@rhinestone/sdk 2.0.0-beta.44 → 2.0.0-beta.46
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/dist/src/accounts/adapter.d.ts +31 -0
- package/dist/src/accounts/adapter.d.ts.map +1 -0
- package/dist/src/accounts/adapters/eoa.d.ts +4 -0
- package/dist/src/accounts/adapters/eoa.d.ts.map +1 -0
- package/dist/src/accounts/adapters/eoa.js +45 -0
- package/dist/src/accounts/adapters/hca.d.ts +5 -0
- package/dist/src/accounts/adapters/hca.d.ts.map +1 -0
- package/dist/src/accounts/adapters/hca.js +118 -0
- package/dist/src/accounts/adapters/kernel.d.ts +9 -0
- package/dist/src/accounts/adapters/kernel.d.ts.map +1 -0
- package/dist/src/accounts/adapters/kernel.js +159 -0
- package/dist/src/accounts/adapters/nexus.d.ts +17 -0
- package/dist/src/accounts/adapters/nexus.d.ts.map +1 -0
- package/dist/src/accounts/adapters/nexus.js +227 -0
- package/dist/src/accounts/adapters/safe.d.ts +6 -0
- package/dist/src/accounts/adapters/safe.d.ts.map +1 -0
- package/dist/src/accounts/adapters/safe.js +194 -0
- package/dist/src/accounts/adapters/shared.d.ts +9 -0
- package/dist/src/accounts/adapters/shared.d.ts.map +1 -0
- package/dist/src/accounts/adapters/shared.js +62 -0
- package/dist/src/accounts/adapters/startale.d.ts +14 -0
- package/dist/src/accounts/adapters/startale.d.ts.map +1 -0
- package/dist/src/accounts/adapters/startale.js +165 -0
- package/dist/src/accounts/construction.d.ts +25 -0
- package/dist/src/accounts/construction.d.ts.map +1 -0
- package/dist/src/accounts/construction.js +34 -0
- package/dist/src/accounts/deployment.d.ts +12 -0
- package/dist/src/accounts/deployment.d.ts.map +1 -0
- package/dist/src/accounts/deployment.js +33 -0
- package/dist/src/accounts/erc7579-calls.d.ts +4 -0
- package/dist/src/accounts/erc7579-calls.d.ts.map +1 -0
- package/dist/src/accounts/erc7579-calls.js +57 -0
- package/dist/src/accounts/error.d.ts +1 -1
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/legacy.d.ts +14 -0
- package/dist/src/accounts/legacy.d.ts.map +1 -0
- package/dist/src/accounts/legacy.js +40 -0
- package/dist/src/accounts/registry.d.ts +4 -0
- package/dist/src/accounts/registry.d.ts.map +1 -0
- package/dist/src/accounts/registry.js +22 -0
- package/dist/src/accounts/types.d.ts +131 -0
- package/dist/src/accounts/types.d.ts.map +1 -0
- package/dist/src/accounts/wallet-account.d.ts +3 -0
- package/dist/src/accounts/wallet-account.d.ts.map +1 -0
- package/dist/src/accounts/wallet-account.js +12 -0
- package/dist/src/actions/deploy.d.ts +4 -0
- package/dist/src/actions/deploy.d.ts.map +1 -0
- package/dist/src/actions/deploy.js +8 -0
- package/dist/src/actions/ecdsa.d.ts +1 -1
- package/dist/src/actions/ecdsa.d.ts.map +1 -1
- package/dist/src/actions/ecdsa.js +8 -8
- package/dist/src/actions/index.d.ts +2 -16
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +3 -49
- package/dist/src/actions/mfa.d.ts +1 -1
- package/dist/src/actions/mfa.d.ts.map +1 -1
- package/dist/src/actions/mfa.js +30 -10
- package/dist/src/actions/modules.d.ts +4 -0
- package/dist/src/actions/modules.d.ts.map +1 -0
- package/dist/src/actions/modules.js +22 -0
- package/dist/src/actions/passkeys.d.ts +2 -2
- package/dist/src/actions/passkeys.d.ts.map +1 -1
- package/dist/src/actions/passkeys.js +19 -14
- package/dist/src/actions/runtime.d.ts +12 -0
- package/dist/src/actions/runtime.d.ts.map +1 -0
- package/dist/src/actions/runtime.js +161 -0
- package/dist/src/actions/smart-sessions.d.ts +2 -2
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +35 -12
- package/dist/src/api/account.d.ts +265 -0
- package/dist/src/api/account.d.ts.map +1 -0
- package/dist/src/api/account.js +640 -0
- package/dist/src/api/accounts.d.ts +12 -0
- package/dist/src/api/accounts.d.ts.map +1 -0
- package/dist/src/api/accounts.js +17 -0
- package/dist/src/api/compose-types.d.ts +147 -0
- package/dist/src/api/compose-types.d.ts.map +1 -0
- package/dist/src/api/compose.d.ts +6 -0
- package/dist/src/api/compose.d.ts.map +1 -0
- package/dist/src/api/compose.js +766 -0
- package/dist/src/api/direct-signing.d.ts +27 -0
- package/dist/src/api/direct-signing.d.ts.map +1 -0
- package/dist/src/api/direct-signing.js +191 -0
- package/dist/src/api/project-mappers.d.ts +7 -0
- package/dist/src/api/project-mappers.d.ts.map +1 -0
- package/dist/src/api/project-mappers.js +23 -0
- package/dist/src/api/queries/app-fees.d.ts +4 -0
- package/dist/src/api/queries/app-fees.d.ts.map +1 -0
- package/dist/src/api/queries/app-fees.js +3 -0
- package/dist/src/api/queries/portfolio.d.ts +9 -0
- package/dist/src/api/queries/portfolio.d.ts.map +1 -0
- package/dist/src/api/queries/portfolio.js +28 -0
- package/dist/src/api/queries/session.d.ts +8 -0
- package/dist/src/api/queries/session.d.ts.map +1 -0
- package/dist/src/api/queries/session.js +15 -0
- package/dist/src/api/sdk.d.ts +80 -0
- package/dist/src/api/sdk.d.ts.map +1 -0
- package/dist/src/api/sdk.js +103 -0
- package/dist/src/api/signer-selection.d.ts +7 -0
- package/dist/src/api/signer-selection.d.ts.map +1 -0
- package/dist/src/api/signer-selection.js +109 -0
- package/dist/src/calls/normalize.d.ts +9 -0
- package/dist/src/calls/normalize.d.ts.map +1 -0
- package/dist/src/calls/normalize.js +17 -0
- package/dist/src/calls/resolve.d.ts +3 -0
- package/dist/src/calls/resolve.d.ts.map +1 -0
- package/dist/src/calls/resolve.js +15 -0
- package/dist/src/calls/types.d.ts +25 -0
- package/dist/src/calls/types.d.ts.map +1 -0
- package/dist/src/calls/types.js +1 -0
- package/dist/src/chains/caip2.d.ts +10 -0
- package/dist/src/chains/caip2.d.ts.map +1 -0
- package/dist/src/chains/caip2.js +85 -0
- package/dist/src/chains/catalog.d.ts +5 -0
- package/dist/src/chains/catalog.d.ts.map +1 -0
- package/dist/src/chains/catalog.js +41 -0
- package/dist/src/chains/errors.d.ts +15 -0
- package/dist/src/chains/errors.d.ts.map +1 -0
- package/dist/src/chains/errors.js +21 -0
- package/dist/src/{orchestrator/destinations.d.ts → chains/non-evm.d.ts} +7 -5
- package/dist/src/chains/non-evm.d.ts.map +1 -0
- package/dist/src/chains/non-evm.js +30 -0
- package/dist/src/chains/tokens.d.ts +4 -0
- package/dist/src/chains/tokens.d.ts.map +1 -0
- package/dist/src/chains/tokens.js +22 -0
- package/dist/src/chains/types.d.ts +25 -0
- package/dist/src/chains/types.d.ts.map +1 -0
- package/dist/src/chains/types.js +1 -0
- package/dist/src/clients/bundler/client.d.ts +10 -0
- package/dist/src/clients/bundler/client.d.ts.map +1 -0
- package/dist/src/clients/bundler/client.js +85 -0
- package/dist/src/clients/bundler/endpoints.d.ts +3 -0
- package/dist/src/clients/bundler/endpoints.d.ts.map +1 -0
- package/dist/src/clients/bundler/endpoints.js +18 -0
- package/dist/src/clients/bundler/port.d.ts +22 -0
- package/dist/src/clients/bundler/port.d.ts.map +1 -0
- package/dist/src/clients/bundler/port.js +1 -0
- package/dist/src/clients/json-rpc.d.ts +20 -0
- package/dist/src/clients/json-rpc.d.ts.map +1 -0
- package/dist/src/clients/json-rpc.js +56 -0
- package/dist/src/clients/orchestrator/auth.d.ts +7 -0
- package/dist/src/clients/orchestrator/auth.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/auth.js +27 -0
- package/dist/src/{orchestrator → clients/orchestrator}/chain-catalog.d.ts +5 -3
- package/dist/src/clients/orchestrator/chain-catalog.d.ts.map +1 -0
- package/dist/src/{orchestrator → clients/orchestrator}/chain-catalog.js +24 -3
- package/dist/src/clients/orchestrator/client.d.ts +13 -0
- package/dist/src/clients/orchestrator/client.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/client.js +97 -0
- package/dist/src/{orchestrator/error.d.ts → clients/orchestrator/errors.d.ts} +2 -16
- package/dist/src/clients/orchestrator/errors.d.ts.map +1 -0
- package/dist/src/{orchestrator/error.js → clients/orchestrator/errors.js} +1 -22
- package/dist/src/clients/orchestrator/fetch.d.ts +7 -0
- package/dist/src/clients/orchestrator/fetch.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/fetch.js +37 -0
- package/dist/src/clients/orchestrator/mappers.d.ts +9 -0
- package/dist/src/clients/orchestrator/mappers.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/mappers.js +198 -0
- package/dist/src/clients/orchestrator/port.d.ts +26 -0
- package/dist/src/clients/orchestrator/port.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/port.js +1 -0
- package/dist/src/{orchestrator/types.d.ts → clients/orchestrator/public.d.ts} +16 -4
- package/dist/src/clients/orchestrator/public.d.ts.map +1 -0
- package/dist/src/{orchestrator/types.js → clients/orchestrator/public.js} +3 -0
- package/dist/src/clients/orchestrator/types.d.ts +144 -0
- package/dist/src/clients/orchestrator/types.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/types.js +1 -0
- package/dist/src/clients/orchestrator/wire.d.ts +19 -0
- package/dist/src/clients/orchestrator/wire.d.ts.map +1 -0
- package/dist/src/{orchestrator → clients/orchestrator}/wire.gen.d.ts +1193 -499
- package/dist/src/clients/orchestrator/wire.gen.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/wire.gen.js +1 -0
- package/dist/src/clients/orchestrator/wire.js +1 -0
- package/dist/src/clients/paymaster/client.d.ts +8 -0
- package/dist/src/clients/paymaster/client.d.ts.map +1 -0
- package/dist/src/clients/paymaster/client.js +38 -0
- package/dist/src/clients/paymaster/endpoints.d.ts +3 -0
- package/dist/src/clients/paymaster/endpoints.d.ts.map +1 -0
- package/dist/src/clients/paymaster/endpoints.js +16 -0
- package/dist/src/clients/paymaster/port.d.ts +17 -0
- package/dist/src/clients/paymaster/port.d.ts.map +1 -0
- package/dist/src/clients/paymaster/port.js +1 -0
- package/dist/src/clients/rpc/client.d.ts +6 -0
- package/dist/src/clients/rpc/client.d.ts.map +1 -0
- package/dist/src/clients/rpc/client.js +66 -0
- package/dist/src/clients/rpc/compatibility.d.ts +12 -0
- package/dist/src/clients/rpc/compatibility.d.ts.map +1 -0
- package/dist/src/clients/rpc/compatibility.js +16 -0
- package/dist/src/clients/rpc/port.d.ts +13 -0
- package/dist/src/clients/rpc/port.d.ts.map +1 -0
- package/dist/src/clients/rpc/port.js +1 -0
- package/dist/src/clients/rpc/providers.d.ts +3 -0
- package/dist/src/clients/rpc/providers.d.ts.map +1 -0
- package/dist/src/clients/rpc/providers.js +8 -0
- package/dist/src/clients/rpc/transport.d.ts +4 -0
- package/dist/src/clients/rpc/transport.d.ts.map +1 -0
- package/dist/src/clients/rpc/transport.js +5 -0
- package/dist/src/clients/rpc/types.d.ts +23 -0
- package/dist/src/clients/rpc/types.d.ts.map +1 -0
- package/dist/src/clients/rpc/types.js +1 -0
- package/dist/src/config/account-runtime.d.ts +7 -0
- package/dist/src/config/account-runtime.d.ts.map +1 -0
- package/dist/src/config/account-runtime.js +36 -0
- package/dist/src/{types.d.ts → config/account.d.ts} +37 -14
- package/dist/src/config/account.d.ts.map +1 -0
- package/dist/src/config/account.js +10 -0
- package/dist/src/config/defaults.d.ts +14 -0
- package/dist/src/config/defaults.d.ts.map +1 -0
- package/dist/src/config/defaults.js +26 -0
- package/dist/src/config/input.d.ts +54 -0
- package/dist/src/config/input.d.ts.map +1 -0
- package/dist/src/config/input.js +1 -0
- package/dist/src/config/legacy.d.ts +22 -0
- package/dist/src/config/legacy.d.ts.map +1 -0
- package/dist/src/config/legacy.js +23 -0
- package/dist/src/config/resolve.d.ts +13 -0
- package/dist/src/config/resolve.d.ts.map +1 -0
- package/dist/src/config/resolve.js +174 -0
- package/dist/src/config/resolved.d.ts +77 -0
- package/dist/src/config/resolved.d.ts.map +1 -0
- package/dist/src/config/resolved.js +1 -0
- package/dist/src/config/validate.d.ts +3 -0
- package/dist/src/config/validate.d.ts.map +1 -0
- package/dist/src/config/validate.js +6 -0
- package/dist/src/{execution/error.d.ts → errors/execution.d.ts} +2 -2
- package/dist/src/errors/execution.d.ts.map +1 -0
- package/dist/src/{execution/error.js → errors/execution.js} +1 -1
- package/dist/src/errors/index.d.ts +4 -4
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +4 -3
- package/dist/src/index.d.ts +13 -324
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -286
- package/dist/src/modules/erc7579-abi.d.ts +4 -0
- package/dist/src/modules/erc7579-abi.d.ts.map +1 -0
- package/dist/src/modules/erc7579-abi.js +12 -0
- package/dist/src/modules/intent-executor.d.ts +6 -0
- package/dist/src/modules/intent-executor.d.ts.map +1 -0
- package/dist/src/modules/intent-executor.js +13 -0
- package/dist/src/modules/legacy-core.d.ts +29 -0
- package/dist/src/modules/legacy-core.d.ts.map +1 -0
- package/dist/src/modules/legacy-core.js +80 -0
- package/dist/src/modules/normalize.d.ts +4 -0
- package/dist/src/modules/normalize.d.ts.map +1 -0
- package/dist/src/modules/normalize.js +15 -0
- package/dist/src/modules/plan.d.ts +16 -0
- package/dist/src/modules/plan.d.ts.map +1 -0
- package/dist/src/modules/plan.js +51 -0
- package/dist/src/modules/read-core.d.ts +39 -0
- package/dist/src/modules/read-core.d.ts.map +1 -0
- package/dist/src/modules/read-core.js +149 -0
- package/dist/src/modules/types.d.ts +46 -0
- package/dist/src/modules/types.d.ts.map +1 -0
- package/dist/src/modules/types.js +1 -0
- package/dist/src/modules/validators/capabilities.d.ts +4 -0
- package/dist/src/modules/validators/capabilities.d.ts.map +1 -0
- package/dist/src/modules/validators/capabilities.js +58 -0
- package/dist/src/modules/validators/contribution.d.ts +4 -0
- package/dist/src/modules/validators/contribution.d.ts.map +1 -0
- package/dist/src/modules/validators/contribution.js +64 -0
- package/dist/src/modules/validators/definition.d.ts +3 -0
- package/dist/src/modules/validators/definition.d.ts.map +1 -0
- package/dist/src/modules/validators/definition.js +68 -0
- package/dist/src/modules/validators/ens.d.ts +5 -0
- package/dist/src/modules/validators/ens.d.ts.map +1 -0
- package/dist/src/modules/validators/ens.js +34 -0
- package/dist/src/modules/validators/k1.d.ts +2 -0
- package/dist/src/modules/validators/k1.d.ts.map +1 -0
- package/dist/src/modules/validators/k1.js +1 -0
- package/dist/src/modules/validators/multi-factor.d.ts +18 -0
- package/dist/src/modules/validators/multi-factor.d.ts.map +1 -0
- package/dist/src/modules/validators/multi-factor.js +79 -0
- package/dist/src/modules/validators/ownable.d.ts +26 -0
- package/dist/src/modules/validators/ownable.d.ts.map +1 -0
- package/dist/src/modules/validators/ownable.js +84 -0
- package/dist/src/modules/validators/permissions.d.ts +1 -1
- package/dist/src/modules/validators/permissions.d.ts.map +1 -1
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts +1 -1
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -1
- package/dist/src/modules/validators/policies/claim/arbiters.js +3 -1
- package/dist/src/modules/validators/resolve.d.ts +5 -0
- package/dist/src/modules/validators/resolve.d.ts.map +1 -0
- package/dist/src/modules/validators/resolve.js +22 -0
- package/dist/src/modules/validators/signer-id.d.ts +5 -0
- package/dist/src/modules/validators/signer-id.d.ts.map +1 -0
- package/dist/src/modules/validators/signer-id.js +8 -0
- package/dist/src/modules/validators/smart-session-signature-types.d.ts +35 -0
- package/dist/src/modules/validators/smart-session-signature-types.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-session-signature-types.js +1 -0
- package/dist/src/modules/validators/smart-sessions/authorization.d.ts +99 -0
- package/dist/src/modules/validators/smart-sessions/authorization.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/authorization.js +101 -0
- package/dist/src/modules/validators/smart-sessions/calls.d.ts +19 -0
- package/dist/src/modules/validators/smart-sessions/calls.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/calls.js +85 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.d.ts +4 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.js +77 -0
- package/dist/src/modules/validators/smart-sessions/digest.d.ts +5 -0
- package/dist/src/modules/validators/smart-sessions/digest.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/digest.js +30 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.d.ts +10 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.js +31 -0
- package/dist/src/modules/validators/smart-sessions/module.d.ts +11 -0
- package/dist/src/modules/validators/smart-sessions/module.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/module.js +18 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.d.ts +23 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.js +29 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.d.ts +10 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.js +106 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.d.ts +4 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.js +197 -0
- package/dist/src/modules/validators/smart-sessions/resolve.d.ts +16 -0
- package/dist/src/modules/validators/smart-sessions/resolve.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/resolve.js +120 -0
- package/dist/src/modules/validators/smart-sessions/signature.d.ts +14 -0
- package/dist/src/modules/validators/smart-sessions/signature.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/signature.js +167 -0
- package/dist/src/modules/validators/smart-sessions/state.d.ts +19 -0
- package/dist/src/modules/validators/smart-sessions/state.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/state.js +42 -0
- package/dist/src/modules/validators/smart-sessions/types.d.ts +227 -0
- package/dist/src/modules/validators/smart-sessions/types.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/types.js +1 -0
- package/dist/src/modules/validators/types.d.ts +143 -0
- package/dist/src/modules/validators/types.d.ts.map +1 -0
- package/dist/src/modules/validators/types.js +1 -0
- package/dist/src/modules/validators/webauthn.d.ts +54 -0
- package/dist/src/modules/validators/webauthn.d.ts.map +1 -0
- package/dist/src/modules/validators/webauthn.js +159 -0
- package/dist/src/signing/context.d.ts +25 -0
- package/dist/src/signing/context.d.ts.map +1 -0
- package/dist/src/signing/context.js +163 -0
- package/dist/src/signing/contribution.d.ts +13 -0
- package/dist/src/signing/contribution.d.ts.map +1 -0
- package/dist/src/signing/contribution.js +83 -0
- package/dist/src/signing/eip7702.d.ts +41 -0
- package/dist/src/signing/eip7702.d.ts.map +1 -0
- package/dist/src/signing/eip7702.js +215 -0
- package/dist/src/signing/error.d.ts +27 -0
- package/dist/src/signing/error.d.ts.map +1 -0
- package/dist/src/signing/error.js +25 -0
- package/dist/src/signing/execute.d.ts +17 -0
- package/dist/src/signing/execute.d.ts.map +1 -0
- package/dist/src/signing/execute.js +138 -0
- package/dist/src/signing/intent-plans/assemble.d.ts +15 -0
- package/dist/src/signing/intent-plans/assemble.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/assemble.js +96 -0
- package/dist/src/signing/intent-plans/independent.d.ts +48 -0
- package/dist/src/signing/intent-plans/independent.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/independent.js +150 -0
- package/dist/src/signing/intent-plans/plan.d.ts +14 -0
- package/dist/src/signing/intent-plans/plan.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/plan.js +187 -0
- package/dist/src/signing/intent-plans/types.d.ts +63 -0
- package/dist/src/signing/intent-plans/types.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/types.js +1 -0
- package/dist/src/signing/message.d.ts +28 -0
- package/dist/src/signing/message.d.ts.map +1 -0
- package/dist/src/signing/message.js +90 -0
- package/dist/src/signing/passkeys.d.ts +28 -0
- package/dist/src/signing/passkeys.d.ts.map +1 -0
- package/dist/src/signing/passkeys.js +17 -0
- package/dist/src/signing/plan.d.ts +35 -0
- package/dist/src/signing/plan.d.ts.map +1 -0
- package/dist/src/signing/plan.js +377 -0
- package/dist/src/signing/protocols/erc6492.d.ts +11 -0
- package/dist/src/signing/protocols/erc6492.d.ts.map +1 -0
- package/dist/src/signing/protocols/erc6492.js +24 -0
- package/dist/src/signing/protocols/erc7739.d.ts +17 -0
- package/dist/src/signing/protocols/erc7739.d.ts.map +1 -0
- package/dist/src/signing/protocols/erc7739.js +84 -0
- package/dist/src/signing/session-enable.d.ts +35 -0
- package/dist/src/signing/session-enable.d.ts.map +1 -0
- package/dist/src/signing/session-enable.js +62 -0
- package/dist/src/signing/signers/compatibility.d.ts +4 -0
- package/dist/src/signing/signers/compatibility.d.ts.map +1 -0
- package/dist/src/signing/signers/compatibility.js +51 -0
- package/dist/src/signing/signers/ecdsa.d.ts +14 -0
- package/dist/src/signing/signers/ecdsa.d.ts.map +1 -0
- package/dist/src/signing/signers/ecdsa.js +54 -0
- package/dist/src/signing/signers/registry.d.ts +7 -0
- package/dist/src/signing/signers/registry.d.ts.map +1 -0
- package/dist/src/signing/signers/registry.js +33 -0
- package/dist/src/signing/signers/types.d.ts +16 -0
- package/dist/src/signing/signers/types.d.ts.map +1 -0
- package/dist/src/signing/signers/types.js +1 -0
- package/dist/src/signing/signers/wallet-chain.d.ts +9 -0
- package/dist/src/signing/signers/wallet-chain.d.ts.map +1 -0
- package/dist/src/signing/signers/wallet-chain.js +15 -0
- package/dist/src/signing/signers/webauthn.d.ts +11 -0
- package/dist/src/signing/signers/webauthn.d.ts.map +1 -0
- package/dist/src/signing/signers/webauthn.js +14 -0
- package/dist/src/signing/typed-data.d.ts +39 -0
- package/dist/src/signing/typed-data.d.ts.map +1 -0
- package/dist/src/signing/typed-data.js +135 -0
- package/dist/src/signing/types.d.ts +346 -0
- package/dist/src/signing/types.d.ts.map +1 -0
- package/dist/src/signing/types.js +1 -0
- package/dist/src/signing/user-operation.d.ts +23 -0
- package/dist/src/signing/user-operation.d.ts.map +1 -0
- package/dist/src/signing/user-operation.js +61 -0
- package/dist/src/smart-sessions/index.d.ts +13 -3
- package/dist/src/smart-sessions/index.d.ts.map +1 -1
- package/dist/src/smart-sessions/index.js +44 -6
- package/dist/src/transactions/intents/account.d.ts +15 -0
- package/dist/src/transactions/intents/account.d.ts.map +1 -0
- package/dist/src/transactions/intents/account.js +48 -0
- package/dist/src/transactions/intents/compatibility.d.ts +4 -0
- package/dist/src/transactions/intents/compatibility.d.ts.map +1 -0
- package/dist/src/transactions/intents/compatibility.js +19 -0
- package/dist/src/transactions/intents/normalize.d.ts +5 -0
- package/dist/src/transactions/intents/normalize.d.ts.map +1 -0
- package/dist/src/transactions/intents/normalize.js +48 -0
- package/dist/src/transactions/intents/prepare.d.ts +7 -0
- package/dist/src/transactions/intents/prepare.d.ts.map +1 -0
- package/dist/src/transactions/intents/prepare.js +249 -0
- package/dist/src/transactions/intents/quotes.d.ts +3 -0
- package/dist/src/transactions/intents/quotes.d.ts.map +1 -0
- package/dist/src/transactions/intents/quotes.js +11 -0
- package/dist/src/transactions/intents/request.d.ts +11 -0
- package/dist/src/transactions/intents/request.d.ts.map +1 -0
- package/dist/src/transactions/intents/request.js +55 -0
- package/dist/src/transactions/intents/send.d.ts +3 -0
- package/dist/src/transactions/intents/send.d.ts.map +1 -0
- package/dist/src/transactions/intents/send.js +22 -0
- package/dist/src/transactions/intents/session-signing.d.ts +7 -0
- package/dist/src/transactions/intents/session-signing.d.ts.map +1 -0
- package/dist/src/transactions/intents/session-signing.js +363 -0
- package/dist/src/transactions/intents/sessions.d.ts +17 -0
- package/dist/src/transactions/intents/sessions.d.ts.map +1 -0
- package/dist/src/transactions/intents/sessions.js +85 -0
- package/dist/src/transactions/intents/sign-transaction.d.ts +10 -0
- package/dist/src/transactions/intents/sign-transaction.d.ts.map +1 -0
- package/dist/src/transactions/intents/sign-transaction.js +386 -0
- package/dist/src/transactions/intents/split.d.ts +13 -0
- package/dist/src/transactions/intents/split.d.ts.map +1 -0
- package/dist/src/transactions/intents/split.js +3 -0
- package/dist/src/transactions/intents/status-policy.d.ts +13 -0
- package/dist/src/transactions/intents/status-policy.d.ts.map +1 -0
- package/dist/src/transactions/intents/status-policy.js +39 -0
- package/dist/src/transactions/intents/status.d.ts +4 -0
- package/dist/src/transactions/intents/status.d.ts.map +1 -0
- package/dist/src/transactions/intents/status.js +50 -0
- package/dist/src/transactions/intents/submit.d.ts +3 -0
- package/dist/src/transactions/intents/submit.d.ts.map +1 -0
- package/dist/src/transactions/intents/submit.js +32 -0
- package/dist/src/transactions/intents/types.d.ts +136 -0
- package/dist/src/transactions/intents/types.d.ts.map +1 -0
- package/dist/src/transactions/intents/types.js +1 -0
- package/dist/src/transactions/user-operations/hash.d.ts +5 -0
- package/dist/src/transactions/user-operations/hash.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/hash.js +9 -0
- package/dist/src/transactions/user-operations/nonce.d.ts +18 -0
- package/dist/src/transactions/user-operations/nonce.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/nonce.js +43 -0
- package/dist/src/transactions/user-operations/prepare.d.ts +12 -0
- package/dist/src/transactions/user-operations/prepare.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/prepare.js +138 -0
- package/dist/src/transactions/user-operations/reconstruct.d.ts +28 -0
- package/dist/src/transactions/user-operations/reconstruct.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/reconstruct.js +52 -0
- package/dist/src/transactions/user-operations/send.d.ts +3 -0
- package/dist/src/transactions/user-operations/send.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/send.js +8 -0
- package/dist/src/transactions/user-operations/sign.d.ts +3 -0
- package/dist/src/transactions/user-operations/sign.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/sign.js +14 -0
- package/dist/src/transactions/user-operations/status.d.ts +4 -0
- package/dist/src/transactions/user-operations/status.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/status.js +37 -0
- package/dist/src/transactions/user-operations/submit.d.ts +3 -0
- package/dist/src/transactions/user-operations/submit.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/submit.js +8 -0
- package/dist/src/transactions/user-operations/types.d.ts +68 -0
- package/dist/src/transactions/user-operations/types.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/types.js +1 -0
- package/dist/src/transactions/user-operations/validator-account.d.ts +5 -0
- package/dist/src/transactions/user-operations/validator-account.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/validator-account.js +26 -0
- package/dist/src/utils/index.d.ts +9 -4
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +54 -51
- package/package.json +3 -3
- package/dist/src/accounts/hca.d.ts +0 -25
- package/dist/src/accounts/hca.d.ts.map +0 -1
- package/dist/src/accounts/hca.js +0 -148
- package/dist/src/accounts/index.d.ts +0 -64
- package/dist/src/accounts/index.d.ts.map +0 -1
- package/dist/src/accounts/index.js +0 -680
- package/dist/src/accounts/json-rpc/index.d.ts +0 -5
- package/dist/src/accounts/json-rpc/index.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.js +0 -13
- package/dist/src/accounts/json-rpc/providers.d.ts +0 -3
- package/dist/src/accounts/json-rpc/providers.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.js +0 -4
- package/dist/src/accounts/kernel.d.ts +0 -26
- package/dist/src/accounts/kernel.d.ts.map +0 -1
- package/dist/src/accounts/kernel.js +0 -265
- package/dist/src/accounts/nexus.d.ts +0 -34
- package/dist/src/accounts/nexus.d.ts.map +0 -1
- package/dist/src/accounts/nexus.js +0 -520
- package/dist/src/accounts/safe.d.ts +0 -32
- package/dist/src/accounts/safe.d.ts.map +0 -1
- package/dist/src/accounts/safe.js +0 -337
- package/dist/src/accounts/signing/common.d.ts +0 -38
- package/dist/src/accounts/signing/common.d.ts.map +0 -1
- package/dist/src/accounts/signing/common.js +0 -186
- package/dist/src/accounts/signing/message.d.ts +0 -7
- package/dist/src/accounts/signing/message.d.ts.map +0 -1
- package/dist/src/accounts/signing/message.js +0 -42
- package/dist/src/accounts/signing/passkeys.d.ts +0 -36
- package/dist/src/accounts/signing/passkeys.d.ts.map +0 -1
- package/dist/src/accounts/signing/passkeys.js +0 -119
- package/dist/src/accounts/signing/typedData.d.ts +0 -5
- package/dist/src/accounts/signing/typedData.d.ts.map +0 -1
- package/dist/src/accounts/signing/typedData.js +0 -30
- package/dist/src/accounts/startale.d.ts +0 -25
- package/dist/src/accounts/startale.d.ts.map +0 -1
- package/dist/src/accounts/startale.js +0 -188
- package/dist/src/accounts/utils.d.ts +0 -33
- package/dist/src/accounts/utils.d.ts.map +0 -1
- package/dist/src/accounts/utils.js +0 -202
- package/dist/src/auth/provider.d.ts +0 -7
- package/dist/src/auth/provider.d.ts.map +0 -1
- package/dist/src/auth/provider.js +0 -38
- package/dist/src/execution/compact.d.ts +0 -5
- package/dist/src/execution/compact.d.ts.map +0 -1
- package/dist/src/execution/compact.js +0 -4
- package/dist/src/execution/error.d.ts.map +0 -1
- package/dist/src/execution/index.d.ts +0 -42
- package/dist/src/execution/index.d.ts.map +0 -1
- package/dist/src/execution/index.js +0 -186
- package/dist/src/execution/utils.d.ts +0 -167
- package/dist/src/execution/utils.d.ts.map +0 -1
- package/dist/src/execution/utils.js +0 -1603
- package/dist/src/modules/abi/smart-sessions.d.ts +0 -104
- package/dist/src/modules/abi/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/abi/smart-sessions.js +0 -128
- package/dist/src/modules/chain-abstraction.d.ts +0 -5
- package/dist/src/modules/chain-abstraction.d.ts.map +0 -1
- package/dist/src/modules/chain-abstraction.js +0 -3
- package/dist/src/modules/common.d.ts +0 -30
- package/dist/src/modules/common.d.ts.map +0 -1
- package/dist/src/modules/common.js +0 -30
- package/dist/src/modules/index.d.ts +0 -11
- package/dist/src/modules/index.d.ts.map +0 -1
- package/dist/src/modules/index.js +0 -85
- package/dist/src/modules/legacy.d.ts +0 -10
- package/dist/src/modules/legacy.d.ts.map +0 -1
- package/dist/src/modules/legacy.js +0 -62
- package/dist/src/modules/read.d.ts +0 -11
- package/dist/src/modules/read.d.ts.map +0 -1
- package/dist/src/modules/read.js +0 -219
- package/dist/src/modules/validators/core.d.ts +0 -31
- package/dist/src/modules/validators/core.d.ts.map +0 -1
- package/dist/src/modules/validators/core.js +0 -269
- package/dist/src/modules/validators/cross-chain-permits.d.ts +0 -22
- package/dist/src/modules/validators/cross-chain-permits.d.ts.map +0 -1
- package/dist/src/modules/validators/cross-chain-permits.js +0 -107
- package/dist/src/modules/validators/index.d.ts +0 -4
- package/dist/src/modules/validators/index.d.ts.map +0 -1
- package/dist/src/modules/validators/index.js +0 -3
- package/dist/src/modules/validators/smart-sessions.d.ts +0 -226
- package/dist/src/modules/validators/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.js +0 -1197
- package/dist/src/orchestrator/caip2.d.ts +0 -18
- package/dist/src/orchestrator/caip2.d.ts.map +0 -1
- package/dist/src/orchestrator/caip2.js +0 -58
- package/dist/src/orchestrator/chain-catalog.d.ts.map +0 -1
- package/dist/src/orchestrator/client.d.ts +0 -43
- package/dist/src/orchestrator/client.d.ts.map +0 -1
- package/dist/src/orchestrator/client.js +0 -336
- package/dist/src/orchestrator/consts.d.ts +0 -6
- package/dist/src/orchestrator/consts.d.ts.map +0 -1
- package/dist/src/orchestrator/consts.js +0 -5
- package/dist/src/orchestrator/destinations.d.ts.map +0 -1
- package/dist/src/orchestrator/destinations.js +0 -59
- package/dist/src/orchestrator/error.d.ts.map +0 -1
- package/dist/src/orchestrator/index.d.ts +0 -12
- package/dist/src/orchestrator/index.d.ts.map +0 -1
- package/dist/src/orchestrator/index.js +0 -9
- package/dist/src/orchestrator/registry.d.ts +0 -7
- package/dist/src/orchestrator/registry.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.js +0 -46
- package/dist/src/orchestrator/types.d.ts.map +0 -1
- package/dist/src/orchestrator/utils.d.ts +0 -3
- package/dist/src/orchestrator/utils.d.ts.map +0 -1
- package/dist/src/orchestrator/utils.js +0 -22
- package/dist/src/orchestrator/wire.d.ts +0 -31
- package/dist/src/orchestrator/wire.d.ts.map +0 -1
- package/dist/src/orchestrator/wire.gen.d.ts.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/utils/walletClient.d.ts +0 -34
- package/dist/src/utils/walletClient.d.ts.map +0 -1
- package/dist/src/utils/walletClient.js +0 -117
- /package/dist/src/{orchestrator/wire.gen.js → accounts/adapter.js} +0 -0
- /package/dist/src/{types.js → accounts/types.js} +0 -0
- /package/dist/src/{orchestrator/wire.js → api/compose-types.js} +0 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { IndependentSigningNotSupportedError, InvalidOwnerSigningOptionsError, UnknownOwnerError, } from '../../errors/execution.js';
|
|
2
|
+
import { encodeValidatorId } from '../../modules/validators/multi-factor.js';
|
|
3
|
+
import { createAccountSigningContext, getAccountSignatureEnvelope, getSigningValidatorCodec, getSigningValidatorFactors, } from '../../signing/context.js';
|
|
4
|
+
import { executeSigningPlan } from '../../signing/execute.js';
|
|
5
|
+
import { assembleIndependentIntentArtifact, } from '../../signing/intent-plans/independent.js';
|
|
6
|
+
import { createIntentSigningPlan, executeIntentSigning, projectIndependentSigning, } from '../../signing/intent-plans/plan.js';
|
|
7
|
+
import { createValidatorSigningTasks } from '../../signing/plan.js';
|
|
8
|
+
import { resolveAccountTypedDataSigning } from '../../signing/typed-data.js';
|
|
9
|
+
import { buildSessionIntentPlanInput, createIntentSessionSignerInvoker, } from './session-signing.js';
|
|
10
|
+
export async function signIntent(context, prepared) {
|
|
11
|
+
const runtime = await context.account.forChain(prepared.accountChain);
|
|
12
|
+
const ownerSelection = prepared.input.signers?.kind === 'owner'
|
|
13
|
+
? prepared.input.signers
|
|
14
|
+
: undefined;
|
|
15
|
+
const signerInvoker = prepared.resolvedSessions
|
|
16
|
+
? createIntentSessionSignerInvoker(prepared, context.signerInvoker)
|
|
17
|
+
: context.signerInvoker;
|
|
18
|
+
const signing = createAccountSigningContext({
|
|
19
|
+
runtime,
|
|
20
|
+
purpose: 'intent',
|
|
21
|
+
signerInvoker,
|
|
22
|
+
...(ownerSelection ? { selection: ownerSelection } : {}),
|
|
23
|
+
});
|
|
24
|
+
const planInput = prepared.resolvedSessions
|
|
25
|
+
? buildSessionIntentPlanInput(prepared, signing)
|
|
26
|
+
: buildIntentPlanInput(prepared, signing);
|
|
27
|
+
const transcript = await executeIntentSigning({
|
|
28
|
+
planInput,
|
|
29
|
+
context: signing,
|
|
30
|
+
checkpoints: context.checkpoints,
|
|
31
|
+
});
|
|
32
|
+
const outputs = Object.assign({}, ...transcript.stages.map((stage) => stage.outputs));
|
|
33
|
+
return {
|
|
34
|
+
prepared,
|
|
35
|
+
originSignatures: prepared.signing.origins.map((_origin, index) => requireOriginSignature(outputs[`origin-${index}`])),
|
|
36
|
+
destinationSignature: requireHex(outputs.destination, 'destination'),
|
|
37
|
+
...(prepared.signing.target
|
|
38
|
+
? { targetSignature: requireHex(outputs.target, 'target') }
|
|
39
|
+
: {}),
|
|
40
|
+
transcript,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export async function signIntentAsOwner(context, prepared, selection) {
|
|
44
|
+
const { signing, planInput } = await createIndependentSigningInput(context, prepared);
|
|
45
|
+
const owner = findIndependentOwner(signing, selection);
|
|
46
|
+
const { plan } = projectIndependentSigning(createIntentSigningPlan(planInput), [selection.signerId], [`${owner.ownerId}`]);
|
|
47
|
+
const transcript = await executeSigningPlan({
|
|
48
|
+
plan,
|
|
49
|
+
payloads: planInput.payloads,
|
|
50
|
+
checkpoints: context.checkpoints,
|
|
51
|
+
signerInvoker: signing.signerInvoker,
|
|
52
|
+
assembleStage: () => ({}),
|
|
53
|
+
});
|
|
54
|
+
const origin = prepared.signing.origins.map((_payload, index) => {
|
|
55
|
+
const stage = transcript.stages.find(({ stage: materialized }) => materialized.stageId === `origin-${index}`);
|
|
56
|
+
const result = stage
|
|
57
|
+
? Object.entries(stage.results).find(([taskId]) => taskId.includes(owner.ownerId))?.[1]
|
|
58
|
+
: undefined;
|
|
59
|
+
return independentOriginResult(owner, result);
|
|
60
|
+
});
|
|
61
|
+
const signature = owner.kind === 'ecdsa'
|
|
62
|
+
? {
|
|
63
|
+
kind: 'ecdsa',
|
|
64
|
+
signer: owner.identity,
|
|
65
|
+
origin: origin,
|
|
66
|
+
}
|
|
67
|
+
: {
|
|
68
|
+
kind: 'passkey',
|
|
69
|
+
publicKey: owner.identity,
|
|
70
|
+
origin: origin,
|
|
71
|
+
};
|
|
72
|
+
return owner.factorPublicId === undefined
|
|
73
|
+
? { intentId: prepared.quote.intentId, ...signature }
|
|
74
|
+
: {
|
|
75
|
+
intentId: prepared.quote.intentId,
|
|
76
|
+
kind: 'multi-factor',
|
|
77
|
+
validatorId: owner.factorPublicId,
|
|
78
|
+
signature,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export async function assembleIntent(context, prepared, signatures) {
|
|
82
|
+
const { signing, planInput } = await createIndependentSigningInput(context, prepared);
|
|
83
|
+
const plan = createIntentSigningPlan(planInput);
|
|
84
|
+
const owners = independentOwners(signing);
|
|
85
|
+
const assembled = Object.fromEntries(prepared.signing.origins.map((_payload, index) => {
|
|
86
|
+
const artifact = plan.stages
|
|
87
|
+
.flatMap(({ artifacts }) => artifacts)
|
|
88
|
+
.find(({ id }) => id === `origin-${index}`);
|
|
89
|
+
if (!artifact) {
|
|
90
|
+
throw new Error(`Intent origin-${index} assembly route is missing`);
|
|
91
|
+
}
|
|
92
|
+
return [
|
|
93
|
+
artifact.id,
|
|
94
|
+
assembleIndependentIntentArtifact({
|
|
95
|
+
intentId: prepared.quote.intentId,
|
|
96
|
+
originIndex: index,
|
|
97
|
+
originCount: prepared.signing.origins.length,
|
|
98
|
+
signatures,
|
|
99
|
+
owners,
|
|
100
|
+
artifact,
|
|
101
|
+
context: signing,
|
|
102
|
+
}),
|
|
103
|
+
];
|
|
104
|
+
}));
|
|
105
|
+
if (prepared.signing.target) {
|
|
106
|
+
throw new IndependentSigningNotSupportedError();
|
|
107
|
+
}
|
|
108
|
+
const destination = prepared.signing.destination;
|
|
109
|
+
if (!destination || destination.mode !== 'reuse-origin') {
|
|
110
|
+
throw new IndependentSigningNotSupportedError();
|
|
111
|
+
}
|
|
112
|
+
const destinationSignature = assembled[destination.originArtifactId];
|
|
113
|
+
if (!destinationSignature) {
|
|
114
|
+
throw new Error('Intent destination signature is missing');
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
prepared,
|
|
118
|
+
originSignatures: prepared.signing.origins.map((_origin, index) => {
|
|
119
|
+
const signature = assembled[`origin-${index}`];
|
|
120
|
+
if (!signature)
|
|
121
|
+
throw new Error(`Intent origin-${index} is missing`);
|
|
122
|
+
return signature;
|
|
123
|
+
}),
|
|
124
|
+
destinationSignature,
|
|
125
|
+
transcript: {
|
|
126
|
+
planKind: 'intent-full',
|
|
127
|
+
payloadId: plan.payload.id,
|
|
128
|
+
stages: [],
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
async function createIndependentSigningInput(context, prepared) {
|
|
133
|
+
if (prepared.resolvedSessions) {
|
|
134
|
+
throw new IndependentSigningNotSupportedError();
|
|
135
|
+
}
|
|
136
|
+
const runtime = await context.account.forChain(prepared.accountChain);
|
|
137
|
+
const signing = createAccountSigningContext({
|
|
138
|
+
runtime,
|
|
139
|
+
purpose: 'intent',
|
|
140
|
+
signerInvoker: context.signerInvoker,
|
|
141
|
+
...(prepared.input.signers?.kind === 'owner'
|
|
142
|
+
? { selection: prepared.input.signers }
|
|
143
|
+
: {}),
|
|
144
|
+
});
|
|
145
|
+
if (!signing.validatorCapabilities.supportsIndependentSigning) {
|
|
146
|
+
throw new IndependentSigningNotSupportedError();
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
signing,
|
|
150
|
+
planInput: buildIntentPlanInput(prepared, signing),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function independentOwners(context) {
|
|
154
|
+
if (context.validator.kind !== 'multi-factor') {
|
|
155
|
+
return context.validator.owners.map((owner) => independentOwner(owner));
|
|
156
|
+
}
|
|
157
|
+
return context.validator.validators.flatMap((factor) => factor.owners.map((owner) => independentOwner(owner, factor.id, factor.publicId)));
|
|
158
|
+
}
|
|
159
|
+
function findIndependentOwner(context, selection) {
|
|
160
|
+
if (context.validator.kind !== 'multi-factor') {
|
|
161
|
+
if (selection.validatorId !== undefined) {
|
|
162
|
+
throw new InvalidOwnerSigningOptionsError({
|
|
163
|
+
context: { validatorId: selection.validatorId },
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const owner = independentOwners(context).find((candidate) => candidate.signerId === selection.signerId);
|
|
167
|
+
if (!owner)
|
|
168
|
+
throw unknownOwner(selection);
|
|
169
|
+
return owner;
|
|
170
|
+
}
|
|
171
|
+
if (selection.validatorId === undefined) {
|
|
172
|
+
throw new InvalidOwnerSigningOptionsError({
|
|
173
|
+
context: { validatorId: selection.validatorId },
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
const factor = context.validator.validators.find((candidate) => sameValidatorId(candidate.publicId, selection.validatorId));
|
|
177
|
+
if (!factor) {
|
|
178
|
+
throw new InvalidOwnerSigningOptionsError({
|
|
179
|
+
context: { validatorId: selection.validatorId },
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
const owner = independentOwners(context).find((candidate) => candidate.factorId === factor.id &&
|
|
183
|
+
candidate.signerId === selection.signerId);
|
|
184
|
+
if (!owner)
|
|
185
|
+
throw unknownOwner(selection);
|
|
186
|
+
return owner;
|
|
187
|
+
}
|
|
188
|
+
function sameValidatorId(left, right) {
|
|
189
|
+
try {
|
|
190
|
+
return (encodeValidatorId(left).toLowerCase() ===
|
|
191
|
+
encodeValidatorId(right).toLowerCase());
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function unknownOwner(selection) {
|
|
198
|
+
const [kind, identity] = selection.signerId.split(':', 2);
|
|
199
|
+
return new UnknownOwnerError({
|
|
200
|
+
context: {
|
|
201
|
+
...(kind === 'webauthn' ? { publicKey: identity } : { signer: identity }),
|
|
202
|
+
...(selection.validatorId === undefined
|
|
203
|
+
? {}
|
|
204
|
+
: { validatorId: selection.validatorId }),
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function independentOwner(owner, factorId, factorPublicId) {
|
|
209
|
+
return {
|
|
210
|
+
ownerId: owner.id,
|
|
211
|
+
signerId: owner.signerId,
|
|
212
|
+
identity: owner.kind === 'webauthn'
|
|
213
|
+
? owner.account.publicKey
|
|
214
|
+
: owner.account.address,
|
|
215
|
+
kind: owner.kind === 'webauthn' ? 'webauthn' : 'ecdsa',
|
|
216
|
+
...(factorId ? { factorId } : {}),
|
|
217
|
+
...(factorPublicId === undefined ? {} : { factorPublicId }),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function independentOriginResult(owner, result) {
|
|
221
|
+
if (owner.kind === 'ecdsa') {
|
|
222
|
+
if (result?.kind !== 'ecdsa-signature') {
|
|
223
|
+
throw new Error(`Independent owner ${owner.ownerId} did not sign`);
|
|
224
|
+
}
|
|
225
|
+
return result.signature;
|
|
226
|
+
}
|
|
227
|
+
if (result?.kind !== 'webauthn-assertion') {
|
|
228
|
+
throw new Error(`Independent owner ${owner.ownerId} did not sign`);
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
signature: result.signature,
|
|
232
|
+
webauthn: {
|
|
233
|
+
authenticatorData: result.authenticatorData,
|
|
234
|
+
challengeIndex: result.challengeIndex,
|
|
235
|
+
clientDataJSON: result.clientDataJSON,
|
|
236
|
+
typeIndex: result.typeIndex,
|
|
237
|
+
userVerificationRequired: result.userVerificationRequired,
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function buildIntentPlanInput(prepared, context) {
|
|
242
|
+
const payloads = {};
|
|
243
|
+
const stages = [];
|
|
244
|
+
for (const [index, origin] of prepared.signing.origins.entries()) {
|
|
245
|
+
const route = resolveAccountTypedDataSigning({
|
|
246
|
+
typedData: origin.typedData,
|
|
247
|
+
chain: origin.chain,
|
|
248
|
+
context,
|
|
249
|
+
});
|
|
250
|
+
payloads[origin.id] = route.material;
|
|
251
|
+
stages.push(signingStage({
|
|
252
|
+
id: `origin-${index}`,
|
|
253
|
+
payloadId: origin.id,
|
|
254
|
+
chain: origin.chain,
|
|
255
|
+
usage: 'intent-origin',
|
|
256
|
+
context,
|
|
257
|
+
route,
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
const lastOriginIndex = prepared.signing.origins.length - 1;
|
|
261
|
+
stages.push({
|
|
262
|
+
id: 'destination',
|
|
263
|
+
checkpoint: { kind: 'none', id: 'destination:none' },
|
|
264
|
+
priorOutputs: [
|
|
265
|
+
{
|
|
266
|
+
stageId: `origin-${lastOriginIndex}`,
|
|
267
|
+
outputId: `origin-${lastOriginIndex}`,
|
|
268
|
+
selection: 'whole',
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
tasks: [],
|
|
272
|
+
schedule: [],
|
|
273
|
+
artifacts: [
|
|
274
|
+
{
|
|
275
|
+
id: 'destination',
|
|
276
|
+
usage: 'intent-destination',
|
|
277
|
+
input: {
|
|
278
|
+
kind: 'reuse-artifact',
|
|
279
|
+
stageId: `origin-${lastOriginIndex}`,
|
|
280
|
+
artifactId: `origin-${lastOriginIndex}`,
|
|
281
|
+
selection: 'whole',
|
|
282
|
+
},
|
|
283
|
+
validatorCodec: { kind: 'none' },
|
|
284
|
+
erc7739: { kind: 'none' },
|
|
285
|
+
accountEnvelope: { kind: 'none' },
|
|
286
|
+
erc6492: { kind: 'none' },
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
});
|
|
290
|
+
if (prepared.signing.target) {
|
|
291
|
+
const target = prepared.signing.target;
|
|
292
|
+
const route = resolveAccountTypedDataSigning({
|
|
293
|
+
typedData: target.typedData,
|
|
294
|
+
chain: target.chain,
|
|
295
|
+
context,
|
|
296
|
+
});
|
|
297
|
+
payloads[target.id] = route.material;
|
|
298
|
+
stages.push(signingStage({
|
|
299
|
+
id: 'target',
|
|
300
|
+
payloadId: target.id,
|
|
301
|
+
chain: target.chain,
|
|
302
|
+
usage: 'intent-target',
|
|
303
|
+
context,
|
|
304
|
+
route,
|
|
305
|
+
}));
|
|
306
|
+
}
|
|
307
|
+
return { intent: prepared.signing, stages, payloads };
|
|
308
|
+
}
|
|
309
|
+
function signingStage(input) {
|
|
310
|
+
const direct = input.context.account.definition.kind === 'eoa';
|
|
311
|
+
const tasks = direct
|
|
312
|
+
? eoaTask(input)
|
|
313
|
+
: createValidatorSigningTasks({
|
|
314
|
+
validator: input.context.validator,
|
|
315
|
+
signerReferences: input.context.signerReferences,
|
|
316
|
+
taskPrefix: input.id,
|
|
317
|
+
ecdsaInvocation: input.route.ecdsaInvocation,
|
|
318
|
+
webauthnInvocation: input.route.webauthnInvocation,
|
|
319
|
+
selectedSignerIds: input.context.effectiveSigners.signerIds,
|
|
320
|
+
}).map((task) => ({
|
|
321
|
+
...task,
|
|
322
|
+
chain: input.chain,
|
|
323
|
+
payload: { source: 'plan-payload', payloadId: input.payloadId },
|
|
324
|
+
}));
|
|
325
|
+
const artifact = {
|
|
326
|
+
id: input.id,
|
|
327
|
+
usage: input.usage,
|
|
328
|
+
input: { kind: 'task-results', taskIds: tasks.map(({ id }) => id) },
|
|
329
|
+
validatorCodec: direct
|
|
330
|
+
? { kind: 'none' }
|
|
331
|
+
: getSigningValidatorCodec(input.context, input.route.payloadKind),
|
|
332
|
+
...(!direct && input.context.validator.kind === 'multi-factor'
|
|
333
|
+
? {
|
|
334
|
+
validatorFactors: getSigningValidatorFactors(input.context, input.route.payloadKind),
|
|
335
|
+
}
|
|
336
|
+
: {}),
|
|
337
|
+
erc7739: input.route.erc7739,
|
|
338
|
+
accountEnvelope: direct
|
|
339
|
+
? { kind: 'none' }
|
|
340
|
+
: getAccountSignatureEnvelope(input.context),
|
|
341
|
+
erc6492: { kind: 'none' },
|
|
342
|
+
};
|
|
343
|
+
return {
|
|
344
|
+
id: input.id,
|
|
345
|
+
checkpoint: { kind: 'none', id: `${input.id}:none` },
|
|
346
|
+
priorOutputs: [],
|
|
347
|
+
tasks,
|
|
348
|
+
schedule: [
|
|
349
|
+
{
|
|
350
|
+
id: `${input.id}:signers`,
|
|
351
|
+
execution: input.context.validator.kind === 'multi-factor'
|
|
352
|
+
? 'serial'
|
|
353
|
+
: 'parallel',
|
|
354
|
+
taskIds: tasks.map(({ id }) => id),
|
|
355
|
+
},
|
|
356
|
+
],
|
|
357
|
+
artifacts: [artifact],
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function eoaTask(input) {
|
|
361
|
+
const signer = Object.values(input.context.signerReferences)[0];
|
|
362
|
+
if (!signer)
|
|
363
|
+
throw new Error('EOA signer is missing');
|
|
364
|
+
return [
|
|
365
|
+
{
|
|
366
|
+
id: `${input.id}:eoa`,
|
|
367
|
+
signer,
|
|
368
|
+
role: 'owner',
|
|
369
|
+
chain: input.chain,
|
|
370
|
+
invocationKind: 'ecdsa-sign-typed-data',
|
|
371
|
+
payload: { source: 'plan-payload', payloadId: input.payloadId },
|
|
372
|
+
},
|
|
373
|
+
];
|
|
374
|
+
}
|
|
375
|
+
function requireOriginSignature(value) {
|
|
376
|
+
if (typeof value === 'string')
|
|
377
|
+
return value;
|
|
378
|
+
if (value && 'preClaimSig' in value)
|
|
379
|
+
return value;
|
|
380
|
+
throw new Error('Intent origin signature is missing');
|
|
381
|
+
}
|
|
382
|
+
function requireHex(value, role) {
|
|
383
|
+
if (typeof value !== 'string')
|
|
384
|
+
throw new Error(`Intent ${role} signature is missing`);
|
|
385
|
+
return value;
|
|
386
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import type { IntentSplitPort } from '../../clients/orchestrator/port.js';
|
|
3
|
+
import type { OrchestratorSplitResult } from '../../clients/orchestrator/types.js';
|
|
4
|
+
export declare function splitIntents(client: IntentSplitPort, input: {
|
|
5
|
+
readonly chainId: number;
|
|
6
|
+
readonly tokens: Readonly<Record<Address, bigint>>;
|
|
7
|
+
readonly settlementLayers?: {
|
|
8
|
+
readonly include: readonly string[];
|
|
9
|
+
} | {
|
|
10
|
+
readonly exclude: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
}): Promise<OrchestratorSplitResult>;
|
|
13
|
+
//# sourceMappingURL=split.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/split.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAE/E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE;IACL,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;IAClD,QAAQ,CAAC,gBAAgB,CAAC,EACtB;QAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GACvC;QAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAA;CAC5C,GACA,OAAO,CAAC,uBAAuB,CAAC,CAElC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OrchestratorIntentStatus } from '../../clients/orchestrator/types.js';
|
|
2
|
+
import type { IntentStatus } from './types.js';
|
|
3
|
+
export declare function classifyIntentStatus(status: OrchestratorIntentStatus): IntentStatus;
|
|
4
|
+
export declare function getIntentRetryDelay(input: {
|
|
5
|
+
readonly error: unknown;
|
|
6
|
+
readonly now: number;
|
|
7
|
+
readonly minimum: number;
|
|
8
|
+
readonly fallback: number;
|
|
9
|
+
}): {
|
|
10
|
+
readonly delay: number;
|
|
11
|
+
readonly backoff: boolean;
|
|
12
|
+
} | undefined;
|
|
13
|
+
//# sourceMappingURL=status-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-policy.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/status-policy.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAI3C,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,wBAAwB,GAC/B,YAAY,CASd;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CA4BpE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isConnectionError, isRateLimited, isRetryable, RateLimitedError, } from '../../clients/orchestrator/errors.js';
|
|
2
|
+
const slowDelayMs = 2_000;
|
|
3
|
+
export function classifyIntentStatus(status) {
|
|
4
|
+
return {
|
|
5
|
+
traceId: status.traceId,
|
|
6
|
+
intentId: status.intentId,
|
|
7
|
+
status: status.status,
|
|
8
|
+
account: status.account,
|
|
9
|
+
operations: status.operations,
|
|
10
|
+
terminal: status.status === 'COMPLETED' || status.status === 'FAILED',
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function getIntentRetryDelay(input) {
|
|
14
|
+
if (!isRetryable(input.error) &&
|
|
15
|
+
!isRateLimited(input.error) &&
|
|
16
|
+
!isConnectionError(input.error)) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
if (!(input.error instanceof RateLimitedError)) {
|
|
20
|
+
return { delay: input.fallback, backoff: true };
|
|
21
|
+
}
|
|
22
|
+
if (!input.error.retryAfter) {
|
|
23
|
+
return { delay: Math.max(slowDelayMs, input.minimum), backoff: false };
|
|
24
|
+
}
|
|
25
|
+
const seconds = Number(input.error.retryAfter);
|
|
26
|
+
if (!Number.isNaN(seconds)) {
|
|
27
|
+
return {
|
|
28
|
+
delay: Math.max(seconds * 1_000, input.minimum),
|
|
29
|
+
backoff: false,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const date = Date.parse(input.error.retryAfter);
|
|
33
|
+
return {
|
|
34
|
+
delay: Number.isNaN(date)
|
|
35
|
+
? input.minimum
|
|
36
|
+
: Math.max(date - input.now, input.minimum),
|
|
37
|
+
backoff: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IntentStatus, IntentWorkflowContext } from './types.js';
|
|
2
|
+
export declare function getIntentStatus<CompatibilityConfig>(context: Pick<IntentWorkflowContext<CompatibilityConfig>, 'statusClient'>, intentId: string): Promise<IntentStatus>;
|
|
3
|
+
export declare function waitForIntentStatus<CompatibilityConfig>(context: Pick<IntentWorkflowContext<CompatibilityConfig>, 'statusClient' | 'clock'>, intentId: string): Promise<IntentStatus>;
|
|
4
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/status.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAQlE,wBAAsB,eAAe,CAAC,mBAAmB,EACvD,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC,EACzE,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,CAAC,CAIvB;AAED,wBAAsB,mBAAmB,CAAC,mBAAmB,EAC3D,OAAO,EAAE,IAAI,CACX,qBAAqB,CAAC,mBAAmB,CAAC,EAC1C,cAAc,GAAG,OAAO,CACzB,EACD,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,CAAC,CAoCvB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { IntentFailedError } from '../../errors/execution.js';
|
|
2
|
+
import { classifyIntentStatus, getIntentRetryDelay } from './status-policy.js';
|
|
3
|
+
const initialDelayMs = 500;
|
|
4
|
+
const slowAfterMs = 15_000;
|
|
5
|
+
const slowDelayMs = 2_000;
|
|
6
|
+
const initialErrorBackoffMs = 1_000;
|
|
7
|
+
const maximumErrorBackoffMs = 10_000;
|
|
8
|
+
export async function getIntentStatus(context, intentId) {
|
|
9
|
+
return classifyIntentStatus(await context.statusClient.getIntentStatus(intentId));
|
|
10
|
+
}
|
|
11
|
+
export async function waitForIntentStatus(context, intentId) {
|
|
12
|
+
const startedAt = context.clock.now();
|
|
13
|
+
let nextDelay = initialDelayMs;
|
|
14
|
+
let errorBackoff = initialErrorBackoffMs;
|
|
15
|
+
for (;;) {
|
|
16
|
+
let status;
|
|
17
|
+
try {
|
|
18
|
+
status = await getIntentStatus(context, intentId);
|
|
19
|
+
errorBackoff = initialErrorBackoffMs;
|
|
20
|
+
nextDelay =
|
|
21
|
+
context.clock.now() - startedAt >= slowAfterMs
|
|
22
|
+
? slowDelayMs
|
|
23
|
+
: initialDelayMs;
|
|
24
|
+
await context.clock.sleep(nextDelay);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
const retryDelay = getIntentRetryDelay({
|
|
28
|
+
error,
|
|
29
|
+
now: context.clock.now(),
|
|
30
|
+
minimum: nextDelay,
|
|
31
|
+
fallback: errorBackoff,
|
|
32
|
+
});
|
|
33
|
+
if (retryDelay === undefined)
|
|
34
|
+
throw error;
|
|
35
|
+
await context.clock.sleep(retryDelay.delay);
|
|
36
|
+
if (retryDelay.backoff) {
|
|
37
|
+
errorBackoff = Math.min(errorBackoff * 2, maximumErrorBackoffMs);
|
|
38
|
+
}
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (!status.terminal)
|
|
42
|
+
continue;
|
|
43
|
+
if (status.status === 'FAILED') {
|
|
44
|
+
throw new IntentFailedError({
|
|
45
|
+
context: { intentId, operations: status.operations },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return status;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IntentWorkflowContext, SignedIntent, SubmittedIntent } from './types.js';
|
|
2
|
+
export declare function submitIntent<CompatibilityConfig>(context: IntentWorkflowContext<CompatibilityConfig>, signed: SignedIntent<CompatibilityConfig>): Promise<SubmittedIntent>;
|
|
3
|
+
//# sourceMappingURL=submit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/submit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,qBAAqB,EACrB,YAAY,EACZ,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,wBAAsB,YAAY,CAAC,mBAAmB,EACpD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,EACnD,MAAM,EAAE,YAAY,CAAC,mBAAmB,CAAC,GACxC,OAAO,CAAC,eAAe,CAAC,CAgC1B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { chainIdFromReference } from '../../chains/caip2.js';
|
|
2
|
+
import { projectCompatibleIntentInput } from './compatibility.js';
|
|
3
|
+
export async function submitIntent(context, signed) {
|
|
4
|
+
const response = await context.submissionClient.submitIntent({
|
|
5
|
+
intentId: signed.prepared.quote.intentId,
|
|
6
|
+
signatures: {
|
|
7
|
+
origin: signed.originSignatures,
|
|
8
|
+
destination: signed.destinationSignature,
|
|
9
|
+
...(signed.targetSignature
|
|
10
|
+
? { targetExecution: signed.targetSignature }
|
|
11
|
+
: {}),
|
|
12
|
+
},
|
|
13
|
+
...(signed.authorizations && signed.authorizations.length > 0
|
|
14
|
+
? { authorizations: { sponsor: signed.authorizations } }
|
|
15
|
+
: {}),
|
|
16
|
+
...(signed.dryRun ? { dryRun: true } : {}),
|
|
17
|
+
}, {
|
|
18
|
+
intentInput: projectCompatibleIntentInput(signed.prepared.request),
|
|
19
|
+
sponsored: Boolean(signed.prepared.request.options.sponsorSettings),
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
type: 'intent',
|
|
23
|
+
traceId: response.traceId,
|
|
24
|
+
intentId: response.intentId,
|
|
25
|
+
...(signed.prepared.input.sourceChains
|
|
26
|
+
? {
|
|
27
|
+
sourceChains: signed.prepared.input.sourceChains.map(({ id }) => id),
|
|
28
|
+
}
|
|
29
|
+
: {}),
|
|
30
|
+
targetChain: chainIdFromReference(signed.prepared.input.destination),
|
|
31
|
+
};
|
|
32
|
+
}
|