xrpjson 0.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/LICENSE +21 -0
- package/README.md +183 -0
- package/dist/errors.d.ts +20 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +27 -0
- package/dist/errors.js.map +1 -0
- package/dist/fp/factories/account-delete.d.ts +33 -0
- package/dist/fp/factories/account-delete.d.ts.map +1 -0
- package/dist/fp/factories/account-delete.js +138 -0
- package/dist/fp/factories/account-delete.js.map +1 -0
- package/dist/fp/factories/account-set.d.ts +31 -0
- package/dist/fp/factories/account-set.d.ts.map +1 -0
- package/dist/fp/factories/account-set.js +44 -0
- package/dist/fp/factories/account-set.js.map +1 -0
- package/dist/fp/factories/amm-bid.d.ts +134 -0
- package/dist/fp/factories/amm-bid.d.ts.map +1 -0
- package/dist/fp/factories/amm-bid.js +82 -0
- package/dist/fp/factories/amm-bid.js.map +1 -0
- package/dist/fp/factories/amm-clawback.d.ts +166 -0
- package/dist/fp/factories/amm-clawback.d.ts.map +1 -0
- package/dist/fp/factories/amm-clawback.js +143 -0
- package/dist/fp/factories/amm-clawback.js.map +1 -0
- package/dist/fp/factories/amm-create.d.ts +91 -0
- package/dist/fp/factories/amm-create.d.ts.map +1 -0
- package/dist/fp/factories/amm-create.js +140 -0
- package/dist/fp/factories/amm-create.js.map +1 -0
- package/dist/fp/factories/amm-delete.d.ts +84 -0
- package/dist/fp/factories/amm-delete.d.ts.map +1 -0
- package/dist/fp/factories/amm-delete.js +36 -0
- package/dist/fp/factories/amm-delete.js.map +1 -0
- package/dist/fp/factories/amm-deposit.d.ts +109 -0
- package/dist/fp/factories/amm-deposit.d.ts.map +1 -0
- package/dist/fp/factories/amm-deposit.js +68 -0
- package/dist/fp/factories/amm-deposit.js.map +1 -0
- package/dist/fp/factories/amm-vote.d.ts +87 -0
- package/dist/fp/factories/amm-vote.d.ts.map +1 -0
- package/dist/fp/factories/amm-vote.js +53 -0
- package/dist/fp/factories/amm-vote.js.map +1 -0
- package/dist/fp/factories/amm-withdraw.d.ts +131 -0
- package/dist/fp/factories/amm-withdraw.d.ts.map +1 -0
- package/dist/fp/factories/amm-withdraw.js +147 -0
- package/dist/fp/factories/amm-withdraw.js.map +1 -0
- package/dist/fp/factories/batch.d.ts +133 -0
- package/dist/fp/factories/batch.d.ts.map +1 -0
- package/dist/fp/factories/batch.js +264 -0
- package/dist/fp/factories/batch.js.map +1 -0
- package/dist/fp/factories/check-cancel.d.ts +22 -0
- package/dist/fp/factories/check-cancel.d.ts.map +1 -0
- package/dist/fp/factories/check-cancel.js +119 -0
- package/dist/fp/factories/check-cancel.js.map +1 -0
- package/dist/fp/factories/check-cash.d.ts +84 -0
- package/dist/fp/factories/check-cash.d.ts.map +1 -0
- package/dist/fp/factories/check-cash.js +95 -0
- package/dist/fp/factories/check-cash.js.map +1 -0
- package/dist/fp/factories/check-create.d.ts +82 -0
- package/dist/fp/factories/check-create.d.ts.map +1 -0
- package/dist/fp/factories/check-create.js +101 -0
- package/dist/fp/factories/check-create.js.map +1 -0
- package/dist/fp/factories/clawback.d.ts +160 -0
- package/dist/fp/factories/clawback.d.ts.map +1 -0
- package/dist/fp/factories/clawback.js +111 -0
- package/dist/fp/factories/clawback.js.map +1 -0
- package/dist/fp/factories/confidential-mpt-clawback.d.ts +24 -0
- package/dist/fp/factories/confidential-mpt-clawback.d.ts.map +1 -0
- package/dist/fp/factories/confidential-mpt-clawback.js +200 -0
- package/dist/fp/factories/confidential-mpt-clawback.js.map +1 -0
- package/dist/fp/factories/confidential-mpt-convert-back.d.ts +32 -0
- package/dist/fp/factories/confidential-mpt-convert-back.d.ts.map +1 -0
- package/dist/fp/factories/confidential-mpt-convert-back.js +203 -0
- package/dist/fp/factories/confidential-mpt-convert-back.js.map +1 -0
- package/dist/fp/factories/confidential-mpt-convert.d.ts +32 -0
- package/dist/fp/factories/confidential-mpt-convert.d.ts.map +1 -0
- package/dist/fp/factories/confidential-mpt-convert.js +209 -0
- package/dist/fp/factories/confidential-mpt-convert.js.map +1 -0
- package/dist/fp/factories/confidential-mpt-merge-inbox.d.ts +18 -0
- package/dist/fp/factories/confidential-mpt-merge-inbox.d.ts.map +1 -0
- package/dist/fp/factories/confidential-mpt-merge-inbox.js +130 -0
- package/dist/fp/factories/confidential-mpt-merge-inbox.js.map +1 -0
- package/dist/fp/factories/confidential-mpt-send.d.ts +38 -0
- package/dist/fp/factories/confidential-mpt-send.d.ts.map +1 -0
- package/dist/fp/factories/confidential-mpt-send.js +254 -0
- package/dist/fp/factories/confidential-mpt-send.js.map +1 -0
- package/dist/fp/factories/credential-accept.d.ts +23 -0
- package/dist/fp/factories/credential-accept.d.ts.map +1 -0
- package/dist/fp/factories/credential-accept.js +135 -0
- package/dist/fp/factories/credential-accept.js.map +1 -0
- package/dist/fp/factories/credential-create.d.ts +24 -0
- package/dist/fp/factories/credential-create.d.ts.map +1 -0
- package/dist/fp/factories/credential-create.js +204 -0
- package/dist/fp/factories/credential-create.js.map +1 -0
- package/dist/fp/factories/credential-delete.d.ts +33 -0
- package/dist/fp/factories/credential-delete.d.ts.map +1 -0
- package/dist/fp/factories/credential-delete.js +167 -0
- package/dist/fp/factories/credential-delete.js.map +1 -0
- package/dist/fp/factories/delegate-set.d.ts +52 -0
- package/dist/fp/factories/delegate-set.d.ts.map +1 -0
- package/dist/fp/factories/delegate-set.js +190 -0
- package/dist/fp/factories/delegate-set.js.map +1 -0
- package/dist/fp/factories/deposit-preauth.d.ts +183 -0
- package/dist/fp/factories/deposit-preauth.d.ts.map +1 -0
- package/dist/fp/factories/deposit-preauth.js +159 -0
- package/dist/fp/factories/deposit-preauth.js.map +1 -0
- package/dist/fp/factories/did-delete.d.ts +22 -0
- package/dist/fp/factories/did-delete.d.ts.map +1 -0
- package/dist/fp/factories/did-delete.js +126 -0
- package/dist/fp/factories/did-delete.js.map +1 -0
- package/dist/fp/factories/did-set.d.ts +68 -0
- package/dist/fp/factories/did-set.d.ts.map +1 -0
- package/dist/fp/factories/did-set.js +178 -0
- package/dist/fp/factories/did-set.js.map +1 -0
- package/dist/fp/factories/escrow-cancel.d.ts +28 -0
- package/dist/fp/factories/escrow-cancel.d.ts.map +1 -0
- package/dist/fp/factories/escrow-cancel.js +127 -0
- package/dist/fp/factories/escrow-cancel.js.map +1 -0
- package/dist/fp/factories/escrow-create.d.ts +103 -0
- package/dist/fp/factories/escrow-create.d.ts.map +1 -0
- package/dist/fp/factories/escrow-create.js +133 -0
- package/dist/fp/factories/escrow-create.js.map +1 -0
- package/dist/fp/factories/escrow-finish.d.ts +39 -0
- package/dist/fp/factories/escrow-finish.d.ts.map +1 -0
- package/dist/fp/factories/escrow-finish.js +173 -0
- package/dist/fp/factories/escrow-finish.js.map +1 -0
- package/dist/fp/factories/ledger-state-fix.d.ts +31 -0
- package/dist/fp/factories/ledger-state-fix.d.ts.map +1 -0
- package/dist/fp/factories/ledger-state-fix.js +163 -0
- package/dist/fp/factories/ledger-state-fix.js.map +1 -0
- package/dist/fp/factories/loan-broker-cover-clawback.d.ts +106 -0
- package/dist/fp/factories/loan-broker-cover-clawback.d.ts.map +1 -0
- package/dist/fp/factories/loan-broker-cover-clawback.js +122 -0
- package/dist/fp/factories/loan-broker-cover-clawback.js.map +1 -0
- package/dist/fp/factories/loan-broker-cover-deposit.d.ts +65 -0
- package/dist/fp/factories/loan-broker-cover-deposit.d.ts.map +1 -0
- package/dist/fp/factories/loan-broker-cover-deposit.js +81 -0
- package/dist/fp/factories/loan-broker-cover-deposit.js.map +1 -0
- package/dist/fp/factories/loan-broker-cover-withdraw.d.ts +96 -0
- package/dist/fp/factories/loan-broker-cover-withdraw.d.ts.map +1 -0
- package/dist/fp/factories/loan-broker-cover-withdraw.js +116 -0
- package/dist/fp/factories/loan-broker-cover-withdraw.js.map +1 -0
- package/dist/fp/factories/loan-broker-delete.d.ts +20 -0
- package/dist/fp/factories/loan-broker-delete.d.ts.map +1 -0
- package/dist/fp/factories/loan-broker-delete.js +94 -0
- package/dist/fp/factories/loan-broker-delete.js.map +1 -0
- package/dist/fp/factories/loan-broker-set.d.ts +108 -0
- package/dist/fp/factories/loan-broker-set.d.ts.map +1 -0
- package/dist/fp/factories/loan-broker-set.js +133 -0
- package/dist/fp/factories/loan-broker-set.js.map +1 -0
- package/dist/fp/factories/loan-delete.d.ts +18 -0
- package/dist/fp/factories/loan-delete.d.ts.map +1 -0
- package/dist/fp/factories/loan-delete.js +95 -0
- package/dist/fp/factories/loan-delete.js.map +1 -0
- package/dist/fp/factories/loan-manage.d.ts +72 -0
- package/dist/fp/factories/loan-manage.d.ts.map +1 -0
- package/dist/fp/factories/loan-manage.js +79 -0
- package/dist/fp/factories/loan-manage.js.map +1 -0
- package/dist/fp/factories/loan-pay.d.ts +70 -0
- package/dist/fp/factories/loan-pay.d.ts.map +1 -0
- package/dist/fp/factories/loan-pay.js +115 -0
- package/dist/fp/factories/loan-pay.js.map +1 -0
- package/dist/fp/factories/loan-set.d.ts +67 -0
- package/dist/fp/factories/loan-set.d.ts.map +1 -0
- package/dist/fp/factories/loan-set.js +102 -0
- package/dist/fp/factories/loan-set.js.map +1 -0
- package/dist/fp/factories/mptoken-authorize.d.ts +83 -0
- package/dist/fp/factories/mptoken-authorize.d.ts.map +1 -0
- package/dist/fp/factories/mptoken-authorize.js +63 -0
- package/dist/fp/factories/mptoken-authorize.js.map +1 -0
- package/dist/fp/factories/mptoken-issuance-create.d.ts +71 -0
- package/dist/fp/factories/mptoken-issuance-create.d.ts.map +1 -0
- package/dist/fp/factories/mptoken-issuance-create.js +135 -0
- package/dist/fp/factories/mptoken-issuance-create.js.map +1 -0
- package/dist/fp/factories/mptoken-issuance-destroy.d.ts +32 -0
- package/dist/fp/factories/mptoken-issuance-destroy.d.ts.map +1 -0
- package/dist/fp/factories/mptoken-issuance-destroy.js +105 -0
- package/dist/fp/factories/mptoken-issuance-destroy.js.map +1 -0
- package/dist/fp/factories/mptoken-issuance-set.d.ts +196 -0
- package/dist/fp/factories/mptoken-issuance-set.d.ts.map +1 -0
- package/dist/fp/factories/mptoken-issuance-set.js +333 -0
- package/dist/fp/factories/mptoken-issuance-set.js.map +1 -0
- package/dist/fp/factories/nftoken-accept-offer.d.ts +108 -0
- package/dist/fp/factories/nftoken-accept-offer.d.ts.map +1 -0
- package/dist/fp/factories/nftoken-accept-offer.js +105 -0
- package/dist/fp/factories/nftoken-accept-offer.js.map +1 -0
- package/dist/fp/factories/nftoken-burn.d.ts +27 -0
- package/dist/fp/factories/nftoken-burn.d.ts.map +1 -0
- package/dist/fp/factories/nftoken-burn.js +125 -0
- package/dist/fp/factories/nftoken-burn.js.map +1 -0
- package/dist/fp/factories/nftoken-cancel-offer.d.ts +19 -0
- package/dist/fp/factories/nftoken-cancel-offer.d.ts.map +1 -0
- package/dist/fp/factories/nftoken-cancel-offer.js +143 -0
- package/dist/fp/factories/nftoken-cancel-offer.js.map +1 -0
- package/dist/fp/factories/nftoken-create-offer.d.ts +159 -0
- package/dist/fp/factories/nftoken-create-offer.d.ts.map +1 -0
- package/dist/fp/factories/nftoken-create-offer.js +212 -0
- package/dist/fp/factories/nftoken-create-offer.js.map +1 -0
- package/dist/fp/factories/nftoken-mint.d.ts +155 -0
- package/dist/fp/factories/nftoken-mint.d.ts.map +1 -0
- package/dist/fp/factories/nftoken-mint.js +165 -0
- package/dist/fp/factories/nftoken-mint.js.map +1 -0
- package/dist/fp/factories/nftoken-modify.d.ts +28 -0
- package/dist/fp/factories/nftoken-modify.d.ts.map +1 -0
- package/dist/fp/factories/nftoken-modify.js +209 -0
- package/dist/fp/factories/nftoken-modify.js.map +1 -0
- package/dist/fp/factories/offer-cancel.d.ts +21 -0
- package/dist/fp/factories/offer-cancel.d.ts.map +1 -0
- package/dist/fp/factories/offer-cancel.js +99 -0
- package/dist/fp/factories/offer-cancel.js.map +1 -0
- package/dist/fp/factories/offer-create.d.ts +125 -0
- package/dist/fp/factories/offer-create.d.ts.map +1 -0
- package/dist/fp/factories/offer-create.js +230 -0
- package/dist/fp/factories/offer-create.js.map +1 -0
- package/dist/fp/factories/oracle-delete.d.ts +21 -0
- package/dist/fp/factories/oracle-delete.d.ts.map +1 -0
- package/dist/fp/factories/oracle-delete.js +101 -0
- package/dist/fp/factories/oracle-delete.js.map +1 -0
- package/dist/fp/factories/oracle-set.d.ts +40 -0
- package/dist/fp/factories/oracle-set.d.ts.map +1 -0
- package/dist/fp/factories/oracle-set.js +257 -0
- package/dist/fp/factories/oracle-set.js.map +1 -0
- package/dist/fp/factories/payment-channel-claim.d.ts +153 -0
- package/dist/fp/factories/payment-channel-claim.d.ts.map +1 -0
- package/dist/fp/factories/payment-channel-claim.js +118 -0
- package/dist/fp/factories/payment-channel-claim.js.map +1 -0
- package/dist/fp/factories/payment-channel-create.d.ts +30 -0
- package/dist/fp/factories/payment-channel-create.d.ts.map +1 -0
- package/dist/fp/factories/payment-channel-create.js +172 -0
- package/dist/fp/factories/payment-channel-create.js.map +1 -0
- package/dist/fp/factories/payment-channel-fund.d.ts +25 -0
- package/dist/fp/factories/payment-channel-fund.d.ts.map +1 -0
- package/dist/fp/factories/payment-channel-fund.js +142 -0
- package/dist/fp/factories/payment-channel-fund.js.map +1 -0
- package/dist/fp/factories/payment.d.ts +65 -0
- package/dist/fp/factories/payment.d.ts.map +1 -0
- package/dist/fp/factories/payment.js +48 -0
- package/dist/fp/factories/payment.js.map +1 -0
- package/dist/fp/factories/permissioned-domain-delete.d.ts +18 -0
- package/dist/fp/factories/permissioned-domain-delete.d.ts.map +1 -0
- package/dist/fp/factories/permissioned-domain-delete.js +88 -0
- package/dist/fp/factories/permissioned-domain-delete.js.map +1 -0
- package/dist/fp/factories/permissioned-domain-set.d.ts +118 -0
- package/dist/fp/factories/permissioned-domain-set.d.ts.map +1 -0
- package/dist/fp/factories/permissioned-domain-set.js +100 -0
- package/dist/fp/factories/permissioned-domain-set.js.map +1 -0
- package/dist/fp/factories/set-regular-key.d.ts +30 -0
- package/dist/fp/factories/set-regular-key.d.ts.map +1 -0
- package/dist/fp/factories/set-regular-key.js +81 -0
- package/dist/fp/factories/set-regular-key.js.map +1 -0
- package/dist/fp/factories/signer-list-set.d.ts +61 -0
- package/dist/fp/factories/signer-list-set.d.ts.map +1 -0
- package/dist/fp/factories/signer-list-set.js +250 -0
- package/dist/fp/factories/signer-list-set.js.map +1 -0
- package/dist/fp/factories/sponsorship-set.d.ts +148 -0
- package/dist/fp/factories/sponsorship-set.d.ts.map +1 -0
- package/dist/fp/factories/sponsorship-set.js +201 -0
- package/dist/fp/factories/sponsorship-set.js.map +1 -0
- package/dist/fp/factories/sponsorship-transfer.d.ts +173 -0
- package/dist/fp/factories/sponsorship-transfer.d.ts.map +1 -0
- package/dist/fp/factories/sponsorship-transfer.js +195 -0
- package/dist/fp/factories/sponsorship-transfer.js.map +1 -0
- package/dist/fp/factories/ticket-create.d.ts +20 -0
- package/dist/fp/factories/ticket-create.d.ts.map +1 -0
- package/dist/fp/factories/ticket-create.js +120 -0
- package/dist/fp/factories/ticket-create.js.map +1 -0
- package/dist/fp/factories/trust-set.d.ts +100 -0
- package/dist/fp/factories/trust-set.d.ts.map +1 -0
- package/dist/fp/factories/trust-set.js +111 -0
- package/dist/fp/factories/trust-set.js.map +1 -0
- package/dist/fp/factories/vault-clawback.d.ts +83 -0
- package/dist/fp/factories/vault-clawback.d.ts.map +1 -0
- package/dist/fp/factories/vault-clawback.js +91 -0
- package/dist/fp/factories/vault-clawback.js.map +1 -0
- package/dist/fp/factories/vault-create.d.ts +51 -0
- package/dist/fp/factories/vault-create.d.ts.map +1 -0
- package/dist/fp/factories/vault-create.js +141 -0
- package/dist/fp/factories/vault-create.js.map +1 -0
- package/dist/fp/factories/vault-delete.d.ts +20 -0
- package/dist/fp/factories/vault-delete.d.ts.map +1 -0
- package/dist/fp/factories/vault-delete.js +103 -0
- package/dist/fp/factories/vault-delete.js.map +1 -0
- package/dist/fp/factories/vault-deposit.d.ts +56 -0
- package/dist/fp/factories/vault-deposit.d.ts.map +1 -0
- package/dist/fp/factories/vault-deposit.js +85 -0
- package/dist/fp/factories/vault-deposit.js.map +1 -0
- package/dist/fp/factories/vault-set.d.ts +32 -0
- package/dist/fp/factories/vault-set.d.ts.map +1 -0
- package/dist/fp/factories/vault-set.js +135 -0
- package/dist/fp/factories/vault-set.js.map +1 -0
- package/dist/fp/factories/vault-withdraw.d.ts +82 -0
- package/dist/fp/factories/vault-withdraw.d.ts.map +1 -0
- package/dist/fp/factories/vault-withdraw.js +122 -0
- package/dist/fp/factories/vault-withdraw.js.map +1 -0
- package/dist/fp/factories/xchain-account-create-commit.d.ts +180 -0
- package/dist/fp/factories/xchain-account-create-commit.d.ts.map +1 -0
- package/dist/fp/factories/xchain-account-create-commit.js +99 -0
- package/dist/fp/factories/xchain-account-create-commit.js.map +1 -0
- package/dist/fp/factories/xchain-add-account-create-attestation.d.ts +213 -0
- package/dist/fp/factories/xchain-add-account-create-attestation.d.ts.map +1 -0
- package/dist/fp/factories/xchain-add-account-create-attestation.js +95 -0
- package/dist/fp/factories/xchain-add-account-create-attestation.js.map +1 -0
- package/dist/fp/factories/xchain-add-claim-attestation.d.ts +206 -0
- package/dist/fp/factories/xchain-add-claim-attestation.d.ts.map +1 -0
- package/dist/fp/factories/xchain-add-claim-attestation.js +97 -0
- package/dist/fp/factories/xchain-add-claim-attestation.js.map +1 -0
- package/dist/fp/factories/xchain-claim.d.ts +187 -0
- package/dist/fp/factories/xchain-claim.d.ts.map +1 -0
- package/dist/fp/factories/xchain-claim.js +140 -0
- package/dist/fp/factories/xchain-claim.js.map +1 -0
- package/dist/fp/factories/xchain-commit.d.ts +168 -0
- package/dist/fp/factories/xchain-commit.d.ts.map +1 -0
- package/dist/fp/factories/xchain-commit.js +137 -0
- package/dist/fp/factories/xchain-commit.js.map +1 -0
- package/dist/fp/factories/xchain-create-bridge.d.ts +206 -0
- package/dist/fp/factories/xchain-create-bridge.d.ts.map +1 -0
- package/dist/fp/factories/xchain-create-bridge.js +100 -0
- package/dist/fp/factories/xchain-create-bridge.js.map +1 -0
- package/dist/fp/factories/xchain-create-claim-id.d.ts +199 -0
- package/dist/fp/factories/xchain-create-claim-id.d.ts.map +1 -0
- package/dist/fp/factories/xchain-create-claim-id.js +78 -0
- package/dist/fp/factories/xchain-create-claim-id.js.map +1 -0
- package/dist/fp/factories/xchain-modify-bridge.d.ts +198 -0
- package/dist/fp/factories/xchain-modify-bridge.d.ts.map +1 -0
- package/dist/fp/factories/xchain-modify-bridge.js +102 -0
- package/dist/fp/factories/xchain-modify-bridge.js.map +1 -0
- package/dist/fp/index.d.ts +124 -0
- package/dist/fp/index.d.ts.map +1 -0
- package/dist/fp/index.js +152 -0
- package/dist/fp/index.js.map +1 -0
- package/dist/fp/shape.d.ts +34 -0
- package/dist/fp/shape.d.ts.map +1 -0
- package/dist/fp/shape.js +80 -0
- package/dist/fp/shape.js.map +1 -0
- package/dist/types/amounts.d.ts +49 -0
- package/dist/types/amounts.d.ts.map +1 -0
- package/dist/types/amounts.js +8 -0
- package/dist/types/amounts.js.map +1 -0
- package/dist/types/base.d.ts +103 -0
- package/dist/types/base.d.ts.map +1 -0
- package/dist/types/base.js +2 -0
- package/dist/types/base.js.map +1 -0
- package/dist/types/common.d.ts +163 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +5 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/flags.d.ts +317 -0
- package/dist/types/flags.d.ts.map +1 -0
- package/dist/types/flags.js +253 -0
- package/dist/types/flags.js.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/transaction-types.d.ts +7 -0
- package/dist/types/transaction-types.d.ts.map +1 -0
- package/dist/types/transaction-types.js +2 -0
- package/dist/types/transaction-types.js.map +1 -0
- package/dist/validation/base.d.ts +8 -0
- package/dist/validation/base.d.ts.map +1 -0
- package/dist/validation/base.js +79 -0
- package/dist/validation/base.js.map +1 -0
- package/dist/validation/helpers.d.ts +42 -0
- package/dist/validation/helpers.d.ts.map +1 -0
- package/dist/validation/helpers.js +154 -0
- package/dist/validation/helpers.js.map +1 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +3 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional DIDDelete factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Deletes the sender's Decentralized Identifier (DID) ledger entry.
|
|
5
|
+
* Per XLS-40 §5.3 the only required field is `Account`; the transaction
|
|
6
|
+
* otherwise uses only the common base transaction fields. The ledger
|
|
7
|
+
* rejects the deletion with `tecNO_ENTRY` if the account does not own a
|
|
8
|
+
* DID, but that is a runtime check (not locally checkable here).
|
|
9
|
+
* Validation happens at construction; there is no way to construct an
|
|
10
|
+
* invalid tx.
|
|
11
|
+
*
|
|
12
|
+
* import { didDelete } from 'xrplt/fp';
|
|
13
|
+
* const tx = didDelete({ Account });
|
|
14
|
+
* const j = tx.toJSON();
|
|
15
|
+
* const tx2 = tx.with({ Fee: '12' });
|
|
16
|
+
*
|
|
17
|
+
* Affected amendments:
|
|
18
|
+
* - `DID` — base DIDDelete (XLS-40).
|
|
19
|
+
*
|
|
20
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/diddelete
|
|
21
|
+
* @see XLS-0040 §5.3 (DIDDelete Transaction)
|
|
22
|
+
* in `~/.mavis/docs.local/xrpl-standards/repo/XLS-0040-decentralized-identity/README.md`
|
|
23
|
+
*
|
|
24
|
+
* ## Divergences
|
|
25
|
+
*
|
|
26
|
+
* The class-based API at `src/transactions/did-delete.ts` and xrpl.js's
|
|
27
|
+
* `validateDIDDelete` both skip three rules that the canonical sources
|
|
28
|
+
* require. The factory fills them:
|
|
29
|
+
*
|
|
30
|
+
* 1. `Account` is validated as a classic/X-address via `isAccount`.
|
|
31
|
+
* The class inherits its `validate()` from `Transaction.validate()`
|
|
32
|
+
* and adds no check of its own — a malformed Account passes class
|
|
33
|
+
* validation and only fails at the ledger with `temINVALID_ACCOUNT`.
|
|
34
|
+
* The factory validates Account at construction time, consistent
|
|
35
|
+
* with every other fp factory (`oracle-delete`, `loan-delete`,
|
|
36
|
+
* `account-delete`).
|
|
37
|
+
* Source: xrpl.js `validateBaseTransaction`
|
|
38
|
+
* (`~/.mavis/docs.local/xrpl.js/repo/packages/xrpl/src/models/transactions/common.ts:987`)
|
|
39
|
+
* — only checks `isString(Account)`, no format check.
|
|
40
|
+
* Source: local `isAccount` at `src/validation/helpers.ts:55–60`.
|
|
41
|
+
* Source: XLS-0040 §5.3.2 (`Account` Internal Type: `AccountID`).
|
|
42
|
+
*
|
|
43
|
+
* 2. `Flags` is exposed and validated.
|
|
44
|
+
* The class has `ASSIGNABLE_FIELDS = []`, so callers using the
|
|
45
|
+
* class API cannot set `Flags` at all. xrpl.js's
|
|
46
|
+
* `validateDIDDelete` delegates to `validateBaseTransaction`,
|
|
47
|
+
* which does NOT validate `Flags` at all — meaning any
|
|
48
|
+
* non-negative integer, NaN, fractional value, or out-of-range
|
|
49
|
+
* value passes xrpl.js's runtime check (see
|
|
50
|
+
* `~/.mavis/docs.local/xrpl.js/repo/packages/xrpl/src/models/transactions/common.ts:964`
|
|
51
|
+
* — Flags is absent from the optional-field list).
|
|
52
|
+
* XLS-40 §5.3 defines no per-transaction flags for DIDDelete.
|
|
53
|
+
* The only valid flag bits are the two global / "universal" flags
|
|
54
|
+
* declared in ripple-binary-codec:
|
|
55
|
+
* - `tfFullyCanonicalSig` = 0x80000000 (2147483648)
|
|
56
|
+
* - `tfInnerBatchTxn` = 0x40000000 (1073741824)
|
|
57
|
+
* The factory accepts `Flags` as an optional `number`, requires
|
|
58
|
+
* it to be a non-negative integer, and rejects any value with
|
|
59
|
+
* bits set outside that valid mask.
|
|
60
|
+
* Source: ripple-binary-codec `definitions.json`
|
|
61
|
+
* (`~/.mavis/docs.local/xrpl.js/repo/packages/ripple-binary-codec/src/enums/definitions.json`)
|
|
62
|
+
* lines 5318–5321 — universal flag namespace
|
|
63
|
+
* (`tfFullyCanonicalSig`, `tfInnerBatchTxn`).
|
|
64
|
+
* Source: xrpl.js `validateBaseTransaction`
|
|
65
|
+
* (`~/.mavis/docs.local/xrpl.js/repo/packages/xrpl/src/models/transactions/common.ts:964–1037`)
|
|
66
|
+
* — Flags is not validated.
|
|
67
|
+
* Source: XLS-0040 §5.3.2 — DIDDelete defines no per-tx flags.
|
|
68
|
+
*
|
|
69
|
+
* 3. `Flags` integer-ness is enforced.
|
|
70
|
+
* Even where xrpl.js or the class lets a numeric `Flags` through,
|
|
71
|
+
* neither rejects NaN, ±Infinity, fractional values, or negatives.
|
|
72
|
+
* `Object.isFrozen` of a frozen tx would still let a poisoned
|
|
73
|
+
* numeric propagate to the ledger, where it would be serialized
|
|
74
|
+
* as 0 (silent data loss). The factory rejects non-finite or
|
|
75
|
+
* non-integer values up front.
|
|
76
|
+
* Source: xrpl.js `isNumber` (`common.ts:209`) — `typeof === 'number'`
|
|
77
|
+
* with no integer / finite check.
|
|
78
|
+
*/
|
|
79
|
+
import { isAccount, isNumber } from '../../validation/helpers.js';
|
|
80
|
+
import { ValidationError } from '../../errors.js';
|
|
81
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
82
|
+
// ─── Spec constants ──────────────────────────────────────────────────
|
|
83
|
+
// Universal / global flag bits defined in ripple-binary-codec. DIDDelete
|
|
84
|
+
// defines no per-tx flags (XLS-40 §5.3.2), so the only bits it may set
|
|
85
|
+
// are these two.
|
|
86
|
+
const TF_FULLY_CANONICAL_SIG = 0x80000000; // 2147483648
|
|
87
|
+
const TF_INNER_BATCH_TXN = 0x40000000; // 1073741824
|
|
88
|
+
const VALID_DID_DELETE_FLAGS = TF_FULLY_CANONICAL_SIG | TF_INNER_BATCH_TXN;
|
|
89
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
90
|
+
export function didDelete(props) {
|
|
91
|
+
// ── Account ── required, must be a valid XRPL classic or X-address.
|
|
92
|
+
require(props.Account, 'DIDDelete: Account is required', isAccount);
|
|
93
|
+
// ── Flags ── optional, but if present must be a non-negative integer
|
|
94
|
+
// whose only set bits are in the universal flag mask.
|
|
95
|
+
if (props.Flags !== undefined) {
|
|
96
|
+
if (!isNumber(props.Flags) ||
|
|
97
|
+
!Number.isFinite(props.Flags) ||
|
|
98
|
+
!Number.isInteger(props.Flags) ||
|
|
99
|
+
props.Flags < 0) {
|
|
100
|
+
throw new ValidationError('DIDDelete: Flags must be a non-negative integer (tfFullyCanonicalSig | tfInnerBatchTxn)');
|
|
101
|
+
}
|
|
102
|
+
if ((props.Flags & ~VALID_DID_DELETE_FLAGS) !== 0) {
|
|
103
|
+
throw new ValidationError(`DIDDelete: Flags contains invalid bits (only tfFullyCanonicalSig=0x${TF_FULLY_CANONICAL_SIG.toString(16)} and tfInnerBatchTxn=0x${TF_INNER_BATCH_TXN.toString(16)} are allowed)`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return buildFrozenTx('DIDDelete', props, {
|
|
107
|
+
validate() {
|
|
108
|
+
// Validated at construction.
|
|
109
|
+
},
|
|
110
|
+
toJSON() {
|
|
111
|
+
const json = {};
|
|
112
|
+
for (const k of Object.keys(this)) {
|
|
113
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
114
|
+
continue;
|
|
115
|
+
const v = this[k];
|
|
116
|
+
if (v !== undefined)
|
|
117
|
+
json[k] = v;
|
|
118
|
+
}
|
|
119
|
+
return json;
|
|
120
|
+
},
|
|
121
|
+
with(overrides) {
|
|
122
|
+
return didDelete(mergeForWith(this, overrides));
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=did-delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-delete.js","sourceRoot":"","sources":["../../../src/fp/factories/did-delete.ts"],"names":[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AAE,CAAC,eAAe,CAClL,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAClB,WAAW,EACX,KAAK,EACL;QACE,QAAQ;YACN,6BAA6B;QAC/B,CAAC;QACD,MAAM;YACJ,MAAM,IAAI,GAA4B,EAAE,CAAC;YACzC,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,MAAM;oBAAE,SAAS;gBACjE,MAAM,CAAC,GAAI,IAA2C,CAAC,CAAC,CAAC,CAAC;gBAC1D,IAAI,CAAC,KAAK,SAAS;oBAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAkB,SAAkC;YACtD,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAClD,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for the `DIDSet` factory.
|
|
3
|
+
*
|
|
4
|
+
* Field naming follows xrpl.js / XLS-40 exactly — no rename relative
|
|
5
|
+
* to the class API. The class's `URI` field, the xrpl.js `URI` field,
|
|
6
|
+
* and the XLS-40 `URI` field all refer to the same hex-encoded
|
|
7
|
+
* Universal Resource Identifier slot on the DID ledger entry.
|
|
8
|
+
*/
|
|
9
|
+
export interface DIDSetProps {
|
|
10
|
+
/**
|
|
11
|
+
* The unique address of the transaction sender. The DID ledger entry
|
|
12
|
+
* is owned by this account. Required, must be a valid XRPL classic
|
|
13
|
+
* or X-address.
|
|
14
|
+
*/
|
|
15
|
+
Account: string;
|
|
16
|
+
/**
|
|
17
|
+
* The DID document associated with the DID, hex-encoded. Optional,
|
|
18
|
+
* but at least one of `Data`, `DIDDocument`, or `URI` must be
|
|
19
|
+
* present (not `undefined`) for the tx to be well-formed.
|
|
20
|
+
*
|
|
21
|
+
* Pass `""` to clear an existing `DIDDocument` from the ledger
|
|
22
|
+
* entry. Source: xrpl.org `didset.md:41`.
|
|
23
|
+
*/
|
|
24
|
+
DIDDocument?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The public attestations of identity credentials associated with
|
|
27
|
+
* the DID, hex-encoded. Optional, but at least one of `Data`,
|
|
28
|
+
* `DIDDocument`, or `URI` must be present.
|
|
29
|
+
*
|
|
30
|
+
* Pass `""` to clear.
|
|
31
|
+
*/
|
|
32
|
+
Data?: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The Universal Resource Identifier associated with the DID,
|
|
35
|
+
* hex-encoded. Optional, but at least one of `Data`, `DIDDocument`,
|
|
36
|
+
* or `URI` must be present.
|
|
37
|
+
*
|
|
38
|
+
* Pass `""` to clear.
|
|
39
|
+
*/
|
|
40
|
+
URI?: string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Bit-flags for this transaction. DIDSet defines no
|
|
43
|
+
* transaction-specific flags; only the universal
|
|
44
|
+
* `tfFullyCanonicalSig` (0x80000000) is meaningful. Optional.
|
|
45
|
+
*/
|
|
46
|
+
Flags?: number | undefined;
|
|
47
|
+
/** Fee in XRP (drops), base-10 integer string. */
|
|
48
|
+
Fee?: string | undefined;
|
|
49
|
+
/** Account sequence number. */
|
|
50
|
+
Sequence?: number | undefined;
|
|
51
|
+
}
|
|
52
|
+
export interface DIDSet extends Readonly<DIDSetProps> {
|
|
53
|
+
readonly TransactionType: 'DIDSet';
|
|
54
|
+
validate(): void;
|
|
55
|
+
toJSON(): Record<string, unknown>;
|
|
56
|
+
with(overrides: Partial<DIDSetProps>): DIDSet;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build a frozen DIDSet. Throws `ValidationError` on construction if
|
|
60
|
+
* any required field is missing or malformed.
|
|
61
|
+
*
|
|
62
|
+
* The class-based equivalent validates lazily (caller must invoke
|
|
63
|
+
* `.validate()`); this functional version validates at construction.
|
|
64
|
+
* There is no way to build an invalid tx — `with()` re-runs the
|
|
65
|
+
* factory, so overrides are re-validated too.
|
|
66
|
+
*/
|
|
67
|
+
export declare function didSet(props: DIDSetProps): DIDSet;
|
|
68
|
+
//# sourceMappingURL=did-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-set.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/did-set.ts"],"names":[],"mappings":"AAoGA;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3B,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,MACf,SAAQ,QAAQ,CAAC,WAAW,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC;IACnC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC;CAC/C;AAsCD;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAwDjD"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional DIDSet factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Creates or updates a [W3C DID][xls-40] (Decentralized Identifier) ledger
|
|
5
|
+
* entry associated with the sending `Account`. Validation happens at
|
|
6
|
+
* construction; there is no way to construct an invalid tx.
|
|
7
|
+
*
|
|
8
|
+
* import { didSet } from 'xrplt/fp';
|
|
9
|
+
* const tx = didSet({
|
|
10
|
+
* Account,
|
|
11
|
+
* URI: '697066733A2F2F62616679626569676479727A7435...', // ipfs://...
|
|
12
|
+
* });
|
|
13
|
+
* tx.validate(); // no-op — already validated at construction
|
|
14
|
+
* const j = tx.toJSON();
|
|
15
|
+
* const tx2 = tx.with({ Fee: '12', Sequence: 42 });
|
|
16
|
+
*
|
|
17
|
+
* At least one of `Data`, `DIDDocument`, or `URI` must be provided — per
|
|
18
|
+
* XLS-40 the tx must carry "modification" payload or rippled rejects it
|
|
19
|
+
* with `temEMPTY_DID`. An empty string (`""`) is the canonical way to
|
|
20
|
+
* clear an existing field, per the xrpl.org DIDSet reference.
|
|
21
|
+
*
|
|
22
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/didset
|
|
23
|
+
* @see XLS-40 §5.2 (DIDSet transaction)
|
|
24
|
+
* https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0040-decentralized-identity
|
|
25
|
+
* @see xrpl.js `packages/xrpl/src/models/transactions/DIDSet.ts`
|
|
26
|
+
* (validateDIDSet — source of every guard below except the
|
|
27
|
+
* hex-format and Account-format checks, which are stricter.)
|
|
28
|
+
*
|
|
29
|
+
* ## Divergences
|
|
30
|
+
*
|
|
31
|
+
* The factory implements the canonical XRPL DIDSet shape from
|
|
32
|
+
* xrpl.js / XLS-40 / xrpl.org, which is a strict superset of the
|
|
33
|
+
* validation the class API performs. The class at
|
|
34
|
+
* `src/transactions/did-set.ts` is a minimal placeholder — it only
|
|
35
|
+
* enforces the "at least one of Data/DIDDocument/URI" rule at
|
|
36
|
+
* `validate()`-call time. Concretely:
|
|
37
|
+
*
|
|
38
|
+
* 1. **Validation is eager, not lazy.** The class lets callers
|
|
39
|
+
* construct a tx without immediately validating it; the factory
|
|
40
|
+
* runs every guard at construction so an invalid `DIDSet` is a
|
|
41
|
+
* type error (the call throws). There is no way to construct an
|
|
42
|
+
* invalid frozen tx. Sources: class `validate()` runs only when
|
|
43
|
+
* explicitly called (`src/transactions/did-set.ts:37-42`); the
|
|
44
|
+
* factory mirrors the xrpl.js guard sequence
|
|
45
|
+
* (`DIDSet.ts:31-48`) at construction time.
|
|
46
|
+
*
|
|
47
|
+
* 2. **`Account` is validated as a classic/X-address via `isAccount`,
|
|
48
|
+
* not just as a non-empty string.** The class defers `Account`
|
|
49
|
+
* validation to the base class's `validateBaseTransaction`, which
|
|
50
|
+
* only requires `typeof Account === 'string'`. The factory
|
|
51
|
+
* enforces the format regex at construction, matching the rest
|
|
52
|
+
* of the M4 fp family (delegateSet, setRegularKey, payment, etc.).
|
|
53
|
+
*
|
|
54
|
+
* 3. **`Data`, `DIDDocument`, and `URI` are validated as
|
|
55
|
+
* well-formed uppercase/lowercase hex (or `""` to clear) when
|
|
56
|
+
* present.** xrpl.js `validateDIDSet` only checks `isString`
|
|
57
|
+
* (`DIDSet.ts:34,36,38`) and lets the binary codec reject
|
|
58
|
+
* non-hex at signing time. XRPL.org's DIDSet reference documents
|
|
59
|
+
* all three fields as JSON Type `String` / Internal Type `Blob`
|
|
60
|
+
* (see the Field tables at `xrpl-dev-portal/repo/docs/
|
|
61
|
+
* references/protocol/transactions/types/didset.md:33-38`). The
|
|
62
|
+
* factory enforces the hex format pre-signing so the failure
|
|
63
|
+
* surfaces at construction, not at submit time. Empty string is
|
|
64
|
+
* accepted (and validated as a no-op hex) because the xrpl.org
|
|
65
|
+
* note "To delete the Data, DIDDocument, or URI field from an
|
|
66
|
+
* existing DID ledger entry, add the field as an empty string."
|
|
67
|
+
* (`didset.md:41`) makes `""` the canonical clear payload.
|
|
68
|
+
* Source: xrpl.org `didset.md:33-41`; XLS-40 §5.2 (DIDSet
|
|
69
|
+
* fields are `Blob` internal type).
|
|
70
|
+
*
|
|
71
|
+
* 4. **`Data`, `DIDDocument`, and `URI` lengths must be even
|
|
72
|
+
* (whole-byte blobs).** Each field is an XLS-40 "Blob", which
|
|
73
|
+
* rippled serialises as an even number of nibbles. xrpl.js does
|
|
74
|
+
* not enforce this at the validator layer (it relies on the
|
|
75
|
+
* binary codec), but odd-length hex would be rejected at sign
|
|
76
|
+
* time with a codec error rather than a clear `ValidationError`.
|
|
77
|
+
* The factory surfaces this at construction so callers don't
|
|
78
|
+
* have to wait until `encode()` to discover the typo.
|
|
79
|
+
* Source: ripple-binary-codec `definitions.json`
|
|
80
|
+
* `DIDSet.Data/DIDDocument/URI: Blob`; XLS-40 §5.2.
|
|
81
|
+
*
|
|
82
|
+
* 5. **`Flags` is validated as a finite number if present.** The
|
|
83
|
+
* spec defines no DIDSet-specific flags; the only meaningful
|
|
84
|
+
* value is the universal `tfFullyCanonicalSig` (0x80000000) that
|
|
85
|
+
* every signed transaction should set. The class accepts any
|
|
86
|
+
* `Flags` value without type-checking; the factory rejects
|
|
87
|
+
* non-numeric, `NaN`, or non-finite values. The bit itself is
|
|
88
|
+
* NOT validated against a whitelist because some legacy tooling
|
|
89
|
+
* passes through whatever the signer provides. Source: XRPL.org
|
|
90
|
+
* DIDSet reference (no transaction-specific flags table; the
|
|
91
|
+
* global flag list at
|
|
92
|
+
* `xrpl-dev-portal/repo/docs/references/protocol/transactions/
|
|
93
|
+
* common-fields.md` is authoritative).
|
|
94
|
+
*/
|
|
95
|
+
import { isAccount, isHex, isNumber, isString } from '../../validation/helpers.js';
|
|
96
|
+
import { ValidationError } from '../../errors.js';
|
|
97
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
98
|
+
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
99
|
+
/**
|
|
100
|
+
* Validate a Blob field per XLS-40: it must be a string, must be valid
|
|
101
|
+
* hex (or empty to clear), and must have even length (whole-byte
|
|
102
|
+
* encoding).
|
|
103
|
+
*
|
|
104
|
+
* The empty string is intentionally accepted because xrpl.org
|
|
105
|
+
* documents `""` as the canonical payload for clearing an existing
|
|
106
|
+
* field. Source: xrpl.org `didset.md:41`.
|
|
107
|
+
*/
|
|
108
|
+
function validateBlobField(field, value) {
|
|
109
|
+
if (!isString(value)) {
|
|
110
|
+
throw new ValidationError(`DIDSet: ${field} must be a string (hex-encoded, or "" to clear)`);
|
|
111
|
+
}
|
|
112
|
+
// Empty string is the canonical "clear" payload and is NOT hex.
|
|
113
|
+
if (value === '')
|
|
114
|
+
return;
|
|
115
|
+
if (!isHex(value)) {
|
|
116
|
+
throw new ValidationError(`DIDSet: ${field} must be valid hex (got: ${JSON.stringify(value)})`);
|
|
117
|
+
}
|
|
118
|
+
if (value.length % 2 !== 0) {
|
|
119
|
+
throw new ValidationError(`DIDSet: ${field} hex must have even length (whole bytes); got ${value.length} chars`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
123
|
+
/**
|
|
124
|
+
* Build a frozen DIDSet. Throws `ValidationError` on construction if
|
|
125
|
+
* any required field is missing or malformed.
|
|
126
|
+
*
|
|
127
|
+
* The class-based equivalent validates lazily (caller must invoke
|
|
128
|
+
* `.validate()`); this functional version validates at construction.
|
|
129
|
+
* There is no way to build an invalid tx — `with()` re-runs the
|
|
130
|
+
* factory, so overrides are re-validated too.
|
|
131
|
+
*/
|
|
132
|
+
export function didSet(props) {
|
|
133
|
+
// ── Account ── required, must be a valid XRPL classic/X-address.
|
|
134
|
+
require(props.Account, 'DIDSet: missing or invalid Account', isAccount);
|
|
135
|
+
// ── At least one of Data / DIDDocument / URI must be present. ──
|
|
136
|
+
// xrpl.js `validateDIDSet` lines 40-48; XRPL.org DIDSet "must include
|
|
137
|
+
// either Data, DIDDocument, or URI"; class `src/transactions/did-set
|
|
138
|
+
// .ts:39-41` enforces the same rule at `.validate()` time.
|
|
139
|
+
const hasData = props.Data !== undefined;
|
|
140
|
+
const hasDIDDocument = props.DIDDocument !== undefined;
|
|
141
|
+
const hasURI = props.URI !== undefined;
|
|
142
|
+
if (!hasData && !hasDIDDocument && !hasURI) {
|
|
143
|
+
throw new ValidationError('DIDSet: must specify at least one of Data, DIDDocument, or URI');
|
|
144
|
+
}
|
|
145
|
+
// ── Data / DIDDocument / URI ── if present, must be hex Blob.
|
|
146
|
+
if (hasData)
|
|
147
|
+
validateBlobField('Data', props.Data);
|
|
148
|
+
if (hasDIDDocument)
|
|
149
|
+
validateBlobField('DIDDocument', props.DIDDocument);
|
|
150
|
+
if (hasURI)
|
|
151
|
+
validateBlobField('URI', props.URI);
|
|
152
|
+
// ── Flags ── if present, must be a finite number.
|
|
153
|
+
if (props.Flags !== undefined) {
|
|
154
|
+
if (!isNumber(props.Flags) || !Number.isFinite(props.Flags)) {
|
|
155
|
+
throw new ValidationError('DIDSet: Flags must be a finite number');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return buildFrozenTx('DIDSet', props, {
|
|
159
|
+
validate() {
|
|
160
|
+
// Validated at construction.
|
|
161
|
+
},
|
|
162
|
+
toJSON() {
|
|
163
|
+
const json = {};
|
|
164
|
+
for (const k of Object.keys(this)) {
|
|
165
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
166
|
+
continue;
|
|
167
|
+
const v = this[k];
|
|
168
|
+
if (v !== undefined)
|
|
169
|
+
json[k] = v;
|
|
170
|
+
}
|
|
171
|
+
return json;
|
|
172
|
+
},
|
|
173
|
+
with(overrides) {
|
|
174
|
+
return didSet(mergeForWith(this, overrides));
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=did-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-set.js","sourceRoot":"","sources":["../../../src/fp/factories/did-set.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,IAAI,CAAe,SAA+B;YAChD,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAC/C,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface EscrowCancelProps {
|
|
2
|
+
/** The unique address of the transaction sender. Any account may cancel. */
|
|
3
|
+
Account: string;
|
|
4
|
+
/**
|
|
5
|
+
* Address of the source account that funded the escrow payment.
|
|
6
|
+
* The sender of the original `EscrowCreate` transaction.
|
|
7
|
+
*/
|
|
8
|
+
Owner: string;
|
|
9
|
+
/**
|
|
10
|
+
* Transaction sequence (or Ticket number) of the `EscrowCreate`
|
|
11
|
+
* transaction that created the escrow to cancel. `UInt32`.
|
|
12
|
+
*/
|
|
13
|
+
OfferSequence: number;
|
|
14
|
+
/** Bit-flags for this transaction. The spec defines none — must be 0. */
|
|
15
|
+
Flags?: number | undefined;
|
|
16
|
+
/** Fee in XRP (drops), base-10 integer string. */
|
|
17
|
+
Fee?: string | undefined;
|
|
18
|
+
/** Account sequence number. */
|
|
19
|
+
Sequence?: number | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface EscrowCancel extends Readonly<EscrowCancelProps> {
|
|
22
|
+
readonly TransactionType: 'EscrowCancel';
|
|
23
|
+
validate(): void;
|
|
24
|
+
toJSON(): Record<string, unknown>;
|
|
25
|
+
with(overrides: Partial<EscrowCancelProps>): EscrowCancel;
|
|
26
|
+
}
|
|
27
|
+
export declare function escrowCancel(props: EscrowCancelProps): EscrowCancel;
|
|
28
|
+
//# sourceMappingURL=escrow-cancel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow-cancel.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/escrow-cancel.ts"],"names":[],"mappings":"AA6EA,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ,CAAC,iBAAiB,CAAC;IAC/D,QAAQ,CAAC,eAAe,EAAE,cAAc,CAAC;IACzC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,YAAY,CAAC;CAC3D;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAsEnE"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional EscrowCancel factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Return escrowed funds from an expired escrow back to the original
|
|
5
|
+
* sender. The escrow must have a `CancelAfter` time that has already
|
|
6
|
+
* passed; that runtime check is enforced by rippled, not the factory.
|
|
7
|
+
* Validation here happens at construction; there is no way to construct
|
|
8
|
+
* an invalid tx.
|
|
9
|
+
*
|
|
10
|
+
* import { escrowCancel } from 'xrplt/fp';
|
|
11
|
+
* const tx = escrowCancel({ Account, Owner, OfferSequence: 7 });
|
|
12
|
+
* const j = tx.toJSON();
|
|
13
|
+
* const tx2 = tx.with({ Fee: '12' });
|
|
14
|
+
*
|
|
15
|
+
* Affected amendments:
|
|
16
|
+
* - `Escrow` (base EscrowCancel)
|
|
17
|
+
* - `TokenEscrow` (XLS-85: IOU/MPT tokens in addition to XRP)
|
|
18
|
+
*
|
|
19
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/escrowcancel
|
|
20
|
+
* @see https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0085-token-escrow
|
|
21
|
+
*
|
|
22
|
+
* ## Divergences
|
|
23
|
+
*
|
|
24
|
+
* The class-based API at `src/transactions/escrow-cancel.ts` and xrpl.js's
|
|
25
|
+
* `validateEscrowCancel` both skip three preclaim guards that the
|
|
26
|
+
* canonical sources require. The factory fills them:
|
|
27
|
+
*
|
|
28
|
+
* 1. **`OfferSequence` must be a UInt32 (non-negative integer in
|
|
29
|
+
* `[0, 0xffffffff]`).**
|
|
30
|
+
* The class only checks `isNumber(this.OfferSequence)`, which accepts
|
|
31
|
+
* any JS number — including `NaN`, `Infinity`, negatives, non-integers,
|
|
32
|
+
* and values larger than `2^32 - 1`. xrpl.js is nearly identical:
|
|
33
|
+
* `validateEscrowCancel` (`escrowCancel.ts:42–48`) only rejects
|
|
34
|
+
* `NaN` / non-numeric strings.
|
|
35
|
+
* Source: xrpl-dev-portal `escrowcancel.md` Fields table —
|
|
36
|
+
* "`OfferSequence` | Number | UInt32".
|
|
37
|
+
* Source: xrpl.js `escrowCancel.ts` — only checks
|
|
38
|
+
* `typeof OfferSequence === 'number' || 'string'` and `!Number.isNaN(Number(...))`.
|
|
39
|
+
*
|
|
40
|
+
* 2. **`Account` must be a valid XRPL classic or X-address.**
|
|
41
|
+
* The class does not validate `Account` at all (it inherits only
|
|
42
|
+
* `Transaction.validate()` and never checks the address format).
|
|
43
|
+
* The factory uses `isAccount` so a typo in the sender address is
|
|
44
|
+
* caught at construction.
|
|
45
|
+
* Source: xrpl-dev-portal basic-data-types.md — `AccountID` is a
|
|
46
|
+
* classic address or X-address.
|
|
47
|
+
*
|
|
48
|
+
* 3. **Cross-field invariant — `OfferSequence` may not equal the
|
|
49
|
+
* transaction's own `Sequence` (temBAD_SEQUENCE).**
|
|
50
|
+
* A cancel that targets its own slot is meaningless and is
|
|
51
|
+
* rejected by rippled with `temBAD_SEQUENCE`. The class does not
|
|
52
|
+
* check this; the factory does so the same way it does for
|
|
53
|
+
* `OfferCancel` (see `src/fp/factories/offer-cancel.ts`).
|
|
54
|
+
* Source: xrpl-dev-portal `tem-codes.md` row `temBAD_SEQUENCE`
|
|
55
|
+
* ("trying to cancel an offer that would have to be placed after
|
|
56
|
+
* the transaction that cancels it") — applied symmetrically to
|
|
57
|
+
* any previous-tx reference.
|
|
58
|
+
*
|
|
59
|
+
* Note: the factory does NOT enforce the ledger-time rules "the
|
|
60
|
+
* original EscrowCreate must have specified a CancelAfter time" or
|
|
61
|
+
* "the CancelAfter time must be in the past" — those are runtime
|
|
62
|
+
* `tec`-class results, not preclaim malformations. Per xrpl-dev-portal
|
|
63
|
+
* `escrowcancel.md` (Description section) they belong to rippled's
|
|
64
|
+
* apply-time checks.
|
|
65
|
+
*/
|
|
66
|
+
import { isAccount, isNumber } from '../../validation/helpers.js';
|
|
67
|
+
import { ValidationError } from '../../errors.js';
|
|
68
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
69
|
+
// ─── Spec constants ──────────────────────────────────────────────────
|
|
70
|
+
// UInt32 bounds (per xrpl-dev-portal escrowcancel.md Fields table).
|
|
71
|
+
const UINT32_MIN = 0;
|
|
72
|
+
const UINT32_MAX = 0xffffffff;
|
|
73
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
74
|
+
export function escrowCancel(props) {
|
|
75
|
+
// ── Account ── required, must be a valid XRPL classic / X-address.
|
|
76
|
+
// The class API does not check Account format at all.
|
|
77
|
+
require(props.Account, 'EscrowCancel: Account is required', isAccount);
|
|
78
|
+
// ── Owner ── required, must be a valid XRPL classic / X-address.
|
|
79
|
+
// `Owner` is the original `EscrowCreate` sender; need not equal
|
|
80
|
+
// `Account` (any account may submit an EscrowCancel per
|
|
81
|
+
// xrpl-dev-portal escrowcancel.md).
|
|
82
|
+
if (!isAccount(props.Owner)) {
|
|
83
|
+
throw new ValidationError('EscrowCancel: Owner must be a valid XRPL account address');
|
|
84
|
+
}
|
|
85
|
+
// ── OfferSequence ── required, must be an integer in [0, 0xffffffff].
|
|
86
|
+
// The class uses `isNumber`, which accepts any JS number (negatives,
|
|
87
|
+
// floats, NaN, Infinity, > UInt32). The factory tightens to UInt32.
|
|
88
|
+
if (!isNumber(props.OfferSequence)) {
|
|
89
|
+
throw new ValidationError('EscrowCancel: missing or invalid OfferSequence');
|
|
90
|
+
}
|
|
91
|
+
if (!Number.isInteger(props.OfferSequence) ||
|
|
92
|
+
props.OfferSequence < UINT32_MIN ||
|
|
93
|
+
props.OfferSequence > UINT32_MAX) {
|
|
94
|
+
throw new ValidationError(`EscrowCancel: OfferSequence must be a UInt32 in [${UINT32_MIN}, ${UINT32_MAX}]`);
|
|
95
|
+
}
|
|
96
|
+
// ── Cross-field: OfferSequence may not equal the tx's own Sequence.
|
|
97
|
+
// xrpl-dev-portal tem-codes.md: "temBAD_SEQUENCE — trying to
|
|
98
|
+
// cancel an offer that would have to be placed after the
|
|
99
|
+
// transaction that cancels it." Applied symmetrically to any
|
|
100
|
+
// previous-tx reference (EscrowCancel's OfferSequence is one).
|
|
101
|
+
if (props.Sequence !== undefined &&
|
|
102
|
+
isNumber(props.Sequence) &&
|
|
103
|
+
Number.isInteger(props.Sequence) &&
|
|
104
|
+
props.OfferSequence === props.Sequence) {
|
|
105
|
+
throw new ValidationError('EscrowCancel: OfferSequence must not equal the transaction Sequence (temBAD_SEQUENCE)');
|
|
106
|
+
}
|
|
107
|
+
return buildFrozenTx('EscrowCancel', props, {
|
|
108
|
+
validate() {
|
|
109
|
+
// Validated at construction.
|
|
110
|
+
},
|
|
111
|
+
toJSON() {
|
|
112
|
+
const json = {};
|
|
113
|
+
for (const k of Object.keys(this)) {
|
|
114
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
115
|
+
continue;
|
|
116
|
+
const v = this[k];
|
|
117
|
+
if (v !== undefined)
|
|
118
|
+
json[k] = v;
|
|
119
|
+
}
|
|
120
|
+
return json;
|
|
121
|
+
},
|
|
122
|
+
with(overrides) {
|
|
123
|
+
return escrowCancel(mergeForWith(this, overrides));
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=escrow-cancel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow-cancel.js","sourceRoot":"","sources":["../../../src/fp/factories/escrow-cancel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,oEAAoE;AACpE,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,UAAU,GAAG,UAAU,CAAC;AAgC9B,wEAAwE;AAExE,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,oEAAoE;IACpE,yDAAyD;IACzD,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,mCAAmC,EAAE,SAAS,CAAC,CAAC;IAEvE,kEAAkE;IAClE,mEAAmE;IACnE,2DAA2D;IAC3D,uCAAuC;IACvC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,eAAe,CACvB,0DAA0D,CAC3D,CAAC;IACJ,CAAC;IAED,uEAAuE;IACvE,wEAAwE;IACxE,uEAAuE;IACvE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,eAAe,CACvB,gDAAgD,CACjD,CAAC;IACJ,CAAC;IACD,IACE,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC;QACtC,KAAK,CAAC,aAAa,GA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TokenEscrow amendment, IOU/MPT tokens) in
|
|
5
|
+
* an escrow that delivers them to a predetermined recipient when
|
|
6
|
+
* certain conditions are met. Validation happens at construction;
|
|
7
|
+
* there is no way to construct an invalid tx.
|
|
8
|
+
*
|
|
9
|
+
* import { escrowCreate } from 'xrplt/fp';
|
|
10
|
+
* const tx = escrowCreate({ Account, Amount, Destination, FinishAfter: 533171558 });
|
|
11
|
+
* const j = tx.toJSON();
|
|
12
|
+
* const tx2 = tx.with({ CancelAfter: 533257958 });
|
|
13
|
+
*
|
|
14
|
+
* Affected amendments:
|
|
15
|
+
* - `Escrow` (base XRP escrow)
|
|
16
|
+
* - `TokenEscrow` (XLS-85: IOU/MPT tokens in addition to XRP)
|
|
17
|
+
*
|
|
18
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/escrowcreate
|
|
19
|
+
* @see https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0085-token-escrow
|
|
20
|
+
*
|
|
21
|
+
* ## Divergences
|
|
22
|
+
*
|
|
23
|
+
* Compared with `src/transactions/escrow-create.ts`, this factory adds
|
|
24
|
+
* preclaim guards the class API skips:
|
|
25
|
+
*
|
|
26
|
+
* 1. **`Amount` must be strictly positive (non-zero, non-negative).**
|
|
27
|
+
* Source: xrpl.js
|
|
28
|
+
* (`repo/packages/xrpl/src/models/transactions/escrowCreate.ts:25–28`) —
|
|
29
|
+
* "Must always be a positive value." The local `isAmount` helper (and the
|
|
30
|
+
* class) accept any numeric string, including `"0"` and `"-1"`, which the
|
|
31
|
+
* ledger rejects with `temBAD_AMOUNT`.
|
|
32
|
+
*
|
|
33
|
+
* 2. **`FinishAfter` must be strictly less than `CancelAfter` when both
|
|
34
|
+
* are present.**
|
|
35
|
+
* Source: xrpl.org `escrowcreate.md` fields table — "`FinishAfter` …
|
|
36
|
+
* the escrowed funds can be released to the recipient. This value is
|
|
37
|
+
* immutable" — combined with the `CancelAfter` description "the funds
|
|
38
|
+
* can only be returned to the sender after this time" — implying
|
|
39
|
+
* `FinishAfter < CancelAfter` for any meaningful escrow. The class
|
|
40
|
+
* does not enforce the ordering.
|
|
41
|
+
*
|
|
42
|
+
* 3. **`Condition` must be a hex string.**
|
|
43
|
+
* Source: xrpl.org `escrowcreate.md` — "`Condition` — Hex value
|
|
44
|
+
* representing a PREIMAGE-SHA-256 crypto-condition." The class only
|
|
45
|
+
* checks `isString(Condition)` and accepts arbitrary text.
|
|
46
|
+
*
|
|
47
|
+
* 4. **Either `FinishAfter` or `Condition` must be specified.**
|
|
48
|
+
* Source: xrpl.js
|
|
49
|
+
* (`repo/packages/xrpl/src/models/transactions/escrowCreate.ts:74–78`) —
|
|
50
|
+
* "Either Condition or FinishAfter must be specified." A conditional
|
|
51
|
+
* escrow with no `FinishAfter` and no `CancelAfter` would be
|
|
52
|
+
* unspendable forever; the class does not enforce this.
|
|
53
|
+
*
|
|
54
|
+
* 5. **`Destination` must not equal `Account`.**
|
|
55
|
+
* Source: XRPL `rippled` preclaim `temMALFORMED` for self-escrow
|
|
56
|
+
* (`EscrowCreate.cpp` — `if (ctx.tx[sfDestination] == ctx.tx[sfAccount])
|
|
57
|
+
* return temMALFORMED;`). The class only checks the address format.
|
|
58
|
+
*
|
|
59
|
+
* 6. **`DestinationTag`, `CancelAfter`, `FinishAfter` must be
|
|
60
|
+
* non-negative integers when provided.**
|
|
61
|
+
* Source: xrpl.org `escrowcreate.md` — fields are typed `UInt32`.
|
|
62
|
+
* The class accepts negative numbers as JavaScript `number`s.
|
|
63
|
+
*/
|
|
64
|
+
import type { Amount } from '../../types/amounts.js';
|
|
65
|
+
export interface EscrowCreateProps {
|
|
66
|
+
/** The unique address of the transaction sender. */
|
|
67
|
+
Account: string;
|
|
68
|
+
/** Amount of XRP (drops) or fungible token to set aside. */
|
|
69
|
+
Amount: Amount;
|
|
70
|
+
/** Address to receive escrowed funds. Must differ from `Account`. */
|
|
71
|
+
Destination: string;
|
|
72
|
+
/**
|
|
73
|
+
* Time (seconds since Ripple Epoch) after which the escrow can be
|
|
74
|
+
* cancelled and funds returned to the sender. `UInt32`.
|
|
75
|
+
*/
|
|
76
|
+
CancelAfter?: number | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Time (seconds since Ripple Epoch) after which the escrow can be
|
|
79
|
+
* finished and funds released to the destination. `UInt32`.
|
|
80
|
+
*/
|
|
81
|
+
FinishAfter?: number | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Hex PREIMAGE-SHA-256 crypto-condition. 80 hex chars.
|
|
84
|
+
*/
|
|
85
|
+
Condition?: string | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Optional destination tag (`UInt32`) — e.g. a hosted recipient
|
|
88
|
+
* identifier at the destination address.
|
|
89
|
+
*/
|
|
90
|
+
DestinationTag?: number | undefined;
|
|
91
|
+
/** Bit-flags for this transaction. EscrowCreate has no defined flags. */
|
|
92
|
+
Flags?: number | undefined;
|
|
93
|
+
Fee?: string | undefined;
|
|
94
|
+
Sequence?: number | undefined;
|
|
95
|
+
}
|
|
96
|
+
export interface EscrowCreate extends Readonly<EscrowCreateProps> {
|
|
97
|
+
readonly TransactionType: 'EscrowCreate';
|
|
98
|
+
validate(): void;
|
|
99
|
+
toJSON(): Record<string, unknown>;
|
|
100
|
+
with(overrides: Partial<EscrowCreateProps>): EscrowCreate;
|
|
101
|
+
}
|
|
102
|
+
export declare function escrowCreate(props: EscrowCreateProps): EscrowCreate;
|
|
103
|
+
//# sourceMappingURL=escrow-create.d.ts.map
|