From d8930c5fb80731099ab8609bda398cfe43ab8112 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 6 Feb 2023 12:14:34 -0500 Subject: [PATCH] remove XChainAddAttestationBatch --- .../src/enums/definitions.json | 88 +++---------- .../test/fixtures/codec-fixtures.json | 123 ------------------ .../transactions/XChainAddAttestationBatch.ts | 101 -------------- .../xrpl/src/models/transactions/index.ts | 1 - .../src/models/transactions/transaction.ts | 9 -- 5 files changed, 18 insertions(+), 304 deletions(-) delete mode 100644 packages/xrpl/src/models/transactions/XChainAddAttestationBatch.ts diff --git a/packages/ripple-binary-codec/src/enums/definitions.json b/packages/ripple-binary-codec/src/enums/definitions.json index 89d50f99..2c1e55db 100644 --- a/packages/ripple-binary-codec/src/enums/definitions.json +++ b/packages/ripple-binary-codec/src/enums/definitions.json @@ -1467,16 +1467,6 @@ "type": "Amount" } ], - [ - "XChainFee", - { - "nth": 28, - "isVLEncoded": false, - "isSerialized": true, - "isSigningField": true, - "type": "Amount" - } - ], [ "SignatureReward", { @@ -1837,16 +1827,6 @@ "type": "AccountID" } ], - [ - "ThisChainAccount", - { - "nth": 17, - "isVLEncoded": true, - "isSerialized": true, - "isSigningField": true, - "type": "AccountID" - } - ], [ "OtherChainSource", { @@ -2228,7 +2208,7 @@ } ], [ - "XChainAttestationBatchElement", + "XChainClaimAttestationBatchElement", { "nth": 34, "isVLEncoded": false, @@ -2237,30 +2217,10 @@ "type": "STObject" } ], - [ - "XChainClaimAttestationBatchElement", - { - "nth": 35, - "isVLEncoded": false, - "isSerialized": true, - "isSigningField": true, - "type": "STObject" - } - ], [ "XChainCreateAccountAttestationBatchElement", { - "nth": 36, - "isVLEncoded": false, - "isSerialized": true, - "isSigningField": true, - "type": "STObject" - } - ], - [ - "XChainAttestationBatchInner", - { - "nth": 37, + "nth": 35, "isVLEncoded": false, "isSerialized": true, "isSigningField": true, @@ -2408,7 +2368,7 @@ } ], [ - "XChainProofSigs", + "XChainClaimAttestationBatch", { "nth": 21, "isVLEncoded": false, @@ -2418,7 +2378,7 @@ } ], [ - "XChainClaimAttestationBatch", + "XChainCreateAccountAttestationBatch", { "nth": 22, "isVLEncoded": false, @@ -2428,7 +2388,7 @@ } ], [ - "XChainCreateAccountAttestationBatch", + "XChainClaimAttestations", { "nth": 23, "isVLEncoded": false, @@ -2437,20 +2397,10 @@ "type": "STArray" } ], - [ - "XChainClaimAttestations", - { - "nth": 24, - "isVLEncoded": false, - "isSerialized": true, - "isSigningField": true, - "type": "STArray" - } - ], [ "XChainCreateAccountAttestations", { - "nth": 25, + "nth": 24, "isVLEncoded": false, "isSerialized": true, "isSigningField": true, @@ -2619,16 +2569,15 @@ "tecXCHAIN_CLAIM_NO_QUORUM": 174, "tecXCHAIN_PROOF_UNKNOWN_KEY": 175, "tecXCHAIN_CREATE_ACCOUNT_NONXRP_ISSUE": 176, - "tecXCHAIN_CLAIM_ACCOUNT_DST_EXISTS": 177, - "tecXCHAIN_WRONG_CHAIN": 178, - "tecXCHAIN_REWARD_MISMATCH": 179, - "tecXCHAIN_NO_SIGNERS_LIST": 180, - "tecXCHAIN_SENDING_ACCOUNT_MISMATCH": 181, - "tecXCHAIN_INSUFF_CREATE_AMOUNT": 182, - "tecXCHAIN_ACCOUNT_CREATE_PAST": 183, - "tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 184, - "tecXCHAIN_PAYMENT_FAILED": 185, - "tecXCHAIN_SELF_COMMIT": 186 + "tecXCHAIN_WRONG_CHAIN": 177, + "tecXCHAIN_REWARD_MISMATCH": 178, + "tecXCHAIN_NO_SIGNERS_LIST": 179, + "tecXCHAIN_SENDING_ACCOUNT_MISMATCH": 180, + "tecXCHAIN_INSUFF_CREATE_AMOUNT": 181, + "tecXCHAIN_ACCOUNT_CREATE_PAST": 182, + "tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 183, + "tecXCHAIN_PAYMENT_FAILED": 184, + "tecXCHAIN_SELF_COMMIT": 185 }, "TRANSACTION_TYPES": { "Invalid": -1, @@ -2665,10 +2614,9 @@ "XChainCommit": 42, "XChainClaim": 43, "XChainAccountCreateCommit": 44, - "XChainAddAttestationBatch": 45, - "XChainAddClaimAttestation": 46, - "XChainAddAccountCreateAttestation": 47, - "XChainModifyBridge": 48, + "XChainAddClaimAttestation": 45, + "XChainAddAccountCreateAttestation": 46, + "XChainModifyBridge": 47, "EnableAmendment": 100, "SetFee": 101, "UNLModify": 102 diff --git a/packages/ripple-binary-codec/test/fixtures/codec-fixtures.json b/packages/ripple-binary-codec/test/fixtures/codec-fixtures.json index 4d88f6da..d0925fa4 100644 --- a/packages/ripple-binary-codec/test/fixtures/codec-fixtures.json +++ b/packages/ripple-binary-codec/test/fixtures/codec-fixtures.json @@ -4551,41 +4551,6 @@ "XChainClaimID": "0000000000000001" } }, - { - "binary": "12002D2280000000240000000468400000000000000A73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074473045022100A6A8CA05B2B6CB60E0FD645A4DA0314D46D79D9FA3D63307FC997357366151B202202266CC23E2CA827905F37F78F54AD435F73A3B704EDD634B89201E23625CE2E28114B5F762798A53D543A014CAF8B297CFF8F2F937E8011A14C48CAD01682D7A86296EF14523074D4852C02EA9000000000000000000000000000000000000000014CC86E58C9B58D4CF71CB8C1B41F21BB290CE13D40000000000000000000000000000000000000000E02330140000000000000000614000000005F5E100712103DAB289CA36FF377F3F4304C7A7203FDE5EDCBFC209F430F6A4355361425526D0760361626381142F3CC37C1D5616B3BBF1AABC49F6BFF46A9200878314621D345F8F094A085132431C69C89EC05D212CC28015142F3CC37C1D5616B3BBF1AABC49F6BFF46A92008700101301E1F1F1", - "json": { - "Account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "Fee" : "10", - "Flags" : 2147483648, - "Sequence" : 4, - "SigningPubKey" : "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020", - "TransactionType" : "XChainAddAttestationBatch", - "TxnSignature" : "3045022100A6A8CA05B2B6CB60E0FD645A4DA0314D46D79D9FA3D63307FC997357366151B202202266CC23E2CA827905F37F78F54AD435F73A3B704EDD634B89201E23625CE2E2", - "XChainAttestationBatch" : { - "XChainBridge" : { - "IssuingChainDoor" : "rKeSSvHvaMZJp9ykaxutVwkhZgWuWMLnQt", - "IssuingChainIssue" : {"currency": "XRP"}, - "LockingChainDoor" : "rJvExveLEL4jNDEeLKCVdxaSCN9cEBnEQC", - "LockingChainIssue" : {"currency": "XRP"} - }, - "XChainClaimAttestationBatch" : [ - { - "XChainClaimAttestationBatchElement" : { - "Account" : "rnJmYAiqEVngtnb5ckRroXLtCbWC7CRUBx", - "Amount" : "100000000", - "AttestationRewardAccount" : "rnJmYAiqEVngtnb5ckRroXLtCbWC7CRUBx", - "Destination" : "r9A8UyNpW3X46FUc6P7JZqgn6WgAPjBwPg", - "PublicKey" : "03DAB289CA36FF377F3F4304C7A7203FDE5EDCBFC209F430F6A4355361425526D0", - "Signature" : "616263", - "WasLockingChainSend" : 1, - "XChainClaimID" : "0000000000000000" - } - } - ], - "XChainCreateAccountAttestationBatch" : [] - } - } - }, { "binary": "12002C228000000024000000016140000000000F424068400000000000000A601D400000000000271073210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0207446304402202984DDE7F0B566F081F7953D7212BF031ACBF8860FE114102E9512C4C8768C77022070113F4630B1DC3045E4A98DDD648CEBC31B12774F7B44A1B8123CD2C9F5CF188114B5F762798A53D543A014CAF8B297CFF8F2F937E88314AF80285F637EE4AF3C20378F9DFB12511ACB8D27011914AF80285F637EE4AF3C20378F9DFB12511ACB8D27000000000000000000000000000000000000000014550FC62003E785DC231A1058A05E56E3F09CF4E60000000000000000000000000000000000000000", "json": { @@ -4606,94 +4571,6 @@ "TransactionType": "XChainAccountCreateCommit", "TxnSignature": "304402202984DDE7F0B566F081F7953D7212BF031ACBF8860FE114102E9512C4C8768C77022070113F4630B1DC3045E4A98DDD648CEBC31B12774F7B44A1B8123CD2C9F5CF18" } - }, - { - "binary": "12002D2280000000240000000168400000000000000A73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0207447304502210098F47661D8EF89CC2DFF3EAA92AF3843CEFD398EAD1E7496FAEAC269DE688FB80220143EBE519FC1936E884B1AFA047D4CB7CD2E2A28F0B27EC982D1BB3E63FC95358114B5F762798A53D543A014CAF8B297CFF8F2F937E8011A14C48CAD01682D7A86296EF14523074D4852C02EA9000000000000000000000000000000000000000014CC86E58C9B58D4CF71CB8C1B41F21BB290CE13D40000000000000000000000000000000000000000F1E0243015000000000000000161400000003B9ACA00601D40000000000F4240712103ADB44CA8E56F78A0096825E5667C450ABD5C24C34E027BC1AAF7E5BD114CB5B576463044022036C8B90F85E8073C465F00625248A72D4714600F98EBBADBAD3B7ED226109A3A02204C5A0AE12D169CF790F66541F3DB59C289E0D99CA7511FDFE352BB601F667A2681142F3CC37C1D5616B3BBF1AABC49F6BFF46A9200878314CA64525733C3BEED910CFE2AE280D3C078DABB4B801514A482A071D77722C2B683FFE01DC30134035E8E7200101301E1E0243015000000000000000161400000003B9ACA00601D40000000000F4240712102A14E886B3C3579FBAE3139F29728B903E6F4295AEE92160C8480695524D66A157646304402200C3F5EEE2D7DCB609EE8558258E6AAF1EF823133C2B7C716E0DC9AAD2110F08D0220180E9F285CB2F78E362D37E947C000A8ED60A4BD8EFF21F74C5E529E1A8870ED81142F3CC37C1D5616B3BBF1AABC49F6BFF46A9200878314CA64525733C3BEED910CFE2AE280D3C078DABB4B801514A482A071D77722C2B683FFE01DC30134035E8E7200101301E1E0243015000000000000000161400000003B9ACA00601D40000000000F4240712102F7390DCF3352060847B81666EBAC79D52DEA2443BDF58439F75397C45334E2DC764730450221008E31CFF0198F09CBA8610A946C23E170A3F11BCB8FC95D0D56C7B79A126D97D102203F4E952C449F2F01C4AF67FC37772A0D4459D770387CC11DBD5464FAB218542881142F3CC37C1D5616B3BBF1AABC49F6BFF46A9200878314CA64525733C3BEED910CFE2AE280D3C078DABB4B801514A482A071D77722C2B683FFE01DC30134035E8E7200101301E1E0243015000000000000000161400000003B9ACA00601D40000000000F4240712102498BD8CD9CA6A4BA567A2ECFA163F118AFD30511CBBA71429C2EC2F74D76059276473045022100F4E2D672F456CB9929EF01766AB72B42C71314A181232098563B8666E4EEA49C02203F936877E9DCC8FF5F7713579233985DF3DADB155F2BDA78FE3A4321373F370E81142F3CC37C1D5616B3BBF1AABC49F6BFF46A9200878314CA64525733C3BEED910CFE2AE280D3C078DABB4B801514A482A071D77722C2B683FFE01DC30134035E8E7200101301E1E0243015000000000000000161400000003B9ACA00601D40000000000F4240712103219642288DEE8A3AA8FEA1F7DAE9ED4D9A9F0EADA1E2DE3DB56DD9598D9AD81776473045022100D1BAFA57F40E16485310698B7B0BD0D4650E18782C4D65787A393CBB6D659EB802204EA28303089CCCD1463866A1BA0493A9B135AEA1EDFC8DD69A1A247DD9FEDB2181142F3CC37C1D5616B3BBF1AABC49F6BFF46A9200878314CA64525733C3BEED910CFE2AE280D3C078DABB4B801514A482A071D77722C2B683FFE01DC30134035E8E7200101301E1F1", - "json": { - "Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "Fee": "10", - "Flags": 2147483648, - "Sequence": 1, - "SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020", - "TransactionType": "XChainAddAttestationBatch", - "TxnSignature": "304502210098F47661D8EF89CC2DFF3EAA92AF3843CEFD398EAD1E7496FAEAC269DE688FB80220143EBE519FC1936E884B1AFA047D4CB7CD2E2A28F0B27EC982D1BB3E63FC9535", - "XChainAttestationBatch": { - "XChainBridge": { - "IssuingChainDoor": "rKeSSvHvaMZJp9ykaxutVwkhZgWuWMLnQt", - "IssuingChainIssue": {"currency": "XRP"}, - "LockingChainDoor": "rJvExveLEL4jNDEeLKCVdxaSCN9cEBnEQC", - "LockingChainIssue": {"currency": "XRP"} - }, - "XChainClaimAttestationBatch": [], - "XChainCreateAccountAttestationBatch": [ - { - "XChainCreateAccountAttestationBatchElement": { - "Account": "rnJmYAiqEVngtnb5ckRroXLtCbWC7CRUBx", - "Amount": "1000000000", - "AttestationRewardAccount": "rEziJZmeZzsJvGVUmpUTey7qxQLKYxaK9f", - "Destination": "rKT9gDkaedAosiHyHZTjyZs2HvXpzuiGmC", - "PublicKey": "03ADB44CA8E56F78A0096825E5667C450ABD5C24C34E027BC1AAF7E5BD114CB5B5", - "Signature": "3044022036C8B90F85E8073C465F00625248A72D4714600F98EBBADBAD3B7ED226109A3A02204C5A0AE12D169CF790F66541F3DB59C289E0D99CA7511FDFE352BB601F667A26", - "SignatureReward": "1000000", - "WasLockingChainSend": 1, - "XChainAccountCreateCount": "0000000000000001" - } - }, - { - "XChainCreateAccountAttestationBatchElement": { - "Account": "rnJmYAiqEVngtnb5ckRroXLtCbWC7CRUBx", - "Amount": "1000000000", - "AttestationRewardAccount": "rEziJZmeZzsJvGVUmpUTey7qxQLKYxaK9f", - "Destination": "rKT9gDkaedAosiHyHZTjyZs2HvXpzuiGmC", - "PublicKey": "02A14E886B3C3579FBAE3139F29728B903E6F4295AEE92160C8480695524D66A15", - "Signature": "304402200C3F5EEE2D7DCB609EE8558258E6AAF1EF823133C2B7C716E0DC9AAD2110F08D0220180E9F285CB2F78E362D37E947C000A8ED60A4BD8EFF21F74C5E529E1A8870ED", - "SignatureReward": "1000000", - "WasLockingChainSend": 1, - "XChainAccountCreateCount": "0000000000000001" - } - }, - { - "XChainCreateAccountAttestationBatchElement": { - "Account": "rnJmYAiqEVngtnb5ckRroXLtCbWC7CRUBx", - "Amount": "1000000000", - "AttestationRewardAccount": "rEziJZmeZzsJvGVUmpUTey7qxQLKYxaK9f", - "Destination": "rKT9gDkaedAosiHyHZTjyZs2HvXpzuiGmC", - "PublicKey": "02F7390DCF3352060847B81666EBAC79D52DEA2443BDF58439F75397C45334E2DC", - "Signature": "30450221008E31CFF0198F09CBA8610A946C23E170A3F11BCB8FC95D0D56C7B79A126D97D102203F4E952C449F2F01C4AF67FC37772A0D4459D770387CC11DBD5464FAB2185428", - "SignatureReward": "1000000", - "WasLockingChainSend": 1, - "XChainAccountCreateCount": "0000000000000001" - } - }, - { - "XChainCreateAccountAttestationBatchElement": { - "Account": "rnJmYAiqEVngtnb5ckRroXLtCbWC7CRUBx", - "Amount": "1000000000", - "AttestationRewardAccount": "rEziJZmeZzsJvGVUmpUTey7qxQLKYxaK9f", - "Destination": "rKT9gDkaedAosiHyHZTjyZs2HvXpzuiGmC", - "PublicKey": "02498BD8CD9CA6A4BA567A2ECFA163F118AFD30511CBBA71429C2EC2F74D760592", - "Signature": "3045022100F4E2D672F456CB9929EF01766AB72B42C71314A181232098563B8666E4EEA49C02203F936877E9DCC8FF5F7713579233985DF3DADB155F2BDA78FE3A4321373F370E", - "SignatureReward": "1000000", - "WasLockingChainSend": 1, - "XChainAccountCreateCount": "0000000000000001" - } - }, - { - "XChainCreateAccountAttestationBatchElement": { - "Account": "rnJmYAiqEVngtnb5ckRroXLtCbWC7CRUBx", - "Amount": "1000000000", - "AttestationRewardAccount": "rEziJZmeZzsJvGVUmpUTey7qxQLKYxaK9f", - "Destination": "rKT9gDkaedAosiHyHZTjyZs2HvXpzuiGmC", - "PublicKey": "03219642288DEE8A3AA8FEA1F7DAE9ED4D9A9F0EADA1E2DE3DB56DD9598D9AD817", - "Signature": "3045022100D1BAFA57F40E16485310698B7B0BD0D4650E18782C4D65787A393CBB6D659EB802204EA28303089CCCD1463866A1BA0493A9B135AEA1EDFC8DD69A1A247DD9FEDB21", - "SignatureReward": "1000000", - "WasLockingChainSend": 1, - "XChainAccountCreateCount": "0000000000000001" - } - } - ] - } - } } ], "ledgerData": [{ diff --git a/packages/xrpl/src/models/transactions/XChainAddAttestationBatch.ts b/packages/xrpl/src/models/transactions/XChainAddAttestationBatch.ts deleted file mode 100644 index 61d6f78a..00000000 --- a/packages/xrpl/src/models/transactions/XChainAddAttestationBatch.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { ValidationError } from '../../errors' -import { Amount, XChainBridge } from '../common' - -import { BaseTransaction, validateBaseTransaction } from './common' - -/** - * - * @category Transaction Models - */ -export interface XChainAddAttestationBatch extends BaseTransaction { - TransactionType: 'XChainAddAttestationBatch' - - XChainAttestationBatch: { - XChainBridge: XChainBridge - - XChainClaimAttestationBatch: Array<{ - XChainClaimAttestationBatchElement: { - Account: string - - Amount: Amount - - AttestationRewardAccount: string - - Destination?: string - - PublicKey: string - - Signature: string - - WasLockingChainSend: 0 | 1 - - XChainClaimID: string - } - }> - - XChainCreateAccountAttestationBatch: Array<{ - XChainCreateAccountAttestationBatchElement: { - Account: string - - Amount: Amount - - AttestationRewardAccount: string - - Destination: string - - PublicKey: string - - Signature: string - - WasLockingChainSend: 0 | 1 - - XChainAccountCreateCount: string - } - }> - } -} - -/** - * Verify the form and type of a XChainAddAttestationBatch at runtime. - * - * @param tx - A XChainAddAttestationBatch Transaction. - * @throws When the XChainAddAttestationBatch is malformed. - */ -export function validateXChainAddAttestationBatch( - tx: Record, -): void { - validateBaseTransaction(tx) - - if (tx.XChainAttestationBatch == null) { - throw new ValidationError( - 'XChainAddAttestationBatch: missing field XChainAttestationBatch', - ) - } - - if (typeof tx.XChainAttestationBatch !== 'object') { - throw new ValidationError( - 'XChainAddAttestationBatch: XChainAttestationBatch must be an object', - ) - } - - /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- known to be this */ - const attestationBatch = tx.XChainAttestationBatch as Record - - if (attestationBatch.XChainBridge == null) { - throw new ValidationError( - 'XChainAddAttestationBatch: missing field XChainAttestationBatch.XChainBridge', - ) - } - - if (attestationBatch.XChainClaimAttestationBatch == null) { - throw new ValidationError( - 'XChainAddAttestationBatch: missing field XChainAttestationBatch.XChainClaimAttestationBatch', - ) - } - - if (attestationBatch.XChainCreateAccountAttestationBatch == null) { - throw new ValidationError( - 'XChainAddAttestationBatch: missing field XChainAttestationBatch.XChainCreateAccountAttestationBatch', - ) - } -} diff --git a/packages/xrpl/src/models/transactions/index.ts b/packages/xrpl/src/models/transactions/index.ts index 13a7668f..492739e3 100644 --- a/packages/xrpl/src/models/transactions/index.ts +++ b/packages/xrpl/src/models/transactions/index.ts @@ -46,7 +46,6 @@ export { SignerListSet } from './signerListSet' export { TicketCreate } from './ticketCreate' export { TrustSetFlagsInterface, TrustSetFlags, TrustSet } from './trustSet' export { XChainAddAccountCreateAttestation } from './XChainAddAccountCreateAttestation' -export { XChainAddAttestationBatch } from './XChainAddAttestationBatch' export { XChainAddClaimAttestation } from './XChainAddClaimAttestation' export { XChainClaim } from './XChainClaim' export { XChainCommit } from './XChainCommit' diff --git a/packages/xrpl/src/models/transactions/transaction.ts b/packages/xrpl/src/models/transactions/transaction.ts index 2f3c0ff8..dc0219de 100644 --- a/packages/xrpl/src/models/transactions/transaction.ts +++ b/packages/xrpl/src/models/transactions/transaction.ts @@ -58,10 +58,6 @@ import { XChainAddAccountCreateAttestation, validateXChainAddAccountCreateAttestation, } from './XChainAddAccountCreateAttestation' -import { - XChainAddAttestationBatch, - validateXChainAddAttestationBatch, -} from './XChainAddAttestationBatch' import { XChainAddClaimAttestation, validateXChainAddClaimAttestation, @@ -110,7 +106,6 @@ export type Transaction = | TicketCreate | TrustSet | XChainAddAccountCreateAttestation - | XChainAddAttestationBatch | XChainAddClaimAttestation | XChainClaim | XChainCommit @@ -246,10 +241,6 @@ export function validate(transaction: Record): void { validateXChainAddAccountCreateAttestation(tx) break - case 'XChainAddAttestationBatch': - validateXChainAddAttestationBatch(tx) - break - case 'XChainAddClaimAttestation': validateXChainAddClaimAttestation(tx) break