xrpl 4.0.0 → 4.1.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/README.md +1 -1
- package/build/xrpl-latest.js +2789 -731
- package/build/xrpl-latest.js.map +1 -1
- package/dist/npm/client/partialPayment.d.ts +2 -2
- package/dist/npm/client/partialPayment.d.ts.map +1 -1
- package/dist/npm/client/partialPayment.js +11 -3
- package/dist/npm/client/partialPayment.js.map +1 -1
- package/dist/npm/models/common/index.d.ts +10 -0
- package/dist/npm/models/common/index.d.ts.map +1 -1
- package/dist/npm/models/index.d.ts +1 -1
- package/dist/npm/models/index.d.ts.map +1 -1
- package/dist/npm/models/index.js +2 -1
- package/dist/npm/models/index.js.map +1 -1
- package/dist/npm/models/ledger/Credential.d.ts +17 -0
- package/dist/npm/models/ledger/Credential.d.ts.map +1 -0
- package/dist/npm/models/ledger/Credential.js +3 -0
- package/dist/npm/models/ledger/Credential.js.map +1 -0
- package/dist/npm/models/ledger/DepositPreauth.d.ts +3 -1
- package/dist/npm/models/ledger/DepositPreauth.d.ts.map +1 -1
- package/dist/npm/models/ledger/Ledger.d.ts +1 -0
- package/dist/npm/models/ledger/Ledger.d.ts.map +1 -1
- package/dist/npm/models/ledger/LedgerEntry.d.ts +3 -2
- package/dist/npm/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/models/ledger/MPToken.d.ts +10 -0
- package/dist/npm/models/ledger/MPToken.d.ts.map +1 -0
- package/dist/npm/models/ledger/MPToken.js +3 -0
- package/dist/npm/models/ledger/MPToken.js.map +1 -0
- package/dist/npm/models/ledger/MPTokenIssuance.d.ts +13 -0
- package/dist/npm/models/ledger/MPTokenIssuance.d.ts.map +1 -0
- package/dist/npm/models/ledger/MPTokenIssuance.js +3 -0
- package/dist/npm/models/ledger/MPTokenIssuance.js.map +1 -0
- package/dist/npm/models/ledger/index.d.ts +4 -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/depositAuthorized.d.ts +2 -0
- package/dist/npm/models/methods/depositAuthorized.d.ts.map +1 -1
- package/dist/npm/models/methods/index.d.ts +2 -2
- package/dist/npm/models/methods/index.d.ts.map +1 -1
- package/dist/npm/models/methods/ledgerEntry.d.ts +12 -0
- package/dist/npm/models/methods/ledgerEntry.d.ts.map +1 -1
- package/dist/npm/models/methods/subscribe.d.ts +7 -3
- package/dist/npm/models/methods/subscribe.d.ts.map +1 -1
- package/dist/npm/models/transactions/CredentialAccept.d.ts +9 -0
- package/dist/npm/models/transactions/CredentialAccept.d.ts.map +1 -0
- package/dist/npm/models/transactions/CredentialAccept.js +12 -0
- package/dist/npm/models/transactions/CredentialAccept.js.map +1 -0
- package/dist/npm/models/transactions/CredentialCreate.d.ts +11 -0
- package/dist/npm/models/transactions/CredentialCreate.d.ts.map +1 -0
- package/dist/npm/models/transactions/CredentialCreate.js +34 -0
- package/dist/npm/models/transactions/CredentialCreate.js.map +1 -0
- package/dist/npm/models/transactions/CredentialDelete.d.ts +10 -0
- package/dist/npm/models/transactions/CredentialDelete.d.ts.map +1 -0
- package/dist/npm/models/transactions/CredentialDelete.js +17 -0
- package/dist/npm/models/transactions/CredentialDelete.js.map +1 -0
- package/dist/npm/models/transactions/MPTokenAuthorize.d.ts +15 -0
- package/dist/npm/models/transactions/MPTokenAuthorize.d.ts.map +1 -0
- package/dist/npm/models/transactions/MPTokenAuthorize.js +15 -0
- package/dist/npm/models/transactions/MPTokenAuthorize.js.map +1 -0
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts +31 -0
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -0
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.js +54 -0
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.js.map +1 -0
- package/dist/npm/models/transactions/MPTokenIssuanceDestroy.d.ts +7 -0
- package/dist/npm/models/transactions/MPTokenIssuanceDestroy.d.ts.map +1 -0
- package/dist/npm/models/transactions/MPTokenIssuanceDestroy.js +10 -0
- package/dist/npm/models/transactions/MPTokenIssuanceDestroy.js.map +1 -0
- package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts +17 -0
- package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts.map +1 -0
- package/dist/npm/models/transactions/MPTokenIssuanceSet.js +29 -0
- package/dist/npm/models/transactions/MPTokenIssuanceSet.js.map +1 -0
- package/dist/npm/models/transactions/accountDelete.d.ts +1 -0
- package/dist/npm/models/transactions/accountDelete.d.ts.map +1 -1
- package/dist/npm/models/transactions/accountDelete.js +1 -0
- package/dist/npm/models/transactions/accountDelete.js.map +1 -1
- package/dist/npm/models/transactions/clawback.d.ts +3 -2
- package/dist/npm/models/transactions/clawback.d.ts.map +1 -1
- package/dist/npm/models/transactions/clawback.js +11 -1
- package/dist/npm/models/transactions/clawback.js.map +1 -1
- package/dist/npm/models/transactions/common.d.ts +4 -1
- package/dist/npm/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/models/transactions/common.js +79 -4
- package/dist/npm/models/transactions/common.js.map +1 -1
- package/dist/npm/models/transactions/depositPreauth.d.ts +3 -0
- package/dist/npm/models/transactions/depositPreauth.d.ts.map +1 -1
- package/dist/npm/models/transactions/depositPreauth.js +20 -7
- package/dist/npm/models/transactions/depositPreauth.js.map +1 -1
- package/dist/npm/models/transactions/escrowFinish.d.ts +1 -0
- package/dist/npm/models/transactions/escrowFinish.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowFinish.js +1 -0
- package/dist/npm/models/transactions/escrowFinish.js.map +1 -1
- package/dist/npm/models/transactions/index.d.ts +8 -1
- package/dist/npm/models/transactions/index.d.ts.map +1 -1
- package/dist/npm/models/transactions/index.js +9 -1
- package/dist/npm/models/transactions/index.js.map +1 -1
- package/dist/npm/models/transactions/metadata.d.ts +5 -4
- package/dist/npm/models/transactions/metadata.d.ts.map +1 -1
- package/dist/npm/models/transactions/metadata.js.map +1 -1
- package/dist/npm/models/transactions/payment.d.ts +7 -6
- package/dist/npm/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/models/transactions/payment.js +1 -0
- package/dist/npm/models/transactions/payment.js.map +1 -1
- package/dist/npm/models/transactions/paymentChannelClaim.d.ts +1 -0
- package/dist/npm/models/transactions/paymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/models/transactions/paymentChannelClaim.js +1 -0
- package/dist/npm/models/transactions/paymentChannelClaim.js.map +1 -1
- package/dist/npm/models/transactions/transaction.d.ts +8 -1
- package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/models/transactions/transaction.js +28 -0
- package/dist/npm/models/transactions/transaction.js.map +1 -1
- package/dist/npm/models/utils/flags.d.ts +1 -0
- package/dist/npm/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/models/utils/flags.js +23 -1
- package/dist/npm/models/utils/flags.js.map +1 -1
- package/dist/npm/models/utils/index.d.ts +1 -0
- package/dist/npm/models/utils/index.d.ts.map +1 -1
- package/dist/npm/models/utils/index.js +2 -1
- package/dist/npm/models/utils/index.js.map +1 -1
- package/dist/npm/snippets/src/paths.js +5 -9
- package/dist/npm/snippets/src/paths.js.map +1 -1
- package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
- package/dist/npm/src/client/partialPayment.d.ts +2 -2
- package/dist/npm/src/client/partialPayment.d.ts.map +1 -1
- package/dist/npm/src/client/partialPayment.js +11 -3
- package/dist/npm/src/client/partialPayment.js.map +1 -1
- package/dist/npm/src/models/common/index.d.ts +10 -0
- package/dist/npm/src/models/common/index.d.ts.map +1 -1
- package/dist/npm/src/models/index.d.ts +1 -1
- package/dist/npm/src/models/index.d.ts.map +1 -1
- package/dist/npm/src/models/index.js +2 -1
- package/dist/npm/src/models/index.js.map +1 -1
- package/dist/npm/src/models/ledger/Credential.d.ts +17 -0
- package/dist/npm/src/models/ledger/Credential.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/Credential.js +3 -0
- package/dist/npm/src/models/ledger/Credential.js.map +1 -0
- package/dist/npm/src/models/ledger/DepositPreauth.d.ts +3 -1
- package/dist/npm/src/models/ledger/DepositPreauth.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/Ledger.d.ts +1 -0
- package/dist/npm/src/models/ledger/Ledger.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts +3 -2
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/MPToken.d.ts +10 -0
- package/dist/npm/src/models/ledger/MPToken.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/MPToken.js +3 -0
- package/dist/npm/src/models/ledger/MPToken.js.map +1 -0
- package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts +13 -0
- package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/MPTokenIssuance.js +3 -0
- package/dist/npm/src/models/ledger/MPTokenIssuance.js.map +1 -0
- package/dist/npm/src/models/ledger/index.d.ts +4 -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/depositAuthorized.d.ts +2 -0
- package/dist/npm/src/models/methods/depositAuthorized.d.ts.map +1 -1
- package/dist/npm/src/models/methods/index.d.ts +2 -2
- package/dist/npm/src/models/methods/index.d.ts.map +1 -1
- package/dist/npm/src/models/methods/ledgerEntry.d.ts +12 -0
- package/dist/npm/src/models/methods/ledgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/methods/subscribe.d.ts +7 -3
- package/dist/npm/src/models/methods/subscribe.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/CredentialAccept.d.ts +9 -0
- package/dist/npm/src/models/transactions/CredentialAccept.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/CredentialAccept.js +12 -0
- package/dist/npm/src/models/transactions/CredentialAccept.js.map +1 -0
- package/dist/npm/src/models/transactions/CredentialCreate.d.ts +11 -0
- package/dist/npm/src/models/transactions/CredentialCreate.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/CredentialCreate.js +34 -0
- package/dist/npm/src/models/transactions/CredentialCreate.js.map +1 -0
- package/dist/npm/src/models/transactions/CredentialDelete.d.ts +10 -0
- package/dist/npm/src/models/transactions/CredentialDelete.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/CredentialDelete.js +17 -0
- package/dist/npm/src/models/transactions/CredentialDelete.js.map +1 -0
- package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts +15 -0
- package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/MPTokenAuthorize.js +15 -0
- package/dist/npm/src/models/transactions/MPTokenAuthorize.js.map +1 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts +31 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js +54 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js.map +1 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceDestroy.d.ts +7 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceDestroy.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceDestroy.js +10 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceDestroy.js.map +1 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts +17 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js +29 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js.map +1 -0
- package/dist/npm/src/models/transactions/accountDelete.d.ts +1 -0
- package/dist/npm/src/models/transactions/accountDelete.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/accountDelete.js +1 -0
- package/dist/npm/src/models/transactions/accountDelete.js.map +1 -1
- package/dist/npm/src/models/transactions/clawback.d.ts +3 -2
- package/dist/npm/src/models/transactions/clawback.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/clawback.js +11 -1
- package/dist/npm/src/models/transactions/clawback.js.map +1 -1
- package/dist/npm/src/models/transactions/common.d.ts +4 -1
- package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/common.js +79 -4
- package/dist/npm/src/models/transactions/common.js.map +1 -1
- package/dist/npm/src/models/transactions/depositPreauth.d.ts +3 -0
- package/dist/npm/src/models/transactions/depositPreauth.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/depositPreauth.js +20 -7
- package/dist/npm/src/models/transactions/depositPreauth.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.d.ts +1 -0
- package/dist/npm/src/models/transactions/escrowFinish.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.js +1 -0
- package/dist/npm/src/models/transactions/escrowFinish.js.map +1 -1
- package/dist/npm/src/models/transactions/index.d.ts +8 -1
- package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/index.js +9 -1
- package/dist/npm/src/models/transactions/index.js.map +1 -1
- package/dist/npm/src/models/transactions/metadata.d.ts +5 -4
- package/dist/npm/src/models/transactions/metadata.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/metadata.js.map +1 -1
- package/dist/npm/src/models/transactions/payment.d.ts +7 -6
- package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/payment.js +1 -0
- package/dist/npm/src/models/transactions/payment.js.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts +1 -0
- package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelClaim.js +1 -0
- package/dist/npm/src/models/transactions/paymentChannelClaim.js.map +1 -1
- package/dist/npm/src/models/transactions/transaction.d.ts +8 -1
- package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/transaction.js +28 -0
- package/dist/npm/src/models/transactions/transaction.js.map +1 -1
- package/dist/npm/src/models/utils/flags.d.ts +1 -0
- package/dist/npm/src/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/src/models/utils/flags.js +23 -1
- package/dist/npm/src/models/utils/flags.js.map +1 -1
- package/dist/npm/src/models/utils/index.d.ts +1 -0
- package/dist/npm/src/models/utils/index.d.ts.map +1 -1
- package/dist/npm/src/models/utils/index.js +2 -1
- package/dist/npm/src/models/utils/index.js.map +1 -1
- package/package.json +5 -5
- package/src/client/partialPayment.ts +37 -7
- package/src/models/common/index.ts +15 -0
- package/src/models/index.ts +1 -0
- package/src/models/ledger/Credential.ts +47 -0
- package/src/models/ledger/DepositPreauth.ts +6 -2
- package/src/models/ledger/Ledger.ts +5 -0
- package/src/models/ledger/LedgerEntry.ts +5 -0
- package/src/models/ledger/MPToken.ts +11 -0
- package/src/models/ledger/MPTokenIssuance.ts +13 -0
- package/src/models/ledger/index.ts +6 -0
- package/src/models/methods/depositAuthorized.ts +10 -0
- package/src/models/methods/index.ts +2 -0
- package/src/models/methods/ledgerEntry.ts +45 -1
- package/src/models/methods/subscribe.ts +34 -3
- package/src/models/transactions/CredentialAccept.ts +44 -0
- package/src/models/transactions/CredentialCreate.ts +81 -0
- package/src/models/transactions/CredentialDelete.ts +55 -0
- package/src/models/transactions/MPTokenAuthorize.ts +67 -0
- package/src/models/transactions/MPTokenIssuanceCreate.ts +179 -0
- package/src/models/transactions/MPTokenIssuanceDestroy.ts +34 -0
- package/src/models/transactions/MPTokenIssuanceSet.ts +86 -0
- package/src/models/transactions/accountDelete.ts +14 -0
- package/src/models/transactions/clawback.ts +27 -6
- package/src/models/transactions/common.ts +139 -1
- package/src/models/transactions/depositPreauth.ts +51 -15
- package/src/models/transactions/escrowFinish.ts +12 -0
- package/src/models/transactions/index.ts +20 -1
- package/src/models/transactions/metadata.ts +9 -3
- package/src/models/transactions/payment.ts +19 -6
- package/src/models/transactions/paymentChannelClaim.ts +18 -1
- package/src/models/transactions/transaction.ts +51 -0
- package/src/models/utils/flags.ts +33 -1
- package/src/models/utils/index.ts +1 -0
- package/build/xrpl-latest-min.js +0 -3
- package/build/xrpl-latest-min.js.map +0 -1
- package/dist/npm/snippets/src/bridgeTransfer.d.ts +0 -2
- package/dist/npm/snippets/src/bridgeTransfer.d.ts.map +0 -1
- package/dist/npm/snippets/src/bridgeTransfer.js +0 -126
- package/dist/npm/snippets/src/bridgeTransfer.js.map +0 -1
@@ -1,6 +1,11 @@
|
|
1
1
|
import { ValidationError } from '../../errors'
|
2
|
+
import { AuthorizeCredential } from '../common'
|
2
3
|
|
3
|
-
import {
|
4
|
+
import {
|
5
|
+
BaseTransaction,
|
6
|
+
validateBaseTransaction,
|
7
|
+
validateCredentialsList,
|
8
|
+
} from './common'
|
4
9
|
|
5
10
|
/**
|
6
11
|
* A DepositPreauth transaction gives another account pre-approval to deliver
|
@@ -18,6 +23,16 @@ export interface DepositPreauth extends BaseTransaction {
|
|
18
23
|
* revoked.
|
19
24
|
*/
|
20
25
|
Unauthorize?: string
|
26
|
+
|
27
|
+
/**
|
28
|
+
* The credential(s) to preauthorize.
|
29
|
+
*/
|
30
|
+
AuthorizeCredentials?: AuthorizeCredential[]
|
31
|
+
|
32
|
+
/**
|
33
|
+
* The credential(s) whose preauthorization should be revoked.
|
34
|
+
*/
|
35
|
+
UnauthorizeCredentials?: AuthorizeCredential[]
|
21
36
|
}
|
22
37
|
|
23
38
|
/**
|
@@ -29,17 +44,7 @@ export interface DepositPreauth extends BaseTransaction {
|
|
29
44
|
export function validateDepositPreauth(tx: Record<string, unknown>): void {
|
30
45
|
validateBaseTransaction(tx)
|
31
46
|
|
32
|
-
|
33
|
-
throw new ValidationError(
|
34
|
-
"DepositPreauth: can't provide both Authorize and Unauthorize fields",
|
35
|
-
)
|
36
|
-
}
|
37
|
-
|
38
|
-
if (tx.Authorize === undefined && tx.Unauthorize === undefined) {
|
39
|
-
throw new ValidationError(
|
40
|
-
'DepositPreauth: must provide either Authorize or Unauthorize field',
|
41
|
-
)
|
42
|
-
}
|
47
|
+
validateSingleAuthorizationFieldProvided(tx)
|
43
48
|
|
44
49
|
if (tx.Authorize !== undefined) {
|
45
50
|
if (typeof tx.Authorize !== 'string') {
|
@@ -51,9 +56,7 @@ export function validateDepositPreauth(tx: Record<string, unknown>): void {
|
|
51
56
|
"DepositPreauth: Account can't preauthorize its own address",
|
52
57
|
)
|
53
58
|
}
|
54
|
-
}
|
55
|
-
|
56
|
-
if (tx.Unauthorize !== undefined) {
|
59
|
+
} else if (tx.Unauthorize !== undefined) {
|
57
60
|
if (typeof tx.Unauthorize !== 'string') {
|
58
61
|
throw new ValidationError('DepositPreauth: Unauthorize must be a string')
|
59
62
|
}
|
@@ -63,5 +66,38 @@ export function validateDepositPreauth(tx: Record<string, unknown>): void {
|
|
63
66
|
"DepositPreauth: Account can't unauthorize its own address",
|
64
67
|
)
|
65
68
|
}
|
69
|
+
} else if (tx.AuthorizeCredentials !== undefined) {
|
70
|
+
validateCredentialsList(
|
71
|
+
tx.AuthorizeCredentials,
|
72
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- confirmed in base transaction check
|
73
|
+
tx.TransactionType as string,
|
74
|
+
false,
|
75
|
+
)
|
76
|
+
} else if (tx.UnauthorizeCredentials !== undefined) {
|
77
|
+
validateCredentialsList(
|
78
|
+
tx.UnauthorizeCredentials,
|
79
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- confirmed in base transaction check
|
80
|
+
tx.TransactionType as string,
|
81
|
+
false,
|
82
|
+
)
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
// Boolean logic to ensure exactly one of 4 inputs was provided
|
87
|
+
function validateSingleAuthorizationFieldProvided(
|
88
|
+
tx: Record<string, unknown>,
|
89
|
+
): void {
|
90
|
+
const fields = [
|
91
|
+
'Authorize',
|
92
|
+
'Unauthorize',
|
93
|
+
'AuthorizeCredentials',
|
94
|
+
'UnauthorizeCredentials',
|
95
|
+
]
|
96
|
+
const countProvided = fields.filter((key) => tx[key] !== undefined).length
|
97
|
+
|
98
|
+
if (countProvided !== 1) {
|
99
|
+
throw new ValidationError(
|
100
|
+
'DepositPreauth: Requires exactly one field of the following: Authorize, Unauthorize, AuthorizeCredentials, UnauthorizeCredentials.',
|
101
|
+
)
|
66
102
|
}
|
67
103
|
}
|
@@ -5,6 +5,7 @@ import {
|
|
5
5
|
BaseTransaction,
|
6
6
|
isAccount,
|
7
7
|
validateBaseTransaction,
|
8
|
+
validateCredentialsList,
|
8
9
|
validateRequiredField,
|
9
10
|
} from './common'
|
10
11
|
|
@@ -32,6 +33,10 @@ export interface EscrowFinish extends BaseTransaction {
|
|
32
33
|
* the held payment's Condition.
|
33
34
|
*/
|
34
35
|
Fulfillment?: string
|
36
|
+
/** Credentials associated with the sender of this transaction.
|
37
|
+
* The credentials included must not be expired.
|
38
|
+
*/
|
39
|
+
CredentialIDs?: string[]
|
35
40
|
}
|
36
41
|
|
37
42
|
/**
|
@@ -45,6 +50,13 @@ export function validateEscrowFinish(tx: Record<string, unknown>): void {
|
|
45
50
|
|
46
51
|
validateRequiredField(tx, 'Owner', isAccount)
|
47
52
|
|
53
|
+
validateCredentialsList(
|
54
|
+
tx.CredentialIDs,
|
55
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- known from base check
|
56
|
+
tx.TransactionType as string,
|
57
|
+
true,
|
58
|
+
)
|
59
|
+
|
48
60
|
if (tx.OfferSequence == null) {
|
49
61
|
throw new ValidationError('EscrowFinish: missing field OfferSequence')
|
50
62
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { BaseTransaction } from './common'
|
1
|
+
export { BaseTransaction, isMPTAmount } from './common'
|
2
2
|
export {
|
3
3
|
validate,
|
4
4
|
PseudoTransaction,
|
@@ -32,6 +32,9 @@ export { CheckCancel } from './checkCancel'
|
|
32
32
|
export { CheckCash } from './checkCash'
|
33
33
|
export { CheckCreate } from './checkCreate'
|
34
34
|
export { Clawback } from './clawback'
|
35
|
+
export { CredentialAccept } from './CredentialAccept'
|
36
|
+
export { CredentialCreate } from './CredentialCreate'
|
37
|
+
export { CredentialDelete } from './CredentialDelete'
|
35
38
|
export { DIDDelete } from './DIDDelete'
|
36
39
|
export { DIDSet } from './DIDSet'
|
37
40
|
export { DepositPreauth } from './depositPreauth'
|
@@ -39,6 +42,22 @@ export { EscrowCancel } from './escrowCancel'
|
|
39
42
|
export { EscrowCreate } from './escrowCreate'
|
40
43
|
export { EscrowFinish } from './escrowFinish'
|
41
44
|
export { EnableAmendment, EnableAmendmentFlags } from './enableAmendment'
|
45
|
+
export {
|
46
|
+
MPTokenAuthorize,
|
47
|
+
MPTokenAuthorizeFlags,
|
48
|
+
MPTokenAuthorizeFlagsInterface,
|
49
|
+
} from './MPTokenAuthorize'
|
50
|
+
export {
|
51
|
+
MPTokenIssuanceCreate,
|
52
|
+
MPTokenIssuanceCreateFlags,
|
53
|
+
MPTokenIssuanceCreateFlagsInterface,
|
54
|
+
} from './MPTokenIssuanceCreate'
|
55
|
+
export { MPTokenIssuanceDestroy } from './MPTokenIssuanceDestroy'
|
56
|
+
export {
|
57
|
+
MPTokenIssuanceSet,
|
58
|
+
MPTokenIssuanceSetFlags,
|
59
|
+
MPTokenIssuanceSetFlagsInterface,
|
60
|
+
} from './MPTokenIssuanceSet'
|
42
61
|
export { NFTokenAcceptOffer } from './NFTokenAcceptOffer'
|
43
62
|
export { NFTokenBurn } from './NFTokenBurn'
|
44
63
|
export { NFTokenCancelOffer } from './NFTokenCancelOffer'
|
@@ -1,6 +1,10 @@
|
|
1
|
-
import { Amount } from '../common'
|
1
|
+
import { Amount, MPTAmount } from '../common'
|
2
2
|
|
3
3
|
import { BaseTransaction } from './common'
|
4
|
+
import {
|
5
|
+
MPTokenIssuanceCreate,
|
6
|
+
MPTokenIssuanceCreateMetadata,
|
7
|
+
} from './MPTokenIssuanceCreate'
|
4
8
|
import {
|
5
9
|
NFTokenAcceptOffer,
|
6
10
|
NFTokenAcceptOfferMetadata,
|
@@ -79,9 +83,9 @@ export function isDeletedNode(node: Node): node is DeletedNode {
|
|
79
83
|
|
80
84
|
export interface TransactionMetadataBase {
|
81
85
|
AffectedNodes: Node[]
|
82
|
-
DeliveredAmount?: Amount
|
86
|
+
DeliveredAmount?: Amount | MPTAmount
|
83
87
|
// "unavailable" possible for transactions before 2014-01-20
|
84
|
-
delivered_amount?: Amount | 'unavailable'
|
88
|
+
delivered_amount?: Amount | MPTAmount | 'unavailable'
|
85
89
|
TransactionIndex: number
|
86
90
|
TransactionResult: string
|
87
91
|
}
|
@@ -97,4 +101,6 @@ export type TransactionMetadata<T extends BaseTransaction = Transaction> =
|
|
97
101
|
? NFTokenAcceptOfferMetadata
|
98
102
|
: T extends NFTokenCancelOffer
|
99
103
|
? NFTokenCancelOfferMetadata
|
104
|
+
: T extends MPTokenIssuanceCreate
|
105
|
+
? MPTokenIssuanceCreateMetadata
|
100
106
|
: TransactionMetadataBase
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ValidationError } from '../../errors'
|
2
|
-
import { Amount, Path } from '../common'
|
2
|
+
import { Amount, Path, MPTAmount } from '../common'
|
3
3
|
import { isFlagEnabled } from '../utils'
|
4
4
|
|
5
5
|
import {
|
@@ -12,6 +12,7 @@ import {
|
|
12
12
|
validateOptionalField,
|
13
13
|
isNumber,
|
14
14
|
Account,
|
15
|
+
validateCredentialsList,
|
15
16
|
} from './common'
|
16
17
|
import type { TransactionMetadataBase } from './metadata'
|
17
18
|
|
@@ -116,7 +117,7 @@ export interface Payment extends BaseTransaction {
|
|
116
117
|
* names MUST be lower-case. If the tfPartialPayment flag is set, deliver up
|
117
118
|
* to this amount instead.
|
118
119
|
*/
|
119
|
-
Amount: Amount
|
120
|
+
Amount: Amount | MPTAmount
|
120
121
|
/** The unique address of the account receiving the payment. */
|
121
122
|
Destination: Account
|
122
123
|
/**
|
@@ -142,19 +143,24 @@ export interface Payment extends BaseTransaction {
|
|
142
143
|
* cross-currency/cross-issue payments. Must be omitted for XRP-to-XRP
|
143
144
|
* Payments.
|
144
145
|
*/
|
145
|
-
SendMax?: Amount
|
146
|
+
SendMax?: Amount | MPTAmount
|
146
147
|
/**
|
147
148
|
* Minimum amount of destination currency this transaction should deliver.
|
148
149
|
* Only valid if this is a partial payment. For non-XRP amounts, the nested
|
149
150
|
* field names are lower-case.
|
150
151
|
*/
|
151
|
-
DeliverMin?: Amount
|
152
|
+
DeliverMin?: Amount | MPTAmount
|
153
|
+
/**
|
154
|
+
* Credentials associated with the sender of this transaction.
|
155
|
+
* The credentials included must not be expired.
|
156
|
+
*/
|
157
|
+
CredentialIDs?: string[]
|
152
158
|
Flags?: number | PaymentFlagsInterface
|
153
159
|
}
|
154
160
|
|
155
161
|
export interface PaymentMetadata extends TransactionMetadataBase {
|
156
|
-
DeliveredAmount?: Amount
|
157
|
-
delivered_amount?: Amount | 'unavailable'
|
162
|
+
DeliveredAmount?: Amount | MPTAmount
|
163
|
+
delivered_amount?: Amount | MPTAmount | 'unavailable'
|
158
164
|
}
|
159
165
|
|
160
166
|
/**
|
@@ -177,6 +183,13 @@ export function validatePayment(tx: Record<string, unknown>): void {
|
|
177
183
|
validateRequiredField(tx, 'Destination', isAccount)
|
178
184
|
validateOptionalField(tx, 'DestinationTag', isNumber)
|
179
185
|
|
186
|
+
validateCredentialsList(
|
187
|
+
tx.CredentialIDs,
|
188
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- known from base check
|
189
|
+
tx.TransactionType as string,
|
190
|
+
true,
|
191
|
+
)
|
192
|
+
|
180
193
|
if (tx.InvoiceID !== undefined && typeof tx.InvoiceID !== 'string') {
|
181
194
|
throw new ValidationError('PaymentTransaction: InvoiceID must be a string')
|
182
195
|
}
|
@@ -1,6 +1,11 @@
|
|
1
1
|
import { ValidationError } from '../../errors'
|
2
2
|
|
3
|
-
import {
|
3
|
+
import {
|
4
|
+
BaseTransaction,
|
5
|
+
GlobalFlags,
|
6
|
+
validateBaseTransaction,
|
7
|
+
validateCredentialsList,
|
8
|
+
} from './common'
|
4
9
|
|
5
10
|
/**
|
6
11
|
* Enum representing values for PaymentChannelClaim transaction flags.
|
@@ -127,6 +132,11 @@ export interface PaymentChannelClaim extends BaseTransaction {
|
|
127
132
|
* field is omitted.
|
128
133
|
*/
|
129
134
|
PublicKey?: string
|
135
|
+
/**
|
136
|
+
* Credentials associated with the sender of this transaction.
|
137
|
+
* The credentials included must not be expired.
|
138
|
+
*/
|
139
|
+
CredentialIDs?: string[]
|
130
140
|
}
|
131
141
|
|
132
142
|
/**
|
@@ -138,6 +148,13 @@ export interface PaymentChannelClaim extends BaseTransaction {
|
|
138
148
|
export function validatePaymentChannelClaim(tx: Record<string, unknown>): void {
|
139
149
|
validateBaseTransaction(tx)
|
140
150
|
|
151
|
+
validateCredentialsList(
|
152
|
+
tx.CredentialIDs,
|
153
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- known from base check
|
154
|
+
tx.TransactionType as string,
|
155
|
+
true,
|
156
|
+
)
|
157
|
+
|
141
158
|
if (tx.Channel === undefined) {
|
142
159
|
throw new ValidationError('PaymentChannelClaim: missing Channel')
|
143
160
|
}
|
@@ -19,6 +19,9 @@ import { CheckCash, validateCheckCash } from './checkCash'
|
|
19
19
|
import { CheckCreate, validateCheckCreate } from './checkCreate'
|
20
20
|
import { Clawback, validateClawback } from './clawback'
|
21
21
|
import { BaseTransaction, isIssuedCurrency } from './common'
|
22
|
+
import { CredentialAccept, validateCredentialAccept } from './CredentialAccept'
|
23
|
+
import { CredentialCreate, validateCredentialCreate } from './CredentialCreate'
|
24
|
+
import { CredentialDelete, validateCredentialDelete } from './CredentialDelete'
|
22
25
|
import { DepositPreauth, validateDepositPreauth } from './depositPreauth'
|
23
26
|
import { DIDDelete, validateDIDDelete } from './DIDDelete'
|
24
27
|
import { DIDSet, validateDIDSet } from './DIDSet'
|
@@ -27,6 +30,19 @@ import { EscrowCancel, validateEscrowCancel } from './escrowCancel'
|
|
27
30
|
import { EscrowCreate, validateEscrowCreate } from './escrowCreate'
|
28
31
|
import { EscrowFinish, validateEscrowFinish } from './escrowFinish'
|
29
32
|
import { TransactionMetadata } from './metadata'
|
33
|
+
import { MPTokenAuthorize, validateMPTokenAuthorize } from './MPTokenAuthorize'
|
34
|
+
import {
|
35
|
+
MPTokenIssuanceCreate,
|
36
|
+
validateMPTokenIssuanceCreate,
|
37
|
+
} from './MPTokenIssuanceCreate'
|
38
|
+
import {
|
39
|
+
MPTokenIssuanceDestroy,
|
40
|
+
validateMPTokenIssuanceDestroy,
|
41
|
+
} from './MPTokenIssuanceDestroy'
|
42
|
+
import {
|
43
|
+
MPTokenIssuanceSet,
|
44
|
+
validateMPTokenIssuanceSet,
|
45
|
+
} from './MPTokenIssuanceSet'
|
30
46
|
import {
|
31
47
|
NFTokenAcceptOffer,
|
32
48
|
validateNFTokenAcceptOffer,
|
@@ -109,12 +125,19 @@ export type SubmittableTransaction =
|
|
109
125
|
| CheckCash
|
110
126
|
| CheckCreate
|
111
127
|
| Clawback
|
128
|
+
| CredentialAccept
|
129
|
+
| CredentialCreate
|
130
|
+
| CredentialDelete
|
112
131
|
| DIDDelete
|
113
132
|
| DIDSet
|
114
133
|
| DepositPreauth
|
115
134
|
| EscrowCancel
|
116
135
|
| EscrowCreate
|
117
136
|
| EscrowFinish
|
137
|
+
| MPTokenAuthorize
|
138
|
+
| MPTokenIssuanceCreate
|
139
|
+
| MPTokenIssuanceDestroy
|
140
|
+
| MPTokenIssuanceSet
|
118
141
|
| NFTokenAcceptOffer
|
119
142
|
| NFTokenBurn
|
120
143
|
| NFTokenCancelOffer
|
@@ -282,6 +305,18 @@ export function validate(transaction: Record<string, unknown>): void {
|
|
282
305
|
validateClawback(tx)
|
283
306
|
break
|
284
307
|
|
308
|
+
case 'CredentialAccept':
|
309
|
+
validateCredentialAccept(tx)
|
310
|
+
break
|
311
|
+
|
312
|
+
case 'CredentialCreate':
|
313
|
+
validateCredentialCreate(tx)
|
314
|
+
break
|
315
|
+
|
316
|
+
case 'CredentialDelete':
|
317
|
+
validateCredentialDelete(tx)
|
318
|
+
break
|
319
|
+
|
285
320
|
case 'DIDDelete':
|
286
321
|
validateDIDDelete(tx)
|
287
322
|
break
|
@@ -306,6 +341,22 @@ export function validate(transaction: Record<string, unknown>): void {
|
|
306
341
|
validateEscrowFinish(tx)
|
307
342
|
break
|
308
343
|
|
344
|
+
case 'MPTokenAuthorize':
|
345
|
+
validateMPTokenAuthorize(tx)
|
346
|
+
break
|
347
|
+
|
348
|
+
case 'MPTokenIssuanceCreate':
|
349
|
+
validateMPTokenIssuanceCreate(tx)
|
350
|
+
break
|
351
|
+
|
352
|
+
case 'MPTokenIssuanceDestroy':
|
353
|
+
validateMPTokenIssuanceDestroy(tx)
|
354
|
+
break
|
355
|
+
|
356
|
+
case 'MPTokenIssuanceSet':
|
357
|
+
validateMPTokenIssuanceSet(tx)
|
358
|
+
break
|
359
|
+
|
309
360
|
case 'NFTokenAcceptOffer':
|
310
361
|
validateNFTokenAcceptOffer(tx)
|
311
362
|
break
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/* eslint-disable no-param-reassign -- param reassign is safe */
|
2
2
|
/* eslint-disable no-bitwise -- flags require bitwise operations */
|
3
|
-
|
4
3
|
import { ValidationError } from '../../errors'
|
5
4
|
import {
|
6
5
|
AccountRootFlagsInterface,
|
@@ -10,6 +9,9 @@ import { AccountSetTfFlags } from '../transactions/accountSet'
|
|
10
9
|
import { AMMDepositFlags } from '../transactions/AMMDeposit'
|
11
10
|
import { AMMWithdrawFlags } from '../transactions/AMMWithdraw'
|
12
11
|
import { GlobalFlags } from '../transactions/common'
|
12
|
+
import { MPTokenAuthorizeFlags } from '../transactions/MPTokenAuthorize'
|
13
|
+
import { MPTokenIssuanceCreateFlags } from '../transactions/MPTokenIssuanceCreate'
|
14
|
+
import { MPTokenIssuanceSetFlags } from '../transactions/MPTokenIssuanceSet'
|
13
15
|
import { NFTokenCreateOfferFlags } from '../transactions/NFTokenCreateOffer'
|
14
16
|
import { NFTokenMintFlags } from '../transactions/NFTokenMint'
|
15
17
|
import { OfferCreateFlags } from '../transactions/offerCreate'
|
@@ -49,6 +51,9 @@ const txToFlag = {
|
|
49
51
|
AccountSet: AccountSetTfFlags,
|
50
52
|
AMMDeposit: AMMDepositFlags,
|
51
53
|
AMMWithdraw: AMMWithdrawFlags,
|
54
|
+
MPTokenAuthorize: MPTokenAuthorizeFlags,
|
55
|
+
MPTokenIssuanceCreate: MPTokenIssuanceCreateFlags,
|
56
|
+
MPTokenIssuanceSet: MPTokenIssuanceSetFlags,
|
52
57
|
NFTokenCreateOffer: NFTokenCreateOfferFlags,
|
53
58
|
NFTokenMint: NFTokenMintFlags,
|
54
59
|
OfferCreate: OfferCreateFlags,
|
@@ -90,3 +95,30 @@ function convertFlagsToNumber(flags: GlobalFlags, flagEnum: any): number {
|
|
90
95
|
return flags[flag] ? resultFlags | flagEnum[flag] : resultFlags
|
91
96
|
}, 0)
|
92
97
|
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Convert a Transaction flags property into a map for easy interpretation.
|
101
|
+
*
|
102
|
+
* @param tx - A transaction to parse flags for.
|
103
|
+
* @returns A map with all flags as booleans.
|
104
|
+
*/
|
105
|
+
export function parseTransactionFlags(tx: Transaction): object {
|
106
|
+
setTransactionFlagsToNumber(tx)
|
107
|
+
if (typeof tx.Flags !== 'number' || !tx.Flags || tx.Flags === 0) {
|
108
|
+
return {}
|
109
|
+
}
|
110
|
+
|
111
|
+
const flags = tx.Flags
|
112
|
+
const flagsMap = {}
|
113
|
+
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- safe member access
|
115
|
+
const flagEnum = txToFlag[tx.TransactionType]
|
116
|
+
Object.values(flagEnum).forEach((flag) => {
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- safe member access
|
118
|
+
if (typeof flag === 'string' && isFlagEnabled(flags, flagEnum[flag])) {
|
119
|
+
flagsMap[flag] = true
|
120
|
+
}
|
121
|
+
})
|
122
|
+
|
123
|
+
return flagsMap
|
124
|
+
}
|