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,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional NFTokenBurn factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Permanently removes an NFToken object from its NFTokenPage. Validation
|
|
5
|
+
* happens at construction; there is no way to construct an invalid tx.
|
|
6
|
+
*
|
|
7
|
+
* import { nftokenBurn } from 'xrplt/fp';
|
|
8
|
+
* const tx = nftokenBurn({ Account, NFTokenID });
|
|
9
|
+
* const j = tx.toJSON();
|
|
10
|
+
*
|
|
11
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/nftokenburn
|
|
12
|
+
* @see https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/NFTokenBurn.ts
|
|
13
|
+
* @see XLS-0020 (Non-Fungible Tokens) §1.5.5
|
|
14
|
+
*
|
|
15
|
+
* Affected amendments:
|
|
16
|
+
* - `NonFungibleTokensV1` — base NFTokenBurn.
|
|
17
|
+
* - `NonFungibleTokensV1_1` — adds the optional `Owner` field for
|
|
18
|
+
* issuer/authorized-minter burns.
|
|
19
|
+
*
|
|
20
|
+
* ## Divergences
|
|
21
|
+
*
|
|
22
|
+
* Compared with `src/transactions/nftoken-burn.ts`, this factory adds
|
|
23
|
+
* guards the class skips (or that xrpl.js / xrpl.org / XLS-20 mandate
|
|
24
|
+
* but the class omits):
|
|
25
|
+
*
|
|
26
|
+
* - **`NFTokenID` must be a 64-character hex string** — XLS-20 §1.5.5
|
|
27
|
+
* lists the internal type as `UINT256`, which is 32 bytes = 64 hex
|
|
28
|
+
* characters. The class only checks `isString(NFTokenID)`, accepting
|
|
29
|
+
* any string. xrpl.js's `validateNFTokenBurn` likewise only uses
|
|
30
|
+
* `isString`. The factory enforces the on-ledger shape.
|
|
31
|
+
* - Source: XLS-20 §1.5.5
|
|
32
|
+
* (`~/.mavis/docs.local/xrpl-standards/repo/XLS-0020-non-fungible-tokens/README.md`
|
|
33
|
+
* line 437, `NFTokenID` `Internal Type` `UINT256`).
|
|
34
|
+
* - Source: xrpl.org `nftokenburn.md` ("String" JSON type, UInt256
|
|
35
|
+
* internal type).
|
|
36
|
+
* - Cross-ref: rippled parses `NFTokenID` as `HASH256` via
|
|
37
|
+
* `NFTokenBurn.cpp`; HASH256 is 32 bytes = 64 hex chars.
|
|
38
|
+
*
|
|
39
|
+
* - **All-zero `NFTokenID` is rejected** — HASH256 zero is malformed by
|
|
40
|
+
* general convention. The class permits `'00…00'` because any
|
|
41
|
+
* 64-char hex passes `isString` + length check. The decoded NFTokenID
|
|
42
|
+
* contains a 160-bit account ID in bytes [8, 48) and an all-zero ID
|
|
43
|
+
* cannot encode a valid account, so a real burn against the zero
|
|
44
|
+
* NFTokenID would be rejected on-ledger as `temMALFORMED`. We catch
|
|
45
|
+
* it at construction.
|
|
46
|
+
* - Source: HASH256 convention (analogous to VaultID, LoanID,
|
|
47
|
+
* LoanBrokerID all-zeros rejection across this codebase).
|
|
48
|
+
* - Cross-ref: xrpl.js `parseNFTokenID` requires `length === 64`
|
|
49
|
+
* (`~/.mavis/docs.local/xrpl.js/repo/packages/xrpl/src/utils/parseNFTokenID.ts`
|
|
50
|
+
* line 73) but does not reject zero.
|
|
51
|
+
*
|
|
52
|
+
* - **`Owner` cross-checked against `Account`** — xrpl.org's
|
|
53
|
+
* `nftokenburn.md` states Owner is "Only used if that owner is
|
|
54
|
+
* different than the account sending this transaction." xrpl.js's
|
|
55
|
+
* `validateNFTokenBurn` does not enforce this; the class does not
|
|
56
|
+
* either. We do not enforce it as a hard error (the spec leaves the
|
|
57
|
+
* ledger to apply the permission check via `tecNO_PERMISSION`),
|
|
58
|
+
* but we leave the field undefined by default rather than mirroring
|
|
59
|
+
* the class's `this.Owner = undefined`. (Behavior is identical;
|
|
60
|
+
* documented for awareness.)
|
|
61
|
+
* - Source: xrpl.org `nftokenburn.md` (Owner field description).
|
|
62
|
+
*
|
|
63
|
+
* - **`Owner` defaults to `undefined`, NOT a class-property
|
|
64
|
+
* `this.Owner?: string = undefined`** — The class declares
|
|
65
|
+
* `readonly Owner?: string | undefined = undefined`, which is a
|
|
66
|
+
* no-op accessor that always shows up as `undefined`. The factory
|
|
67
|
+
* relies on `mergeForWith` to omit unspecified fields from the frozen
|
|
68
|
+
* object so `Object.keys(tx)` reflects only what the caller provided.
|
|
69
|
+
* This is the same divergence pattern used by every other fp factory.
|
|
70
|
+
* - Source: `src/fp/shape.ts` `mergeForWith` (lines 76–89).
|
|
71
|
+
*/
|
|
72
|
+
import { isAccount, isHex, isString } from '../../validation/helpers.js';
|
|
73
|
+
import { ValidationError } from '../../errors.js';
|
|
74
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
75
|
+
// ─── Spec constants ──────────────────────────────────────────────────
|
|
76
|
+
// HASH256 (UInt256) in hex is 64 characters. XLS-20 §1.5.5: NFTokenID
|
|
77
|
+
// internal type is UINT256; xrpl.org nftokenburn.md confirms UInt256.
|
|
78
|
+
const NFTOKEN_ID_HEX_LENGTH = 64;
|
|
79
|
+
// All-zero HASH256 is reserved / malformed by general convention.
|
|
80
|
+
const NFTOKEN_ID_ZERO = '0'.repeat(NFTOKEN_ID_HEX_LENGTH);
|
|
81
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
82
|
+
export function nftokenBurn(props) {
|
|
83
|
+
// ── Account ── required, must be a valid XRPL account.
|
|
84
|
+
require(props.Account, 'NFTokenBurn: Account is required', isAccount);
|
|
85
|
+
// ── NFTokenID ── required, 64-char hex (HASH256 / UInt256),
|
|
86
|
+
// and not all-zero.
|
|
87
|
+
if (!isString(props.NFTokenID)) {
|
|
88
|
+
throw new ValidationError('NFTokenBurn: NFTokenID is required and must be a string');
|
|
89
|
+
}
|
|
90
|
+
if (!isHex(props.NFTokenID)) {
|
|
91
|
+
throw new ValidationError('NFTokenBurn: NFTokenID must be a hex-encoded string');
|
|
92
|
+
}
|
|
93
|
+
if (props.NFTokenID.length !== NFTOKEN_ID_HEX_LENGTH) {
|
|
94
|
+
throw new ValidationError(`NFTokenBurn: NFTokenID must be exactly ${NFTOKEN_ID_HEX_LENGTH} hex characters (HASH256)`);
|
|
95
|
+
}
|
|
96
|
+
if (props.NFTokenID === NFTOKEN_ID_ZERO) {
|
|
97
|
+
throw new ValidationError('NFTokenBurn: NFTokenID must not be the all-zero HASH256 value');
|
|
98
|
+
}
|
|
99
|
+
// ── Owner ── optional, must be a valid XRPL account when present.
|
|
100
|
+
if (props.Owner !== undefined) {
|
|
101
|
+
if (!isAccount(props.Owner)) {
|
|
102
|
+
throw new ValidationError('NFTokenBurn: Owner must be a valid XRPL account address');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return buildFrozenTx('NFTokenBurn', props, {
|
|
106
|
+
validate() {
|
|
107
|
+
// Validated at construction.
|
|
108
|
+
},
|
|
109
|
+
toJSON() {
|
|
110
|
+
const json = {};
|
|
111
|
+
for (const k of Object.keys(this)) {
|
|
112
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
113
|
+
continue;
|
|
114
|
+
const v = this[k];
|
|
115
|
+
if (v !== undefined)
|
|
116
|
+
json[k] = v;
|
|
117
|
+
}
|
|
118
|
+
return json;
|
|
119
|
+
},
|
|
120
|
+
with(overrides) {
|
|
121
|
+
return nftokenBurn(mergeForWith(this, overrides));
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=nftoken-burn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nftoken-burn.js","sourceRoot":"","sources":["../../../src/fp/factories/nftoken-burn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;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AC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,eAAe,CACvB,yDAAyD,CAC1D,CAAC;QACJ,CAAC;IACH,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,19 @@
|
|
|
1
|
+
export interface NftokenCancelOfferProps {
|
|
2
|
+
Account: string;
|
|
3
|
+
/**
|
|
4
|
+
* NFTokenOffer object IDs to cancel. Each entry is a 256-bit hash
|
|
5
|
+
* hex-encoded (64 chars). 1–500 entries; no duplicates; no all-zero
|
|
6
|
+
* IDs.
|
|
7
|
+
*/
|
|
8
|
+
NFTokenOffers: string[];
|
|
9
|
+
Fee?: string | undefined;
|
|
10
|
+
Sequence?: number | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface NftokenCancelOffer extends Readonly<NftokenCancelOfferProps> {
|
|
13
|
+
readonly TransactionType: 'NFTokenCancelOffer';
|
|
14
|
+
validate(): void;
|
|
15
|
+
toJSON(): Record<string, unknown>;
|
|
16
|
+
with(overrides: Partial<NftokenCancelOfferProps>): NftokenCancelOffer;
|
|
17
|
+
}
|
|
18
|
+
export declare function nftokenCancelOffer(props: NftokenCancelOfferProps): NftokenCancelOffer;
|
|
19
|
+
//# sourceMappingURL=nftoken-cancel-offer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nftoken-cancel-offer.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/nftoken-cancel-offer.ts"],"names":[],"mappings":"AAoFA,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,kBACf,SAAQ,QAAQ,CAAC,uBAAuB,CAAC;IACzC,QAAQ,CAAC,eAAe,EAAE,oBAAoB,CAAC;IAC/C,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,kBAAkB,CAAC;CACvE;AA0BD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAC7B,kBAAkB,CA6DpB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional NFTokenCancelOffer factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Cancels one or more existing NFTokenOffer ledger entries. Validation
|
|
5
|
+
* happens at construction; there is no way to construct an invalid tx.
|
|
6
|
+
*
|
|
7
|
+
* import { nftokenCancelOffer } from 'xrplt/fp';
|
|
8
|
+
* const tx = nftokenCancelOffer({ Account, NFTokenOffers: [offerId1] });
|
|
9
|
+
* const j = tx.toJSON();
|
|
10
|
+
* const tx2 = tx.with({ NFTokenOffers: [offerId1, offerId2] });
|
|
11
|
+
*
|
|
12
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/nftokencanceloffer
|
|
13
|
+
* @see https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/NFTokenCancelOffer.ts
|
|
14
|
+
* @see XLS-0020 §1.5.5 (Non-Fungible Tokens)
|
|
15
|
+
*
|
|
16
|
+
* ## Divergences
|
|
17
|
+
*
|
|
18
|
+
* Compared with `src/transactions/nftoken-cancel-offer.ts`, this factory
|
|
19
|
+
* adds guards that the class skips but the canonical sources (rippled
|
|
20
|
+
* C++ source, xrpl.org Error Cases, XLS-20) mandate:
|
|
21
|
+
*
|
|
22
|
+
* - **`NFTokenOffers` is a non-empty array of Vector256 (64-char hex)
|
|
23
|
+
* offer IDs.** The class only checks `isArray` and `length === 0`; it
|
|
24
|
+
* does not check that each entry is a 64-character hex string. The
|
|
25
|
+
* ledger type is `Vector256`, i.e. an array of 256-bit hashes
|
|
26
|
+
* hex-encoded.
|
|
27
|
+
* - Source: XLS-20 §1.5.5 (`NFTokenOffers` is `VECTOR256`)
|
|
28
|
+
* `~/.mavis/docs.local/xrpl-standards/repo/XLS-0020-non-fungible-tokens/README.md`
|
|
29
|
+
* line 738.
|
|
30
|
+
* - Source: xrpl.org `nftokencanceloffer.md` line 46 ("Each entry must
|
|
31
|
+
* be a different object ID of an NFTokenOffer").
|
|
32
|
+
* - Source: xrpl.org `common-fields.md` `Hash256` (64-char hex).
|
|
33
|
+
*
|
|
34
|
+
* - **All-zero offer IDs are rejected** (`fixCleanup3_2_0` amendment).
|
|
35
|
+
* rippled's `NFTokenCancelOffer::preflight` rejects a list that
|
|
36
|
+
* contains any zero offer ID; the class does not guard against this.
|
|
37
|
+
* - Source: rippled
|
|
38
|
+
* `src/libxrpl/tx/transactors/nft/NFTokenCancelOffer.cpp` lines 23–24
|
|
39
|
+
* (the `id.isZero()` check gated on `fixCleanup3_2_0`).
|
|
40
|
+
* - Source: xrpl.org `nftokencanceloffer.md` line 61
|
|
41
|
+
* (`temMALFORMED` … "contained an all-zero offer ID").
|
|
42
|
+
*
|
|
43
|
+
* - **Duplicate offer IDs are rejected.** rippled always sorts the list
|
|
44
|
+
* and rejects adjacent duplicates via `std::ranges::adjacent_find`.
|
|
45
|
+
* xrpl.org explicitly says "the transaction is invalid if the array
|
|
46
|
+
* contains duplicate entries". The class does not check duplicates.
|
|
47
|
+
* - Source: rippled `NFTokenCancelOffer.cpp` lines 28–31.
|
|
48
|
+
* - Source: xrpl.org `nftokencanceloffer.md` line 46 ("the transaction
|
|
49
|
+
* is invalid if the array contains duplicate entries").
|
|
50
|
+
*
|
|
51
|
+
* - **Maximum of 500 offer IDs.** rippled enforces
|
|
52
|
+
* `kMaxTokenOfferCancelCount = 500`; xrpl.org's Error Cases table
|
|
53
|
+
* mentions "more than the maximum number of offers that can be
|
|
54
|
+
* canceled at one time" as a `temMALFORMED` cause. The class has no
|
|
55
|
+
* upper bound.
|
|
56
|
+
* - Source: rippled `Protocol.h` (`constexpr std::size_t
|
|
57
|
+
* kMaxTokenOfferCancelCount = 500;`).
|
|
58
|
+
* - Source: rippled `NFTokenCancelOffer.cpp` line 22
|
|
59
|
+
* (`offerIds.size() > kMaxTokenOfferCancelCount`).
|
|
60
|
+
* - Source: xrpl.org `nftokencanceloffer.md` line 61 (`temMALFORMED`).
|
|
61
|
+
*
|
|
62
|
+
* - **Account must be a valid XRPL address.** The class accepts any
|
|
63
|
+
* non-empty string. xrpl.js's `validateBaseTransaction` (which
|
|
64
|
+
* `validateNFTokenCancelOffer` delegates to) enforces a valid classic
|
|
65
|
+
* address; we mirror that check at construction.
|
|
66
|
+
* - Source: xrpl.js
|
|
67
|
+
* `~/.mavis/docs.local/xrpl.js/repo/packages/xrpl/src/models/transactions/common.ts`
|
|
68
|
+
* `validateBaseTransaction`.
|
|
69
|
+
*/
|
|
70
|
+
import { isAccount, isArray, isLedgerEntryId, } from '../../validation/helpers.js';
|
|
71
|
+
import { ValidationError } from '../../errors.js';
|
|
72
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
73
|
+
// ─── Spec constants ──────────────────────────────────────────────────
|
|
74
|
+
// rippled `Protocol.h` `kMaxTokenOfferCancelCount`.
|
|
75
|
+
const MAX_NFTOKEN_OFFERS = 500;
|
|
76
|
+
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
77
|
+
/**
|
|
78
|
+
* Validate a single NFTokenOffer entry: must be a 64-char hex string,
|
|
79
|
+
* and must not be all-zero (the `fixCleanup3_2_0` rule). Throws with
|
|
80
|
+
* a message that includes the index so callers know which entry
|
|
81
|
+
* failed.
|
|
82
|
+
*/
|
|
83
|
+
function assertValidOfferId(id, index) {
|
|
84
|
+
if (!isLedgerEntryId(id)) {
|
|
85
|
+
throw new ValidationError(`NFTokenCancelOffer: NFTokenOffers[${index}] must be a 64-character hex string (Hash256)`);
|
|
86
|
+
}
|
|
87
|
+
// All-zero offer ID is malformed under fixCleanup3_2_0.
|
|
88
|
+
if (/^0+$/u.test(id)) {
|
|
89
|
+
throw new ValidationError(`NFTokenCancelOffer: NFTokenOffers[${index}] must not be zero (fixCleanup3_2_0)`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
93
|
+
export function nftokenCancelOffer(props) {
|
|
94
|
+
// ── Account ── required, must be a valid XRPL classic address.
|
|
95
|
+
require(props.Account, 'NFTokenCancelOffer: Account is required', isAccount);
|
|
96
|
+
// ── NFTokenOffers ── required, non-empty array of 64-char hex IDs.
|
|
97
|
+
if (!isArray(props.NFTokenOffers)) {
|
|
98
|
+
throw new ValidationError('NFTokenCancelOffer: NFTokenOffers must be an array');
|
|
99
|
+
}
|
|
100
|
+
if (props.NFTokenOffers.length === 0) {
|
|
101
|
+
throw new ValidationError('NFTokenCancelOffer: NFTokenOffers must not be empty');
|
|
102
|
+
}
|
|
103
|
+
// Upper bound per rippled `kMaxTokenOfferCancelCount = 500`.
|
|
104
|
+
if (props.NFTokenOffers.length > MAX_NFTOKEN_OFFERS) {
|
|
105
|
+
throw new ValidationError(`NFTokenCancelOffer: NFTokenOffers must contain at most ${MAX_NFTOKEN_OFFERS} entries (actual: ${props.NFTokenOffers.length})`);
|
|
106
|
+
}
|
|
107
|
+
// Per-entry validation. Walk once: shape + zero check. Then walk
|
|
108
|
+
// again for duplicate detection (cheaper than building a Set since
|
|
109
|
+
// the array is bounded to 500).
|
|
110
|
+
for (let i = 0; i < props.NFTokenOffers.length; i++) {
|
|
111
|
+
assertValidOfferId(props.NFTokenOffers[i], i);
|
|
112
|
+
}
|
|
113
|
+
const seen = new Set();
|
|
114
|
+
for (let i = 0; i < props.NFTokenOffers.length; i++) {
|
|
115
|
+
const id = props.NFTokenOffers[i];
|
|
116
|
+
if (id === undefined)
|
|
117
|
+
continue; // unreachable: length check + shape check above.
|
|
118
|
+
if (seen.has(id)) {
|
|
119
|
+
throw new ValidationError(`NFTokenCancelOffer: NFTokenOffers contains duplicate entry at index ${i} (${id})`);
|
|
120
|
+
}
|
|
121
|
+
seen.add(id);
|
|
122
|
+
}
|
|
123
|
+
return buildFrozenTx('NFTokenCancelOffer', props, {
|
|
124
|
+
validate() {
|
|
125
|
+
// Validated at construction.
|
|
126
|
+
},
|
|
127
|
+
toJSON() {
|
|
128
|
+
const json = {};
|
|
129
|
+
for (const k of Object.keys(this)) {
|
|
130
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
131
|
+
continue;
|
|
132
|
+
const v = this[k];
|
|
133
|
+
if (v !== undefined)
|
|
134
|
+
json[k] = v;
|
|
135
|
+
}
|
|
136
|
+
return json;
|
|
137
|
+
},
|
|
138
|
+
with(overrides) {
|
|
139
|
+
return nftokenCancelOffer(mergeForWith(this, overrides));
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=nftoken-cancel-offer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nftoken-cancel-off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M,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,CAA2B,SAA2C;YACxE,OAAO,kBAAkB,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAC3D,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional NFTokenCreateOffer factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Creates either a buy offer (Account does NOT own the NFToken) or a
|
|
5
|
+
* sell offer (Account owns the NFToken) for a non-fungible token.
|
|
6
|
+
* Validation happens at construction; there is no way to construct
|
|
7
|
+
* an invalid tx.
|
|
8
|
+
*
|
|
9
|
+
* import { nftokenCreateOffer } from 'xrplt/fp';
|
|
10
|
+
* // Sell offer (owner must be Account implicitly):
|
|
11
|
+
* const sell = nftokenCreateOffer({
|
|
12
|
+
* Account,
|
|
13
|
+
* NFTokenID,
|
|
14
|
+
* Amount: '1000000',
|
|
15
|
+
* Flags: { tfSellNFToken: true },
|
|
16
|
+
* });
|
|
17
|
+
* // Buy offer (Owner must be present and != Account):
|
|
18
|
+
* const buy = nftokenCreateOffer({
|
|
19
|
+
* Account,
|
|
20
|
+
* NFTokenID,
|
|
21
|
+
* Amount: '500000',
|
|
22
|
+
* Owner,
|
|
23
|
+
* // Flags: tfSellNFToken NOT set (default = buy offer)
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/nftokencreateoffer
|
|
27
|
+
* @see https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/NFTokenCreateOffer.ts
|
|
28
|
+
* @see XLS-0020 §1.5.4 (NonFungibleToken create offer)
|
|
29
|
+
*
|
|
30
|
+
* ## Divergences
|
|
31
|
+
*
|
|
32
|
+
* Compared with `src/transactions/nftoken-create-offer.ts`, this factory
|
|
33
|
+
* adds guards the class skips and ones xrpl.js / xrpl.org / XLS-20
|
|
34
|
+
* mandate but the class omits:
|
|
35
|
+
*
|
|
36
|
+
* - **`Owner` cross-field: present ⇔ buy offer (tfSellNFToken off).**
|
|
37
|
+
* The class accepts `Owner` regardless of flag value; xrpl.js
|
|
38
|
+
* `validateNFTokenSellOfferCases` (lines 97–103) rejects `Owner` on
|
|
39
|
+
* sell offers, and `validateNFTokenBuyOfferCases` (lines 105–110)
|
|
40
|
+
* requires `Owner` on buy offers. The factory enforces both.
|
|
41
|
+
* - Source: xrpl.js `NFTokenCreateOffer.ts` lines 97–117.
|
|
42
|
+
* - Source: XLS-20 §1.5.4 line 660 ("If the offer is to sell a token,
|
|
43
|
+
* this field must not be present ... If the offer is to buy a token,
|
|
44
|
+
* this field must be present").
|
|
45
|
+
*
|
|
46
|
+
* - **`Amount` for buy offers must be strictly positive.** The class
|
|
47
|
+
* accepts any Amount shape (including XRP `"0"` and IOU `value:"0"`).
|
|
48
|
+
* xrpl.js `validateNFTokenBuyOfferCases` (lines 112–116) requires
|
|
49
|
+
* `parseAmountValue(Amount) > 0` for buy offers and the error code
|
|
50
|
+
* on the ledger is `temBAD_AMOUNT`.
|
|
51
|
+
* - Source: xrpl.js `NFTokenCreateOffer.ts` lines 112–116.
|
|
52
|
+
* - Source: xrpl.org `nftokencreateoffer.md` line 61 (`temBAD_AMOUNT`:
|
|
53
|
+
* "the amount was zero for a buy offer").
|
|
54
|
+
* - Source: XLS-20 §1.5.4 line 694 ("The amount must be non-zero,
|
|
55
|
+
* except where this is an offer is an offer to sell and the asset
|
|
56
|
+
* is XRP; then it is legal to specify an amount of zero").
|
|
57
|
+
*
|
|
58
|
+
* - **`Account` ≠ `Owner` (when Owner present).** The class accepts
|
|
59
|
+
* `Owner === Account` for a buy offer, but per XLS-20 §1.5.4 line 659
|
|
60
|
+
* "an offer to buy a token one already holds is meaningless". xrpl.js
|
|
61
|
+
* `validateNFTokenCreateOffer` lines 128–136 throws on
|
|
62
|
+
* `areAddressesEqual(Account, Owner)`. The factory uses
|
|
63
|
+
* exact-string equality as a pragmatic check (matches the regex
|
|
64
|
+
* style of `isAccount`).
|
|
65
|
+
* - Source: xrpl.js `NFTokenCreateOffer.ts` lines 128–136.
|
|
66
|
+
* - Source: XLS-20 §1.5.4 line 659.
|
|
67
|
+
*
|
|
68
|
+
* - **`Account` ≠ `Destination` (when Destination present).** The class
|
|
69
|
+
* does not check this; xrpl.js lines 138–146 throws on equality.
|
|
70
|
+
* You cannot sell to yourself.
|
|
71
|
+
* - Source: xrpl.js `NFTokenCreateOffer.ts` lines 138–146.
|
|
72
|
+
*
|
|
73
|
+
* - **`NFTokenID` must be a 64-character hex string (Hash256).** The
|
|
74
|
+
* class only checks `isString`, accepting any string. xrpl.org
|
|
75
|
+
* `nftokencreateoffer.md` line 39 ("`NFTokenID` | String | UInt256")
|
|
76
|
+
* and XLS-20 §1.5.4 line 682 ("`NFTokenID` | `string` | `Hash256`")
|
|
77
|
+
* both require the canonical Hash256 encoding. The factory enforces
|
|
78
|
+
* length 64 + hex.
|
|
79
|
+
* - Source: xrpl.org `nftokencreateoffer.md` line 39.
|
|
80
|
+
* - Source: XLS-20 §1.5.4 line 682.
|
|
81
|
+
*
|
|
82
|
+
* - **`Expiration` must be a UInt32 (`[0, 2^32-1]`) and must be > 0
|
|
83
|
+
* when present.** The class only checks `isNumber`. XLS-20 §1.5.4
|
|
84
|
+
* line 700 declares the type `UINT32`, and xrpl.org
|
|
85
|
+
* `nftokencreateoffer.md` Error Cases line 62 (`temBAD_EXPIRATION`:
|
|
86
|
+
* "The specified `Expiration` time is invalid (for example, `0`)")
|
|
87
|
+
* rejects Expiration=0. The factory accepts 0 by default — same as
|
|
88
|
+
* OfferCreate — but the canonical error case the ledger emits is for
|
|
89
|
+
* Expiration=0 specifically. We accept Expiration=0 because XLS-20
|
|
90
|
+
* only requires UInt32 and there are legitimate use-cases for it
|
|
91
|
+
* during testing; the cross-check above (must be > 0 in practice)
|
|
92
|
+
* is documented here for awareness but not enforced at construction
|
|
93
|
+
* (mirroring OfferCreate's policy).
|
|
94
|
+
* - Source: XLS-20 §1.5.4 line 700.
|
|
95
|
+
* - Source: xrpl.org `nftokencreateoffer.md` line 62.
|
|
96
|
+
*
|
|
97
|
+
* - **`Amount` shape sub-checks (IOU/MPT currency, issuer, value).**
|
|
98
|
+
* The class delegates to `isAmount`, which only checks key presence.
|
|
99
|
+
* The factory re-uses the OfferCreate pattern: IOU currency must be
|
|
100
|
+
* 3 ASCII or 40 hex chars; issuer must be a valid account; value
|
|
101
|
+
* must be a non-negative base-10 integer string. MPT issuance IDs
|
|
102
|
+
* must be 24–48 hex chars. Negative or fractional numeric `value`
|
|
103
|
+
* strings are rejected at construction.
|
|
104
|
+
* - Source: xrpl-dev-portal `basic-data-types.md`
|
|
105
|
+
* `#specifying-currency-amounts` (used by OfferCreate / AmmCreate).
|
|
106
|
+
*
|
|
107
|
+
* - **`Owner` is a valid XRPL account when present.** The class does
|
|
108
|
+
* not check `isAccount`; xrpl.js `validateOptionalField(tx, 'Owner',
|
|
109
|
+
* isAccount)` (line 149) does.
|
|
110
|
+
* - Source: xrpl.js `NFTokenCreateOffer.ts` line 149.
|
|
111
|
+
*
|
|
112
|
+
* - **`Destination` is a valid XRPL account when present.** Same
|
|
113
|
+
* rationale; xrpl.js line 148.
|
|
114
|
+
* - Source: xrpl.js `NFTokenCreateOffer.ts` line 148.
|
|
115
|
+
*
|
|
116
|
+
* - **Amount=0 for sell offers requires XRP (gratis).** Per XLS-20
|
|
117
|
+
* §1.5.4 line 694 the zero-Amount path is only legal for sell offers
|
|
118
|
+
* in XRP. The factory permits `Amount: '0'` only when `tfSellNFToken`
|
|
119
|
+
* is set AND `Amount` is the XRP string form. An IOU/MPT Amount of
|
|
120
|
+
* zero (positive-value, e.g. `{ value: '0' }`) is rejected.
|
|
121
|
+
* - Source: XLS-20 §1.5.4 line 694.
|
|
122
|
+
* - Source: xrpl.js `NFTokenCreateOffer.ts` lines 112–116
|
|
123
|
+
* (`parseAmountValue(Amount) > 0` enforced for buy offers; sell
|
|
124
|
+
* offers accept `Amount: '0'` only for XRP).
|
|
125
|
+
*
|
|
126
|
+
* - **`Flags` accepts both numeric bitmask and boolean-map form.** The
|
|
127
|
+
* class types the field as `number | NFTokenCreateOfferFlagsInterface`
|
|
128
|
+
* but does not document the latter or validate it. The factory
|
|
129
|
+
* accepts both, mirroring the OfferCreate / NFTokenMint factories.
|
|
130
|
+
* - Source: xrpl.js `NFTokenCreateOffer.ts` lines 38–40, 160–164.
|
|
131
|
+
*/
|
|
132
|
+
import type { Amount } from '../../types/amounts.js';
|
|
133
|
+
import type { NFTokenCreateOfferFlagsInterface } from '../../types/flags.js';
|
|
134
|
+
export interface NftokenCreateOfferProps {
|
|
135
|
+
/** The unique address of the transaction sender (the offer creator). */
|
|
136
|
+
Account: string;
|
|
137
|
+
/** The NFTokenID being offered on (Hash256, 64-char hex). */
|
|
138
|
+
NFTokenID: string;
|
|
139
|
+
/** Amount expected or offered for the NFToken. */
|
|
140
|
+
Amount: Amount;
|
|
141
|
+
/** Owner of the NFToken (required for buy offers, forbidden for sell). */
|
|
142
|
+
Owner?: string | undefined;
|
|
143
|
+
/** Time after which the offer is no longer active (UInt32). */
|
|
144
|
+
Expiration?: number | undefined;
|
|
145
|
+
/** Account allowed to accept the offer. */
|
|
146
|
+
Destination?: string | undefined;
|
|
147
|
+
/** Bit-flags (numeric or boolean-map). tfSellNFToken = 0x1. */
|
|
148
|
+
Flags?: number | NFTokenCreateOfferFlagsInterface | undefined;
|
|
149
|
+
Fee?: string | undefined;
|
|
150
|
+
Sequence?: number | undefined;
|
|
151
|
+
}
|
|
152
|
+
export interface NftokenCreateOffer extends Readonly<NftokenCreateOfferProps> {
|
|
153
|
+
readonly TransactionType: 'NFTokenCreateOffer';
|
|
154
|
+
validate(): void;
|
|
155
|
+
toJSON(): Record<string, unknown>;
|
|
156
|
+
with(overrides: Partial<NftokenCreateOfferProps>): NftokenCreateOffer;
|
|
157
|
+
}
|
|
158
|
+
export declare function nftokenCreateOffer(props: NftokenCreateOfferProps): NftokenCreateOffer;
|
|
159
|
+
//# sourceMappingURL=nftoken-create-offer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nftoken-create-offer.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/nftoken-create-offer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkIG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAkC7E,MAAM,WAAW,uBAAuB;IACtC,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,GAAG,gCAAgC,GAAG,SAAS,CAAC;IAC9D,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,kBACf,SAAQ,QAAQ,CAAC,uBAAuB,CAAC;IACzC,Q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