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,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functional XChainAccountCreateCommit factory — frozen-object style.
|
|
3
|
+
*
|
|
4
|
+
* Commits funds on the source chain to create a new account on the
|
|
5
|
+
* destination chain via a witness-attested bridge. Validation happens at
|
|
6
|
+
* construction; there is no way to construct an invalid tx.
|
|
7
|
+
*
|
|
8
|
+
* import { xchainAccountCreateCommit } from 'xrplt/fp';
|
|
9
|
+
* const tx = xchainAccountCreateCommit({
|
|
10
|
+
* Account,
|
|
11
|
+
* Amount: '20000000',
|
|
12
|
+
* SignatureReward: '100',
|
|
13
|
+
* Destination: 'rD323VyRjgzzhY4bFpo44rmyh2neB5d8Mo',
|
|
14
|
+
* XChainBridge: {
|
|
15
|
+
* LockingChainDoor: 'rMAXACCrp3Y8PpswXcg3bKggHX76V3F8M4',
|
|
16
|
+
* LockingChainIssue: { currency: 'XRP' },
|
|
17
|
+
* IssuingChainDoor: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh',
|
|
18
|
+
* IssuingChainIssue: { currency: 'XRP' },
|
|
19
|
+
* },
|
|
20
|
+
* });
|
|
21
|
+
* const j = tx.toJSON();
|
|
22
|
+
*
|
|
23
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/xchainaccountcreatecommit
|
|
24
|
+
* @see https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/XChainAccountCreateCommit.ts
|
|
25
|
+
* @see XLS-0038 (Cross-Chain Bridge) §2.4.1
|
|
26
|
+
* (`~/.mavis/docs.local/xrpl-standards/repo/XLS-0038-cross-chain-bridge/README.md`
|
|
27
|
+
* lines 565–606)
|
|
28
|
+
*
|
|
29
|
+
* Affected amendments:
|
|
30
|
+
* - `XChainBridge` — required for the transaction to be accepted.
|
|
31
|
+
*
|
|
32
|
+
* ## Divergences
|
|
33
|
+
*
|
|
34
|
+
* Compared with `src/transactions/xchain-account-create-commit.ts`,
|
|
35
|
+
* this factory adds guards the class skips (or that xrpl.js / xrpl.org
|
|
36
|
+
* / XLS-38 mandate but the class omits):
|
|
37
|
+
*
|
|
38
|
+
* - **`Account` must be a valid XRPL classic or X-address.** The class
|
|
39
|
+
* accepts any non-empty string — only the base transaction
|
|
40
|
+
* `super.validate()` is invoked. xrpl.js's
|
|
41
|
+
* `validateBaseTransaction` (which `validateXChainAccountCreateCommit`
|
|
42
|
+
* delegates to) enforces a valid classic address; we mirror that at
|
|
43
|
+
* construction.
|
|
44
|
+
* - Source: xrpl.js
|
|
45
|
+
* `~/.mavis/docs.local/xrpl.js/repo/packages/xrpl/src/models/transactions/common.ts`
|
|
46
|
+
* `validateBaseTransaction`.
|
|
47
|
+
* - Cross-ref: rippled `XChainAccountCreateCommit.cpp` parses
|
|
48
|
+
* `Account` as `STAccount`; only valid XRPL classic addresses parse.
|
|
49
|
+
*
|
|
50
|
+
* - **`Destination` must be a valid XRPL classic or X-address.**
|
|
51
|
+
* xrpl.js `validateXChainAccountCreateCommit` (line 66) calls
|
|
52
|
+
* `validateRequiredField(tx, 'Destination', isAccount)`. The class
|
|
53
|
+
* does not validate `Destination` at all (no `validate()` check, just
|
|
54
|
+
* `declare readonly Destination`).
|
|
55
|
+
* - Source: xrpl.js `XChainAccountCreateCommit.ts` line 66
|
|
56
|
+
* (`isAccount`).
|
|
57
|
+
* - Source: xrpl.org `xchainaccountcreatecommit.md` line 48
|
|
58
|
+
* (`AccountID` internal type).
|
|
59
|
+
* - Cross-ref: rippled parses `Destination` as `STAccount`; only
|
|
60
|
+
* valid XRPL classic addresses parse. XLS-38 §2.4.1.1.4 line 604
|
|
61
|
+
* defines `Destination` as `ACCOUNT`.
|
|
62
|
+
*
|
|
63
|
+
* - **`XChainBridge` is fully shape-validated.** xrpl.js's
|
|
64
|
+
* `validateXChainAccountCreateCommit` (line 62) calls
|
|
65
|
+
* `validateRequiredField(tx, 'XChainBridge', isXChainBridge)`, which
|
|
66
|
+
* requires exactly 4 keys, two `AccountID` door strings, and two
|
|
67
|
+
* `Issue` currency objects (`{currency: 'XRP'}` or
|
|
68
|
+
* `{currency, issuer}`). Our class only verifies `isRecord`, which
|
|
69
|
+
* accepts any object (including `{}` or `{foo: 'bar'}`). The factory
|
|
70
|
+
* uses the local `isXChainBridge` helper to enforce the full shape.
|
|
71
|
+
* - Source: xrpl.js `common.ts` `isXChainBridge` (lines 444–453);
|
|
72
|
+
* `isIssuedCurrency` (lines 282–291).
|
|
73
|
+
* - Source: XLS-38 §2.1.1.1.2 lines 175–180 (`XChainBridge`
|
|
74
|
+
* `XCHAIN_BRIDGE` internal type; `LockingChainDoor`,
|
|
75
|
+
* `LockingChainIssue`, `IssuingChainDoor`, `IssuingChainIssue`
|
|
76
|
+
* all required).
|
|
77
|
+
* - Cross-ref: our `src/validation/helpers.ts` `isXChainBridge`
|
|
78
|
+
* (lines 168–177) mirrors the xrpl.js check.
|
|
79
|
+
*
|
|
80
|
+
* - **Both `XChainBridge` doors must be valid XRPL classic
|
|
81
|
+
* X addresses.** `isXChainBridge` only checks that the door strings are
|
|
82
|
+
* strings; rippled parses them as `STAccount`. The factory additionally
|
|
83
|
+
* runs `isAccount` on each door so a malformed door string is caught
|
|
84
|
+
* at construction.
|
|
85
|
+
* - Source: rippled `XChainAccountCreateCommit.cpp` (`sfLockingChainDoor`,
|
|
86
|
+
* `sfIssuingChainDoor` parsed as `STAccount`).
|
|
87
|
+
* - Cross-ref: XLS-38 §2.1.1.1.2 line 177 (`LockingChainDoor` is
|
|
88
|
+
* `ACCOUNT`); line 179 (`IssuingChainDoor` is `ACCOUNT`).
|
|
89
|
+
*
|
|
90
|
+
* - **`Amount` must be a strictly-positive XRP drops string.** xrpl.org
|
|
91
|
+
* `xchainaccountcreatecommit.md` line 47 states: "The amount, **in
|
|
92
|
+
* XRP**, to use for account creation." XLS-38 §2.4.1.1.3 line 600
|
|
93
|
+
* repeats "The amount, in XRP, to use for account creation." The
|
|
94
|
+
* transaction is "for XRP-XRP bridges only" per XLS-38 §2.4.1 line
|
|
95
|
+
* 571 ("This transaction can only be used for XRP-XRP bridges").
|
|
96
|
+
* The class and xrpl.js both accept any `Amount` form (IOU object,
|
|
97
|
+
* MPT object, or XRP string); for an XRP-XRP-only transaction this
|
|
98
|
+
* is too permissive — an IOU/MPT `Amount` would be rejected on-ledger
|
|
99
|
+
* as `temBAD_AMOUNT`. The factory enforces XRP-only (drops string)
|
|
100
|
+
* AND `> 0` (must exceed `MinAccountCreateAmount`, which is itself
|
|
101
|
+
* positive).
|
|
102
|
+
* - Source: xrpl.org `xchainaccountcreatecommit.md` line 47 ("in
|
|
103
|
+
* XRP").
|
|
104
|
+
* - Source: XLS-38 §2.4.1 line 571 ("XRP-XRP bridges only").
|
|
105
|
+
* - Source: XLS-38 §2.4.1.1.3 line 602 (Amount in XRP).
|
|
106
|
+
* - Cross-ref: rippled `XChainAccountCreateCommit.cpp` parses
|
|
107
|
+
* `Amount` as `STAmount` with XRP constraint; non-XRP amounts
|
|
108
|
+
* fail preclaim.
|
|
109
|
+
*
|
|
110
|
+
* - **`SignatureReward` must be a non-negative XRP drops string.**
|
|
111
|
+
* xrpl.org line 49: "The amount, **in XRP**, to be used to reward
|
|
112
|
+
* the witness servers for providing signatures." XLS-38 §2.4.1.1.2
|
|
113
|
+
* line 592 repeats it. As with `Amount`, the class and xrpl.js accept
|
|
114
|
+
* any `Amount` form; for an XRP-XRP-only bridge, IOU/MPT forms are
|
|
115
|
+
* out-of-spec. The factory enforces XRP-only (drops string) with
|
|
116
|
+
* `≥ 0` (zero is permitted; the value must match the bridge's
|
|
117
|
+
* `SignatureReward`, which may legitimately be zero if the bridge
|
|
118
|
+
* chooses to pay no witnesses).
|
|
119
|
+
* - Source: xrpl.org `xchainaccountcreatecommit.md` line 49 ("in
|
|
120
|
+
* XRP").
|
|
121
|
+
* - Source: XLS-38 §2.4.1.1.2 line 592 (SignatureReward in XRP).
|
|
122
|
+
* - Cross-ref: rippled `XChainAccountCreateCommit.cpp` parses
|
|
123
|
+
* `SignatureReward` as `STAmount` with XRP constraint.
|
|
124
|
+
*
|
|
125
|
+
* - **`Amount` does NOT include the `Signers` array.** rippled's
|
|
126
|
+
* `XChainAccountCreateCommit` does not accept a `Signers` field
|
|
127
|
+
* (witness attestations arrive via separate `XChainAddAccountCreateAttestation`
|
|
128
|
+
* transactions, not as part of this tx). The class API does not
|
|
129
|
+
* declare `Signers`, but this is documented here to flag the
|
|
130
|
+
* apparent confusion in the task brief, which described
|
|
131
|
+
* `OtherChainDestination` as an optional field on this transaction.
|
|
132
|
+
* `OtherChainDestination` is a field on `XChainCommit` (XLS-38
|
|
133
|
+
* §2.3.2.1.4 line 422), NOT on `XChainAccountCreateCommit`. The
|
|
134
|
+
* factory correctly omits both fields.
|
|
135
|
+
* - Source: XLS-38 §2.4.1.1 fields table (lines 581–586); no
|
|
136
|
+
* `OtherChainDestination` row.
|
|
137
|
+
* - Source: XLS-38 §2.3.2.1.4 line 422 (`OtherChainDestination` is
|
|
138
|
+
* a `XChainCommit` field).
|
|
139
|
+
*
|
|
140
|
+
* - **`Flags` accepted for parity with the base transaction shape.**
|
|
141
|
+
* XChainAccountCreateCommit itself defines no transaction-specific
|
|
142
|
+
* flags; only `tfFullyCanonicalSig` (global) is normally meaningful.
|
|
143
|
+
* The class does not declare a `Flags` field. We accept a numeric
|
|
144
|
+
* bitmask for parity with `loan-set.ts` / `payment-channel-create.ts`.
|
|
145
|
+
* This is a permissive addition, not a tightening; callers who pass
|
|
146
|
+
* a non-zero Flags get the value stored verbatim. (Divergence
|
|
147
|
+
* documented for awareness; no spec source requires flag rejection
|
|
148
|
+
* for XChainAccountCreateCommit.)
|
|
149
|
+
*/
|
|
150
|
+
import type { XChainBridge } from '../../types/common.js';
|
|
151
|
+
export interface XchainAccountCreateCommitProps {
|
|
152
|
+
/** The unique address of the transaction sender (the source-chain
|
|
153
|
+
* account that pays `Amount + SignatureReward`). */
|
|
154
|
+
Account: string;
|
|
155
|
+
/** The bridge to create accounts for. */
|
|
156
|
+
XChainBridge: XChainBridge;
|
|
157
|
+
/** The amount, in XRP, to use for account creation on the destination
|
|
158
|
+
* chain. Strictly positive (> 0). */
|
|
159
|
+
Amount: string;
|
|
160
|
+
/** The amount, in XRP, to be used to reward the witness servers for
|
|
161
|
+
* providing signatures. Must match the bridge's `SignatureReward`.
|
|
162
|
+
* Non-negative (≥ 0). */
|
|
163
|
+
SignatureReward: string;
|
|
164
|
+
/** The destination account on the destination chain. */
|
|
165
|
+
Destination: string;
|
|
166
|
+
/** Bit-flags for this transaction. XChainAccountCreateCommit has no
|
|
167
|
+
* defined flags; only `tfFullyCanonicalSig` (global) is meaningful.
|
|
168
|
+
* Accepted for parity with the base tx shape. */
|
|
169
|
+
Flags?: number | undefined;
|
|
170
|
+
Fee?: string | undefined;
|
|
171
|
+
Sequence?: number | undefined;
|
|
172
|
+
}
|
|
173
|
+
export interface XchainAccountCreateCommit extends Readonly<XchainAccountCreateCommitProps> {
|
|
174
|
+
readonly TransactionType: 'XChainAccountCreateCommit';
|
|
175
|
+
validate(): void;
|
|
176
|
+
toJSON(): Record<string, unknown>;
|
|
177
|
+
with(overrides: Partial<XchainAccountCreateCommitProps>): XchainAccountCreateCommit;
|
|
178
|
+
}
|
|
179
|
+
export declare function xchainAccountCreateCommit(props: XchainAccountCreateCommitProps): XchainAccountCreateCommit;
|
|
180
|
+
//# sourceMappingURL=xchain-account-create-commit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xchain-account-create-commit.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/xchain-account-create-commit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoJG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA8D1D,MAAM,WAAW,8BAA8B;IAC7C;yDACqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,YAAY,EAAE,YAAY,CAAC;IAC3B;0CACsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf;;8BAE0B;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB;;sDAEkD;IAClD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,yBACf,SAAQ,QAAQ,CAAC,8BAA8B,CAAC;IAChD,QAAQ,CAAC,eAAe,EAAE,2BAA2B,CAAC;IACtD,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CACF,SAAS,EAAE,OAAO,CAAC,8BAA8B,CAAC,GACjD,yBAAyB,CAAC;CAC9B;AAID,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,8BAA8B,GACpC,yBAAyB,CAoE3B"}
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
// XRPL UInt64 max (4-byte unsigned). Used for non-negative integer
|
|
6
|
+
// validation helpers in the future; not directly needed here since
|
|
7
|
+
// XRP drops strings are decimal.
|
|
8
|
+
const XRP_DROPS_REGEX = /^[0-9]+$/u;
|
|
9
|
+
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
10
|
+
/**
|
|
11
|
+
* Strictly-positive XRP drops Amount. Accepts canonical XRP drops
|
|
12
|
+
* mantissa form (decimal integer string with no exponent, no decimal
|
|
13
|
+
* point — the wire format used by Amount fields in XChainBridge-related
|
|
14
|
+
* transactions) and rejects zero, negative, and non-numeric values.
|
|
15
|
+
*/
|
|
16
|
+
function isStrictlyPositiveXrpAmount(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 value !== '0';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Non-negative XRP drops Amount. Same as the strictly-positive variant
|
|
29
|
+
* but allows '0'. Used for SignatureReward.
|
|
30
|
+
*/
|
|
31
|
+
function isNonNegativeXrpAmount(value) {
|
|
32
|
+
if (!isString(value))
|
|
33
|
+
return false;
|
|
34
|
+
if (!XRP_DROPS_REGEX.test(value))
|
|
35
|
+
return false;
|
|
36
|
+
if (value.length > 1 && value.startsWith('0'))
|
|
37
|
+
return false;
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Validate XChainBridge object shape: 4 keys with both doors as valid
|
|
42
|
+
* XRPL classic/X addresses and both issues as valid Issue forms (XRP
|
|
43
|
+
* or IOU). The local `isXChainBridge` helper checks the structural
|
|
44
|
+
* 4-key + Issue shape; we add XRPL-account format validation on the
|
|
45
|
+
* two doors.
|
|
46
|
+
*/
|
|
47
|
+
function assertValidXChainBridge(bridge) {
|
|
48
|
+
if (!isAccount(bridge.LockingChainDoor)) {
|
|
49
|
+
throw new ValidationError('XChainAccountCreateCommit: XChainBridge.LockingChainDoor must be a valid XRPL account address');
|
|
50
|
+
}
|
|
51
|
+
if (!isAccount(bridge.IssuingChainDoor)) {
|
|
52
|
+
throw new ValidationError('XChainAccountCreateCommit: XChainBridge.IssuingChainDoor must be a valid XRPL account address');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
56
|
+
export function xchainAccountCreateCommit(props) {
|
|
57
|
+
// ── Account ── required, must be a valid XRPL classic or X-address.
|
|
58
|
+
require(props.Account, 'XChainAccountCreateCommit: Account is required', isAccount);
|
|
59
|
+
// ── XChainBridge ── required, full shape (4 keys, both doors valid
|
|
60
|
+
// XRPL accounts, both issues valid Issue forms). The factory
|
|
61
|
+
// uses the local `isXChainBridge` helper for the structural
|
|
62
|
+
// shape (see validation/helpers.ts lines 168–177) and additionally
|
|
63
|
+
// verifies the door strings are valid XRPL accounts.
|
|
64
|
+
require(props.XChainBridge, 'XChainAccountCreateCommit: XChainBridge is required and must have shape {LockingChainDoor, LockingChainIssue, IssuingChainDoor, IssuingChainIssue}', isXChainBridge);
|
|
65
|
+
// Now `props.XChainBridge` is type-narrowed to XChainBridge — verify
|
|
66
|
+
// the doors are valid XRPL accounts (the helper only checks
|
|
67
|
+
// `typeof === 'string'`).
|
|
68
|
+
assertValidXChainBridge(props.XChainBridge);
|
|
69
|
+
// ── Amount ── required, strictly-positive XRP drops string.
|
|
70
|
+
if (!isStrictlyPositiveXrpAmount(props.Amount)) {
|
|
71
|
+
throw new ValidationError('XChainAccountCreateCommit: Amount must be a strictly-positive XRP drops string (in XRP, > 0; XLS-38 §2.4.1: XRP-XRP bridges only)');
|
|
72
|
+
}
|
|
73
|
+
// ── SignatureReward ── required, non-negative XRP drops string.
|
|
74
|
+
if (!isNonNegativeXrpAmount(props.SignatureReward)) {
|
|
75
|
+
throw new ValidationError('XChainAccountCreateCommit: SignatureReward must be a non-negative XRP drops string (in XRP, ≥ 0)');
|
|
76
|
+
}
|
|
77
|
+
// ── Destination ── required, must be a valid XRPL account.
|
|
78
|
+
require(props.Destination, 'XChainAccountCreateCommit: Destination is required', isAccount);
|
|
79
|
+
return buildFrozenTx('XChainAccountCreateCommit', props, {
|
|
80
|
+
validate() {
|
|
81
|
+
// Validated at construction.
|
|
82
|
+
},
|
|
83
|
+
toJSON() {
|
|
84
|
+
const json = {};
|
|
85
|
+
for (const k of Object.keys(this)) {
|
|
86
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
87
|
+
continue;
|
|
88
|
+
const v = this[k];
|
|
89
|
+
if (v !== undefined)
|
|
90
|
+
json[k] = v;
|
|
91
|
+
}
|
|
92
|
+
return json;
|
|
93
|
+
},
|
|
94
|
+
with(overrides) {
|
|
95
|
+
return xchainAccountCreateCommit(mergeForWith(this, overrides));
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=xchain-account-create-commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xchain-account-create-commit.js","sourceRoot":"","sources":["../../../src/fp/factories/xchain-account-create-commit.ts"],"names":[],"mappings":"AAsJA,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,mEAAmE;AACnE,mEAAmE;AACnE,iCAAiC;AACjC,MAAM,eAAe,GAAG,WAAW,CAAC;AAEpC,wEAAwE;AAExE;;;;;GAKG;AACH,SAAS,2BAA2B,CAAC,KAAc;IACjD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC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server attestation that an `XChainAccountCreateCommit`
|
|
6
|
+
* transaction occurred on the source chain. The witness signs a message
|
|
7
|
+
* that names the destination chain account, the source chain account
|
|
8
|
+
* (`OtherChainSource`), the amount, and which side of the bridge
|
|
9
|
+
* the commit happened on (`WasLockingChainSend`).
|
|
10
|
+
*
|
|
11
|
+
* import { xchainAddAccountCreateAttestation } from 'xrplt/fp';
|
|
12
|
+
* const tx = xchainAddAccountCreateAttestation({
|
|
13
|
+
* Account: 'rDr5okqGKmMpn44Bbhe5WAfDQx8e9XquEv',
|
|
14
|
+
* OtherChainSource: 'rUzB7yg1LcFa7m3q1hfrjr5w53vcWzNh3U',
|
|
15
|
+
* Destination: 'rJMfWNVbyjcCtds8kpoEjEbYQ41J5B6MUd',
|
|
16
|
+
* Amount: '2000000000',
|
|
17
|
+
* SignatureReward: '204',
|
|
18
|
+
* PublicKey: 'EDF7C3F9C80C102AF6D241752B37356E91ED454F26A35C567CF6F8477960F66614',
|
|
19
|
+
* Signature: 'F95675BA...',
|
|
20
|
+
* WasLockingChainSend: 1,
|
|
21
|
+
* AttestationRewardAccount: 'rpFp36UHW6FpEcZjZqq5jSJWY6UCj3k4Es',
|
|
22
|
+
* AttestationSignerAccount: 'rpWLegmW9WrFBzHUj7brhQNZzrxgLj9oxw',
|
|
23
|
+
* XChainAccountCreateCount: '2',
|
|
24
|
+
* XChainBridge: { ... },
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* Required amendment: `XChainBridge`.
|
|
28
|
+
*
|
|
29
|
+
* @see https://xrpl.org/docs/references/protocol/transactions/types/xchainaddaccountcreateattestation
|
|
30
|
+
* @see xrpl.js `packages/xrpl/src/models/transactions/XChainAddAccountCreateAttestation.ts`
|
|
31
|
+
* (`validateXChainAddAccountCreateAttestation` — source of every
|
|
32
|
+
* required-field check below).
|
|
33
|
+
* @see XLS-0038 §2.4.2 — "The `XChainAddAccountCreateAttestation`
|
|
34
|
+
* transaction"
|
|
35
|
+
* `~/.mavis/docs.local/xrpl-standards/repo/XLS-0038-cross-chain-bridge/README.md`
|
|
36
|
+
* lines 608–683 (Fields table at lines 622–634).
|
|
37
|
+
*
|
|
38
|
+
* ## Divergences
|
|
39
|
+
*
|
|
40
|
+
* The factory implements the canonical XLS-0038 §2.4.2 field set,
|
|
41
|
+
* which is a strict superset of what the class API at
|
|
42
|
+
* `src/transactions/xchain-add-account-create-attestation.ts` exposes.
|
|
43
|
+
* The class is missing four required fields (`AttestationSignerAccount`,
|
|
44
|
+
* `OtherChainSource`, `SignatureReward`, plus `XChainAccountCreateCount`
|
|
45
|
+
* typed as `number` only). It also uses a generic `isRecord` for
|
|
46
|
+
* `XChainBridge` instead of the full 4-key structural check, and types
|
|
47
|
+
* `WasLockingChainSend` as the loose `number` instead of the literal
|
|
48
|
+
* `0 | 1`. Concretely:
|
|
49
|
+
*
|
|
50
|
+
* 1. **Validation is eager, not lazy.** The class's `validate()`
|
|
51
|
+
* only checks `XChainBridge isRecord` and `XChainAccountCreateCount
|
|
52
|
+
* isNumber` (`src/transactions/xchain-add-account-create-attestation.ts:
|
|
53
|
+
* 44-52`). The factory mirrors the full xrpl.js guard sequence
|
|
54
|
+
* (`XChainAddAccountCreateAttestation.ts:89-123`) at construction
|
|
55
|
+
* time so an invalid tx is impossible to construct.
|
|
56
|
+
*
|
|
57
|
+
* 2. **`AttestationSignerAccount` is modelled (XLS-38 §2.4.2.1.3).**
|
|
58
|
+
* The class does not declare this field. xrpl.js requires
|
|
59
|
+
* `validateRequiredField(tx, 'AttestationSignerAccount', isAccount)`
|
|
60
|
+
* (`XChainAddAccountCreateAttestation.ts:98`); XRPL.org marks it
|
|
61
|
+
* as required (`xchainaddaccountcreateattestation.md:60`); XLS-38
|
|
62
|
+
* §2.4.2.1.3 (line 626 + 644) describes it as "the account on the
|
|
63
|
+
* door account's signer list that is signing the transaction."
|
|
64
|
+
* The factory requires it as a valid XRPL account.
|
|
65
|
+
* Source: xrpl.js `XChainAddAccountCreateAttestation.ts:98`;
|
|
66
|
+
* XRPL.org `xchainaddaccountcreateattestation.md:60`;
|
|
67
|
+
* XLS-38 §2.4.2.1.3 (line 644).
|
|
68
|
+
*
|
|
69
|
+
* 3. **`OtherChainSource` is modelled (XLS-38 §2.4.2.1.5).** The
|
|
70
|
+
* class does not declare this field. xrpl.js requires
|
|
71
|
+
* `validateRequiredField(tx, 'OtherChainSource', isAccount)`
|
|
72
|
+
* (`XChainAddAccountCreateAttestation.ts:102`); XRPL.org marks it
|
|
73
|
+
* as required (`xchainaddaccountcreateattestation.md:62`); XLS-38
|
|
74
|
+
* §2.4.2.1.5 (line 652) defines it as "the account on the source
|
|
75
|
+
* chain that submitted the XChainAccountCreateCommit transaction."
|
|
76
|
+
* The factory requires it as a valid XRPL account.
|
|
77
|
+
* Source: xrpl.js `XChainAddAccountCreateAttestation.ts:102`;
|
|
78
|
+
* XRPL.org `xchainaddaccountcreateattestation.md:62`;
|
|
79
|
+
* XLS-38 §2.4.2.1.5 (line 652).
|
|
80
|
+
*
|
|
81
|
+
* 4. **`SignatureReward` is modelled (XLS-38 §2.4.2.1.8).** The
|
|
82
|
+
* class does not declare this field. xrpl.js requires
|
|
83
|
+
* `validateRequiredField(tx, 'SignatureReward', isAmount)`
|
|
84
|
+
* (`XChainAddAccountCreateAttestation.ts:108`); XRPL.org marks it
|
|
85
|
+
* as required (`xchainaddaccountcreateattestation.md:65`); XLS-38
|
|
86
|
+
* §2.4.2.1.8 (line 664) defines it as "the signature reward paid
|
|
87
|
+
* in the XChainAccountCreateCommit transaction." The factory
|
|
88
|
+
* requires it via `isAmount` (XRP drops string, IOU object, or
|
|
89
|
+
* MPT object — whichever matches the bridge asset).
|
|
90
|
+
* Source: xrpl.js `XChainAddAccountCreateAttestation.ts:108`;
|
|
91
|
+
* XRPL.org `xchainaddaccountcreateattestation.md:65`;
|
|
92
|
+
* XLS-38 §2.4.2.1.8 (line 664).
|
|
93
|
+
*
|
|
94
|
+
* 5. **`XChainAccountCreateCount` accepts number OR string.**
|
|
95
|
+
* The class types the field as `number` only and accepts any
|
|
96
|
+
* `isNumber`. xrpl.js types it as `number | string`
|
|
97
|
+
* (`XChainAddAccountCreateAttestation.ts:75`) and validates with
|
|
98
|
+
* `isNumber(inp) || isString(inp)` (line 119). XRPL.org marks it
|
|
99
|
+
* `String / UInt64` internal type (`xchainaddaccountcreateattestation.md:67`).
|
|
100
|
+
* The wire format encodes UInt64 as a decimal string; callers
|
|
101
|
+
* frequently pass it as a string. The factory accepts either.
|
|
102
|
+
* Source: xrpl.js `XChainAddAccountCreateAttestation.ts:75,119`;
|
|
103
|
+
* XRPL.org `xchainaddaccountcreateattestation.md:67`.
|
|
104
|
+
*
|
|
105
|
+
* 6. **`WasLockingChainSend` is the literal `0 | 1` union.**
|
|
106
|
+
* The class types it as loose `number`; the factory types it as
|
|
107
|
+
* `0 | 1` to match the xrpl.js interface and the XRPL.org field
|
|
108
|
+
* table ("Number / UInt8", `xchainaddaccountcreateattestation.md:66`).
|
|
109
|
+
* Anything other than `0` or `1` is rejected. xrpl.js's
|
|
110
|
+
* validator literal `(inp): inp is 0 | 1 => inp === 0 || inp === 1`
|
|
111
|
+
* (`XChainAddAccountCreateAttestation.ts:113`) is mirrored.
|
|
112
|
+
* Source: xrpl.js `XChainAddAccountCreateAttestation.ts:70,113`;
|
|
113
|
+
* XRPL.org `xchainaddaccountcreateattestation.md:66`.
|
|
114
|
+
*
|
|
115
|
+
* 7. **`XChainBridge` is fully shape-validated.** The class only
|
|
116
|
+
* checks `isRecord` (`src/transactions/xchain-add-account-create-attestation.ts:46`),
|
|
117
|
+
* which accepts any object including `{}`. The factory uses the
|
|
118
|
+
* local `isXChainBridge` helper (4 keys, both Issues valid
|
|
119
|
+
* currency objects, both doors as strings) AND verifies each
|
|
120
|
+
* door is a valid XRPL account (mirrors
|
|
121
|
+
* `xchain-account-create-commit.ts` Divergences #3-#4, applies to
|
|
122
|
+
* all bridge-bearing transactions).
|
|
123
|
+
* Source: xrpl.js `common.ts` `isXChainBridge` (lines 168–177 in
|
|
124
|
+
* our `validation/helpers.ts`).
|
|
125
|
+
*
|
|
126
|
+
* 8. **`Account`, `Destination`, `AttestationRewardAccount`, and
|
|
127
|
+
* `AttestationSignerAccount` are validated as valid XRPL classic
|
|
128
|
+
* or X-addresses.** The class delegates `Account` to the base
|
|
129
|
+
* class (which only requires `typeof === 'string'`) and does
|
|
130
|
+
* not validate the other three account fields at all. The
|
|
131
|
+
* factory uses `isAccount` for all four, matching the rest of
|
|
132
|
+
* the M4 fp family and xrpl.js
|
|
133
|
+
* `validateXChainAddAccountCreateAttestation`.
|
|
134
|
+
*
|
|
135
|
+
* 9. **`PublicKey` and `Signature` must be non-empty hex Blobs.**
|
|
136
|
+
* xrpl.js only checks `isString`
|
|
137
|
+
* (`XChainAddAccountCreateAttestation.ts:104,106`); XRPL.org
|
|
138
|
+
* marks both as `String / Blob` internal type
|
|
139
|
+
* (`xchainaddaccountcreateattestation.md:63-64`). The factory
|
|
140
|
+
* enforces a non-empty, even-length hex string so malformed
|
|
141
|
+
* blobs surface at construction rather than at the binary
|
|
142
|
+
* codec layer. Note: per XLS-38 §2.4.2.1.6 (line 656),
|
|
143
|
+
* `PublicKey` is conventionally a 33-byte compressed secp256k1
|
|
144
|
+
* key (66 hex chars), but the wire format accepts any Blob so
|
|
145
|
+
* we do NOT cap the length — the witness-server pubkey length
|
|
146
|
+
* is a network convention, not a tx-format rule.
|
|
147
|
+
* Source: XRPL.org `xchainaddaccountcreateattestation.md:63-64`.
|
|
148
|
+
*/
|
|
149
|
+
import type { XChainBridge } from '../../types/common.js';
|
|
150
|
+
export interface XchainAddAccountCreateAttestationProps {
|
|
151
|
+
/** The unique address of the transaction sender (the witness
|
|
152
|
+
* submitting this attestation). Required, valid XRPL address. */
|
|
153
|
+
Account: string;
|
|
154
|
+
/** The amount committed by the `XChainAccountCreateCommit`
|
|
155
|
+
* transaction on the source chain. Currency Amount — XRP drops
|
|
156
|
+
* string, IOU object, or MPT object. Required. */
|
|
157
|
+
Amount: string | Record<string, unknown>;
|
|
158
|
+
/** The account that should receive this signer's share of the
|
|
159
|
+
* `SignatureReward`. Required, valid XRPL address. */
|
|
160
|
+
AttestationRewardAccount: string;
|
|
161
|
+
/** The account on the door account's signer list that is signing
|
|
162
|
+
* the transaction. Required, valid XRPL address.
|
|
163
|
+
* Source: XLS-38 §2.4.2.1.3 (line 644). */
|
|
164
|
+
AttestationSignerAccount: string;
|
|
165
|
+
/** The destination account for the funds on the destination chain.
|
|
166
|
+
* Required, valid XRPL address. */
|
|
167
|
+
Destination: string;
|
|
168
|
+
/** The account on the source chain that submitted the
|
|
169
|
+
* `XChainAccountCreateCommit` transaction that triggered the
|
|
170
|
+
* event associated with the attestation. Required, valid XRPL
|
|
171
|
+
* address. Source: XLS-38 §2.4.2.1.5 (line 652). */
|
|
172
|
+
OtherChainSource: string;
|
|
173
|
+
/** The public key used to verify the signature. Hex Blob; by
|
|
174
|
+
* convention 33-byte compressed secp256k1 (66 hex chars).
|
|
175
|
+
* Required. */
|
|
176
|
+
PublicKey: string;
|
|
177
|
+
/** The signature attesting to the event on the other chain. Hex
|
|
178
|
+
* Blob. Required. */
|
|
179
|
+
Signature: string;
|
|
180
|
+
/** The signature reward paid in the `XChainAccountCreateCommit`
|
|
181
|
+
* transaction. Currency Amount. Required.
|
|
182
|
+
* Source: XLS-38 §2.4.2.1.8 (line 664). */
|
|
183
|
+
SignatureReward: string | Record<string, unknown>;
|
|
184
|
+
/** Boolean (encoded as UInt8): true (=1) if the event occurred on
|
|
185
|
+
* the locking chain (so `OtherChainSource` is on the locking
|
|
186
|
+
* chain); false (=0) if on the issuing chain. Required, must be
|
|
187
|
+
* exactly `0` or `1`. */
|
|
188
|
+
WasLockingChainSend: 0 | 1;
|
|
189
|
+
/** The counter that represents the order that the claims must be
|
|
190
|
+
* processed in. UInt64 — accepts number or decimal string.
|
|
191
|
+
* Required. */
|
|
192
|
+
XChainAccountCreateCount: number | string;
|
|
193
|
+
/** The bridge associated with the attestation. 4-key shape with
|
|
194
|
+
* both doors as valid XRPL accounts and both Issues as valid
|
|
195
|
+
* currency objects. Required. */
|
|
196
|
+
XChainBridge: XChainBridge;
|
|
197
|
+
/** Bit-flags for this transaction. XChainAddAccountCreateAttestation
|
|
198
|
+
* has no defined flags; only `tfFullyCanonicalSig` (global) is
|
|
199
|
+
* normally meaningful. Accepted for parity with the base tx shape. */
|
|
200
|
+
Flags?: number | undefined;
|
|
201
|
+
/** Fee in XRP (drops), base-10 integer string. */
|
|
202
|
+
Fee?: string | undefined;
|
|
203
|
+
/** Account sequence number. */
|
|
204
|
+
Sequence?: number | undefined;
|
|
205
|
+
}
|
|
206
|
+
export interface XchainAddAccountCreateAttestation extends Readonly<XchainAddAccountCreateAttestationProps> {
|
|
207
|
+
readonly TransactionType: 'XChainAddAccountCreateAttestation';
|
|
208
|
+
validate(): void;
|
|
209
|
+
toJSON(): Record<string, unknown>;
|
|
210
|
+
with(overrides: Partial<XchainAddAccountCreateAttestationProps>): XchainAddAccountCreateAttestation;
|
|
211
|
+
}
|
|
212
|
+
export declare function xchainAddAccountCreateAttestation(props: XchainAddAccountCreateAttestationProps): XchainAddAccountCreateAttestation;
|
|
213
|
+
//# sourceMappingURL=xchain-add-account-create-attestation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xchain-add-account-create-attestation.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/xchain-add-account-create-attestation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmJG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA8D1D,MAAM,WAAW,sCAAsC;IACrD;sEACkE;IAClE,OAAO,EAAE,MAAM,CAAC;IAE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mount, isHex, isNumber, isString, isXChainBridge, } from '../../validation/helpers.js';
|
|
2
|
+
import { ValidationError } from '../../errors.js';
|
|
3
|
+
import { buildFrozenTx, mergeForWith, require } from '../shape.js';
|
|
4
|
+
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
5
|
+
/**
|
|
6
|
+
* Validate a non-empty hex Blob per the XRPL.org field tables
|
|
7
|
+
* (`PublicKey` and `Signature`: `String / Blob` internal type). Even
|
|
8
|
+
* length is required for whole-byte serialisation.
|
|
9
|
+
*/
|
|
10
|
+
function validateBlob(value, field) {
|
|
11
|
+
if (!isString(value)) {
|
|
12
|
+
throw new ValidationError(`XChainAddAccountCreateAttestation: ${field} must be a hex string`);
|
|
13
|
+
}
|
|
14
|
+
if (value.length === 0) {
|
|
15
|
+
throw new ValidationError(`XChainAddAccountCreateAttestation: ${field} must not be an empty string`);
|
|
16
|
+
}
|
|
17
|
+
if (!isHex(value)) {
|
|
18
|
+
throw new ValidationError(`XChainAddAccountCreateAttestation: ${field} must be encoded in hex`);
|
|
19
|
+
}
|
|
20
|
+
if (value.length % 2 !== 0) {
|
|
21
|
+
throw new ValidationError(`XChainAddAccountCreateAttestation: ${field} must have an even number of hex characters (whole-byte Blob encoding)`);
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Verify both XChainBridge doors are valid XRPL account addresses
|
|
27
|
+
* (the local `isXChainBridge` helper only checks `typeof === 'string'`).
|
|
28
|
+
*/
|
|
29
|
+
function assertValidXChainBridge(bridge) {
|
|
30
|
+
if (!isAccount(bridge.LockingChainDoor)) {
|
|
31
|
+
throw new ValidationError('XChainAddAccountCreateAttestation: XChainBridge.LockingChainDoor must be a valid XRPL account address');
|
|
32
|
+
}
|
|
33
|
+
if (!isAccount(bridge.IssuingChainDoor)) {
|
|
34
|
+
throw new ValidationError('XChainAddAccountCreateAttestation: XChainBridge.IssuingChainDoor must be a valid XRPL account address');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// ─── Factory ─────────────────────────────────────────────────────────
|
|
38
|
+
export function xchainAddAccountCreateAttestation(props) {
|
|
39
|
+
// ── Account ── required, valid XRPL classic/X-address.
|
|
40
|
+
require(props.Account, 'XChainAddAccountCreateAttestation: missing or invalid Account', isAccount);
|
|
41
|
+
// ── Amount ── required, any Currency Amount form (XRP / IOU / MPT).
|
|
42
|
+
if (!isAmount(props.Amount)) {
|
|
43
|
+
throw new ValidationError('XChainAddAccountCreateAttestation: Amount must be a Currency Amount (XRP drops string, IOU object, or MPT object)');
|
|
44
|
+
}
|
|
45
|
+
// ── AttestationRewardAccount ── required, valid XRPL account.
|
|
46
|
+
require(props.AttestationRewardAccount, 'XChainAddAccountCreateAttestation: missing or invalid AttestationRewardAccount', isAccount);
|
|
47
|
+
// ── AttestationSignerAccount ── required, valid XRPL account.
|
|
48
|
+
// Class API does not declare this field at all.
|
|
49
|
+
require(props.AttestationSignerAccount, 'XChainAddAccountCreateAttestation: missing or invalid AttestationSignerAccount', isAccount);
|
|
50
|
+
// ── Destination ── required, valid XRPL account.
|
|
51
|
+
require(props.Destination, 'XChainAddAccountCreateAttestation: missing or invalid Destination', isAccount);
|
|
52
|
+
// ── OtherChainSource ── required, valid XRPL account.
|
|
53
|
+
// Class API does not declare this field at all.
|
|
54
|
+
require(props.OtherChainSource, 'XChainAddAccountCreateAttestation: missing or invalid OtherChainSource', isAccount);
|
|
55
|
+
// ── PublicKey ── required, non-empty even-length hex Blob.
|
|
56
|
+
validateBlob(props.PublicKey, 'PublicKey');
|
|
57
|
+
// ── Signature ── required, non-empty even-length hex Blob.
|
|
58
|
+
validateBlob(props.Signature, 'Signature');
|
|
59
|
+
// ── SignatureReward ── required, any Currency Amount form.
|
|
60
|
+
if (!isAmount(props.SignatureReward)) {
|
|
61
|
+
throw new ValidationError('XChainAddAccountCreateAttestation: SignatureReward must be a Currency Amount (XRP drops string, IOU object, or MPT object)');
|
|
62
|
+
}
|
|
63
|
+
// ── WasLockingChainSend ── required, exactly 0 or 1.
|
|
64
|
+
if (props.WasLockingChainSend !== 0 && props.WasLockingChainSend !== 1) {
|
|
65
|
+
throw new ValidationError('XChainAddAccountCreateAttestation: WasLockingChainSend must be exactly 0 or 1 (UInt8 boolean)');
|
|
66
|
+
}
|
|
67
|
+
// ── XChainAccountCreateCount ── required, number OR string.
|
|
68
|
+
if (!isNumber(props.XChainAccountCreateCount) && !isString(props.XChainAccountCreateCount)) {
|
|
69
|
+
throw new ValidationError('XChainAddAccountCreateAttestation: XChainAccountCreateCount must be a number or decimal string (UInt64)');
|
|
70
|
+
}
|
|
71
|
+
// ── XChainBridge ── required, full shape (4 keys + valid Issues) +
|
|
72
|
+
// both doors as valid XRPL accounts.
|
|
73
|
+
require(props.XChainBridge, 'XChainAddAccountCreateAttestation: XChainBridge is required and must have shape {LockingChainDoor, LockingChainIssue, IssuingChainDoor, IssuingChainIssue}', isXChainBridge);
|
|
74
|
+
assertValidXChainBridge(props.XChainBridge);
|
|
75
|
+
return buildFrozenTx('XChainAddAccountCreateAttestation', props, {
|
|
76
|
+
validate() {
|
|
77
|
+
// Validated at construction.
|
|
78
|
+
},
|
|
79
|
+
toJSON() {
|
|
80
|
+
const json = {};
|
|
81
|
+
for (const k of Object.keys(this)) {
|
|
82
|
+
if (k === 'validate' || k === 'toJSON' || k === 'with')
|
|
83
|
+
continue;
|
|
84
|
+
const v = this[k];
|
|
85
|
+
if (v !== undefined)
|
|
86
|
+
json[k] = v;
|
|
87
|
+
}
|
|
88
|
+
return json;
|
|
89
|
+
},
|
|
90
|
+
with(overrides) {
|
|
91
|
+
return xchainAddAccountCreateAttestation(mergeForWith(this, overrides));
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=xchain-add-account-create-attestation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xchain-add-account-create-attestation.js","sourceRoot":"","sources":["../../../src/fp/factories/xchain-add-account-create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