xrpl 2.12.0-beta.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/xrpl-latest-min.js +1 -1
- package/build/xrpl-latest-min.js.map +1 -1
- package/build/xrpl-latest.js +139 -312
- package/build/xrpl-latest.js.map +1 -1
- package/dist/npm/models/common/index.d.ts +2 -1
- package/dist/npm/models/common/index.d.ts.map +1 -1
- package/dist/npm/models/ledger/AMM.d.ts +5 -3
- package/dist/npm/models/ledger/AMM.d.ts.map +1 -1
- package/dist/npm/models/ledger/AccountRoot.d.ts +1 -0
- package/dist/npm/models/ledger/AccountRoot.d.ts.map +1 -1
- package/dist/npm/models/ledger/AccountRoot.js.map +1 -1
- package/dist/npm/models/ledger/XChainOwnedClaimID.d.ts +11 -1
- package/dist/npm/models/ledger/XChainOwnedClaimID.d.ts.map +1 -1
- package/dist/npm/models/ledger/XChainOwnedCreateAccountClaimID.d.ts +10 -1
- package/dist/npm/models/ledger/XChainOwnedCreateAccountClaimID.d.ts.map +1 -1
- package/dist/npm/models/ledger/index.d.ts +2 -1
- package/dist/npm/models/ledger/index.d.ts.map +1 -1
- package/dist/npm/models/ledger/index.js.map +1 -1
- package/dist/npm/models/methods/accountObjects.d.ts +3 -3
- package/dist/npm/models/methods/accountObjects.d.ts.map +1 -1
- package/dist/npm/models/methods/ammInfo.d.ts +4 -3
- package/dist/npm/models/methods/ammInfo.d.ts.map +1 -1
- package/dist/npm/models/methods/ledgerEntry.d.ts +4 -4
- package/dist/npm/models/methods/ledgerEntry.d.ts.map +1 -1
- package/dist/npm/models/methods/serverInfo.d.ts +6 -0
- package/dist/npm/models/methods/serverInfo.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMBid.d.ts +3 -3
- package/dist/npm/models/transactions/AMMBid.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMBid.js.map +1 -1
- package/dist/npm/models/transactions/AMMDeposit.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMDeposit.js.map +1 -1
- package/dist/npm/models/transactions/AMMWithdraw.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMWithdraw.js.map +1 -1
- package/dist/npm/models/transactions/XChainAccountCreateCommit.d.ts.map +1 -1
- package/dist/npm/models/transactions/XChainAccountCreateCommit.js +5 -26
- package/dist/npm/models/transactions/XChainAccountCreateCommit.js.map +1 -1
- package/dist/npm/models/transactions/XChainAddAccountCreateAttestation.d.ts.map +1 -1
- package/dist/npm/models/transactions/XChainAddAccountCreateAttestation.js +11 -68
- package/dist/npm/models/transactions/XChainAddAccountCreateAttestation.js.map +1 -1
- package/dist/npm/models/transactions/XChainAddClaimAttestation.d.ts.map +1 -1
- package/dist/npm/models/transactions/XChainAddClaimAttestation.js +10 -59
- package/dist/npm/models/transactions/XChainAddClaimAttestation.js.map +1 -1
- package/dist/npm/models/transactions/XChainClaim.d.ts.map +1 -1
- package/dist/npm/models/transactions/XChainClaim.js +5 -30
- package/dist/npm/models/transactions/XChainClaim.js.map +1 -1
- package/dist/npm/models/transactions/XChainCommit.d.ts.map +1 -1
- package/dist/npm/models/transactions/XChainCommit.js +4 -24
- package/dist/npm/models/transactions/XChainCommit.js.map +1 -1
- package/dist/npm/models/transactions/XChainCreateBridge.d.ts.map +1 -1
- package/dist/npm/models/transactions/XChainCreateBridge.js +3 -17
- package/dist/npm/models/transactions/XChainCreateBridge.js.map +1 -1
- package/dist/npm/models/transactions/XChainCreateClaimID.d.ts.map +1 -1
- package/dist/npm/models/transactions/XChainCreateClaimID.js +3 -19
- package/dist/npm/models/transactions/XChainCreateClaimID.js.map +1 -1
- package/dist/npm/models/transactions/XChainModifyBridge.d.ts.map +1 -1
- package/dist/npm/models/transactions/XChainModifyBridge.js +3 -14
- package/dist/npm/models/transactions/XChainModifyBridge.js.map +1 -1
- package/dist/npm/models/transactions/accountSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/accountSet.js.map +1 -1
- package/dist/npm/models/transactions/checkCash.d.ts.map +1 -1
- package/dist/npm/models/transactions/checkCash.js.map +1 -1
- package/dist/npm/models/transactions/checkCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/checkCreate.js.map +1 -1
- package/dist/npm/models/transactions/common.d.ts +4 -0
- package/dist/npm/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/models/transactions/common.js +33 -38
- package/dist/npm/models/transactions/common.js.map +1 -1
- package/dist/npm/models/transactions/depositPreauth.d.ts.map +1 -1
- package/dist/npm/models/transactions/depositPreauth.js.map +1 -1
- package/dist/npm/models/transactions/escrowCancel.d.ts +1 -1
- package/dist/npm/models/transactions/escrowCancel.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowCancel.js +5 -3
- package/dist/npm/models/transactions/escrowCancel.js.map +1 -1
- package/dist/npm/models/transactions/escrowCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowCreate.js.map +1 -1
- package/dist/npm/models/transactions/escrowFinish.d.ts +1 -1
- package/dist/npm/models/transactions/escrowFinish.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowFinish.js +5 -3
- package/dist/npm/models/transactions/escrowFinish.js.map +1 -1
- package/dist/npm/models/transactions/offerCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/offerCreate.js.map +1 -1
- package/dist/npm/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/models/transactions/payment.js.map +1 -1
- package/dist/npm/models/transactions/paymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/models/transactions/paymentChannelClaim.js.map +1 -1
- package/dist/npm/models/transactions/paymentChannelCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/paymentChannelCreate.js.map +1 -1
- package/dist/npm/models/transactions/signerListSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/signerListSet.js.map +1 -1
- package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/models/transactions/transaction.js.map +1 -1
- package/dist/npm/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/models/utils/flags.js.map +1 -1
- package/dist/npm/snippets/src/bridgeTransfer.js +12 -10
- package/dist/npm/snippets/src/bridgeTransfer.js.map +1 -1
- package/dist/npm/src/models/common/index.d.ts +2 -1
- package/dist/npm/src/models/common/index.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/AMM.d.ts +5 -3
- package/dist/npm/src/models/ledger/AMM.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/AccountRoot.d.ts +1 -0
- package/dist/npm/src/models/ledger/AccountRoot.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/AccountRoot.js.map +1 -1
- package/dist/npm/src/models/ledger/XChainOwnedClaimID.d.ts +11 -1
- package/dist/npm/src/models/ledger/XChainOwnedClaimID.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/XChainOwnedCreateAccountClaimID.d.ts +10 -1
- package/dist/npm/src/models/ledger/XChainOwnedCreateAccountClaimID.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/index.d.ts +2 -1
- package/dist/npm/src/models/ledger/index.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/index.js.map +1 -1
- package/dist/npm/src/models/methods/accountObjects.d.ts +3 -3
- package/dist/npm/src/models/methods/accountObjects.d.ts.map +1 -1
- package/dist/npm/src/models/methods/ammInfo.d.ts +4 -3
- package/dist/npm/src/models/methods/ammInfo.d.ts.map +1 -1
- package/dist/npm/src/models/methods/ledgerEntry.d.ts +4 -4
- package/dist/npm/src/models/methods/ledgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/methods/serverInfo.d.ts +6 -0
- package/dist/npm/src/models/methods/serverInfo.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMBid.d.ts +3 -3
- package/dist/npm/src/models/transactions/AMMBid.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMBid.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMDeposit.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMDeposit.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMWithdraw.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMWithdraw.js.map +1 -1
- package/dist/npm/src/models/transactions/XChainAccountCreateCommit.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/XChainAccountCreateCommit.js +5 -26
- package/dist/npm/src/models/transactions/XChainAccountCreateCommit.js.map +1 -1
- package/dist/npm/src/models/transactions/XChainAddAccountCreateAttestation.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/XChainAddAccountCreateAttestation.js +11 -68
- package/dist/npm/src/models/transactions/XChainAddAccountCreateAttestation.js.map +1 -1
- package/dist/npm/src/models/transactions/XChainAddClaimAttestation.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/XChainAddClaimAttestation.js +10 -59
- package/dist/npm/src/models/transactions/XChainAddClaimAttestation.js.map +1 -1
- package/dist/npm/src/models/transactions/XChainClaim.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/XChainClaim.js +5 -30
- package/dist/npm/src/models/transactions/XChainClaim.js.map +1 -1
- package/dist/npm/src/models/transactions/XChainCommit.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/XChainCommit.js +4 -24
- package/dist/npm/src/models/transactions/XChainCommit.js.map +1 -1
- package/dist/npm/src/models/transactions/XChainCreateBridge.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/XChainCreateBridge.js +3 -17
- package/dist/npm/src/models/transactions/XChainCreateBridge.js.map +1 -1
- package/dist/npm/src/models/transactions/XChainCreateClaimID.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/XChainCreateClaimID.js +3 -19
- package/dist/npm/src/models/transactions/XChainCreateClaimID.js.map +1 -1
- package/dist/npm/src/models/transactions/XChainModifyBridge.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/XChainModifyBridge.js +3 -14
- package/dist/npm/src/models/transactions/XChainModifyBridge.js.map +1 -1
- package/dist/npm/src/models/transactions/accountSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/accountSet.js.map +1 -1
- package/dist/npm/src/models/transactions/checkCash.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/checkCash.js.map +1 -1
- package/dist/npm/src/models/transactions/checkCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/checkCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/common.d.ts +4 -0
- package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/common.js +33 -38
- package/dist/npm/src/models/transactions/common.js.map +1 -1
- package/dist/npm/src/models/transactions/depositPreauth.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/depositPreauth.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowCancel.d.ts +1 -1
- package/dist/npm/src/models/transactions/escrowCancel.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowCancel.js +5 -3
- package/dist/npm/src/models/transactions/escrowCancel.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.d.ts +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.js +5 -3
- package/dist/npm/src/models/transactions/escrowFinish.js.map +1 -1
- package/dist/npm/src/models/transactions/offerCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/offerCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/payment.js.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelClaim.js.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/signerListSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/signerListSet.js.map +1 -1
- package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/transaction.js.map +1 -1
- package/dist/npm/src/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/src/models/utils/flags.js.map +1 -1
- package/dist/npm/src/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/src/sugar/autofill.js.map +1 -1
- package/dist/npm/src/utils/getXChainClaimID.d.ts +3 -0
- package/dist/npm/src/utils/getXChainClaimID.d.ts.map +1 -0
- package/dist/npm/src/utils/getXChainClaimID.js +29 -0
- package/dist/npm/src/utils/getXChainClaimID.js.map +1 -0
- package/dist/npm/src/utils/index.d.ts +2 -1
- package/dist/npm/src/utils/index.d.ts.map +1 -1
- package/dist/npm/src/utils/index.js +3 -1
- package/dist/npm/src/utils/index.js.map +1 -1
- package/dist/npm/src/utils/signPaymentChannelClaim.d.ts +1 -1
- package/dist/npm/src/utils/signPaymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/src/utils/signPaymentChannelClaim.js +2 -2
- package/dist/npm/src/utils/signPaymentChannelClaim.js.map +1 -1
- package/dist/npm/src/utils/verifyPaymentChannelClaim.d.ts +1 -1
- package/dist/npm/src/utils/verifyPaymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/src/utils/verifyPaymentChannelClaim.js +2 -2
- package/dist/npm/src/utils/verifyPaymentChannelClaim.js.map +1 -1
- package/dist/npm/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/sugar/autofill.js.map +1 -1
- package/dist/npm/utils/getXChainClaimID.d.ts +3 -0
- package/dist/npm/utils/getXChainClaimID.d.ts.map +1 -0
- package/dist/npm/utils/getXChainClaimID.js +29 -0
- package/dist/npm/utils/getXChainClaimID.js.map +1 -0
- package/dist/npm/utils/index.d.ts +2 -1
- package/dist/npm/utils/index.d.ts.map +1 -1
- package/dist/npm/utils/index.js +3 -1
- package/dist/npm/utils/index.js.map +1 -1
- package/dist/npm/utils/signPaymentChannelClaim.d.ts +1 -1
- package/dist/npm/utils/signPaymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/utils/signPaymentChannelClaim.js +2 -2
- package/dist/npm/utils/signPaymentChannelClaim.js.map +1 -1
- package/dist/npm/utils/verifyPaymentChannelClaim.d.ts +1 -1
- package/dist/npm/utils/verifyPaymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/utils/verifyPaymentChannelClaim.js +2 -2
- package/dist/npm/utils/verifyPaymentChannelClaim.js.map +1 -1
- package/package.json +6 -7
- package/src/models/common/index.ts +2 -1
- package/src/models/ledger/AMM.ts +11 -3
- package/src/models/ledger/AccountRoot.ts +6 -0
- package/src/models/ledger/XChainOwnedClaimID.ts +18 -2
- package/src/models/ledger/XChainOwnedCreateAccountClaimID.ts +16 -2
- package/src/models/ledger/index.ts +3 -0
- package/src/models/methods/accountObjects.ts +3 -0
- package/src/models/methods/ammInfo.ts +8 -3
- package/src/models/methods/ledgerEntry.ts +4 -4
- package/src/models/methods/serverInfo.ts +21 -0
- package/src/models/transactions/AMMBid.ts +5 -6
- package/src/models/transactions/AMMDeposit.ts +0 -1
- package/src/models/transactions/AMMWithdraw.ts +0 -1
- package/src/models/transactions/XChainAccountCreateCommit.ts +9 -47
- package/src/models/transactions/XChainAddAccountCreateAttestation.ts +34 -138
- package/src/models/transactions/XChainAddClaimAttestation.ts +33 -116
- package/src/models/transactions/XChainClaim.ts +15 -41
- package/src/models/transactions/XChainCommit.ts +14 -35
- package/src/models/transactions/XChainCreateBridge.ts +7 -29
- package/src/models/transactions/XChainCreateClaimID.ts +7 -32
- package/src/models/transactions/XChainModifyBridge.ts +7 -23
- package/src/models/transactions/accountSet.ts +0 -2
- package/src/models/transactions/checkCash.ts +0 -1
- package/src/models/transactions/checkCreate.ts +0 -1
- package/src/models/transactions/common.ts +82 -53
- package/src/models/transactions/depositPreauth.ts +0 -1
- package/src/models/transactions/escrowCancel.ts +8 -4
- package/src/models/transactions/escrowCreate.ts +0 -1
- package/src/models/transactions/escrowFinish.ts +8 -4
- package/src/models/transactions/offerCreate.ts +0 -1
- package/src/models/transactions/payment.ts +0 -1
- package/src/models/transactions/paymentChannelClaim.ts +0 -1
- package/src/models/transactions/paymentChannelCreate.ts +0 -1
- package/src/models/transactions/signerListSet.ts +0 -1
- package/src/models/transactions/transaction.ts +0 -1
- package/src/models/utils/flags.ts +0 -1
- package/src/sugar/autofill.ts +0 -2
- package/src/utils/getXChainClaimID.ts +64 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/signPaymentChannelClaim.ts +3 -3
- package/src/utils/verifyPaymentChannelClaim.ts +3 -3
- package/dist/npm/snippets/tsconfig.tsbuildinfo +0 -1
@@ -1,11 +1,14 @@
|
|
1
|
-
import { ValidationError } from '../../errors'
|
2
1
|
import { Amount, XChainBridge } from '../common'
|
3
2
|
|
4
3
|
import {
|
5
4
|
BaseTransaction,
|
6
5
|
isAmount,
|
6
|
+
isNumber,
|
7
|
+
isString,
|
7
8
|
isXChainBridge,
|
8
9
|
validateBaseTransaction,
|
10
|
+
validateOptionalField,
|
11
|
+
validateRequiredField,
|
9
12
|
} from './common'
|
10
13
|
|
11
14
|
/**
|
@@ -72,127 +75,41 @@ export interface XChainAddClaimAttestation extends BaseTransaction {
|
|
72
75
|
}
|
73
76
|
|
74
77
|
/**
|
75
|
-
* Verify the form and type of
|
78
|
+
* Verify the form and type of an XChainAddClaimAttestation at runtime.
|
76
79
|
*
|
77
|
-
* @param tx -
|
80
|
+
* @param tx - An XChainAddClaimAttestation Transaction.
|
78
81
|
* @throws When the XChainAddClaimAttestation is malformed.
|
79
82
|
*/
|
80
|
-
// eslint-disable-next-line max-lines-per-function, max-statements, complexity -- okay for this function, lots of things to check
|
81
83
|
export function validateXChainAddClaimAttestation(
|
82
84
|
tx: Record<string, unknown>,
|
83
85
|
): void {
|
84
86
|
validateBaseTransaction(tx)
|
85
87
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
)
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
throw new ValidationError(
|
114
|
-
'XChainAddClaimAttestation: invalid field AttestationSignerAccount',
|
115
|
-
)
|
116
|
-
}
|
117
|
-
|
118
|
-
if (tx.Destination !== undefined && typeof tx.Destination !== 'string') {
|
119
|
-
throw new ValidationError(
|
120
|
-
'XChainAddClaimAttestation: invalid field Destination',
|
121
|
-
)
|
122
|
-
}
|
123
|
-
|
124
|
-
if (tx.OtherChainSource == null) {
|
125
|
-
throw new ValidationError(
|
126
|
-
'XChainAddClaimAttestation: missing field OtherChainSource',
|
127
|
-
)
|
128
|
-
}
|
129
|
-
|
130
|
-
if (typeof tx.OtherChainSource !== 'string') {
|
131
|
-
throw new ValidationError(
|
132
|
-
'XChainAddClaimAttestation: invalid field OtherChainSource',
|
133
|
-
)
|
134
|
-
}
|
135
|
-
|
136
|
-
if (tx.PublicKey == null) {
|
137
|
-
throw new ValidationError(
|
138
|
-
'XChainAddClaimAttestation: missing field PublicKey',
|
139
|
-
)
|
140
|
-
}
|
141
|
-
|
142
|
-
if (typeof tx.PublicKey !== 'string') {
|
143
|
-
throw new ValidationError(
|
144
|
-
'XChainAddClaimAttestation: invalid field PublicKey',
|
145
|
-
)
|
146
|
-
}
|
147
|
-
|
148
|
-
if (tx.Signature == null) {
|
149
|
-
throw new ValidationError(
|
150
|
-
'XChainAddClaimAttestation: missing field Signature',
|
151
|
-
)
|
152
|
-
}
|
153
|
-
|
154
|
-
if (typeof tx.Signature !== 'string') {
|
155
|
-
throw new ValidationError(
|
156
|
-
'XChainAddClaimAttestation: invalid field Signature',
|
157
|
-
)
|
158
|
-
}
|
159
|
-
|
160
|
-
if (tx.WasLockingChainSend == null) {
|
161
|
-
throw new ValidationError(
|
162
|
-
'XChainAddClaimAttestation: missing field WasLockingChainSend',
|
163
|
-
)
|
164
|
-
}
|
165
|
-
|
166
|
-
if (tx.WasLockingChainSend !== 0 && tx.WasLockingChainSend !== 1) {
|
167
|
-
throw new ValidationError(
|
168
|
-
'XChainAddClaimAttestation: invalid field WasLockingChainSend',
|
169
|
-
)
|
170
|
-
}
|
171
|
-
|
172
|
-
if (tx.XChainBridge == null) {
|
173
|
-
throw new ValidationError(
|
174
|
-
'XChainAddClaimAttestation: missing field XChainBridge',
|
175
|
-
)
|
176
|
-
}
|
177
|
-
|
178
|
-
if (!isXChainBridge(tx.XChainBridge)) {
|
179
|
-
throw new ValidationError(
|
180
|
-
'XChainAddClaimAttestation: invalid field XChainBridge',
|
181
|
-
)
|
182
|
-
}
|
183
|
-
|
184
|
-
if (tx.XChainClaimID == null) {
|
185
|
-
throw new ValidationError(
|
186
|
-
'XChainAddClaimAttestation: missing field XChainClaimID',
|
187
|
-
)
|
188
|
-
}
|
189
|
-
|
190
|
-
if (
|
191
|
-
typeof tx.XChainClaimID !== 'string' &&
|
192
|
-
typeof tx.XChainClaimID !== 'number'
|
193
|
-
) {
|
194
|
-
throw new ValidationError(
|
195
|
-
'XChainAddClaimAttestation: invalid field XChainClaimID',
|
196
|
-
)
|
197
|
-
}
|
88
|
+
validateRequiredField(tx, 'Amount', isAmount)
|
89
|
+
|
90
|
+
validateRequiredField(tx, 'AttestationRewardAccount', isString)
|
91
|
+
|
92
|
+
validateRequiredField(tx, 'AttestationSignerAccount', isString)
|
93
|
+
|
94
|
+
validateOptionalField(tx, 'Destination', isString)
|
95
|
+
|
96
|
+
validateRequiredField(tx, 'OtherChainSource', isString)
|
97
|
+
|
98
|
+
validateRequiredField(tx, 'PublicKey', isString)
|
99
|
+
|
100
|
+
validateRequiredField(tx, 'Signature', isString)
|
101
|
+
|
102
|
+
validateRequiredField(
|
103
|
+
tx,
|
104
|
+
'WasLockingChainSend',
|
105
|
+
(inp) => inp === 0 || inp === 1,
|
106
|
+
)
|
107
|
+
|
108
|
+
validateRequiredField(tx, 'XChainBridge', isXChainBridge)
|
109
|
+
|
110
|
+
validateRequiredField(
|
111
|
+
tx,
|
112
|
+
'XChainClaimID',
|
113
|
+
(inp) => isNumber(inp) || isString(inp),
|
114
|
+
)
|
198
115
|
}
|
@@ -1,11 +1,14 @@
|
|
1
|
-
import { ValidationError } from '../../errors'
|
2
1
|
import { Amount, XChainBridge } from '../common'
|
3
2
|
|
4
3
|
import {
|
5
4
|
BaseTransaction,
|
6
5
|
isAmount,
|
6
|
+
isNumber,
|
7
|
+
isString,
|
7
8
|
isXChainBridge,
|
8
9
|
validateBaseTransaction,
|
10
|
+
validateOptionalField,
|
11
|
+
validateRequiredField,
|
9
12
|
} from './common'
|
10
13
|
|
11
14
|
/**
|
@@ -50,54 +53,25 @@ export interface XChainClaim extends BaseTransaction {
|
|
50
53
|
}
|
51
54
|
|
52
55
|
/**
|
53
|
-
* Verify the form and type of
|
56
|
+
* Verify the form and type of an XChainClaim at runtime.
|
54
57
|
*
|
55
|
-
* @param tx -
|
58
|
+
* @param tx - An XChainClaim Transaction.
|
56
59
|
* @throws When the XChainClaim is malformed.
|
57
60
|
*/
|
58
|
-
// eslint-disable-next-line complexity -- okay for this function, lots of things to check
|
59
61
|
export function validateXChainClaim(tx: Record<string, unknown>): void {
|
60
62
|
validateBaseTransaction(tx)
|
61
63
|
|
62
|
-
|
63
|
-
throw new ValidationError('XChainClaim: missing field XChainBridge')
|
64
|
-
}
|
64
|
+
validateRequiredField(tx, 'XChainBridge', isXChainBridge)
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
validateRequiredField(
|
67
|
+
tx,
|
68
|
+
'XChainClaimID',
|
69
|
+
(inp) => isNumber(inp) || isString(inp),
|
70
|
+
)
|
69
71
|
|
70
|
-
|
71
|
-
throw new ValidationError('XChainClaim: missing field XChainClaimID')
|
72
|
-
}
|
72
|
+
validateRequiredField(tx, 'Destination', isString)
|
73
73
|
|
74
|
-
|
75
|
-
typeof tx.XChainClaimID !== 'number' &&
|
76
|
-
typeof tx.XChainClaimID !== 'string'
|
77
|
-
) {
|
78
|
-
throw new ValidationError('XChainClaim: invalid field XChainClaimID')
|
79
|
-
}
|
74
|
+
validateOptionalField(tx, 'DestinationTag', isNumber)
|
80
75
|
|
81
|
-
|
82
|
-
throw new ValidationError('XChainClaim: missing field Destination')
|
83
|
-
}
|
84
|
-
|
85
|
-
if (typeof tx.Destination !== 'string') {
|
86
|
-
throw new ValidationError('XChainClaim: invalid field Destination')
|
87
|
-
}
|
88
|
-
|
89
|
-
if (
|
90
|
-
tx.DestinationTag !== undefined &&
|
91
|
-
typeof tx.DestinationTag !== 'number'
|
92
|
-
) {
|
93
|
-
throw new ValidationError('XChainClaim: invalid field DestinationTag')
|
94
|
-
}
|
95
|
-
|
96
|
-
if (tx.Amount == null) {
|
97
|
-
throw new ValidationError('XChainClaim: missing field Amount')
|
98
|
-
}
|
99
|
-
|
100
|
-
if (!isAmount(tx.Amount)) {
|
101
|
-
throw new ValidationError('XChainClaim: invalid field Amount')
|
102
|
-
}
|
76
|
+
validateRequiredField(tx, 'Amount', isAmount)
|
103
77
|
}
|
@@ -1,11 +1,14 @@
|
|
1
|
-
import { ValidationError } from '../../errors'
|
2
1
|
import { Amount, XChainBridge } from '../common'
|
3
2
|
|
4
3
|
import {
|
5
4
|
BaseTransaction,
|
6
5
|
isAmount,
|
6
|
+
isNumber,
|
7
|
+
isString,
|
7
8
|
isXChainBridge,
|
8
9
|
validateBaseTransaction,
|
10
|
+
validateOptionalField,
|
11
|
+
validateRequiredField,
|
9
12
|
} from './common'
|
10
13
|
|
11
14
|
/**
|
@@ -49,47 +52,23 @@ export interface XChainCommit extends BaseTransaction {
|
|
49
52
|
}
|
50
53
|
|
51
54
|
/**
|
52
|
-
* Verify the form and type of
|
55
|
+
* Verify the form and type of an XChainCommit at runtime.
|
53
56
|
*
|
54
|
-
* @param tx -
|
57
|
+
* @param tx - An XChainCommit Transaction.
|
55
58
|
* @throws When the XChainCommit is malformed.
|
56
59
|
*/
|
57
60
|
export function validateXChainCommit(tx: Record<string, unknown>): void {
|
58
61
|
validateBaseTransaction(tx)
|
59
62
|
|
60
|
-
|
61
|
-
throw new ValidationError('XChainCommit: missing field XChainBridge')
|
62
|
-
}
|
63
|
+
validateRequiredField(tx, 'XChainBridge', isXChainBridge)
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
validateRequiredField(
|
66
|
+
tx,
|
67
|
+
'XChainClaimID',
|
68
|
+
(inp) => isNumber(inp) || isString(inp),
|
69
|
+
)
|
67
70
|
|
68
|
-
|
69
|
-
throw new ValidationError('XChainCommit: missing field XChainClaimID')
|
70
|
-
}
|
71
|
+
validateOptionalField(tx, 'OtherChainDestination', isString)
|
71
72
|
|
72
|
-
|
73
|
-
typeof tx.XChainClaimID !== 'number' &&
|
74
|
-
typeof tx.XChainClaimID !== 'string'
|
75
|
-
) {
|
76
|
-
throw new ValidationError('XChainCommit: invalid field XChainClaimID')
|
77
|
-
}
|
78
|
-
|
79
|
-
if (
|
80
|
-
tx.OtherChainDestination !== undefined &&
|
81
|
-
typeof tx.OtherChainDestination !== 'string'
|
82
|
-
) {
|
83
|
-
throw new ValidationError(
|
84
|
-
'XChainCommit: invalid field OtherChainDestination',
|
85
|
-
)
|
86
|
-
}
|
87
|
-
|
88
|
-
if (tx.Amount == null) {
|
89
|
-
throw new ValidationError('XChainCommit: missing field Amount')
|
90
|
-
}
|
91
|
-
|
92
|
-
if (!isAmount(tx.Amount)) {
|
93
|
-
throw new ValidationError('XChainCommit: invalid field Amount')
|
94
|
-
}
|
73
|
+
validateRequiredField(tx, 'Amount', isAmount)
|
95
74
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { ValidationError } from '../../errors'
|
2
1
|
import { Amount, XChainBridge } from '../common'
|
3
2
|
|
4
3
|
import {
|
@@ -6,6 +5,8 @@ import {
|
|
6
5
|
isAmount,
|
7
6
|
isXChainBridge,
|
8
7
|
validateBaseTransaction,
|
8
|
+
validateOptionalField,
|
9
|
+
validateRequiredField,
|
9
10
|
} from './common'
|
10
11
|
|
11
12
|
/**
|
@@ -39,40 +40,17 @@ export interface XChainCreateBridge extends BaseTransaction {
|
|
39
40
|
}
|
40
41
|
|
41
42
|
/**
|
42
|
-
* Verify the form and type of
|
43
|
+
* Verify the form and type of an XChainCreateBridge at runtime.
|
43
44
|
*
|
44
|
-
* @param tx -
|
45
|
+
* @param tx - An XChainCreateBridge Transaction.
|
45
46
|
* @throws When the XChainCreateBridge is malformed.
|
46
47
|
*/
|
47
48
|
export function validateXChainCreateBridge(tx: Record<string, unknown>): void {
|
48
49
|
validateBaseTransaction(tx)
|
49
50
|
|
50
|
-
|
51
|
-
throw new ValidationError('XChainCreateBridge: missing field XChainBridge')
|
52
|
-
}
|
51
|
+
validateRequiredField(tx, 'XChainBridge', isXChainBridge)
|
53
52
|
|
54
|
-
|
55
|
-
throw new ValidationError('XChainCreateBridge: invalid field XChainBridge')
|
56
|
-
}
|
53
|
+
validateRequiredField(tx, 'SignatureReward', isAmount)
|
57
54
|
|
58
|
-
|
59
|
-
throw new ValidationError(
|
60
|
-
'XChainCreateBridge: missing field SignatureReward',
|
61
|
-
)
|
62
|
-
}
|
63
|
-
|
64
|
-
if (!isAmount(tx.SignatureReward)) {
|
65
|
-
throw new ValidationError(
|
66
|
-
'XChainCreateBridge: invalid field SignatureReward',
|
67
|
-
)
|
68
|
-
}
|
69
|
-
|
70
|
-
if (
|
71
|
-
tx.MinAccountCreateAmount !== undefined &&
|
72
|
-
!isAmount(tx.MinAccountCreateAmount)
|
73
|
-
) {
|
74
|
-
throw new ValidationError(
|
75
|
-
'XChainCreateBridge: invalid field MinAccountCreateAmount',
|
76
|
-
)
|
77
|
-
}
|
55
|
+
validateOptionalField(tx, 'MinAccountCreateAmount', isAmount)
|
78
56
|
}
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import { ValidationError } from '../../errors'
|
2
1
|
import { Amount, XChainBridge } from '../common'
|
3
2
|
|
4
3
|
import {
|
5
4
|
BaseTransaction,
|
6
5
|
isAmount,
|
6
|
+
isString,
|
7
7
|
isXChainBridge,
|
8
8
|
validateBaseTransaction,
|
9
|
+
validateRequiredField,
|
9
10
|
} from './common'
|
10
11
|
|
11
12
|
/**
|
@@ -36,43 +37,17 @@ export interface XChainCreateClaimID extends BaseTransaction {
|
|
36
37
|
}
|
37
38
|
|
38
39
|
/**
|
39
|
-
* Verify the form and type of
|
40
|
+
* Verify the form and type of an XChainCreateClaimID at runtime.
|
40
41
|
*
|
41
|
-
* @param tx -
|
42
|
+
* @param tx - An XChainCreateClaimID Transaction.
|
42
43
|
* @throws When the XChainCreateClaimID is malformed.
|
43
44
|
*/
|
44
45
|
export function validateXChainCreateClaimID(tx: Record<string, unknown>): void {
|
45
46
|
validateBaseTransaction(tx)
|
46
47
|
|
47
|
-
|
48
|
-
throw new ValidationError('XChainCreateClaimID: missing field XChainBridge')
|
49
|
-
}
|
48
|
+
validateRequiredField(tx, 'XChainBridge', isXChainBridge)
|
50
49
|
|
51
|
-
|
52
|
-
throw new ValidationError('XChainCreateClaimID: invalid field XChainBridge')
|
53
|
-
}
|
50
|
+
validateRequiredField(tx, 'SignatureReward', isAmount)
|
54
51
|
|
55
|
-
|
56
|
-
throw new ValidationError(
|
57
|
-
'XChainCreateClaimID: missing field SignatureReward',
|
58
|
-
)
|
59
|
-
}
|
60
|
-
|
61
|
-
if (!isAmount(tx.SignatureReward)) {
|
62
|
-
throw new ValidationError(
|
63
|
-
'XChainCreateClaimID: invalid field SignatureReward',
|
64
|
-
)
|
65
|
-
}
|
66
|
-
|
67
|
-
if (tx.OtherChainSource == null) {
|
68
|
-
throw new ValidationError(
|
69
|
-
'XChainCreateClaimID: missing field OtherChainSource',
|
70
|
-
)
|
71
|
-
}
|
72
|
-
|
73
|
-
if (typeof tx.OtherChainSource !== 'string') {
|
74
|
-
throw new ValidationError(
|
75
|
-
'XChainCreateClaimID: invalid field OtherChainSource',
|
76
|
-
)
|
77
|
-
}
|
52
|
+
validateRequiredField(tx, 'OtherChainSource', isString)
|
78
53
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { ValidationError } from '../../errors'
|
2
1
|
import { Amount, XChainBridge } from '../common'
|
3
2
|
|
4
3
|
import {
|
@@ -7,6 +6,8 @@ import {
|
|
7
6
|
isAmount,
|
8
7
|
isXChainBridge,
|
9
8
|
validateBaseTransaction,
|
9
|
+
validateOptionalField,
|
10
|
+
validateRequiredField,
|
10
11
|
} from './common'
|
11
12
|
|
12
13
|
/**
|
@@ -60,34 +61,17 @@ export interface XChainModifyBridge extends BaseTransaction {
|
|
60
61
|
}
|
61
62
|
|
62
63
|
/**
|
63
|
-
* Verify the form and type of
|
64
|
+
* Verify the form and type of an XChainModifyBridge at runtime.
|
64
65
|
*
|
65
|
-
* @param tx -
|
66
|
+
* @param tx - An XChainModifyBridge Transaction.
|
66
67
|
* @throws When the XChainModifyBridge is malformed.
|
67
68
|
*/
|
68
69
|
export function validateXChainModifyBridge(tx: Record<string, unknown>): void {
|
69
70
|
validateBaseTransaction(tx)
|
70
71
|
|
71
|
-
|
72
|
-
throw new ValidationError('XChainModifyBridge: missing field XChainBridge')
|
73
|
-
}
|
72
|
+
validateRequiredField(tx, 'XChainBridge', isXChainBridge)
|
74
73
|
|
75
|
-
|
76
|
-
throw new ValidationError('XChainModifyBridge: invalid field XChainBridge')
|
77
|
-
}
|
74
|
+
validateOptionalField(tx, 'SignatureReward', isAmount)
|
78
75
|
|
79
|
-
|
80
|
-
throw new ValidationError(
|
81
|
-
'XChainModifyBridge: invalid field SignatureReward',
|
82
|
-
)
|
83
|
-
}
|
84
|
-
|
85
|
-
if (
|
86
|
-
tx.MinAccountCreateAmount !== undefined &&
|
87
|
-
!isAmount(tx.MinAccountCreateAmount)
|
88
|
-
) {
|
89
|
-
throw new ValidationError(
|
90
|
-
'XChainModifyBridge: invalid field MinAccountCreateAmount',
|
91
|
-
)
|
92
|
-
}
|
76
|
+
validateOptionalField(tx, 'MinAccountCreateAmount', isAmount)
|
93
77
|
}
|