@rhinestone/sdk 2.0.0-beta.43 → 2.0.0-beta.45
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/README.md +2 -2
- 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 +635 -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/clients/orchestrator/chain-catalog.d.ts +36 -0
- package/dist/src/clients/orchestrator/chain-catalog.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/chain-catalog.js +67 -0
- 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} +12 -15
- 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 +140 -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 +519 -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} +31 -26
- 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 -314
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -260
- 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 +9 -12
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -1
- package/dist/src/modules/validators/policies/claim/arbiters.js +52 -27
- 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 -4
- 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 -19
- package/dist/src/accounts/json-rpc/providers.d.ts +0 -5
- package/dist/src/accounts/json-rpc/providers.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.js +0 -16
- 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 -469
- 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 -187
- 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 -1606
- 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 -21
- package/dist/src/modules/validators/cross-chain-permits.d.ts.map +0 -1
- package/dist/src/modules/validators/cross-chain-permits.js +0 -111
- 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 -225
- package/dist/src/modules/validators/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.js +0 -1189
- package/dist/src/orchestrator/caip2.d.ts +0 -20
- package/dist/src/orchestrator/caip2.d.ts.map +0 -1
- package/dist/src/orchestrator/caip2.js +0 -49
- package/dist/src/orchestrator/client.d.ts +0 -29
- package/dist/src/orchestrator/client.d.ts.map +0 -1
- package/dist/src/orchestrator/client.js +0 -290
- 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 -13
- package/dist/src/orchestrator/index.d.ts.map +0 -1
- package/dist/src/orchestrator/index.js +0 -10
- package/dist/src/orchestrator/registry.d.ts +0 -17
- package/dist/src/orchestrator/registry.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.js +0 -103
- 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 -30
- 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,635 @@
|
|
|
1
|
+
import { parseCaip2, toEvmChainReference } from '../chains/caip2.js';
|
|
2
|
+
import { getChainById, getChainReference } from '../chains/catalog.js';
|
|
3
|
+
import { normalizeTokenAddress, validateTokenAddresses } from '../chains/tokens.js';
|
|
4
|
+
import { createStaticAccountRuntime } from '../config/account-runtime.js';
|
|
5
|
+
import { materializeAccountInvocationContext, resolveAccountConfig, } from '../config/resolve.js';
|
|
6
|
+
import { IndependentSigningNotSupportedError, MismatchedOwnerSignaturesError, QuoteNotInPreparedTransactionError, } from '../errors/execution.js';
|
|
7
|
+
import { ecdsaSignerId, webauthnSignerId, } from '../modules/validators/signer-id.js';
|
|
8
|
+
import { projectIntentAccount, projectIntentRecipient, } from '../transactions/intents/account.js';
|
|
9
|
+
import { projectCompatibleIntentInput, projectCompatibleQuote, } from '../transactions/intents/compatibility.js';
|
|
10
|
+
import { normalizeIntentQuote } from '../transactions/intents/normalize.js';
|
|
11
|
+
import { adaptSignerSelection } from './signer-selection.js';
|
|
12
|
+
function toPublicQuote(quote) {
|
|
13
|
+
const compatible = projectCompatibleQuote(quote);
|
|
14
|
+
return {
|
|
15
|
+
intentId: compatible.intentId,
|
|
16
|
+
expiresAt: compatible.expiresAt,
|
|
17
|
+
estimatedFillTime: compatible.estimatedFillTime,
|
|
18
|
+
settlementLayer: compatible.settlementLayer,
|
|
19
|
+
signData: {
|
|
20
|
+
origin: [...compatible.signData.origin],
|
|
21
|
+
destination: compatible.signData.destination,
|
|
22
|
+
...(compatible.signData.targetExecution
|
|
23
|
+
? { targetExecution: compatible.signData.targetExecution }
|
|
24
|
+
: {}),
|
|
25
|
+
},
|
|
26
|
+
cost: compatible.cost,
|
|
27
|
+
...(compatible.tokenRequirements
|
|
28
|
+
? { tokenRequirements: compatible.tokenRequirements }
|
|
29
|
+
: {}),
|
|
30
|
+
...(compatible.bridgeFill ? { bridgeFill: compatible.bridgeFill } : {}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function toPreparedTransactionData(prepared, transaction, cache) {
|
|
34
|
+
const data = {
|
|
35
|
+
quotes: {
|
|
36
|
+
traceId: prepared.traceId,
|
|
37
|
+
best: toPublicQuote(prepared.quote),
|
|
38
|
+
all: prepared.quotes.map(toPublicQuote),
|
|
39
|
+
},
|
|
40
|
+
intentInput: projectCompatibleIntentInput(prepared.request),
|
|
41
|
+
transaction,
|
|
42
|
+
};
|
|
43
|
+
cache.set(data, prepared);
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
function selectedPublicQuote(prepared, intentId) {
|
|
47
|
+
if (!intentId)
|
|
48
|
+
return prepared.quotes.best;
|
|
49
|
+
const quote = prepared.quotes.all.find((candidate) => candidate.intentId === intentId);
|
|
50
|
+
if (!quote) {
|
|
51
|
+
throw new QuoteNotInPreparedTransactionError({ context: { intentId } });
|
|
52
|
+
}
|
|
53
|
+
return quote;
|
|
54
|
+
}
|
|
55
|
+
function reconstructInput(context, prepared, intentId) {
|
|
56
|
+
const selected = selectedPublicQuote(prepared, intentId);
|
|
57
|
+
const quote = normalizeIntentQuote(selected);
|
|
58
|
+
return {
|
|
59
|
+
traceId: prepared.quotes.traceId,
|
|
60
|
+
quote,
|
|
61
|
+
quotes: prepared.quotes.all.map((candidate) => candidate.intentId === quote.intentId
|
|
62
|
+
? quote
|
|
63
|
+
: normalizeIntentQuote(candidate)),
|
|
64
|
+
request: prepared.intentInput,
|
|
65
|
+
intentInput: adaptTransaction(context, prepared.transaction),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function toSignedTransactionData(prepared, signed, cache) {
|
|
69
|
+
const data = {
|
|
70
|
+
...prepared,
|
|
71
|
+
quote: toPublicQuote(signed.prepared.quote),
|
|
72
|
+
originSignatures: signed.originSignatures,
|
|
73
|
+
destinationSignature: signed.destinationSignature,
|
|
74
|
+
targetExecutionSignature: signed.targetSignature,
|
|
75
|
+
};
|
|
76
|
+
cache.set(data, signed);
|
|
77
|
+
return data;
|
|
78
|
+
}
|
|
79
|
+
function referenceChain() {
|
|
80
|
+
// Account addresses are CREATE2 and chain-independent, so initialization only
|
|
81
|
+
// needs some EVM chain reference. With no bundled chain set, use mainnet.
|
|
82
|
+
return toEvmChainReference(1);
|
|
83
|
+
}
|
|
84
|
+
export function createAccountFacade(compatibilityConfig, composition) {
|
|
85
|
+
// Intent identity caches are facade-scoped. Values crossing account/SDK
|
|
86
|
+
// instances are reconstructed and validated by the receiving account.
|
|
87
|
+
const preparedIntents = new WeakMap();
|
|
88
|
+
const signedIntents = new WeakMap();
|
|
89
|
+
const context = (method) => materializeAccountInvocationContext(composition.config, compatibilityConfig, method);
|
|
90
|
+
const workflowsFor = (ctx) => composition.createAccount(ctx).workflows;
|
|
91
|
+
const resolvePrepared = (ctx, prepared, intentId) => {
|
|
92
|
+
const cached = preparedIntents.get(prepared);
|
|
93
|
+
if (cached && !intentId)
|
|
94
|
+
return Promise.resolve(cached);
|
|
95
|
+
return workflowsFor(ctx).reconstructPreparedIntent(ctx, reconstructInput(ctx, prepared, intentId));
|
|
96
|
+
};
|
|
97
|
+
const account = {
|
|
98
|
+
config: compatibilityConfig,
|
|
99
|
+
deploy(chain, params) {
|
|
100
|
+
const ctx = context('deploy');
|
|
101
|
+
return workflowsFor(ctx).deploy(ctx, toEvmChainReference(chain.id), {
|
|
102
|
+
...(params?.sponsored !== undefined
|
|
103
|
+
? { sponsored: params.sponsored }
|
|
104
|
+
: {}),
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
isDeployed(chain) {
|
|
108
|
+
const ctx = context('is-deployed');
|
|
109
|
+
return workflowsFor(ctx).isDeployed(ctx, toEvmChainReference(chain.id));
|
|
110
|
+
},
|
|
111
|
+
setup(chain) {
|
|
112
|
+
const ctx = context('setup');
|
|
113
|
+
return workflowsFor(ctx).setup(ctx, toEvmChainReference(chain.id));
|
|
114
|
+
},
|
|
115
|
+
getInitData() {
|
|
116
|
+
const ctx = context('get-init-data');
|
|
117
|
+
return workflowsFor(ctx).getInitData(ctx);
|
|
118
|
+
},
|
|
119
|
+
async signEip7702InitData() {
|
|
120
|
+
const ctx = context('sign-eip7702-init-data');
|
|
121
|
+
const result = await workflowsFor(ctx).signEip7702InitData(ctx);
|
|
122
|
+
return result.signature;
|
|
123
|
+
},
|
|
124
|
+
async prepareTransaction(transaction) {
|
|
125
|
+
const ctx = context('prepare-intent');
|
|
126
|
+
const prepared = await workflowsFor(ctx).prepareIntent(ctx, adaptTransaction(ctx, transaction));
|
|
127
|
+
return toPreparedTransactionData(prepared, transaction, preparedIntents);
|
|
128
|
+
},
|
|
129
|
+
getTransactionMessages(preparedTransaction, options) {
|
|
130
|
+
const quote = selectedPublicQuote(preparedTransaction, options?.intentId);
|
|
131
|
+
return {
|
|
132
|
+
origin: [...quote.signData.origin],
|
|
133
|
+
destination: quote.signData.destination,
|
|
134
|
+
...(quote.signData.targetExecution
|
|
135
|
+
? { targetExecution: quote.signData.targetExecution }
|
|
136
|
+
: {}),
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
signTransaction: ((preparedTransaction, options) => {
|
|
140
|
+
const ctx = context('sign-intent');
|
|
141
|
+
const workflows = workflowsFor(ctx);
|
|
142
|
+
if (options && 'owner' in options) {
|
|
143
|
+
// Independent owner signing is unsupported for smart-session intents;
|
|
144
|
+
// reject before resolving sessions (which would issue an RPC read),
|
|
145
|
+
// matching the legacy fast-fail.
|
|
146
|
+
if (preparedTransaction.transaction.signers?.type ===
|
|
147
|
+
'experimental_session') {
|
|
148
|
+
return Promise.reject(new IndependentSigningNotSupportedError());
|
|
149
|
+
}
|
|
150
|
+
const signerId = signerIdForOwner(options.owner);
|
|
151
|
+
return resolvePrepared(ctx, preparedTransaction, options.intentId).then((internal) => workflows.signIntentAsOwner(ctx, internal, {
|
|
152
|
+
signerId,
|
|
153
|
+
...(options.validatorId === undefined
|
|
154
|
+
? {}
|
|
155
|
+
: { validatorId: options.validatorId }),
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
return resolvePrepared(ctx, preparedTransaction, options?.intentId)
|
|
159
|
+
.then((internal) => workflows.signIntent(ctx, internal))
|
|
160
|
+
.then(({ intent }) => toSignedTransactionData(preparedTransaction, intent, signedIntents));
|
|
161
|
+
}),
|
|
162
|
+
async assembleTransaction(preparedTransaction, signatures) {
|
|
163
|
+
const ctx = context('assemble-intent');
|
|
164
|
+
const workflows = workflowsFor(ctx);
|
|
165
|
+
const intentIds = [...new Set(signatures.map(({ intentId }) => intentId))];
|
|
166
|
+
if (intentIds.length > 1) {
|
|
167
|
+
throw new MismatchedOwnerSignaturesError({ context: { intentIds } });
|
|
168
|
+
}
|
|
169
|
+
const internal = await resolvePrepared(ctx, preparedTransaction, intentIds[0]);
|
|
170
|
+
const signed = await workflows.assembleIntent(ctx, internal, signatures);
|
|
171
|
+
return toSignedTransactionData(preparedTransaction, signed, signedIntents);
|
|
172
|
+
},
|
|
173
|
+
async signAuthorizations(preparedTransaction) {
|
|
174
|
+
const ctx = context('sign-authorizations');
|
|
175
|
+
const intentInput = adaptTransaction(ctx, preparedTransaction.transaction);
|
|
176
|
+
const chains = authorizationChains(intentInput);
|
|
177
|
+
const result = await workflowsFor(ctx).signAuthorizations(ctx, {
|
|
178
|
+
chains,
|
|
179
|
+
...(intentInput.eip7702InitSignature
|
|
180
|
+
? { eip7702InitSignature: intentInput.eip7702InitSignature }
|
|
181
|
+
: {}),
|
|
182
|
+
});
|
|
183
|
+
return result.authorizations;
|
|
184
|
+
},
|
|
185
|
+
async signMessage(message, chain, signers) {
|
|
186
|
+
const ctx = context('sign-message');
|
|
187
|
+
const result = await workflowsFor(ctx).signMessage(ctx, {
|
|
188
|
+
message,
|
|
189
|
+
chain: toEvmChainReference(chain.id),
|
|
190
|
+
...(signers
|
|
191
|
+
? { signers: adaptSignerSelection(ctx.account, signers) }
|
|
192
|
+
: {}),
|
|
193
|
+
});
|
|
194
|
+
return result.signature;
|
|
195
|
+
},
|
|
196
|
+
async signTypedData(parameters, chain, signers) {
|
|
197
|
+
const ctx = context('sign-typed-data');
|
|
198
|
+
const result = await workflowsFor(ctx).signTypedData(ctx, {
|
|
199
|
+
typedData: parameters,
|
|
200
|
+
chain: toEvmChainReference(chain.id),
|
|
201
|
+
...(signers
|
|
202
|
+
? { signers: adaptSignerSelection(ctx.account, signers) }
|
|
203
|
+
: {}),
|
|
204
|
+
});
|
|
205
|
+
return result.signature;
|
|
206
|
+
},
|
|
207
|
+
async signIntent(signData, targetChain, signers) {
|
|
208
|
+
const ctx = context('sign-intent');
|
|
209
|
+
const result = await workflowsFor(ctx).signIntentFromSignData(ctx, {
|
|
210
|
+
signData: {
|
|
211
|
+
origin: signData.origin,
|
|
212
|
+
destination: signData.destination,
|
|
213
|
+
...(signData.targetExecution
|
|
214
|
+
? { targetExecution: signData.targetExecution }
|
|
215
|
+
: {}),
|
|
216
|
+
},
|
|
217
|
+
targetChain: destinationChainReference(targetChain),
|
|
218
|
+
...(signers
|
|
219
|
+
? { signers: adaptSignerSelection(ctx.account, signers) }
|
|
220
|
+
: {}),
|
|
221
|
+
});
|
|
222
|
+
return {
|
|
223
|
+
originSignatures: result.originSignatures,
|
|
224
|
+
destinationSignature: result.destinationSignature,
|
|
225
|
+
targetExecutionSignature: result.targetExecutionSignature,
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
async submitTransaction(signedTransaction, options) {
|
|
229
|
+
const ctx = context('submit-intent');
|
|
230
|
+
const workflows = workflowsFor(ctx);
|
|
231
|
+
// Fast path for the same-instance signed object; otherwise (cross-instance
|
|
232
|
+
// replay or caller-tampered signatures) rebuild from the public shape.
|
|
233
|
+
const cached = signedIntents.get(signedTransaction);
|
|
234
|
+
const base = cached ?? {
|
|
235
|
+
prepared: await resolvePrepared(ctx, signedTransaction, signedTransaction.quote.intentId),
|
|
236
|
+
originSignatures: signedTransaction.originSignatures,
|
|
237
|
+
destinationSignature: signedTransaction.destinationSignature,
|
|
238
|
+
...(signedTransaction.targetExecutionSignature
|
|
239
|
+
? { targetSignature: signedTransaction.targetExecutionSignature }
|
|
240
|
+
: {}),
|
|
241
|
+
transcript: { planKind: 'intent-full', payloadId: '0x', stages: [] },
|
|
242
|
+
};
|
|
243
|
+
const signed = {
|
|
244
|
+
...base,
|
|
245
|
+
...(options?.authorizations
|
|
246
|
+
? { authorizations: options.authorizations }
|
|
247
|
+
: {}),
|
|
248
|
+
...(options?.internal_dryRun ? { dryRun: true } : {}),
|
|
249
|
+
};
|
|
250
|
+
const submitted = await workflows.submitIntent(ctx, signed);
|
|
251
|
+
return {
|
|
252
|
+
type: 'intent',
|
|
253
|
+
id: submitted.intentId,
|
|
254
|
+
traceId: submitted.traceId,
|
|
255
|
+
...(submitted.sourceChains
|
|
256
|
+
? { sourceChains: [...submitted.sourceChains] }
|
|
257
|
+
: {}),
|
|
258
|
+
targetChain: submitted.targetChain,
|
|
259
|
+
};
|
|
260
|
+
},
|
|
261
|
+
async prepareUserOperation(transaction) {
|
|
262
|
+
const ctx = context('prepare-user-operation');
|
|
263
|
+
const signers = userOperationSignerSelection(ctx, transaction);
|
|
264
|
+
const prepared = await workflowsFor(ctx).prepareUserOperation(ctx, {
|
|
265
|
+
chain: toEvmChainReference(transaction.chain.id),
|
|
266
|
+
calls: transaction.calls.map((call) => adaptCall(call, transaction.chain.id)),
|
|
267
|
+
...(transaction.gasLimit === undefined
|
|
268
|
+
? {}
|
|
269
|
+
: { gasLimit: transaction.gasLimit }),
|
|
270
|
+
...(signers ? { signers } : {}),
|
|
271
|
+
});
|
|
272
|
+
const data = {
|
|
273
|
+
userOperation: prepared.operation,
|
|
274
|
+
hash: prepared.hash,
|
|
275
|
+
transaction,
|
|
276
|
+
};
|
|
277
|
+
return data;
|
|
278
|
+
},
|
|
279
|
+
async signUserOperation(preparedUserOperation) {
|
|
280
|
+
const ctx = context('sign-user-operation');
|
|
281
|
+
const signers = userOperationSignerSelection(ctx, preparedUserOperation.transaction);
|
|
282
|
+
// Recompute from the current public operation and live owners.
|
|
283
|
+
const internal = await workflowsFor(ctx).reconstructPreparedUserOperation(ctx, {
|
|
284
|
+
chain: toEvmChainReference(preparedUserOperation.transaction.chain.id),
|
|
285
|
+
operation: preparedUserOperation.userOperation,
|
|
286
|
+
...(signers ? { signers } : {}),
|
|
287
|
+
});
|
|
288
|
+
const signed = await workflowsFor(ctx).signUserOperation(ctx, internal);
|
|
289
|
+
const data = {
|
|
290
|
+
...preparedUserOperation,
|
|
291
|
+
signature: signed.signature,
|
|
292
|
+
};
|
|
293
|
+
return data;
|
|
294
|
+
},
|
|
295
|
+
async submitUserOperation(signedUserOperation) {
|
|
296
|
+
const ctx = context('submit-user-operation');
|
|
297
|
+
const signers = userOperationSignerSelection(ctx, signedUserOperation.transaction);
|
|
298
|
+
// The public operation and top-level signature remain authoritative.
|
|
299
|
+
const internal = await workflowsFor(ctx).reconstructSignedUserOperation(ctx, {
|
|
300
|
+
chain: toEvmChainReference(signedUserOperation.transaction.chain.id),
|
|
301
|
+
operation: signedUserOperation.userOperation,
|
|
302
|
+
signature: signedUserOperation.signature,
|
|
303
|
+
...(signers ? { signers } : {}),
|
|
304
|
+
});
|
|
305
|
+
const submitted = await workflowsFor(ctx).submitUserOperation(ctx, internal);
|
|
306
|
+
return {
|
|
307
|
+
type: 'userop',
|
|
308
|
+
hash: submitted.hash,
|
|
309
|
+
chain: submitted.chain.id,
|
|
310
|
+
};
|
|
311
|
+
},
|
|
312
|
+
async sendUserOperation(transaction) {
|
|
313
|
+
const ctx = context('send-user-operation');
|
|
314
|
+
const signers = userOperationSignerSelection(ctx, transaction);
|
|
315
|
+
const submitted = await workflowsFor(ctx).sendUserOperation(ctx, {
|
|
316
|
+
chain: toEvmChainReference(transaction.chain.id),
|
|
317
|
+
calls: transaction.calls.map((call) => adaptCall(call, transaction.chain.id)),
|
|
318
|
+
...(transaction.gasLimit === undefined
|
|
319
|
+
? {}
|
|
320
|
+
: { gasLimit: transaction.gasLimit }),
|
|
321
|
+
...(signers ? { signers } : {}),
|
|
322
|
+
});
|
|
323
|
+
return {
|
|
324
|
+
type: 'userop',
|
|
325
|
+
hash: submitted.hash,
|
|
326
|
+
chain: submitted.chain.id,
|
|
327
|
+
};
|
|
328
|
+
},
|
|
329
|
+
waitForExecution: ((result) => {
|
|
330
|
+
if (result.type === 'intent') {
|
|
331
|
+
const ctx = context('wait-for-execution');
|
|
332
|
+
return workflowsFor(ctx)
|
|
333
|
+
.waitForIntentStatus(ctx, result.id)
|
|
334
|
+
.then((status) => ({
|
|
335
|
+
traceId: status.traceId,
|
|
336
|
+
status: status.status,
|
|
337
|
+
accountAddress: status.account,
|
|
338
|
+
operations: status.operations,
|
|
339
|
+
}));
|
|
340
|
+
}
|
|
341
|
+
const ctx = context('wait-for-execution');
|
|
342
|
+
return workflowsFor(ctx)
|
|
343
|
+
.waitForUserOperationStatus(ctx, {
|
|
344
|
+
type: 'userop',
|
|
345
|
+
chain: toEvmChainReference(result.chain),
|
|
346
|
+
hash: result.hash,
|
|
347
|
+
})
|
|
348
|
+
.then((status) => status.receipt);
|
|
349
|
+
}),
|
|
350
|
+
getAddress() {
|
|
351
|
+
const ctx = context('get-address');
|
|
352
|
+
return workflowsFor(ctx).getAddress(ctx, referenceChain());
|
|
353
|
+
},
|
|
354
|
+
getPortfolio(onTestnets = false) {
|
|
355
|
+
const ctx = context('get-portfolio');
|
|
356
|
+
return workflowsFor(ctx)
|
|
357
|
+
.getPortfolio(ctx, onTestnets)
|
|
358
|
+
.then((portfolio) => portfolio.tokens);
|
|
359
|
+
},
|
|
360
|
+
experimental_getSessionDetails(sessions) {
|
|
361
|
+
const ctx = context('get-session-details');
|
|
362
|
+
return workflowsFor(ctx).getSessionDetails(ctx, sessions);
|
|
363
|
+
},
|
|
364
|
+
experimental_isSessionEnabled(session) {
|
|
365
|
+
const ctx = context('is-session-enabled');
|
|
366
|
+
return workflowsFor(ctx).isSessionEnabled(ctx, session);
|
|
367
|
+
},
|
|
368
|
+
experimental_signEnableSession(details) {
|
|
369
|
+
const ctx = context('sign-enable-session');
|
|
370
|
+
return workflowsFor(ctx).signEnableSession(ctx, details);
|
|
371
|
+
},
|
|
372
|
+
getOwners(chain) {
|
|
373
|
+
const ctx = context('get-owners');
|
|
374
|
+
return workflowsFor(ctx)
|
|
375
|
+
.getOwners(ctx, toEvmChainReference(chain.id))
|
|
376
|
+
.then((owners) => owners
|
|
377
|
+
? { accounts: [...owners.accounts], threshold: owners.threshold }
|
|
378
|
+
: null);
|
|
379
|
+
},
|
|
380
|
+
getValidators(chain) {
|
|
381
|
+
const ctx = context('get-validators');
|
|
382
|
+
return workflowsFor(ctx)
|
|
383
|
+
.getValidators(ctx, toEvmChainReference(chain.id))
|
|
384
|
+
.then((addresses) => [...addresses]);
|
|
385
|
+
},
|
|
386
|
+
getExecutors(chain) {
|
|
387
|
+
const ctx = context('get-executors');
|
|
388
|
+
return workflowsFor(ctx)
|
|
389
|
+
.getExecutors(ctx, toEvmChainReference(chain.id))
|
|
390
|
+
.then((addresses) => [...addresses]);
|
|
391
|
+
},
|
|
392
|
+
};
|
|
393
|
+
return account;
|
|
394
|
+
}
|
|
395
|
+
function signerIdForOwner(owner) {
|
|
396
|
+
// ECDSA local accounts also expose `publicKey`, so discriminate on the
|
|
397
|
+
// account type rather than the presence of a public key.
|
|
398
|
+
if (owner.type === 'webAuthn') {
|
|
399
|
+
return webauthnSignerId(owner.publicKey);
|
|
400
|
+
}
|
|
401
|
+
return ecdsaSignerId(owner.address);
|
|
402
|
+
}
|
|
403
|
+
function userOperationSignerSelection(context, transaction) {
|
|
404
|
+
if (!transaction.signers)
|
|
405
|
+
return undefined;
|
|
406
|
+
if (transaction.signers?.type === 'experimental_session') {
|
|
407
|
+
throw new Error('No account found');
|
|
408
|
+
}
|
|
409
|
+
const selection = adaptSignerSelection(context.account, transaction.signers);
|
|
410
|
+
if (selection.kind !== 'owner')
|
|
411
|
+
throw new Error('No account found');
|
|
412
|
+
return selection;
|
|
413
|
+
}
|
|
414
|
+
function destinationChainReference(targetChain) {
|
|
415
|
+
if ('kind' in targetChain && typeof targetChain.caip2 === 'string') {
|
|
416
|
+
return parseCaip2(targetChain.caip2);
|
|
417
|
+
}
|
|
418
|
+
return getChainReference(targetChain.id);
|
|
419
|
+
}
|
|
420
|
+
// Public `Transaction` -> internal `IntentInput`. Owned here because the facade
|
|
421
|
+
// is the only translation point between the compatibility surface and the
|
|
422
|
+
// intent workflow.
|
|
423
|
+
export function adaptTransaction(context, transaction) {
|
|
424
|
+
const destination = 'chain' in transaction
|
|
425
|
+
? getChainReference(transaction.chain.id)
|
|
426
|
+
: 'kind' in transaction.targetChain
|
|
427
|
+
? parseCaip2(transaction.targetChain.caip2)
|
|
428
|
+
: getChainReference(transaction.targetChain.id);
|
|
429
|
+
const destinationChainId = destination.kind === 'evm' ? destination.id : undefined;
|
|
430
|
+
const sourceChains = 'chain' in transaction
|
|
431
|
+
? [getChainReference(transaction.chain.id)]
|
|
432
|
+
: transaction.sourceChains?.map((chain) => getChainReference(chain.id));
|
|
433
|
+
const evmSources = sourceChains?.flatMap((chain) => chain.kind === 'evm' ? [chain] : []);
|
|
434
|
+
return {
|
|
435
|
+
destination,
|
|
436
|
+
...(evmSources ? { sourceChains: evmSources } : {}),
|
|
437
|
+
calls: (transaction.calls ?? []).map((call) => adaptCall(call, destinationChainId)),
|
|
438
|
+
tokenRequests: (transaction.tokenRequests ?? []).map((request) => ({
|
|
439
|
+
token: destinationChainId === undefined
|
|
440
|
+
? request.address
|
|
441
|
+
: normalizeTokenAddress(request.address, destinationChainId, false),
|
|
442
|
+
...(request.amount === undefined ? {} : { amount: request.amount }),
|
|
443
|
+
})),
|
|
444
|
+
...(transaction.recipient
|
|
445
|
+
? {
|
|
446
|
+
recipient: adaptRecipient(context, transaction.recipient, destination, transaction.eip7702InitSignature, transaction.experimental_accountOverride?.setupOps),
|
|
447
|
+
}
|
|
448
|
+
: {}),
|
|
449
|
+
...(transaction.gasLimit === undefined
|
|
450
|
+
? {}
|
|
451
|
+
: { gasLimit: transaction.gasLimit }),
|
|
452
|
+
...(transaction.eip7702InitSignature
|
|
453
|
+
? { eip7702InitSignature: transaction.eip7702InitSignature }
|
|
454
|
+
: {}),
|
|
455
|
+
...(transaction.sourceAssets || sourceChains
|
|
456
|
+
? {
|
|
457
|
+
accountAccessList: adaptSourceAssets(transaction.sourceAssets, evmSources?.map(({ id }) => id)),
|
|
458
|
+
}
|
|
459
|
+
: {}),
|
|
460
|
+
options: {
|
|
461
|
+
...(transaction.appFees ? { appFees: transaction.appFees } : {}),
|
|
462
|
+
...('chain' in transaction && transaction.customDeadline !== undefined
|
|
463
|
+
? { customDeadline: transaction.customDeadline }
|
|
464
|
+
: {}),
|
|
465
|
+
...(transaction.sponsored
|
|
466
|
+
? {
|
|
467
|
+
sponsorSettings: typeof transaction.sponsored === 'boolean'
|
|
468
|
+
? {
|
|
469
|
+
gas: transaction.sponsored,
|
|
470
|
+
bridgeFees: transaction.sponsored,
|
|
471
|
+
swapFees: transaction.sponsored,
|
|
472
|
+
}
|
|
473
|
+
: {
|
|
474
|
+
gas: transaction.sponsored.gas,
|
|
475
|
+
bridgeFees: transaction.sponsored.bridging,
|
|
476
|
+
swapFees: transaction.sponsored.swaps,
|
|
477
|
+
},
|
|
478
|
+
}
|
|
479
|
+
: {}),
|
|
480
|
+
...(transaction.settlementLayers
|
|
481
|
+
? { settlementLayers: transaction.settlementLayers }
|
|
482
|
+
: {}),
|
|
483
|
+
...(transaction.auxiliaryFunds
|
|
484
|
+
? { auxiliaryFunds: transaction.auxiliaryFunds }
|
|
485
|
+
: {}),
|
|
486
|
+
},
|
|
487
|
+
...(transaction.sourceCalls
|
|
488
|
+
? {
|
|
489
|
+
sourceCalls: Object.fromEntries(Object.entries(transaction.sourceCalls).map(([chainId, calls]) => [
|
|
490
|
+
Number(chainId),
|
|
491
|
+
calls.map((call) => ({
|
|
492
|
+
call: adaptCall(call, Number(chainId)),
|
|
493
|
+
...(call.provides ? { provides: call.provides } : {}),
|
|
494
|
+
})),
|
|
495
|
+
])),
|
|
496
|
+
}
|
|
497
|
+
: {}),
|
|
498
|
+
...(transaction.experimental_accountOverride?.setupOps
|
|
499
|
+
? {
|
|
500
|
+
accountSetupOverride: transaction.experimental_accountOverride.setupOps,
|
|
501
|
+
}
|
|
502
|
+
: {}),
|
|
503
|
+
...(transaction.signers
|
|
504
|
+
? {
|
|
505
|
+
signers: transaction.signers.type === 'experimental_session'
|
|
506
|
+
? {
|
|
507
|
+
kind: 'smart-session',
|
|
508
|
+
byChain: adaptSessionSelection(transaction, sourceChains ?? []),
|
|
509
|
+
}
|
|
510
|
+
: adaptSignerSelection(context.account, transaction.signers),
|
|
511
|
+
}
|
|
512
|
+
: {}),
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function adaptRecipient(context, recipient, destination, eip7702InitSignature, setupOverride) {
|
|
516
|
+
if (typeof recipient === 'string') {
|
|
517
|
+
return projectIntentRecipient(recipient, destination);
|
|
518
|
+
}
|
|
519
|
+
if (destination.kind !== 'evm') {
|
|
520
|
+
throw new Error('Smart-account recipients require an EVM destination');
|
|
521
|
+
}
|
|
522
|
+
const resolved = resolveAccountConfig(context.sdk, toAccountConstructionInput(recipient));
|
|
523
|
+
return projectIntentAccount({
|
|
524
|
+
runtime: createStaticAccountRuntime(resolved, destination, false),
|
|
525
|
+
...(setupOverride ? { setupOverride } : {}),
|
|
526
|
+
...(eip7702InitSignature ? { eip7702InitSignature } : {}),
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
function toAccountConstructionInput(config) {
|
|
530
|
+
return {
|
|
531
|
+
...(config.account ? { account: config.account } : {}),
|
|
532
|
+
...(config.owners ? { owners: config.owners } : {}),
|
|
533
|
+
...(config.experimental_sessions
|
|
534
|
+
? { experimental_sessions: config.experimental_sessions }
|
|
535
|
+
: {}),
|
|
536
|
+
...(config.eoa ? { eoa: config.eoa } : {}),
|
|
537
|
+
...(config.modules ? { modules: config.modules } : {}),
|
|
538
|
+
...(config.initData ? { initData: config.initData } : {}),
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
export function authorizationChains(input) {
|
|
542
|
+
const chains = [...(input.sourceChains ?? []), input.destination];
|
|
543
|
+
const seen = new Set();
|
|
544
|
+
return chains.filter((chain) => {
|
|
545
|
+
if (seen.has(chain.caip2))
|
|
546
|
+
return false;
|
|
547
|
+
seen.add(chain.caip2);
|
|
548
|
+
return true;
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
function adaptCall(call, chainId) {
|
|
552
|
+
if ('resolve' in call) {
|
|
553
|
+
return {
|
|
554
|
+
resolve: async (ctx) => {
|
|
555
|
+
const chain = getChainById(ctx.chain.id);
|
|
556
|
+
const value = await call.resolve({
|
|
557
|
+
config: ctx.config,
|
|
558
|
+
chain,
|
|
559
|
+
accountAddress: ctx.account,
|
|
560
|
+
});
|
|
561
|
+
return (Array.isArray(value) ? value : [value]).map((item) => normalizeCall(item, ctx.chain.id));
|
|
562
|
+
},
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
if (chainId === undefined) {
|
|
566
|
+
throw new Error('Destination calls are not supported for non-EVM chains');
|
|
567
|
+
}
|
|
568
|
+
return normalizeCall(call, chainId);
|
|
569
|
+
}
|
|
570
|
+
function normalizeCall(call, chainId) {
|
|
571
|
+
return {
|
|
572
|
+
target: normalizeTokenAddress(call.to, chainId, false),
|
|
573
|
+
value: call.value ?? 0n,
|
|
574
|
+
data: call.data ?? '0x',
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function adaptSessionSelection(transaction, chains) {
|
|
578
|
+
const signers = transaction.signers;
|
|
579
|
+
if (!signers || signers.type !== 'experimental_session')
|
|
580
|
+
return {};
|
|
581
|
+
if ('sessions' in signers) {
|
|
582
|
+
return Object.fromEntries(Object.entries(signers.sessions).map(([chainId, selection]) => [
|
|
583
|
+
Number(chainId),
|
|
584
|
+
selection,
|
|
585
|
+
]));
|
|
586
|
+
}
|
|
587
|
+
const chainIds = new Set(chains.flatMap((chain) => chain.kind === 'evm' && chain.id !== undefined ? [chain.id] : []));
|
|
588
|
+
if ('chain' in transaction)
|
|
589
|
+
chainIds.add(transaction.chain.id);
|
|
590
|
+
if ('targetChain' in transaction && 'id' in transaction.targetChain) {
|
|
591
|
+
chainIds.add(transaction.targetChain.id);
|
|
592
|
+
}
|
|
593
|
+
return Object.fromEntries([...chainIds].map((chainId) => [
|
|
594
|
+
chainId,
|
|
595
|
+
{
|
|
596
|
+
session: signers.session,
|
|
597
|
+
...(signers.enableData ? { enableData: signers.enableData } : {}),
|
|
598
|
+
},
|
|
599
|
+
]));
|
|
600
|
+
}
|
|
601
|
+
function adaptSourceAssets(sourceAssets, chainIds) {
|
|
602
|
+
if (!sourceAssets)
|
|
603
|
+
return chainIds ? { chainIds } : undefined;
|
|
604
|
+
if (Array.isArray(sourceAssets)) {
|
|
605
|
+
if (sourceAssets.length > 0 && typeof sourceAssets[0] === 'object') {
|
|
606
|
+
const chainTokens = {};
|
|
607
|
+
const chainTokenAmounts = {};
|
|
608
|
+
for (const item of sourceAssets) {
|
|
609
|
+
const token = normalizeTokenAddress(item.address, item.chain.id, false);
|
|
610
|
+
if (item.amount === undefined)
|
|
611
|
+
(chainTokens[item.chain.id] ??= []).push(token);
|
|
612
|
+
else
|
|
613
|
+
(chainTokenAmounts[item.chain.id] ??= {})[token] = item.amount;
|
|
614
|
+
}
|
|
615
|
+
return {
|
|
616
|
+
...(Object.keys(chainTokens).length > 0 ? { chainTokens } : {}),
|
|
617
|
+
...(Object.keys(chainTokenAmounts).length > 0
|
|
618
|
+
? { chainTokenAmounts }
|
|
619
|
+
: {}),
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
const tokens = sourceAssets;
|
|
623
|
+
validateTokenAddresses(tokens);
|
|
624
|
+
return {
|
|
625
|
+
...(chainIds ? { chainIds } : {}),
|
|
626
|
+
tokens,
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
// ChainTokenMap: validate every per-chain list too, so symbols can't slip
|
|
630
|
+
// through this input the way they can't through tokenRequests / ExactInputConfig.
|
|
631
|
+
for (const tokens of Object.values(sourceAssets)) {
|
|
632
|
+
validateTokenAddresses(tokens);
|
|
633
|
+
}
|
|
634
|
+
return { chainTokens: sourceAssets };
|
|
635
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RhinestoneAccountConfig } from '../config/account.js';
|
|
2
|
+
import type { SdkConstructionInput } from '../config/input.js';
|
|
3
|
+
import { type LegacyAccountConfig, type LegacySdkConfigSnapshot } from '../config/legacy.js';
|
|
4
|
+
import { type RhinestoneAccount } from './account.js';
|
|
5
|
+
import type { CoreComposition } from './compose-types.js';
|
|
6
|
+
export interface SdkComposition {
|
|
7
|
+
readonly composition: CoreComposition<LegacyAccountConfig<unknown>>;
|
|
8
|
+
readonly snapshot: LegacySdkConfigSnapshot<unknown>;
|
|
9
|
+
}
|
|
10
|
+
export declare function composeSdk(input: SdkConstructionInput): SdkComposition;
|
|
11
|
+
export declare function attachAccount(sdk: SdkComposition, config: RhinestoneAccountConfig): RhinestoneAccount;
|
|
12
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../api/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAA;AAMzB,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAA;IACnE,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAAA;CACpD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,oBAAoB,GAAG,cAAc,CAOtE;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,uBAAuB,GAC9B,iBAAiB,CAanB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { captureLegacySdkConfig, createLegacyAccountConfig, } from '../config/legacy.js';
|
|
2
|
+
import { materializeAccountInvocationContext, resolveSdkConfig, } from '../config/resolve.js';
|
|
3
|
+
import { assertAccountOwnersConfigured } from '../config/validate.js';
|
|
4
|
+
import { createAccountFacade } from './account.js';
|
|
5
|
+
import { createConfiguredCoreComposition } from './compose.js';
|
|
6
|
+
export function composeSdk(input) {
|
|
7
|
+
const resolved = resolveSdkConfig(input);
|
|
8
|
+
return {
|
|
9
|
+
composition: createConfiguredCoreComposition(resolved),
|
|
10
|
+
snapshot: captureLegacySdkConfig(input, resolved.auth),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function attachAccount(sdk, config) {
|
|
14
|
+
const compatibilityConfig = createLegacyAccountConfig(config, sdk.snapshot);
|
|
15
|
+
assertAccountOwnersConfigured(materializeAccountInvocationContext(sdk.composition.config, compatibilityConfig, 'get-address').account);
|
|
16
|
+
return createAccountFacade(compatibilityConfig, sdk.composition);
|
|
17
|
+
}
|