@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,11 @@
|
|
|
1
|
+
import { type Address, type Hex } from 'viem';
|
|
2
|
+
export declare const ERC6492_MAGIC_BYTES: "0x6492649264926492649264926492649264926492649264926492649264926492";
|
|
3
|
+
export interface Erc6492Signature {
|
|
4
|
+
readonly factory: Address;
|
|
5
|
+
readonly factoryData: Hex;
|
|
6
|
+
readonly signature: Hex;
|
|
7
|
+
}
|
|
8
|
+
export declare function isErc6492Signature(signature: Hex): boolean;
|
|
9
|
+
export declare function wrapErc6492Signature(input: Erc6492Signature): Hex;
|
|
10
|
+
export declare function unwrapErc6492Signature(signature: Hex): Erc6492Signature;
|
|
11
|
+
//# sourceMappingURL=erc6492.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc6492.d.ts","sourceRoot":"","sources":["../../../../signing/protocols/erc6492.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAIZ,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAEb,eAAO,MAAM,mBAAmB,EAC9B,oEAA6E,CAAA;AAE/E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAA;CACxB;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAK1D;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,GAAG,GAAG,CAYjE;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,GAAG,GAAG,gBAAgB,CAUvE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { concat, decodeAbiParameters, encodeAbiParameters, size, slice, } from 'viem';
|
|
2
|
+
export const ERC6492_MAGIC_BYTES = '0x6492649264926492649264926492649264926492649264926492649264926492';
|
|
3
|
+
export function isErc6492Signature(signature) {
|
|
4
|
+
return (size(signature) >= 32 &&
|
|
5
|
+
slice(signature, size(signature) - 32).toLowerCase() === ERC6492_MAGIC_BYTES);
|
|
6
|
+
}
|
|
7
|
+
export function wrapErc6492Signature(input) {
|
|
8
|
+
return concat([
|
|
9
|
+
encodeAbiParameters([
|
|
10
|
+
{ name: 'create2Factory', type: 'address' },
|
|
11
|
+
{ name: 'factoryCalldata', type: 'bytes' },
|
|
12
|
+
{ name: 'originalERC1271Signature', type: 'bytes' },
|
|
13
|
+
], [input.factory, input.factoryData, input.signature]),
|
|
14
|
+
ERC6492_MAGIC_BYTES,
|
|
15
|
+
]);
|
|
16
|
+
}
|
|
17
|
+
export function unwrapErc6492Signature(signature) {
|
|
18
|
+
if (!isErc6492Signature(signature)) {
|
|
19
|
+
throw new Error('Signature is not ERC-6492 encoded');
|
|
20
|
+
}
|
|
21
|
+
const encoded = slice(signature, 0, size(signature) - 32);
|
|
22
|
+
const [factory, factoryData, originalSignature] = decodeAbiParameters([{ type: 'address' }, { type: 'bytes' }, { type: 'bytes' }], encoded);
|
|
23
|
+
return { factory, factoryData, signature: originalSignature };
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Address, type Hex, type TypedDataDefinition } from 'viem';
|
|
2
|
+
export interface Erc7739VerifierDomain {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly version: string;
|
|
5
|
+
readonly chainId: number;
|
|
6
|
+
readonly verifyingContract: Address;
|
|
7
|
+
readonly salt: Hex;
|
|
8
|
+
}
|
|
9
|
+
export declare function hashErc7739TypedData(input: {
|
|
10
|
+
readonly typedData: TypedDataDefinition;
|
|
11
|
+
readonly verifierDomain: Erc7739VerifierDomain;
|
|
12
|
+
}): Hex;
|
|
13
|
+
export declare function wrapErc7739TypedDataSignature(input: {
|
|
14
|
+
readonly typedData: TypedDataDefinition;
|
|
15
|
+
readonly signature: Hex;
|
|
16
|
+
}): Hex;
|
|
17
|
+
//# sourceMappingURL=erc7739.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc7739.d.ts","sourceRoot":"","sources":["../../../../signing/protocols/erc7739.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAGZ,KAAK,GAAG,EAKR,KAAK,mBAAmB,EAGzB,MAAM,MAAM,CAAA;AAGb,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAA;IACnC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAA;CACnB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;IACvC,QAAQ,CAAC,cAAc,EAAE,qBAAqB,CAAA;CAC/C,GAAG,GAAG,CAwDN;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAA;CACxB,GAAG,GAAG,CASN"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { concat, encodeAbiParameters, hashDomain, hashStruct, keccak256, toHex, } from 'viem';
|
|
2
|
+
import { wrapTypedDataSignature } from 'viem/experimental/erc7739';
|
|
3
|
+
export function hashErc7739TypedData(input) {
|
|
4
|
+
const { domain, types, primaryType, message } = input.typedData;
|
|
5
|
+
if (!domain || !primaryType) {
|
|
6
|
+
throw new Error('ERC-7739 requires a complete typed-data definition');
|
|
7
|
+
}
|
|
8
|
+
const typeFields = types;
|
|
9
|
+
const contentsType = encodeType(primaryType, typeFields);
|
|
10
|
+
const typedDataSignTypeHash = keccak256(toHex(`TypedDataSign(${primaryType} contents,string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)${contentsType}`));
|
|
11
|
+
const contentsHash = hashStruct({
|
|
12
|
+
data: message,
|
|
13
|
+
primaryType,
|
|
14
|
+
types: typeFields,
|
|
15
|
+
});
|
|
16
|
+
const verifier = input.verifierDomain;
|
|
17
|
+
const structHash = keccak256(encodeAbiParameters([
|
|
18
|
+
{ type: 'bytes32' },
|
|
19
|
+
{ type: 'bytes32' },
|
|
20
|
+
{ type: 'bytes32' },
|
|
21
|
+
{ type: 'bytes32' },
|
|
22
|
+
{ type: 'uint256' },
|
|
23
|
+
{ type: 'address' },
|
|
24
|
+
{ type: 'bytes32' },
|
|
25
|
+
], [
|
|
26
|
+
typedDataSignTypeHash,
|
|
27
|
+
contentsHash,
|
|
28
|
+
keccak256(toHex(verifier.name)),
|
|
29
|
+
keccak256(toHex(verifier.version)),
|
|
30
|
+
BigInt(verifier.chainId),
|
|
31
|
+
verifier.verifyingContract,
|
|
32
|
+
verifier.salt,
|
|
33
|
+
]));
|
|
34
|
+
const domainTypes = [];
|
|
35
|
+
if (domain.name)
|
|
36
|
+
domainTypes.push({ name: 'name', type: 'string' });
|
|
37
|
+
if (domain.version)
|
|
38
|
+
domainTypes.push({ name: 'version', type: 'string' });
|
|
39
|
+
if (domain.chainId)
|
|
40
|
+
domainTypes.push({ name: 'chainId', type: 'uint256' });
|
|
41
|
+
if (domain.verifyingContract) {
|
|
42
|
+
domainTypes.push({ name: 'verifyingContract', type: 'address' });
|
|
43
|
+
}
|
|
44
|
+
if (domain.salt)
|
|
45
|
+
domainTypes.push({ name: 'salt', type: 'bytes32' });
|
|
46
|
+
const appDomainSeparator = hashDomain({
|
|
47
|
+
domain,
|
|
48
|
+
types: { EIP712Domain: domainTypes },
|
|
49
|
+
});
|
|
50
|
+
return keccak256(concat(['0x1901', appDomainSeparator, structHash]));
|
|
51
|
+
}
|
|
52
|
+
export function wrapErc7739TypedDataSignature(input) {
|
|
53
|
+
const typedData = input.typedData;
|
|
54
|
+
return wrapTypedDataSignature({
|
|
55
|
+
domain: typedData.domain,
|
|
56
|
+
primaryType: typedData.primaryType,
|
|
57
|
+
types: typedData.types,
|
|
58
|
+
message: typedData.message,
|
|
59
|
+
signature: input.signature,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function encodeType(primaryType, types) {
|
|
63
|
+
const dependencies = new Set();
|
|
64
|
+
const collect = (type) => {
|
|
65
|
+
const typeName = type.match(/^\w*/)?.[0];
|
|
66
|
+
if (!typeName || dependencies.has(typeName) || !types[typeName])
|
|
67
|
+
return;
|
|
68
|
+
dependencies.add(typeName);
|
|
69
|
+
for (const field of types[typeName])
|
|
70
|
+
collect(field.type);
|
|
71
|
+
};
|
|
72
|
+
collect(primaryType);
|
|
73
|
+
dependencies.delete(primaryType);
|
|
74
|
+
return [primaryType, ...dependencies]
|
|
75
|
+
.sort((left, right) => {
|
|
76
|
+
if (left === primaryType)
|
|
77
|
+
return -1;
|
|
78
|
+
if (right === primaryType)
|
|
79
|
+
return 1;
|
|
80
|
+
return left.localeCompare(right);
|
|
81
|
+
})
|
|
82
|
+
.map((type) => `${type}(${types[type].map((field) => `${field.type} ${field.name}`).join(',')})`)
|
|
83
|
+
.join('');
|
|
84
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Address, type Hex, type TypedDataDefinition } from 'viem';
|
|
2
|
+
import type { AccountKind } from '../accounts/types.js';
|
|
3
|
+
import type { EvmChainReference } from '../chains/types.js';
|
|
4
|
+
import type { ValidatorContributionCodec } from '../modules/validators/types.js';
|
|
5
|
+
import type { SigningContext } from './context.js';
|
|
6
|
+
import type { ArtifactAssemblyPlan, ConfiguredValidatorTopology, EffectiveSignerSelection, PayloadSigningTask, SigningCheckpointPort, SigningPayloadMaterial, SigningPlan, SigningTranscript } from './types.js';
|
|
7
|
+
export interface SessionEnableSigningPlanInput {
|
|
8
|
+
readonly typedData: TypedDataDefinition;
|
|
9
|
+
readonly chain: EvmChainReference;
|
|
10
|
+
readonly configuredTopology: ConfiguredValidatorTopology;
|
|
11
|
+
readonly effectiveSelection: EffectiveSignerSelection;
|
|
12
|
+
readonly tasks: readonly PayloadSigningTask[];
|
|
13
|
+
readonly signingMaterial?: SigningPayloadMaterial;
|
|
14
|
+
readonly validatorCodec: ValidatorContributionCodec;
|
|
15
|
+
readonly validatorFactors?: import('./types.js').ArtifactAssemblyPlan['validatorFactors'];
|
|
16
|
+
readonly route: Pick<ArtifactAssemblyPlan, 'erc7739' | 'accountEnvelope' | 'erc6492'>;
|
|
17
|
+
}
|
|
18
|
+
export declare function createSessionEnableSigningPlan(input: SessionEnableSigningPlanInput): SigningPlan;
|
|
19
|
+
export declare function signSessionEnablement(input: {
|
|
20
|
+
readonly planInput: SessionEnableSigningPlanInput;
|
|
21
|
+
readonly context: SigningContext;
|
|
22
|
+
readonly checkpoints: SigningCheckpointPort;
|
|
23
|
+
}): Promise<{
|
|
24
|
+
readonly signature: Hex;
|
|
25
|
+
readonly transcript: SigningTranscript;
|
|
26
|
+
}>;
|
|
27
|
+
export declare function resolveSessionEnableChain(input: {
|
|
28
|
+
readonly accountKind: AccountKind;
|
|
29
|
+
readonly validator: Address;
|
|
30
|
+
readonly hashesAndChainIds: readonly {
|
|
31
|
+
readonly chainId: bigint;
|
|
32
|
+
}[];
|
|
33
|
+
readonly defaultChain: EvmChainReference;
|
|
34
|
+
}): EvmChainReference;
|
|
35
|
+
//# sourceMappingURL=session-enable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-enable.d.ts","sourceRoot":"","sources":["../../../signing/session-enable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,GAAG,EAGR,KAAK,mBAAmB,EACzB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAI/C,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;IACvC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAA;IACxD,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,CAAA;IACrD,QAAQ,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAC7C,QAAQ,CAAC,eAAe,CAAC,EAAE,sBAAsB,CAAA;IACjD,QAAQ,CAAC,cAAc,EAAE,0BAA0B,CAAA;IACnD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,SAAS,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,CAAA;IACtF,QAAQ,CAAC,KAAK,EAAE,IAAI,CAClB,oBAAoB,EACpB,SAAS,GAAG,iBAAiB,GAAG,SAAS,CAC1C,CAAA;CACF;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,6BAA6B,GACnC,WAAW,CAqBb;AAED,wBAAsB,qBAAqB,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,SAAS,EAAE,6BAA6B,CAAA;IACjD,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,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,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IACjC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,SAAS;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACnE,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAA;CACzC,GAAG,iBAAiB,CAoBpB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { hashTypedData, isAddressEqual, } from 'viem';
|
|
2
|
+
import { toEvmChainReference } from '../chains/caip2.js';
|
|
3
|
+
import { K1_DEFAULT_VALIDATOR_ADDRESS } from '../modules/validators/k1.js';
|
|
4
|
+
import { executeSigningPlan } from './execute.js';
|
|
5
|
+
import { createSingleStageSigningPlan } from './plan.js';
|
|
6
|
+
import { assembleTypedDataStage } from './typed-data.js';
|
|
7
|
+
export function createSessionEnableSigningPlan(input) {
|
|
8
|
+
return createSingleStageSigningPlan({
|
|
9
|
+
kind: 'session-enable',
|
|
10
|
+
payload: { kind: 'session-enable', id: hashTypedData(input.typedData) },
|
|
11
|
+
configuredTopology: input.configuredTopology,
|
|
12
|
+
effectiveSelection: input.effectiveSelection,
|
|
13
|
+
stageId: 'session-enable',
|
|
14
|
+
chain: input.chain,
|
|
15
|
+
tasks: input.tasks,
|
|
16
|
+
artifacts: [
|
|
17
|
+
{
|
|
18
|
+
id: 'session-enable-signature',
|
|
19
|
+
usage: 'session-enable',
|
|
20
|
+
validatorCodec: input.validatorCodec,
|
|
21
|
+
...(input.validatorFactors
|
|
22
|
+
? { validatorFactors: input.validatorFactors }
|
|
23
|
+
: {}),
|
|
24
|
+
...input.route,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export async function signSessionEnablement(input) {
|
|
30
|
+
const plan = createSessionEnableSigningPlan(input.planInput);
|
|
31
|
+
const transcript = await executeSigningPlan({
|
|
32
|
+
plan,
|
|
33
|
+
payloads: {
|
|
34
|
+
[plan.payload.id]: input.planInput.signingMaterial ?? {
|
|
35
|
+
kind: 'typed-data',
|
|
36
|
+
typedData: input.planInput.typedData,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
signerInvoker: input.context.signerInvoker,
|
|
40
|
+
checkpoints: input.checkpoints,
|
|
41
|
+
assembleStage: (stage) => assembleTypedDataStage(stage, input.context),
|
|
42
|
+
});
|
|
43
|
+
const signature = transcript.stages[0].outputs['session-enable-signature'];
|
|
44
|
+
return { signature, transcript };
|
|
45
|
+
}
|
|
46
|
+
export function resolveSessionEnableChain(input) {
|
|
47
|
+
const startaleK1 = input.accountKind === 'startale' &&
|
|
48
|
+
isAddressEqual(input.validator, K1_DEFAULT_VALIDATOR_ADDRESS);
|
|
49
|
+
if (!startaleK1)
|
|
50
|
+
return input.defaultChain;
|
|
51
|
+
const chainIds = [
|
|
52
|
+
...new Set(input.hashesAndChainIds.map(({ chainId }) => chainId.toString())),
|
|
53
|
+
];
|
|
54
|
+
if (chainIds.length > 1) {
|
|
55
|
+
throw new Error('Startale accounts with K1 validator do not support multi-chain session enable');
|
|
56
|
+
}
|
|
57
|
+
const chainId = chainIds[0];
|
|
58
|
+
if (chainId === undefined) {
|
|
59
|
+
throw new Error('Startale K1 session enable requires one session chain');
|
|
60
|
+
}
|
|
61
|
+
return toEvmChainReference(Number(chainId));
|
|
62
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Account, WalletClient } from 'viem';
|
|
2
|
+
export declare function walletClientToAccount(walletClient: WalletClient): Account;
|
|
3
|
+
export declare function wrapParaAccount(viemAccount: Account, walletId?: string): Account;
|
|
4
|
+
//# sourceMappingURL=compatibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../../../../signing/signers/compatibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAOP,YAAY,EACb,MAAM,MAAM,CAAA;AAGb,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CA0BzE;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,OAAO,EACpB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CA+BT"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { WalletClientNoConnectedAccountError } from '../../accounts/error.js';
|
|
2
|
+
export function walletClientToAccount(walletClient) {
|
|
3
|
+
const address = walletClient.account?.address;
|
|
4
|
+
if (!address)
|
|
5
|
+
throw new WalletClientNoConnectedAccountError();
|
|
6
|
+
return {
|
|
7
|
+
address,
|
|
8
|
+
signMessage: ({ message }) => walletClient.signMessage({ account: address, message }),
|
|
9
|
+
signTypedData: (parameters) => walletClient.signTypedData({
|
|
10
|
+
account: address,
|
|
11
|
+
...parameters,
|
|
12
|
+
}),
|
|
13
|
+
signTransaction: (transaction) => walletClient.signTransaction({
|
|
14
|
+
account: address,
|
|
15
|
+
...transaction,
|
|
16
|
+
}),
|
|
17
|
+
client: walletClient,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function wrapParaAccount(viemAccount, walletId) {
|
|
21
|
+
const para = viemAccount;
|
|
22
|
+
const effectiveWalletId = walletId || para.walletId || para._walletId;
|
|
23
|
+
if (effectiveWalletId)
|
|
24
|
+
para._paraWalletId = effectiveWalletId;
|
|
25
|
+
return {
|
|
26
|
+
...viemAccount,
|
|
27
|
+
signMessage: async ({ message }) => {
|
|
28
|
+
if (!viemAccount.signMessage)
|
|
29
|
+
throw new Error('Account does not support signMessage');
|
|
30
|
+
return normalizeParaRecovery(await viemAccount.signMessage({ message }));
|
|
31
|
+
},
|
|
32
|
+
signTypedData: async (typedData) => {
|
|
33
|
+
if (!viemAccount.signTypedData) {
|
|
34
|
+
throw new Error('Account does not support signTypedData');
|
|
35
|
+
}
|
|
36
|
+
return normalizeParaRecovery(await viemAccount.signTypedData(typedData));
|
|
37
|
+
},
|
|
38
|
+
signAuthorization: viemAccount.signAuthorization
|
|
39
|
+
? viemAccount.signAuthorization.bind(viemAccount)
|
|
40
|
+
: undefined,
|
|
41
|
+
client: viemAccount.client,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function normalizeParaRecovery(signature) {
|
|
45
|
+
const value = signature.slice(2);
|
|
46
|
+
const r = value.slice(0, 64);
|
|
47
|
+
const s = value.slice(64, 128);
|
|
48
|
+
const recovery = Number.parseInt(value.slice(128, 130), 16);
|
|
49
|
+
const normalized = recovery < 27 ? recovery + 27 : recovery;
|
|
50
|
+
return `0x${r}${s}${normalized.toString(16).padStart(2, '0')}`;
|
|
51
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import type { RawSignerResult, SignerInvocation } from '../types.js';
|
|
3
|
+
import type { ChainResolver, ExternalSigner } from './types.js';
|
|
4
|
+
export declare function invokeEcdsaSigner(input: {
|
|
5
|
+
readonly signer: Extract<ExternalSigner, {
|
|
6
|
+
readonly kind: 'ecdsa' | 'wallet-authorization';
|
|
7
|
+
}>;
|
|
8
|
+
readonly invocation: Extract<SignerInvocation, {
|
|
9
|
+
readonly kind: 'ecdsa-sign-message' | 'ecdsa-sign-typed-data' | 'sign-authorization';
|
|
10
|
+
}>;
|
|
11
|
+
readonly resolveChain?: ChainResolver;
|
|
12
|
+
}): Promise<RawSignerResult>;
|
|
13
|
+
export declare function normalizeRecovery(signature: Hex): Hex;
|
|
14
|
+
//# sourceMappingURL=ecdsa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecdsa.d.ts","sourceRoot":"","sources":["../../../../signing/signers/ecdsa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,GAAG,EAAqB,MAAM,MAAM,CAAA;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG5D,wBAAsB,iBAAiB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,MAAM,EAAE,OAAO,CACtB,cAAc,EACd;QAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,sBAAsB,CAAA;KAAE,CACpD,CAAA;IACD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAC1B,gBAAgB,EAChB;QACE,QAAQ,CAAC,IAAI,EACT,oBAAoB,GACpB,uBAAuB,GACvB,oBAAoB,CAAA;KACzB,CACF,CAAA;IACD,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAA;CACtC,GAAG,OAAO,CAAC,eAAe,CAAC,CAyC3B;AAQD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,GAAG,GAAG,GAAG,CAMrD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { concat, hexToBytes, toHex } from 'viem';
|
|
2
|
+
import { selectSignerChain } from './wallet-chain.js';
|
|
3
|
+
export async function invokeEcdsaSigner(input) {
|
|
4
|
+
const account = input.signer.account;
|
|
5
|
+
const chain = invocationChain(input.invocation);
|
|
6
|
+
await selectSignerChain({
|
|
7
|
+
account,
|
|
8
|
+
...(chain ? { chain } : {}),
|
|
9
|
+
...(input.resolveChain ? { resolveChain: input.resolveChain } : {}),
|
|
10
|
+
});
|
|
11
|
+
switch (input.invocation.kind) {
|
|
12
|
+
case 'ecdsa-sign-message': {
|
|
13
|
+
if (!account.signMessage)
|
|
14
|
+
throw new Error('Account does not support signMessage');
|
|
15
|
+
const signature = await account.signMessage({
|
|
16
|
+
message: input.invocation.message,
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
kind: 'ecdsa-signature',
|
|
20
|
+
signature: normalizeRecovery(signature),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
case 'ecdsa-sign-typed-data': {
|
|
24
|
+
if (!account.signTypedData)
|
|
25
|
+
throw new Error('Account does not support signTypedData');
|
|
26
|
+
const signature = await account.signTypedData(input.invocation.typedData);
|
|
27
|
+
return {
|
|
28
|
+
kind: 'ecdsa-signature',
|
|
29
|
+
signature: normalizeRecovery(signature),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
case 'sign-authorization': {
|
|
33
|
+
if (!account.signAuthorization) {
|
|
34
|
+
throw new Error('Account does not support signAuthorization');
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
kind: 'signed-authorization',
|
|
38
|
+
authorization: await account.signAuthorization(input.invocation.authorization),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function invocationChain(invocation) {
|
|
44
|
+
return 'chain' in invocation ? invocation.chain : undefined;
|
|
45
|
+
}
|
|
46
|
+
export function normalizeRecovery(signature) {
|
|
47
|
+
const bytes = hexToBytes(signature);
|
|
48
|
+
if (bytes.length !== 65)
|
|
49
|
+
return signature;
|
|
50
|
+
const recovery = bytes[64];
|
|
51
|
+
if (recovery >= 27)
|
|
52
|
+
return signature;
|
|
53
|
+
return concat([signature.slice(0, -2), toHex(recovery + 27)]);
|
|
54
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SignerInvocationPort } from '../types.js';
|
|
2
|
+
import type { ChainResolver, ExternalSignerRegistry } from './types.js';
|
|
3
|
+
export declare function createSignerInvocationPort(input: {
|
|
4
|
+
readonly signers: ExternalSignerRegistry;
|
|
5
|
+
readonly resolveChain?: ChainResolver;
|
|
6
|
+
}): SignerInvocationPort;
|
|
7
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../signing/signers/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGpE,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAA;IACxC,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAA;CACtC,GAAG,oBAAoB,CAiCvB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { invokeEcdsaSigner } from './ecdsa.js';
|
|
2
|
+
import { invokeWebauthnSigner } from './webauthn.js';
|
|
3
|
+
export function createSignerInvocationPort(input) {
|
|
4
|
+
return {
|
|
5
|
+
has: (reference) => {
|
|
6
|
+
const signer = input.signers[reference.id];
|
|
7
|
+
return signer !== undefined && signer.kind === reference.kind;
|
|
8
|
+
},
|
|
9
|
+
invoke: async (reference, invocation) => {
|
|
10
|
+
const signer = input.signers[reference.id];
|
|
11
|
+
if (!signer)
|
|
12
|
+
throw new Error(`Signer ${reference.id} is not registered`);
|
|
13
|
+
if (signer.kind !== reference.kind) {
|
|
14
|
+
throw new Error(`Signer ${reference.id} has kind ${signer.kind}, expected ${reference.kind}`);
|
|
15
|
+
}
|
|
16
|
+
if (invocation.kind === 'webauthn-sign-hash' ||
|
|
17
|
+
invocation.kind === 'webauthn-sign-typed-data') {
|
|
18
|
+
if (signer.kind !== 'webauthn') {
|
|
19
|
+
throw new Error(`Signer ${reference.id} cannot invoke WebAuthn`);
|
|
20
|
+
}
|
|
21
|
+
return invokeWebauthnSigner({ signer, invocation });
|
|
22
|
+
}
|
|
23
|
+
if (signer.kind === 'webauthn') {
|
|
24
|
+
throw new Error(`Signer ${reference.id} cannot invoke ECDSA`);
|
|
25
|
+
}
|
|
26
|
+
return invokeEcdsaSigner({
|
|
27
|
+
signer,
|
|
28
|
+
invocation,
|
|
29
|
+
...(input.resolveChain ? { resolveChain: input.resolveChain } : {}),
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Account, Chain } from 'viem';
|
|
2
|
+
import type { WebAuthnAccount } from 'viem/account-abstraction';
|
|
3
|
+
import type { EvmChainReference } from '../../chains/types.js';
|
|
4
|
+
export type ExternalSigner = {
|
|
5
|
+
readonly kind: 'ecdsa';
|
|
6
|
+
readonly account: Account;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'webauthn';
|
|
9
|
+
readonly account: WebAuthnAccount;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'wallet-authorization';
|
|
12
|
+
readonly account: Account;
|
|
13
|
+
};
|
|
14
|
+
export type ExternalSignerRegistry = Readonly<Record<string, ExternalSigner>>;
|
|
15
|
+
export type ChainResolver = (chain: EvmChainReference) => Chain;
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../signing/signers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAE3D,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA;AAExE,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAA;AAE7E,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,KAAK,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Account } from 'viem';
|
|
2
|
+
import type { EvmChainReference } from '../../chains/types.js';
|
|
3
|
+
import type { ChainResolver } from './types.js';
|
|
4
|
+
export declare function selectSignerChain(input: {
|
|
5
|
+
readonly account: Account;
|
|
6
|
+
readonly chain?: EvmChainReference;
|
|
7
|
+
readonly resolveChain?: ChainResolver;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=wallet-chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-chain.d.ts","sourceRoot":"","sources":["../../../../signing/signers/wallet-chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAA8B,MAAM,MAAM,CAAA;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,wBAAsB,iBAAiB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAA;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAA;CACtC,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createWalletClient, custom } from 'viem';
|
|
2
|
+
export async function selectSignerChain(input) {
|
|
3
|
+
if (!input.chain || !input.resolveChain)
|
|
4
|
+
return;
|
|
5
|
+
const transport = input.account.client?.transport;
|
|
6
|
+
if (!transport)
|
|
7
|
+
return;
|
|
8
|
+
const chain = input.resolveChain(input.chain);
|
|
9
|
+
const walletClient = createWalletClient({
|
|
10
|
+
account: input.account,
|
|
11
|
+
chain,
|
|
12
|
+
transport: custom(transport),
|
|
13
|
+
});
|
|
14
|
+
await walletClient.switchChain({ id: chain.id });
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RawSignerResult, SignerInvocation } from '../types.js';
|
|
2
|
+
import type { ExternalSigner } from './types.js';
|
|
3
|
+
export declare function invokeWebauthnSigner(input: {
|
|
4
|
+
readonly signer: Extract<ExternalSigner, {
|
|
5
|
+
readonly kind: 'webauthn';
|
|
6
|
+
}>;
|
|
7
|
+
readonly invocation: Extract<SignerInvocation, {
|
|
8
|
+
readonly kind: 'webauthn-sign-hash' | 'webauthn-sign-typed-data';
|
|
9
|
+
}>;
|
|
10
|
+
}): Promise<RawSignerResult>;
|
|
11
|
+
//# sourceMappingURL=webauthn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthn.d.ts","sourceRoot":"","sources":["../../../../signing/signers/webauthn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAA;IACvE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAC1B,gBAAgB,EAChB;QAAE,QAAQ,CAAC,IAAI,EAAE,oBAAoB,GAAG,0BAA0B,CAAA;KAAE,CACrE,CAAA;CACF,GAAG,OAAO,CAAC,eAAe,CAAC,CAc3B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export async function invokeWebauthnSigner(input) {
|
|
2
|
+
const result = input.invocation.kind === 'webauthn-sign-hash'
|
|
3
|
+
? await input.signer.account.sign({ hash: input.invocation.hash })
|
|
4
|
+
: await input.signer.account.signTypedData(input.invocation.typedData);
|
|
5
|
+
return {
|
|
6
|
+
kind: 'webauthn-assertion',
|
|
7
|
+
signature: result.signature,
|
|
8
|
+
authenticatorData: result.webauthn.authenticatorData,
|
|
9
|
+
clientDataJSON: result.webauthn.clientDataJSON,
|
|
10
|
+
challengeIndex: result.webauthn.challengeIndex ?? 0,
|
|
11
|
+
typeIndex: result.webauthn.typeIndex ?? 0,
|
|
12
|
+
userVerificationRequired: result.webauthn.userVerificationRequired ?? false,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Hex, type TypedDataDefinition } from 'viem';
|
|
2
|
+
import type { EvmChainReference } from '../chains/types.js';
|
|
3
|
+
import type { SigningContext } from './context.js';
|
|
4
|
+
import { type SigningStageAssemblyInput } from './execute.js';
|
|
5
|
+
import type { ArtifactAssemblyPlan, ConfiguredValidatorTopology, EffectiveSignerSelection, PayloadSigningTask, SigningCheckpointPort, SigningPayloadMaterial, SigningPlan, SigningTranscript } from './types.js';
|
|
6
|
+
export interface TypedDataSigningPlanInput {
|
|
7
|
+
readonly typedData: TypedDataDefinition;
|
|
8
|
+
readonly signingMaterial?: SigningPayloadMaterial;
|
|
9
|
+
readonly chain: EvmChainReference;
|
|
10
|
+
readonly configuredTopology: ConfiguredValidatorTopology;
|
|
11
|
+
readonly effectiveSelection: EffectiveSignerSelection;
|
|
12
|
+
readonly tasks: readonly PayloadSigningTask[];
|
|
13
|
+
readonly route: Omit<ArtifactAssemblyPlan, 'id' | 'stageId' | 'input' | 'usage'>;
|
|
14
|
+
readonly checkpoint?: Extract<import('./types.js').SigningReadCheckpoint, {
|
|
15
|
+
readonly kind: 'account-deployment';
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export declare function resolveAccountTypedDataSigning(input: {
|
|
19
|
+
readonly typedData: TypedDataDefinition;
|
|
20
|
+
readonly chain: EvmChainReference;
|
|
21
|
+
readonly context: SigningContext;
|
|
22
|
+
}): {
|
|
23
|
+
readonly material: SigningPayloadMaterial;
|
|
24
|
+
readonly payloadKind: 'message' | 'typed-data';
|
|
25
|
+
readonly ecdsaInvocation: 'ecdsa-sign-message' | 'ecdsa-sign-typed-data';
|
|
26
|
+
readonly webauthnInvocation: 'webauthn-sign-hash' | 'webauthn-sign-typed-data';
|
|
27
|
+
readonly erc7739: ArtifactAssemblyPlan['erc7739'];
|
|
28
|
+
};
|
|
29
|
+
export declare function createTypedDataSigningPlan(input: TypedDataSigningPlanInput): SigningPlan;
|
|
30
|
+
export declare function signAccountTypedData(input: {
|
|
31
|
+
readonly planInput: TypedDataSigningPlanInput;
|
|
32
|
+
readonly context: SigningContext;
|
|
33
|
+
readonly checkpoints: SigningCheckpointPort;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
readonly signature: Hex;
|
|
36
|
+
readonly transcript: SigningTranscript;
|
|
37
|
+
}>;
|
|
38
|
+
export declare function assembleTypedDataStage(input: SigningStageAssemblyInput, context: SigningContext): Readonly<Record<string, Hex>>;
|
|
39
|
+
//# sourceMappingURL=typed-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-data.d.ts","sourceRoot":"","sources":["../../../signing/typed-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,GAAG,EAAiB,KAAK,mBAAmB,EAAE,MAAM,MAAM,CAAA;AAOhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAG/C,OAAO,EAAsB,KAAK,yBAAyB,EAAE,MAAM,WAAW,CAAA;AAO9E,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,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,eAAe,CAAC,EAAE,sBAAsB,CAAA;IACjD,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAA;IACxD,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,CAAA;IACrD,QAAQ,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAC7C,QAAQ,CAAC,KAAK,EAAE,IAAI,CAClB,oBAAoB,EACpB,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CACrC,CAAA;IACD,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAC3B,OAAO,SAAS,EAAE,qBAAqB,EACvC;QAAE,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAA;KAAE,CACxC,CAAA;CACF;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE;IACpD,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;IACvC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CACjC,GAAG;IACF,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAA;IACzC,QAAQ,CAAC,WAAW,EAAE,SAAS,GAAG,YAAY,CAAA;IAC9C,QAAQ,CAAC,eAAe,EAAE,oBAAoB,GAAG,uBAAuB,CAAA;IACxE,QAAQ,CAAC,kBAAkB,EAAE,oBAAoB,GAAG,0BAA0B,CAAA;IAC9E,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAA;CAClD,CAsCA;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,yBAAyB,GAC/B,WAAW,CAkBb;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAA;IAC7C,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,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,CAmBD;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,yBAAyB,EAChC,OAAO,EAAE,cAAc,GACtB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAgE/B"}
|