-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for XLS-40d + add script to auto-generate models from rippled code #2491
Changes from 31 commits
ff17552
c3afe4e
28cb659
2a6a3d4
f16faa4
8a160e7
a9b97e3
d5d9f30
433a095
2020d0b
085d6cd
306521b
a0a2738
4a9badc
8d62c6c
915d588
f129354
962ea67
1e875bb
b48db6f
6aaaa60
b5b1e14
b921ada
8598831
65667a9
5ea2a87
050795f
1d97c10
4869e67
765a99a
f100d78
97b536c
0d32f82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,5 +167,6 @@ AMM | |
Clawback | ||
fixReducedOffersV1 | ||
fixNFTokenRemint | ||
# 2.0.0-b1 Amendments | ||
# 2.0.0 Amendments | ||
XChainBridge | ||
DID |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { BaseTransaction, validateBaseTransaction } from './common' | ||
|
||
/** | ||
* @category Transaction Models | ||
*/ | ||
export interface DIDDelete extends BaseTransaction { | ||
TransactionType: 'DIDDelete' | ||
} | ||
|
||
/** | ||
* Verify the form and type of a DIDDelete at runtime. | ||
* | ||
* @param tx - A DIDDelete Transaction. | ||
* @throws When the DIDDelete is malformed. | ||
*/ | ||
export function validateDIDDelete(tx: Record<string, unknown>): void { | ||
validateBaseTransaction(tx) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
BaseTransaction, | ||
isString, | ||
validateBaseTransaction, | ||
validateOptionalField, | ||
} from './common' | ||
|
||
/** | ||
* @category Transaction Models | ||
*/ | ||
export interface DIDSet extends BaseTransaction { | ||
TransactionType: 'DIDSet' | ||
|
||
Data?: string | ||
|
||
DIDDocument?: string | ||
mvadari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
URI?: string | ||
} | ||
|
||
/** | ||
* Verify the form and type of a DIDSet at runtime. | ||
* | ||
* @param tx - A DIDSet Transaction. | ||
* @throws When the DIDSet is malformed. | ||
*/ | ||
export function validateDIDSet(tx: Record<string, unknown>): void { | ||
validateBaseTransaction(tx) | ||
|
||
validateOptionalField(tx, 'Data', isString) | ||
|
||
validateOptionalField(tx, 'DIDDocument', isString) | ||
|
||
validateOptionalField(tx, 'URI', isString) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ import { CheckCreate, validateCheckCreate } from './checkCreate' | |
import { Clawback, validateClawback } from './clawback' | ||
import { isIssuedCurrency } from './common' | ||
import { DepositPreauth, validateDepositPreauth } from './depositPreauth' | ||
import { DIDDelete, validateDIDDelete } from './DIDDelete' | ||
import { DIDSet, validateDIDSet } from './DIDSet' | ||
import { EnableAmendment } from './enableAmendment' | ||
import { EscrowCancel, validateEscrowCancel } from './escrowCancel' | ||
import { EscrowCreate, validateEscrowCreate } from './escrowCreate' | ||
|
@@ -91,18 +93,20 @@ import { | |
* @category Transaction Models | ||
*/ | ||
export type Transaction = | ||
| AccountDelete | ||
| AccountSet | ||
| AMMBid | ||
| AMMCreate | ||
| AMMDelete | ||
| AMMDeposit | ||
| AMMCreate | ||
| AMMVote | ||
| AMMWithdraw | ||
| AccountDelete | ||
| AccountSet | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Alphabetically There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Same nit applies below with the case statement if we want to maintain alphabetical order) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was sorting with capitals before lowercase, which makes more sense to me, but if you disagree I'm happy to change that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I personally don't consider capitalization when scanning lists, so I'd prefer to ignore it when sorting alphabetically |
||
| CheckCancel | ||
| CheckCash | ||
| CheckCreate | ||
| Clawback | ||
| DIDDelete | ||
| DIDSet | ||
| DepositPreauth | ||
| EscrowCancel | ||
| EscrowCreate | ||
|
@@ -122,13 +126,13 @@ export type Transaction = | |
| SignerListSet | ||
| TicketCreate | ||
| TrustSet | ||
| XChainAccountCreateCommit | ||
| XChainAddAccountCreateAttestation | ||
| XChainAddClaimAttestation | ||
| XChainClaim | ||
| XChainCommit | ||
| XChainCreateBridge | ||
| XChainCreateClaimID | ||
| XChainAccountCreateCommit | ||
| XChainModifyBridge | ||
|
||
export type PseudoTransaction = EnableAmendment | SetFee | UNLModify | ||
|
@@ -210,18 +214,14 @@ export function validate(transaction: Record<string, unknown>): void { | |
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- okay here | ||
setTransactionFlagsToNumber(tx as unknown as Transaction) | ||
switch (tx.TransactionType) { | ||
case 'AccountDelete': | ||
validateAccountDelete(tx) | ||
break | ||
|
||
case 'AccountSet': | ||
validateAccountSet(tx) | ||
break | ||
|
||
case 'AMMBid': | ||
validateAMMBid(tx) | ||
break | ||
|
||
case 'AMMCreate': | ||
validateAMMCreate(tx) | ||
break | ||
|
||
case 'AMMDelete': | ||
validateAMMDelete(tx) | ||
break | ||
|
@@ -230,10 +230,6 @@ export function validate(transaction: Record<string, unknown>): void { | |
validateAMMDeposit(tx) | ||
break | ||
|
||
case 'AMMCreate': | ||
validateAMMCreate(tx) | ||
break | ||
|
||
case 'AMMVote': | ||
validateAMMVote(tx) | ||
break | ||
|
@@ -242,6 +238,14 @@ export function validate(transaction: Record<string, unknown>): void { | |
validateAMMWithdraw(tx) | ||
break | ||
|
||
case 'AccountDelete': | ||
validateAccountDelete(tx) | ||
break | ||
|
||
case 'AccountSet': | ||
validateAccountSet(tx) | ||
break | ||
|
||
case 'CheckCancel': | ||
validateCheckCancel(tx) | ||
break | ||
|
@@ -258,6 +262,14 @@ export function validate(transaction: Record<string, unknown>): void { | |
validateClawback(tx) | ||
break | ||
|
||
case 'DIDDelete': | ||
validateDIDDelete(tx) | ||
break | ||
|
||
case 'DIDSet': | ||
validateDIDSet(tx) | ||
break | ||
|
||
case 'DepositPreauth': | ||
validateDepositPreauth(tx) | ||
break | ||
|
@@ -334,6 +346,10 @@ export function validate(transaction: Record<string, unknown>): void { | |
validateTrustSet(tx) | ||
break | ||
|
||
case 'XChainAccountCreateCommit': | ||
validateXChainAccountCreateCommit(tx) | ||
break | ||
|
||
case 'XChainAddAccountCreateAttestation': | ||
validateXChainAddAccountCreateAttestation(tx) | ||
break | ||
|
@@ -358,10 +374,6 @@ export function validate(transaction: Record<string, unknown>): void { | |
validateXChainCreateClaimID(tx) | ||
break | ||
|
||
case 'XChainAccountCreateCommit': | ||
validateXChainAccountCreateCommit(tx) | ||
break | ||
|
||
case 'XChainModifyBridge': | ||
validateXChainModifyBridge(tx) | ||
break | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did these fields change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing discrepancies between the
server_definitions
RPC and thexrpl-codec-gen
script. Tests all pass because these fields aren't used for signing, they only exist for rippled technical reasons.