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 @@
|
|
|
1
|
+
{"version":3,"file":"amm-create.js","sourceRoot":"","sources":["../../../src/fp/factories/amm-create.ts"],"names":[],"mappings":"AAkEA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,KAAK,EACL,sBAAsB,EACtB,WAAW,EACX,QAAQ,EACR,QAAQ,GACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,gEAAgE;AAChE,2DAA2D;AAC3D,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,qEAAqE;AACrE,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,oEAAoE;AACpE,qEAAqE;AACrE,wDAAwD;AACxD,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,mBAAmB,GAAG,EAAE,CAAC;AA6B/B,wEAAwE;AAExE;;;GAGG;AACH,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,sBAAsB,CAAC,MAAc,EAAE,IAAY;IAC1D,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,eAAe,CACvB,cAAc,IAAI,wDAAwD,CAC3E,CAAC;IACJ,CAAC;IAED,6CAA6C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AAkB,SAAkC;YACtD,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAClD,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional AMMDelete factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Deletes an Automated Market Maker (AMM) instance that could not be
|
|
5
|
+
* fully deleted automatically (e.g. more than 512 empty trust lines
|
|
6
|
+
* remain after an AMMWithdraw). Anyone can call `AMMDelete`; the ledger
|
|
7
|
+
* enforces that the AMM is in an empty (`LPTokens == 0`) state.
|
|
8
|
+
*
|
|
9
|
+
* Validation happens at construction; there is no way to construct an
|
|
10
|
+
* invalid tx.
|
|
11
|
+
*
|
|
12
|
+
* import { ammDelete } from 'xrplt/fp';
|
|
13
|
+
* const tx = ammDelete({
|
|
14
|
+
* Account,
|
|
15
|
+
* Asset: { currency: 'XRP' },
|
|
16
|
+
* Asset2: { currency: 'TST', issuer: 'r…' },
|
|
17
|
+
* });
|
|
18
|
+
* const j = tx.toJSON();
|
|
19
|
+
* const tx2 = tx.with({ Fee: '10' });
|
|
20
|
+
*
|
|
21
|
+
* Affected amendments:
|
|
22
|
+
* - `AMM` (base AMMDelete)
|
|
23
|
+
*
|
|
24
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/ammdelete
|
|
25
|
+
* @see https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0030-automated-market-maker
|
|
26
|
+
*
|
|
27
|
+
* ## Divergences
|
|
28
|
+
*
|
|
29
|
+
* The class-based API at `src/transactions/amm-delete.ts` validates
|
|
30
|
+
* `Asset` and `Asset2` with `isRecord`, which accepts any object —
|
|
31
|
+
* including the wrong kind of object (e.g. a `Memo`, a `Signer`, or an
|
|
32
|
+
* empty `{}`). The factory fills three guards the class skips:
|
|
33
|
+
*
|
|
34
|
+
* 1. **`Asset` must be a valid `Currency` (XRP / IOU / MPT).** The
|
|
35
|
+
* class accepts any object; the factory rejects with
|
|
36
|
+
* `'AMMDelete: Asset must be a valid Currency'` when Asset is
|
|
37
|
+
* missing, null, or not a recognized currency shape.
|
|
38
|
+
* Source: xrpl.org `ammdelete.md` Fields table — `Asset` row,
|
|
39
|
+
* Description column: "The asset can be XRP, a token, or an MPT".
|
|
40
|
+
* Source: XLS-0030 §2.3.1, `Asset` row, JSON Type = `object`,
|
|
41
|
+
* Internal Type = `ISSUE`. xrpl.js `validateAMMDelete` calls
|
|
42
|
+
* `isIssuedCurrency(tx.Asset)` (line 48) and throws
|
|
43
|
+
* `'AMMDelete: Asset must be a Currency'`.
|
|
44
|
+
* (`isIssuedCurrency` rejects MPT form; `isCurrency` accepts it
|
|
45
|
+
* to match the more recent xrpl.org docs. Either is stricter
|
|
46
|
+
* than `isRecord`.)
|
|
47
|
+
*
|
|
48
|
+
* 2. **`Asset2` must be a valid `Currency` (XRP / IOU / MPT).** Same
|
|
49
|
+
* rationale and sources as #1, applied to `Asset2`. The class
|
|
50
|
+
* accepts any object; xrpl.js line 56 calls `isIssuedCurrency`
|
|
51
|
+
* on `Asset2`; the factory uses `isCurrency` for the same
|
|
52
|
+
* docs-aligned coverage as `Asset`.
|
|
53
|
+
*
|
|
54
|
+
* 3. **`Account` is validated as a well-formed XRPL classic or
|
|
55
|
+
* X-address.** The class delegates Account validation to
|
|
56
|
+
* `validateBaseTransaction`, which only checks `isString(Account)`
|
|
57
|
+
* and skips `isAccount`. The factory uses `isAccount` so a
|
|
58
|
+
* malformed Account is caught at construction rather than at
|
|
59
|
+
* `.validate()` time.
|
|
60
|
+
* Source: xrpl.js `validateBaseTransaction` calls `isAccount`
|
|
61
|
+
* on `tx.Account`. Local helper at `src/validation/helpers.ts`
|
|
62
|
+
* lines 55–60.
|
|
63
|
+
*/
|
|
64
|
+
import type { Currency } from '../../types/amounts.js';
|
|
65
|
+
export interface AmmDeleteProps {
|
|
66
|
+
/** The unique address of the transaction sender (anyone may delete). */
|
|
67
|
+
Account: string;
|
|
68
|
+
/** One of the two assets in the AMM's pool (XRP / IOU / MPT). */
|
|
69
|
+
Asset: Currency;
|
|
70
|
+
/** The other asset in the AMM's pool (XRP / IOU / MPT). */
|
|
71
|
+
Asset2: Currency;
|
|
72
|
+
/** Fee in XRP (drops), base-10 integer string. */
|
|
73
|
+
Fee?: string | undefined;
|
|
74
|
+
/** Account sequence number. */
|
|
75
|
+
Sequence?: number | undefined;
|
|
76
|
+
}
|
|
77
|
+
export interface AmmDelete extends Readonly<AmmDeleteProps> {
|
|
78
|
+
readonly TransactionType: 'AMMDelete';
|
|
79
|
+
validate(): void;
|
|
80
|
+
toJSON(): Record<string, unknown>;
|
|
81
|
+
with(overrides: Partial<AmmDeleteProps>): AmmDelete;
|
|
82
|
+
}
|
|
83
|
+
export declare function ammDelete(props: AmmDeleteProps): AmmDelete;
|
|
84
|
+
//# sourceMappingURL=amm-delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amm-delete.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/amm-delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAOvD,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,KAAK,EAAE,QAAQ,CAAC;IAChB,2DAA2D;IAC3D,MAAM,EAAE,QAAQ,CAAC;IACjB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,SAAU,SAAQ,QAAQ,CAAC,cAAc,CAAC;IACzD,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC;IACtC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;CACrD;AAID,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CAuC1D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isAccount, isCurrency } from '../../validation/helpers.js';
|
|
2
|
+
import { ValidationError } from '../../errors.js';
|
|
3
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
4
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
5
|
+
export function ammDelete(props) {
|
|
6
|
+
// ── Account ── required, must be a valid XRPL classic / X-address.
|
|
7
|
+
require(props.Account, 'AMMDelete: Account is required', isAccount);
|
|
8
|
+
// ── Asset ── required, must be a valid Currency (XRP / IOU / MPT).
|
|
9
|
+
if (!isCurrency(props.Asset)) {
|
|
10
|
+
throw new ValidationError('AMMDelete: Asset must be a valid Currency (XRP, trust line, or MPT form)');
|
|
11
|
+
}
|
|
12
|
+
// ── Asset2 ── required, must be a valid Currency (XRP / IOU / MPT).
|
|
13
|
+
if (!isCurrency(props.Asset2)) {
|
|
14
|
+
throw new ValidationError('AMMDelete: Asset2 must be a valid Currency (XRP, trust line, or MPT form)');
|
|
15
|
+
}
|
|
16
|
+
return buildFrozenTx('AMMDelete', props, {
|
|
17
|
+
validate() {
|
|
18
|
+
// Validated at construction.
|
|
19
|
+
},
|
|
20
|
+
toJSON() {
|
|
21
|
+
const json = {};
|
|
22
|
+
for (const k of Object.keys(this)) {
|
|
23
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
24
|
+
continue;
|
|
25
|
+
const v = this[k];
|
|
26
|
+
if (v !== undefined)
|
|
27
|
+
json[k] = v;
|
|
28
|
+
}
|
|
29
|
+
return json;
|
|
30
|
+
},
|
|
31
|
+
with(overrides) {
|
|
32
|
+
return ammDelete(mergeForWith(this, overrides));
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=amm-delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amm-delete.js","sourceRoot":"","sources":["../../../src/fp/factories/amm-delete.ts"],"names":[],"mappings":"AAgEA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAwBnE,wEAAwE;AAExE,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,oEAAoE;IACpE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,gCAAgC,EAAE,SAAS,CAAC,CAAC;IAEpE,oEAAoE;IACpE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,eAAe,CACvB,0EAA0E,CAC3E,CAAC;IACJ,CAAC;IAED,qEAAqE;IACrE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,eAAe,CACvB,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAClB,WAAW,EACX,KAAK,EACL;QACE,QAAQ;YACN,6BAA6B;QAC/B,CAAC;QACD,MAAM;YACJ,MAAM,IAAI,GAA4B,EAAE,CAAC;YACzC,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,MAAM;oBAAE,SAAS;gBACjE,MAAM,CAAC,GAAI,IAA2C,CAAC,CAAC,CAAC,CAAC;gBAC1D,IAAI,CAAC,KAAK,SAAS;oBAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAkB,SAAkC;YACtD,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAClD,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional AMMDeposit factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Adds liquidity to an AMM instance and receives LP tokens in exchange.
|
|
5
|
+
* Validation happens at construction; there is no way to construct an
|
|
6
|
+
* invalid tx.
|
|
7
|
+
*
|
|
8
|
+
* import { ammDeposit } from 'xrplt/fp';
|
|
9
|
+
* const tx = ammDeposit({
|
|
10
|
+
* Account,
|
|
11
|
+
* Asset: { currency: 'XRP' },
|
|
12
|
+
* Asset2: { currency: 'USD', issuer: USD_ISSUER },
|
|
13
|
+
* Amount: '1000000',
|
|
14
|
+
* Flags: AMMDepositFlags.tfSingleAsset,
|
|
15
|
+
* });
|
|
16
|
+
* const j = tx.toJSON();
|
|
17
|
+
* const tx2 = tx.with({ Amount: '2000000' });
|
|
18
|
+
*
|
|
19
|
+
* Affected amendments:
|
|
20
|
+
* - `AMM` (base AMMDeposit)
|
|
21
|
+
*
|
|
22
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/ammdeposit
|
|
23
|
+
* @see https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0030-automated-market-maker
|
|
24
|
+
*
|
|
25
|
+
* ## Divergences
|
|
26
|
+
* The factory enforces eight preclaim checks that the class API
|
|
27
|
+
* (`src/transactions/amm-deposit.ts`) skips:
|
|
28
|
+
*
|
|
29
|
+
* 1. `Asset` must be an `IssuedCurrency` (XRP form OR IOU form,
|
|
30
|
+
* NOT MPT). The class only checks `isRecord`, which lets
|
|
31
|
+
* `{ mpt_issuance_id: '...' }` slip through.
|
|
32
|
+
* Source: xrpl.js `validateAMMDeposit` (lines 92–94) calls
|
|
33
|
+
* `isIssuedCurrency(tx.Asset)` and throws
|
|
34
|
+
* `'AMMDeposit: Asset must be a Currency'`. The class API
|
|
35
|
+
* uses `isRecord(this.Asset)` which cannot distinguish
|
|
36
|
+
* IssuedCurrency from MPT.
|
|
37
|
+
*
|
|
38
|
+
* 2. `Asset2` must be an `IssuedCurrency` (XRP form OR IOU form,
|
|
39
|
+
* NOT MPT). Same source as #1, but applied to Asset2
|
|
40
|
+
* (xrpl.js lines 100–102).
|
|
41
|
+
*
|
|
42
|
+
* 3. `LPTokenOut`, when present, must be an `IssuedCurrencyAmount`.
|
|
43
|
+
* Source: xrpl.js `validateAMMDeposit` lines 114–118 — throws
|
|
44
|
+
* `'AMMDeposit: LPTokenOut must be an IssuedCurrencyAmount'`.
|
|
45
|
+
* The class API does not validate the type of LPTokenOut.
|
|
46
|
+
*
|
|
47
|
+
* 4. `Amount`, when present, must be a valid `Amount` (XRP drops
|
|
48
|
+
* string, IOU, or MPT). The class API does not validate the
|
|
49
|
+
* type of Amount.
|
|
50
|
+
* Source: xrpl.js `validateAMMDeposit` lines 120–122.
|
|
51
|
+
*
|
|
52
|
+
* 5. `Amount2`, when present, must be a valid `Amount`. Same source
|
|
53
|
+
* as #4 but applied to Amount2 (xrpl.js lines 124–126).
|
|
54
|
+
*
|
|
55
|
+
* 6. `EPrice`, when present, must be a valid `Amount`. Same source
|
|
56
|
+
* as #4 but applied to EPrice (xrpl.js lines 128–130).
|
|
57
|
+
*
|
|
58
|
+
* 7. `Amount2` and `EPrice` are not allowed without `Amount`. The
|
|
59
|
+
* class API does not check that Amount2 / EPrice are paired
|
|
60
|
+
* with Amount.
|
|
61
|
+
* Source: xrpl.js `validateAMMDeposit` lines 104–112 — throws
|
|
62
|
+
* `'AMMDeposit: must set Amount with Amount2'` and
|
|
63
|
+
* `'AMMDeposit: must set Amount with EPrice'`.
|
|
64
|
+
*
|
|
65
|
+
* 8. At least one of `LPTokenOut` or `Amount` must be present.
|
|
66
|
+
* The class API does not enforce the minimal field set.
|
|
67
|
+
* Source: xrpl.js `validateAMMDeposit` lines 108–112 — throws
|
|
68
|
+
* `'AMMDeposit: must set at least LPTokenOut or Amount'`.
|
|
69
|
+
*/
|
|
70
|
+
import type { Amount, IssuedCurrencyAmount } from '../../types/amounts.js';
|
|
71
|
+
import type { AMMDepositFlagsInterface } from '../../types/flags.js';
|
|
72
|
+
export interface AmmDepositProps {
|
|
73
|
+
/** The unique address of the transaction sender (the LP). */
|
|
74
|
+
Account: string;
|
|
75
|
+
/** One of the two pool assets (XRP form or IOU form, NOT MPT). */
|
|
76
|
+
Asset: {
|
|
77
|
+
readonly currency: 'XRP';
|
|
78
|
+
} | {
|
|
79
|
+
readonly currency: string;
|
|
80
|
+
readonly issuer: string;
|
|
81
|
+
};
|
|
82
|
+
/** The other pool asset (XRP form or IOU form, NOT MPT). */
|
|
83
|
+
Asset2: {
|
|
84
|
+
readonly currency: 'XRP';
|
|
85
|
+
} | {
|
|
86
|
+
readonly currency: string;
|
|
87
|
+
readonly issuer: string;
|
|
88
|
+
};
|
|
89
|
+
/** Amount of `Asset` to deposit. Required unless `LPTokenOut` is set. */
|
|
90
|
+
Amount?: Amount | undefined;
|
|
91
|
+
/** Amount of `Asset2` to deposit. Requires `Amount`. */
|
|
92
|
+
Amount2?: Amount | undefined;
|
|
93
|
+
/** Max effective price per LP token. Requires `Amount`. */
|
|
94
|
+
EPrice?: Amount | undefined;
|
|
95
|
+
/** Target LP tokens out (IssuedCurrencyAmount). */
|
|
96
|
+
LPTokenOut?: IssuedCurrencyAmount | undefined;
|
|
97
|
+
/** Bit-flags for this transaction. Numeric or boolean map. */
|
|
98
|
+
Flags?: number | AMMDepositFlagsInterface | undefined;
|
|
99
|
+
Fee?: string | undefined;
|
|
100
|
+
Sequence?: number | undefined;
|
|
101
|
+
}
|
|
102
|
+
export interface AmmDeposit extends Readonly<AmmDepositProps> {
|
|
103
|
+
readonly TransactionType: 'AMMDeposit';
|
|
104
|
+
validate(): void;
|
|
105
|
+
toJSON(): Record<string, unknown>;
|
|
106
|
+
with(overrides: Partial<AmmDepositProps>): AmmDeposit;
|
|
107
|
+
}
|
|
108
|
+
export declare function ammDeposit(props: AmmDepositProps): AmmDeposit;
|
|
109
|
+
//# sourceMappingURL=amm-deposit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amm-deposit.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/amm-deposit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAYrE,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,KAAK,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAA;KAAE,GAAG;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7F,4DAA4D;IAC5D,MAAM,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAA;KAAE,GAAG;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9F,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,mDAAmD;IACnD,UAAU,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAC9C,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS,CAAC;IACtD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,UAAW,SAAQ,QAAQ,CAAC,eAAe,CAAC;IAC3D,QAAQ,CAAC,eAAe,EAAE,YAAY,CAAC;IACvC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;CACvD;AAID,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,UAAU,CA8E7D"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { isAccount, isAmount, isIssuedCurrency, isIssuedCurrencyAmount, } from '../../validation/helpers.js';
|
|
2
|
+
import { ValidationError } from '../../errors.js';
|
|
3
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
4
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
5
|
+
export function ammDeposit(props) {
|
|
6
|
+
// ── Account ── required, must be a valid XRPL classic address.
|
|
7
|
+
require(props.Account, 'AMMDeposit: Account is required', isAccount);
|
|
8
|
+
// ── Asset ── required, must be an IssuedCurrency (XRP or IOU, NOT MPT).
|
|
9
|
+
if (props.Asset === undefined) {
|
|
10
|
+
throw new ValidationError('AMMDeposit: missing field Asset');
|
|
11
|
+
}
|
|
12
|
+
if (!isIssuedCurrency(props.Asset)) {
|
|
13
|
+
throw new ValidationError('AMMDeposit: Asset must be a Currency (XRP form or IOU form, NOT MPT)');
|
|
14
|
+
}
|
|
15
|
+
// ── Asset2 ── required, must be an IssuedCurrency (XRP or IOU, NOT MPT).
|
|
16
|
+
if (props.Asset2 === undefined) {
|
|
17
|
+
throw new ValidationError('AMMDeposit: missing field Asset2');
|
|
18
|
+
}
|
|
19
|
+
if (!isIssuedCurrency(props.Asset2)) {
|
|
20
|
+
throw new ValidationError('AMMDeposit: Asset2 must be a Currency (XRP form or IOU form, NOT MPT)');
|
|
21
|
+
}
|
|
22
|
+
// ── Combinatorial rules (xrpl.js `validateAMMDeposit` lines 104–112). ──
|
|
23
|
+
if (props.Amount2 !== undefined && props.Amount === undefined) {
|
|
24
|
+
throw new ValidationError('AMMDeposit: must set Amount with Amount2');
|
|
25
|
+
}
|
|
26
|
+
if (props.EPrice !== undefined && props.Amount === undefined) {
|
|
27
|
+
throw new ValidationError('AMMDeposit: must set Amount with EPrice');
|
|
28
|
+
}
|
|
29
|
+
if (props.LPTokenOut === undefined && props.Amount === undefined) {
|
|
30
|
+
throw new ValidationError('AMMDeposit: must set at least LPTokenOut or Amount');
|
|
31
|
+
}
|
|
32
|
+
// ── LPTokenOut ── if present, must be an IssuedCurrencyAmount.
|
|
33
|
+
if (props.LPTokenOut !== undefined) {
|
|
34
|
+
if (!isIssuedCurrencyAmount(props.LPTokenOut)) {
|
|
35
|
+
throw new ValidationError('AMMDeposit: LPTokenOut must be an IssuedCurrencyAmount');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// ── Amount / Amount2 / EPrice ── if present, must be a valid Amount.
|
|
39
|
+
if (props.Amount !== undefined && !isAmount(props.Amount)) {
|
|
40
|
+
throw new ValidationError('AMMDeposit: Amount must be an Amount');
|
|
41
|
+
}
|
|
42
|
+
if (props.Amount2 !== undefined && !isAmount(props.Amount2)) {
|
|
43
|
+
throw new ValidationError('AMMDeposit: Amount2 must be an Amount');
|
|
44
|
+
}
|
|
45
|
+
if (props.EPrice !== undefined && !isAmount(props.EPrice)) {
|
|
46
|
+
throw new ValidationError('AMMDeposit: EPrice must be an Amount');
|
|
47
|
+
}
|
|
48
|
+
return buildFrozenTx('AMMDeposit', props, {
|
|
49
|
+
validate() {
|
|
50
|
+
// Validated at construction.
|
|
51
|
+
},
|
|
52
|
+
toJSON() {
|
|
53
|
+
const json = {};
|
|
54
|
+
for (const k of Object.keys(this)) {
|
|
55
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
56
|
+
continue;
|
|
57
|
+
const v = this[k];
|
|
58
|
+
if (v !== undefined)
|
|
59
|
+
json[k] = v;
|
|
60
|
+
}
|
|
61
|
+
return json;
|
|
62
|
+
},
|
|
63
|
+
with(overrides) {
|
|
64
|
+
return ammDeposit(mergeForWith(this, overrides));
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=amm-deposit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amm-deposit.js","sourceRoot":"","sources":["../../../src/fp/factories/amm-deposit.ts"],"names":[],"mappings":"AAuEA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAgCnE,wEAAwE;AAExE,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,gEAAgE;IAChE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,iCAAiC,EAAE,SAAS,CAAC,CAAC;IAErE,yEAAyE;IACzE,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,eAAe,CAAC,iCAAiC,CAAC,CAAC;IAC/D,CAAC;IACD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,eAAe,CACvB,sEAAsE,CACvE,CAAC;IACJ,CAAC;IAED,0EAA0E;IAC1E,IAAI,KAAK,CAAC,MAA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CAAC;IACrE,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,eAAe,CAAC,sCAAsC,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,aAAa,CAClB,YAAY,EACZ,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,CAAmB,SAAmC;YACxD,OAAO,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QACnD,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional AMMVote factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Votes on the trading fee for an Automated Market Maker (AMM) instance.
|
|
5
|
+
* Up to 8 accounts can vote in proportion to the amount of the AMM's
|
|
6
|
+
* LP Tokens they hold; the new trading fee is recomputed as a weighted
|
|
7
|
+
* average of the active votes. Validation happens at construction;
|
|
8
|
+
* there is no way to construct an invalid tx.
|
|
9
|
+
*
|
|
10
|
+
* import { ammVote } from 'xrplt/fp';
|
|
11
|
+
* const tx = ammVote({
|
|
12
|
+
* Account,
|
|
13
|
+
* Asset: { currency: 'XRP' },
|
|
14
|
+
* Asset2: { currency: 'TST', issuer: 'r…' },
|
|
15
|
+
* TradingFee: 600,
|
|
16
|
+
* });
|
|
17
|
+
* const j = tx.toJSON();
|
|
18
|
+
* const tx2 = tx.with({ TradingFee: 700 });
|
|
19
|
+
*
|
|
20
|
+
* Affected amendments:
|
|
21
|
+
* - `AMM` (base AMMVote)
|
|
22
|
+
*
|
|
23
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/ammvote
|
|
24
|
+
* @see https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0030-automated-market-maker
|
|
25
|
+
*
|
|
26
|
+
* ## Divergences
|
|
27
|
+
*
|
|
28
|
+
* Compared with `src/transactions/amm-vote.ts`, this factory adds
|
|
29
|
+
* preclaim guards the class API skips. The class only calls `isRecord`
|
|
30
|
+
* on `Asset` / `Asset2` and only checks the [0, 1000] numeric range on
|
|
31
|
+
* `TradingFee` — it accepts any object for the asset fields and any
|
|
32
|
+
* non-integer in range for the fee. Citing the docs:
|
|
33
|
+
*
|
|
34
|
+
* 1. **`Asset` must be a valid `Currency` (XRP / IOU / MPT), not just
|
|
35
|
+
* a record.** Source: xrpl.org `ammvote.md` Fields table — `Asset`
|
|
36
|
+
* row, Description column: "The asset can be XRP, a token, or an
|
|
37
|
+
* MPT". Source: XLS-0030 §3.2.1, `Asset` row, Internal Type = `ISSUE`.
|
|
38
|
+
* xrpl.js `validateAMMVote` (line 50) calls `isIssuedCurrency(tx.Asset)`
|
|
39
|
+
* and throws `'AMMVote: Asset must be a Currency'`. The class API
|
|
40
|
+
* uses `isRecord(this.Asset)`, which cannot distinguish IssuedCurrency
|
|
41
|
+
* or MPT form from any other object.
|
|
42
|
+
*
|
|
43
|
+
* 2. **`Asset2` must be a valid `Currency` (XRP / IOU / MPT), not just
|
|
44
|
+
* a record.** Same sources and rationale as #1, applied to `Asset2`
|
|
45
|
+
* (xrpl.js line 58).
|
|
46
|
+
*
|
|
47
|
+
* 3. **`TradingFee` must be an integer.** Source: XLS-0030 §3.2.1,
|
|
48
|
+
* `TradingFee` row, Internal Type = `UINT16`. The class accepts any
|
|
49
|
+
* number in [0, 1000], including non-integer values like 0.5.
|
|
50
|
+
*
|
|
51
|
+
* 4. **`Account` must be a valid XRPL classic or X-address.** The class
|
|
52
|
+
* delegates Account validation to `validateBaseTransaction`, which
|
|
53
|
+
* only checks `isString(Account)`. The factory uses `isAccount` so
|
|
54
|
+
* a malformed Account is caught at construction rather than at
|
|
55
|
+
* `.validate()` time.
|
|
56
|
+
* Source: xrpl.js `validateBaseTransaction` calls `isAccount`
|
|
57
|
+
* on `tx.Account`. Local helper at `src/validation/helpers.ts`
|
|
58
|
+
* lines 55–60.
|
|
59
|
+
*/
|
|
60
|
+
import type { Currency } from '../../types/amounts.js';
|
|
61
|
+
export interface AmmVoteProps {
|
|
62
|
+
/** The unique address of the transaction sender (an LP of the AMM). */
|
|
63
|
+
Account: string;
|
|
64
|
+
/** One of the two assets in the AMM's pool (XRP / IOU / MPT). */
|
|
65
|
+
Asset: Currency;
|
|
66
|
+
/** The other asset in the AMM's pool (XRP / IOU / MPT). */
|
|
67
|
+
Asset2: Currency;
|
|
68
|
+
/**
|
|
69
|
+
* The proposed trading fee, in units of 1/100,000 (1 = 0.001%). Must
|
|
70
|
+
* be an integer in [0, 1000] inclusive. UINT16.
|
|
71
|
+
*/
|
|
72
|
+
TradingFee: number;
|
|
73
|
+
/** Fee in XRP (drops), base-10 integer string. */
|
|
74
|
+
Fee?: string | undefined;
|
|
75
|
+
/** Account sequence number. */
|
|
76
|
+
Sequence?: number | undefined;
|
|
77
|
+
/** Bit-flags for this transaction (AMMVote defines no transaction-specific flags). */
|
|
78
|
+
Flags?: number | undefined;
|
|
79
|
+
}
|
|
80
|
+
export interface AmmVote extends Readonly<AmmVoteProps> {
|
|
81
|
+
readonly TransactionType: 'AMMVote';
|
|
82
|
+
validate(): void;
|
|
83
|
+
toJSON(): Record<string, unknown>;
|
|
84
|
+
with(overrides: Partial<AmmVoteProps>): AmmVote;
|
|
85
|
+
}
|
|
86
|
+
export declare function ammVote(props: AmmVoteProps): AmmVote;
|
|
87
|
+
//# sourceMappingURL=amm-vote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amm-vote.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/amm-vote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAiBvD,MAAM,WAAW,YAAY;IAC3B,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,KAAK,EAAE,QAAQ,CAAC;IAChB,2DAA2D;IAC3D,MAAM,EAAE,QAAQ,CAAC;IACjB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,OAAQ,SAAQ,QAAQ,CAAC,YAAY,CAAC;IACrD,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC;CACjD;AAID,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAyDpD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isAccount, isCurrency, isNumber, } from '../../validation/helpers.js';
|
|
2
|
+
import { ValidationError } from '../../errors.js';
|
|
3
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
4
|
+
// ─── Spec constants ──────────────────────────────────────────────────
|
|
5
|
+
// TradingFee is UINT16 with a ledger-enforced range of 0–1000
|
|
6
|
+
// (0%–1%). (XLS-0030 §3.2.1; xrpl.js AMM_MAX_TRADING_FEE.)
|
|
7
|
+
const AMM_MAX_TRADING_FEE = 1000;
|
|
8
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
9
|
+
export function ammVote(props) {
|
|
10
|
+
// ── Account ── required, must be a valid XRPL classic / X-address.
|
|
11
|
+
require(props.Account, 'AMMVote: Account is required', isAccount);
|
|
12
|
+
// ── Asset ── required, must be a valid Currency (XRP / IOU / MPT).
|
|
13
|
+
if (!isCurrency(props.Asset)) {
|
|
14
|
+
throw new ValidationError('AMMVote: Asset must be a valid Currency (XRP, trust line, or MPT form)');
|
|
15
|
+
}
|
|
16
|
+
// ── Asset2 ── required, must be a valid Currency (XRP / IOU / MPT).
|
|
17
|
+
if (!isCurrency(props.Asset2)) {
|
|
18
|
+
throw new ValidationError('AMMVote: Asset2 must be a valid Currency (XRP, trust line, or MPT form)');
|
|
19
|
+
}
|
|
20
|
+
// ── TradingFee ── required, integer, 0–1000 inclusive (UINT16).
|
|
21
|
+
if (props.TradingFee === undefined || props.TradingFee === null) {
|
|
22
|
+
throw new ValidationError('AMMVote: TradingFee is required');
|
|
23
|
+
}
|
|
24
|
+
if (!isNumber(props.TradingFee)) {
|
|
25
|
+
throw new ValidationError('AMMVote: TradingFee must be a number');
|
|
26
|
+
}
|
|
27
|
+
if (!Number.isInteger(props.TradingFee)) {
|
|
28
|
+
throw new ValidationError('AMMVote: TradingFee must be an integer (UINT16)');
|
|
29
|
+
}
|
|
30
|
+
if (props.TradingFee < 0 || props.TradingFee > AMM_MAX_TRADING_FEE) {
|
|
31
|
+
throw new ValidationError(`AMMVote: TradingFee must be between 0 and ${AMM_MAX_TRADING_FEE} inclusive (got ${props.TradingFee})`);
|
|
32
|
+
}
|
|
33
|
+
return buildFrozenTx('AMMVote', props, {
|
|
34
|
+
validate() {
|
|
35
|
+
// Validated at construction.
|
|
36
|
+
},
|
|
37
|
+
toJSON() {
|
|
38
|
+
const json = {};
|
|
39
|
+
for (const k of Object.keys(this)) {
|
|
40
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
41
|
+
continue;
|
|
42
|
+
const v = this[k];
|
|
43
|
+
if (v !== undefined)
|
|
44
|
+
json[k] = v;
|
|
45
|
+
}
|
|
46
|
+
return json;
|
|
47
|
+
},
|
|
48
|
+
with(overrides) {
|
|
49
|
+
return ammVote(mergeForWith(this, overrides));
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=amm-vote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amm-vote.js","sourceRoot":"","sources":["../../../src/fp/factories/amm-vote.ts"],"names":[],"mappings":"AA4DA,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,GACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,8DAA8D;AAC9D,2DAA2D;AAC3D,MAAM,mBAAmB,GAAG,IAAI,CAAC;AA+BjC,wEAAwE;AAExE,MAAM,UAAU,OAAO,CAAC,KAAmB;IACzC,oEAAoE;IACpE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,8BAA8B,EAAE,SAAS,CAAC,CAAC;IAElE,oEAAoE;IACpE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,eAAe,CACvB,wEAAwE,CACzE,CAAC;IACJ,CAAC;IAED,qEAAqE;IACrE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QA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AY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAChD,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional AMMWithdraw factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Withdraws assets from an Automated Market Maker (AMM) instance by
|
|
5
|
+
* returning the AMM's liquidity provider tokens (LP Tokens). The factory
|
|
6
|
+
* enforces the seven mutually-exclusive AMM-withdraw modes at
|
|
7
|
+
* construction; there is no way to construct an invalid tx.
|
|
8
|
+
*
|
|
9
|
+
* import { ammWithdraw } from 'xrplt/fp';
|
|
10
|
+
* const tx = ammWithdraw({
|
|
11
|
+
* Account,
|
|
12
|
+
* Asset: { currency: 'XRP' },
|
|
13
|
+
* Asset2: { currency: 'TST', issuer: 'r…' },
|
|
14
|
+
* Amount: '1000',
|
|
15
|
+
* Flags: AMMWithdrawFlags.tfSingleAsset,
|
|
16
|
+
* });
|
|
17
|
+
* const j = tx.toJSON();
|
|
18
|
+
* const tx2 = tx.with({ Amount: '2000' });
|
|
19
|
+
*
|
|
20
|
+
* Affected amendments:
|
|
21
|
+
* - `AMM` (base AMMWithdraw)
|
|
22
|
+
* - `fixAMMv1_3` (LP-token precision-loss error path; runtime)
|
|
23
|
+
* - `fixCleanup3_3_0` (frozen/locked asset error path; runtime)
|
|
24
|
+
* - `fixCleanup3_4_0` (replaces `tefEXCEPTION` with `tecAMM_FAILED`;
|
|
25
|
+
* runtime)
|
|
26
|
+
*
|
|
27
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/ammwithdraw
|
|
28
|
+
* @see https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0030-automated-market-maker
|
|
29
|
+
*
|
|
30
|
+
* ## Divergences
|
|
31
|
+
*
|
|
32
|
+
* Compared with `src/transactions/amm-withdraw.ts`, this factory adds
|
|
33
|
+
* preclaim guards the class API skips. The class only calls `isRecord`
|
|
34
|
+
* on `Asset` / `Asset2` and does not validate any of the optional
|
|
35
|
+
* amount fields, the field-combination rules, or the
|
|
36
|
+
* one-AMMWithdraw-flag rule. Citing `temMALFORMED` from
|
|
37
|
+
* xrpl.org `ammwithdraw.md` Error Cases: "The transaction specified an
|
|
38
|
+
* invalid combination of fields. See AMMWithdraw Modes."
|
|
39
|
+
*
|
|
40
|
+
* 1. **`Asset` and `Asset2` must each be a valid `Currency` (XRP / IOU /
|
|
41
|
+
* MPT), not merely a record.** Source: XLS-0030 §2.4.2.1 — both
|
|
42
|
+
* fields are typed `object` with internal type `ISSUE`, and
|
|
43
|
+
* xrpl.org `ammwithdraw.md` Fields table — "The asset can be XRP,
|
|
44
|
+
* a token, or an MPT". xrpl.js `validateAMMWithdraw` enforces
|
|
45
|
+
* `isIssuedCurrency(Asset)` and `isIssuedCurrency(Asset2)` and
|
|
46
|
+
* rejects with `'AMMWithdraw: Asset must be a Currency'`. The class
|
|
47
|
+
* accepts any object.
|
|
48
|
+
*
|
|
49
|
+
* 2. **`Amount2` requires `Amount` (XLS-0030 §2.4.2.3 — "Amount and
|
|
50
|
+
* Amount2" combination).** Source: xrpl.js
|
|
51
|
+
* `validateAMMWithdraw` lines 102–106 — `if (tx.Amount2 != null &&
|
|
52
|
+
* tx.Amount == null) throw 'AMMWithdraw: must set Amount with
|
|
53
|
+
* Amount2'`. The class accepts Amount2 alone.
|
|
54
|
+
*
|
|
55
|
+
* 3. **`EPrice` requires `Amount` (XLS-0030 §2.4.2.3 — "Amount and
|
|
56
|
+
* EPrice" combination; EPrice is only meaningful for single-sided
|
|
57
|
+
* withdrawals).** Source: xrpl.js `validateAMMWithdraw` lines
|
|
58
|
+
* 104–106 — `if (tx.EPrice != null && tx.Amount == null) throw
|
|
59
|
+
* 'AMMWithdraw: must set Amount with EPrice'`. The class accepts
|
|
60
|
+
* EPrice alone.
|
|
61
|
+
*
|
|
62
|
+
* 4. **`LPTokenIn` must be an `IssuedCurrencyAmount` (LP tokens are
|
|
63
|
+
* always an issued currency — never XRP and never an MPT).**
|
|
64
|
+
* Source: xrpl.js `validateAMMWithdraw` lines 108–112 — `if
|
|
65
|
+
* (tx.LPTokenIn != null && !isIssuedCurrencyAmount(tx.LPTokenIn))
|
|
66
|
+
* throw 'AMMWithdraw: LPTokenIn must be an IssuedCurrencyAmount'`.
|
|
67
|
+
* xrpl.js interface `AMMWithdraw.LPTokenIn` is typed
|
|
68
|
+
* `IssuedCurrencyAmount`. The class accepts anything (no
|
|
69
|
+
* validation).
|
|
70
|
+
*
|
|
71
|
+
* 5. **Exactly one of the seven `AMMWithdraw` mode flags must be set in
|
|
72
|
+
* `Flags`.** Source: xrpl.org `ammwithdraw.md` AMMWithdraw Flags
|
|
73
|
+
* section — "You must specify **exactly one** of these flags, plus
|
|
74
|
+
* any global flags." The seven flags (`tfLPToken = 0x00010000`,
|
|
75
|
+
* `tfWithdrawAll = 0x00020000`, `tfOneAssetWithdrawAll = 0x00040000`,
|
|
76
|
+
* `tfSingleAsset = 0x00080000`, `tfTwoAsset = 0x00100000`,
|
|
77
|
+
* `tfOneAssetLPToken = 0x00200000`, `tfLimitLPToken = 0x00400000`)
|
|
78
|
+
* are non-overlapping single-bit values defined in
|
|
79
|
+
* xrpl.js `AMMWithdrawFlags` enum. The class performs no flag-mode
|
|
80
|
+
* validation at all; an empty `Flags` is silently accepted.
|
|
81
|
+
*
|
|
82
|
+
* 6. **`Amount`, `Amount2`, `EPrice` must each be a valid `Amount`
|
|
83
|
+
* (string / IssuedCurrencyAmount / MPTAmount) when provided.**
|
|
84
|
+
* Source: xrpl.js `validateAMMWithdraw` lines 114–124 — each of
|
|
85
|
+
* the three amount fields is gated with `isAmount`. The class
|
|
86
|
+
* accepts anything (no validation).
|
|
87
|
+
*/
|
|
88
|
+
import type { Amount, IssuedCurrencyAmount, Currency } from '../../types/amounts.js';
|
|
89
|
+
import type { AMMWithdrawFlagsInterface } from '../../types/flags.js';
|
|
90
|
+
export interface AmmWithdrawProps {
|
|
91
|
+
/** The unique address of the transaction sender. */
|
|
92
|
+
Account: string;
|
|
93
|
+
/** One of the two assets in the AMM's pool (XRP / IOU / MPT). */
|
|
94
|
+
Asset: Currency;
|
|
95
|
+
/** The other asset in the AMM's pool (XRP / IOU / MPT). */
|
|
96
|
+
Asset2: Currency;
|
|
97
|
+
/**
|
|
98
|
+
* Amount of one asset to withdraw. Optional — when omitted, the
|
|
99
|
+
* mode flag (`tfLPToken`, `tfWithdrawAll`) specifies the
|
|
100
|
+
* withdrawal amount.
|
|
101
|
+
*/
|
|
102
|
+
Amount?: Amount | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Amount of the other asset to withdraw. Requires `Amount` and the
|
|
105
|
+
* `tfTwoAsset` flag (XLS-0030 §2.4.2.3).
|
|
106
|
+
*/
|
|
107
|
+
Amount2?: Amount | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Minimum effective price, in LP Token returned, to pay per unit of
|
|
110
|
+
* the asset to withdraw. Requires `Amount` and the `tfLimitLPToken`
|
|
111
|
+
* flag.
|
|
112
|
+
*/
|
|
113
|
+
EPrice?: Amount | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* How many of the AMM's LP Tokens to redeem. Always an
|
|
116
|
+
* `IssuedCurrencyAmount` (LP tokens are never XRP or MPT).
|
|
117
|
+
*/
|
|
118
|
+
LPTokenIn?: IssuedCurrencyAmount | undefined;
|
|
119
|
+
/** AMM-withdraw mode flag bitmask + any global flags. */
|
|
120
|
+
Flags?: number | AMMWithdrawFlagsInterface | undefined;
|
|
121
|
+
Fee?: string | undefined;
|
|
122
|
+
Sequence?: number | undefined;
|
|
123
|
+
}
|
|
124
|
+
export interface AmmWithdraw extends Readonly<AmmWithdrawProps> {
|
|
125
|
+
readonly TransactionType: 'AMMWithdraw';
|
|
126
|
+
validate(): void;
|
|
127
|
+
toJSON(): Record<string, unknown>;
|
|
128
|
+
with(overrides: Partial<AmmWithdrawProps>): AmmWithdraw;
|
|
129
|
+
}
|
|
130
|
+
export declare function ammWithdraw(props: AmmWithdrawProps): AmmWithdraw;
|
|
131
|
+
//# sourceMappingURL=amm-withdraw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amm-withdraw.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/amm-withdraw.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AA0CtE,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,KAAK,EAAE,QAAQ,CAAC;IAChB,2DAA2D;IAC3D,MAAM,EAAE,QAAQ,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAC7C,yDAAyD;IACzD,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,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