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,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional NFTokenModify factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Modifies an existing dynamic NFToken (one minted with the `tfMutable`
|
|
5
|
+
* flag enabled, per XLS-46). Currently the only mutable field is `URI`.
|
|
6
|
+
* Validation happens at construction; there is no way to construct an
|
|
7
|
+
* invalid tx.
|
|
8
|
+
*
|
|
9
|
+
* import { nftokenModify } from 'xrplt/fp';
|
|
10
|
+
* const tx = nftokenModify({ Account, NFTokenID });
|
|
11
|
+
* const tx2 = nftokenModify({
|
|
12
|
+
* Account, NFTokenID,
|
|
13
|
+
* URI: '697066733A2F2F62616679',
|
|
14
|
+
* Owner: 'rogue5HnPRSszD9CWGSUz8UGHMVwSSKF6',
|
|
15
|
+
* });
|
|
16
|
+
* const j = tx2.toJSON();
|
|
17
|
+
* const tx3 = tx2.with({ URI: '6F746865726D657461' });
|
|
18
|
+
*
|
|
19
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/nftokenmodify
|
|
20
|
+
* @see https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/NFTokenModify.ts
|
|
21
|
+
* @see XLS-0046 (Dynamic Non-Fungible Tokens) §3.2
|
|
22
|
+
* (`~/.mavis/docs.local/xrpl-standards/repo/XLS-0046-dynamic-non-fungible-tokens/README.md`
|
|
23
|
+
* lines 49–95)
|
|
24
|
+
*
|
|
25
|
+
* Affected amendments:
|
|
26
|
+
* - `DynamicNFT` — required for the transaction to be accepted.
|
|
27
|
+
* - `NonFungibleTokensV1` (XLS-20) — base NFToken support.
|
|
28
|
+
* - `NonFungibleTokensV1_1` — adds the optional `Owner` field.
|
|
29
|
+
*
|
|
30
|
+
* ## Divergences
|
|
31
|
+
*
|
|
32
|
+
* Compared with `src/transactions/nftoken-modify.ts`, this factory adds
|
|
33
|
+
* guards the class skips (or that xrpl.js / xrpl.org / XLS-46 mandate
|
|
34
|
+
* but the class omits):
|
|
35
|
+
*
|
|
36
|
+
* - **`NFTokenID` must be a 64-character hexadecimal string** — XLS-46
|
|
37
|
+
* §3.2 line 69 declares `NFTokenID` as `UINT256`. xrpl.org
|
|
38
|
+
* `nftokenmodify.md` line 37 labels it "String - Hexadecimal" with
|
|
39
|
+
* internal type `UInt256`. A UInt256 in hex is 64 characters.
|
|
40
|
+
* xrpl.js's `validateNFTokenModify` (line 55) only checks `isString`,
|
|
41
|
+
* and the class inherits the same laxness. The factory enforces the
|
|
42
|
+
* on-ledger shape.
|
|
43
|
+
* - Source: XLS-46 §3.2 line 69 (`UINT256`).
|
|
44
|
+
* - Source: xrpl.org `nftokenmodify.md` line 37 (UInt256, String -
|
|
45
|
+
* Hexadecimal).
|
|
46
|
+
* - Cross-ref: rippled parses `NFTokenID` as `HASH256` via
|
|
47
|
+
* `NFTokenModify.cpp`; HASH256 is 32 bytes = 64 hex chars.
|
|
48
|
+
*
|
|
49
|
+
* - **All-zero `NFTokenID` is rejected** — HASH256 zero is malformed
|
|
50
|
+
* by general convention. The class permits `'00…00'` because any
|
|
51
|
+
* 64-char hex passes `isString` + length check. The decoded
|
|
52
|
+
* NFTokenID contains a 160-bit account ID in bytes [8, 48); an
|
|
53
|
+
* all-zero ID cannot encode a valid account, so a real modify
|
|
54
|
+
* against the zero NFTokenID would be rejected on-ledger as
|
|
55
|
+
* `temMALFORMED`. We catch it at construction.
|
|
56
|
+
* - Source: HASH256 convention (analogous to VaultID, LoanID,
|
|
57
|
+
* LoanBrokerID, NFTokenBurn.NFTokenID all-zeros rejection across
|
|
58
|
+
* this codebase; see `src/fp/factories/nftoken-burn.ts`).
|
|
59
|
+
*
|
|
60
|
+
* - **`URI` must be hex-encoded** — XLS-46 §3.2 line 76 declares `URI`
|
|
61
|
+
* as `BLOB`. xrpl.js's `validateNFTokenModify` (lines 59–65) checks
|
|
62
|
+
* `isHex` when URI is a non-empty string. The class accepts any
|
|
63
|
+
* string. We enforce hex at construction.
|
|
64
|
+
* - Source: XLS-46 §3.2 line 76 (`BLOB`).
|
|
65
|
+
* - Source: xrpl.js `NFTokenModify.ts` lines 59–65.
|
|
66
|
+
* - Source: xrpl.org `nftokenmodify.md` line 38 ("In JSON, this
|
|
67
|
+
* should be encoded as a string of hexadecimal").
|
|
68
|
+
*
|
|
69
|
+
* - **`URI` must not be an empty string** — xrpl.js
|
|
70
|
+
* `validateNFTokenModify` (lines 60–62) rejects `''`. xrpl.org
|
|
71
|
+
* `nftokenmodify.md` line 38 documents that omitting the field
|
|
72
|
+
* deletes any existing URI, but setting it to `""` is distinct from
|
|
73
|
+
* omitting it. The class accepts `''`. We mirror xrpl.js.
|
|
74
|
+
* - Source: xrpl.js `NFTokenModify.ts` lines 60–62.
|
|
75
|
+
* - Source: xrpl.org `nftokenmodify.md` line 38 ("Omit it from the
|
|
76
|
+
* transaction… if you do not use it" — i.e., `""` ≠ omitted).
|
|
77
|
+
*
|
|
78
|
+
* - **`URI` length capped at 256 bytes (512 hex chars)** — xrpl.org
|
|
79
|
+
* `nftokenmodify.md` line 38 states "Up to 256 bytes of arbitrary
|
|
80
|
+
* data." XLS-46 §3.2 line 76 declares the type as `BLOB` with no
|
|
81
|
+
* explicit limit, but the on-ledger cap matches XLS-20 §1.3.3
|
|
82
|
+
* (`NFTokenMint.URI` is also limited to 256 bytes). The class does
|
|
83
|
+
* not enforce this. The factory enforces 256 bytes (512 hex chars)
|
|
84
|
+
* and also rejects odd-length hex so byte-alignment is preserved.
|
|
85
|
+
* - Source: xrpl.org `nftokenmodify.md` line 38 ("limited to a
|
|
86
|
+
* maximum length of 256 bytes" — same wording as nftokenmint.md
|
|
87
|
+
* line 53).
|
|
88
|
+
* - Cross-ref: XLS-20 §1.3.3 line 134 (256-byte BLOB cap applied to
|
|
89
|
+
* NFTokenMint.URI; NFTokenModify reuses the same wire field).
|
|
90
|
+
*
|
|
91
|
+
* - **`Owner` must not equal `Account`** — XLS-46 §3.2 line 59 says
|
|
92
|
+
* "in case of `Owner` not specified, it's implied that the
|
|
93
|
+
* submitting `account` is also the `Owner` of the NFT." xrpl.org
|
|
94
|
+
* `nftokenmodify.md` line 36 says "If the `Account` and `Owner` are
|
|
95
|
+
* the same address, omit this field." Including `Owner: Account` is
|
|
96
|
+
* therefore redundant and confusing; xrpl.js does not enforce it
|
|
97
|
+
* (passes through `validateOptionalField(tx, 'Owner', isAccount)`),
|
|
98
|
+
* and the class does not enforce it either. We reject it for
|
|
99
|
+
* clarity — this also catches the common "I forgot to omit Owner"
|
|
100
|
+
* bug at construction time.
|
|
101
|
+
* - Source: xrpl.org `nftokenmodify.md` line 36 ("If the `Account`
|
|
102
|
+
* and `Owner` are the same address, omit this field").
|
|
103
|
+
* - Source: XLS-46 §3.2 line 59.
|
|
104
|
+
*
|
|
105
|
+
* - **`URI` omitted is permitted (deletes existing URI)** — xrpl.org
|
|
106
|
+
* `nftokenmodify.md` line 38 documents that omitting URI deletes any
|
|
107
|
+
* existing URI on the token. The class permits this by leaving
|
|
108
|
+
* `this.URI` undefined. We mirror the permissive behavior — there is
|
|
109
|
+
* no cross-field rule binding URI to other fields, and the field is
|
|
110
|
+
* genuinely optional in the protocol sense.
|
|
111
|
+
* - Source: xrpl.org `nftokenmodify.md` line 38 ("If you do not
|
|
112
|
+
* specify a URI, the existing URI is deleted").
|
|
113
|
+
*
|
|
114
|
+
* - **`Flags` accepted for parity with the base transaction shape** —
|
|
115
|
+
* NFTokenModify itself defines no transaction-specific flags; only
|
|
116
|
+
* `tfFullyCanonicalSig` (global) is normally meaningful. The class
|
|
117
|
+
* does not declare a Flags field. We accept a numeric bitmask for
|
|
118
|
+
* parity with the base tx shape (matches `nftoken-burn.ts` pattern).
|
|
119
|
+
* This is a permissive addition, not a tightening; callers who pass
|
|
120
|
+
* a non-zero Flags get the value stored verbatim. (Divergence is
|
|
121
|
+
* documented for awareness; no spec source requires flag rejection
|
|
122
|
+
* for NFTokenModify.)
|
|
123
|
+
*/
|
|
124
|
+
import { isAccount, isHex, isString } from '../../validation/helpers.js';
|
|
125
|
+
import { ValidationError } from '../../errors.js';
|
|
126
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
127
|
+
// ─── Spec constants ──────────────────────────────────────────────────
|
|
128
|
+
// HASH256 (UInt256) in hex is 64 characters. XLS-46 §3.2 line 69:
|
|
129
|
+
// NFTokenID internal type is UINT256; xrpl.org nftokenmodify.md
|
|
130
|
+
// confirms UInt256.
|
|
131
|
+
const NFTOKEN_ID_HEX_LENGTH = 64;
|
|
132
|
+
// All-zero HASH256 is reserved / malformed by general convention.
|
|
133
|
+
const NFTOKEN_ID_ZERO = '0'.repeat(NFTOKEN_ID_HEX_LENGTH);
|
|
134
|
+
// XLS-46 §3.2 line 76 / xrpl.org nftokenmodify.md line 38: URI is a BLOB
|
|
135
|
+
// with max 256 bytes.
|
|
136
|
+
const MAX_URI_BYTES = 256;
|
|
137
|
+
const MAX_URI_HEX_CHARS = MAX_URI_BYTES * 2;
|
|
138
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
139
|
+
export function nftokenModify(props) {
|
|
140
|
+
// ── Account ── required, must be a valid XRPL account.
|
|
141
|
+
require(props.Account, 'NFTokenModify: Account is required', isAccount);
|
|
142
|
+
// ── NFTokenID ── required, 64-char hex (HASH256 / UInt256),
|
|
143
|
+
// and not all-zero.
|
|
144
|
+
if (!isString(props.NFTokenID)) {
|
|
145
|
+
throw new ValidationError('NFTokenModify: NFTokenID is required and must be a string');
|
|
146
|
+
}
|
|
147
|
+
if (!isHex(props.NFTokenID)) {
|
|
148
|
+
throw new ValidationError('NFTokenModify: NFTokenID must be a hex-encoded string');
|
|
149
|
+
}
|
|
150
|
+
if (props.NFTokenID.length !== NFTOKEN_ID_HEX_LENGTH) {
|
|
151
|
+
throw new ValidationError(`NFTokenModify: NFTokenID must be exactly ${NFTOKEN_ID_HEX_LENGTH} hex characters (HASH256)`);
|
|
152
|
+
}
|
|
153
|
+
if (props.NFTokenID === NFTOKEN_ID_ZERO) {
|
|
154
|
+
throw new ValidationError('NFTokenModify: NFTokenID must not be the all-zero HASH256 value');
|
|
155
|
+
}
|
|
156
|
+
// ── URI ── optional, non-empty hex, even length, ≤ 256 bytes
|
|
157
|
+
// (512 hex chars). Odd-length hex is invalid by the BLOB
|
|
158
|
+
// spec; omitting URI is permitted (deletes existing URI on
|
|
159
|
+
// the token).
|
|
160
|
+
if (props.URI !== undefined) {
|
|
161
|
+
if (!isString(props.URI)) {
|
|
162
|
+
throw new ValidationError('NFTokenModify: URI must be a hex-encoded string');
|
|
163
|
+
}
|
|
164
|
+
if (props.URI.length === 0) {
|
|
165
|
+
throw new ValidationError('NFTokenModify: URI must not be an empty string');
|
|
166
|
+
}
|
|
167
|
+
if (!isHex(props.URI)) {
|
|
168
|
+
throw new ValidationError('NFTokenModify: URI must be a hex-encoded string');
|
|
169
|
+
}
|
|
170
|
+
if (props.URI.length % 2 !== 0) {
|
|
171
|
+
throw new ValidationError('NFTokenModify: URI must have an even number of hex characters (BLOB is byte-aligned)');
|
|
172
|
+
}
|
|
173
|
+
if (props.URI.length > MAX_URI_HEX_CHARS) {
|
|
174
|
+
throw new ValidationError(`NFTokenModify: URI exceeds ${MAX_URI_BYTES} bytes (${MAX_URI_HEX_CHARS} hex chars); actual: ${props.URI.length}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// ── Owner ── optional, must be a valid XRPL account when present,
|
|
178
|
+
// and must NOT equal Account (xrpl.org nftokenmodify.md
|
|
179
|
+
// line 36: "If the `Account` and `Owner` are the same
|
|
180
|
+
// address, omit this field").
|
|
181
|
+
if (props.Owner !== undefined) {
|
|
182
|
+
if (!isAccount(props.Owner)) {
|
|
183
|
+
throw new ValidationError('NFTokenModify: Owner must be a valid XRPL account address');
|
|
184
|
+
}
|
|
185
|
+
if (props.Owner === props.Account) {
|
|
186
|
+
throw new ValidationError('NFTokenModify: Owner must not equal Account (omit Owner instead; xrpl.org nftokenmodify.md)');
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return buildFrozenTx('NFTokenModify', props, {
|
|
190
|
+
validate() {
|
|
191
|
+
// Validated at construction.
|
|
192
|
+
},
|
|
193
|
+
toJSON() {
|
|
194
|
+
const json = {};
|
|
195
|
+
for (const k of Object.keys(this)) {
|
|
196
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
197
|
+
continue;
|
|
198
|
+
const v = this[k];
|
|
199
|
+
if (v !== undefined)
|
|
200
|
+
json[k] = v;
|
|
201
|
+
}
|
|
202
|
+
return json;
|
|
203
|
+
},
|
|
204
|
+
with(overrides) {
|
|
205
|
+
return nftokenModify(mergeForWith(this, overrides));
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=nftoken-modify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nftoken-modify.js","sourceRoot":"","sources":["../../../src/fp/factories/nftoken-modify.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface OfferCancelProps {
|
|
2
|
+
/** The unique address of the transaction sender (the offer owner). */
|
|
3
|
+
Account: string;
|
|
4
|
+
/**
|
|
5
|
+
* The sequence number (or Ticket number) of a previous OfferCreate
|
|
6
|
+
* transaction. If specified, cancel any offer object in the ledger
|
|
7
|
+
* that was created by that transaction. It is not considered an
|
|
8
|
+
* error if the offer specified does not exist.
|
|
9
|
+
*/
|
|
10
|
+
OfferSequence: number;
|
|
11
|
+
Fee?: string | undefined;
|
|
12
|
+
Sequence?: number | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface OfferCancel extends Readonly<OfferCancelProps> {
|
|
15
|
+
readonly TransactionType: 'OfferCancel';
|
|
16
|
+
validate(): void;
|
|
17
|
+
toJSON(): Record<string, unknown>;
|
|
18
|
+
with(overrides: Partial<OfferCancelProps>): OfferCancel;
|
|
19
|
+
}
|
|
20
|
+
export declare function offerCancel(props: OfferCancelProps): OfferCancel;
|
|
21
|
+
//# sourceMappingURL=offer-cancel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offer-cancel.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/offer-cancel.ts"],"names":[],"mappings":"AA8DA,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,WACf,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC;IACxC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,WAAW,CAAC;CACzD;AAID,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CAsDhE"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional OfferCancel factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Cancels an existing offer on the DEX. Validation happens at
|
|
5
|
+
* construction; there is no way to construct an invalid tx.
|
|
6
|
+
*
|
|
7
|
+
* import { offerCancel } from 'xrplt/fp';
|
|
8
|
+
* const tx = offerCancel({ Account, OfferSequence: 6 });
|
|
9
|
+
* const j = tx.toJSON();
|
|
10
|
+
* const tx2 = tx.with({ OfferSequence: 7 });
|
|
11
|
+
*
|
|
12
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/offercancel
|
|
13
|
+
* @see https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/offerCancel.ts
|
|
14
|
+
*
|
|
15
|
+
* ## Divergences
|
|
16
|
+
*
|
|
17
|
+
* Compared with `src/transactions/offer-cancel.ts`, this factory adds
|
|
18
|
+
* guards the class skips and tightens the spec compliance:
|
|
19
|
+
*
|
|
20
|
+
* - **`OfferSequence` must be a UInt32.** The class only checks
|
|
21
|
+
* `isNumber(this.OfferSequence)`, which accepts any JS number —
|
|
22
|
+
* including negative numbers, NaN, Infinity, and non-integers, and
|
|
23
|
+
* values larger than `2^32 - 1`. rippled rejects these with
|
|
24
|
+
* `temMALFORMED` ("Unspecified problem with the format of the
|
|
25
|
+
* transaction"). The factory additionally requires an integer in
|
|
26
|
+
* `[0, 0xffffffff]`.
|
|
27
|
+
* - Source: xrpl-dev-portal `offercancel.md` Fields table
|
|
28
|
+
* `OfferSequence | Number | UInt32`.
|
|
29
|
+
* - Source: xrpl.js `validateOfferCancel` (`offerCancel.ts` line 34)
|
|
30
|
+
* checks `typeof tx.OfferSequence === 'number'` only.
|
|
31
|
+
*
|
|
32
|
+
* - **`OfferSequence` may not equal the transaction's own `Sequence`.**
|
|
33
|
+
* rippled rejects this with `temBAD_SEQUENCE` ("The transaction is
|
|
34
|
+
* references a sequence number that is higher than its own `Sequence`
|
|
35
|
+
* number"). A cancel that targets its own slot is meaningless and
|
|
36
|
+
* spec-illegal. The class skips this cross-field invariant entirely.
|
|
37
|
+
* - Source: xrpl-dev-portal `offercancel.md` (implicit via
|
|
38
|
+
* OfferSequence's role as a previous-tx reference).
|
|
39
|
+
* - Source: xrpl-dev-portal `tem-codes.md` row `temBAD_SEQUENCE`
|
|
40
|
+
* ("trying to cancel an offer that would have to be placed after
|
|
41
|
+
* the transaction that cancels it").
|
|
42
|
+
*
|
|
43
|
+
* - **`Account` must be a valid XRPL classic or X-address.** The class
|
|
44
|
+
* inherits only `validateBaseTransaction`'s `isString(Account)` check
|
|
45
|
+
* (or none at all, since `OfferTransaction` itself is empty). The
|
|
46
|
+
* factory uses `isAccount` so an obvious typo (e.g. `"r…"`) is caught
|
|
47
|
+
* at construction.
|
|
48
|
+
* - Source: xrpl-dev-portal basic-data-types.md (`AccountID` is a
|
|
49
|
+
* classic address or X-address).
|
|
50
|
+
*/
|
|
51
|
+
import { isAccount, isNumber } from '../../validation/helpers.js';
|
|
52
|
+
import { ValidationError } from '../../errors.js';
|
|
53
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
54
|
+
// ─── Spec constants ──────────────────────────────────────────────────
|
|
55
|
+
// UInt32 bounds (per xrpl-dev-portal offercancel.md Fields table).
|
|
56
|
+
const UINT32_MIN = 0;
|
|
57
|
+
const UINT32_MAX = 0xffffffff;
|
|
58
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
59
|
+
export function offerCancel(props) {
|
|
60
|
+
// ── Account ── required, must be a valid XRPL classic / X-address.
|
|
61
|
+
require(props.Account, 'OfferCancel: Account is required', isAccount);
|
|
62
|
+
// ── OfferSequence ── required, must be an integer in [0, 0xffffffff].
|
|
63
|
+
if (!isNumber(props.OfferSequence)) {
|
|
64
|
+
throw new ValidationError('OfferCancel: missing or invalid OfferSequence');
|
|
65
|
+
}
|
|
66
|
+
if (!Number.isInteger(props.OfferSequence) ||
|
|
67
|
+
props.OfferSequence < UINT32_MIN ||
|
|
68
|
+
props.OfferSequence > UINT32_MAX) {
|
|
69
|
+
throw new ValidationError(`OfferCancel: OfferSequence must be a UInt32 in [${UINT32_MIN}, ${UINT32_MAX}]`);
|
|
70
|
+
}
|
|
71
|
+
// ── Cross-field: OfferSequence may not equal the tx's own Sequence.
|
|
72
|
+
// (xrpl-dev-portal tem-codes.md temBAD_SEQUENCE row.)
|
|
73
|
+
if (props.Sequence !== undefined &&
|
|
74
|
+
isNumber(props.Sequence) &&
|
|
75
|
+
Number.isInteger(props.Sequence) &&
|
|
76
|
+
props.OfferSequence === props.Sequence) {
|
|
77
|
+
throw new ValidationError('OfferCancel: OfferSequence must not equal the transaction Sequence (temBAD_SEQUENCE)');
|
|
78
|
+
}
|
|
79
|
+
return buildFrozenTx('OfferCancel', props, {
|
|
80
|
+
validate() {
|
|
81
|
+
// Validated at construction.
|
|
82
|
+
},
|
|
83
|
+
toJSON() {
|
|
84
|
+
const json = {};
|
|
85
|
+
for (const k of Object.keys(this)) {
|
|
86
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
87
|
+
continue;
|
|
88
|
+
const v = this[k];
|
|
89
|
+
if (v !== undefined)
|
|
90
|
+
json[k] = v;
|
|
91
|
+
}
|
|
92
|
+
return json;
|
|
93
|
+
},
|
|
94
|
+
with(overrides) {
|
|
95
|
+
return offerCancel(mergeForWith(this, overrides));
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=offer-cancel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offer-cancel.js","sourceRoot":"","sources":["../../../src/fp/factories/offer-cancel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;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,mEAAmE;AACnE,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,UAAU,GAAG,UAAU,CAAC;AA0B9B,wEAAwE;AAExE,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,oEAAoE;IACpE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,kCAAkC,EAAE,SAAS,CAAC,CAAC;IAEtE,uEAAuE;IACvE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,eAAe,CACvB,+CAA+C,CAChD,CAAC;IACJ,CAAC;IACD,IACE,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC;QACtC,KAAK,CAAC,aAAa,GAAG,UAAU;QAChC,KAAK,CAAC,aAAa,GAAG,UAAU,EAChC,CAAC;QACD,MAAM,IAAI,eAAe,CACvB,mDAAmD,UAAU,KAAK,UAAU,GAAG,CAChF,CAAC;IACJ,CAAC;IAED,qEAAqE;IACrE,sDAAsD;IACtD,IACE,KAAK,CAAC,QAAQ,KAAK,SAAS;QAC5B,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QACxB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;QAChC,KAAK,CAAC,aAAa,KAAK,KAAK,CAAC,QAAQ,EACtC,CAAC;QACD,MAAM,IAAI,eAAe,CACvB,sFAAsF,CACvF,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAClB,aAAa,EACb,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,CAAoB,SAAoC;YAC1D,OAAO,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QACpD,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional OfferCreate factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Places an offer on the Decentralized Exchange (DEX). The class-based
|
|
5
|
+
* equivalent requires a separate `.validate()` call after construction;
|
|
6
|
+
* this factory validates at construction so an invalid tx can never exist.
|
|
7
|
+
*
|
|
8
|
+
* import { offerCreate } from 'xrplt/fp';
|
|
9
|
+
* const tx = offerCreate({ Account, TakerGets: '1000000', TakerPays: { … } });
|
|
10
|
+
* const j = tx.toJSON();
|
|
11
|
+
* const tx2 = tx.with({ Expiration: 770000000 });
|
|
12
|
+
*
|
|
13
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/offercreate
|
|
14
|
+
* @see https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/offerCreate.ts
|
|
15
|
+
*
|
|
16
|
+
* ## Divergences
|
|
17
|
+
*
|
|
18
|
+
* Compared with `src/transactions/offer-create.ts`, this factory adds
|
|
19
|
+
* guards the class skips and fixes a flag-value bug:
|
|
20
|
+
*
|
|
21
|
+
* - **The class hard-codes `tfHybrid = 0x00400000` in `validate()` but
|
|
22
|
+
* the spec value is `0x00100000`.** The class therefore fails to detect
|
|
23
|
+
* tfHybrid offers that use the correct bit and (worse) would falsely
|
|
24
|
+
* pass the tfHybrid-without-DomainID guard for an invalid-bit tx.
|
|
25
|
+
* The factory uses `0x00100000` directly so it matches the canonical
|
|
26
|
+
* spec.
|
|
27
|
+
* - Source: xrpl.js `OfferCreateFlags.tfHybrid = 0x00100000`
|
|
28
|
+
* (xrpl.js repo packages/xrpl/src/models/transactions/offerCreate.ts
|
|
29
|
+
* line 52) and the canonical XRPL definitions table
|
|
30
|
+
* (xrpl.js repo packages/ripple-binary-codec/src/enums/definitions.json
|
|
31
|
+
* line 5275: `"tfHybrid": 1048576` = `0x00100000`).
|
|
32
|
+
* - Source: xrpl-dev-portal `offercreate.md` flag table
|
|
33
|
+
* `tfHybrid | 0x00100000 | 1048576`.
|
|
34
|
+
*
|
|
35
|
+
* - **`tfImmediateOrCancel` and `tfFillOrKill` are mutually exclusive.**
|
|
36
|
+
* The class doesn't check this — only the single-flag `tfHybrid`
|
|
37
|
+
* guard. Both flags are uint32 values; their bits overlap with
|
|
38
|
+
* nothing else, but rippled rejects the combination with
|
|
39
|
+
* `temINVALID_FLAG` ("such as both `tfImmediateOrCancel` and
|
|
40
|
+
* `tfFillOrKill`").
|
|
41
|
+
* - Source: xrpl-dev-portal `offercreate.md` Error Cases row
|
|
42
|
+
* `temINVALID_FLAG`: "The transaction specifies an invalid flag
|
|
43
|
+
* combination, such as both `tfImmediateOrCancel` and `tfFillOrKill`."
|
|
44
|
+
*
|
|
45
|
+
* - **Both `TakerGets` and `TakerPays` must be strictly positive amounts.**
|
|
46
|
+
* The class only checks shape via `isAmount`, which allows the XRP
|
|
47
|
+
* string `"0"` and any numeric string for IOU/MPT `value`. rippled
|
|
48
|
+
* rejects negative or zero amounts with `temBAD_OFFER` ("The offer
|
|
49
|
+
* tries to trade XRP for XRP, or tries to trade an invalid or negative
|
|
50
|
+
* amount of a token"). The factory performs the same positive-value
|
|
51
|
+
* check used by `ammCreate` for `Amount`/`Amount2`.
|
|
52
|
+
* - Source: xrpl-dev-portal `offercreate.md` Error Cases
|
|
53
|
+
* `temBAD_OFFER` row.
|
|
54
|
+
*
|
|
55
|
+
* - **`TakerGets` and `TakerPays` may not be the same currency (same
|
|
56
|
+
* issuer + currency code, or both XRP).** This catches both the
|
|
57
|
+
* XRP-for-XRP case (`temBAD_OFFER`) and the IOU-for-same-IOU case
|
|
58
|
+
* (`temREDUNDANT`). The class skips this cross-field invariant entirely.
|
|
59
|
+
* - Source: xrpl-dev-portal `offercreate.md` Error Cases
|
|
60
|
+
* `temBAD_OFFER` row ("The offer tries to trade XRP for XRP") and
|
|
61
|
+
* `temREDUNDANT` row ("The transaction would trade a token for the
|
|
62
|
+
* same token (same issuer and currency code)").
|
|
63
|
+
*
|
|
64
|
+
* - **`Account` must be a valid XRPL classic or X-address.** The class
|
|
65
|
+
* inherits only `validateBaseTransaction`'s `isString(Account)` check,
|
|
66
|
+
* which accepts any string. The factory uses `isAccount` so an
|
|
67
|
+
* obvious typo (e.g. `"r…"`) is caught at construction.
|
|
68
|
+
* - Source: xrpl-dev-portal basic-data-types.md (`AccountID` is a
|
|
69
|
+
* classic address or X-address).
|
|
70
|
+
*
|
|
71
|
+
* - **`Expiration` must be a UInt32.** The class accepts any number via
|
|
72
|
+
* `super.validate()` (none) — i.e. no check at all. The factory checks
|
|
73
|
+
* that, when present, the value is an integer in `[0, 0xffffffff]`.
|
|
74
|
+
* - Source: xrpl-dev-portal `offercreate.md` Fields table
|
|
75
|
+
* `Expiration | Number | UInt32`.
|
|
76
|
+
*
|
|
77
|
+
* - **`OfferSequence` must be a UInt32.** Same rationale as `Expiration`.
|
|
78
|
+
* The factory additionally rejects `OfferSequence > Sequence` here
|
|
79
|
+
* only when `Sequence` is also provided, per
|
|
80
|
+
* `temBAD_SEQUENCE` ("the `OfferSequence` ... is higher than the
|
|
81
|
+
* transaction's own `Sequence` number").
|
|
82
|
+
* - Source: xrpl-dev-portal `offercreate.md` Fields table
|
|
83
|
+
* `OfferSequence | Number | UInt32`; Error Cases `temBAD_SEQUENCE`.
|
|
84
|
+
*
|
|
85
|
+
* - **`IssuedCurrencyAmount` shape is validated** (currency length /
|
|
86
|
+
* hex, issuer must be a valid account, value must be a positive
|
|
87
|
+
* XRPLNumber). The class delegates to `isAmount`, which only checks
|
|
88
|
+
* key presence.
|
|
89
|
+
* - Source: xrpl-dev-portal basic-data-types.md
|
|
90
|
+
* `#specifying-currency-amounts`.
|
|
91
|
+
*
|
|
92
|
+
* - **`MPTAmount.mpt_issuance_id` must be 24–48 hex characters.** The
|
|
93
|
+
* class only checks key presence via `isAmount`.
|
|
94
|
+
* - Source: XLS-0033 Multi-Purpose Tokens (192-bit issuance ID,
|
|
95
|
+
* hex-encoded; the 24–48 char window matches the policy used by
|
|
96
|
+
* `ammCreate` and `vaultClawback`).
|
|
97
|
+
*/
|
|
98
|
+
import type { Amount } from '../../types/amounts.js';
|
|
99
|
+
import type { OfferCreateFlagsInterface } from '../../types/flags.js';
|
|
100
|
+
export interface OfferCreateProps {
|
|
101
|
+
/** The unique address of the transaction sender (the offer creator). */
|
|
102
|
+
Account: string;
|
|
103
|
+
/** The amount and type of currency being sold by the offer creator. */
|
|
104
|
+
TakerGets: Amount;
|
|
105
|
+
/** The amount and type of currency being bought by the offer creator. */
|
|
106
|
+
TakerPays: Amount;
|
|
107
|
+
/** Time after which the offer is no longer active (UInt32, seconds since the Ripple Epoch). */
|
|
108
|
+
Expiration?: number | undefined;
|
|
109
|
+
/** An Offer to delete first, specified the same way as OfferCancel. */
|
|
110
|
+
OfferSequence?: number | undefined;
|
|
111
|
+
/** Permissioned Domain ID (64-char hex). Required when tfHybrid is set. */
|
|
112
|
+
DomainID?: string | undefined;
|
|
113
|
+
/** Bit-flags for this transaction. */
|
|
114
|
+
Flags?: number | OfferCreateFlagsInterface | undefined;
|
|
115
|
+
Fee?: string | undefined;
|
|
116
|
+
Sequence?: number | undefined;
|
|
117
|
+
}
|
|
118
|
+
export interface OfferCreate extends Readonly<OfferCreateProps> {
|
|
119
|
+
readonly TransactionType: 'OfferCreate';
|
|
120
|
+
validate(): void;
|
|
121
|
+
toJSON(): Record<string, unknown>;
|
|
122
|
+
with(overrides: Partial<OfferCreateProps>): OfferCreate;
|
|
123
|
+
}
|
|
124
|
+
export declare function offerCreate(props: OfferCreateProps): OfferCreate;
|
|
125
|
+
//# sourceMappingURL=offer-create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offer-create.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/offer-create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgGG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AA4CtE,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,GAAG,yBAAyB,GAAG,SAAS,CAAC;IACvD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,WAAY,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAC7D,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC;IACxC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,WAAW,CAAC;CACzD;AA2KD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CA8HhE"}
|