@rhinestone/sdk 2.0.0-beta.9 → 2.1.0
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 +121 -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 +16 -0
- package/dist/src/accounts/adapters/nexus.d.ts.map +1 -0
- package/dist/src/accounts/adapters/nexus.js +212 -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 +3 -10
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +5 -11
- 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/types.js +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 +2 -2
- package/dist/src/actions/ecdsa.d.ts.map +1 -1
- package/dist/src/actions/ecdsa.js +12 -65
- 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/ownable.d.ts +6 -0
- package/dist/src/actions/ownable.d.ts.map +1 -0
- package/dist/src/actions/ownable.js +63 -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 +23 -78
- package/dist/src/actions/recovery.d.ts +58 -24
- package/dist/src/actions/recovery.d.ts.map +1 -1
- package/dist/src/actions/recovery.js +107 -162
- package/dist/src/actions/runtime.d.ts +17 -0
- package/dist/src/actions/runtime.d.ts.map +1 -0
- package/dist/src/actions/runtime.js +182 -0
- package/dist/src/actions/smart-sessions.d.ts +30 -6
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +69 -18
- package/dist/src/actions/webauthn.d.ts +6 -0
- package/dist/src/actions/webauthn.d.ts.map +1 -0
- package/dist/src/actions/webauthn.js +67 -0
- 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 +638 -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-types.js +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 +772 -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 +20 -0
- package/dist/src/api/signer-selection.d.ts.map +1 -0
- package/dist/src/api/signer-selection.js +159 -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} +9 -6
- 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/clients/orchestrator/errors.d.ts +238 -0
- package/dist/src/clients/orchestrator/errors.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/errors.js +525 -0
- 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} +113 -43
- package/dist/src/clients/orchestrator/public.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/public.js +14 -0
- package/dist/src/clients/orchestrator/types.d.ts +144 -0
- package/dist/src/clients/orchestrator/types.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/types.js +1 -0
- package/dist/src/clients/orchestrator/wire.d.ts +19 -0
- package/dist/src/clients/orchestrator/wire.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/wire.gen.d.ts +6463 -0
- 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/config/account.d.ts +767 -0
- 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 +59 -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 +200 -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} +47 -9
- package/dist/src/errors/execution.d.ts.map +1 -0
- package/dist/src/errors/execution.js +131 -0
- package/dist/src/errors/index.d.ts +6 -4
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +7 -6
- package/dist/src/index.d.ts +14 -84
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -293
- package/dist/src/jwt-server/jcs.d.ts +1 -1
- package/dist/src/jwt-server/jcs.js +4 -2
- 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 +62 -0
- package/dist/src/modules/read-core.d.ts.map +1 -0
- package/dist/src/modules/read-core.js +206 -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 +2 -1
- package/dist/src/modules/validators/permissions.d.ts.map +1 -1
- package/dist/src/modules/validators/permissions.js +192 -18
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts +19 -0
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -0
- package/dist/src/modules/validators/policies/claim/arbiters.js +82 -0
- 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/social-recovery.d.ts +16 -0
- package/dist/src/modules/validators/social-recovery.d.ts.map +1 -0
- package/dist/src/modules/validators/social-recovery.js +17 -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 +16 -0
- package/dist/src/smart-sessions/index.d.ts.map +1 -0
- package/dist/src/smart-sessions/index.js +45 -0
- 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 +136 -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 +68 -4
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +113 -51
- package/package.json +10 -11
- package/dist/src/accounts/index.d.ts +0 -51
- package/dist/src/accounts/index.d.ts.map +0 -1
- package/dist/src/accounts/index.js +0 -589
- 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 -27
- package/dist/src/accounts/kernel.d.ts.map +0 -1
- package/dist/src/accounts/kernel.js +0 -272
- package/dist/src/accounts/nexus.d.ts +0 -33
- package/dist/src/accounts/nexus.d.ts.map +0 -1
- package/dist/src/accounts/nexus.js +0 -444
- package/dist/src/accounts/safe.d.ts +0 -33
- package/dist/src/accounts/safe.d.ts.map +0 -1
- package/dist/src/accounts/safe.js +0 -343
- package/dist/src/accounts/signing/common.d.ts +0 -32
- package/dist/src/accounts/signing/common.d.ts.map +0 -1
- package/dist/src/accounts/signing/common.js +0 -184
- 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 -45
- 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 -33
- package/dist/src/accounts/startale.d.ts +0 -26
- package/dist/src/accounts/startale.d.ts.map +0 -1
- package/dist/src/accounts/startale.js +0 -191
- 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/error.js +0 -85
- 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 -202
- package/dist/src/execution/utils.d.ts +0 -127
- package/dist/src/execution/utils.d.ts.map +0 -1
- package/dist/src/execution/utils.js +0 -1116
- 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 -90
- 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 -10
- package/dist/src/modules/read.d.ts.map +0 -1
- package/dist/src/modules/read.js +0 -171
- 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 -266
- 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 -196
- package/dist/src/modules/validators/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.js +0 -772
- package/dist/src/orchestrator/caip2.d.ts +0 -13
- package/dist/src/orchestrator/caip2.d.ts.map +0 -1
- package/dist/src/orchestrator/caip2.js +0 -52
- 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 -293
- 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 -36
- package/dist/src/orchestrator/error.d.ts +0 -97
- package/dist/src/orchestrator/error.d.ts.map +0 -1
- package/dist/src/orchestrator/error.js +0 -173
- 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 -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 -100
- package/dist/src/orchestrator/types.d.ts.map +0 -1
- package/dist/src/orchestrator/types.js +0 -15
- 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/types.d.ts +0 -466
- 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/{types.js → accounts/adapter.js} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AccountAdapter, AccountRuntime } from '../accounts/adapter.js';
|
|
2
|
+
import type { AccountCapabilities, AccountIdentity } from '../accounts/types.js';
|
|
3
|
+
import type { ResolvedValidatorDefinition, ValidatorCapabilities, ValidatorContributionCodec, ValidatorSigningPurpose } from '../modules/validators/types.js';
|
|
4
|
+
import type { ArtifactAssemblyPlan, EffectiveSignerSelection, OwnerSignerSelection, SignerInvocationPort, SignerReference } from './types.js';
|
|
5
|
+
export interface SigningContext {
|
|
6
|
+
readonly account: AccountIdentity;
|
|
7
|
+
readonly accountAdapter: AccountAdapter;
|
|
8
|
+
readonly accountCapabilities: AccountCapabilities;
|
|
9
|
+
readonly validator: ResolvedValidatorDefinition;
|
|
10
|
+
readonly validatorCapabilities: ValidatorCapabilities;
|
|
11
|
+
readonly effectiveSigners: EffectiveSignerSelection;
|
|
12
|
+
readonly signerReferences: Readonly<Record<string, SignerReference>>;
|
|
13
|
+
readonly signerInvoker: SignerInvocationPort;
|
|
14
|
+
}
|
|
15
|
+
export declare function createAccountSigningContext(input: {
|
|
16
|
+
readonly runtime: AccountRuntime;
|
|
17
|
+
readonly purpose: ValidatorSigningPurpose;
|
|
18
|
+
readonly signerInvoker: SignerInvocationPort;
|
|
19
|
+
readonly selection?: OwnerSignerSelection;
|
|
20
|
+
}): SigningContext;
|
|
21
|
+
export declare function getSigningValidatorCodec(context: SigningContext, payloadKind?: 'message' | 'typed-data'): ValidatorContributionCodec;
|
|
22
|
+
export declare function getSigningValidatorFactors(context: SigningContext, payloadKind?: 'message' | 'typed-data'): NonNullable<ArtifactAssemblyPlan['validatorFactors']>;
|
|
23
|
+
export declare function getAccountSignatureRoute(runtime: AccountRuntime, context: SigningContext, erc7739?: ArtifactAssemblyPlan['erc7739'], payloadKind?: 'message' | 'typed-data'): Omit<ArtifactAssemblyPlan, 'id' | 'stageId' | 'input' | 'usage'>;
|
|
24
|
+
export declare function getAccountSignatureEnvelope(context: SigningContext): import('../accounts/types.js').AccountSignatureEnvelope;
|
|
25
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../signing/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAI7E,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAA;IACvC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAA;IACjD,QAAQ,CAAC,SAAS,EAAE,2BAA2B,CAAA;IAC/C,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAA;IACrD,QAAQ,CAAC,gBAAgB,EAAE,wBAAwB,CAAA;IACnD,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAA;IACpE,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAA;CAC7C;AAID,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAA;IACzC,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAA;IAC5C,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAA;CAC1C,GAAG,cAAc,CA4DjB;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,cAAc,EACvB,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,GACrC,0BAA0B,CAoB5B;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,cAAc,EACvB,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,GACrC,WAAW,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC,CAmCvD;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,cAAc,EACvB,OAAO,GAAE,oBAAoB,CAAC,SAAS,CAAoB,EAC3D,WAAW,GAAE,SAAS,GAAG,YAAwB,GAChD,IAAI,CAAC,oBAAoB,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC,CAsBlE;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,cAAc,GACtB,OAAO,mBAAmB,EAAE,wBAAwB,CAWtD"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { isAddressEqual } from 'viem';
|
|
2
|
+
import { getValidatorCapabilities } from '../modules/validators/capabilities.js';
|
|
3
|
+
import { resolveValidator } from '../modules/validators/resolve.js';
|
|
4
|
+
import { ecdsaSignerId } from '../modules/validators/signer-id.js';
|
|
5
|
+
import { signingTopology } from './plan.js';
|
|
6
|
+
const zeroAddress = '0x0000000000000000000000000000000000000000';
|
|
7
|
+
export function createAccountSigningContext(input) {
|
|
8
|
+
const validator = input.selection?.validator ??
|
|
9
|
+
input.runtime.construction.owner ??
|
|
10
|
+
eoaValidator(input.runtime);
|
|
11
|
+
const module = input.selection?.validator === undefined &&
|
|
12
|
+
input.runtime.construction.owner === undefined
|
|
13
|
+
? {
|
|
14
|
+
kind: 'validator',
|
|
15
|
+
address: zeroAddress,
|
|
16
|
+
initData: '0x',
|
|
17
|
+
deInitData: '0x',
|
|
18
|
+
additionalContext: '0x',
|
|
19
|
+
}
|
|
20
|
+
: resolveValidator(validator);
|
|
21
|
+
const signerReferences = Object.fromEntries(validatorOwners(validator).map((owner) => [
|
|
22
|
+
owner.signerId,
|
|
23
|
+
{
|
|
24
|
+
id: owner.signerId,
|
|
25
|
+
kind: owner.kind === 'webauthn'
|
|
26
|
+
? 'webauthn'
|
|
27
|
+
: 'ecdsa',
|
|
28
|
+
},
|
|
29
|
+
]));
|
|
30
|
+
const topology = input.selection?.validator === undefined &&
|
|
31
|
+
input.runtime.construction.owner === undefined
|
|
32
|
+
? {
|
|
33
|
+
configuredTopology: {
|
|
34
|
+
rootValidatorId: 'eoa',
|
|
35
|
+
validators: [],
|
|
36
|
+
threshold: 1,
|
|
37
|
+
},
|
|
38
|
+
effectiveSelection: {
|
|
39
|
+
validatorIds: [],
|
|
40
|
+
signerIds: Object.keys(signerReferences),
|
|
41
|
+
threshold: 1,
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
: signingTopology(validator, input.selection?.signerIds);
|
|
45
|
+
return {
|
|
46
|
+
account: input.runtime.identity,
|
|
47
|
+
accountAdapter: input.runtime.adapter,
|
|
48
|
+
accountCapabilities: input.runtime.adapter.capabilities,
|
|
49
|
+
validator,
|
|
50
|
+
validatorCapabilities: getValidatorCapabilities(validator, module, input.runtime.construction.account.kind, input.purpose, input.runtime.adapter.capabilities.supportsOriginSignatureReuse),
|
|
51
|
+
effectiveSigners: topology.effectiveSelection,
|
|
52
|
+
signerReferences,
|
|
53
|
+
signerInvoker: input.signerInvoker,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function getSigningValidatorCodec(context, payloadKind) {
|
|
57
|
+
const codec = context.validatorCapabilities.contributionCodec;
|
|
58
|
+
const normalizedCodec = payloadKind === 'typed-data' && codec.kind === 'ordered-threshold'
|
|
59
|
+
? { ...codec, recoveryEncoding: 'ethereum' }
|
|
60
|
+
: codec;
|
|
61
|
+
if (context.validator.kind !== 'passkey' ||
|
|
62
|
+
normalizedCodec.kind !== 'ordered-threshold') {
|
|
63
|
+
return normalizedCodec;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
...normalizedCodec,
|
|
67
|
+
webauthn: {
|
|
68
|
+
account: context.account.address,
|
|
69
|
+
usePrecompile: false,
|
|
70
|
+
format: 'current',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export function getSigningValidatorFactors(context, payloadKind) {
|
|
75
|
+
if (context.validator.kind !== 'multi-factor')
|
|
76
|
+
return [];
|
|
77
|
+
return context.validator.validators.map((factor) => {
|
|
78
|
+
const module = resolveValidator(factor);
|
|
79
|
+
const codec = getValidatorCapabilities(factor, module, context.account.definition.kind, context.validatorCapabilities.compatibilityKey.purpose, context.accountCapabilities.supportsOriginSignatureReuse).contributionCodec;
|
|
80
|
+
const normalizedCodec = payloadKind === 'typed-data' && codec.kind === 'ordered-threshold'
|
|
81
|
+
? { ...codec, recoveryEncoding: 'ethereum' }
|
|
82
|
+
: codec;
|
|
83
|
+
if (normalizedCodec.kind !== 'ordered-threshold') {
|
|
84
|
+
throw new Error(`Multi-factor validator ${factor.id} is not atomic`);
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
id: factor.id,
|
|
88
|
+
publicId: factor.publicId,
|
|
89
|
+
validator: module.address,
|
|
90
|
+
codec: factor.kind === 'passkey'
|
|
91
|
+
? {
|
|
92
|
+
...normalizedCodec,
|
|
93
|
+
webauthn: {
|
|
94
|
+
account: context.account.address,
|
|
95
|
+
usePrecompile: false,
|
|
96
|
+
format: 'current',
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
: normalizedCodec,
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
export function getAccountSignatureRoute(runtime, context, erc7739 = { kind: 'none' }, payloadKind = 'message') {
|
|
104
|
+
const deployment = runtime.adapter.getDeploymentPlan(runtime.construction);
|
|
105
|
+
let erc6492 = { kind: 'none' };
|
|
106
|
+
if (!deployment.deployed) {
|
|
107
|
+
if (!deployment.factory || !deployment.factoryData) {
|
|
108
|
+
throw new Error('Account factory arguments are unavailable');
|
|
109
|
+
}
|
|
110
|
+
erc6492 = {
|
|
111
|
+
kind: 'wrap-deployless',
|
|
112
|
+
factory: deployment.factory,
|
|
113
|
+
factoryData: deployment.factoryData,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
validatorCodec: getSigningValidatorCodec(context, payloadKind),
|
|
118
|
+
...(context.validator.kind === 'multi-factor'
|
|
119
|
+
? { validatorFactors: getSigningValidatorFactors(context, payloadKind) }
|
|
120
|
+
: {}),
|
|
121
|
+
erc7739,
|
|
122
|
+
accountEnvelope: getAccountSignatureEnvelope(context),
|
|
123
|
+
erc6492,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export function getAccountSignatureEnvelope(context) {
|
|
127
|
+
const envelope = context.accountCapabilities.signatureEnvelope;
|
|
128
|
+
if (envelope.kind === 'none' || envelope.kind === 'hca')
|
|
129
|
+
return envelope;
|
|
130
|
+
const validator = context.validatorCapabilities.compatibilityKey.moduleAddress;
|
|
131
|
+
return envelope.kind === 'kernel'
|
|
132
|
+
? {
|
|
133
|
+
...envelope,
|
|
134
|
+
validator,
|
|
135
|
+
isRoot: isAddressEqual(validator, envelope.validator),
|
|
136
|
+
}
|
|
137
|
+
: { ...envelope, validator };
|
|
138
|
+
}
|
|
139
|
+
function eoaValidator(runtime) {
|
|
140
|
+
const account = runtime.construction.eoa;
|
|
141
|
+
if (!account)
|
|
142
|
+
throw new Error('EOA account signer is missing');
|
|
143
|
+
return {
|
|
144
|
+
kind: 'ecdsa',
|
|
145
|
+
id: 'eoa',
|
|
146
|
+
publicId: 0,
|
|
147
|
+
module: { source: 'explicit', address: zeroAddress },
|
|
148
|
+
owners: [
|
|
149
|
+
{
|
|
150
|
+
kind: 'ecdsa',
|
|
151
|
+
id: 'eoa/owner/0',
|
|
152
|
+
signerId: ecdsaSignerId(account),
|
|
153
|
+
account,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
threshold: 1,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function validatorOwners(validator) {
|
|
160
|
+
return validator.kind === 'multi-factor'
|
|
161
|
+
? validator.validators.flatMap(({ owners }) => owners)
|
|
162
|
+
: validator.owners;
|
|
163
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ValidatorContributionCodec } from '../modules/validators/types.js';
|
|
2
|
+
import type { ArtifactAssemblyPlan, MaterializedSigningStage, PlannedValidatorContributionCodec, RawSignerResult } from './types.js';
|
|
3
|
+
export declare function encodePlannedValidatorContribution(input: {
|
|
4
|
+
readonly artifact: ArtifactAssemblyPlan;
|
|
5
|
+
readonly stage: MaterializedSigningStage;
|
|
6
|
+
readonly results: Readonly<Record<string, RawSignerResult>>;
|
|
7
|
+
}): `0x${string}`;
|
|
8
|
+
export declare function resolvePlannedValidatorCodec(codec: PlannedValidatorContributionCodec | {
|
|
9
|
+
readonly kind: 'none';
|
|
10
|
+
}, stage: MaterializedSigningStage): ValidatorContributionCodec | {
|
|
11
|
+
readonly kind: 'none';
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../../signing/contribution.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,0BAA0B,EAE3B,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,iCAAiC,EACjC,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,wBAAgB,kCAAkC,CAAC,KAAK,EAAE;IACxD,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAA;IACvC,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAA;IACxC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAA;CAC5D,GAAG,KAAK,MAAM,EAAE,CA4ChB;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,iCAAiC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACpE,KAAK,EAAE,wBAAwB,GAC9B,0BAA0B,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAOxD"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { encodeValidatorContribution } from '../modules/validators/contribution.js';
|
|
2
|
+
import { encodeEcdsaRecoveryValue } from '../modules/validators/ownable.js';
|
|
3
|
+
export function encodePlannedValidatorContribution(input) {
|
|
4
|
+
const codec = resolvePlannedValidatorCodec(input.artifact.validatorCodec, input.stage);
|
|
5
|
+
if (codec.kind === 'none') {
|
|
6
|
+
throw new Error(`Artifact ${input.artifact.id} has no validator codec`);
|
|
7
|
+
}
|
|
8
|
+
if (input.artifact.input.kind !== 'task-results') {
|
|
9
|
+
throw new Error(`Artifact ${input.artifact.id} does not use task results`);
|
|
10
|
+
}
|
|
11
|
+
const planned = input.artifact.input.taskIds.map((taskId) => {
|
|
12
|
+
const task = input.stage.tasks.find(({ id }) => id === taskId);
|
|
13
|
+
const result = input.results[taskId];
|
|
14
|
+
if (!task || !result || !task.contribution) {
|
|
15
|
+
throw new Error(`Signing contribution ${taskId} is incomplete`);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
metadata: task.contribution,
|
|
19
|
+
contribution: contributionFromResult(task.contribution, result),
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
if (!input.artifact.validatorFactors) {
|
|
23
|
+
return encodeValidatorContribution(codec, planned.map(({ contribution }) => contribution));
|
|
24
|
+
}
|
|
25
|
+
const factors = input.artifact.validatorFactors.map((factor) => ({
|
|
26
|
+
kind: 'factor',
|
|
27
|
+
factorId: factor.id,
|
|
28
|
+
publicId: factor.publicId,
|
|
29
|
+
validator: factor.validator,
|
|
30
|
+
contribution: encodeValidatorContribution(factor.codec, planned.flatMap(({ metadata, contribution }) => 'factorId' in metadata && metadata.factorId === factor.id
|
|
31
|
+
? [contribution]
|
|
32
|
+
: [])),
|
|
33
|
+
}));
|
|
34
|
+
return encodeValidatorContribution(codec, factors);
|
|
35
|
+
}
|
|
36
|
+
export function resolvePlannedValidatorCodec(codec, stage) {
|
|
37
|
+
if (codec.kind !== 'smart-session-state')
|
|
38
|
+
return codec;
|
|
39
|
+
const fact = stage.facts.find(({ id }) => id === codec.factId);
|
|
40
|
+
if (fact?.kind !== 'session-enabled') {
|
|
41
|
+
throw new Error(`Session-state fact ${codec.factId} is missing`);
|
|
42
|
+
}
|
|
43
|
+
return fact.enabled ? codec.whenEnabled : codec.whenDisabled;
|
|
44
|
+
}
|
|
45
|
+
function contributionFromResult(metadata, result) {
|
|
46
|
+
switch (metadata.kind) {
|
|
47
|
+
case 'ecdsa':
|
|
48
|
+
if (result.kind !== 'ecdsa-signature') {
|
|
49
|
+
throw new Error('ECDSA task returned an incompatible result');
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
kind: 'ecdsa',
|
|
53
|
+
ownerId: metadata.ownerId,
|
|
54
|
+
signature: result.signature,
|
|
55
|
+
encoding: metadata.encoding,
|
|
56
|
+
};
|
|
57
|
+
case 'webauthn':
|
|
58
|
+
if (result.kind !== 'webauthn-assertion') {
|
|
59
|
+
throw new Error('WebAuthn task returned an incompatible result');
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
kind: 'webauthn',
|
|
63
|
+
ownerId: metadata.ownerId,
|
|
64
|
+
publicKey: metadata.publicKey,
|
|
65
|
+
signature: result.signature,
|
|
66
|
+
authenticatorData: result.authenticatorData,
|
|
67
|
+
clientDataJSON: result.clientDataJSON,
|
|
68
|
+
challengeIndex: result.challengeIndex,
|
|
69
|
+
typeIndex: result.typeIndex,
|
|
70
|
+
userVerificationRequired: result.userVerificationRequired,
|
|
71
|
+
};
|
|
72
|
+
case 'session':
|
|
73
|
+
if (result.kind !== 'ecdsa-signature') {
|
|
74
|
+
throw new Error('Session task returned an incompatible result');
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
kind: 'session',
|
|
78
|
+
signature: encodeEcdsaRecoveryValue(result.signature, metadata.recoveryEncoding),
|
|
79
|
+
};
|
|
80
|
+
case 'authorization':
|
|
81
|
+
throw new Error('Authorization results are not validator contributions');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Address, type Hex, type SignedAuthorization, type TypedDataDefinition } from 'viem';
|
|
2
|
+
import type { ChainReference } from '../chains/types.js';
|
|
3
|
+
import type { PayloadSigningTask, SignerInvocationPort, SignerReference, SigningCheckpointPort, SigningPayloadRegistry, SigningPlan, SigningTranscript } from './types.js';
|
|
4
|
+
export interface NexusEip7702InitPlanInput {
|
|
5
|
+
readonly typedData: TypedDataDefinition;
|
|
6
|
+
readonly signer: SignerReference;
|
|
7
|
+
}
|
|
8
|
+
export declare function createNexusEip7702InitTypedData(input: {
|
|
9
|
+
readonly contract: Address;
|
|
10
|
+
readonly initData: Hex;
|
|
11
|
+
}): TypedDataDefinition;
|
|
12
|
+
export declare function createNexusEip7702InitPlan(input: NexusEip7702InitPlanInput): SigningPlan;
|
|
13
|
+
export declare function signNexusEip7702Init(input: {
|
|
14
|
+
readonly planInput: NexusEip7702InitPlanInput;
|
|
15
|
+
readonly signerInvoker: SignerInvocationPort;
|
|
16
|
+
readonly checkpoints: SigningCheckpointPort;
|
|
17
|
+
}): Promise<{
|
|
18
|
+
readonly signature: Hex;
|
|
19
|
+
readonly transcript: SigningTranscript;
|
|
20
|
+
}>;
|
|
21
|
+
export interface AuthorizationListPlanInput {
|
|
22
|
+
readonly account: Address;
|
|
23
|
+
readonly contract: Address;
|
|
24
|
+
readonly chains: readonly ChainReference[];
|
|
25
|
+
readonly signer: SignerReference;
|
|
26
|
+
readonly nonceByChain: Readonly<Record<number, number>>;
|
|
27
|
+
}
|
|
28
|
+
export declare function createAuthorizationListPlan(input: AuthorizationListPlanInput): {
|
|
29
|
+
readonly plan: SigningPlan;
|
|
30
|
+
readonly payloads: SigningPayloadRegistry;
|
|
31
|
+
};
|
|
32
|
+
export declare function signAuthorizationList(input: {
|
|
33
|
+
readonly planInput: AuthorizationListPlanInput;
|
|
34
|
+
readonly signerInvoker: SignerInvocationPort;
|
|
35
|
+
readonly checkpoints: SigningCheckpointPort;
|
|
36
|
+
}): Promise<{
|
|
37
|
+
readonly authorizations: readonly SignedAuthorization[];
|
|
38
|
+
readonly transcript: SigningTranscript;
|
|
39
|
+
}>;
|
|
40
|
+
export type { PayloadSigningTask };
|
|
41
|
+
//# sourceMappingURL=eip7702.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip7702.d.ts","sourceRoot":"","sources":["../../../signing/eip7702.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,GAAG,EAGR,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAA;AAExE,OAAO,KAAK,EAGV,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;IACvC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;CACjC;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACrD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAA;CACvB,GAAG,mBAAmB,CAiBtB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,yBAAyB,GAC/B,WAAW,CAeb;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAA;IAC7C,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAA;IAC5C,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAA;CAC5C,GAAG,OAAO,CAAC;IACV,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAA;IACvB,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAA;CACvC,CAAC,CAkBD;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAA;IAC1C,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;IAChC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACxD;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,0BAA0B,GAChC;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAA;CAAE,CAkF3E;AAED,wBAAsB,qBAAqB,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,SAAS,EAAE,0BAA0B,CAAA;IAC9C,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAA;IAC5C,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAA;CAC5C,GAAG,OAAO,CAAC;IACV,QAAQ,CAAC,cAAc,EAAE,SAAS,mBAAmB,EAAE,CAAA;IACvD,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAA;CACvC,CAAC,CAeD;AAiGD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { encodeAbiParameters, hashTypedData, keccak256, } from 'viem';
|
|
2
|
+
import { executeSigningPlan } from './execute.js';
|
|
3
|
+
export function createNexusEip7702InitTypedData(input) {
|
|
4
|
+
return {
|
|
5
|
+
domain: { name: 'Nexus', version: '1.2.0' },
|
|
6
|
+
types: {
|
|
7
|
+
Initialize: [
|
|
8
|
+
{ name: 'nexus', type: 'address' },
|
|
9
|
+
{ name: 'chainIds', type: 'uint256[]' },
|
|
10
|
+
{ name: 'initData', type: 'bytes' },
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
primaryType: 'Initialize',
|
|
14
|
+
message: {
|
|
15
|
+
nexus: input.contract,
|
|
16
|
+
chainIds: [0n],
|
|
17
|
+
initData: input.initData,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function createNexusEip7702InitPlan(input) {
|
|
22
|
+
const payloadId = hashTypedData(input.typedData);
|
|
23
|
+
return directSigningPlan({
|
|
24
|
+
kind: 'nexus-eip7702-init',
|
|
25
|
+
payload: { kind: 'typed-data', id: payloadId },
|
|
26
|
+
stageId: 'nexus-eip7702-init',
|
|
27
|
+
task: {
|
|
28
|
+
id: 'nexus-eip7702-init-signer',
|
|
29
|
+
signer: input.signer,
|
|
30
|
+
role: 'owner',
|
|
31
|
+
invocationKind: 'ecdsa-sign-typed-data',
|
|
32
|
+
payload: { source: 'plan-payload', payloadId },
|
|
33
|
+
},
|
|
34
|
+
artifactId: 'nexus-eip7702-init-signature',
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export async function signNexusEip7702Init(input) {
|
|
38
|
+
const plan = createNexusEip7702InitPlan(input.planInput);
|
|
39
|
+
const transcript = await executeDirectPlan({
|
|
40
|
+
plan,
|
|
41
|
+
payloads: {
|
|
42
|
+
[plan.payload.id]: {
|
|
43
|
+
kind: 'typed-data',
|
|
44
|
+
typedData: input.planInput.typedData,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
signerInvoker: input.signerInvoker,
|
|
48
|
+
checkpoints: input.checkpoints,
|
|
49
|
+
artifactId: 'nexus-eip7702-init-signature',
|
|
50
|
+
});
|
|
51
|
+
const signature = transcript.stages[0].outputs['nexus-eip7702-init-signature'];
|
|
52
|
+
return { signature, transcript };
|
|
53
|
+
}
|
|
54
|
+
export function createAuthorizationListPlan(input) {
|
|
55
|
+
const chains = dedupeEvmChains(input.chains);
|
|
56
|
+
const payloadId = keccak256(encodeAbiParameters([{ type: 'address' }, { type: 'uint256[]' }], [input.contract, chains.map(({ id }) => BigInt(id))]));
|
|
57
|
+
const payloads = {};
|
|
58
|
+
const stages = chains.map((chain) => {
|
|
59
|
+
const nonce = input.nonceByChain[chain.id];
|
|
60
|
+
if (nonce === undefined) {
|
|
61
|
+
throw new Error(`Authorization nonce for chain ${chain.id} is missing`);
|
|
62
|
+
}
|
|
63
|
+
const chainPayloadId = keccak256(encodeAbiParameters([{ type: 'bytes32' }, { type: 'uint256' }], [payloadId, BigInt(chain.id)]));
|
|
64
|
+
payloads[chainPayloadId] = {
|
|
65
|
+
kind: 'authorization',
|
|
66
|
+
authorization: {
|
|
67
|
+
contractAddress: input.contract,
|
|
68
|
+
chainId: chain.id,
|
|
69
|
+
nonce,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
const taskId = `authorization-${chain.id}`;
|
|
73
|
+
const factId = `delegation-${chain.id}`;
|
|
74
|
+
return {
|
|
75
|
+
id: `authorization-chain-${chain.id}`,
|
|
76
|
+
checkpoint: {
|
|
77
|
+
kind: 'delegation-code',
|
|
78
|
+
id: factId,
|
|
79
|
+
chain,
|
|
80
|
+
account: input.account,
|
|
81
|
+
},
|
|
82
|
+
priorOutputs: [],
|
|
83
|
+
taskTemplates: [
|
|
84
|
+
{
|
|
85
|
+
id: taskId,
|
|
86
|
+
signer: input.signer,
|
|
87
|
+
role: 'authorization',
|
|
88
|
+
chain,
|
|
89
|
+
invocationKind: 'sign-authorization',
|
|
90
|
+
payload: {
|
|
91
|
+
source: 'plan-payload',
|
|
92
|
+
payloadId: chainPayloadId,
|
|
93
|
+
},
|
|
94
|
+
when: {
|
|
95
|
+
kind: 'delegation-required',
|
|
96
|
+
factId,
|
|
97
|
+
contract: input.contract,
|
|
98
|
+
},
|
|
99
|
+
contribution: { kind: 'authorization' },
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
schedule: [
|
|
103
|
+
{
|
|
104
|
+
id: `authorization-prompt-${chain.id}`,
|
|
105
|
+
execution: 'serial',
|
|
106
|
+
taskIds: [taskId],
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
artifacts: [],
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
const plan = {
|
|
113
|
+
version: 1,
|
|
114
|
+
kind: 'eip7702-authorization-list',
|
|
115
|
+
payload: { kind: 'authorization', id: payloadId },
|
|
116
|
+
configuredTopology: emptyTopology,
|
|
117
|
+
effectiveSelection: emptySelection,
|
|
118
|
+
stages,
|
|
119
|
+
publicOutputs: stages.map((stage) => ({
|
|
120
|
+
id: `${stage.id}-result`,
|
|
121
|
+
source: { kind: 'task-result', taskId: stage.taskTemplates[0].id },
|
|
122
|
+
exposedForIndependentSigning: false,
|
|
123
|
+
})),
|
|
124
|
+
};
|
|
125
|
+
return { plan, payloads };
|
|
126
|
+
}
|
|
127
|
+
export async function signAuthorizationList(input) {
|
|
128
|
+
const { plan, payloads } = createAuthorizationListPlan(input.planInput);
|
|
129
|
+
const transcript = await executeSigningPlan({
|
|
130
|
+
plan,
|
|
131
|
+
payloads,
|
|
132
|
+
signerInvoker: input.signerInvoker,
|
|
133
|
+
checkpoints: input.checkpoints,
|
|
134
|
+
assembleStage: () => ({}),
|
|
135
|
+
});
|
|
136
|
+
const authorizations = transcript.stages.flatMap(({ results }) => Object.values(results).flatMap((result) => result.kind === 'signed-authorization' ? [result.authorization] : []));
|
|
137
|
+
return { authorizations, transcript };
|
|
138
|
+
}
|
|
139
|
+
function directSigningPlan(input) {
|
|
140
|
+
return {
|
|
141
|
+
version: 1,
|
|
142
|
+
kind: input.kind,
|
|
143
|
+
payload: input.payload,
|
|
144
|
+
configuredTopology: emptyTopology,
|
|
145
|
+
effectiveSelection: emptySelection,
|
|
146
|
+
stages: [
|
|
147
|
+
{
|
|
148
|
+
id: input.stageId,
|
|
149
|
+
checkpoint: { kind: 'none', id: `${input.stageId}-no-read` },
|
|
150
|
+
priorOutputs: [],
|
|
151
|
+
taskTemplates: [input.task],
|
|
152
|
+
schedule: [
|
|
153
|
+
{
|
|
154
|
+
id: `${input.stageId}-signer`,
|
|
155
|
+
execution: 'serial',
|
|
156
|
+
taskIds: [input.task.id],
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
artifacts: [
|
|
160
|
+
{
|
|
161
|
+
id: input.artifactId,
|
|
162
|
+
stageId: input.stageId,
|
|
163
|
+
usage: 'erc1271',
|
|
164
|
+
input: { kind: 'task-results', taskIds: [input.task.id] },
|
|
165
|
+
validatorCodec: { kind: 'none' },
|
|
166
|
+
erc7739: { kind: 'none' },
|
|
167
|
+
accountEnvelope: { kind: 'none' },
|
|
168
|
+
erc6492: { kind: 'none' },
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
publicOutputs: [
|
|
174
|
+
{
|
|
175
|
+
id: input.artifactId,
|
|
176
|
+
source: { kind: 'artifact', artifactId: input.artifactId },
|
|
177
|
+
exposedForIndependentSigning: false,
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
async function executeDirectPlan(input) {
|
|
183
|
+
return executeSigningPlan({
|
|
184
|
+
plan: input.plan,
|
|
185
|
+
payloads: input.payloads,
|
|
186
|
+
signerInvoker: input.signerInvoker,
|
|
187
|
+
checkpoints: input.checkpoints,
|
|
188
|
+
assembleStage: ({ results }) => {
|
|
189
|
+
const result = Object.values(results)[0];
|
|
190
|
+
if (result?.kind !== 'ecdsa-signature') {
|
|
191
|
+
throw new Error('Direct signing task did not return an ECDSA signature');
|
|
192
|
+
}
|
|
193
|
+
return { [input.artifactId]: result.signature };
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function dedupeEvmChains(chains) {
|
|
198
|
+
const seen = new Set();
|
|
199
|
+
return chains.flatMap((chain) => {
|
|
200
|
+
if (chain.kind !== 'evm' || seen.has(chain.id))
|
|
201
|
+
return [];
|
|
202
|
+
seen.add(chain.id);
|
|
203
|
+
return [chain];
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
const emptyTopology = {
|
|
207
|
+
rootValidatorId: 'none',
|
|
208
|
+
validators: [],
|
|
209
|
+
threshold: 0,
|
|
210
|
+
};
|
|
211
|
+
const emptySelection = {
|
|
212
|
+
validatorIds: [],
|
|
213
|
+
signerIds: [],
|
|
214
|
+
threshold: 0,
|
|
215
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { EvmChainReference } from '../chains/types.js';
|
|
2
|
+
import type { SignatureUsage, SigningPayloadKind, SigningPlan, SigningPlanKind, SigningTaskRole } from './types.js';
|
|
3
|
+
export type SigningFailureStage = 'plan' | 'read' | 'invoke' | 'validator-encode' | 'account-envelope' | 'protocol-operation' | 'final-assembly';
|
|
4
|
+
export interface SigningErrorContext {
|
|
5
|
+
readonly planKind: SigningPlanKind;
|
|
6
|
+
readonly payloadKind: SigningPayloadKind;
|
|
7
|
+
readonly failureStage: SigningFailureStage;
|
|
8
|
+
readonly stageId?: string;
|
|
9
|
+
readonly taskId?: string;
|
|
10
|
+
readonly artifactId?: string;
|
|
11
|
+
readonly usage?: SignatureUsage;
|
|
12
|
+
readonly signerRole?: SigningTaskRole;
|
|
13
|
+
readonly chain?: EvmChainReference;
|
|
14
|
+
}
|
|
15
|
+
export declare class SigningPipelineError extends Error {
|
|
16
|
+
readonly context: SigningErrorContext;
|
|
17
|
+
constructor(message: string, context: SigningErrorContext, options?: ErrorOptions);
|
|
18
|
+
}
|
|
19
|
+
export declare function runSigningStep<Result>(input: {
|
|
20
|
+
readonly plan: SigningPlan;
|
|
21
|
+
readonly failureStage: SigningFailureStage;
|
|
22
|
+
readonly stageId: string;
|
|
23
|
+
readonly artifactId: string;
|
|
24
|
+
readonly usage: SignatureUsage;
|
|
25
|
+
readonly operation: () => Result;
|
|
26
|
+
}): Result;
|
|
27
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../signing/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,MAAM,GACN,QAAQ,GACR,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,CAAA;AAEpB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAA;IAClC,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAA;IACxC,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAA;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,cAAc,CAAA;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAA;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAA;CACnC;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAA;gBAGnC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,YAAY;CAMzB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE;IAC5C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAA;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,MAAM,CAAA;CACjC,GAAG,MAAM,CAkBT"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class SigningPipelineError extends Error {
|
|
2
|
+
context;
|
|
3
|
+
constructor(message, context, options) {
|
|
4
|
+
super(message, options);
|
|
5
|
+
this.name = 'SigningPipelineError';
|
|
6
|
+
this.context = context;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function runSigningStep(input) {
|
|
10
|
+
try {
|
|
11
|
+
return input.operation();
|
|
12
|
+
}
|
|
13
|
+
catch (cause) {
|
|
14
|
+
if (cause instanceof SigningPipelineError)
|
|
15
|
+
throw cause;
|
|
16
|
+
throw new SigningPipelineError(`Signing artifact ${input.artifactId} failed during ${input.failureStage}`, {
|
|
17
|
+
planKind: input.plan.kind,
|
|
18
|
+
payloadKind: input.plan.payload.kind,
|
|
19
|
+
failureStage: input.failureStage,
|
|
20
|
+
stageId: input.stageId,
|
|
21
|
+
artifactId: input.artifactId,
|
|
22
|
+
usage: input.usage,
|
|
23
|
+
}, { cause });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MaterializedSigningStage, RawSignerResult, SigningArtifact, SigningCheckpointPort, SigningPayloadRegistry, SigningPlan, SigningStagePlan, SigningTranscript } from './types.js';
|
|
2
|
+
export interface SigningStageAssemblyInput {
|
|
3
|
+
readonly plan: SigningPlan;
|
|
4
|
+
readonly stagePlan: SigningStagePlan;
|
|
5
|
+
readonly stage: MaterializedSigningStage;
|
|
6
|
+
readonly results: Readonly<Record<string, RawSignerResult>>;
|
|
7
|
+
readonly priorOutputs: Readonly<Record<string, SigningArtifact>>;
|
|
8
|
+
}
|
|
9
|
+
export type SigningStageAssembler = (input: SigningStageAssemblyInput) => Readonly<Record<string, SigningArtifact>>;
|
|
10
|
+
export declare function executeSigningPlan(input: {
|
|
11
|
+
readonly plan: SigningPlan;
|
|
12
|
+
readonly payloads: SigningPayloadRegistry;
|
|
13
|
+
readonly checkpoints: SigningCheckpointPort;
|
|
14
|
+
readonly signerInvoker: import('./types.js').SignerInvocationPort;
|
|
15
|
+
readonly assembleStage: SigningStageAssembler;
|
|
16
|
+
}): Promise<SigningTranscript>;
|
|
17
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../signing/execute.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAA;IACpC,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAA;IACxC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAA;IAC3D,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAA;CACjE;AAED,MAAM,MAAM,qBAAqB,GAAG,CAClC,KAAK,EAAE,yBAAyB,KAC7B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAA;AAE9C,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAA;IACzC,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAA;IAC3C,QAAQ,CAAC,aAAa,EAAE,OAAO,SAAS,EAAE,oBAAoB,CAAA;IAC9D,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAA;CAC9C,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA+J7B"}
|