@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
|
@@ -1,680 +0,0 @@
|
|
|
1
|
-
import { concat, createPublicClient, encodeAbiParameters, encodeFunctionData, hashTypedData, isAddressEqual, size, zeroAddress, } from 'viem';
|
|
2
|
-
import { sendTransactionInternal, sendUserOperationInternal, waitForExecution, } from '../execution/index.js';
|
|
3
|
-
import { getIntentExecutor, getSetup } from '../modules/index.js';
|
|
4
|
-
import { MODULE_TYPE_ID_VALIDATOR } from '../modules/common.js';
|
|
5
|
-
import { getValidators as getValidatorsInternal, isValidatorInitialized, } from '../modules/read.js';
|
|
6
|
-
import { getOwnerValidator } from '../modules/validators/index.js';
|
|
7
|
-
import { AccountConfigurationNotSupportedError, AccountError, DefaultValidatorAlreadyInitializedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, FactoryArgsNotAvailableError, isAccountError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, WalletClientNoConnectedAccountError, } from './error.js';
|
|
8
|
-
import { getAddress as getHcaAddress, getDeployArgs as getHcaDeployArgs, getEip712Domain as getHcaEip712Domain, getSmartAccount as getHcaSmartAccount, packSignature as packHcaSignature, } from './hca.js';
|
|
9
|
-
import { getAddress as getKernelAddress, getDeployArgs as getKernelDeployArgs, getEip712Domain as getKernelEip712Domain, getInstallData as getKernelInstallData, getSmartAccount as getKernelSmartAccount, packSignature as packKernelSignature, wrapMessageHash as wrapKernelMessageHash, } from './kernel.js';
|
|
10
|
-
import { getAddress as getNexusAddress, getDefaultValidatorAddress as getNexusDefaultValidatorAddress, getDefaultValidatorInitData as getNexusDefaultValidatorInitData, getDeployArgs as getNexusDeployArgs, getEip712Domain as getNexusEip712Domain, getEip7702InitCall as getNexusEip7702InitCall, getInstallData as getNexusInstallData, getSmartAccount as getNexusSmartAccount, isDefaultValidatorConfigured as isNexusDefaultValidatorConfigured, packSignature as packNexusSignature, signEip7702InitData as signNexusEip7702InitData, } from './nexus.js';
|
|
11
|
-
import { getAddress as getSafeAddress, getDeployArgs as getSafeDeployArgs, getEip712Domain as getSafeEip712Domain, getInstallData as getSafeInstallData, getSmartAccount as getSafeSmartAccount, getV0DeployArgs as getSafeV0DeployArgs, packSignature as packSafeSignature, } from './safe.js';
|
|
12
|
-
import { convertOwnerSetToSignerSet } from './signing/common.js';
|
|
13
|
-
import { sign as signMessage } from './signing/message.js';
|
|
14
|
-
import { sign as signTypedData } from './signing/typedData.js';
|
|
15
|
-
import { getAddress as getStartaleAddress, getDeployArgs as getStartaleDeployArgs, getEip712Domain as getStartaleEip712Domain, getInstallData as getStartaleInstallData, getSmartAccount as getStartaleSmartAccount, packSignature as packStartaleSignature, K1_DEFAULT_VALIDATOR_ADDRESS as STARTALE_K1_VALIDATOR_ADDRESS, } from './startale.js';
|
|
16
|
-
import { createTransport, getBundlerClient, } from './utils.js';
|
|
17
|
-
function getDeployArgs(config) {
|
|
18
|
-
const account = getAccountProvider(config);
|
|
19
|
-
switch (account.type) {
|
|
20
|
-
case 'safe': {
|
|
21
|
-
return getSafeDeployArgs(config);
|
|
22
|
-
}
|
|
23
|
-
case 'nexus': {
|
|
24
|
-
return getNexusDeployArgs(config);
|
|
25
|
-
}
|
|
26
|
-
case 'kernel': {
|
|
27
|
-
return getKernelDeployArgs(config);
|
|
28
|
-
}
|
|
29
|
-
case 'startale': {
|
|
30
|
-
return getStartaleDeployArgs(config);
|
|
31
|
-
}
|
|
32
|
-
case 'hca': {
|
|
33
|
-
return getHcaDeployArgs(config);
|
|
34
|
-
}
|
|
35
|
-
case 'eoa': {
|
|
36
|
-
throw new Error('EOA accounts do not have deploy args');
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function getV0DeployArgs(config) {
|
|
41
|
-
const account = getAccountProvider(config);
|
|
42
|
-
switch (account.type) {
|
|
43
|
-
case 'safe': {
|
|
44
|
-
return getSafeV0DeployArgs(config);
|
|
45
|
-
}
|
|
46
|
-
default: {
|
|
47
|
-
throw new Error(`Unsupported account type: ${account.type}`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function getInitCode(config) {
|
|
52
|
-
if (is7702(config)) {
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
else if (config.account?.type === 'eoa') {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
else if (config.initData) {
|
|
59
|
-
return config.initData;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
const deployArgs = getDeployArgs(config);
|
|
63
|
-
if (!deployArgs) {
|
|
64
|
-
throw new FactoryArgsNotAvailableError();
|
|
65
|
-
}
|
|
66
|
-
const { factory, factoryData } = deployArgs;
|
|
67
|
-
return {
|
|
68
|
-
factory,
|
|
69
|
-
factoryData,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function getV0InitCode(config) {
|
|
74
|
-
if (is7702(config)) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
else if (config.account?.type === 'eoa') {
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
else if (config.initData) {
|
|
81
|
-
return config.initData;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
const deployArgs = getV0DeployArgs(config);
|
|
85
|
-
if (!deployArgs) {
|
|
86
|
-
throw new FactoryArgsNotAvailableError();
|
|
87
|
-
}
|
|
88
|
-
const { factory, factoryData } = deployArgs;
|
|
89
|
-
return {
|
|
90
|
-
factory,
|
|
91
|
-
factoryData,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async function signEip7702InitData(config) {
|
|
96
|
-
const eoa = config.eoa;
|
|
97
|
-
if (!eoa) {
|
|
98
|
-
throw new Eip7702AccountMustHaveEoaError();
|
|
99
|
-
}
|
|
100
|
-
const account = getAccountProvider(config);
|
|
101
|
-
switch (account.type) {
|
|
102
|
-
case 'nexus': {
|
|
103
|
-
return await signNexusEip7702InitData(config, eoa);
|
|
104
|
-
}
|
|
105
|
-
case 'eoa': {
|
|
106
|
-
throw new Eip7702NotSupportedForAccountError(account.type);
|
|
107
|
-
}
|
|
108
|
-
case 'safe':
|
|
109
|
-
case 'kernel':
|
|
110
|
-
case 'startale':
|
|
111
|
-
case 'hca': {
|
|
112
|
-
throw new Eip7702NotSupportedForAccountError(account.type);
|
|
113
|
-
}
|
|
114
|
-
default: {
|
|
115
|
-
throw new Eip7702NotSupportedForAccountError(account.type);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function getEip7702InitCall(config, signature) {
|
|
120
|
-
const account = getAccountProvider(config);
|
|
121
|
-
switch (account.type) {
|
|
122
|
-
case 'nexus': {
|
|
123
|
-
return getNexusEip7702InitCall(config, signature);
|
|
124
|
-
}
|
|
125
|
-
case 'safe':
|
|
126
|
-
case 'kernel':
|
|
127
|
-
case 'startale':
|
|
128
|
-
case 'hca': {
|
|
129
|
-
throw new Eip7702NotSupportedForAccountError(account.type);
|
|
130
|
-
}
|
|
131
|
-
default: {
|
|
132
|
-
throw new Eip7702NotSupportedForAccountError(account.type);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
function getEip712Domain(config, chain) {
|
|
137
|
-
const account = getAccountProvider(config);
|
|
138
|
-
switch (account.type) {
|
|
139
|
-
case 'nexus': {
|
|
140
|
-
return getNexusEip712Domain(config, chain);
|
|
141
|
-
}
|
|
142
|
-
case 'safe': {
|
|
143
|
-
return getSafeEip712Domain(config, chain);
|
|
144
|
-
}
|
|
145
|
-
case 'kernel': {
|
|
146
|
-
return getKernelEip712Domain(config, chain);
|
|
147
|
-
}
|
|
148
|
-
case 'startale': {
|
|
149
|
-
return getStartaleEip712Domain(config, chain);
|
|
150
|
-
}
|
|
151
|
-
case 'hca': {
|
|
152
|
-
return getHcaEip712Domain(config, chain);
|
|
153
|
-
}
|
|
154
|
-
case 'eoa': {
|
|
155
|
-
throw new Eip712DomainNotAvailableError('EOA accounts do not have an EIP-712 domain');
|
|
156
|
-
}
|
|
157
|
-
default: {
|
|
158
|
-
throw new Eip712DomainNotAvailableError(`Account type ${account.type} not yet supported`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function getModuleInstallationCalls(config, module) {
|
|
163
|
-
const address = getAddress(config);
|
|
164
|
-
function getInstallData() {
|
|
165
|
-
const account = getAccountProvider(config);
|
|
166
|
-
switch (account.type) {
|
|
167
|
-
case 'safe': {
|
|
168
|
-
return [getSafeInstallData(module)];
|
|
169
|
-
}
|
|
170
|
-
case 'nexus': {
|
|
171
|
-
return [getNexusInstallData(module)];
|
|
172
|
-
}
|
|
173
|
-
case 'kernel': {
|
|
174
|
-
return getKernelInstallData(module);
|
|
175
|
-
}
|
|
176
|
-
case 'startale': {
|
|
177
|
-
return [getStartaleInstallData(module)];
|
|
178
|
-
}
|
|
179
|
-
case 'hca': {
|
|
180
|
-
throw new ModuleInstallationNotSupportedError(account.type);
|
|
181
|
-
}
|
|
182
|
-
case 'eoa': {
|
|
183
|
-
throw new ModuleInstallationNotSupportedError(account.type);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
const installData = getInstallData();
|
|
188
|
-
return installData.map((data) => ({
|
|
189
|
-
to: address,
|
|
190
|
-
value: 0n,
|
|
191
|
-
data,
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
// Like `getModuleInstallationCalls`, but aware of the Nexus default validator.
|
|
195
|
-
// On Nexus the OwnableValidator is the hardwired default validator: it can't be
|
|
196
|
-
// added via `installModule` (reverts `DefaultValidatorAlreadyInstalled`), and
|
|
197
|
-
// passkey-bootstrapped accounts never initialize it, so `addOwner` reverts with
|
|
198
|
-
// `NotInitialized`. For that case we initialize it directly via `onInstall`.
|
|
199
|
-
async function getValidatorInstallationCalls(config, chain, module) {
|
|
200
|
-
const account = getAccountProvider(config);
|
|
201
|
-
if (account.type === 'nexus') {
|
|
202
|
-
const defaultValidatorAddress = getNexusDefaultValidatorAddress(account.version);
|
|
203
|
-
if (module.address.toLowerCase() === defaultValidatorAddress.toLowerCase()) {
|
|
204
|
-
// Treat the validator as initialized if the account's deployment will
|
|
205
|
-
// initialize it (config check, covers not-yet-deployed accounts) or if
|
|
206
|
-
// it is already initialized on-chain (covers accounts where ECDSA was
|
|
207
|
-
// enabled separately after deployment).
|
|
208
|
-
const initialized = isNexusDefaultValidatorConfigured(config) ||
|
|
209
|
-
(await isValidatorInitialized(getAddress(config), chain, defaultValidatorAddress, config.provider));
|
|
210
|
-
if (initialized) {
|
|
211
|
-
throw new DefaultValidatorAlreadyInitializedError();
|
|
212
|
-
}
|
|
213
|
-
return [
|
|
214
|
-
{
|
|
215
|
-
to: defaultValidatorAddress,
|
|
216
|
-
value: 0n,
|
|
217
|
-
data: getNexusDefaultValidatorInitData(module),
|
|
218
|
-
},
|
|
219
|
-
];
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return getModuleInstallationCalls(config, module);
|
|
223
|
-
}
|
|
224
|
-
// SentinelList head pointer used by ERC-7579 module managers (Nexus, Safe7579,
|
|
225
|
-
// Startale). Validator/executor uninstall on these accounts decodes the
|
|
226
|
-
// `deInitData` slot as `(address prev, bytes moduleDeInit)`, where `prev`
|
|
227
|
-
// identifies the preceding linked-list entry to repair on removal.
|
|
228
|
-
const SENTINEL_LIST_HEAD = '0x0000000000000000000000000000000000000001';
|
|
229
|
-
async function getModuleUninstallationCalls(config, chain, module) {
|
|
230
|
-
const address = getAddress(config);
|
|
231
|
-
const onChainDeInitData = await resolveOnChainDeInitData(config, chain, address, module);
|
|
232
|
-
const data = encodeFunctionData({
|
|
233
|
-
abi: [
|
|
234
|
-
{
|
|
235
|
-
type: 'function',
|
|
236
|
-
name: 'uninstallModule',
|
|
237
|
-
inputs: [
|
|
238
|
-
{
|
|
239
|
-
type: 'uint256',
|
|
240
|
-
name: 'moduleTypeId',
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
type: 'address',
|
|
244
|
-
name: 'module',
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
type: 'bytes',
|
|
248
|
-
name: 'deInitData',
|
|
249
|
-
},
|
|
250
|
-
],
|
|
251
|
-
outputs: [],
|
|
252
|
-
stateMutability: 'nonpayable',
|
|
253
|
-
},
|
|
254
|
-
],
|
|
255
|
-
functionName: 'uninstallModule',
|
|
256
|
-
args: [module.type, module.address, onChainDeInitData],
|
|
257
|
-
});
|
|
258
|
-
return [{ to: address, data, value: 0n }];
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Build the value the account expects in `uninstallModule`'s third argument.
|
|
262
|
-
*
|
|
263
|
-
* `Module.deInitData` carries module-level bytes (mirroring `Module.initData`,
|
|
264
|
-
* what the module's `onUninstall` sees). ERC-7579 accounts that store
|
|
265
|
-
* validators / executors in a SentinelList — Nexus, Safe7579, Startale —
|
|
266
|
-
* require an account-level wrapper `abi.encode(prev, moduleDeInit)` so they
|
|
267
|
-
* can pop the entry from the linked list. Kernel uses different storage and
|
|
268
|
-
* treats this slot as raw module bytes, so we pass `module.deInitData` through
|
|
269
|
-
* unchanged.
|
|
270
|
-
*
|
|
271
|
-
* Scope: validator type only — there are no public actions to disable
|
|
272
|
-
* executor modules today.
|
|
273
|
-
*/
|
|
274
|
-
async function resolveOnChainDeInitData(config, chain, account, module) {
|
|
275
|
-
if (module.type !== MODULE_TYPE_ID_VALIDATOR) {
|
|
276
|
-
return module.deInitData;
|
|
277
|
-
}
|
|
278
|
-
const accountType = getAccountProvider(config).type;
|
|
279
|
-
if (accountType !== 'nexus' &&
|
|
280
|
-
accountType !== 'safe' &&
|
|
281
|
-
accountType !== 'startale') {
|
|
282
|
-
return module.deInitData;
|
|
283
|
-
}
|
|
284
|
-
const validators = await getValidatorsInternal(accountType, account, chain, config.provider);
|
|
285
|
-
const targetLower = module.address.toLowerCase();
|
|
286
|
-
const index = validators.findIndex((v) => v.toLowerCase() === targetLower);
|
|
287
|
-
if (index === -1) {
|
|
288
|
-
// Not installed; pass through unchanged. The account's `uninstallModule`
|
|
289
|
-
// will surface a `ModuleNotInstalled` revert with the original module
|
|
290
|
-
// address, which is more useful than a silent abi.decode mismatch.
|
|
291
|
-
return module.deInitData;
|
|
292
|
-
}
|
|
293
|
-
const prev = index === 0 ? SENTINEL_LIST_HEAD : validators[index - 1];
|
|
294
|
-
return encodeAbiParameters([{ type: 'address' }, { type: 'bytes' }], [prev, module.deInitData]);
|
|
295
|
-
}
|
|
296
|
-
function getAddress(config) {
|
|
297
|
-
if (is7702(config)) {
|
|
298
|
-
if (!config.eoa) {
|
|
299
|
-
throw new Eip7702AccountMustHaveEoaError();
|
|
300
|
-
}
|
|
301
|
-
return config.eoa.address;
|
|
302
|
-
}
|
|
303
|
-
const account = getAccountProvider(config);
|
|
304
|
-
switch (account.type) {
|
|
305
|
-
case 'safe': {
|
|
306
|
-
return getSafeAddress(config);
|
|
307
|
-
}
|
|
308
|
-
case 'nexus': {
|
|
309
|
-
return getNexusAddress(config);
|
|
310
|
-
}
|
|
311
|
-
case 'kernel': {
|
|
312
|
-
return getKernelAddress(config);
|
|
313
|
-
}
|
|
314
|
-
case 'startale': {
|
|
315
|
-
return getStartaleAddress(config);
|
|
316
|
-
}
|
|
317
|
-
case 'hca': {
|
|
318
|
-
return getHcaAddress(config);
|
|
319
|
-
}
|
|
320
|
-
case 'eoa': {
|
|
321
|
-
if (!config.eoa) {
|
|
322
|
-
throw new AccountError({
|
|
323
|
-
message: 'EOA account must have an EOA configured',
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
return config.eoa.address;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
function checkAddress(config) {
|
|
331
|
-
const initData = config.initData;
|
|
332
|
-
if (!initData) {
|
|
333
|
-
return true;
|
|
334
|
-
}
|
|
335
|
-
if (!('factory' in initData)) {
|
|
336
|
-
return true;
|
|
337
|
-
}
|
|
338
|
-
return initData.address.toLowerCase() === getAddress(config).toLowerCase();
|
|
339
|
-
}
|
|
340
|
-
async function packAccountSignature(config, signature, validator, transformSignature = (signature) => signature) {
|
|
341
|
-
const account = getAccountProvider(config);
|
|
342
|
-
switch (account.type) {
|
|
343
|
-
case 'safe': {
|
|
344
|
-
return packSafeSignature(signature, validator, transformSignature);
|
|
345
|
-
}
|
|
346
|
-
case 'nexus': {
|
|
347
|
-
const defaultValidatorAddress = getNexusDefaultValidatorAddress(account.version);
|
|
348
|
-
return packNexusSignature(signature, validator, transformSignature, defaultValidatorAddress);
|
|
349
|
-
}
|
|
350
|
-
case 'kernel': {
|
|
351
|
-
return packKernelSignature(signature, validator, transformSignature);
|
|
352
|
-
}
|
|
353
|
-
case 'startale': {
|
|
354
|
-
return packStartaleSignature(signature, validator, transformSignature);
|
|
355
|
-
}
|
|
356
|
-
case 'hca': {
|
|
357
|
-
return packHcaSignature(signature, validator, transformSignature);
|
|
358
|
-
}
|
|
359
|
-
default: {
|
|
360
|
-
throw new Error(`Unsupported account type: ${account.type}`);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
async function getEip1271Signature(config, signers, chain, validator, hash, transformSignature = (signature) => signature) {
|
|
365
|
-
if (config.account?.type === 'eoa') {
|
|
366
|
-
throw new EoaSigningNotSupportedError('packed signatures');
|
|
367
|
-
}
|
|
368
|
-
signers = signers ?? convertOwnerSetToSignerSet(config.owners);
|
|
369
|
-
const account = getAccountProvider(config);
|
|
370
|
-
const address = getAddress(config);
|
|
371
|
-
const signedHash = account.type === 'kernel' ? wrapKernelMessageHash(hash, address) : hash;
|
|
372
|
-
const signature = await signMessage(signers, chain, address, signedHash, false);
|
|
373
|
-
return packAccountSignature(config, signature, validator, transformSignature);
|
|
374
|
-
}
|
|
375
|
-
// Signs and packs a signature to be used by the emissary validator
|
|
376
|
-
async function getEmissarySignature(config, signers, chain, hash, transformSignature = (signature) => signature) {
|
|
377
|
-
if (config.account?.type === 'eoa') {
|
|
378
|
-
throw new EoaSigningNotSupportedError('packed signatures');
|
|
379
|
-
}
|
|
380
|
-
signers = signers ?? convertOwnerSetToSignerSet(config.owners);
|
|
381
|
-
const address = getAddress(config);
|
|
382
|
-
const signFn = (hash) => signMessage(signers, chain, address, hash, false);
|
|
383
|
-
const signature = await signFn(hash);
|
|
384
|
-
return transformSignature(signature);
|
|
385
|
-
}
|
|
386
|
-
// Signs and packs a signature to be EIP-1271 compatible
|
|
387
|
-
async function getTypedDataPackedSignature(config, signers, chain, validator, parameters, transformSignature = (signature) => signature) {
|
|
388
|
-
if (config.account?.type === 'eoa') {
|
|
389
|
-
throw new EoaSigningNotSupportedError('packed signatures');
|
|
390
|
-
}
|
|
391
|
-
const address = getAddress(config);
|
|
392
|
-
signers = signers ?? convertOwnerSetToSignerSet(config.owners);
|
|
393
|
-
const account = getAccountProvider(config);
|
|
394
|
-
const signature = account.type === 'kernel'
|
|
395
|
-
? await signMessage(signers, chain, address, wrapKernelMessageHash(hashTypedData(parameters), address), false)
|
|
396
|
-
: await signTypedData(signers, chain, address, parameters);
|
|
397
|
-
return packAccountSignature(config, signature, validator, transformSignature);
|
|
398
|
-
}
|
|
399
|
-
async function getOwnerEcdsaSignature(config, chain, parameters, owner, module, validatorSupportsEip712) {
|
|
400
|
-
if (config.account?.type === 'eoa') {
|
|
401
|
-
throw new EoaSigningNotSupportedError('packed signatures');
|
|
402
|
-
}
|
|
403
|
-
const address = getAddress(config);
|
|
404
|
-
const signers = {
|
|
405
|
-
type: 'owner',
|
|
406
|
-
kind: 'ecdsa',
|
|
407
|
-
accounts: [owner],
|
|
408
|
-
module,
|
|
409
|
-
};
|
|
410
|
-
const accountProvider = getAccountProvider(config);
|
|
411
|
-
if (accountProvider.type === 'kernel') {
|
|
412
|
-
return signMessage(signers, chain, address, wrapKernelMessageHash(hashTypedData(parameters), address), false);
|
|
413
|
-
}
|
|
414
|
-
if (!validatorSupportsEip712) {
|
|
415
|
-
return signMessage(signers, chain, address, hashTypedData(parameters), false);
|
|
416
|
-
}
|
|
417
|
-
return signTypedData(signers, chain, address, parameters);
|
|
418
|
-
}
|
|
419
|
-
async function getOwnerPasskeySignature(config, parameters, owner, validatorSupportsEip712) {
|
|
420
|
-
if (config.account?.type === 'eoa') {
|
|
421
|
-
throw new EoaSigningNotSupportedError('packed signatures');
|
|
422
|
-
}
|
|
423
|
-
const address = getAddress(config);
|
|
424
|
-
const accountProvider = getAccountProvider(config);
|
|
425
|
-
if (accountProvider.type === 'kernel') {
|
|
426
|
-
const { webauthn, signature } = await owner.sign({
|
|
427
|
-
hash: wrapKernelMessageHash(hashTypedData(parameters), address),
|
|
428
|
-
});
|
|
429
|
-
return { webauthn, signature };
|
|
430
|
-
}
|
|
431
|
-
if (!validatorSupportsEip712) {
|
|
432
|
-
const { webauthn, signature } = await owner.sign({
|
|
433
|
-
hash: hashTypedData(parameters),
|
|
434
|
-
});
|
|
435
|
-
return { webauthn, signature };
|
|
436
|
-
}
|
|
437
|
-
const { webauthn, signature } = await owner.signTypedData(parameters);
|
|
438
|
-
return { webauthn, signature };
|
|
439
|
-
}
|
|
440
|
-
async function isDeployed(config, chain) {
|
|
441
|
-
const account = getAccountProvider(config);
|
|
442
|
-
if (account.type === 'eoa') {
|
|
443
|
-
return true;
|
|
444
|
-
}
|
|
445
|
-
const publicClient = createPublicClient({
|
|
446
|
-
chain: chain,
|
|
447
|
-
transport: createTransport(chain, config.provider),
|
|
448
|
-
});
|
|
449
|
-
const address = getAddress(config);
|
|
450
|
-
const code = await publicClient.getCode({
|
|
451
|
-
address,
|
|
452
|
-
});
|
|
453
|
-
if (!code) {
|
|
454
|
-
return false;
|
|
455
|
-
}
|
|
456
|
-
return size(code) > 0;
|
|
457
|
-
}
|
|
458
|
-
async function deploy(config, chain, params) {
|
|
459
|
-
const deployed = await isDeployed(config, chain);
|
|
460
|
-
if (deployed) {
|
|
461
|
-
return false;
|
|
462
|
-
}
|
|
463
|
-
const account = getAccountProvider(config);
|
|
464
|
-
if (account.type === 'eoa') {
|
|
465
|
-
return false;
|
|
466
|
-
}
|
|
467
|
-
const deployArgs = getDeployArgs(config);
|
|
468
|
-
if (!deployArgs) {
|
|
469
|
-
throw new FactoryArgsNotAvailableError();
|
|
470
|
-
}
|
|
471
|
-
const intentExecutorInstalled = 'intentExecutorInstalled' in deployArgs
|
|
472
|
-
? deployArgs.intentExecutorInstalled
|
|
473
|
-
: false;
|
|
474
|
-
// Use bundler directly when:
|
|
475
|
-
// (account has initData and intent executor is not installed) || (custom bundler is configured)
|
|
476
|
-
const useCustomBundler = config.bundler?.type === 'custom';
|
|
477
|
-
const asUserOp = (config.initData && !intentExecutorInstalled) || useCustomBundler;
|
|
478
|
-
if (asUserOp) {
|
|
479
|
-
await deployWithBundler(chain, config);
|
|
480
|
-
}
|
|
481
|
-
else {
|
|
482
|
-
await deployWithIntent(chain, config, params?.sponsored ?? false, params?.eip7702InitSignature);
|
|
483
|
-
}
|
|
484
|
-
return true;
|
|
485
|
-
}
|
|
486
|
-
// Installs the missing modules
|
|
487
|
-
// Checks if the provided modules are already installed
|
|
488
|
-
// Useful for existing (already deployed) accounts
|
|
489
|
-
async function setup(config, chain) {
|
|
490
|
-
const account = getAccountProvider(config);
|
|
491
|
-
// HCA accounts are locked and cannot install modules, so there is nothing to set up.
|
|
492
|
-
if (account.type === 'eoa' || account.type === 'hca') {
|
|
493
|
-
return false;
|
|
494
|
-
}
|
|
495
|
-
const modules = getSetup(config);
|
|
496
|
-
const publicClient = createPublicClient({
|
|
497
|
-
chain,
|
|
498
|
-
transport: createTransport(chain, config.provider),
|
|
499
|
-
});
|
|
500
|
-
const address = getAddress(config);
|
|
501
|
-
const allModules = [
|
|
502
|
-
...modules.validators,
|
|
503
|
-
...modules.executors,
|
|
504
|
-
...modules.fallbacks,
|
|
505
|
-
...modules.hooks,
|
|
506
|
-
].filter(
|
|
507
|
-
// Startale's K1 validator is the account's built-in default validator, set
|
|
508
|
-
// at deployment — it is never a regular 7579 module, so isModuleInstalled
|
|
509
|
-
// reports false and trying to install it reverts. Skip it.
|
|
510
|
-
(module) => !(account.type === 'startale' &&
|
|
511
|
-
isAddressEqual(module.address, STARTALE_K1_VALIDATOR_ADDRESS)));
|
|
512
|
-
// Check if the modules are already installed
|
|
513
|
-
const installedResults = await publicClient.multicall({
|
|
514
|
-
contracts: allModules.map((module) => ({
|
|
515
|
-
address: address,
|
|
516
|
-
abi: [
|
|
517
|
-
{
|
|
518
|
-
type: 'function',
|
|
519
|
-
name: 'isModuleInstalled',
|
|
520
|
-
inputs: [
|
|
521
|
-
{ type: 'uint256', name: 'moduleTypeId' },
|
|
522
|
-
{ type: 'address', name: 'module' },
|
|
523
|
-
{ type: 'bytes', name: 'additionalContext' },
|
|
524
|
-
],
|
|
525
|
-
outputs: [{ type: 'bool', name: 'isInstalled' }],
|
|
526
|
-
stateMutability: 'view',
|
|
527
|
-
},
|
|
528
|
-
],
|
|
529
|
-
functionName: 'isModuleInstalled',
|
|
530
|
-
args: [module.type, module.address, module.additionalContext],
|
|
531
|
-
})),
|
|
532
|
-
});
|
|
533
|
-
const isInstalled = installedResults.map((result) => result.result);
|
|
534
|
-
const modulesToInstall = allModules.filter((_, index) => !isInstalled[index]);
|
|
535
|
-
if (modulesToInstall.length === 0) {
|
|
536
|
-
// Nothing to install
|
|
537
|
-
return false;
|
|
538
|
-
}
|
|
539
|
-
const calls = [];
|
|
540
|
-
for (const module of modulesToInstall) {
|
|
541
|
-
calls.push(...getModuleInstallationCalls(config, module));
|
|
542
|
-
}
|
|
543
|
-
// Select the transaction infra layer based on the intent executor status
|
|
544
|
-
const intentExecutor = getIntentExecutor(config);
|
|
545
|
-
const hasIntentExecutor = modulesToInstall.every((module) => module.address !== intentExecutor.address);
|
|
546
|
-
let result;
|
|
547
|
-
if (hasIntentExecutor) {
|
|
548
|
-
result = await sendTransactionInternal(config, [chain], chain, {
|
|
549
|
-
callInputs: calls,
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
else {
|
|
553
|
-
result = await sendUserOperationInternal(config, chain, calls);
|
|
554
|
-
}
|
|
555
|
-
await waitForExecution(config, result);
|
|
556
|
-
return true;
|
|
557
|
-
}
|
|
558
|
-
async function deployWithIntent(chain, config, sponsored, eip7702InitSignature) {
|
|
559
|
-
const publicClient = createPublicClient({
|
|
560
|
-
chain,
|
|
561
|
-
transport: createTransport(chain, config.provider),
|
|
562
|
-
});
|
|
563
|
-
const address = getAddress(config);
|
|
564
|
-
const code = await publicClient.getCode({ address });
|
|
565
|
-
if (code) {
|
|
566
|
-
// Already deployed
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
// For EIP-7702 accounts, auto-sign if no signature was provided
|
|
570
|
-
let initSignature = eip7702InitSignature;
|
|
571
|
-
if (!initSignature && is7702(config)) {
|
|
572
|
-
initSignature = await signEip7702InitData(config);
|
|
573
|
-
}
|
|
574
|
-
const result = await sendTransactionInternal(config, [chain], chain, {
|
|
575
|
-
callInputs: [],
|
|
576
|
-
sponsored,
|
|
577
|
-
eip7702InitSignature: initSignature,
|
|
578
|
-
});
|
|
579
|
-
await waitForExecution(config, result);
|
|
580
|
-
}
|
|
581
|
-
async function deployWithBundler(chain, config) {
|
|
582
|
-
const publicClient = createPublicClient({
|
|
583
|
-
chain,
|
|
584
|
-
transport: createTransport(chain, config.provider),
|
|
585
|
-
});
|
|
586
|
-
const bundlerClient = getBundlerClient(config, publicClient);
|
|
587
|
-
const smartAccount = await getSmartAccount(config, publicClient, chain);
|
|
588
|
-
const deployArgs = getDeployArgs(config);
|
|
589
|
-
if (!deployArgs) {
|
|
590
|
-
throw new FactoryArgsNotAvailableError();
|
|
591
|
-
}
|
|
592
|
-
const { factory, factoryData } = deployArgs;
|
|
593
|
-
const opHash = await bundlerClient.sendUserOperation({
|
|
594
|
-
account: smartAccount,
|
|
595
|
-
factory,
|
|
596
|
-
factoryData,
|
|
597
|
-
calls: [
|
|
598
|
-
{
|
|
599
|
-
to: zeroAddress,
|
|
600
|
-
value: 0n,
|
|
601
|
-
data: '0x',
|
|
602
|
-
},
|
|
603
|
-
],
|
|
604
|
-
});
|
|
605
|
-
await bundlerClient.waitForUserOperationReceipt({
|
|
606
|
-
hash: opHash,
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
async function toErc6492Signature(config, signature, chain) {
|
|
610
|
-
const deployed = await isDeployed(config, chain);
|
|
611
|
-
if (deployed) {
|
|
612
|
-
return signature;
|
|
613
|
-
}
|
|
614
|
-
// Account is not deployed, use ERC-6492
|
|
615
|
-
const initCode = getInitCode(config);
|
|
616
|
-
if (!initCode) {
|
|
617
|
-
throw new FactoryArgsNotAvailableError();
|
|
618
|
-
}
|
|
619
|
-
const deployArgs = getDeployArgs(config);
|
|
620
|
-
if (!deployArgs) {
|
|
621
|
-
throw new FactoryArgsNotAvailableError();
|
|
622
|
-
}
|
|
623
|
-
const { factory, factoryData } = deployArgs;
|
|
624
|
-
const magicBytes = '0x6492649264926492649264926492649264926492649264926492649264926492';
|
|
625
|
-
return concat([
|
|
626
|
-
encodeAbiParameters([
|
|
627
|
-
{ name: 'create2Factory', type: 'address' },
|
|
628
|
-
{ name: 'factoryCalldata', type: 'bytes' },
|
|
629
|
-
{ name: 'originalERC1271Signature', type: 'bytes' },
|
|
630
|
-
], [factory, factoryData, signature]),
|
|
631
|
-
magicBytes,
|
|
632
|
-
]);
|
|
633
|
-
}
|
|
634
|
-
async function getSmartAccount(config, client, chain) {
|
|
635
|
-
// EOA accounts don't need smart account functionality
|
|
636
|
-
if (config.account?.type === 'eoa') {
|
|
637
|
-
throw new Error('getSmartAccount is not supported for EOA accounts');
|
|
638
|
-
}
|
|
639
|
-
if (!config.owners) {
|
|
640
|
-
throw new OwnersFieldRequiredError();
|
|
641
|
-
}
|
|
642
|
-
const account = getAccountProvider(config);
|
|
643
|
-
const address = getAddress(config);
|
|
644
|
-
const ownerValidator = getOwnerValidator(config);
|
|
645
|
-
const signers = convertOwnerSetToSignerSet(config.owners);
|
|
646
|
-
const signFn = (hash) => signMessage(signers, chain, address, hash, true);
|
|
647
|
-
switch (account.type) {
|
|
648
|
-
case 'safe': {
|
|
649
|
-
return getSafeSmartAccount(client, address, config.owners, ownerValidator.address, signFn);
|
|
650
|
-
}
|
|
651
|
-
case 'nexus': {
|
|
652
|
-
const defaultValidatorAddress = getNexusDefaultValidatorAddress(account.version);
|
|
653
|
-
return getNexusSmartAccount(client, address, config.owners, ownerValidator.address, signFn, defaultValidatorAddress);
|
|
654
|
-
}
|
|
655
|
-
case 'kernel': {
|
|
656
|
-
return getKernelSmartAccount(client, address, config.owners, ownerValidator.address, signFn);
|
|
657
|
-
}
|
|
658
|
-
case 'startale': {
|
|
659
|
-
return getStartaleSmartAccount(client, address, config.owners, ownerValidator.address, signFn);
|
|
660
|
-
}
|
|
661
|
-
case 'hca': {
|
|
662
|
-
return getHcaSmartAccount(client, address, config.owners, ownerValidator.address, signFn);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
function is7702(config) {
|
|
667
|
-
const account = getAccountProvider(config);
|
|
668
|
-
return account.type !== 'eoa' && config.eoa !== undefined;
|
|
669
|
-
}
|
|
670
|
-
function getAccountProvider(config) {
|
|
671
|
-
if (config.account) {
|
|
672
|
-
return config.account;
|
|
673
|
-
}
|
|
674
|
-
return {
|
|
675
|
-
type: 'nexus',
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
export { getEip712Domain, getModuleInstallationCalls, getValidatorInstallationCalls, getModuleUninstallationCalls, getAddress, checkAddress, getAccountProvider, getInitCode, getV0InitCode, signEip7702InitData, getEip7702InitCall, is7702, isDeployed, deploy, setup, toErc6492Signature, getSmartAccount, getEip1271Signature, getEmissarySignature, getOwnerEcdsaSignature, getOwnerPasskeySignature, getTypedDataPackedSignature, packAccountSignature,
|
|
679
|
-
// Errors
|
|
680
|
-
isAccountError, AccountError, AccountConfigurationNotSupportedError, DefaultValidatorAlreadyInitializedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, FactoryArgsNotAvailableError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, WalletClientNoConnectedAccountError, };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAQ,KAAK,SAAS,EAAE,MAAM,MAAM,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,iBAAS,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAS3E;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|