@rhinestone/sdk 2.0.0-beta.43 → 2.0.0-beta.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/src/accounts/adapter.d.ts +31 -0
- package/dist/src/accounts/adapter.d.ts.map +1 -0
- package/dist/src/accounts/adapters/eoa.d.ts +4 -0
- package/dist/src/accounts/adapters/eoa.d.ts.map +1 -0
- package/dist/src/accounts/adapters/eoa.js +45 -0
- package/dist/src/accounts/adapters/hca.d.ts +5 -0
- package/dist/src/accounts/adapters/hca.d.ts.map +1 -0
- package/dist/src/accounts/adapters/hca.js +118 -0
- package/dist/src/accounts/adapters/kernel.d.ts +9 -0
- package/dist/src/accounts/adapters/kernel.d.ts.map +1 -0
- package/dist/src/accounts/adapters/kernel.js +159 -0
- package/dist/src/accounts/adapters/nexus.d.ts +17 -0
- package/dist/src/accounts/adapters/nexus.d.ts.map +1 -0
- package/dist/src/accounts/adapters/nexus.js +227 -0
- package/dist/src/accounts/adapters/safe.d.ts +6 -0
- package/dist/src/accounts/adapters/safe.d.ts.map +1 -0
- package/dist/src/accounts/adapters/safe.js +194 -0
- package/dist/src/accounts/adapters/shared.d.ts +9 -0
- package/dist/src/accounts/adapters/shared.d.ts.map +1 -0
- package/dist/src/accounts/adapters/shared.js +62 -0
- package/dist/src/accounts/adapters/startale.d.ts +14 -0
- package/dist/src/accounts/adapters/startale.d.ts.map +1 -0
- package/dist/src/accounts/adapters/startale.js +165 -0
- package/dist/src/accounts/construction.d.ts +25 -0
- package/dist/src/accounts/construction.d.ts.map +1 -0
- package/dist/src/accounts/construction.js +34 -0
- package/dist/src/accounts/deployment.d.ts +12 -0
- package/dist/src/accounts/deployment.d.ts.map +1 -0
- package/dist/src/accounts/deployment.js +33 -0
- package/dist/src/accounts/erc7579-calls.d.ts +4 -0
- package/dist/src/accounts/erc7579-calls.d.ts.map +1 -0
- package/dist/src/accounts/erc7579-calls.js +57 -0
- package/dist/src/accounts/error.d.ts +1 -1
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/legacy.d.ts +14 -0
- package/dist/src/accounts/legacy.d.ts.map +1 -0
- package/dist/src/accounts/legacy.js +40 -0
- package/dist/src/accounts/registry.d.ts +4 -0
- package/dist/src/accounts/registry.d.ts.map +1 -0
- package/dist/src/accounts/registry.js +22 -0
- package/dist/src/accounts/types.d.ts +131 -0
- package/dist/src/accounts/types.d.ts.map +1 -0
- package/dist/src/accounts/wallet-account.d.ts +3 -0
- package/dist/src/accounts/wallet-account.d.ts.map +1 -0
- package/dist/src/accounts/wallet-account.js +12 -0
- package/dist/src/actions/deploy.d.ts +4 -0
- package/dist/src/actions/deploy.d.ts.map +1 -0
- package/dist/src/actions/deploy.js +8 -0
- package/dist/src/actions/ecdsa.d.ts +1 -1
- package/dist/src/actions/ecdsa.d.ts.map +1 -1
- package/dist/src/actions/ecdsa.js +8 -8
- package/dist/src/actions/index.d.ts +2 -16
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +3 -49
- package/dist/src/actions/mfa.d.ts +1 -1
- package/dist/src/actions/mfa.d.ts.map +1 -1
- package/dist/src/actions/mfa.js +30 -10
- package/dist/src/actions/modules.d.ts +4 -0
- package/dist/src/actions/modules.d.ts.map +1 -0
- package/dist/src/actions/modules.js +22 -0
- package/dist/src/actions/passkeys.d.ts +2 -2
- package/dist/src/actions/passkeys.d.ts.map +1 -1
- package/dist/src/actions/passkeys.js +19 -14
- package/dist/src/actions/runtime.d.ts +12 -0
- package/dist/src/actions/runtime.d.ts.map +1 -0
- package/dist/src/actions/runtime.js +161 -0
- package/dist/src/actions/smart-sessions.d.ts +2 -2
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +35 -12
- package/dist/src/api/account.d.ts +265 -0
- package/dist/src/api/account.d.ts.map +1 -0
- package/dist/src/api/account.js +635 -0
- package/dist/src/api/accounts.d.ts +12 -0
- package/dist/src/api/accounts.d.ts.map +1 -0
- package/dist/src/api/accounts.js +17 -0
- package/dist/src/api/compose-types.d.ts +147 -0
- package/dist/src/api/compose-types.d.ts.map +1 -0
- package/dist/src/api/compose.d.ts +6 -0
- package/dist/src/api/compose.d.ts.map +1 -0
- package/dist/src/api/compose.js +766 -0
- package/dist/src/api/direct-signing.d.ts +27 -0
- package/dist/src/api/direct-signing.d.ts.map +1 -0
- package/dist/src/api/direct-signing.js +191 -0
- package/dist/src/api/project-mappers.d.ts +7 -0
- package/dist/src/api/project-mappers.d.ts.map +1 -0
- package/dist/src/api/project-mappers.js +23 -0
- package/dist/src/api/queries/app-fees.d.ts +4 -0
- package/dist/src/api/queries/app-fees.d.ts.map +1 -0
- package/dist/src/api/queries/app-fees.js +3 -0
- package/dist/src/api/queries/portfolio.d.ts +9 -0
- package/dist/src/api/queries/portfolio.d.ts.map +1 -0
- package/dist/src/api/queries/portfolio.js +28 -0
- package/dist/src/api/queries/session.d.ts +8 -0
- package/dist/src/api/queries/session.d.ts.map +1 -0
- package/dist/src/api/queries/session.js +15 -0
- package/dist/src/api/sdk.d.ts +80 -0
- package/dist/src/api/sdk.d.ts.map +1 -0
- package/dist/src/api/sdk.js +103 -0
- package/dist/src/api/signer-selection.d.ts +7 -0
- package/dist/src/api/signer-selection.d.ts.map +1 -0
- package/dist/src/api/signer-selection.js +109 -0
- package/dist/src/calls/normalize.d.ts +9 -0
- package/dist/src/calls/normalize.d.ts.map +1 -0
- package/dist/src/calls/normalize.js +17 -0
- package/dist/src/calls/resolve.d.ts +3 -0
- package/dist/src/calls/resolve.d.ts.map +1 -0
- package/dist/src/calls/resolve.js +15 -0
- package/dist/src/calls/types.d.ts +25 -0
- package/dist/src/calls/types.d.ts.map +1 -0
- package/dist/src/calls/types.js +1 -0
- package/dist/src/chains/caip2.d.ts +10 -0
- package/dist/src/chains/caip2.d.ts.map +1 -0
- package/dist/src/chains/caip2.js +85 -0
- package/dist/src/chains/catalog.d.ts +5 -0
- package/dist/src/chains/catalog.d.ts.map +1 -0
- package/dist/src/chains/catalog.js +41 -0
- package/dist/src/chains/errors.d.ts +15 -0
- package/dist/src/chains/errors.d.ts.map +1 -0
- package/dist/src/chains/errors.js +21 -0
- package/dist/src/{orchestrator/destinations.d.ts → chains/non-evm.d.ts} +7 -5
- package/dist/src/chains/non-evm.d.ts.map +1 -0
- package/dist/src/chains/non-evm.js +30 -0
- package/dist/src/chains/tokens.d.ts +4 -0
- package/dist/src/chains/tokens.d.ts.map +1 -0
- package/dist/src/chains/tokens.js +22 -0
- package/dist/src/chains/types.d.ts +25 -0
- package/dist/src/chains/types.d.ts.map +1 -0
- package/dist/src/chains/types.js +1 -0
- package/dist/src/clients/bundler/client.d.ts +10 -0
- package/dist/src/clients/bundler/client.d.ts.map +1 -0
- package/dist/src/clients/bundler/client.js +85 -0
- package/dist/src/clients/bundler/endpoints.d.ts +3 -0
- package/dist/src/clients/bundler/endpoints.d.ts.map +1 -0
- package/dist/src/clients/bundler/endpoints.js +18 -0
- package/dist/src/clients/bundler/port.d.ts +22 -0
- package/dist/src/clients/bundler/port.d.ts.map +1 -0
- package/dist/src/clients/bundler/port.js +1 -0
- package/dist/src/clients/json-rpc.d.ts +20 -0
- package/dist/src/clients/json-rpc.d.ts.map +1 -0
- package/dist/src/clients/json-rpc.js +56 -0
- package/dist/src/clients/orchestrator/auth.d.ts +7 -0
- package/dist/src/clients/orchestrator/auth.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/auth.js +27 -0
- package/dist/src/clients/orchestrator/chain-catalog.d.ts +36 -0
- package/dist/src/clients/orchestrator/chain-catalog.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/chain-catalog.js +67 -0
- package/dist/src/clients/orchestrator/client.d.ts +13 -0
- package/dist/src/clients/orchestrator/client.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/client.js +97 -0
- package/dist/src/{orchestrator/error.d.ts → clients/orchestrator/errors.d.ts} +2 -16
- package/dist/src/clients/orchestrator/errors.d.ts.map +1 -0
- package/dist/src/{orchestrator/error.js → clients/orchestrator/errors.js} +1 -22
- package/dist/src/clients/orchestrator/fetch.d.ts +7 -0
- package/dist/src/clients/orchestrator/fetch.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/fetch.js +37 -0
- package/dist/src/clients/orchestrator/mappers.d.ts +9 -0
- package/dist/src/clients/orchestrator/mappers.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/mappers.js +198 -0
- package/dist/src/clients/orchestrator/port.d.ts +26 -0
- package/dist/src/clients/orchestrator/port.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/port.js +1 -0
- package/dist/src/{orchestrator/types.d.ts → clients/orchestrator/public.d.ts} +12 -15
- package/dist/src/clients/orchestrator/public.d.ts.map +1 -0
- package/dist/src/{orchestrator/types.js → clients/orchestrator/public.js} +3 -0
- package/dist/src/clients/orchestrator/types.d.ts +140 -0
- package/dist/src/clients/orchestrator/types.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/types.js +1 -0
- package/dist/src/clients/orchestrator/wire.d.ts +19 -0
- package/dist/src/clients/orchestrator/wire.d.ts.map +1 -0
- package/dist/src/{orchestrator → clients/orchestrator}/wire.gen.d.ts +519 -499
- package/dist/src/clients/orchestrator/wire.gen.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/wire.gen.js +1 -0
- package/dist/src/clients/orchestrator/wire.js +1 -0
- package/dist/src/clients/paymaster/client.d.ts +8 -0
- package/dist/src/clients/paymaster/client.d.ts.map +1 -0
- package/dist/src/clients/paymaster/client.js +38 -0
- package/dist/src/clients/paymaster/endpoints.d.ts +3 -0
- package/dist/src/clients/paymaster/endpoints.d.ts.map +1 -0
- package/dist/src/clients/paymaster/endpoints.js +16 -0
- package/dist/src/clients/paymaster/port.d.ts +17 -0
- package/dist/src/clients/paymaster/port.d.ts.map +1 -0
- package/dist/src/clients/paymaster/port.js +1 -0
- package/dist/src/clients/rpc/client.d.ts +6 -0
- package/dist/src/clients/rpc/client.d.ts.map +1 -0
- package/dist/src/clients/rpc/client.js +66 -0
- package/dist/src/clients/rpc/compatibility.d.ts +12 -0
- package/dist/src/clients/rpc/compatibility.d.ts.map +1 -0
- package/dist/src/clients/rpc/compatibility.js +16 -0
- package/dist/src/clients/rpc/port.d.ts +13 -0
- package/dist/src/clients/rpc/port.d.ts.map +1 -0
- package/dist/src/clients/rpc/port.js +1 -0
- package/dist/src/clients/rpc/providers.d.ts +3 -0
- package/dist/src/clients/rpc/providers.d.ts.map +1 -0
- package/dist/src/clients/rpc/providers.js +8 -0
- package/dist/src/clients/rpc/transport.d.ts +4 -0
- package/dist/src/clients/rpc/transport.d.ts.map +1 -0
- package/dist/src/clients/rpc/transport.js +5 -0
- package/dist/src/clients/rpc/types.d.ts +23 -0
- package/dist/src/clients/rpc/types.d.ts.map +1 -0
- package/dist/src/clients/rpc/types.js +1 -0
- package/dist/src/config/account-runtime.d.ts +7 -0
- package/dist/src/config/account-runtime.d.ts.map +1 -0
- package/dist/src/config/account-runtime.js +36 -0
- package/dist/src/{types.d.ts → config/account.d.ts} +31 -26
- package/dist/src/config/account.d.ts.map +1 -0
- package/dist/src/config/account.js +10 -0
- package/dist/src/config/defaults.d.ts +14 -0
- package/dist/src/config/defaults.d.ts.map +1 -0
- package/dist/src/config/defaults.js +26 -0
- package/dist/src/config/input.d.ts +54 -0
- package/dist/src/config/input.d.ts.map +1 -0
- package/dist/src/config/input.js +1 -0
- package/dist/src/config/legacy.d.ts +22 -0
- package/dist/src/config/legacy.d.ts.map +1 -0
- package/dist/src/config/legacy.js +23 -0
- package/dist/src/config/resolve.d.ts +13 -0
- package/dist/src/config/resolve.d.ts.map +1 -0
- package/dist/src/config/resolve.js +174 -0
- package/dist/src/config/resolved.d.ts +77 -0
- package/dist/src/config/resolved.d.ts.map +1 -0
- package/dist/src/config/resolved.js +1 -0
- package/dist/src/config/validate.d.ts +3 -0
- package/dist/src/config/validate.d.ts.map +1 -0
- package/dist/src/config/validate.js +6 -0
- package/dist/src/{execution/error.d.ts → errors/execution.d.ts} +2 -2
- package/dist/src/errors/execution.d.ts.map +1 -0
- package/dist/src/{execution/error.js → errors/execution.js} +1 -1
- package/dist/src/errors/index.d.ts +4 -4
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +4 -3
- package/dist/src/index.d.ts +13 -314
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -260
- package/dist/src/modules/erc7579-abi.d.ts +4 -0
- package/dist/src/modules/erc7579-abi.d.ts.map +1 -0
- package/dist/src/modules/erc7579-abi.js +12 -0
- package/dist/src/modules/intent-executor.d.ts +6 -0
- package/dist/src/modules/intent-executor.d.ts.map +1 -0
- package/dist/src/modules/intent-executor.js +13 -0
- package/dist/src/modules/legacy-core.d.ts +29 -0
- package/dist/src/modules/legacy-core.d.ts.map +1 -0
- package/dist/src/modules/legacy-core.js +80 -0
- package/dist/src/modules/normalize.d.ts +4 -0
- package/dist/src/modules/normalize.d.ts.map +1 -0
- package/dist/src/modules/normalize.js +15 -0
- package/dist/src/modules/plan.d.ts +16 -0
- package/dist/src/modules/plan.d.ts.map +1 -0
- package/dist/src/modules/plan.js +51 -0
- package/dist/src/modules/read-core.d.ts +39 -0
- package/dist/src/modules/read-core.d.ts.map +1 -0
- package/dist/src/modules/read-core.js +149 -0
- package/dist/src/modules/types.d.ts +46 -0
- package/dist/src/modules/types.d.ts.map +1 -0
- package/dist/src/modules/types.js +1 -0
- package/dist/src/modules/validators/capabilities.d.ts +4 -0
- package/dist/src/modules/validators/capabilities.d.ts.map +1 -0
- package/dist/src/modules/validators/capabilities.js +58 -0
- package/dist/src/modules/validators/contribution.d.ts +4 -0
- package/dist/src/modules/validators/contribution.d.ts.map +1 -0
- package/dist/src/modules/validators/contribution.js +64 -0
- package/dist/src/modules/validators/definition.d.ts +3 -0
- package/dist/src/modules/validators/definition.d.ts.map +1 -0
- package/dist/src/modules/validators/definition.js +68 -0
- package/dist/src/modules/validators/ens.d.ts +5 -0
- package/dist/src/modules/validators/ens.d.ts.map +1 -0
- package/dist/src/modules/validators/ens.js +34 -0
- package/dist/src/modules/validators/k1.d.ts +2 -0
- package/dist/src/modules/validators/k1.d.ts.map +1 -0
- package/dist/src/modules/validators/k1.js +1 -0
- package/dist/src/modules/validators/multi-factor.d.ts +18 -0
- package/dist/src/modules/validators/multi-factor.d.ts.map +1 -0
- package/dist/src/modules/validators/multi-factor.js +79 -0
- package/dist/src/modules/validators/ownable.d.ts +26 -0
- package/dist/src/modules/validators/ownable.d.ts.map +1 -0
- package/dist/src/modules/validators/ownable.js +84 -0
- package/dist/src/modules/validators/permissions.d.ts +1 -1
- package/dist/src/modules/validators/permissions.d.ts.map +1 -1
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts +9 -12
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -1
- package/dist/src/modules/validators/policies/claim/arbiters.js +52 -27
- package/dist/src/modules/validators/resolve.d.ts +5 -0
- package/dist/src/modules/validators/resolve.d.ts.map +1 -0
- package/dist/src/modules/validators/resolve.js +22 -0
- package/dist/src/modules/validators/signer-id.d.ts +5 -0
- package/dist/src/modules/validators/signer-id.d.ts.map +1 -0
- package/dist/src/modules/validators/signer-id.js +8 -0
- package/dist/src/modules/validators/smart-session-signature-types.d.ts +35 -0
- package/dist/src/modules/validators/smart-session-signature-types.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-session-signature-types.js +1 -0
- package/dist/src/modules/validators/smart-sessions/authorization.d.ts +99 -0
- package/dist/src/modules/validators/smart-sessions/authorization.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/authorization.js +101 -0
- package/dist/src/modules/validators/smart-sessions/calls.d.ts +19 -0
- package/dist/src/modules/validators/smart-sessions/calls.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/calls.js +85 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.d.ts +4 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.js +77 -0
- package/dist/src/modules/validators/smart-sessions/digest.d.ts +5 -0
- package/dist/src/modules/validators/smart-sessions/digest.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/digest.js +30 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.d.ts +10 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.js +31 -0
- package/dist/src/modules/validators/smart-sessions/module.d.ts +11 -0
- package/dist/src/modules/validators/smart-sessions/module.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/module.js +18 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.d.ts +23 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.js +29 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.d.ts +10 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.js +106 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.d.ts +4 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.js +197 -0
- package/dist/src/modules/validators/smart-sessions/resolve.d.ts +16 -0
- package/dist/src/modules/validators/smart-sessions/resolve.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/resolve.js +120 -0
- package/dist/src/modules/validators/smart-sessions/signature.d.ts +14 -0
- package/dist/src/modules/validators/smart-sessions/signature.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/signature.js +167 -0
- package/dist/src/modules/validators/smart-sessions/state.d.ts +19 -0
- package/dist/src/modules/validators/smart-sessions/state.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/state.js +42 -0
- package/dist/src/modules/validators/smart-sessions/types.d.ts +227 -0
- package/dist/src/modules/validators/smart-sessions/types.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/types.js +1 -0
- package/dist/src/modules/validators/types.d.ts +143 -0
- package/dist/src/modules/validators/types.d.ts.map +1 -0
- package/dist/src/modules/validators/types.js +1 -0
- package/dist/src/modules/validators/webauthn.d.ts +54 -0
- package/dist/src/modules/validators/webauthn.d.ts.map +1 -0
- package/dist/src/modules/validators/webauthn.js +159 -0
- package/dist/src/signing/context.d.ts +25 -0
- package/dist/src/signing/context.d.ts.map +1 -0
- package/dist/src/signing/context.js +163 -0
- package/dist/src/signing/contribution.d.ts +13 -0
- package/dist/src/signing/contribution.d.ts.map +1 -0
- package/dist/src/signing/contribution.js +83 -0
- package/dist/src/signing/eip7702.d.ts +41 -0
- package/dist/src/signing/eip7702.d.ts.map +1 -0
- package/dist/src/signing/eip7702.js +215 -0
- package/dist/src/signing/error.d.ts +27 -0
- package/dist/src/signing/error.d.ts.map +1 -0
- package/dist/src/signing/error.js +25 -0
- package/dist/src/signing/execute.d.ts +17 -0
- package/dist/src/signing/execute.d.ts.map +1 -0
- package/dist/src/signing/execute.js +138 -0
- package/dist/src/signing/intent-plans/assemble.d.ts +15 -0
- package/dist/src/signing/intent-plans/assemble.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/assemble.js +96 -0
- package/dist/src/signing/intent-plans/independent.d.ts +48 -0
- package/dist/src/signing/intent-plans/independent.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/independent.js +150 -0
- package/dist/src/signing/intent-plans/plan.d.ts +14 -0
- package/dist/src/signing/intent-plans/plan.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/plan.js +187 -0
- package/dist/src/signing/intent-plans/types.d.ts +63 -0
- package/dist/src/signing/intent-plans/types.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/types.js +1 -0
- package/dist/src/signing/message.d.ts +28 -0
- package/dist/src/signing/message.d.ts.map +1 -0
- package/dist/src/signing/message.js +90 -0
- package/dist/src/signing/passkeys.d.ts +28 -0
- package/dist/src/signing/passkeys.d.ts.map +1 -0
- package/dist/src/signing/passkeys.js +17 -0
- package/dist/src/signing/plan.d.ts +35 -0
- package/dist/src/signing/plan.d.ts.map +1 -0
- package/dist/src/signing/plan.js +377 -0
- package/dist/src/signing/protocols/erc6492.d.ts +11 -0
- package/dist/src/signing/protocols/erc6492.d.ts.map +1 -0
- package/dist/src/signing/protocols/erc6492.js +24 -0
- package/dist/src/signing/protocols/erc7739.d.ts +17 -0
- package/dist/src/signing/protocols/erc7739.d.ts.map +1 -0
- package/dist/src/signing/protocols/erc7739.js +84 -0
- package/dist/src/signing/session-enable.d.ts +35 -0
- package/dist/src/signing/session-enable.d.ts.map +1 -0
- package/dist/src/signing/session-enable.js +62 -0
- package/dist/src/signing/signers/compatibility.d.ts +4 -0
- package/dist/src/signing/signers/compatibility.d.ts.map +1 -0
- package/dist/src/signing/signers/compatibility.js +51 -0
- package/dist/src/signing/signers/ecdsa.d.ts +14 -0
- package/dist/src/signing/signers/ecdsa.d.ts.map +1 -0
- package/dist/src/signing/signers/ecdsa.js +54 -0
- package/dist/src/signing/signers/registry.d.ts +7 -0
- package/dist/src/signing/signers/registry.d.ts.map +1 -0
- package/dist/src/signing/signers/registry.js +33 -0
- package/dist/src/signing/signers/types.d.ts +16 -0
- package/dist/src/signing/signers/types.d.ts.map +1 -0
- package/dist/src/signing/signers/types.js +1 -0
- package/dist/src/signing/signers/wallet-chain.d.ts +9 -0
- package/dist/src/signing/signers/wallet-chain.d.ts.map +1 -0
- package/dist/src/signing/signers/wallet-chain.js +15 -0
- package/dist/src/signing/signers/webauthn.d.ts +11 -0
- package/dist/src/signing/signers/webauthn.d.ts.map +1 -0
- package/dist/src/signing/signers/webauthn.js +14 -0
- package/dist/src/signing/typed-data.d.ts +39 -0
- package/dist/src/signing/typed-data.d.ts.map +1 -0
- package/dist/src/signing/typed-data.js +135 -0
- package/dist/src/signing/types.d.ts +346 -0
- package/dist/src/signing/types.d.ts.map +1 -0
- package/dist/src/signing/types.js +1 -0
- package/dist/src/signing/user-operation.d.ts +23 -0
- package/dist/src/signing/user-operation.d.ts.map +1 -0
- package/dist/src/signing/user-operation.js +61 -0
- package/dist/src/smart-sessions/index.d.ts +13 -3
- package/dist/src/smart-sessions/index.d.ts.map +1 -1
- package/dist/src/smart-sessions/index.js +44 -6
- package/dist/src/transactions/intents/account.d.ts +15 -0
- package/dist/src/transactions/intents/account.d.ts.map +1 -0
- package/dist/src/transactions/intents/account.js +48 -0
- package/dist/src/transactions/intents/compatibility.d.ts +4 -0
- package/dist/src/transactions/intents/compatibility.d.ts.map +1 -0
- package/dist/src/transactions/intents/compatibility.js +19 -0
- package/dist/src/transactions/intents/normalize.d.ts +5 -0
- package/dist/src/transactions/intents/normalize.d.ts.map +1 -0
- package/dist/src/transactions/intents/normalize.js +48 -0
- package/dist/src/transactions/intents/prepare.d.ts +7 -0
- package/dist/src/transactions/intents/prepare.d.ts.map +1 -0
- package/dist/src/transactions/intents/prepare.js +249 -0
- package/dist/src/transactions/intents/quotes.d.ts +3 -0
- package/dist/src/transactions/intents/quotes.d.ts.map +1 -0
- package/dist/src/transactions/intents/quotes.js +11 -0
- package/dist/src/transactions/intents/request.d.ts +11 -0
- package/dist/src/transactions/intents/request.d.ts.map +1 -0
- package/dist/src/transactions/intents/request.js +55 -0
- package/dist/src/transactions/intents/send.d.ts +3 -0
- package/dist/src/transactions/intents/send.d.ts.map +1 -0
- package/dist/src/transactions/intents/send.js +22 -0
- package/dist/src/transactions/intents/session-signing.d.ts +7 -0
- package/dist/src/transactions/intents/session-signing.d.ts.map +1 -0
- package/dist/src/transactions/intents/session-signing.js +363 -0
- package/dist/src/transactions/intents/sessions.d.ts +17 -0
- package/dist/src/transactions/intents/sessions.d.ts.map +1 -0
- package/dist/src/transactions/intents/sessions.js +85 -0
- package/dist/src/transactions/intents/sign-transaction.d.ts +10 -0
- package/dist/src/transactions/intents/sign-transaction.d.ts.map +1 -0
- package/dist/src/transactions/intents/sign-transaction.js +386 -0
- package/dist/src/transactions/intents/split.d.ts +13 -0
- package/dist/src/transactions/intents/split.d.ts.map +1 -0
- package/dist/src/transactions/intents/split.js +3 -0
- package/dist/src/transactions/intents/status-policy.d.ts +13 -0
- package/dist/src/transactions/intents/status-policy.d.ts.map +1 -0
- package/dist/src/transactions/intents/status-policy.js +39 -0
- package/dist/src/transactions/intents/status.d.ts +4 -0
- package/dist/src/transactions/intents/status.d.ts.map +1 -0
- package/dist/src/transactions/intents/status.js +50 -0
- package/dist/src/transactions/intents/submit.d.ts +3 -0
- package/dist/src/transactions/intents/submit.d.ts.map +1 -0
- package/dist/src/transactions/intents/submit.js +32 -0
- package/dist/src/transactions/intents/types.d.ts +136 -0
- package/dist/src/transactions/intents/types.d.ts.map +1 -0
- package/dist/src/transactions/intents/types.js +1 -0
- package/dist/src/transactions/user-operations/hash.d.ts +5 -0
- package/dist/src/transactions/user-operations/hash.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/hash.js +9 -0
- package/dist/src/transactions/user-operations/nonce.d.ts +18 -0
- package/dist/src/transactions/user-operations/nonce.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/nonce.js +43 -0
- package/dist/src/transactions/user-operations/prepare.d.ts +12 -0
- package/dist/src/transactions/user-operations/prepare.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/prepare.js +138 -0
- package/dist/src/transactions/user-operations/reconstruct.d.ts +28 -0
- package/dist/src/transactions/user-operations/reconstruct.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/reconstruct.js +52 -0
- package/dist/src/transactions/user-operations/send.d.ts +3 -0
- package/dist/src/transactions/user-operations/send.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/send.js +8 -0
- package/dist/src/transactions/user-operations/sign.d.ts +3 -0
- package/dist/src/transactions/user-operations/sign.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/sign.js +14 -0
- package/dist/src/transactions/user-operations/status.d.ts +4 -0
- package/dist/src/transactions/user-operations/status.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/status.js +37 -0
- package/dist/src/transactions/user-operations/submit.d.ts +3 -0
- package/dist/src/transactions/user-operations/submit.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/submit.js +8 -0
- package/dist/src/transactions/user-operations/types.d.ts +68 -0
- package/dist/src/transactions/user-operations/types.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/types.js +1 -0
- package/dist/src/transactions/user-operations/validator-account.d.ts +5 -0
- package/dist/src/transactions/user-operations/validator-account.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/validator-account.js +26 -0
- package/dist/src/utils/index.d.ts +9 -4
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +54 -51
- package/package.json +3 -4
- package/dist/src/accounts/hca.d.ts +0 -25
- package/dist/src/accounts/hca.d.ts.map +0 -1
- package/dist/src/accounts/hca.js +0 -148
- package/dist/src/accounts/index.d.ts +0 -64
- package/dist/src/accounts/index.d.ts.map +0 -1
- package/dist/src/accounts/index.js +0 -680
- package/dist/src/accounts/json-rpc/index.d.ts +0 -5
- package/dist/src/accounts/json-rpc/index.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.js +0 -19
- package/dist/src/accounts/json-rpc/providers.d.ts +0 -5
- package/dist/src/accounts/json-rpc/providers.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.js +0 -16
- package/dist/src/accounts/kernel.d.ts +0 -26
- package/dist/src/accounts/kernel.d.ts.map +0 -1
- package/dist/src/accounts/kernel.js +0 -265
- package/dist/src/accounts/nexus.d.ts +0 -34
- package/dist/src/accounts/nexus.d.ts.map +0 -1
- package/dist/src/accounts/nexus.js +0 -469
- package/dist/src/accounts/safe.d.ts +0 -32
- package/dist/src/accounts/safe.d.ts.map +0 -1
- package/dist/src/accounts/safe.js +0 -337
- package/dist/src/accounts/signing/common.d.ts +0 -38
- package/dist/src/accounts/signing/common.d.ts.map +0 -1
- package/dist/src/accounts/signing/common.js +0 -186
- package/dist/src/accounts/signing/message.d.ts +0 -7
- package/dist/src/accounts/signing/message.d.ts.map +0 -1
- package/dist/src/accounts/signing/message.js +0 -42
- package/dist/src/accounts/signing/passkeys.d.ts +0 -36
- package/dist/src/accounts/signing/passkeys.d.ts.map +0 -1
- package/dist/src/accounts/signing/passkeys.js +0 -119
- package/dist/src/accounts/signing/typedData.d.ts +0 -5
- package/dist/src/accounts/signing/typedData.d.ts.map +0 -1
- package/dist/src/accounts/signing/typedData.js +0 -30
- package/dist/src/accounts/startale.d.ts +0 -25
- package/dist/src/accounts/startale.d.ts.map +0 -1
- package/dist/src/accounts/startale.js +0 -188
- package/dist/src/accounts/utils.d.ts +0 -33
- package/dist/src/accounts/utils.d.ts.map +0 -1
- package/dist/src/accounts/utils.js +0 -202
- package/dist/src/auth/provider.d.ts +0 -7
- package/dist/src/auth/provider.d.ts.map +0 -1
- package/dist/src/auth/provider.js +0 -38
- package/dist/src/execution/compact.d.ts +0 -5
- package/dist/src/execution/compact.d.ts.map +0 -1
- package/dist/src/execution/compact.js +0 -4
- package/dist/src/execution/error.d.ts.map +0 -1
- package/dist/src/execution/index.d.ts +0 -42
- package/dist/src/execution/index.d.ts.map +0 -1
- package/dist/src/execution/index.js +0 -187
- package/dist/src/execution/utils.d.ts +0 -167
- package/dist/src/execution/utils.d.ts.map +0 -1
- package/dist/src/execution/utils.js +0 -1606
- package/dist/src/modules/abi/smart-sessions.d.ts +0 -104
- package/dist/src/modules/abi/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/abi/smart-sessions.js +0 -128
- package/dist/src/modules/chain-abstraction.d.ts +0 -5
- package/dist/src/modules/chain-abstraction.d.ts.map +0 -1
- package/dist/src/modules/chain-abstraction.js +0 -3
- package/dist/src/modules/common.d.ts +0 -30
- package/dist/src/modules/common.d.ts.map +0 -1
- package/dist/src/modules/common.js +0 -30
- package/dist/src/modules/index.d.ts +0 -11
- package/dist/src/modules/index.d.ts.map +0 -1
- package/dist/src/modules/index.js +0 -85
- package/dist/src/modules/legacy.d.ts +0 -10
- package/dist/src/modules/legacy.d.ts.map +0 -1
- package/dist/src/modules/legacy.js +0 -62
- package/dist/src/modules/read.d.ts +0 -11
- package/dist/src/modules/read.d.ts.map +0 -1
- package/dist/src/modules/read.js +0 -219
- package/dist/src/modules/validators/core.d.ts +0 -31
- package/dist/src/modules/validators/core.d.ts.map +0 -1
- package/dist/src/modules/validators/core.js +0 -269
- package/dist/src/modules/validators/cross-chain-permits.d.ts +0 -21
- package/dist/src/modules/validators/cross-chain-permits.d.ts.map +0 -1
- package/dist/src/modules/validators/cross-chain-permits.js +0 -111
- package/dist/src/modules/validators/index.d.ts +0 -4
- package/dist/src/modules/validators/index.d.ts.map +0 -1
- package/dist/src/modules/validators/index.js +0 -3
- package/dist/src/modules/validators/smart-sessions.d.ts +0 -225
- package/dist/src/modules/validators/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.js +0 -1189
- package/dist/src/orchestrator/caip2.d.ts +0 -20
- package/dist/src/orchestrator/caip2.d.ts.map +0 -1
- package/dist/src/orchestrator/caip2.js +0 -49
- package/dist/src/orchestrator/client.d.ts +0 -29
- package/dist/src/orchestrator/client.d.ts.map +0 -1
- package/dist/src/orchestrator/client.js +0 -290
- package/dist/src/orchestrator/consts.d.ts +0 -6
- package/dist/src/orchestrator/consts.d.ts.map +0 -1
- package/dist/src/orchestrator/consts.js +0 -5
- package/dist/src/orchestrator/destinations.d.ts.map +0 -1
- package/dist/src/orchestrator/destinations.js +0 -59
- package/dist/src/orchestrator/error.d.ts.map +0 -1
- package/dist/src/orchestrator/index.d.ts +0 -13
- package/dist/src/orchestrator/index.d.ts.map +0 -1
- package/dist/src/orchestrator/index.js +0 -10
- package/dist/src/orchestrator/registry.d.ts +0 -17
- package/dist/src/orchestrator/registry.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.js +0 -103
- package/dist/src/orchestrator/types.d.ts.map +0 -1
- package/dist/src/orchestrator/utils.d.ts +0 -3
- package/dist/src/orchestrator/utils.d.ts.map +0 -1
- package/dist/src/orchestrator/utils.js +0 -22
- package/dist/src/orchestrator/wire.d.ts +0 -30
- package/dist/src/orchestrator/wire.d.ts.map +0 -1
- package/dist/src/orchestrator/wire.gen.d.ts.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/utils/walletClient.d.ts +0 -34
- package/dist/src/utils/walletClient.d.ts.map +0 -1
- package/dist/src/utils/walletClient.js +0 -117
- /package/dist/src/{orchestrator/wire.gen.js → accounts/adapter.js} +0 -0
- /package/dist/src/{types.js → accounts/types.js} +0 -0
- /package/dist/src/{orchestrator/wire.js → api/compose-types.js} +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AccountAdapter } from '../adapter.js';
|
|
2
|
+
import { type DeploymentMaterial } from '../deployment.js';
|
|
3
|
+
import type { AccountConstruction } from '../types.js';
|
|
4
|
+
export declare function safeV0FactoryMaterial(input: AccountConstruction): Pick<Required<DeploymentMaterial>, 'factory' | 'factoryData'>;
|
|
5
|
+
export declare function createSafeAdapter(construction: AccountConstruction): AccountAdapter;
|
|
6
|
+
//# sourceMappingURL=safe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../../../accounts/adapters/safe.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,KAAK,kBAAkB,EAAkB,MAAM,eAAe,CAAA;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAyHnD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,mBAAmB,GACzB,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,CA0D/D;AAED,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,mBAAmB,GAChC,cAAc,CA8BhB"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { concat, decodeFunctionData, encodeAbiParameters, encodeFunctionData, encodePacked, getContractAddress, keccak256, parseAbi, parseAbiParameters, zeroAddress, } from 'viem';
|
|
2
|
+
import { getV0Attesters } from '../../modules/legacy-core.js';
|
|
3
|
+
import { deploymentPlan } from '../deployment.js';
|
|
4
|
+
import { encodeErc7579Calls } from '../erc7579-calls.js';
|
|
5
|
+
import { encodeAddressEnvelope, encodeInstallModule, encodeUninstallModule, primaryOwnerAddresses, primaryThreshold, } from './shared.js';
|
|
6
|
+
const SAFE_LAUNCHPAD = '0x75798463024bda64d83c94a64bc7d7eab41300ef';
|
|
7
|
+
const SAFE_ADAPTER = '0x7579f2ad53b01c3d8779fe17928e0d48885b0003';
|
|
8
|
+
const SAFE_V0_LAUNCHPAD = '0x7579011ab74c46090561ea277ba79d510c6c00ff';
|
|
9
|
+
const SAFE_V0_ADAPTER = '0x7579ee8307284f293b1927136486880611f20002';
|
|
10
|
+
const SAFE_SINGLETON = '0x29fcb43b46531bca003ddc8fcb67ffe91900c762';
|
|
11
|
+
const SAFE_FACTORY = '0x4e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67';
|
|
12
|
+
const SAFE_PROXY_INIT_CODE = '0x608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea264697066735822122003d1488ee65e08fa41e58e888a9865554c535f2c77126a82cb4c0f917f31441364736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564';
|
|
13
|
+
function safeMaterial(input) {
|
|
14
|
+
if (input.account.kind !== 'safe')
|
|
15
|
+
throw new Error('Expected Safe account');
|
|
16
|
+
if (input.eoa)
|
|
17
|
+
return { address: input.eoa.address };
|
|
18
|
+
if (input.initData && !('factory' in input.initData)) {
|
|
19
|
+
return { address: input.initData.address };
|
|
20
|
+
}
|
|
21
|
+
let factory = SAFE_FACTORY;
|
|
22
|
+
let factoryData;
|
|
23
|
+
let implementation = SAFE_SINGLETON;
|
|
24
|
+
let salt;
|
|
25
|
+
if (input.initData && 'factory' in input.initData) {
|
|
26
|
+
const decoded = decodeFunctionData({
|
|
27
|
+
abi: parseAbi([
|
|
28
|
+
'function createProxyWithNonce(address singleton,bytes initializer,uint256 saltNonce)',
|
|
29
|
+
]),
|
|
30
|
+
data: input.initData.factoryData,
|
|
31
|
+
});
|
|
32
|
+
if (decoded.functionName !== 'createProxyWithNonce') {
|
|
33
|
+
throw new Error('Invalid Safe factory data');
|
|
34
|
+
}
|
|
35
|
+
factory = input.initData.factory;
|
|
36
|
+
factoryData = input.initData.factoryData;
|
|
37
|
+
implementation = decoded.args[0];
|
|
38
|
+
salt = keccak256(encodePacked(['bytes32', 'uint256'], [keccak256(decoded.args[1]), decoded.args[2]]));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
if (!input.owner)
|
|
42
|
+
throw new Error('Safe account owners are required');
|
|
43
|
+
const modules = [
|
|
44
|
+
...input.setup.validators,
|
|
45
|
+
...input.setup.executors,
|
|
46
|
+
...input.setup.fallbacks,
|
|
47
|
+
...input.setup.hooks,
|
|
48
|
+
];
|
|
49
|
+
const addSafe7579 = encodeFunctionData({
|
|
50
|
+
abi: parseAbi([
|
|
51
|
+
'struct ModuleInit {address module;bytes initData;uint256 moduleType}',
|
|
52
|
+
'function addSafe7579(address safe7579,ModuleInit[] modules,address[] attesters,uint8 threshold)',
|
|
53
|
+
]),
|
|
54
|
+
functionName: 'addSafe7579',
|
|
55
|
+
args: [
|
|
56
|
+
SAFE_ADAPTER,
|
|
57
|
+
modules.map((module) => ({
|
|
58
|
+
module: module.address,
|
|
59
|
+
initData: module.initData,
|
|
60
|
+
moduleType: module.kind === 'validator'
|
|
61
|
+
? 1n
|
|
62
|
+
: module.kind === 'executor'
|
|
63
|
+
? 2n
|
|
64
|
+
: module.kind === 'fallback'
|
|
65
|
+
? 3n
|
|
66
|
+
: 4n,
|
|
67
|
+
})),
|
|
68
|
+
[],
|
|
69
|
+
0,
|
|
70
|
+
],
|
|
71
|
+
});
|
|
72
|
+
const initializer = encodeFunctionData({
|
|
73
|
+
abi: parseAbi([
|
|
74
|
+
'function setup(address[] _owners,uint256 _threshold,address to,bytes data,address fallbackHandler,address paymentToken,uint256 payment,address paymentReceiver)',
|
|
75
|
+
]),
|
|
76
|
+
functionName: 'setup',
|
|
77
|
+
args: [
|
|
78
|
+
[...primaryOwnerAddresses(input.owner)],
|
|
79
|
+
primaryThreshold(input.owner),
|
|
80
|
+
SAFE_LAUNCHPAD,
|
|
81
|
+
addSafe7579,
|
|
82
|
+
SAFE_ADAPTER,
|
|
83
|
+
zeroAddress,
|
|
84
|
+
0n,
|
|
85
|
+
zeroAddress,
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
const nonce = input.account.nonce.source === 'explicit' ? input.account.nonce.value : 0n;
|
|
89
|
+
factoryData = encodeFunctionData({
|
|
90
|
+
abi: parseAbi([
|
|
91
|
+
'function createProxyWithNonce(address singleton,bytes initializer,uint256 saltNonce)',
|
|
92
|
+
]),
|
|
93
|
+
functionName: 'createProxyWithNonce',
|
|
94
|
+
args: [SAFE_SINGLETON, initializer, nonce],
|
|
95
|
+
});
|
|
96
|
+
salt = keccak256(encodePacked(['bytes32', 'uint256'], [keccak256(initializer), nonce]));
|
|
97
|
+
}
|
|
98
|
+
const constructorArgs = encodeAbiParameters(parseAbiParameters('address singleton'), [implementation]);
|
|
99
|
+
const address = getContractAddress({
|
|
100
|
+
opcode: 'CREATE2',
|
|
101
|
+
from: factory,
|
|
102
|
+
salt,
|
|
103
|
+
bytecode: concat([SAFE_PROXY_INIT_CODE, constructorArgs]),
|
|
104
|
+
});
|
|
105
|
+
return { address, factory, factoryData };
|
|
106
|
+
}
|
|
107
|
+
export function safeV0FactoryMaterial(input) {
|
|
108
|
+
if (input.account.kind !== 'safe')
|
|
109
|
+
throw new Error('Expected Safe account');
|
|
110
|
+
if (input.initData) {
|
|
111
|
+
throw new Error('Account configuration for Safe account is not supported: Custom V0 accounts are not supported');
|
|
112
|
+
}
|
|
113
|
+
if (!input.owner)
|
|
114
|
+
throw new Error('Safe account owners are required');
|
|
115
|
+
const attesters = getV0Attesters();
|
|
116
|
+
const modules = (items) => items.map((module) => ({
|
|
117
|
+
module: module.address,
|
|
118
|
+
initData: module.initData,
|
|
119
|
+
}));
|
|
120
|
+
const addSafe7579 = encodeFunctionData({
|
|
121
|
+
abi: parseAbi([
|
|
122
|
+
'struct ModuleInit {address module;bytes initData;}',
|
|
123
|
+
'function addSafe7579(address safe7579,ModuleInit[] validators,ModuleInit[] executors,ModuleInit[] fallbacks,ModuleInit[] hooks,address[] attesters,uint8 threshold)',
|
|
124
|
+
]),
|
|
125
|
+
functionName: 'addSafe7579',
|
|
126
|
+
args: [
|
|
127
|
+
SAFE_V0_ADAPTER,
|
|
128
|
+
modules(input.setup.validators),
|
|
129
|
+
modules(input.setup.executors),
|
|
130
|
+
modules(input.setup.fallbacks),
|
|
131
|
+
modules(input.setup.hooks),
|
|
132
|
+
[...attesters.addresses],
|
|
133
|
+
attesters.threshold,
|
|
134
|
+
],
|
|
135
|
+
});
|
|
136
|
+
const initializer = encodeFunctionData({
|
|
137
|
+
abi: parseAbi([
|
|
138
|
+
'function setup(address[] _owners,uint256 _threshold,address to,bytes data,address fallbackHandler,address paymentToken,uint256 payment,address paymentReceiver)',
|
|
139
|
+
]),
|
|
140
|
+
functionName: 'setup',
|
|
141
|
+
args: [
|
|
142
|
+
[...primaryOwnerAddresses(input.owner)],
|
|
143
|
+
primaryThreshold(input.owner),
|
|
144
|
+
SAFE_V0_LAUNCHPAD,
|
|
145
|
+
addSafe7579,
|
|
146
|
+
SAFE_V0_ADAPTER,
|
|
147
|
+
zeroAddress,
|
|
148
|
+
0n,
|
|
149
|
+
zeroAddress,
|
|
150
|
+
],
|
|
151
|
+
});
|
|
152
|
+
const nonce = input.account.nonce.source === 'explicit' ? input.account.nonce.value : 0n;
|
|
153
|
+
return {
|
|
154
|
+
factory: SAFE_FACTORY,
|
|
155
|
+
factoryData: encodeFunctionData({
|
|
156
|
+
abi: parseAbi([
|
|
157
|
+
'function createProxyWithNonce(address singleton,bytes initializer,uint256 saltNonce)',
|
|
158
|
+
]),
|
|
159
|
+
functionName: 'createProxyWithNonce',
|
|
160
|
+
args: [SAFE_SINGLETON, initializer, nonce],
|
|
161
|
+
}),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export function createSafeAdapter(construction) {
|
|
165
|
+
if (construction.account.kind !== 'safe') {
|
|
166
|
+
throw new Error('Expected Safe account');
|
|
167
|
+
}
|
|
168
|
+
const validator = construction.setup.validators[0]?.address ?? zeroAddress;
|
|
169
|
+
return {
|
|
170
|
+
account: construction.account,
|
|
171
|
+
capabilities: {
|
|
172
|
+
modular: true,
|
|
173
|
+
supportsDeployment: true,
|
|
174
|
+
supportsUserOperations: true,
|
|
175
|
+
supportsEip7702Adoption: false,
|
|
176
|
+
supportsSmartSessions: true,
|
|
177
|
+
supportsOriginSignatureReuse: true,
|
|
178
|
+
signatureEnvelope: { kind: 'safe', validator },
|
|
179
|
+
},
|
|
180
|
+
getIdentity: (input) => ({
|
|
181
|
+
definition: input.account,
|
|
182
|
+
address: safeMaterial(input).address,
|
|
183
|
+
}),
|
|
184
|
+
getDeploymentPlan: (input) => deploymentPlan(input.chain, safeMaterial(input), input.deployed),
|
|
185
|
+
encodeCalls: encodeErc7579Calls,
|
|
186
|
+
encodeModuleInstallation: (module) => [encodeInstallModule(module)],
|
|
187
|
+
encodeModuleUninstallation: encodeUninstallModule,
|
|
188
|
+
encodeSignatureEnvelope: ({ envelope, validatorContribution }) => {
|
|
189
|
+
if (envelope.kind !== 'safe')
|
|
190
|
+
throw new Error('Expected Safe envelope');
|
|
191
|
+
return encodeAddressEnvelope(envelope.validator, validatorContribution);
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import type { ResolvedModule } from '../../modules/types.js';
|
|
3
|
+
import type { ResolvedValidatorDefinition } from '../../modules/validators/types.js';
|
|
4
|
+
export declare function primaryOwnerAddresses(validator: ResolvedValidatorDefinition): readonly `0x${string}`[];
|
|
5
|
+
export declare function primaryThreshold(validator: ResolvedValidatorDefinition): bigint;
|
|
6
|
+
export declare function encodeInstallModule(module: ResolvedModule): Hex;
|
|
7
|
+
export declare function encodeUninstallModule(module: ResolvedModule): Hex;
|
|
8
|
+
export declare function encodeAddressEnvelope(validator: `0x${string}`, signature: Hex, defaultValidator?: `0x${string}`): Hex;
|
|
9
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../accounts/adapters/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,GAAG,EAAe,MAAM,MAAM,CAAA;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAEjF,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,2BAA2B,GACrC,SAAS,KAAK,MAAM,EAAE,EAAE,CAU1B;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,2BAA2B,GACrC,MAAM,CAMR;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,GAAG,CAkB/D;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,GAAG,CAkBjE;AAED,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,KAAK,MAAM,EAAE,EACxB,SAAS,EAAE,GAAG,EACd,gBAAgB,CAAC,EAAE,KAAK,MAAM,EAAE,GAC/B,GAAG,CAML"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { encodeFunctionData, encodePacked, zeroAddress } from 'viem';
|
|
2
|
+
import { moduleTypeId } from '../../modules/erc7579-abi.js';
|
|
3
|
+
export function primaryOwnerAddresses(validator) {
|
|
4
|
+
if (validator.kind === 'passkey' || validator.kind === 'multi-factor') {
|
|
5
|
+
return ['0xbabe99e62d8bcbd3acf5ccbcfcd4f64fe75e5e72'];
|
|
6
|
+
}
|
|
7
|
+
return validator.owners.map((owner) => {
|
|
8
|
+
if (owner.kind === 'webauthn') {
|
|
9
|
+
throw new Error('Validator owner does not expose an address');
|
|
10
|
+
}
|
|
11
|
+
return owner.account.address;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function primaryThreshold(validator) {
|
|
15
|
+
return BigInt(validator.kind === 'passkey' || validator.kind === 'multi-factor'
|
|
16
|
+
? 1
|
|
17
|
+
: validator.threshold);
|
|
18
|
+
}
|
|
19
|
+
export function encodeInstallModule(module) {
|
|
20
|
+
return encodeFunctionData({
|
|
21
|
+
abi: [
|
|
22
|
+
{
|
|
23
|
+
type: 'function',
|
|
24
|
+
name: 'installModule',
|
|
25
|
+
inputs: [
|
|
26
|
+
{ type: 'uint256', name: 'moduleTypeId' },
|
|
27
|
+
{ type: 'address', name: 'module' },
|
|
28
|
+
{ type: 'bytes', name: 'initData' },
|
|
29
|
+
],
|
|
30
|
+
outputs: [],
|
|
31
|
+
stateMutability: 'nonpayable',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
functionName: 'installModule',
|
|
35
|
+
args: [moduleTypeId(module.kind), module.address, module.initData],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export function encodeUninstallModule(module) {
|
|
39
|
+
return encodeFunctionData({
|
|
40
|
+
abi: [
|
|
41
|
+
{
|
|
42
|
+
type: 'function',
|
|
43
|
+
name: 'uninstallModule',
|
|
44
|
+
inputs: [
|
|
45
|
+
{ type: 'uint256', name: 'moduleTypeId' },
|
|
46
|
+
{ type: 'address', name: 'module' },
|
|
47
|
+
{ type: 'bytes', name: 'deInitData' },
|
|
48
|
+
],
|
|
49
|
+
outputs: [],
|
|
50
|
+
stateMutability: 'nonpayable',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
functionName: 'uninstallModule',
|
|
54
|
+
args: [moduleTypeId(module.kind), module.address, module.deInitData],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export function encodeAddressEnvelope(validator, signature, defaultValidator) {
|
|
58
|
+
const address = defaultValidator?.toLowerCase() === validator.toLowerCase()
|
|
59
|
+
? zeroAddress
|
|
60
|
+
: validator;
|
|
61
|
+
return encodePacked(['address', 'bytes'], [address, signature]);
|
|
62
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
import { K1_DEFAULT_VALIDATOR_ADDRESS } from '../../modules/validators/k1.js';
|
|
3
|
+
import type { AccountAdapter } from '../adapter.js';
|
|
4
|
+
import type { AccountConstruction } from '../types.js';
|
|
5
|
+
export { K1_DEFAULT_VALIDATOR_ADDRESS };
|
|
6
|
+
export declare function startaleEip712Domain(account: Address, chainId: number): {
|
|
7
|
+
readonly name: "Startale";
|
|
8
|
+
readonly version: "1.0.0";
|
|
9
|
+
readonly chainId: number;
|
|
10
|
+
readonly verifyingContract: `0x${string}`;
|
|
11
|
+
readonly salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
12
|
+
};
|
|
13
|
+
export declare function createStartaleAdapter(construction: AccountConstruction): AccountAdapter;
|
|
14
|
+
//# sourceMappingURL=startale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startale.d.ts","sourceRoot":"","sources":["../../../../accounts/adapters/startale.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAYb,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAQnD,OAAO,EAAE,4BAA4B,EAAE,CAAA;AACvC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM;;;;;;EAQrE;AAqID,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,mBAAmB,GAChC,cAAc,CAoChB"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { concat, decodeFunctionData, encodeAbiParameters, encodeFunctionData, encodePacked, keccak256, parseAbi, slice, zeroAddress, zeroHash, } from 'viem';
|
|
2
|
+
import { K1_DEFAULT_VALIDATOR_ADDRESS } from '../../modules/validators/k1.js';
|
|
3
|
+
import { deploymentPlan } from '../deployment.js';
|
|
4
|
+
import { encodeErc7579Calls } from '../erc7579-calls.js';
|
|
5
|
+
import { encodeAddressEnvelope, encodeInstallModule, encodeUninstallModule, primaryOwnerAddresses, } from './shared.js';
|
|
6
|
+
export { K1_DEFAULT_VALIDATOR_ADDRESS };
|
|
7
|
+
export function startaleEip712Domain(account, chainId) {
|
|
8
|
+
return {
|
|
9
|
+
name: 'Startale',
|
|
10
|
+
version: '1.0.0',
|
|
11
|
+
chainId,
|
|
12
|
+
verifyingContract: account,
|
|
13
|
+
salt: zeroHash,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const STARTALE_IMPLEMENTATION_ADDRESS = '0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a';
|
|
17
|
+
const STARTALE_FACTORY_ADDRESS = '0x0000003b3e7b530b4f981ae80d9350392defef90';
|
|
18
|
+
const STARTALE_BOOTSTRAP_ADDRESS = '0x000000552a5fae3db7a8f3917c435448f49ba6a9';
|
|
19
|
+
const STARTALE_CREATION_CODE = '0x608060405261029d803803806100148161018c565b92833981016040828203126101885781516001600160a01b03811692909190838303610188576020810151906001600160401b03821161018857019281601f8501121561018857835161006e610069826101c5565b61018c565b9481865260208601936020838301011161018857815f926020809301865e8601015260017f754fd8b321c4649cb777ae6fdce7e89e9cceaa31a4f639795c7807eb7f1a27005d823b15610176577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916821790557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b5f80a282511561015e575f8091610146945190845af43d15610156573d91610137610069846101c5565b9283523d5f602085013e6101e0565b505b604051605e908161023f8239f35b6060916101e0565b50505034156101485763b398979f60e01b5f5260045ffd5b634c9c8ce360e01b5f5260045260245ffd5b5f80fd5b6040519190601f01601f191682016001600160401b038111838210176101b157604052565b634e487b7160e01b5f52604160045260245ffd5b6001600160401b0381116101b157601f01601f191660200190565b9061020457508051156101f557805190602001fd5b63d6bda27560e01b5f5260045ffd5b81511580610235575b610215575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b1561020d56fe60806040523615605c575f8073ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5416368280378136915af43d5f803e156058573d5ff35b3d5ffd5b00';
|
|
20
|
+
function moduleConfigs(modules) {
|
|
21
|
+
return modules.map((module) => ({
|
|
22
|
+
module: module.address,
|
|
23
|
+
initData: module.initData,
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
function startaleInitData(input) {
|
|
27
|
+
const ownerValidator = input.setup.validators[0];
|
|
28
|
+
if (!ownerValidator)
|
|
29
|
+
throw new Error('Startale owner validator is required');
|
|
30
|
+
const isK1 = ownerValidator.address.toLowerCase() ===
|
|
31
|
+
K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
|
|
32
|
+
let bootstrapData;
|
|
33
|
+
if (isK1) {
|
|
34
|
+
if (!input.owner)
|
|
35
|
+
throw new Error('Startale K1 owner is required');
|
|
36
|
+
const owners = primaryOwnerAddresses(input.owner);
|
|
37
|
+
if (owners.length !== 1) {
|
|
38
|
+
throw new Error('K1 validator only supports a single owner');
|
|
39
|
+
}
|
|
40
|
+
bootstrapData = encodeFunctionData({
|
|
41
|
+
abi: parseAbi([
|
|
42
|
+
'struct BootstrapConfig {address module;bytes initData;}',
|
|
43
|
+
'struct BootstrapPreValidationHookConfig {uint256 hookType;address module;bytes data;}',
|
|
44
|
+
'function initWithDefaultValidatorAndOtherModules(bytes defaultValidatorInitData,BootstrapConfig[] validators,BootstrapConfig[] executors,BootstrapConfig hook,BootstrapConfig[] fallbacks,BootstrapPreValidationHookConfig[] preValidationHooks)',
|
|
45
|
+
]),
|
|
46
|
+
functionName: 'initWithDefaultValidatorAndOtherModules',
|
|
47
|
+
args: [
|
|
48
|
+
owners[0],
|
|
49
|
+
moduleConfigs(input.setup.validators.slice(1)),
|
|
50
|
+
moduleConfigs(input.setup.executors),
|
|
51
|
+
{ module: zeroAddress, initData: zeroHash },
|
|
52
|
+
moduleConfigs(input.setup.fallbacks),
|
|
53
|
+
[],
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
bootstrapData = encodeFunctionData({
|
|
59
|
+
abi: parseAbi([
|
|
60
|
+
'struct BootstrapConfig {address module;bytes initData;}',
|
|
61
|
+
'struct BootstrapPreValidationHookConfig {uint256 hookType;address module;bytes data;}',
|
|
62
|
+
'function init(BootstrapConfig[] validators,BootstrapConfig[] executors,BootstrapConfig hook,BootstrapConfig[] fallbacks,BootstrapPreValidationHookConfig[] preValidationHooks)',
|
|
63
|
+
]),
|
|
64
|
+
functionName: 'init',
|
|
65
|
+
args: [
|
|
66
|
+
moduleConfigs(input.setup.validators),
|
|
67
|
+
moduleConfigs(input.setup.executors),
|
|
68
|
+
{ module: zeroAddress, initData: '0x' },
|
|
69
|
+
moduleConfigs(input.setup.fallbacks),
|
|
70
|
+
[],
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return encodeAbiParameters([{ type: 'address' }, { type: 'bytes' }], [STARTALE_BOOTSTRAP_ADDRESS, bootstrapData]);
|
|
75
|
+
}
|
|
76
|
+
function startaleMaterial(input) {
|
|
77
|
+
if (input.account.kind !== 'startale') {
|
|
78
|
+
throw new Error('Expected Startale account');
|
|
79
|
+
}
|
|
80
|
+
if (input.eoa)
|
|
81
|
+
return { address: input.eoa.address };
|
|
82
|
+
if (input.initData && !('factory' in input.initData)) {
|
|
83
|
+
return { address: input.initData.address };
|
|
84
|
+
}
|
|
85
|
+
let factory = STARTALE_FACTORY_ADDRESS;
|
|
86
|
+
let factoryData;
|
|
87
|
+
let salt;
|
|
88
|
+
let initializationCallData;
|
|
89
|
+
if (input.initData && 'factory' in input.initData) {
|
|
90
|
+
try {
|
|
91
|
+
const decoded = decodeFunctionData({
|
|
92
|
+
abi: parseAbi(['function createAccount(bytes,bytes32)']),
|
|
93
|
+
data: input.initData.factoryData,
|
|
94
|
+
});
|
|
95
|
+
factory = input.initData.factory;
|
|
96
|
+
factoryData = input.initData.factoryData;
|
|
97
|
+
salt = decoded.args[1];
|
|
98
|
+
initializationCallData = encodeFunctionData({
|
|
99
|
+
abi: parseAbi(['function initializeAccount(bytes)']),
|
|
100
|
+
functionName: 'initializeAccount',
|
|
101
|
+
args: [decoded.args[0]],
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return { address: input.initData.address };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
salt =
|
|
110
|
+
input.account.salt.source === 'explicit'
|
|
111
|
+
? input.account.salt.value
|
|
112
|
+
: zeroHash;
|
|
113
|
+
const initData = startaleInitData(input);
|
|
114
|
+
factoryData = encodeFunctionData({
|
|
115
|
+
abi: parseAbi(['function createAccount(bytes,bytes32)']),
|
|
116
|
+
functionName: 'createAccount',
|
|
117
|
+
args: [initData, salt],
|
|
118
|
+
});
|
|
119
|
+
initializationCallData = encodeFunctionData({
|
|
120
|
+
abi: parseAbi(['function initializeAccount(bytes)']),
|
|
121
|
+
functionName: 'initializeAccount',
|
|
122
|
+
args: [initData],
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const accountInitData = encodeAbiParameters([{ type: 'address' }, { type: 'bytes' }], [STARTALE_IMPLEMENTATION_ADDRESS, initializationCallData]);
|
|
126
|
+
const hash = keccak256(encodePacked(['bytes1', 'address', 'bytes32', 'bytes32'], [
|
|
127
|
+
'0xff',
|
|
128
|
+
factory,
|
|
129
|
+
salt,
|
|
130
|
+
keccak256(concat([STARTALE_CREATION_CODE, accountInitData])),
|
|
131
|
+
]));
|
|
132
|
+
return { address: slice(hash, 12, 32), factory, factoryData };
|
|
133
|
+
}
|
|
134
|
+
export function createStartaleAdapter(construction) {
|
|
135
|
+
if (construction.account.kind !== 'startale') {
|
|
136
|
+
throw new Error('Expected Startale account');
|
|
137
|
+
}
|
|
138
|
+
const validator = construction.setup.validators[0]?.address ?? zeroAddress;
|
|
139
|
+
return {
|
|
140
|
+
account: construction.account,
|
|
141
|
+
capabilities: {
|
|
142
|
+
modular: true,
|
|
143
|
+
supportsDeployment: true,
|
|
144
|
+
supportsUserOperations: true,
|
|
145
|
+
supportsEip7702Adoption: false,
|
|
146
|
+
supportsSmartSessions: true,
|
|
147
|
+
supportsOriginSignatureReuse: true,
|
|
148
|
+
signatureEnvelope: { kind: 'startale', validator },
|
|
149
|
+
},
|
|
150
|
+
getIdentity: (input) => ({
|
|
151
|
+
definition: input.account,
|
|
152
|
+
address: startaleMaterial(input).address,
|
|
153
|
+
}),
|
|
154
|
+
getDeploymentPlan: (input) => deploymentPlan(input.chain, startaleMaterial(input), input.deployed),
|
|
155
|
+
encodeCalls: encodeErc7579Calls,
|
|
156
|
+
encodeModuleInstallation: (module) => [encodeInstallModule(module)],
|
|
157
|
+
encodeModuleUninstallation: encodeUninstallModule,
|
|
158
|
+
encodeSignatureEnvelope: ({ envelope, validatorContribution }) => {
|
|
159
|
+
if (envelope.kind !== 'startale') {
|
|
160
|
+
throw new Error('Expected Startale envelope');
|
|
161
|
+
}
|
|
162
|
+
return encodeAddressEnvelope(envelope.validator, validatorContribution, K1_DEFAULT_VALIDATOR_ADDRESS);
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Account } from 'viem';
|
|
2
|
+
import type { EvmChainReference } from '../chains/types.js';
|
|
3
|
+
import type { ConfiguredModule, ModuleSetup } from '../modules/types.js';
|
|
4
|
+
import type { ResolvedValidatorDefinition } from '../modules/validators/types.js';
|
|
5
|
+
import type { AccountConstruction, AccountDefinition, AccountInitData } from './types.js';
|
|
6
|
+
export interface AccountConstructionMaterial {
|
|
7
|
+
readonly account: AccountDefinition;
|
|
8
|
+
readonly owner?: ResolvedValidatorDefinition;
|
|
9
|
+
readonly modules: readonly ConfiguredModule[];
|
|
10
|
+
readonly initData?: AccountInitData;
|
|
11
|
+
readonly eoa?: Account;
|
|
12
|
+
readonly sessions: {
|
|
13
|
+
readonly enabled: boolean;
|
|
14
|
+
readonly environment: 'production' | 'development';
|
|
15
|
+
readonly module?: `0x${string}`;
|
|
16
|
+
readonly compatibilityFallback?: `0x${string}`;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare function createAccountConstruction(input: {
|
|
20
|
+
readonly material: AccountConstructionMaterial;
|
|
21
|
+
readonly chain: EvmChainReference;
|
|
22
|
+
readonly deployed: boolean;
|
|
23
|
+
readonly setup?: ModuleSetup;
|
|
24
|
+
}): AccountConstruction;
|
|
25
|
+
//# sourceMappingURL=construction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"construction.d.ts","sourceRoot":"","sources":["../../../accounts/construction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAErE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAA;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,2BAA2B,CAAA;IAC5C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAA;IAC7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;QACzB,QAAQ,CAAC,WAAW,EAAE,YAAY,GAAG,aAAa,CAAA;QAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,MAAM,EAAE,CAAA;QAC/B,QAAQ,CAAC,qBAAqB,CAAC,EAAE,KAAK,MAAM,EAAE,CAAA;KAC/C,CAAA;CACF;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAA;IAC9C,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAA;CAC7B,GAAG,mBAAmB,CAgCtB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { planModuleSetup } from '../modules/plan.js';
|
|
2
|
+
import { resolveValidator } from '../modules/validators/resolve.js';
|
|
3
|
+
export function createAccountConstruction(input) {
|
|
4
|
+
const ownerModule = input.material.owner
|
|
5
|
+
? resolveValidator(input.material.owner)
|
|
6
|
+
: undefined;
|
|
7
|
+
if (!ownerModule && input.material.account.kind !== 'eoa') {
|
|
8
|
+
throw new Error('Smart account owner is required');
|
|
9
|
+
}
|
|
10
|
+
const setup = input.setup ??
|
|
11
|
+
(ownerModule
|
|
12
|
+
? planModuleSetup({
|
|
13
|
+
accountKind: input.material.account.kind,
|
|
14
|
+
owner: ownerModule,
|
|
15
|
+
configured: input.material.modules,
|
|
16
|
+
environment: input.material.sessions.environment,
|
|
17
|
+
sessions: input.material.sessions,
|
|
18
|
+
})
|
|
19
|
+
: { validators: [], executors: [], hooks: [], fallbacks: [] });
|
|
20
|
+
return {
|
|
21
|
+
account: input.material.account,
|
|
22
|
+
...(input.material.owner ? { owner: input.material.owner } : {}),
|
|
23
|
+
modules: input.material.modules,
|
|
24
|
+
setup,
|
|
25
|
+
sessions: {
|
|
26
|
+
enabled: input.material.sessions.enabled,
|
|
27
|
+
environment: input.material.sessions.environment,
|
|
28
|
+
},
|
|
29
|
+
...(input.material.initData ? { initData: input.material.initData } : {}),
|
|
30
|
+
...(input.material.eoa ? { eoa: input.material.eoa } : {}),
|
|
31
|
+
chain: input.chain,
|
|
32
|
+
deployed: input.deployed,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
import type { AccountDefinition, AccountDeploymentPlan, AccountInitData, AccountValueSelection } from './types.js';
|
|
3
|
+
export interface DeploymentMaterial {
|
|
4
|
+
readonly address: Address;
|
|
5
|
+
readonly factory?: Address;
|
|
6
|
+
readonly factoryData?: Hex;
|
|
7
|
+
}
|
|
8
|
+
export declare function selectedValue<Value, Profile extends string>(selection: AccountValueSelection<Value, Profile>, defaults: Readonly<Record<Profile, Value>>): Value;
|
|
9
|
+
export declare function deploymentPlan(chain: AccountDeploymentPlan['chain'], material: DeploymentMaterial, deployed: boolean): AccountDeploymentPlan;
|
|
10
|
+
export declare function initDataMaterial(initData: AccountInitData | undefined): DeploymentMaterial | undefined;
|
|
11
|
+
export declare function accountKind(definition: AccountDefinition): AccountDefinition['kind'];
|
|
12
|
+
//# sourceMappingURL=deployment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../../accounts/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,GAAG,CAAA;CAC3B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,SAAS,MAAM,EACzD,SAAS,EAAE,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,EAChD,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,GACzC,KAAK,CAIP;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,EACrC,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EAAE,OAAO,GAChB,qBAAqB,CAcvB;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,eAAe,GAAG,SAAS,GACpC,kBAAkB,GAAG,SAAS,CAShC;AAED,wBAAgB,WAAW,CACzB,UAAU,EAAE,iBAAiB,GAC5B,iBAAiB,CAAC,MAAM,CAAC,CAE3B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function selectedValue(selection, defaults) {
|
|
2
|
+
return selection.source === 'explicit'
|
|
3
|
+
? selection.value
|
|
4
|
+
: defaults[selection.profile];
|
|
5
|
+
}
|
|
6
|
+
export function deploymentPlan(chain, material, deployed) {
|
|
7
|
+
return {
|
|
8
|
+
chain,
|
|
9
|
+
address: material.address,
|
|
10
|
+
...(material.factory ? { factory: material.factory } : {}),
|
|
11
|
+
...(material.factoryData ? { factoryData: material.factoryData } : {}),
|
|
12
|
+
...(material.factory && material.factoryData
|
|
13
|
+
? {
|
|
14
|
+
initCode: `${material.factory}${material.factoryData.slice(2)}`,
|
|
15
|
+
}
|
|
16
|
+
: {}),
|
|
17
|
+
deployed,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function initDataMaterial(initData) {
|
|
21
|
+
if (!initData)
|
|
22
|
+
return undefined;
|
|
23
|
+
return 'factory' in initData
|
|
24
|
+
? {
|
|
25
|
+
address: initData.address,
|
|
26
|
+
factory: initData.factory,
|
|
27
|
+
factoryData: initData.factoryData,
|
|
28
|
+
}
|
|
29
|
+
: { address: initData.address };
|
|
30
|
+
}
|
|
31
|
+
export function accountKind(definition) {
|
|
32
|
+
return definition.kind;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc7579-calls.d.ts","sourceRoot":"","sources":["../../../accounts/erc7579-calls.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AA4BvD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,wBAAwB,GAAG,GAAG,CAqCvE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { concatHex, encodeAbiParameters, encodeFunctionData, encodePacked, toBytes, toHex, } from 'viem';
|
|
2
|
+
function executionMode(mode) {
|
|
3
|
+
return encodePacked(['bytes1', 'bytes1', 'bytes4', 'bytes4', 'bytes22'], [
|
|
4
|
+
toHex(toBytes(mode === 'batch' ? '0x01' : '0x00', { size: 1 })),
|
|
5
|
+
'0x00',
|
|
6
|
+
'0x00000000',
|
|
7
|
+
'0x00000000',
|
|
8
|
+
`0x${'00'.repeat(22)}`,
|
|
9
|
+
]);
|
|
10
|
+
}
|
|
11
|
+
const executeAbi = [
|
|
12
|
+
{
|
|
13
|
+
type: 'function',
|
|
14
|
+
name: 'execute',
|
|
15
|
+
inputs: [
|
|
16
|
+
{ name: 'execMode', type: 'bytes32' },
|
|
17
|
+
{ name: 'executionCalldata', type: 'bytes' },
|
|
18
|
+
],
|
|
19
|
+
outputs: [],
|
|
20
|
+
stateMutability: 'payable',
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
export function encodeErc7579Calls(input) {
|
|
24
|
+
if (input.calls.length === 0)
|
|
25
|
+
throw new Error('No calls to encode');
|
|
26
|
+
if (input.calls.length > 1 && input.mode !== 'batch') {
|
|
27
|
+
throw new Error('Single execution mode cannot encode multiple calls');
|
|
28
|
+
}
|
|
29
|
+
const calldata = input.mode === 'batch'
|
|
30
|
+
? encodeAbiParameters([
|
|
31
|
+
{
|
|
32
|
+
name: 'executionBatch',
|
|
33
|
+
type: 'tuple[]',
|
|
34
|
+
components: [
|
|
35
|
+
{ name: 'target', type: 'address' },
|
|
36
|
+
{ name: 'value', type: 'uint256' },
|
|
37
|
+
{ name: 'callData', type: 'bytes' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
], [
|
|
41
|
+
input.calls.map((call) => ({
|
|
42
|
+
target: call.target,
|
|
43
|
+
value: call.value,
|
|
44
|
+
callData: call.data,
|
|
45
|
+
})),
|
|
46
|
+
])
|
|
47
|
+
: concatHex([
|
|
48
|
+
input.calls[0].target,
|
|
49
|
+
toHex(input.calls[0].value, { size: 32 }),
|
|
50
|
+
input.calls[0].data,
|
|
51
|
+
]);
|
|
52
|
+
return encodeFunctionData({
|
|
53
|
+
abi: executeAbi,
|
|
54
|
+
functionName: 'execute',
|
|
55
|
+
args: [executionMode(input.mode), calldata],
|
|
56
|
+
});
|
|
57
|
+
}
|