@florent-uzio/custody 2.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 +15 -0
- package/README.md +280 -0
- package/dist/constants/defaults.d.ts +3 -0
- package/dist/constants/defaults.d.ts.map +1 -0
- package/dist/constants/defaults.js +3 -0
- package/dist/constants/defaults.js.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/urls.d.ts +86 -0
- package/dist/constants/urls.d.ts.map +1 -0
- package/dist/constants/urls.js +109 -0
- package/dist/constants/urls.js.map +1 -0
- package/dist/helpers/async/async.d.ts +6 -0
- package/dist/helpers/async/async.d.ts.map +1 -0
- package/dist/helpers/async/async.js +6 -0
- package/dist/helpers/async/async.js.map +1 -0
- package/dist/helpers/async/index.d.ts +2 -0
- package/dist/helpers/async/index.d.ts.map +1 -0
- package/dist/helpers/async/index.js +2 -0
- package/dist/helpers/async/index.js.map +1 -0
- package/dist/helpers/index.d.ts +4 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +4 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/typeof-fns/index.d.ts +2 -0
- package/dist/helpers/typeof-fns/index.d.ts.map +1 -0
- package/dist/helpers/typeof-fns/index.js +2 -0
- package/dist/helpers/typeof-fns/index.js.map +1 -0
- package/dist/helpers/typeof-fns/typeof-fns.d.ts +18 -0
- package/dist/helpers/typeof-fns/typeof-fns.d.ts.map +1 -0
- package/dist/helpers/typeof-fns/typeof-fns.js +48 -0
- package/dist/helpers/typeof-fns/typeof-fns.js.map +1 -0
- package/dist/helpers/url/index.d.ts +2 -0
- package/dist/helpers/url/index.d.ts.map +1 -0
- package/dist/helpers/url/index.js +2 -0
- package/dist/helpers/url/index.js.map +1 -0
- package/dist/helpers/url/url.d.ts +39 -0
- package/dist/helpers/url/url.d.ts.map +1 -0
- package/dist/helpers/url/url.js +54 -0
- package/dist/helpers/url/url.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.helpers.d.ts +2 -0
- package/dist/main.helpers.d.ts.map +1 -0
- package/dist/main.helpers.js +99 -0
- package/dist/main.helpers.js.map +1 -0
- package/dist/main.js +41 -0
- package/dist/main.js.map +1 -0
- package/dist/models/custody-error.d.ts +22 -0
- package/dist/models/custody-error.d.ts.map +1 -0
- package/dist/models/custody-error.js +47 -0
- package/dist/models/custody-error.js.map +1 -0
- package/dist/models/custody-types.d.ts +14664 -0
- package/dist/models/custody-types.d.ts.map +1 -0
- package/dist/models/custody-types.js +6 -0
- package/dist/models/custody-types.js.map +1 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +3 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/ledger-ids.d.ts +19 -0
- package/dist/models/ledger-ids.d.ts.map +1 -0
- package/dist/models/ledger-ids.js +2 -0
- package/dist/models/ledger-ids.js.map +1 -0
- package/dist/namespaces/accounts.d.ts +32 -0
- package/dist/namespaces/accounts.d.ts.map +1 -0
- package/dist/namespaces/accounts.js +66 -0
- package/dist/namespaces/accounts.js.map +1 -0
- package/dist/namespaces/channels.d.ts +14 -0
- package/dist/namespaces/channels.d.ts.map +1 -0
- package/dist/namespaces/channels.js +15 -0
- package/dist/namespaces/channels.js.map +1 -0
- package/dist/namespaces/domains.d.ts +7 -0
- package/dist/namespaces/domains.d.ts.map +1 -0
- package/dist/namespaces/domains.js +8 -0
- package/dist/namespaces/domains.js.map +1 -0
- package/dist/namespaces/endpoints.d.ts +7 -0
- package/dist/namespaces/endpoints.d.ts.map +1 -0
- package/dist/namespaces/endpoints.js +8 -0
- package/dist/namespaces/endpoints.js.map +1 -0
- package/dist/namespaces/events.d.ts +6 -0
- package/dist/namespaces/events.d.ts.map +1 -0
- package/dist/namespaces/events.js +7 -0
- package/dist/namespaces/events.js.map +1 -0
- package/dist/namespaces/genesis.d.ts +6 -0
- package/dist/namespaces/genesis.d.ts.map +1 -0
- package/dist/namespaces/genesis.js +7 -0
- package/dist/namespaces/genesis.js.map +1 -0
- package/dist/namespaces/index.d.ts +16 -0
- package/dist/namespaces/index.d.ts.map +1 -0
- package/dist/namespaces/index.js +16 -0
- package/dist/namespaces/index.js.map +1 -0
- package/dist/namespaces/intents.d.ts +13 -0
- package/dist/namespaces/intents.d.ts.map +1 -0
- package/dist/namespaces/intents.js +70 -0
- package/dist/namespaces/intents.js.map +1 -0
- package/dist/namespaces/ledgers.d.ts +11 -0
- package/dist/namespaces/ledgers.d.ts.map +1 -0
- package/dist/namespaces/ledgers.js +12 -0
- package/dist/namespaces/ledgers.js.map +1 -0
- package/dist/namespaces/policies.d.ts +7 -0
- package/dist/namespaces/policies.d.ts.map +1 -0
- package/dist/namespaces/policies.js +8 -0
- package/dist/namespaces/policies.js.map +1 -0
- package/dist/namespaces/requests.d.ts +8 -0
- package/dist/namespaces/requests.d.ts.map +1 -0
- package/dist/namespaces/requests.js +9 -0
- package/dist/namespaces/requests.js.map +1 -0
- package/dist/namespaces/tickers.d.ts +7 -0
- package/dist/namespaces/tickers.d.ts.map +1 -0
- package/dist/namespaces/tickers.js +8 -0
- package/dist/namespaces/tickers.js.map +1 -0
- package/dist/namespaces/transactions.d.ts +12 -0
- package/dist/namespaces/transactions.d.ts.map +1 -0
- package/dist/namespaces/transactions.js +13 -0
- package/dist/namespaces/transactions.js.map +1 -0
- package/dist/namespaces/user-invitations.d.ts +13 -0
- package/dist/namespaces/user-invitations.d.ts.map +1 -0
- package/dist/namespaces/user-invitations.js +14 -0
- package/dist/namespaces/user-invitations.js.map +1 -0
- package/dist/namespaces/users.d.ts +9 -0
- package/dist/namespaces/users.d.ts.map +1 -0
- package/dist/namespaces/users.js +10 -0
- package/dist/namespaces/users.js.map +1 -0
- package/dist/namespaces/vaults.d.ts +9 -0
- package/dist/namespaces/vaults.d.ts.map +1 -0
- package/dist/namespaces/vaults.js +12 -0
- package/dist/namespaces/vaults.js.map +1 -0
- package/dist/ripple-custody.d.ts +95 -0
- package/dist/ripple-custody.d.ts.map +1 -0
- package/dist/ripple-custody.js +138 -0
- package/dist/ripple-custody.js.map +1 -0
- package/dist/ripple-custody.types.d.ts +29 -0
- package/dist/ripple-custody.types.d.ts.map +1 -0
- package/dist/ripple-custody.types.js +2 -0
- package/dist/ripple-custody.types.js.map +1 -0
- package/dist/services/accounts/accounts.types.d.ts +48 -0
- package/dist/services/accounts/accounts.types.d.ts.map +1 -0
- package/dist/services/accounts/accounts.types.js +2 -0
- package/dist/services/accounts/accounts.types.js.map +1 -0
- package/dist/services/accounts/index.d.ts +2 -0
- package/dist/services/accounts/index.d.ts.map +1 -0
- package/dist/services/accounts/index.js +2 -0
- package/dist/services/accounts/index.js.map +1 -0
- package/dist/services/apis/api.service.d.ts +64 -0
- package/dist/services/apis/api.service.d.ts.map +1 -0
- package/dist/services/apis/api.service.js +235 -0
- package/dist/services/apis/api.service.js.map +1 -0
- package/dist/services/apis/api.service.types.d.ts +16 -0
- package/dist/services/apis/api.service.types.d.ts.map +1 -0
- package/dist/services/apis/api.service.types.js +3 -0
- package/dist/services/apis/api.service.types.js.map +1 -0
- package/dist/services/apis/index.d.ts +3 -0
- package/dist/services/apis/index.d.ts.map +1 -0
- package/dist/services/apis/index.js +3 -0
- package/dist/services/apis/index.js.map +1 -0
- package/dist/services/auth/auth.service.d.ts +56 -0
- package/dist/services/auth/auth.service.d.ts.map +1 -0
- package/dist/services/auth/auth.service.js +120 -0
- package/dist/services/auth/auth.service.js.map +1 -0
- package/dist/services/auth/auth.service.types.d.ts +9 -0
- package/dist/services/auth/auth.service.types.d.ts.map +1 -0
- package/dist/services/auth/auth.service.types.js +2 -0
- package/dist/services/auth/auth.service.types.js.map +1 -0
- package/dist/services/auth/index.d.ts +3 -0
- package/dist/services/auth/index.d.ts.map +1 -0
- package/dist/services/auth/index.js +3 -0
- package/dist/services/auth/index.js.map +1 -0
- package/dist/services/channels/channels.types.d.ts +37 -0
- package/dist/services/channels/channels.types.d.ts.map +1 -0
- package/dist/services/channels/channels.types.js +2 -0
- package/dist/services/channels/channels.types.js.map +1 -0
- package/dist/services/channels/index.d.ts +3 -0
- package/dist/services/channels/index.d.ts.map +1 -0
- package/dist/services/channels/index.js +3 -0
- package/dist/services/channels/index.js.map +1 -0
- package/dist/services/channels/parse-event-payload.d.ts +12 -0
- package/dist/services/channels/parse-event-payload.d.ts.map +1 -0
- package/dist/services/channels/parse-event-payload.js +37 -0
- package/dist/services/channels/parse-event-payload.js.map +1 -0
- package/dist/services/domain-resolver/domain-resolver.types.d.ts +18 -0
- package/dist/services/domain-resolver/domain-resolver.types.d.ts.map +1 -0
- package/dist/services/domain-resolver/domain-resolver.types.js +2 -0
- package/dist/services/domain-resolver/domain-resolver.types.js.map +1 -0
- package/dist/services/domain-resolver/index.d.ts +2 -0
- package/dist/services/domain-resolver/index.d.ts.map +1 -0
- package/dist/services/domain-resolver/index.js +2 -0
- package/dist/services/domain-resolver/index.js.map +1 -0
- package/dist/services/domains/domain.types.d.ts +6 -0
- package/dist/services/domains/domain.types.d.ts.map +1 -0
- package/dist/services/domains/domain.types.js +2 -0
- package/dist/services/domains/domain.types.js.map +1 -0
- package/dist/services/domains/index.d.ts +2 -0
- package/dist/services/domains/index.d.ts.map +1 -0
- package/dist/services/domains/index.js +2 -0
- package/dist/services/domains/index.js.map +1 -0
- package/dist/services/endpoints/endpoints.types.d.ts +7 -0
- package/dist/services/endpoints/endpoints.types.d.ts.map +1 -0
- package/dist/services/endpoints/endpoints.types.js +2 -0
- package/dist/services/endpoints/endpoints.types.js.map +1 -0
- package/dist/services/endpoints/index.d.ts +2 -0
- package/dist/services/endpoints/index.d.ts.map +1 -0
- package/dist/services/endpoints/index.js +2 -0
- package/dist/services/endpoints/index.js.map +1 -0
- package/dist/services/events/events.types.d.ts +8 -0
- package/dist/services/events/events.types.d.ts.map +1 -0
- package/dist/services/events/events.types.js +2 -0
- package/dist/services/events/events.types.js.map +1 -0
- package/dist/services/events/index.d.ts +2 -0
- package/dist/services/events/index.d.ts.map +1 -0
- package/dist/services/events/index.js +2 -0
- package/dist/services/events/index.js.map +1 -0
- package/dist/services/genesis/genesis.types.d.ts +7 -0
- package/dist/services/genesis/genesis.types.d.ts.map +1 -0
- package/dist/services/genesis/genesis.types.js +2 -0
- package/dist/services/genesis/genesis.types.js.map +1 -0
- package/dist/services/genesis/index.d.ts +2 -0
- package/dist/services/genesis/index.d.ts.map +1 -0
- package/dist/services/genesis/index.js +2 -0
- package/dist/services/genesis/index.js.map +1 -0
- package/dist/services/index.d.ts +19 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +19 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/intents/index.d.ts +2 -0
- package/dist/services/intents/index.d.ts.map +1 -0
- package/dist/services/intents/index.js +2 -0
- package/dist/services/intents/index.js.map +1 -0
- package/dist/services/intents/intents.types.d.ts +66 -0
- package/dist/services/intents/intents.types.d.ts.map +1 -0
- package/dist/services/intents/intents.types.js +5 -0
- package/dist/services/intents/intents.types.js.map +1 -0
- package/dist/services/keypairs/ed25519.service.d.ts +25 -0
- package/dist/services/keypairs/ed25519.service.d.ts.map +1 -0
- package/dist/services/keypairs/ed25519.service.js +84 -0
- package/dist/services/keypairs/ed25519.service.js.map +1 -0
- package/dist/services/keypairs/index.d.ts +3 -0
- package/dist/services/keypairs/index.d.ts.map +1 -0
- package/dist/services/keypairs/index.js +3 -0
- package/dist/services/keypairs/index.js.map +1 -0
- package/dist/services/keypairs/keypair.service.d.ts +27 -0
- package/dist/services/keypairs/keypair.service.d.ts.map +1 -0
- package/dist/services/keypairs/keypair.service.js +69 -0
- package/dist/services/keypairs/keypair.service.js.map +1 -0
- package/dist/services/keypairs/keypairs.types.d.ts +10 -0
- package/dist/services/keypairs/keypairs.types.d.ts.map +1 -0
- package/dist/services/keypairs/keypairs.types.js +2 -0
- package/dist/services/keypairs/keypairs.types.js.map +1 -0
- package/dist/services/keypairs/secp256k1.service.d.ts +24 -0
- package/dist/services/keypairs/secp256k1.service.d.ts.map +1 -0
- package/dist/services/keypairs/secp256k1.service.js +101 -0
- package/dist/services/keypairs/secp256k1.service.js.map +1 -0
- package/dist/services/keypairs/secp256r1.service.d.ts +24 -0
- package/dist/services/keypairs/secp256r1.service.d.ts.map +1 -0
- package/dist/services/keypairs/secp256r1.service.js +101 -0
- package/dist/services/keypairs/secp256r1.service.js.map +1 -0
- package/dist/services/ledgers/index.d.ts +2 -0
- package/dist/services/ledgers/index.d.ts.map +1 -0
- package/dist/services/ledgers/index.js +2 -0
- package/dist/services/ledgers/index.js.map +1 -0
- package/dist/services/ledgers/ledgers.types.d.ts +13 -0
- package/dist/services/ledgers/ledgers.types.d.ts.map +1 -0
- package/dist/services/ledgers/ledgers.types.js +2 -0
- package/dist/services/ledgers/ledgers.types.js.map +1 -0
- package/dist/services/policies/index.d.ts +2 -0
- package/dist/services/policies/index.d.ts.map +1 -0
- package/dist/services/policies/index.js +2 -0
- package/dist/services/policies/index.js.map +1 -0
- package/dist/services/policies/policies.types.d.ts +13 -0
- package/dist/services/policies/policies.types.d.ts.map +1 -0
- package/dist/services/policies/policies.types.js +2 -0
- package/dist/services/policies/policies.types.js.map +1 -0
- package/dist/services/requests/index.d.ts +2 -0
- package/dist/services/requests/index.d.ts.map +1 -0
- package/dist/services/requests/index.js +2 -0
- package/dist/services/requests/index.js.map +1 -0
- package/dist/services/requests/requests.types.d.ts +8 -0
- package/dist/services/requests/requests.types.d.ts.map +1 -0
- package/dist/services/requests/requests.types.js +2 -0
- package/dist/services/requests/requests.types.js.map +1 -0
- package/dist/services/tickers/index.d.ts +2 -0
- package/dist/services/tickers/index.d.ts.map +1 -0
- package/dist/services/tickers/index.js +2 -0
- package/dist/services/tickers/index.js.map +1 -0
- package/dist/services/tickers/tickers.types.d.ts +6 -0
- package/dist/services/tickers/tickers.types.d.ts.map +1 -0
- package/dist/services/tickers/tickers.types.js +2 -0
- package/dist/services/tickers/tickers.types.js.map +1 -0
- package/dist/services/transactions/index.d.ts +2 -0
- package/dist/services/transactions/index.d.ts.map +1 -0
- package/dist/services/transactions/index.js +2 -0
- package/dist/services/transactions/index.js.map +1 -0
- package/dist/services/transactions/transactions.types.d.ts +21 -0
- package/dist/services/transactions/transactions.types.d.ts.map +1 -0
- package/dist/services/transactions/transactions.types.js +2 -0
- package/dist/services/transactions/transactions.types.js.map +1 -0
- package/dist/services/user-invitations/index.d.ts +2 -0
- package/dist/services/user-invitations/index.d.ts.map +1 -0
- package/dist/services/user-invitations/index.js +2 -0
- package/dist/services/user-invitations/index.js.map +1 -0
- package/dist/services/user-invitations/user-invitations.types.d.ts +15 -0
- package/dist/services/user-invitations/user-invitations.types.d.ts.map +1 -0
- package/dist/services/user-invitations/user-invitations.types.js +2 -0
- package/dist/services/user-invitations/user-invitations.types.js.map +1 -0
- package/dist/services/users/index.d.ts +2 -0
- package/dist/services/users/index.d.ts.map +1 -0
- package/dist/services/users/index.js +2 -0
- package/dist/services/users/index.js.map +1 -0
- package/dist/services/users/users.types.d.ts +10 -0
- package/dist/services/users/users.types.d.ts.map +1 -0
- package/dist/services/users/users.types.js +2 -0
- package/dist/services/users/users.types.js.map +1 -0
- package/dist/services/vaults/index.d.ts +2 -0
- package/dist/services/vaults/index.d.ts.map +1 -0
- package/dist/services/vaults/index.js +2 -0
- package/dist/services/vaults/index.js.map +1 -0
- package/dist/services/vaults/vaults.types.d.ts +14 -0
- package/dist/services/vaults/vaults.types.d.ts.map +1 -0
- package/dist/services/vaults/vaults.types.js +2 -0
- package/dist/services/vaults/vaults.types.js.map +1 -0
- package/dist/services/xrpl/index.d.ts +5 -0
- package/dist/services/xrpl/index.d.ts.map +1 -0
- package/dist/services/xrpl/index.js +8 -0
- package/dist/services/xrpl/index.js.map +1 -0
- package/dist/services/xrpl/xrpl.adapters.d.ts +13 -0
- package/dist/services/xrpl/xrpl.adapters.d.ts.map +1 -0
- package/dist/services/xrpl/xrpl.adapters.js +288 -0
- package/dist/services/xrpl/xrpl.adapters.js.map +1 -0
- package/dist/services/xrpl/xrpl.http-adapters.d.ts +14 -0
- package/dist/services/xrpl/xrpl.http-adapters.d.ts.map +1 -0
- package/dist/services/xrpl/xrpl.http-adapters.js +83 -0
- package/dist/services/xrpl/xrpl.http-adapters.js.map +1 -0
- package/dist/services/xrpl/xrpl.ports.d.ts +36 -0
- package/dist/services/xrpl/xrpl.ports.d.ts.map +1 -0
- package/dist/services/xrpl/xrpl.ports.js +2 -0
- package/dist/services/xrpl/xrpl.ports.js.map +1 -0
- package/dist/services/xrpl/xrpl.service.d.ts +124 -0
- package/dist/services/xrpl/xrpl.service.d.ts.map +1 -0
- package/dist/services/xrpl/xrpl.service.js +370 -0
- package/dist/services/xrpl/xrpl.service.js.map +1 -0
- package/dist/services/xrpl/xrpl.types.d.ts +131 -0
- package/dist/services/xrpl/xrpl.types.d.ts.map +1 -0
- package/dist/services/xrpl/xrpl.types.js +30 -0
- package/dist/services/xrpl/xrpl.types.js.map +1 -0
- package/dist/transport/index.d.ts +4 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +3 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/split-params.d.ts +14 -0
- package/dist/transport/split-params.d.ts.map +1 -0
- package/dist/transport/split-params.js +28 -0
- package/dist/transport/split-params.js.map +1 -0
- package/dist/transport/transport.types.d.ts +11 -0
- package/dist/transport/transport.types.d.ts.map +1 -0
- package/dist/transport/transport.types.js +2 -0
- package/dist/transport/transport.types.js.map +1 -0
- package/dist/transport/typed-transport.d.ts +38 -0
- package/dist/transport/typed-transport.d.ts.map +1 -0
- package/dist/transport/typed-transport.js +78 -0
- package/dist/transport/typed-transport.js.map +1 -0
- package/dist/type-utils/index.d.ts +4 -0
- package/dist/type-utils/index.d.ts.map +1 -0
- package/dist/type-utils/index.js +4 -0
- package/dist/type-utils/index.js.map +1 -0
- package/dist/type-utils/optional-except-for.d.ts +2 -0
- package/dist/type-utils/optional-except-for.d.ts.map +1 -0
- package/dist/type-utils/optional-except-for.js +2 -0
- package/dist/type-utils/optional-except-for.js.map +1 -0
- package/dist/type-utils/prettify.d.ts +4 -0
- package/dist/type-utils/prettify.d.ts.map +1 -0
- package/dist/type-utils/prettify.js +2 -0
- package/dist/type-utils/prettify.js.map +1 -0
- package/dist/type-utils/required-except-for.d.ts +2 -0
- package/dist/type-utils/required-except-for.d.ts.map +1 -0
- package/dist/type-utils/required-except-for.js +2 -0
- package/dist/type-utils/required-except-for.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { type SubmittableTransaction } from "xrpl";
|
|
2
|
+
import type { Core_IntentResponse } from "../intents/intents.types.js";
|
|
3
|
+
import type { XrplPorts } from "./xrpl.ports.js";
|
|
4
|
+
import type { Core_XrplOperation, RawSignAndWaitOptions, RawSignAndWaitResult, XrplIntentOptions } from "./xrpl.types.js";
|
|
5
|
+
export declare class XrplService {
|
|
6
|
+
private readonly ports;
|
|
7
|
+
constructor(ports: XrplPorts);
|
|
8
|
+
/**
|
|
9
|
+
* Proposes any XRPL transaction intent.
|
|
10
|
+
*
|
|
11
|
+
* Replaces the individual per-type methods (sendPayment, createTrustline, etc.).
|
|
12
|
+
* The `operation` parameter is a discriminated union — callers specify the
|
|
13
|
+
* transaction type via the `type` field (e.g. `{ type: "Payment", ... }`).
|
|
14
|
+
*
|
|
15
|
+
* Internally: resolves domain/user context from the Account address,
|
|
16
|
+
* builds the intent envelope, and submits it to the Custody API.
|
|
17
|
+
*
|
|
18
|
+
* @param params - The Account address and XRPL operation
|
|
19
|
+
* @param options - Optional configuration for the intent
|
|
20
|
+
* @returns The proposed intent response
|
|
21
|
+
* @throws {CustodyError} If validation fails or the sender account is not found
|
|
22
|
+
*/
|
|
23
|
+
proposeIntent(params: {
|
|
24
|
+
Account: string;
|
|
25
|
+
operation: Core_XrplOperation;
|
|
26
|
+
}, options?: XrplIntentOptions): Promise<Core_IntentResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves the compressed secp256k1 public key for an XRPL account.
|
|
29
|
+
* @param domainId - The domain ID of the account
|
|
30
|
+
* @param accountId - The account ID
|
|
31
|
+
* @returns The compressed public key in uppercase hex format
|
|
32
|
+
* @throws {CustodyError} If the account is not a Vault account or the key is not found
|
|
33
|
+
*/
|
|
34
|
+
getPublicKey({ domainId, accountId, }: {
|
|
35
|
+
domainId: string;
|
|
36
|
+
accountId: string;
|
|
37
|
+
}): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Creates and proposes a raw sign intent for an XRPL transaction.
|
|
40
|
+
* @param xrplTransaction - The XRPL transaction details
|
|
41
|
+
* @param options - Optional configuration for the raw sign intent
|
|
42
|
+
* @returns The proposed intent response
|
|
43
|
+
* @throws {CustodyError} If validation fails or the sender account is not found
|
|
44
|
+
*/
|
|
45
|
+
rawSign(xrplTransaction: SubmittableTransaction, options?: XrplIntentOptions): Promise<Core_IntentResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Raw-signs an XRPL transaction and waits for the manifest signature.
|
|
48
|
+
*
|
|
49
|
+
* If `SigningPubKey` is not already set on the transaction, it will be
|
|
50
|
+
* fetched from the custody account and set automatically.
|
|
51
|
+
*
|
|
52
|
+
* @param xrplTransaction - The XRPL transaction details
|
|
53
|
+
* @param options - Optional configuration for the raw sign intent and polling
|
|
54
|
+
* @returns The signature, signing public key in uppercase hex and the signed transaction
|
|
55
|
+
* @throws {CustodyError} If validation fails, the sender account is not found,
|
|
56
|
+
* or the manifest signature is not available after maximum retries
|
|
57
|
+
*/
|
|
58
|
+
rawSignAndWait(xrplTransaction: SubmittableTransaction, options?: RawSignAndWaitOptions): Promise<RawSignAndWaitResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Proposes a raw sign intent for a Batch transaction envelope for a single
|
|
61
|
+
* inner account. The batch envelope (`flags` + all inner transaction hashes)
|
|
62
|
+
* is encoded using `encodeForSigningBatch` and signed with the key of the
|
|
63
|
+
* specified `signerAddress`.
|
|
64
|
+
*
|
|
65
|
+
* All signers sign the same envelope data. Call this once per inner account
|
|
66
|
+
* that is managed by this custody instance.
|
|
67
|
+
*
|
|
68
|
+
* @param batch - The autofilled Batch transaction (with all inner transactions)
|
|
69
|
+
* @param signerAddress - The XRPL address of the inner account to sign for
|
|
70
|
+
* @param options - Optional configuration for the raw sign intent
|
|
71
|
+
* @returns The proposed intent response
|
|
72
|
+
* @throws {CustodyError} If signerAddress is not in the batch, or the account is not found
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* Signs a Batch transaction envelope for a single inner account and waits
|
|
76
|
+
* for the manifest signature.
|
|
77
|
+
*
|
|
78
|
+
* All signers sign the same envelope (`flags` + all inner transaction hashes).
|
|
79
|
+
* Call this method once per inner account managed by this custody instance.
|
|
80
|
+
* Inner accounts on other custody instances sign independently with their own SDK.
|
|
81
|
+
*
|
|
82
|
+
* @param batch - The autofilled Batch transaction (with all inner transactions)
|
|
83
|
+
* @param signerAddress - The XRPL address of the inner account to sign for
|
|
84
|
+
* @param options - Optional configuration for the raw sign intent and polling
|
|
85
|
+
* @returns The signature and signing public key in uppercase hex
|
|
86
|
+
* @throws {CustodyError} If signerAddress is not in the batch, the account is not found,
|
|
87
|
+
* or the manifest signature is not available after maximum retries
|
|
88
|
+
*/
|
|
89
|
+
/**
|
|
90
|
+
* Resolves the intent context for an inner batch signer.
|
|
91
|
+
* When `accountId` and `ledgerId` are provided in options, skips the address lookup.
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
/**
|
|
95
|
+
* Validates that the signer address is involved in at least one inner transaction.
|
|
96
|
+
* @private
|
|
97
|
+
*/
|
|
98
|
+
private validateBatchSigner;
|
|
99
|
+
/**
|
|
100
|
+
* Encodes a Batch transaction envelope for signing.
|
|
101
|
+
* Computes txIDs from inner transactions and encodes with `encodeForSigningBatch`.
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
private encodeBatchForSigning;
|
|
105
|
+
/**
|
|
106
|
+
* Proposes a raw sign intent with base64-encoded bytes.
|
|
107
|
+
* Shared by rawSign, rawSignAndWait, and signBytesAndWait.
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
private proposeRawSignIntent;
|
|
111
|
+
/**
|
|
112
|
+
* Polls the manifest until a signature is available, then returns it as uppercase hex.
|
|
113
|
+
* Handles both the manifest not existing yet (404) and the manifest existing
|
|
114
|
+
* but not yet having a signature.
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
private waitForManifestSignature;
|
|
118
|
+
/**
|
|
119
|
+
* Builds an XRPL intent body.
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
private buildTransactionIntent;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=xrpl.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xrpl.service.d.ts","sourceRoot":"","sources":["../../../src/services/xrpl/xrpl.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,KAAK,sBAAsB,EAC5B,MAAM,MAAM,CAAA;AAIb,OAAO,KAAK,EAAE,mBAAmB,EAA0B,MAAM,6BAA6B,CAAA;AAC9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAEV,kBAAkB,EAElB,qBAAqB,EACrB,oBAAoB,EAEpB,iBAAiB,EAClB,MAAM,iBAAiB,CAAA;AAExB,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,SAAS;IAE7C;;;;;;;;;;;;;;OAcG;IACU,aAAa,CACxB,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,kBAAkB,CAAA;KAAE,EAC1D,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,mBAAmB,CAAC;IAe/B;;;;;;OAMG;IACU,YAAY,CAAC,EACxB,QAAQ,EACR,SAAS,GACV,EAAE;QACD,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,MAAM,CAAA;KAClB,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBnB;;;;;;OAMG;IACU,OAAO,CAClB,eAAe,EAAE,sBAAsB,EACvC,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,mBAAmB,CAAC;IAa/B;;;;;;;;;;;OAWG;IACU,cAAc,CACzB,eAAe,EAAE,sBAAsB,EACvC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,oBAAoB,CAAC;IAwChC;;;;;;;;;;;;;;OAcG;IAgBH;;;;;;;;;;;;;;OAcG;IA4CH;;;;OAIG;IAwBH;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAW3B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;;OAIG;YACW,oBAAoB;IAuClC;;;;;OAKG;YACW,wBAAwB;IAkCtC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CAwC/B"}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { createPublicKey } from "crypto";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import { v7 as uuidv7 } from "uuid";
|
|
4
|
+
import { encodeForSigning, encodeForSigningBatch, hashes, isValidAddress, } from "xrpl";
|
|
5
|
+
import { sleep } from "../../helpers/async/async.js";
|
|
6
|
+
import { isUndefined } from "../../helpers/index.js";
|
|
7
|
+
import { CustodyError } from "../../models/index.js";
|
|
8
|
+
export class XrplService {
|
|
9
|
+
ports;
|
|
10
|
+
constructor(ports) {
|
|
11
|
+
this.ports = ports;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Proposes any XRPL transaction intent.
|
|
15
|
+
*
|
|
16
|
+
* Replaces the individual per-type methods (sendPayment, createTrustline, etc.).
|
|
17
|
+
* The `operation` parameter is a discriminated union — callers specify the
|
|
18
|
+
* transaction type via the `type` field (e.g. `{ type: "Payment", ... }`).
|
|
19
|
+
*
|
|
20
|
+
* Internally: resolves domain/user context from the Account address,
|
|
21
|
+
* builds the intent envelope, and submits it to the Custody API.
|
|
22
|
+
*
|
|
23
|
+
* @param params - The Account address and XRPL operation
|
|
24
|
+
* @param options - Optional configuration for the intent
|
|
25
|
+
* @returns The proposed intent response
|
|
26
|
+
* @throws {CustodyError} If validation fails or the sender account is not found
|
|
27
|
+
*/
|
|
28
|
+
async proposeIntent(params, options = {}) {
|
|
29
|
+
const context = await this.ports.resolveContext(params.Account, {
|
|
30
|
+
domainId: options.domainId,
|
|
31
|
+
ledgerId: options.ledgerId,
|
|
32
|
+
});
|
|
33
|
+
const intent = this.buildTransactionIntent({
|
|
34
|
+
operation: params.operation,
|
|
35
|
+
context,
|
|
36
|
+
options,
|
|
37
|
+
});
|
|
38
|
+
return this.ports.submitIntent(intent);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Retrieves the compressed secp256k1 public key for an XRPL account.
|
|
42
|
+
* @param domainId - The domain ID of the account
|
|
43
|
+
* @param accountId - The account ID
|
|
44
|
+
* @returns The compressed public key in uppercase hex format
|
|
45
|
+
* @throws {CustodyError} If the account is not a Vault account or the key is not found
|
|
46
|
+
*/
|
|
47
|
+
async getPublicKey({ domainId, accountId, }) {
|
|
48
|
+
const account = await this.ports.getAccount(domainId, accountId);
|
|
49
|
+
const { providerDetails } = account.data;
|
|
50
|
+
if (providerDetails.type !== "Vault") {
|
|
51
|
+
throw new CustodyError({ reason: "Account is not a Vault account" });
|
|
52
|
+
}
|
|
53
|
+
const key = providerDetails.keys?.find((k) => k.id === "SECP256K1_CUSTODY_1");
|
|
54
|
+
if (!key?.publicKey) {
|
|
55
|
+
throw new CustodyError({
|
|
56
|
+
reason: "Public key not found for key ID SECP256K1_CUSTODY_1",
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return compressPublicKey(key.publicKey.value);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Creates and proposes a raw sign intent for an XRPL transaction.
|
|
63
|
+
* @param xrplTransaction - The XRPL transaction details
|
|
64
|
+
* @param options - Optional configuration for the raw sign intent
|
|
65
|
+
* @returns The proposed intent response
|
|
66
|
+
* @throws {CustodyError} If validation fails or the sender account is not found
|
|
67
|
+
*/
|
|
68
|
+
async rawSign(xrplTransaction, options = {}) {
|
|
69
|
+
const context = await this.ports.resolveContext(xrplTransaction.Account, {
|
|
70
|
+
domainId: options.domainId,
|
|
71
|
+
ledgerId: options.ledgerId,
|
|
72
|
+
});
|
|
73
|
+
const encoded = encodeForSigning(xrplTransaction);
|
|
74
|
+
const base64Encoded = Buffer.from(encoded, "hex").toString("base64");
|
|
75
|
+
const { intentResponse } = await this.proposeRawSignIntent(base64Encoded, context, options);
|
|
76
|
+
return intentResponse;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Raw-signs an XRPL transaction and waits for the manifest signature.
|
|
80
|
+
*
|
|
81
|
+
* If `SigningPubKey` is not already set on the transaction, it will be
|
|
82
|
+
* fetched from the custody account and set automatically.
|
|
83
|
+
*
|
|
84
|
+
* @param xrplTransaction - The XRPL transaction details
|
|
85
|
+
* @param options - Optional configuration for the raw sign intent and polling
|
|
86
|
+
* @returns The signature, signing public key in uppercase hex and the signed transaction
|
|
87
|
+
* @throws {CustodyError} If validation fails, the sender account is not found,
|
|
88
|
+
* or the manifest signature is not available after maximum retries
|
|
89
|
+
*/
|
|
90
|
+
async rawSignAndWait(xrplTransaction, options = {}) {
|
|
91
|
+
if (!isUndefined(options.signerAccount) && !isValidAddress(options.signerAccount)) {
|
|
92
|
+
throw new CustodyError({ reason: `Invalid signerAccount address: ${options.signerAccount}` });
|
|
93
|
+
}
|
|
94
|
+
const signerAddress = options.signerAccount ?? xrplTransaction.Account;
|
|
95
|
+
const context = await this.ports.resolveContext(signerAddress, {
|
|
96
|
+
domainId: options.domainId,
|
|
97
|
+
ledgerId: options.ledgerId,
|
|
98
|
+
});
|
|
99
|
+
if (!xrplTransaction.SigningPubKey) {
|
|
100
|
+
const pubKey = await this.getPublicKey({
|
|
101
|
+
domainId: context.domainId,
|
|
102
|
+
accountId: context.accountId,
|
|
103
|
+
});
|
|
104
|
+
xrplTransaction.SigningPubKey = pubKey;
|
|
105
|
+
}
|
|
106
|
+
const encoded = encodeForSigning(xrplTransaction);
|
|
107
|
+
const base64Encoded = Buffer.from(encoded, "hex").toString("base64");
|
|
108
|
+
const { payloadId } = await this.proposeRawSignIntent(base64Encoded, context, options);
|
|
109
|
+
const signature = await this.waitForManifestSignature(context.domainId, context.accountId, payloadId, options.polling);
|
|
110
|
+
xrplTransaction.TxnSignature = signature;
|
|
111
|
+
return {
|
|
112
|
+
signature,
|
|
113
|
+
signingPubKey: xrplTransaction.SigningPubKey,
|
|
114
|
+
signedTransaction: xrplTransaction,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Proposes a raw sign intent for a Batch transaction envelope for a single
|
|
119
|
+
* inner account. The batch envelope (`flags` + all inner transaction hashes)
|
|
120
|
+
* is encoded using `encodeForSigningBatch` and signed with the key of the
|
|
121
|
+
* specified `signerAddress`.
|
|
122
|
+
*
|
|
123
|
+
* All signers sign the same envelope data. Call this once per inner account
|
|
124
|
+
* that is managed by this custody instance.
|
|
125
|
+
*
|
|
126
|
+
* @param batch - The autofilled Batch transaction (with all inner transactions)
|
|
127
|
+
* @param signerAddress - The XRPL address of the inner account to sign for
|
|
128
|
+
* @param options - Optional configuration for the raw sign intent
|
|
129
|
+
* @returns The proposed intent response
|
|
130
|
+
* @throws {CustodyError} If signerAddress is not in the batch, or the account is not found
|
|
131
|
+
*/
|
|
132
|
+
// public async rawSignInnerBatch(
|
|
133
|
+
// batch: Batch,
|
|
134
|
+
// signerAddress: string,
|
|
135
|
+
// options: RawSignInnerBatchOptions = {},
|
|
136
|
+
// ): Promise<Core_IntentResponse> {
|
|
137
|
+
// this.validateBatchSigner(batch, signerAddress)
|
|
138
|
+
// const context = await this.resolveInnerBatchContext(signerAddress, options)
|
|
139
|
+
// const base64Encoded = this.encodeBatchForSigning(batch)
|
|
140
|
+
// const { intentResponse } = await this.proposeRawSignIntent(base64Encoded, context, options)
|
|
141
|
+
// return intentResponse
|
|
142
|
+
// }
|
|
143
|
+
/**
|
|
144
|
+
* Signs a Batch transaction envelope for a single inner account and waits
|
|
145
|
+
* for the manifest signature.
|
|
146
|
+
*
|
|
147
|
+
* All signers sign the same envelope (`flags` + all inner transaction hashes).
|
|
148
|
+
* Call this method once per inner account managed by this custody instance.
|
|
149
|
+
* Inner accounts on other custody instances sign independently with their own SDK.
|
|
150
|
+
*
|
|
151
|
+
* @param batch - The autofilled Batch transaction (with all inner transactions)
|
|
152
|
+
* @param signerAddress - The XRPL address of the inner account to sign for
|
|
153
|
+
* @param options - Optional configuration for the raw sign intent and polling
|
|
154
|
+
* @returns The signature and signing public key in uppercase hex
|
|
155
|
+
* @throws {CustodyError} If signerAddress is not in the batch, the account is not found,
|
|
156
|
+
* or the manifest signature is not available after maximum retries
|
|
157
|
+
*/
|
|
158
|
+
// public async rawSignInnerBatchAndWait(
|
|
159
|
+
// batch: Batch,
|
|
160
|
+
// signerAddress: string,
|
|
161
|
+
// options: RawSignInnerBatchOptions = {},
|
|
162
|
+
// ): Promise<RawSignInnerBatchAndWaitResult> {
|
|
163
|
+
// this.validateBatchSigner(batch, signerAddress)
|
|
164
|
+
// const context = await this.resolveInnerBatchContext(signerAddress, options)
|
|
165
|
+
// const signingPubKey = await this.getPublicKey({
|
|
166
|
+
// domainId: context.domainId,
|
|
167
|
+
// accountId: context.accountId,
|
|
168
|
+
// })
|
|
169
|
+
// const base64Encoded = this.encodeBatchForSigning(batch)
|
|
170
|
+
// const { payloadId } = await this.proposeRawSignIntent(base64Encoded, context, options)
|
|
171
|
+
// const signature = await this.waitForManifestSignature(
|
|
172
|
+
// context.domainId,
|
|
173
|
+
// context.accountId,
|
|
174
|
+
// payloadId,
|
|
175
|
+
// options.polling,
|
|
176
|
+
// )
|
|
177
|
+
// return {
|
|
178
|
+
// signature,
|
|
179
|
+
// signingPubKey,
|
|
180
|
+
// batchSigner: {
|
|
181
|
+
// BatchSigner: {
|
|
182
|
+
// Account: signerAddress,
|
|
183
|
+
// SigningPubKey: signingPubKey,
|
|
184
|
+
// TxnSignature: signature,
|
|
185
|
+
// },
|
|
186
|
+
// },
|
|
187
|
+
// custodyBatchSigner: {
|
|
188
|
+
// account: signerAddress,
|
|
189
|
+
// signingPubKey,
|
|
190
|
+
// txnSignature: signature,
|
|
191
|
+
// },
|
|
192
|
+
// }
|
|
193
|
+
// }
|
|
194
|
+
/**
|
|
195
|
+
* Resolves the intent context for an inner batch signer.
|
|
196
|
+
* When `accountId` and `ledgerId` are provided in options, skips the address lookup.
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
199
|
+
// private async resolveInnerBatchContext(
|
|
200
|
+
// signerAddress: string,
|
|
201
|
+
// options: RawSignInnerBatchOptions,
|
|
202
|
+
// ): Promise<IntentContext> {
|
|
203
|
+
// if (options.accountId && options.ledgerId) {
|
|
204
|
+
// const fullContext = await this.ports.resolveContext(signerAddress, {
|
|
205
|
+
// domainId: options.domainId,
|
|
206
|
+
// ledgerId: options.ledgerId,
|
|
207
|
+
// })
|
|
208
|
+
// return {
|
|
209
|
+
// domainId: fullContext.domainId,
|
|
210
|
+
// userId: fullContext.userId,
|
|
211
|
+
// accountId: options.accountId,
|
|
212
|
+
// ledgerId: options.ledgerId,
|
|
213
|
+
// address: signerAddress,
|
|
214
|
+
// }
|
|
215
|
+
// }
|
|
216
|
+
// return this.ports.resolveContext(signerAddress, {
|
|
217
|
+
// domainId: options.domainId,
|
|
218
|
+
// ledgerId: options.ledgerId,
|
|
219
|
+
// })
|
|
220
|
+
// }
|
|
221
|
+
/**
|
|
222
|
+
* Validates that the signer address is involved in at least one inner transaction.
|
|
223
|
+
* @private
|
|
224
|
+
*/
|
|
225
|
+
validateBatchSigner(batch, signerAddress) {
|
|
226
|
+
const involvedAccounts = new Set(batch.RawTransactions.map((rawTx) => rawTx.RawTransaction.Account));
|
|
227
|
+
if (!involvedAccounts.has(signerAddress)) {
|
|
228
|
+
throw new CustodyError({
|
|
229
|
+
reason: `Address ${signerAddress} is not involved in any inner transaction of the Batch`,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Encodes a Batch transaction envelope for signing.
|
|
235
|
+
* Computes txIDs from inner transactions and encodes with `encodeForSigningBatch`.
|
|
236
|
+
* @private
|
|
237
|
+
*/
|
|
238
|
+
encodeBatchForSigning(batch) {
|
|
239
|
+
const txIDs = batch.RawTransactions.map((rawTx) => hashes.hashSignedTx(rawTx.RawTransaction));
|
|
240
|
+
const batchEncodedHex = encodeForSigningBatch({
|
|
241
|
+
flags: batch.Flags,
|
|
242
|
+
txIDs,
|
|
243
|
+
});
|
|
244
|
+
return Buffer.from(batchEncodedHex, "hex").toString("base64");
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Proposes a raw sign intent with base64-encoded bytes.
|
|
248
|
+
* Shared by rawSign, rawSignAndWait, and signBytesAndWait.
|
|
249
|
+
* @private
|
|
250
|
+
*/
|
|
251
|
+
async proposeRawSignIntent(base64Bytes, context, options) {
|
|
252
|
+
const requestId = options.requestId ?? uuidv7();
|
|
253
|
+
const payloadId = options.payloadId ?? uuidv7();
|
|
254
|
+
const intent = {
|
|
255
|
+
request: {
|
|
256
|
+
author: {
|
|
257
|
+
id: context.userId,
|
|
258
|
+
domainId: context.domainId,
|
|
259
|
+
},
|
|
260
|
+
expiryAt: dayjs()
|
|
261
|
+
.add(options.expiryDays ?? 1, "day")
|
|
262
|
+
.toISOString(),
|
|
263
|
+
targetDomainId: context.domainId,
|
|
264
|
+
id: requestId,
|
|
265
|
+
customProperties: options.requestCustomProperties ?? {},
|
|
266
|
+
payload: {
|
|
267
|
+
id: payloadId,
|
|
268
|
+
accountId: context.accountId,
|
|
269
|
+
ledgerId: context.ledgerId,
|
|
270
|
+
customProperties: options.payloadCustomProperties ?? {},
|
|
271
|
+
content: {
|
|
272
|
+
value: base64Bytes,
|
|
273
|
+
type: "Unsafe",
|
|
274
|
+
},
|
|
275
|
+
type: "v0_SignManifest",
|
|
276
|
+
},
|
|
277
|
+
type: "Propose",
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
const intentResponse = await this.ports.submitIntent(intent);
|
|
281
|
+
return { intentResponse, payloadId };
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Polls the manifest until a signature is available, then returns it as uppercase hex.
|
|
285
|
+
* Handles both the manifest not existing yet (404) and the manifest existing
|
|
286
|
+
* but not yet having a signature.
|
|
287
|
+
* @private
|
|
288
|
+
*/
|
|
289
|
+
async waitForManifestSignature(domainId, accountId, manifestId, options = {}) {
|
|
290
|
+
const { maxRetries = 3, intervalMs = 3000, onAttempt } = options;
|
|
291
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
292
|
+
onAttempt?.(attempt);
|
|
293
|
+
try {
|
|
294
|
+
const manifest = await this.ports.getManifest(domainId, accountId, manifestId);
|
|
295
|
+
const { value } = manifest.data;
|
|
296
|
+
if (value && value.type === "Unsafe") {
|
|
297
|
+
return Buffer.from(value.signature, "base64").toString("hex").toUpperCase();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
if (!(error instanceof CustodyError && error.statusCode === 404)) {
|
|
302
|
+
throw error;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (attempt < maxRetries) {
|
|
306
|
+
await sleep(intervalMs);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
throw new CustodyError({
|
|
310
|
+
reason: "Manifest signature not available after maximum retries",
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Builds an XRPL intent body.
|
|
315
|
+
* @private
|
|
316
|
+
*/
|
|
317
|
+
buildTransactionIntent({ operation, context, options, }) {
|
|
318
|
+
const feePriority = options.feePriority ?? "Low";
|
|
319
|
+
const expiryDays = options.expiryDays ?? 1;
|
|
320
|
+
const requestId = options.requestId ?? uuidv7();
|
|
321
|
+
const payloadId = options.payloadId ?? uuidv7();
|
|
322
|
+
return {
|
|
323
|
+
request: {
|
|
324
|
+
author: {
|
|
325
|
+
domainId: context.domainId,
|
|
326
|
+
id: context.userId,
|
|
327
|
+
},
|
|
328
|
+
customProperties: options.requestCustomProperties ?? {},
|
|
329
|
+
expiryAt: dayjs().add(expiryDays, "day").toISOString(),
|
|
330
|
+
id: requestId,
|
|
331
|
+
payload: {
|
|
332
|
+
accountId: context.accountId,
|
|
333
|
+
customProperties: options.payloadCustomProperties ?? {},
|
|
334
|
+
id: payloadId,
|
|
335
|
+
ledgerId: context.ledgerId,
|
|
336
|
+
parameters: {
|
|
337
|
+
feeStrategy: {
|
|
338
|
+
priority: feePriority,
|
|
339
|
+
type: "Priority",
|
|
340
|
+
},
|
|
341
|
+
memos: [],
|
|
342
|
+
operation,
|
|
343
|
+
type: "XRPL",
|
|
344
|
+
},
|
|
345
|
+
type: "v0_CreateTransactionOrder",
|
|
346
|
+
},
|
|
347
|
+
targetDomainId: context.domainId,
|
|
348
|
+
type: "Propose",
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Compresses a base64-encoded SPKI/DER secp256k1 public key to its compressed hex form.
|
|
355
|
+
* Uses Node.js built-in crypto via JWK export to extract the raw EC point coordinates.
|
|
356
|
+
*/
|
|
357
|
+
function compressPublicKey(base64PublicKey) {
|
|
358
|
+
const publicKey = createPublicKey({
|
|
359
|
+
key: Buffer.from(base64PublicKey, "base64"),
|
|
360
|
+
format: "der",
|
|
361
|
+
type: "spki",
|
|
362
|
+
});
|
|
363
|
+
const jwk = publicKey.export({ format: "jwk" });
|
|
364
|
+
const x = Buffer.from(jwk.x, "base64url");
|
|
365
|
+
const y = Buffer.from(jwk.y, "base64url");
|
|
366
|
+
const lastByte = y[y.length - 1];
|
|
367
|
+
const prefix = lastByte % 2 === 0 ? "02" : "03";
|
|
368
|
+
return (prefix + x.toString("hex")).toUpperCase();
|
|
369
|
+
}
|
|
370
|
+
//# sourceMappingURL=xrpl.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xrpl.service.js","sourceRoot":"","sources":["../../../src/services/xrpl/xrpl.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,MAAM,EACN,cAAc,GAGf,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAapD,MAAM,OAAO,WAAW;IACO;IAA7B,YAA6B,KAAgB;QAAhB,UAAK,GAAL,KAAK,CAAW;IAAG,CAAC;IAEjD;;;;;;;;;;;;;;OAcG;IACI,KAAK,CAAC,aAAa,CACxB,MAA0D,EAC1D,UAA6B,EAAE;QAE/B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE;YAC9D,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,IAAI,CAAC,sBAAsB,CAAC;YACzC,SAAS,EAAE,MAAM,CAAC,SAAS;YA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,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { AccountSet, Clawback, DepositPreauth, MPTokenAuthorize, MPTokenIssuanceCreate, MPTokenIssuanceDestroy, MPTokenIssuanceSet, OfferCreate, Payment, SubmittableTransaction, TrustSet } from "xrpl";
|
|
2
|
+
import type { components } from "../../models/custody-types.js";
|
|
3
|
+
import type { XrplLedgerId } from "../../models/ledger-ids.js";
|
|
4
|
+
import type { Prettify } from "../../type-utils/index.js";
|
|
5
|
+
import type { DomainUserReference } from "../domain-resolver/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* Minimum set of account fields required to build an XRPL intent.
|
|
8
|
+
* Consumed by `IntentContext`. Not an API response shape — see
|
|
9
|
+
* `Core_AccountAddressReference` for the full address-lookup result.
|
|
10
|
+
*/
|
|
11
|
+
export type XrplAccountReference = {
|
|
12
|
+
accountId: string;
|
|
13
|
+
ledgerId: XrplLedgerId;
|
|
14
|
+
address: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Combined context required to build an intent.
|
|
18
|
+
* Contains domain/user reference and account reference.
|
|
19
|
+
*/
|
|
20
|
+
export type IntentContext = DomainUserReference & XrplAccountReference;
|
|
21
|
+
export type Core_XrplOperation_Payment = components["schemas"]["Core_XrplOperation_Payment"];
|
|
22
|
+
export type CustodyPayment = Prettify<Pick<Payment, "Account"> & Omit<Core_XrplOperation_Payment, "type">>;
|
|
23
|
+
export type Core_XrplOperation_TrustSet = components["schemas"]["Core_XrplOperation_TrustSet"];
|
|
24
|
+
export type CustodyTrustline = Prettify<Pick<TrustSet, "Account"> & Omit<Core_XrplOperation_TrustSet, "type">>;
|
|
25
|
+
export type Core_XrplOperation_DepositPreauth = components["schemas"]["Core_XrplOperation_DepositPreauth"];
|
|
26
|
+
export type CustodyDepositPreauth = Prettify<Pick<DepositPreauth, "Account"> & Omit<Core_XrplOperation_DepositPreauth, "type">>;
|
|
27
|
+
export type Core_XrplOperation_Clawback = components["schemas"]["Core_XrplOperation_Clawback"];
|
|
28
|
+
export type CustodyClawback = Prettify<Pick<Clawback, "Account"> & Omit<Core_XrplOperation_Clawback, "type">>;
|
|
29
|
+
export type Core_XrplOperation_MPTokenAuthorize = components["schemas"]["Core_XrplOperation_MPTokenAuthorize"];
|
|
30
|
+
export type CustodyMpTokenAuthorize = Prettify<Pick<MPTokenAuthorize, "Account"> & Omit<Core_XrplOperation_MPTokenAuthorize, "type">>;
|
|
31
|
+
type Core_XrplOperation_MPTokenIssuanceCreate = components["schemas"]["Core_XrplOperation_MPTokenIssuanceCreate"];
|
|
32
|
+
export type CustodyMpTokenIssuanceCreate = Prettify<Pick<MPTokenIssuanceCreate, "Account"> & Omit<Core_XrplOperation_MPTokenIssuanceCreate, "type">>;
|
|
33
|
+
type Core_XrplOperation_MPTokenIssuanceSet = components["schemas"]["Core_XrplOperation_MPTokenIssuanceSet"];
|
|
34
|
+
export type CustodyMpTokenIssuanceSet = Prettify<Pick<MPTokenIssuanceSet, "Account"> & Omit<Core_XrplOperation_MPTokenIssuanceSet, "type">>;
|
|
35
|
+
type Core_XrplOperation_MPTokenIssuanceDestroy = components["schemas"]["Core_XrplOperation_MPTokenIssuanceDestroy"];
|
|
36
|
+
export type CustodyMpTokenIssuanceDestroy = Prettify<Pick<MPTokenIssuanceDestroy, "Account"> & Omit<Core_XrplOperation_MPTokenIssuanceDestroy, "type">>;
|
|
37
|
+
export type Core_XrplOperation_OfferCreate = components["schemas"]["Core_XrplOperation_OfferCreate"];
|
|
38
|
+
export type CustodyOfferCreate = Prettify<Pick<OfferCreate, "Account"> & Omit<Core_XrplOperation_OfferCreate, "type">>;
|
|
39
|
+
export type Core_XrplOperation_AccountSet = components["schemas"]["Core_XrplOperation_AccountSet"];
|
|
40
|
+
export type CustodyAccountSet = Prettify<Pick<AccountSet, "Account"> & Omit<Core_XrplOperation_AccountSet, "type">>;
|
|
41
|
+
export type CustodyAccountSetFlag = CustodyAccountSet["setFlag"];
|
|
42
|
+
export type XrplIntentOptions = {
|
|
43
|
+
/**
|
|
44
|
+
* Domain ID to use for the payment. If not provided and user has multiple domains, an error will be thrown.
|
|
45
|
+
*/
|
|
46
|
+
domainId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Ledger ID to disambiguate when the same address exists on multiple ledgers
|
|
49
|
+
* under the same login (e.g. "xrpl" vs "xrpl-testnet-august-2024"). Required when
|
|
50
|
+
* the address is registered on more than one ledger; otherwise optional.
|
|
51
|
+
* The auto-completion is loose, you can write any value.
|
|
52
|
+
*/
|
|
53
|
+
ledgerId?: XrplLedgerId;
|
|
54
|
+
/**
|
|
55
|
+
* Fee strategy priority. Defaults to "Low".
|
|
56
|
+
*/
|
|
57
|
+
feePriority?: "Low" | "Medium" | "High";
|
|
58
|
+
/**
|
|
59
|
+
* Number of days until the intent expires. Defaults to 1.
|
|
60
|
+
*/
|
|
61
|
+
expiryDays?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Custom properties to include in the intent request.
|
|
64
|
+
*/
|
|
65
|
+
requestCustomProperties?: Record<string, string>;
|
|
66
|
+
/**
|
|
67
|
+
* Custom properties to include in the intent payload.
|
|
68
|
+
*/
|
|
69
|
+
payloadCustomProperties?: Record<string, string>;
|
|
70
|
+
/**
|
|
71
|
+
* Request ID to use for the intent. If not provided, a new UUID will be generated.
|
|
72
|
+
*/
|
|
73
|
+
requestId?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Payload ID to use for the intent. If not provided, a new UUID will be generated.
|
|
76
|
+
*/
|
|
77
|
+
payloadId?: string;
|
|
78
|
+
};
|
|
79
|
+
export type Core_XrplOperation = components["schemas"]["Core_XrplOperation"];
|
|
80
|
+
export type BuildTransactionIntentProps = {
|
|
81
|
+
operation: Core_XrplOperation;
|
|
82
|
+
context: IntentContext;
|
|
83
|
+
options: XrplIntentOptions;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Options for polling the manifest signature after a raw sign intent.
|
|
87
|
+
*/
|
|
88
|
+
export type WaitForSignatureOptions = {
|
|
89
|
+
/** Maximum number of polling attempts (default: 3) */
|
|
90
|
+
maxRetries?: number;
|
|
91
|
+
/** Interval between polling attempts in milliseconds (default: 3000) */
|
|
92
|
+
intervalMs?: number;
|
|
93
|
+
/** Callback on each polling attempt */
|
|
94
|
+
onAttempt?: (attempt: number) => void;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Options for rawSignAndWait: intent options + polling configuration.
|
|
98
|
+
*/
|
|
99
|
+
export type RawSignAndWaitOptions = XrplIntentOptions & {
|
|
100
|
+
/** Polling options for waiting for the manifest signature */
|
|
101
|
+
polling?: WaitForSignatureOptions;
|
|
102
|
+
/**
|
|
103
|
+
* XRPL address of the account whose custody key will sign the transaction.
|
|
104
|
+
* Defaults to xrplTransaction.Account. Set this when the account has a regular key
|
|
105
|
+
* (via SetRegularKey) and you want to sign with that regular key's custody account.
|
|
106
|
+
*/
|
|
107
|
+
signerAccount?: string;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Result of rawSignAndWait.
|
|
111
|
+
*/
|
|
112
|
+
export type RawSignAndWaitResult = {
|
|
113
|
+
/** The signature in uppercase hex */
|
|
114
|
+
signature: string;
|
|
115
|
+
/** The compressed secp256k1 public key in uppercase hex */
|
|
116
|
+
signingPubKey: string;
|
|
117
|
+
/** The transaction with TxnSignature and SigningPubKey set, ready to submit */
|
|
118
|
+
signedTransaction: SubmittableTransaction;
|
|
119
|
+
};
|
|
120
|
+
export {};
|
|
121
|
+
/**
|
|
122
|
+
* Result of rawSignInnerBatchAndWait.
|
|
123
|
+
* Extends RawSignAndWaitResult with batch signer representations.
|
|
124
|
+
*/
|
|
125
|
+
/**
|
|
126
|
+
* Options for rawSignInnerBatch / rawSignInnerBatchAndWait: intent options + polling configuration.
|
|
127
|
+
*
|
|
128
|
+
* When `accountId` and `ledgerId` are provided, the address-to-account lookup is
|
|
129
|
+
* skipped, saving an API call.
|
|
130
|
+
*/
|
|
131
|
+
//# sourceMappingURL=xrpl.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xrpl.types.d.ts","sourceRoot":"","sources":["../../../src/services/xrpl/xrpl.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,sBAAsB,EACtB,QAAQ,EACT,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEtE;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,YAAY,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,oBAAoB,CAAA;AAItE,MAAM,MAAM,0BAA0B,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,4BAA4B,CAAC,CAAA;AAE5F,MAAM,MAAM,cAAc,GAAG,QAAQ,CACnC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,0BAA0B,EAAE,MAAM,CAAC,CACpE,CAAA;AAID,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,6BAA6B,CAAC,CAAA;AAE9F,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CACrC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,G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