@rhinestone/sdk 2.0.0-beta.44 → 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/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/{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} +4 -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 +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 +498 -498
- 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} +23 -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,766 @@
|
|
|
1
|
+
import { isAddressEqual } from 'viem';
|
|
2
|
+
import { createAccountConstruction } from '../accounts/construction.js';
|
|
3
|
+
import { FactoryArgsNotAvailableError } from '../accounts/error.js';
|
|
4
|
+
import { createAccountAdapter } from '../accounts/registry.js';
|
|
5
|
+
import { toEvmChainReference } from '../chains/caip2.js';
|
|
6
|
+
import { getChainById } from '../chains/catalog.js';
|
|
7
|
+
import { createBundlerClient } from '../clients/bundler/client.js';
|
|
8
|
+
import { createConfiguredOrchestratorClient } from '../clients/orchestrator/client.js';
|
|
9
|
+
import { createPaymasterClient } from '../clients/paymaster/client.js';
|
|
10
|
+
import { createRpcPort } from '../clients/rpc/client.js';
|
|
11
|
+
import { accountMaterial, createStaticAccountRuntime, } from '../config/account-runtime.js';
|
|
12
|
+
import { getIntentExecutorModule } from '../modules/intent-executor.js';
|
|
13
|
+
import { readInstalledModules, readModuleInstallations, readOwners, } from '../modules/read-core.js';
|
|
14
|
+
import { defineValidator } from '../modules/validators/definition.js';
|
|
15
|
+
import { K1_DEFAULT_VALIDATOR_ADDRESS } from '../modules/validators/k1.js';
|
|
16
|
+
import { ecdsaSignerId } from '../modules/validators/signer-id.js';
|
|
17
|
+
import { getSessionDetails as buildSessionDetails, SESSION_LOCK_TAG, } from '../modules/validators/smart-sessions/authorization.js';
|
|
18
|
+
import { getSmartSessionEmissaryAddress } from '../modules/validators/smart-sessions/module.js';
|
|
19
|
+
import { readSessionEnabled, readSessionNonce, } from '../modules/validators/smart-sessions/state.js';
|
|
20
|
+
import { createAccountSigningContext, getAccountSignatureRoute, getSigningValidatorCodec, getSigningValidatorFactors, } from '../signing/context.js';
|
|
21
|
+
import { createNexusEip7702InitTypedData, signAuthorizationList, signNexusEip7702Init, } from '../signing/eip7702.js';
|
|
22
|
+
import { createValidatorSigningTasks, signingTopology } from '../signing/plan.js';
|
|
23
|
+
import { resolveSessionEnableChain, signSessionEnablement, } from '../signing/session-enable.js';
|
|
24
|
+
import { createSignerInvocationPort } from '../signing/signers/registry.js';
|
|
25
|
+
import { resolveAccountTypedDataSigning } from '../signing/typed-data.js';
|
|
26
|
+
import { buildIntentSigningInput, prepareIntent, } from '../transactions/intents/prepare.js';
|
|
27
|
+
import { sendIntent } from '../transactions/intents/send.js';
|
|
28
|
+
import { prepareIntentSessions } from '../transactions/intents/sessions.js';
|
|
29
|
+
import { assembleIntent, signIntent, signIntentAsOwner, } from '../transactions/intents/sign-transaction.js';
|
|
30
|
+
import { splitIntents } from '../transactions/intents/split.js';
|
|
31
|
+
import { getIntentStatus, waitForIntentStatus, } from '../transactions/intents/status.js';
|
|
32
|
+
import { submitIntent } from '../transactions/intents/submit.js';
|
|
33
|
+
import { prepareUserOperation } from '../transactions/user-operations/prepare.js';
|
|
34
|
+
import { reconstructPreparedUserOperation, reconstructSignedUserOperation, } from '../transactions/user-operations/reconstruct.js';
|
|
35
|
+
import { sendUserOperation } from '../transactions/user-operations/send.js';
|
|
36
|
+
import { signUserOperation } from '../transactions/user-operations/sign.js';
|
|
37
|
+
import { getUserOperationStatus, waitForUserOperationStatus, } from '../transactions/user-operations/status.js';
|
|
38
|
+
import { submitUserOperation } from '../transactions/user-operations/submit.js';
|
|
39
|
+
import { signRuntimeMessage, signRuntimeTypedData } from './direct-signing.js';
|
|
40
|
+
import { getAppFeeBalances } from './queries/app-fees.js';
|
|
41
|
+
import { getPortfolio } from './queries/portfolio.js';
|
|
42
|
+
import { createSession } from './queries/session.js';
|
|
43
|
+
const sessionEnabledAbi = [
|
|
44
|
+
{
|
|
45
|
+
type: 'function',
|
|
46
|
+
name: 'isPermissionEnabled',
|
|
47
|
+
stateMutability: 'view',
|
|
48
|
+
inputs: [
|
|
49
|
+
{ name: 'account', type: 'address' },
|
|
50
|
+
{ name: 'permissionId', type: 'bytes32' },
|
|
51
|
+
],
|
|
52
|
+
outputs: [{ name: 'enabled', type: 'bool' }],
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
export function createCoreComposition(config, dependencies, resolveAccountDependencies = () => dependencies) {
|
|
56
|
+
const project = {
|
|
57
|
+
getIntentStatus: (intentId) => getIntentStatus({ statusClient: dependencies.orchestrator }, intentId),
|
|
58
|
+
splitIntents: (input) => splitIntents(dependencies.orchestrator, input),
|
|
59
|
+
getAppFeeBalances: () => getAppFeeBalances(dependencies.orchestrator),
|
|
60
|
+
createSession: (definition) => createSession({
|
|
61
|
+
orchestrator: dependencies.orchestrator,
|
|
62
|
+
environment: config.environment,
|
|
63
|
+
definition,
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
config,
|
|
68
|
+
project,
|
|
69
|
+
createAccount: (context) => createAccountComposition(context, resolveAccountDependencies(context)),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function createConfiguredCoreComposition(config) {
|
|
73
|
+
return createCoreComposition(config, createConfiguredDependencies(config), (context) => createConfiguredDependencies(context.sdk));
|
|
74
|
+
}
|
|
75
|
+
function createConfiguredDependencies(config) {
|
|
76
|
+
const rpc = createRpcPort(config.provider);
|
|
77
|
+
return {
|
|
78
|
+
orchestrator: createConfiguredOrchestratorClient(config),
|
|
79
|
+
rpc,
|
|
80
|
+
bundler: createBundlerClient({
|
|
81
|
+
endpoint: config.bundler,
|
|
82
|
+
provider: config.provider,
|
|
83
|
+
}),
|
|
84
|
+
...(config.paymaster
|
|
85
|
+
? { paymaster: createPaymasterClient({ endpoint: config.paymaster }) }
|
|
86
|
+
: {}),
|
|
87
|
+
clock: {
|
|
88
|
+
now: Date.now,
|
|
89
|
+
sleep: (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)),
|
|
90
|
+
timeout: (promise, milliseconds, error) => new Promise((resolve, reject) => {
|
|
91
|
+
const timer = setTimeout(() => reject(error()), milliseconds);
|
|
92
|
+
promise.then((value) => {
|
|
93
|
+
clearTimeout(timer);
|
|
94
|
+
resolve(value);
|
|
95
|
+
}, (reason) => {
|
|
96
|
+
clearTimeout(timer);
|
|
97
|
+
reject(reason);
|
|
98
|
+
});
|
|
99
|
+
}),
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function createAccountComposition(initialContext, dependencies) {
|
|
104
|
+
const workflows = {
|
|
105
|
+
getAddress: (context, chain) => createStaticAccountRuntime(context.account, chain, false).identity
|
|
106
|
+
.address,
|
|
107
|
+
signMessage: async (context, input) => {
|
|
108
|
+
const account = createAccountRuntimePort(context.account, dependencies);
|
|
109
|
+
const session = input.signers?.kind === 'smart-session'
|
|
110
|
+
? directSession(input.signers, input.chain)
|
|
111
|
+
: undefined;
|
|
112
|
+
return signRuntimeMessage({
|
|
113
|
+
...input,
|
|
114
|
+
runtime: await account.forChain(input.chain),
|
|
115
|
+
signerInvoker: signerInvoker(context.account, dependencies, session
|
|
116
|
+
? defineValidator(session.session.owners, 'smart-session-validator')
|
|
117
|
+
: input.signers?.kind === 'owner'
|
|
118
|
+
? input.signers.validator
|
|
119
|
+
: undefined),
|
|
120
|
+
checkpoints: checkpointPort(context.account, dependencies),
|
|
121
|
+
...(input.signers?.kind === 'owner'
|
|
122
|
+
? { selection: input.signers }
|
|
123
|
+
: {}),
|
|
124
|
+
...(session ? { session } : {}),
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
signTypedData: async (context, input) => {
|
|
128
|
+
const account = createAccountRuntimePort(context.account, dependencies);
|
|
129
|
+
const session = input.signers?.kind === 'smart-session'
|
|
130
|
+
? directSession(input.signers, input.chain)
|
|
131
|
+
: undefined;
|
|
132
|
+
return signRuntimeTypedData({
|
|
133
|
+
...input,
|
|
134
|
+
runtime: await account.forChain(input.chain),
|
|
135
|
+
signerInvoker: signerInvoker(context.account, dependencies, session
|
|
136
|
+
? defineValidator(session.session.owners, 'smart-session-validator')
|
|
137
|
+
: input.signers?.kind === 'owner'
|
|
138
|
+
? input.signers.validator
|
|
139
|
+
: undefined),
|
|
140
|
+
checkpoints: checkpointPort(context.account, dependencies),
|
|
141
|
+
...(input.signers?.kind === 'owner'
|
|
142
|
+
? { selection: input.signers }
|
|
143
|
+
: {}),
|
|
144
|
+
...(session ? { session } : {}),
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
signEip7702InitData: (context) => signEip7702InitData(context.account, dependencies),
|
|
148
|
+
signAuthorizations: (context, input) => signEip7702Authorizations(context.account, input, dependencies),
|
|
149
|
+
prepareIntent: (context, input) => prepareIntent(intentContext(context, dependencies), input),
|
|
150
|
+
signIntent: async (context, input) => {
|
|
151
|
+
const ownerSelection = input.input.signers?.kind === 'owner' ? input.input.signers : undefined;
|
|
152
|
+
const intent = await signIntent(intentContext(context, dependencies, ownerSelection?.validator), input);
|
|
153
|
+
return { intent, transcript: intent.transcript };
|
|
154
|
+
},
|
|
155
|
+
signIntentAsOwner: (context, input, selection) => {
|
|
156
|
+
const ownerSelection = input.input.signers?.kind === 'owner' ? input.input.signers : undefined;
|
|
157
|
+
return signIntentAsOwner(intentContext(context, dependencies, ownerSelection?.validator), input, selection);
|
|
158
|
+
},
|
|
159
|
+
assembleIntent: (context, input, signatures) => assembleIntent(intentContext(context, dependencies), input, signatures),
|
|
160
|
+
submitIntent: (context, input) => submitIntent(intentContext(context, dependencies), input),
|
|
161
|
+
sendIntent: (context, input) => sendIntent(intentContext(context, dependencies), input),
|
|
162
|
+
waitForIntentStatus: (context, intentId) => waitForIntentStatus(intentContext(context, dependencies), intentId),
|
|
163
|
+
prepareUserOperation: (context, input) => prepareUserOperation(userOperationContext(context, dependencies, input.signers), input),
|
|
164
|
+
signUserOperation: (context, input) => signUserOperation(userOperationContext(context, dependencies, input.input.signers), input),
|
|
165
|
+
submitUserOperation: (context, input) => submitUserOperation(userOperationContext(context, dependencies), input),
|
|
166
|
+
sendUserOperation: (context, input) => sendUserOperation(userOperationContext(context, dependencies, input.signers), input),
|
|
167
|
+
getUserOperationStatus: (context, input) => getUserOperationStatus(userOperationContext(context, dependencies), input),
|
|
168
|
+
waitForUserOperationStatus: (context, input) => waitForUserOperationStatus(userOperationContext(context, dependencies), input),
|
|
169
|
+
reconstructPreparedUserOperation: (context, input) => reconstructPreparedUserOperation(userOperationContext(context, dependencies, input.signers), input),
|
|
170
|
+
reconstructSignedUserOperation: (context, input) => reconstructSignedUserOperation(userOperationContext(context, dependencies, input.signers), input),
|
|
171
|
+
getPortfolio: (context, onTestnets = false) => getPortfolio({
|
|
172
|
+
account: createAccountRuntimePort(context.account, dependencies),
|
|
173
|
+
client: dependencies.orchestrator,
|
|
174
|
+
onTestnets,
|
|
175
|
+
}),
|
|
176
|
+
getInitData: (context) => accountInitData(context.account),
|
|
177
|
+
isDeployed: (context, chain) => isAccountDeployed(context.account, chain, dependencies),
|
|
178
|
+
deploy: (context, chain, options) => deployAccount(context, chain, options, dependencies),
|
|
179
|
+
setup: (context, chain) => setupAccount(context, chain, dependencies),
|
|
180
|
+
getTransactionMessages: (prepared) => intentMessages(prepared),
|
|
181
|
+
reconstructPreparedIntent: (context, input) => reconstructPreparedIntent(context, input, dependencies),
|
|
182
|
+
signIntentFromSignData: (context, input) => signIntentFromSignData(context, input, dependencies),
|
|
183
|
+
getOwners: (context, chain) => readOwners({
|
|
184
|
+
rpc: dependencies.rpc.forChain(chain),
|
|
185
|
+
chain,
|
|
186
|
+
accountKind: context.account.account.kind,
|
|
187
|
+
account: createStaticAccountRuntime(context.account, chain, false)
|
|
188
|
+
.identity.address,
|
|
189
|
+
...(hcaFactory(context.account)
|
|
190
|
+
? { hcaFactory: hcaFactory(context.account) }
|
|
191
|
+
: {}),
|
|
192
|
+
}),
|
|
193
|
+
getValidators: (context, chain) => readInstalledModules({
|
|
194
|
+
rpc: dependencies.rpc.forChain(chain),
|
|
195
|
+
chain,
|
|
196
|
+
accountKind: context.account.account.kind,
|
|
197
|
+
account: createStaticAccountRuntime(context.account, chain, false)
|
|
198
|
+
.identity.address,
|
|
199
|
+
kind: 'validator',
|
|
200
|
+
}),
|
|
201
|
+
getExecutors: (context, chain) => readInstalledModules({
|
|
202
|
+
rpc: dependencies.rpc.forChain(chain),
|
|
203
|
+
chain,
|
|
204
|
+
accountKind: context.account.account.kind,
|
|
205
|
+
account: createStaticAccountRuntime(context.account, chain, false)
|
|
206
|
+
.identity.address,
|
|
207
|
+
kind: 'executor',
|
|
208
|
+
}),
|
|
209
|
+
getSessionDetails: (context, sessions) => accountSessionDetails(context.account, sessions, dependencies),
|
|
210
|
+
isSessionEnabled: (context, session) => accountSessionEnabled(context.account, session, dependencies),
|
|
211
|
+
signEnableSession: (context, details) => signAccountEnableSession(context, details, dependencies),
|
|
212
|
+
};
|
|
213
|
+
return { context: initialContext, workflows };
|
|
214
|
+
}
|
|
215
|
+
async function signEip7702InitData(account, dependencies) {
|
|
216
|
+
const chain = referenceChain();
|
|
217
|
+
const runtime = createStaticAccountRuntime(account, chain, false);
|
|
218
|
+
const adoption = runtime.adapter.getEip7702AdoptionPlan?.(runtime.construction);
|
|
219
|
+
if (!adoption || !account.eoa) {
|
|
220
|
+
throw new Error('EIP-7702 initialization is unavailable for this account');
|
|
221
|
+
}
|
|
222
|
+
return signNexusEip7702Init({
|
|
223
|
+
planInput: {
|
|
224
|
+
typedData: createNexusEip7702InitTypedData(adoption),
|
|
225
|
+
signer: {
|
|
226
|
+
id: ecdsaSignerId(account.eoa),
|
|
227
|
+
kind: 'ecdsa',
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
signerInvoker: signerInvoker(account, dependencies),
|
|
231
|
+
checkpoints: { read: async () => [] },
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
async function signEip7702Authorizations(account, input, dependencies) {
|
|
235
|
+
if (!input.eip7702InitSignature)
|
|
236
|
+
return { authorizations: [] };
|
|
237
|
+
const chains = input.chains.flatMap((chain) => chain.kind === 'evm' ? [chain] : []);
|
|
238
|
+
const firstChain = chains[0];
|
|
239
|
+
if (!firstChain || !account.eoa) {
|
|
240
|
+
throw new Error('EIP-7702 authorization requires an EVM chain and EOA');
|
|
241
|
+
}
|
|
242
|
+
const runtime = createStaticAccountRuntime(account, firstChain, false);
|
|
243
|
+
const adoption = runtime.adapter.getEip7702AdoptionPlan?.(runtime.construction);
|
|
244
|
+
if (!adoption) {
|
|
245
|
+
throw new Error('EIP-7702 authorization is unavailable for this account');
|
|
246
|
+
}
|
|
247
|
+
const facts = new Map();
|
|
248
|
+
const nonceByChain = {};
|
|
249
|
+
for (const chain of chains) {
|
|
250
|
+
if (facts.has(chain.id))
|
|
251
|
+
continue;
|
|
252
|
+
const rpc = dependencies.rpc.forChain(chain);
|
|
253
|
+
const { code } = await rpc.getCode({ chain }, account.eoa.address);
|
|
254
|
+
facts.set(chain.id, {
|
|
255
|
+
kind: 'delegation-code',
|
|
256
|
+
id: `delegation-${chain.id}`,
|
|
257
|
+
...(code ? { code } : {}),
|
|
258
|
+
});
|
|
259
|
+
const delegated = code?.toLowerCase() ===
|
|
260
|
+
`0xef0100${adoption.contract.slice(2)}`.toLowerCase();
|
|
261
|
+
nonceByChain[chain.id] = delegated
|
|
262
|
+
? 0
|
|
263
|
+
: Number(await rpc.getTransactionCount({ chain }, account.eoa.address));
|
|
264
|
+
}
|
|
265
|
+
const result = await signAuthorizationList({
|
|
266
|
+
planInput: {
|
|
267
|
+
account: account.eoa.address,
|
|
268
|
+
contract: adoption.contract,
|
|
269
|
+
chains,
|
|
270
|
+
signer: {
|
|
271
|
+
id: ecdsaSignerId(account.eoa),
|
|
272
|
+
kind: 'ecdsa',
|
|
273
|
+
},
|
|
274
|
+
nonceByChain,
|
|
275
|
+
},
|
|
276
|
+
signerInvoker: signerInvoker(account, dependencies),
|
|
277
|
+
checkpoints: {
|
|
278
|
+
read: async (checkpoint) => {
|
|
279
|
+
if (checkpoint.kind !== 'delegation-code')
|
|
280
|
+
return [];
|
|
281
|
+
const fact = facts.get(checkpoint.chain.id);
|
|
282
|
+
if (!fact)
|
|
283
|
+
throw new Error(`Missing delegation fact ${checkpoint.id}`);
|
|
284
|
+
return [fact];
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
return result;
|
|
289
|
+
}
|
|
290
|
+
function referenceChain() {
|
|
291
|
+
// Account addresses are CREATE2 and chain-independent, so initialization only
|
|
292
|
+
// needs some EVM chain reference. With no bundled chain set, use mainnet.
|
|
293
|
+
return toEvmChainReference(1);
|
|
294
|
+
}
|
|
295
|
+
function accountInitData(account) {
|
|
296
|
+
const runtime = createStaticAccountRuntime(account, referenceChain(), false);
|
|
297
|
+
const plan = runtime.adapter.getDeploymentPlan(runtime.construction);
|
|
298
|
+
if (!plan.factory || !plan.factoryData) {
|
|
299
|
+
throw new FactoryArgsNotAvailableError();
|
|
300
|
+
}
|
|
301
|
+
return { factory: plan.factory, factoryData: plan.factoryData };
|
|
302
|
+
}
|
|
303
|
+
function hcaFactory(account) {
|
|
304
|
+
if (account.account.kind !== 'hca')
|
|
305
|
+
return undefined;
|
|
306
|
+
if (account.account.factory.source === 'explicit') {
|
|
307
|
+
return account.account.factory.value;
|
|
308
|
+
}
|
|
309
|
+
return account.initData && 'factory' in account.initData
|
|
310
|
+
? account.initData.factory
|
|
311
|
+
: undefined;
|
|
312
|
+
}
|
|
313
|
+
async function isAccountDeployed(account, chain, dependencies) {
|
|
314
|
+
if (account.account.kind === 'eoa')
|
|
315
|
+
return true;
|
|
316
|
+
const runtime = createStaticAccountRuntime(account, chain, false);
|
|
317
|
+
const { code } = await dependencies.rpc
|
|
318
|
+
.forChain(chain)
|
|
319
|
+
.getCode({ chain }, runtime.identity.address);
|
|
320
|
+
return code !== undefined && code !== '0x';
|
|
321
|
+
}
|
|
322
|
+
function intentMessages(prepared) {
|
|
323
|
+
const { signData } = prepared.quote;
|
|
324
|
+
return {
|
|
325
|
+
origin: [...signData.origin],
|
|
326
|
+
destination: signData.destination,
|
|
327
|
+
...(signData.targetExecution
|
|
328
|
+
? { targetExecution: signData.targetExecution }
|
|
329
|
+
: {}),
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
const zeroAddress = '0x0000000000000000000000000000000000000000';
|
|
333
|
+
async function deployAccount(context, chain, options, dependencies) {
|
|
334
|
+
const account = context.account;
|
|
335
|
+
if (account.account.kind === 'eoa')
|
|
336
|
+
return false;
|
|
337
|
+
if (await isAccountDeployed(account, chain, dependencies))
|
|
338
|
+
return false;
|
|
339
|
+
const runtime = createStaticAccountRuntime(account, chain, false);
|
|
340
|
+
const adoption = account.eoa
|
|
341
|
+
? runtime.adapter.getEip7702AdoptionPlan?.(runtime.construction)
|
|
342
|
+
: undefined;
|
|
343
|
+
const intentExecutorInstalled = account.initData && 'intentExecutorInstalled' in account.initData
|
|
344
|
+
? account.initData.intentExecutorInstalled
|
|
345
|
+
: false;
|
|
346
|
+
const asUserOp = Boolean(account.initData) && !intentExecutorInstalled;
|
|
347
|
+
const useUserOperation = !adoption && (asUserOp || context.sdk.bundler?.kind === 'custom');
|
|
348
|
+
let initSignature = options?.eip7702InitSignature;
|
|
349
|
+
if (adoption && !initSignature) {
|
|
350
|
+
initSignature = (await signEip7702InitData(account, dependencies)).signature;
|
|
351
|
+
}
|
|
352
|
+
if (useUserOperation) {
|
|
353
|
+
const plan = runtime.adapter.getDeploymentPlan(runtime.construction);
|
|
354
|
+
if (!plan.factory || !plan.factoryData) {
|
|
355
|
+
throw new FactoryArgsNotAvailableError();
|
|
356
|
+
}
|
|
357
|
+
const workflowContext = userOperationContext(context, dependencies);
|
|
358
|
+
const submitted = await sendUserOperation(workflowContext, {
|
|
359
|
+
chain,
|
|
360
|
+
calls: [{ target: zeroAddress, value: 0n, data: '0x' }],
|
|
361
|
+
});
|
|
362
|
+
await waitForUserOperationStatus(workflowContext, submitted);
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
const workflowContext = intentContext(context, dependencies);
|
|
366
|
+
const submitted = await sendIntent(workflowContext, {
|
|
367
|
+
destination: chain,
|
|
368
|
+
sourceChains: [chain],
|
|
369
|
+
calls: [],
|
|
370
|
+
tokenRequests: [],
|
|
371
|
+
...(initSignature ? { eip7702InitSignature: initSignature } : {}),
|
|
372
|
+
options: options?.sponsored
|
|
373
|
+
? { sponsorSettings: { gas: true, bridgeFees: true, swapFees: true } }
|
|
374
|
+
: {},
|
|
375
|
+
});
|
|
376
|
+
await waitForIntentStatus(workflowContext, submitted.intentId);
|
|
377
|
+
}
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
async function setupAccount(context, chain, dependencies) {
|
|
381
|
+
const account = context.account;
|
|
382
|
+
if (account.account.kind === 'eoa' || account.account.kind === 'hca') {
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
const runtime = createStaticAccountRuntime(account, chain, true);
|
|
386
|
+
const plan = runtime.construction.setup;
|
|
387
|
+
const candidates = [
|
|
388
|
+
...plan.validators,
|
|
389
|
+
...plan.executors,
|
|
390
|
+
...plan.fallbacks,
|
|
391
|
+
...plan.hooks,
|
|
392
|
+
].filter((module) => !(account.account.kind === 'startale' &&
|
|
393
|
+
isAddressEqual(module.address, K1_DEFAULT_VALIDATOR_ADDRESS)));
|
|
394
|
+
const installationState = await readModuleInstallations({
|
|
395
|
+
rpc: dependencies.rpc.forChain(chain),
|
|
396
|
+
chain,
|
|
397
|
+
account: runtime.identity.address,
|
|
398
|
+
modules: candidates,
|
|
399
|
+
});
|
|
400
|
+
const missing = candidates.filter((_module, index) => !installationState[index]);
|
|
401
|
+
if (missing.length === 0)
|
|
402
|
+
return false;
|
|
403
|
+
const calls = missing.flatMap((module) => runtime.adapter.encodeModuleInstallation(module).map((data) => ({
|
|
404
|
+
target: runtime.identity.address,
|
|
405
|
+
value: 0n,
|
|
406
|
+
data,
|
|
407
|
+
})));
|
|
408
|
+
const intentExecutor = getIntentExecutorModule(account.sessions.environment);
|
|
409
|
+
const usesIntent = missing.every((module) => !isAddressEqual(module.address, intentExecutor.address));
|
|
410
|
+
if (usesIntent) {
|
|
411
|
+
const submitted = await sendIntent(intentContext(context, dependencies), {
|
|
412
|
+
destination: chain,
|
|
413
|
+
sourceChains: [chain],
|
|
414
|
+
calls,
|
|
415
|
+
tokenRequests: [],
|
|
416
|
+
options: {},
|
|
417
|
+
});
|
|
418
|
+
await waitForIntentStatus(intentContext(context, dependencies), submitted.intentId);
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
const submitted = await sendUserOperation(userOperationContext(context, dependencies), { chain, calls });
|
|
422
|
+
await waitForUserOperationStatus(userOperationContext(context, dependencies), submitted);
|
|
423
|
+
}
|
|
424
|
+
return true;
|
|
425
|
+
}
|
|
426
|
+
function accountSessionDetails(account, sessions, dependencies) {
|
|
427
|
+
const address = createStaticAccountRuntime(account, referenceChain(), false)
|
|
428
|
+
.identity.address;
|
|
429
|
+
const environment = account.sessions.environment;
|
|
430
|
+
return buildSessionDetails({
|
|
431
|
+
account: address,
|
|
432
|
+
sessions,
|
|
433
|
+
environment,
|
|
434
|
+
readNonce: (session) => {
|
|
435
|
+
const chain = toEvmChainReference(session.chain.id);
|
|
436
|
+
return readSessionNonce({
|
|
437
|
+
rpc: dependencies.rpc.forChain(chain),
|
|
438
|
+
chain,
|
|
439
|
+
account: address,
|
|
440
|
+
lockTag: SESSION_LOCK_TAG,
|
|
441
|
+
environment,
|
|
442
|
+
});
|
|
443
|
+
},
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
function accountSessionEnabled(account, session, dependencies) {
|
|
447
|
+
const chain = toEvmChainReference(session.chain.id);
|
|
448
|
+
const address = createStaticAccountRuntime(account, chain, false).identity
|
|
449
|
+
.address;
|
|
450
|
+
return readSessionEnabled({
|
|
451
|
+
rpc: dependencies.rpc.forChain(chain),
|
|
452
|
+
chain,
|
|
453
|
+
account: address,
|
|
454
|
+
session,
|
|
455
|
+
environment: account.sessions.environment,
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
async function signAccountEnableSession(context, details, dependencies) {
|
|
459
|
+
const defaultChain = referenceChain();
|
|
460
|
+
const defaultRuntime = createStaticAccountRuntime(context.account, defaultChain, false);
|
|
461
|
+
const defaultSigning = createAccountSigningContext({
|
|
462
|
+
runtime: defaultRuntime,
|
|
463
|
+
purpose: 'session-enable',
|
|
464
|
+
signerInvoker: signerInvoker(context.account, dependencies),
|
|
465
|
+
});
|
|
466
|
+
const chain = resolveSessionEnableChain({
|
|
467
|
+
accountKind: context.account.account.kind,
|
|
468
|
+
validator: defaultSigning.validatorCapabilities.compatibilityKey.moduleAddress,
|
|
469
|
+
hashesAndChainIds: details.hashesAndChainIds,
|
|
470
|
+
defaultChain,
|
|
471
|
+
});
|
|
472
|
+
const runtime = chain.id === defaultChain.id
|
|
473
|
+
? defaultRuntime
|
|
474
|
+
: createStaticAccountRuntime(context.account, chain, false);
|
|
475
|
+
const signing = createAccountSigningContext({
|
|
476
|
+
runtime,
|
|
477
|
+
purpose: 'session-enable',
|
|
478
|
+
signerInvoker: signerInvoker(context.account, dependencies),
|
|
479
|
+
});
|
|
480
|
+
const topology = signingTopology(signing.validator);
|
|
481
|
+
const route = resolveAccountTypedDataSigning({
|
|
482
|
+
typedData: details.data,
|
|
483
|
+
chain,
|
|
484
|
+
context: signing,
|
|
485
|
+
});
|
|
486
|
+
const accountRoute = getAccountSignatureRoute(runtime, signing, route.erc7739, route.payloadKind);
|
|
487
|
+
const result = await signSessionEnablement({
|
|
488
|
+
context: signing,
|
|
489
|
+
checkpoints: checkpointPort(context.account, dependencies),
|
|
490
|
+
planInput: {
|
|
491
|
+
typedData: details.data,
|
|
492
|
+
signingMaterial: route.material,
|
|
493
|
+
chain,
|
|
494
|
+
...topology,
|
|
495
|
+
tasks: createValidatorSigningTasks({
|
|
496
|
+
validator: signing.validator,
|
|
497
|
+
signerReferences: signing.signerReferences,
|
|
498
|
+
taskPrefix: 'typed-data',
|
|
499
|
+
ecdsaInvocation: route.ecdsaInvocation,
|
|
500
|
+
webauthnInvocation: route.webauthnInvocation,
|
|
501
|
+
}),
|
|
502
|
+
validatorCodec: getSigningValidatorCodec(signing, route.payloadKind),
|
|
503
|
+
...(signing.validator.kind === 'multi-factor'
|
|
504
|
+
? {
|
|
505
|
+
validatorFactors: getSigningValidatorFactors(signing, route.payloadKind),
|
|
506
|
+
}
|
|
507
|
+
: {}),
|
|
508
|
+
route: {
|
|
509
|
+
erc7739: accountRoute.erc7739,
|
|
510
|
+
accountEnvelope: accountRoute.accountEnvelope,
|
|
511
|
+
erc6492: { kind: 'none' },
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
});
|
|
515
|
+
return result.signature;
|
|
516
|
+
}
|
|
517
|
+
async function reconstructPreparedIntent(context, input, dependencies) {
|
|
518
|
+
const originChainId = Number(input.quote.signData.origin.at(-1)?.domain?.chainId);
|
|
519
|
+
const accountChain = toEvmChainReference(originChainId);
|
|
520
|
+
const runtime = await createAccountRuntimePort(context.account, dependencies).forChain(accountChain);
|
|
521
|
+
let resolvedSessions;
|
|
522
|
+
if (input.intentInput.signers?.kind === 'smart-session') {
|
|
523
|
+
const prepared = await prepareIntentSessions({
|
|
524
|
+
intent: input.intentInput,
|
|
525
|
+
runtime,
|
|
526
|
+
context: { checkpoints: checkpointPort(context.account, dependencies) },
|
|
527
|
+
});
|
|
528
|
+
resolvedSessions = prepared?.byChain;
|
|
529
|
+
}
|
|
530
|
+
const destination = input.intentInput.destination.kind === 'evm'
|
|
531
|
+
? input.intentInput.destination
|
|
532
|
+
: undefined;
|
|
533
|
+
const signing = buildIntentSigningInput(runtime, input.quote, resolvedSessions, destination, input.intentInput.signers?.kind === 'owner'
|
|
534
|
+
? input.intentInput.signers.validator
|
|
535
|
+
: undefined, input.intentInput.signers?.kind === 'owner'
|
|
536
|
+
? input.intentInput.signers.signerIds
|
|
537
|
+
: undefined);
|
|
538
|
+
return {
|
|
539
|
+
traceId: input.traceId,
|
|
540
|
+
input: input.intentInput,
|
|
541
|
+
request: input.request,
|
|
542
|
+
quote: input.quote,
|
|
543
|
+
quotes: input.quotes,
|
|
544
|
+
signing,
|
|
545
|
+
accountChain,
|
|
546
|
+
...(resolvedSessions
|
|
547
|
+
? {
|
|
548
|
+
resolvedSessions,
|
|
549
|
+
sessionEnvironment: runtime.construction.sessions.environment,
|
|
550
|
+
}
|
|
551
|
+
: {}),
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
async function signIntentFromSignData(context, input, dependencies) {
|
|
555
|
+
const originChainId = Number(input.signData.origin.at(-1)?.domain?.chainId);
|
|
556
|
+
const accountChain = toEvmChainReference(originChainId);
|
|
557
|
+
const runtime = await createAccountRuntimePort(context.account, dependencies).forChain(accountChain);
|
|
558
|
+
let resolvedSessions;
|
|
559
|
+
if (input.signers?.kind === 'smart-session') {
|
|
560
|
+
const preparedSessions = await prepareIntentSessions({
|
|
561
|
+
intent: {
|
|
562
|
+
destination: input.targetChain,
|
|
563
|
+
calls: [],
|
|
564
|
+
tokenRequests: [],
|
|
565
|
+
signers: input.signers,
|
|
566
|
+
},
|
|
567
|
+
runtime,
|
|
568
|
+
context: { checkpoints: checkpointPort(context.account, dependencies) },
|
|
569
|
+
});
|
|
570
|
+
resolvedSessions = preparedSessions?.byChain;
|
|
571
|
+
}
|
|
572
|
+
const destination = input.targetChain.kind === 'evm' ? input.targetChain : undefined;
|
|
573
|
+
const quote = {
|
|
574
|
+
signData: {
|
|
575
|
+
origin: [...input.signData.origin],
|
|
576
|
+
destination: input.signData.destination,
|
|
577
|
+
...(input.signData.targetExecution
|
|
578
|
+
? { targetExecution: input.signData.targetExecution }
|
|
579
|
+
: {}),
|
|
580
|
+
},
|
|
581
|
+
};
|
|
582
|
+
const signing = buildIntentSigningInput(runtime, quote, resolvedSessions, destination, input.signers?.kind === 'owner' ? input.signers.validator : undefined, input.signers?.kind === 'owner' ? input.signers.signerIds : undefined);
|
|
583
|
+
const prepared = {
|
|
584
|
+
traceId: '',
|
|
585
|
+
input: {
|
|
586
|
+
destination: input.targetChain,
|
|
587
|
+
calls: [],
|
|
588
|
+
tokenRequests: [],
|
|
589
|
+
...(input.signers ? { signers: input.signers } : {}),
|
|
590
|
+
},
|
|
591
|
+
request: {},
|
|
592
|
+
quote,
|
|
593
|
+
quotes: [quote],
|
|
594
|
+
signing,
|
|
595
|
+
accountChain,
|
|
596
|
+
...(resolvedSessions
|
|
597
|
+
? {
|
|
598
|
+
resolvedSessions,
|
|
599
|
+
sessionEnvironment: runtime.construction.sessions.environment,
|
|
600
|
+
}
|
|
601
|
+
: {}),
|
|
602
|
+
};
|
|
603
|
+
const signed = await signIntent(intentContext(context, dependencies, input.signers?.kind === 'owner' ? input.signers.validator : undefined), prepared);
|
|
604
|
+
return {
|
|
605
|
+
originSignatures: signed.originSignatures,
|
|
606
|
+
destinationSignature: signed.destinationSignature,
|
|
607
|
+
targetExecutionSignature: signed.targetSignature,
|
|
608
|
+
transcript: signed.transcript,
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
function intentContext(context, dependencies, validator) {
|
|
612
|
+
return {
|
|
613
|
+
compatibilityConfig: context.compatibilityConfig,
|
|
614
|
+
account: createAccountRuntimePort(context.account, dependencies),
|
|
615
|
+
quoteClient: dependencies.orchestrator,
|
|
616
|
+
submissionClient: dependencies.orchestrator,
|
|
617
|
+
statusClient: dependencies.orchestrator,
|
|
618
|
+
signerInvoker: signerInvoker(context.account, dependencies, validator),
|
|
619
|
+
checkpoints: checkpointPort(context.account, dependencies),
|
|
620
|
+
signAuthorizations: async (input) => (await signEip7702Authorizations(context.account, input, dependencies))
|
|
621
|
+
.authorizations,
|
|
622
|
+
clock: dependencies.clock,
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
function userOperationContext(context, dependencies, selection) {
|
|
626
|
+
if (!dependencies.bundler) {
|
|
627
|
+
throw new Error('A bundler client is required for UserOperations');
|
|
628
|
+
}
|
|
629
|
+
return {
|
|
630
|
+
compatibilityConfig: context.compatibilityConfig,
|
|
631
|
+
account: createAccountRuntimePort(context.account, dependencies),
|
|
632
|
+
rpc: dependencies.rpc,
|
|
633
|
+
bundler: dependencies.bundler,
|
|
634
|
+
...(dependencies.paymaster ? { paymaster: dependencies.paymaster } : {}),
|
|
635
|
+
signerInvoker: signerInvoker(context.account, dependencies, selection?.validator),
|
|
636
|
+
checkpoints: checkpointPort(context.account, dependencies),
|
|
637
|
+
clock: dependencies.clock,
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
function createAccountRuntimePort(account, dependencies) {
|
|
641
|
+
const cache = new Map();
|
|
642
|
+
return {
|
|
643
|
+
forChain: (chain) => {
|
|
644
|
+
const existing = cache.get(chain.id);
|
|
645
|
+
if (existing)
|
|
646
|
+
return existing;
|
|
647
|
+
const pending = materializeAccountRuntime(account, dependencies, chain);
|
|
648
|
+
cache.set(chain.id, pending);
|
|
649
|
+
return pending;
|
|
650
|
+
},
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
async function materializeAccountRuntime(resolved, dependencies, chain) {
|
|
654
|
+
const material = accountMaterial(resolved);
|
|
655
|
+
const pendingConstruction = createAccountConstruction({
|
|
656
|
+
material,
|
|
657
|
+
chain,
|
|
658
|
+
deployed: false,
|
|
659
|
+
});
|
|
660
|
+
const pendingAdapter = createAccountAdapter(pendingConstruction);
|
|
661
|
+
const identity = pendingAdapter.getIdentity(pendingConstruction);
|
|
662
|
+
const { code } = await dependencies.rpc
|
|
663
|
+
.forChain(chain)
|
|
664
|
+
.getCode({ chain }, identity.address);
|
|
665
|
+
const deployed = code !== undefined && code !== '0x';
|
|
666
|
+
if (!deployed) {
|
|
667
|
+
return {
|
|
668
|
+
adapter: pendingAdapter,
|
|
669
|
+
construction: pendingConstruction,
|
|
670
|
+
identity,
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
const construction = createAccountConstruction({
|
|
674
|
+
material,
|
|
675
|
+
chain,
|
|
676
|
+
deployed: true,
|
|
677
|
+
});
|
|
678
|
+
const adapter = createAccountAdapter(construction);
|
|
679
|
+
return {
|
|
680
|
+
adapter,
|
|
681
|
+
construction,
|
|
682
|
+
identity: adapter.getIdentity(construction),
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
function signerInvoker(account, dependencies, validator) {
|
|
686
|
+
return (dependencies.signerInvoker ??
|
|
687
|
+
createSignerInvocationPort({
|
|
688
|
+
signers: signerRegistry(account, validator),
|
|
689
|
+
resolveChain: (chain) => getChainById(chain.id),
|
|
690
|
+
}));
|
|
691
|
+
}
|
|
692
|
+
function signerRegistry(account, validator) {
|
|
693
|
+
const signers = {};
|
|
694
|
+
for (const owner of [
|
|
695
|
+
...validatorOwners(account.owners),
|
|
696
|
+
...validatorOwners(validator),
|
|
697
|
+
]) {
|
|
698
|
+
signers[owner.signerId] =
|
|
699
|
+
owner.kind === 'webauthn'
|
|
700
|
+
? { kind: 'webauthn', account: owner.account }
|
|
701
|
+
: { kind: 'ecdsa', account: owner.account };
|
|
702
|
+
}
|
|
703
|
+
if (account.eoa) {
|
|
704
|
+
signers[ecdsaSignerId(account.eoa)] = {
|
|
705
|
+
kind: 'ecdsa',
|
|
706
|
+
account: account.eoa,
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
return signers;
|
|
710
|
+
}
|
|
711
|
+
function validatorOwners(validator) {
|
|
712
|
+
if (!validator)
|
|
713
|
+
return [];
|
|
714
|
+
return validator.kind === 'multi-factor'
|
|
715
|
+
? validator.validators.flatMap(({ owners }) => owners)
|
|
716
|
+
: validator.owners;
|
|
717
|
+
}
|
|
718
|
+
function directSession(selection, chain) {
|
|
719
|
+
const selected = selection.byChain[chain.id];
|
|
720
|
+
if (!selected)
|
|
721
|
+
throw new Error(`No session configured for chain ${chain.id}`);
|
|
722
|
+
return {
|
|
723
|
+
kind: 'smart-session',
|
|
724
|
+
session: selected.session,
|
|
725
|
+
...(selected.enableData ? { enableData: selected.enableData } : {}),
|
|
726
|
+
verifyExecutions: false,
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
function checkpointPort(account, dependencies) {
|
|
730
|
+
return {
|
|
731
|
+
read: async (checkpoint) => {
|
|
732
|
+
const rpc = dependencies.rpc.forChain(checkpoint.chain);
|
|
733
|
+
switch (checkpoint.kind) {
|
|
734
|
+
case 'account-deployment': {
|
|
735
|
+
const { code } = await rpc.getCode({ chain: checkpoint.chain }, checkpoint.account);
|
|
736
|
+
return [
|
|
737
|
+
{
|
|
738
|
+
kind: 'account-deployed',
|
|
739
|
+
id: checkpoint.id,
|
|
740
|
+
deployed: code !== undefined && code !== '0x',
|
|
741
|
+
},
|
|
742
|
+
];
|
|
743
|
+
}
|
|
744
|
+
case 'delegation-code': {
|
|
745
|
+
const { code } = await rpc.getCode({ chain: checkpoint.chain }, checkpoint.account);
|
|
746
|
+
return [
|
|
747
|
+
{
|
|
748
|
+
kind: 'delegation-code',
|
|
749
|
+
id: checkpoint.id,
|
|
750
|
+
...(code ? { code } : {}),
|
|
751
|
+
},
|
|
752
|
+
];
|
|
753
|
+
}
|
|
754
|
+
case 'session-enabled': {
|
|
755
|
+
const enabled = await rpc.readContract({ chain: checkpoint.chain }, {
|
|
756
|
+
address: getSmartSessionEmissaryAddress(account.sessions.environment),
|
|
757
|
+
abi: sessionEnabledAbi,
|
|
758
|
+
functionName: 'isPermissionEnabled',
|
|
759
|
+
args: [checkpoint.account, checkpoint.permissionId],
|
|
760
|
+
});
|
|
761
|
+
return [{ kind: 'session-enabled', id: checkpoint.id, enabled }];
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
};
|
|
766
|
+
}
|