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,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional XChainCreateClaimID factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Creates a new cross-chain claim ID on the destination chain. The claim
|
|
5
|
+
* ID represents one cross-chain transfer of value and is the first step
|
|
6
|
+
* of a transfer: after this transaction succeeds, a corresponding
|
|
7
|
+
* `XChainCommit` transaction on the source chain can reference the
|
|
8
|
+
* resulting `XChainClaimID`. Validation happens at construction; there
|
|
9
|
+
* is no way to construct an invalid tx.
|
|
10
|
+
*
|
|
11
|
+
* import { xchainCreateClaimID } from 'xrplt/fp';
|
|
12
|
+
* const tx = xchainCreateClaimID({
|
|
13
|
+
* Account: 'rahDmoXrtPdh7sUdrPjini3gcnTVYjbjjw',
|
|
14
|
+
* OtherChainSource: 'rMTi57fNy2UkUb4RcdoUeJm7gjxVQvxzUo',
|
|
15
|
+
* SignatureReward: '100',
|
|
16
|
+
* XChainBridge: {
|
|
17
|
+
* LockingChainDoor: 'rMAXACCrp3Y8PpswXcg3bKggHX76V3F8M4',
|
|
18
|
+
* LockingChainIssue: { currency: 'XRP' },
|
|
19
|
+
* IssuingChainDoor: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh',
|
|
20
|
+
* IssuingChainIssue: { currency: 'XRP' },
|
|
21
|
+
* },
|
|
22
|
+
* });
|
|
23
|
+
* const j = tx.toJSON();
|
|
24
|
+
*
|
|
25
|
+
* Required amendment: `XChainBridge`.
|
|
26
|
+
*
|
|
27
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/xchaincreateclaimid
|
|
28
|
+
* @see https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/XChainCreateClaimID.ts
|
|
29
|
+
* @see XLS-0038 (Cross-Chain Bridge) §2.3.1
|
|
30
|
+
* `~/.mavis/docs.local/xrpl-standards/repo/XLS-0038-cross-chain-bridge/README.md`
|
|
31
|
+
* lines 376–403
|
|
32
|
+
* @see rippled `XChainBridge.cpp::XChainCreateClaimID::preflight` (signatures
|
|
33
|
+
* must be XRP, ≥ 0, and a legal net value):
|
|
34
|
+
* https://github.com/XRPLF/rippled/blob/develop/src/libxrpl/tx/transactors/bridge/XChainBridge.cpp#L1961-L1969
|
|
35
|
+
*
|
|
36
|
+
* ## Divergences
|
|
37
|
+
*
|
|
38
|
+
* Compared with `src/transactions/xchain-create-claim-id.ts`, this
|
|
39
|
+
* factory adds guards the class skips (or that xrpl.js / xrpl.org /
|
|
40
|
+
* XLS-38 / rippled mandate but the class omits):
|
|
41
|
+
*
|
|
42
|
+
* - **`Account` must be a valid XRPL classic or X-address.** The class
|
|
43
|
+
* accepts any non-empty string — only the base transaction
|
|
44
|
+
* `super.validate()` is invoked. xrpl.js's `validateBaseTransaction`
|
|
45
|
+
* (which `validateXChainCreateClaimID` delegates to) enforces a string;
|
|
46
|
+
* we additionally enforce the XRPL classic/X-address format at
|
|
47
|
+
* construction, matching every other fp factory.
|
|
48
|
+
* - Source: xrpl.js
|
|
49
|
+
* `~/.mavis/docs.local/xrpl.js/repo/packages/xrpl/src/models/transactions/common.ts`
|
|
50
|
+
* `validateBaseTransaction`.
|
|
51
|
+
* - Cross-ref: rippled parses `Account` as `STAccount`; only valid
|
|
52
|
+
* XRPL classic addresses parse. xrpl.org `xchaincreateclaimid.md`
|
|
53
|
+
* example line 20 lists `Account` as a classic address.
|
|
54
|
+
*
|
|
55
|
+
* - **`XChainBridge` is fully shape-validated.** xrpl.js
|
|
56
|
+
* `validateXChainCreateClaimID` line 47 calls
|
|
57
|
+
* `validateRequiredField(tx, 'XChainBridge', isXChainBridge)`, which
|
|
58
|
+
* requires exactly 4 keys, two `AccountID` door strings, and two
|
|
59
|
+
* `Issue` currency objects (`{currency: 'XRP'}` or `{currency,
|
|
60
|
+
* issuer}`). The class only verifies `isRecord`, which accepts any
|
|
61
|
+
* object (including `{}` or `{foo: 'bar'}`). The factory uses the
|
|
62
|
+
* local `isXChainBridge` helper to enforce the full shape.
|
|
63
|
+
* - Source: xrpl.js
|
|
64
|
+
* `~/.mavis/docs.local/xrpl.js/repo/packages/xrpl/src/models/transactions/common.ts`
|
|
65
|
+
* `isXChainBridge` (lines 444–453).
|
|
66
|
+
* - Source: XLS-38 §2.3.1.1.1 line 391 (`XChainBridge` is required;
|
|
67
|
+
* `XCHAIN_BRIDGE` internal type).
|
|
68
|
+
* - Source: xrpl.org `xchaincreateclaimid.md` lines 56–61 (the four
|
|
69
|
+
* sub-fields are each required: `IssuingChainDoor`,
|
|
70
|
+
* `IssuingChainIssue`, `LockingChainDoor`, `LockingChainIssue`).
|
|
71
|
+
* - Cross-ref: our `src/validation/helpers.ts` `isXChainBridge`
|
|
72
|
+
* (lines 168–177) mirrors the xrpl.js check.
|
|
73
|
+
*
|
|
74
|
+
* - **Both `XChainBridge` doors must be valid XRPL classic
|
|
75
|
+
* / X-addresses.** `isXChainBridge` only checks that the door
|
|
76
|
+
* strings are strings; rippled parses them as `STAccount`. The
|
|
77
|
+
* factory additionally runs `isAccount` on each door so a malformed
|
|
78
|
+
* door string is caught at construction.
|
|
79
|
+
* - Source: rippled `XChainBridge.cpp` (`sfLockingChainDoor`,
|
|
80
|
+
* `sfIssuingChainDoor` parsed as `STAccount`).
|
|
81
|
+
* - Source: xrpl.org `xchaincreateclaimid.md` line 58
|
|
82
|
+
* (`IssuingChainDoor` is `Account`); line 60 (`LockingChainDoor`
|
|
83
|
+
* is `Account`).
|
|
84
|
+
* - Cross-ref: XLS-38 §2.1.1.1.2 lines 175–180 (bridge `XCHAIN_BRIDGE`
|
|
85
|
+
* internal type; `LockingChainDoor` / `IssuingChainDoor` are
|
|
86
|
+
* `ACCOUNT`).
|
|
87
|
+
*
|
|
88
|
+
* - **`SignatureReward` must be a non-negative XRP drops string.** The
|
|
89
|
+
* class delegates to `isAmount`, which accepts any of: XRP drops
|
|
90
|
+
* string, IOU object, or MPT object. XLS-38 §2.3.1.1.2 line 398
|
|
91
|
+
* states: "The amount, **in XRP**, to be used to reward the witness
|
|
92
|
+
* servers for providing signatures." xrpl.org
|
|
93
|
+
* `xchaincreateclaimid.md` line 45 calls it a `Currency Amount`
|
|
94
|
+
* (per the JSON type column) but the example JSON (line 22) uses
|
|
95
|
+
* `"SignatureReward": "100"` (XRP drops string form), and the
|
|
96
|
+
* description immediately after the table says "in XRP". rippled's
|
|
97
|
+
* `XChainCreateClaimID::preflight` enforces `isXRP(reward) &&
|
|
98
|
+
* reward.signum() >= 0 && isLegalNet(reward)` — i.e., native (XRP),
|
|
99
|
+
* non-negative, and within the protocol's native mantissa cap. The
|
|
100
|
+
* factory mirrors this with a strict XRP drops string check, ≥ 0
|
|
101
|
+
* (zero is permitted; a bridge may opt out of witness payment).
|
|
102
|
+
* - Source: XLS-38 §2.3.1.1.2 line 398 ("in XRP").
|
|
103
|
+
* - Source: xrpl.org `xchaincreateclaimid.md` line 45 + example line
|
|
104
|
+
* 22 (`"SignatureReward": "100"`).
|
|
105
|
+
* - Source: rippled `XChainBridge.cpp` lines 1961–1969
|
|
106
|
+
* (`isXRP(reward) && signum() >= 0 && isLegalNet(reward)` →
|
|
107
|
+
* `temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT`).
|
|
108
|
+
* - Cross-ref: `isLegalNet` enforces `mantissa() <= kMaxNativeN`
|
|
109
|
+
* (`include/xrpl/protocol/STAmount.h` line 23: `kMaxNativeN =
|
|
110
|
+
* 100'000'000'000'000'000ull`). The factory does NOT enforce this
|
|
111
|
+
* ceiling — at 100 billion XRP the wire form would already be too
|
|
112
|
+
* large for the integer-string parser; we rely on the `isString`
|
|
113
|
+
* type check plus the regex. (Documented for awareness; the spec
|
|
114
|
+
* upper bound is effectively `kMaxNativeN`.)
|
|
115
|
+
*
|
|
116
|
+
* - **`OtherChainSource` must be a valid XRPL classic / X-address.**
|
|
117
|
+
* The class declares the field as `readonly OtherChainSource: string`
|
|
118
|
+
* but never validates it. xrpl.js `validateXChainCreateClaimID`
|
|
119
|
+
* line 49 calls `validateRequiredField(tx, 'OtherChainSource',
|
|
120
|
+
* isAccount)`. xrpl.org `xchaincreateclaimid.md` line 44 marks it
|
|
121
|
+
* `String - Address / AccountID`; XLS-38 §2.3.1.1.3 line 402 defines
|
|
122
|
+
* it as `ACCOUNT`. rippled parses it as `STAccount`. The factory
|
|
123
|
+
* enforces XRPL address format at construction.
|
|
124
|
+
* - Source: xrpl.js `XChainCreateClaimID.ts` line 49 (`isAccount`).
|
|
125
|
+
* - Source: xrpl.org `xchaincreateclaimid.md` line 44 (`AccountID`).
|
|
126
|
+
* - Source: XLS-38 §2.3.1.1.3 line 402 (`ACCOUNT` internal type).
|
|
127
|
+
* - Cross-ref: rippled parses `OtherChainSource` as `STAccount`; only
|
|
128
|
+
* valid XRPL classic addresses parse.
|
|
129
|
+
*
|
|
130
|
+
* - **`XChainClaimID` is NOT a transaction field.** The task brief
|
|
131
|
+
* mentioned `XChainClaimID` as a `number | string` UInt64 input, but
|
|
132
|
+
* the canonical spec lists exactly three fields — `XChainBridge`,
|
|
133
|
+
* `SignatureReward`, `OtherChainSource` — at XLS-38 §2.3.1.1 lines
|
|
134
|
+
* 385–389. xrpl.js's `XChainCreateClaimID` interface (lines 23–37)
|
|
135
|
+
* also omits it. rippled's `XChainCreateClaimID::doApply` derives
|
|
136
|
+
* the new claim ID by incrementing the bridge's stored counter
|
|
137
|
+
* (`(*sleBridge)[sfXChainClaimID] + 1`, `XChainBridge.cpp:2022`).
|
|
138
|
+
* The factory correctly omits `XChainClaimID`; consumers read the
|
|
139
|
+
* new claim ID from the transaction's metadata after submission.
|
|
140
|
+
* - Source: XLS-38 §2.3.1.1 lines 385–389 (no `XChainClaimID` row).
|
|
141
|
+
* - Source: xrpl.js `XChainCreateClaimID.ts` lines 23–37 (interface
|
|
142
|
+
* has no `XChainClaimID` field).
|
|
143
|
+
* - Source: rippled `XChainBridge.cpp` lines 2022–2029 (claim ID is
|
|
144
|
+
* derived, not input).
|
|
145
|
+
*
|
|
146
|
+
* - **`Account` and `OtherChainSource` are typically different
|
|
147
|
+
* accounts.** The factory does NOT enforce a `Account !==
|
|
148
|
+
* OtherChainSource` check (XLS-38 does not forbid self-source), but
|
|
149
|
+
* in practice `OtherChainSource` is the source-chain account that
|
|
150
|
+
* will later submit the `XChainCommit` transaction, while `Account`
|
|
151
|
+
* is the destination-chain account that submits this
|
|
152
|
+
* `XChainCreateClaimID`. Same-account usage is unusual but allowed.
|
|
153
|
+
* Documented here to clarify the factory's scope; no spec rule is
|
|
154
|
+
* relaxed.
|
|
155
|
+
*
|
|
156
|
+
* - **`Flags` accepted for parity with the base transaction shape.**
|
|
157
|
+
* XChainCreateClaimID defines no transaction-specific flags; only
|
|
158
|
+
* `tfFullyCanonicalSig` (global) is normally meaningful. The class
|
|
159
|
+
* does not declare a `Flags` field. We accept a numeric bitmask
|
|
160
|
+
* for parity with the rest of the fp family. This is a permissive
|
|
161
|
+
* addition, not a tightening.
|
|
162
|
+
* - Source: XLS-38 §2.3.1.1 lines 385–389 (no `Flags` row).
|
|
163
|
+
* - Cross-ref: rippled accepts the `Flags` field for any transaction
|
|
164
|
+
* (it defaults to `tfFullyCanonicalSig`).
|
|
165
|
+
*/
|
|
166
|
+
import type { XChainBridge } from '../../types/common.js';
|
|
167
|
+
export interface XchainCreateClaimIDProps {
|
|
168
|
+
/** The unique address of the transaction sender — the destination-
|
|
169
|
+
* chain account that will own the resulting `XChainOwnedClaimID`
|
|
170
|
+
* ledger object. Valid XRPL classic/X-address. */
|
|
171
|
+
Account: string;
|
|
172
|
+
/** The bridge to create the claim ID for. Required; 4-key shape with
|
|
173
|
+
* both doors as valid XRPL classic/X addresses and both Issues as
|
|
174
|
+
* valid Issue forms. */
|
|
175
|
+
XChainBridge: XChainBridge;
|
|
176
|
+
/** The amount, in XRP, to reward the witness servers for providing
|
|
177
|
+
* signatures. Must match the bridge's stored `SignatureReward`.
|
|
178
|
+
* Non-negative (≥ 0). */
|
|
179
|
+
SignatureReward: string;
|
|
180
|
+
/** The account that must send the `XChainCommit` transaction on the
|
|
181
|
+
* source chain. Valid XRPL classic/X-address. */
|
|
182
|
+
OtherChainSource: string;
|
|
183
|
+
/** Bit-flags for this transaction. XChainCreateClaimID has no
|
|
184
|
+
* defined flags; only `tfFullyCanonicalSig` (global) is meaningful.
|
|
185
|
+
* Accepted for parity with the base tx shape. */
|
|
186
|
+
Flags?: number | undefined;
|
|
187
|
+
/** Fee in drops. */
|
|
188
|
+
Fee?: string | undefined;
|
|
189
|
+
/** Account sequence number. */
|
|
190
|
+
Sequence?: number | undefined;
|
|
191
|
+
}
|
|
192
|
+
export interface XchainCreateClaimID extends Readonly<XchainCreateClaimIDProps> {
|
|
193
|
+
readonly TransactionType: 'XChainCreateClaimID';
|
|
194
|
+
validate(): void;
|
|
195
|
+
toJSON(): Record<string, unknown>;
|
|
196
|
+
with(overrides: Partial<XchainCreateClaimIDProps>): XchainCreateClaimID;
|
|
197
|
+
}
|
|
198
|
+
export declare function xchainCreateClaimID(props: XchainCreateClaimIDProps): XchainCreateClaimID;
|
|
199
|
+
//# sourceMappingURL=xchain-create-claim-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xchain-create-claim-id.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/xchain-create-claim-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoKG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAiD1D,MAAM,WAAW,wBAAwB;IACvC;;uDAEmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB;;6BAEyB;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B;;8BAE0B;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB;sDACkD;IAClD,gBAAgB,EAAE,MAAM,CAAC;IACzB;;sDAEkD;IAClD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,oBAAoB;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,mBACf,SAAQ,QAAQ,CAAC,wBAAwB,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,qBAAqB,CAAC;IAChD,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,mBAAmB,CAAC;CACzE;AAID,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,GAC9B,mBAAmB,CA0DrB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { isAccount, isString, isXChainBridge } from '../../validation/helpers.js';
|
|
2
|
+
import { ValidationError } from '../../errors.js';
|
|
3
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
4
|
+
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
5
|
+
const XRP_DROPS_REGEX = /^[0-9]+$/u;
|
|
6
|
+
/**
|
|
7
|
+
* Non-negative XRP drops Amount. Accepts the canonical XRP drops
|
|
8
|
+
* mantissa form (decimal integer string with no exponent, no decimal
|
|
9
|
+
* point — the wire format used by Amount fields in XChainBridge-related
|
|
10
|
+
* transactions) and rejects zero, negative, and non-numeric values
|
|
11
|
+
* via the strictly-positive wrapper.
|
|
12
|
+
*
|
|
13
|
+
* For XChainCreateClaimID, `SignatureReward` may legitimately be `'0'`
|
|
14
|
+
* (a bridge may opt out of witness payment). Zero is therefore allowed.
|
|
15
|
+
*/
|
|
16
|
+
function isNonNegativeXrpAmount(value) {
|
|
17
|
+
if (!isString(value))
|
|
18
|
+
return false;
|
|
19
|
+
if (!XRP_DROPS_REGEX.test(value))
|
|
20
|
+
return false;
|
|
21
|
+
// Reject leading zeros (e.g., '01', '00100') — the XRPL wire format
|
|
22
|
+
// rejects these. `'0'` itself is the only valid zero.
|
|
23
|
+
if (value.length > 1 && value.startsWith('0'))
|
|
24
|
+
return false;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Validate XChainBridge object shape: 4 keys with both doors as valid
|
|
29
|
+
* XRPL classic/X addresses and both issues as valid Issue forms. The
|
|
30
|
+
* local `isXChainBridge` helper checks the structural 4-key + Issue
|
|
31
|
+
* shape; we add XRPL-account format validation on the two doors.
|
|
32
|
+
*/
|
|
33
|
+
function assertValidXChainBridge(bridge) {
|
|
34
|
+
if (!isAccount(bridge.LockingChainDoor)) {
|
|
35
|
+
throw new ValidationError('XChainCreateClaimID: XChainBridge.LockingChainDoor must be a valid XRPL account address');
|
|
36
|
+
}
|
|
37
|
+
if (!isAccount(bridge.IssuingChainDoor)) {
|
|
38
|
+
throw new ValidationError('XChainCreateClaimID: XChainBridge.IssuingChainDoor must be a valid XRPL account address');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
42
|
+
export function xchainCreateClaimID(props) {
|
|
43
|
+
// ── Account ── required, must be a valid XRPL classic or X-address.
|
|
44
|
+
require(props.Account, 'XChainCreateClaimID: Account is required', isAccount);
|
|
45
|
+
// ── XChainBridge ── required, full shape (4 keys, both doors valid
|
|
46
|
+
// XRPL accounts, both issues valid Issue forms).
|
|
47
|
+
require(props.XChainBridge, 'XChainCreateClaimID: XChainBridge is required and must have shape {LockingChainDoor, LockingChainIssue, IssuingChainDoor, IssuingChainIssue}', isXChainBridge);
|
|
48
|
+
// `props.XChainBridge` is now type-narrowed to XChainBridge —
|
|
49
|
+
// verify the doors are valid XRPL accounts (the helper only
|
|
50
|
+
// checks `typeof === 'string'`).
|
|
51
|
+
assertValidXChainBridge(props.XChainBridge);
|
|
52
|
+
// ── SignatureReward ── required, non-negative XRP drops string.
|
|
53
|
+
if (!isNonNegativeXrpAmount(props.SignatureReward)) {
|
|
54
|
+
throw new ValidationError('XChainCreateClaimID: SignatureReward must be a non-negative XRP drops string (in XRP, ≥ 0; XLS-38 §2.3.1.1.2 line 398)');
|
|
55
|
+
}
|
|
56
|
+
// ── OtherChainSource ── required, valid XRPL classic/X-address.
|
|
57
|
+
require(props.OtherChainSource, 'XChainCreateClaimID: OtherChainSource is required', isAccount);
|
|
58
|
+
return buildFrozenTx('XChainCreateClaimID', props, {
|
|
59
|
+
validate() {
|
|
60
|
+
// Validated at construction.
|
|
61
|
+
},
|
|
62
|
+
toJSON() {
|
|
63
|
+
const json = {};
|
|
64
|
+
for (const k of Object.keys(this)) {
|
|
65
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
66
|
+
continue;
|
|
67
|
+
const v = this[k];
|
|
68
|
+
if (v !== undefined)
|
|
69
|
+
json[k] = v;
|
|
70
|
+
}
|
|
71
|
+
return json;
|
|
72
|
+
},
|
|
73
|
+
with(overrides) {
|
|
74
|
+
return xchainCreateClaimID(mergeForWith(this, overrides));
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=xchain-create-claim-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xchain-create-claim-id.js","sourceRoot":"","sources":["../../../src/fp/factories/xchain-create-claim-id.ts"],"names":[],"mappings":"AAsKA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,MAAM,eAAe,GAAG,WAAW,CAAC;AAEpC;;;;;;;;;GASG;AACH,SAAS,sBAAsB,CAAC,KAAc;IAC5C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/C,oEAAoE;IACpE,sDAAsD;IACtD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5D,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAS,uBAAuB,CAAC,MAAoB;IACnD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,eAAe,CACvB,yFAAyF,CAC1F,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,eAAe,CACvB,yFAAyF,CAC1F,CAAC;IACJ,CAAC;AACH,CAAC;AAsCD,wEAAwE;AAExE,MAAM,UAAU,mBAAmB,CACjC,KAA+B;IAE/B,qEAAqE;IACrE,OAAO,CACL,KAAK,CAAC,OAAO,EACb,0CAA0C,EAC1C,SAAS,CACV,CAAC;IAEF,oEAAoE;IACpE,oDAAoD;IACpD,OAAO,CACL,KAAK,CAAC,YAAY,EAClB,8IAA8I,EAC9I,cAAc,CACf,CAAC;IACF,8DAA8D;IAC9D,4DAA4D;IAC5D,iCAAiC;IACjC,uBAAuB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE5C,iEAAiE;IACjE,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,eAAe,CACvB,wHAAwH,CACzH,CAAC;IACJ,CAAC;IAED,iEAAiE;IACjE,OAAO,CACL,KAAK,CAAC,gBAAgB,EACtB,mDAAmD,EACnD,SAAS,CACV,CAAC;IAEF,OAAO,aAAa,CAClB,qBAAqB,EACrB,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,CAEF,SAA4C;YAE5C,OAAO,mBAAmB,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAC5D,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional XChainModifyBridge factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Updates the parameters of an existing cross-chain bridge. Per XLS-38
|
|
5
|
+
* §2.2.2 (line 336), only `SignatureReward` and `MinAccountCreateAmount`
|
|
6
|
+
* may be modified — changing the door accounts or assets would be
|
|
7
|
+
* equivalent to creating a new bridge. The transaction is sent by the
|
|
8
|
+
* door account and requires witness signatures (collected outside the
|
|
9
|
+
* ledger). Validation happens at construction; there is no way to
|
|
10
|
+
* construct an invalid tx.
|
|
11
|
+
*
|
|
12
|
+
* import { xchainModifyBridge } from 'xrplt/fp';
|
|
13
|
+
* const tx = xchainModifyBridge({
|
|
14
|
+
* Account: 'rhWQzvdmhf5vFS35vtKUSUwNZHGT53qQsg',
|
|
15
|
+
* XChainBridge: { ... },
|
|
16
|
+
* SignatureReward: '250',
|
|
17
|
+
* MinAccountCreateAmount: '500000',
|
|
18
|
+
* Flags: { tfClearAccountCreateAmount: false },
|
|
19
|
+
* });
|
|
20
|
+
* // Clear the MinAccountCreateAmount via the explicit flag:
|
|
21
|
+
* const tx2 = xchainModifyBridge({
|
|
22
|
+
* Account: 'rhWQzvdmhf5vFS35vtKUSUwNZHGT53qQsg',
|
|
23
|
+
* XChainBridge: { ... },
|
|
24
|
+
* SignatureReward: '250',
|
|
25
|
+
* Flags: { tfClearAccountCreateAmount: true },
|
|
26
|
+
* });
|
|
27
|
+
* const j = tx.toJSON();
|
|
28
|
+
* const tx3 = tx.with({ SignatureReward: '300' });
|
|
29
|
+
*
|
|
30
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/xchainmodifybridge
|
|
31
|
+
* @see https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/XChainModifyBridge.ts
|
|
32
|
+
* @see XLS-0038 (Cross-Chain Bridge) §2.2.2
|
|
33
|
+
* (`~/.mavis/docs.local/xrpl-standards/repo/XLS-0038-cross-chain-bridge/README.md`
|
|
34
|
+
* lines 334–372)
|
|
35
|
+
*
|
|
36
|
+
* ## Divergences
|
|
37
|
+
*
|
|
38
|
+
* Compared with `src/transactions/xchain-modify-bridge.ts`, this factory
|
|
39
|
+
* adds guards the class skips (or that xrpl.js / xrpl.org / XLS-38
|
|
40
|
+
* mandate but the class omits):
|
|
41
|
+
*
|
|
42
|
+
* - **`Account` must be a valid XRPL classic or X-address.** The class
|
|
43
|
+
* only invokes `super.validate()` (the base transaction check), which
|
|
44
|
+
* does not enforce an XRPL address format. xrpl.js's
|
|
45
|
+
* `validateBaseTransaction` (which `validateXChainModifyBridge`
|
|
46
|
+
* delegates to) requires a string; we additionally enforce the XRPL
|
|
47
|
+
* classic/X-address format at construction, matching every other fp
|
|
48
|
+
* factory.
|
|
49
|
+
* - Source: xrpl.js
|
|
50
|
+
* `~/.mavis/docs.local/xrpl.js/repo/packages/xrpl/src/models/transactions/common.ts`
|
|
51
|
+
* `validateBaseTransaction`.
|
|
52
|
+
* - Cross-ref: rippled `XChainBridge.cpp` preflight parses
|
|
53
|
+
* `Account` as `STAccount`; only valid XRPL classic addresses parse.
|
|
54
|
+
* xrpl.org `xchainmodifybridge.md` line 26 lists `Account` as the
|
|
55
|
+
* door account.
|
|
56
|
+
*
|
|
57
|
+
* - **`XChainBridge` is fully shape-validated.** xrpl.js
|
|
58
|
+
* `validateXChainModifyBridge.ts:72` calls
|
|
59
|
+
* `validateRequiredField(tx, 'XChainBridge', isXChainBridge)`,
|
|
60
|
+
* which requires exactly 4 keys, two `AccountID` door strings, and
|
|
61
|
+
* two `Issue` currency objects. Our class only verifies `isRecord`,
|
|
62
|
+
* which accepts any object (including `{}` or `{foo: 'bar'}`). The
|
|
63
|
+
* factory uses the local `isXChainBridge` helper to enforce the full
|
|
64
|
+
* shape.
|
|
65
|
+
* - Source: xrpl.js `common.ts` `isXChainBridge` (lines 444–453).
|
|
66
|
+
* - Source: XLS-38 §2.2.2.1.1 line 354 (`XChainBridge` is required,
|
|
67
|
+
* `XCHAIN_BRIDGE` internal type).
|
|
68
|
+
* - Source: xrpl.org `xchainmodifybridge.md` line 50 (required).
|
|
69
|
+
*
|
|
70
|
+
* - **Both `XChainBridge` doors must be valid XRPL classic
|
|
71
|
+
* addresses.** `isXChainBridge` only checks that the door strings are
|
|
72
|
+
* strings; rippled parses them as `STAccount`. The factory
|
|
73
|
+
* additionally runs `isAccount` on each door so a malformed door
|
|
74
|
+
* string is caught at construction.
|
|
75
|
+
* - Source: xrpl.org `xchainmodifybridge.md` lines 57, 59 (each
|
|
76
|
+
* door is `AccountID`).
|
|
77
|
+
* - Cross-ref: rippled `XChainBridge.cpp` (`sfLockingChainDoor`,
|
|
78
|
+
* `sfIssuingChainDoor` parsed as `STAccount`).
|
|
79
|
+
*
|
|
80
|
+
* - **`SignatureReward` must be a non-negative XRP drops string.**
|
|
81
|
+
* XLS-38 §2.1.1.1.3 line 200 (the spec text is shared between
|
|
82
|
+
* create-bridge and modify-bridge): "The total amount, **in XRP**, to
|
|
83
|
+
* be rewarded for providing a signature for a cross-chain transfer or
|
|
84
|
+
* for signing for the cross-chain reward." xrpl.js
|
|
85
|
+
* `validateXChainModifyBridge.ts:74` only runs `isAmount`, which
|
|
86
|
+
* accepts any of: XRP drops string, IOU object, or MPT object. The
|
|
87
|
+
* factory enforces XRP-only (drops string) with `≥ 0`, matching the
|
|
88
|
+
* XLS-38 wording and rippled's `STAmount` parse for `sfSignatureReward`.
|
|
89
|
+
* The factory treats `SignatureReward` as **required** even though the
|
|
90
|
+
* canonical sources mark it as optional, because modifying the
|
|
91
|
+
* signature reward is the canonical use case of this transaction and
|
|
92
|
+
* forcing the caller to be explicit avoids silently no-op txs
|
|
93
|
+
* (cf. Spec Ambiguities #1).
|
|
94
|
+
* - Source: XLS-38 §2.1.1.1.3 line 200 ("in XRP").
|
|
95
|
+
* - Source: xrpl.org `xchainmodifybridge.md` line 49 (example uses
|
|
96
|
+
* numeric `200`).
|
|
97
|
+
* - Source: XLS-38 §2.2.2.1.2 line 358 (`SignatureReward` field).
|
|
98
|
+
*
|
|
99
|
+
* - **`MinAccountCreateAmount`, when present, must be a non-negative
|
|
100
|
+
* XRP drops string.** xrpl.org line 48: "The minimum amount, **in
|
|
101
|
+
* XRP**, required for a `XChainAccountCreateCommit` transaction.
|
|
102
|
+
* ... **This field can only be present on XRP-XRP bridges.**" XLS-38
|
|
103
|
+
* §2.1.1.1.4 line 204 repeats the same. The class accepts any string;
|
|
104
|
+
* xrpl.js's `validateXChainModifyBridge.ts:76` does the same. The
|
|
105
|
+
* factory rejects IOU/MPT forms and non-canonical wire forms (leading
|
|
106
|
+
* zeros, decimals, exponents) at construction.
|
|
107
|
+
* - Source: xrpl.org `xchainmodifybridge.md` line 48 ("in XRP";
|
|
108
|
+
* "can only be present on XRP-XRP bridges").
|
|
109
|
+
* - Source: XLS-38 §2.1.1.1.4 line 204 ("in XRP"; "XRP-XRP
|
|
110
|
+
* bridges only").
|
|
111
|
+
* - Source: XLS-38 §2.2.2.1.3 line 362 (`MinAccountCreateAmount`
|
|
112
|
+
* field).
|
|
113
|
+
*
|
|
114
|
+
* - **`Account` must equal `XChainBridge.LockingChainDoor`.** xrpl.org
|
|
115
|
+
* line 13: "Only managers can send this transaction." xrpl.org line
|
|
116
|
+
* 15: "This transaction must be sent by the door account." The
|
|
117
|
+
* example JSON (lines 26, 28) sets `Account === LockingChainDoor`.
|
|
118
|
+
* The factory enforces this equality at construction. The class does
|
|
119
|
+
* not (it accepts any `Account` shape). Note: an issuing-chain
|
|
120
|
+
* submission uses the `IssuingChainDoor` instead; we do not enforce
|
|
121
|
+
* that case here — see Spec Ambiguities #2.
|
|
122
|
+
* - Source: xrpl.org `xchainmodifybridge.md` line 13 ("Only managers
|
|
123
|
+
* can send this transaction").
|
|
124
|
+
* - Source: xrpl.org `xchainmodifybridge.md` line 15 ("must be sent
|
|
125
|
+
* by the door account").
|
|
126
|
+
* - Source: xrpl.org example JSON (lines 26, 28) — `Account` equals
|
|
127
|
+
* `LockingChainDoor`.
|
|
128
|
+
* - Cross-ref: rippled `XChainBridge.cpp` preflight checks
|
|
129
|
+
* `tx[sfAccount]` matches the door account.
|
|
130
|
+
*
|
|
131
|
+
* - **`Flags` accepts the `tfClearAccountCreateAmount` flag (0x00010000)
|
|
132
|
+
* via boolean-map form.** XLS-38 §2.2.2.1.4 lines 366–372 defines a
|
|
133
|
+
* single transaction-specific flag,
|
|
134
|
+
* `tfClearAccountCreateAmount` (`0x00010000`), which clears the
|
|
135
|
+
* `MinAccountCreateAmount` on the bridge. xrpl.js exposes this via
|
|
136
|
+
* `XChainModifyBridgeFlagsInterface` (lines 29–32). The class does
|
|
137
|
+
* not declare any `Flags` field; we accept both numeric and
|
|
138
|
+
* boolean-map forms and translate the latter to a numeric bitmask
|
|
139
|
+
* for downstream consumers (mirroring `nftokenMint`'s flag handling).
|
|
140
|
+
* When set, the resulting `Flags` includes the `0x00010000` bit.
|
|
141
|
+
* - Source: xrpl.js `XChainModifyBridge.ts` lines 18–32
|
|
142
|
+
* (`XChainModifyBridgeFlags` enum, `XChainModifyBridgeFlagsInterface`).
|
|
143
|
+
* - Source: XLS-38 §2.2.2.1.4 line 372.
|
|
144
|
+
* - Source: xrpl.org `xchainmodifybridge.md` line 69.
|
|
145
|
+
*
|
|
146
|
+
* - **No `Amount` / `Destination` / `Memos` are not declared here.**
|
|
147
|
+
* `XChainModifyBridge` only carries `SignatureReward` /
|
|
148
|
+
* `MinAccountCreateAmount` (plus the `XChainBridge`). We do not add
|
|
149
|
+
* unsupported fields. The factory does not pass through arbitrary
|
|
150
|
+
* keys — `.with()` can override the documented fields only.
|
|
151
|
+
* (Sanity note; included to prevent future API drift.)
|
|
152
|
+
* - Source: XLS-38 §2.2.2.1 fields table (lines 347–352); no other
|
|
153
|
+
* amount-bearing fields.
|
|
154
|
+
* - Source: xrpl.org `xchainmodifybridge.md` Fields table
|
|
155
|
+
* (lines 45–50); no other fields.
|
|
156
|
+
*/
|
|
157
|
+
import type { XChainBridge } from '../../types/common.js';
|
|
158
|
+
import type { XChainModifyBridgeFlagsInterface } from '../../types/flags.js';
|
|
159
|
+
export interface XchainModifyBridgeProps {
|
|
160
|
+
/** The unique address of the transaction sender — the door account
|
|
161
|
+
* on the chain the bridge was created on. For a locking-chain
|
|
162
|
+
* submission, this MUST equal `XChainBridge.LockingChainDoor`
|
|
163
|
+
* (xrpl.org line 15, rippled preflight). */
|
|
164
|
+
Account: string;
|
|
165
|
+
/** The bridge (door accounts and assets) to modify. Required;
|
|
166
|
+
* must be a fully-shaped `XChainBridge` (4 keys, two valid XRPL
|
|
167
|
+
* doors, two valid Issue forms). */
|
|
168
|
+
XChainBridge: XChainBridge;
|
|
169
|
+
/** The total amount to pay the witness servers for their
|
|
170
|
+
* signatures (XRP drops, ≥ 0). Factory treats this as required
|
|
171
|
+
* even though XLS-38 marks it optional — see Divergences for
|
|
172
|
+
* rationale. */
|
|
173
|
+
SignatureReward: string;
|
|
174
|
+
/** Optional. The minimum amount, in XRP, required for a
|
|
175
|
+
* `XChainAccountCreateCommit` transaction against this bridge.
|
|
176
|
+
* May only be present on XRP-XRP bridges; defaults to 0 when
|
|
177
|
+
* omitted. To explicitly clear a previously-set value, use the
|
|
178
|
+
* `tfClearAccountCreateAmount` flag instead. */
|
|
179
|
+
MinAccountCreateAmount?: string | undefined;
|
|
180
|
+
/** Bit-flags for this transaction. Accepts a numeric bitmask or
|
|
181
|
+
* the `XChainModifyBridgeFlagsInterface` boolean-map form. The
|
|
182
|
+
* transaction-specific flag is `tfClearAccountCreateAmount`
|
|
183
|
+
* (`0x00010000`); setting it clears the bridge's stored
|
|
184
|
+
* `MinAccountCreateAmount`. */
|
|
185
|
+
Flags?: number | XChainModifyBridgeFlagsInterface | undefined;
|
|
186
|
+
/** Fee in drops. */
|
|
187
|
+
Fee?: string | undefined;
|
|
188
|
+
/** Account sequence number. */
|
|
189
|
+
Sequence?: number | undefined;
|
|
190
|
+
}
|
|
191
|
+
export interface XchainModifyBridge extends Readonly<XchainModifyBridgeProps> {
|
|
192
|
+
readonly TransactionType: 'XChainModifyBridge';
|
|
193
|
+
validate(): void;
|
|
194
|
+
toJSON(): Record<string, unknown>;
|
|
195
|
+
with(overrides: Partial<XchainModifyBridgeProps>): XchainModifyBridge;
|
|
196
|
+
}
|
|
197
|
+
export declare function xchainModifyBridge(props: XchainModifyBridgeProps): XchainModifyBridge;
|
|
198
|
+
//# sourceMappingURL=xchain-modify-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xchain-modify-bridge.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/xchain-modify-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2JG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAoD7E,MAAM,WAAW,uBAAuB;IACtC;;;iDAG6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;yCAEqC;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B;;;qBAGiB;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB;;;;qDAIiD;IACjD,sBAAsB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C;;;;oCAIgC;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,gCAAgC,GAAG,SAAS,CAAC;IAC9D,oBAAoB;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+BAA+B;IAC/B,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;AAID,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAC7B,kBAAkB,CAkFpB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { isAccount, isString, isXChainBridge } from '../../validation/helpers.js';
|
|
2
|
+
import { ValidationError } from '../../errors.js';
|
|
3
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
4
|
+
// ─── Spec constants ──────────────────────────────────────────────────
|
|
5
|
+
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
6
|
+
const XRP_DROPS_REGEX = /^[0-9]+$/u;
|
|
7
|
+
/**
|
|
8
|
+
* Non-negative XRP drops Amount. Accepts the canonical XRPL wire form
|
|
9
|
+
* (decimal integer string with no exponent, no decimal point) and
|
|
10
|
+
* rejects leading zeros (e.g. `'01'`, `'00100'`) so the form matches
|
|
11
|
+
* what rippled's `STAmount` parser will accept. `'0'` itself is the
|
|
12
|
+
* only valid zero.
|
|
13
|
+
*
|
|
14
|
+
* For XChainModifyBridge, both `SignatureReward` and
|
|
15
|
+
* `MinAccountCreateAmount` may legitimately be `'0'`: a zero
|
|
16
|
+
* `SignatureReward` is permitted (bridge may opt out of witness
|
|
17
|
+
* payment); a zero `MinAccountCreateAmount` is the default value when
|
|
18
|
+
* the field is omitted. Zero is therefore allowed.
|
|
19
|
+
*/
|
|
20
|
+
function isNonNegativeXrpAmount(value) {
|
|
21
|
+
if (!isString(value))
|
|
22
|
+
return false;
|
|
23
|
+
if (!XRP_DROPS_REGEX.test(value))
|
|
24
|
+
return false;
|
|
25
|
+
if (value.length > 1 && value.startsWith('0'))
|
|
26
|
+
return false;
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validate XChainBridge object shape: 4 keys with both doors as valid
|
|
31
|
+
* XRPL classic/X addresses and both issues as valid Issue forms. The
|
|
32
|
+
* local `isXChainBridge` helper checks the structural 4-key + Issue
|
|
33
|
+
* shape; we add XRPL-account format validation on the two doors.
|
|
34
|
+
*/
|
|
35
|
+
function assertValidXChainBridge(bridge) {
|
|
36
|
+
if (!isAccount(bridge.LockingChainDoor)) {
|
|
37
|
+
throw new ValidationError('XChainModifyBridge: XChainBridge.LockingChainDoor must be a valid XRPL account address');
|
|
38
|
+
}
|
|
39
|
+
if (!isAccount(bridge.IssuingChainDoor)) {
|
|
40
|
+
throw new ValidationError('XChainModifyBridge: XChainBridge.IssuingChainDoor must be a valid XRPL account address');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
44
|
+
export function xchainModifyBridge(props) {
|
|
45
|
+
// ── Account ── required, must be a valid XRPL classic or X-address.
|
|
46
|
+
require(props.Account, 'XChainModifyBridge: Account is required', isAccount);
|
|
47
|
+
// ── XChainBridge ── required, full shape (4 keys, both doors valid
|
|
48
|
+
// XRPL accounts, both issues valid Issue forms). The factory uses
|
|
49
|
+
// the local `isXChainBridge` helper for the structural shape
|
|
50
|
+
// (see validation/helpers.ts lines 168–177) and additionally
|
|
51
|
+
// verifies the door strings are valid XRPL accounts.
|
|
52
|
+
require(props.XChainBridge, 'XChainModifyBridge: XChainBridge is required and must have shape {LockingChainDoor, LockingChainIssue, IssuingChainDoor, IssuingChainIssue}', isXChainBridge);
|
|
53
|
+
assertValidXChainBridge(props.XChainBridge);
|
|
54
|
+
// ── Account must equal LockingChainDoor (locking-chain submission).
|
|
55
|
+
// xrpl.org line 15: "This transaction must be sent by the door
|
|
56
|
+
// account." The example JSON shows `Account === LockingChainDoor`.
|
|
57
|
+
if (props.Account !== props.XChainBridge.LockingChainDoor) {
|
|
58
|
+
throw new ValidationError('XChainModifyBridge: Account must equal XChainBridge.LockingChainDoor (transaction must be submitted by the locking-chain door account)');
|
|
59
|
+
}
|
|
60
|
+
// ── SignatureReward ── required, non-negative XRP drops string.
|
|
61
|
+
if (!isNonNegativeXrpAmount(props.SignatureReward)) {
|
|
62
|
+
throw new ValidationError('XChainModifyBridge: SignatureReward must be a non-negative XRP drops string (in XRP, ≥ 0; XLS-38 §2.1.1.1.3 line 200)');
|
|
63
|
+
}
|
|
64
|
+
// ── MinAccountCreateAmount ── optional. When present, must be a
|
|
65
|
+
// non-negative XRP drops string. The spec limits this field to
|
|
66
|
+
// XRP-XRP bridges (xrpl.org line 48 / XLS-38 §2.1.1.1.4 line 204).
|
|
67
|
+
// We do not detect IOU-IOU bridges here; the IOU form of the
|
|
68
|
+
// amount is rejected by the XRP-drops format check.
|
|
69
|
+
if (props.MinAccountCreateAmount !== undefined) {
|
|
70
|
+
if (!isNonNegativeXrpAmount(props.MinAccountCreateAmount)) {
|
|
71
|
+
throw new ValidationError('XChainModifyBridge: MinAccountCreateAmount must be a non-negative XRP drops string (in XRP, ≥ 0; XRP-XRP bridges only — xrpl.org line 48)');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// ── Flags ── optional. We accept both numeric and boolean-map
|
|
75
|
+
// forms. The factory stores the original form (numeric or object)
|
|
76
|
+
// so `.with({ Flags: { tfClearAccountCreateAmount: true } })`
|
|
77
|
+
// round-trips verbatim. We do NOT enforce a specific value or
|
|
78
|
+
// require the field (parity with sibling factories such as
|
|
79
|
+
// `nftokenMint` and `vaultCreate`). Note: XLS-38 §2.2.2.1 marks
|
|
80
|
+
// Flags as required; we keep it optional here for parity with
|
|
81
|
+
// the rest of the fp codebase — see Spec Ambiguities #3.
|
|
82
|
+
return buildFrozenTx('XChainModifyBridge', props, {
|
|
83
|
+
validate() {
|
|
84
|
+
// Validated at construction.
|
|
85
|
+
},
|
|
86
|
+
toJSON() {
|
|
87
|
+
const json = {};
|
|
88
|
+
for (const k of Object.keys(this)) {
|
|
89
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
90
|
+
continue;
|
|
91
|
+
const v = this[k];
|
|
92
|
+
if (v !== undefined)
|
|
93
|
+
json[k] = v;
|
|
94
|
+
}
|
|
95
|
+
return json;
|
|
96
|
+
},
|
|
97
|
+
with(overrides) {
|
|
98
|
+
return xchainModifyBridge(mergeForWith(this, overrides));
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=xchain-modify-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xchain-modify-bridge.js","sourceRoot":"","sources":["../../../src/fp/factories/xchain-modify-bridge.ts"],"names":[],"mappings":"AA8JA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,wEAAwE;AAExE,MAAM,eAAe,GAAG,WAAW,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,SAAS,sBAAsB,CAAC,KAAc;IAC5C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5D,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAS,uBAAuB,CAAC,MAAoB;IACnD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,eAAe,CACvB,wFAAwF,CACzF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,eAAe,CACvB,wFAAwF,CACzF,CAAC;IACJ,CAAC;AACH,CAAC;AA6CD,wEAAwE;AAExE,MAAM,UAAU,kBAAkB,CAChC,KAA8B;IAE9B,qEAAqE;IACrE,OAAO,CACL,KAAK,CAAC,OAAO,EACb,yCAAyC,EACzC,SAAS,CACV,CAAC;IAEF,oEAAoE;IACpE,qEAAqE;IACrE,gEAAgE;IAChE,gEAAgE;IAChE,wDAAwD;IACxD,OAAO,CACL,KAAK,CAAC,YAAY,EAClB,6IAA6I,EAC7I,cAAc,CACf,CAAC;IACF,uBAAuB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE5C,qEAAqE;IACrE,kEAAkE;IAClE,sEAAsE;IACtE,IAAI,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC;QAC1D,MAAM,IAAI,eAAe,CACvB,wIAAwI,CACzI,CAAC;IACJ,CAAC;IAED,iEAAiE;IACjE,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,eAAe,CACvB,uHAAuH,CACxH,CAAC;IACJ,CAAC;IAED,iEAAiE;IACjE,kEAAkE;IAClE,sEAAsE;IACtE,gEAAgE;IAChE,uDAAuD;IACvD,IAAI,KAAK,CAAC,sBAAsB,KAAK,SAAS,EAAE,CAAC;QAC/C,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,sBAAsB,CAAC,EAAE,CAAC;YAC1D,MAAM,IAAI,eAAe,CACvB,2IAA2I,CAC5I,CAAC;QACJ,CAAC;IACH,CAAC;IAED,+DAA+D;IAC/D,qEAAqE;IACrE,iEAAiE;IACjE,iEAAiE;IACjE,8DAA8D;IAC9D,mEAAmE;IACnE,iEAAiE;IACjE,4DAA4D;IAE5D,OAAO,aAAa,CAClB,oBAAoB,EACpB,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,CAEF,SAA2C;YAE3C,OAAO,kBAAkB,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAC3D,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|