@rhinestone/sdk 2.0.0-beta.8 → 2.0.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 +118 -0
- package/dist/src/accounts/adapters/kernel.d.ts +9 -0
- package/dist/src/accounts/adapters/kernel.d.ts.map +1 -0
- package/dist/src/accounts/adapters/kernel.js +159 -0
- package/dist/src/accounts/adapters/nexus.d.ts +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 +1 -1
- package/dist/src/actions/ecdsa.d.ts.map +1 -1
- package/dist/src/actions/ecdsa.js +8 -8
- package/dist/src/actions/index.d.ts +2 -16
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +3 -49
- package/dist/src/actions/mfa.d.ts +1 -1
- package/dist/src/actions/mfa.d.ts.map +1 -1
- package/dist/src/actions/mfa.js +30 -10
- package/dist/src/actions/modules.d.ts +4 -0
- package/dist/src/actions/modules.d.ts.map +1 -0
- package/dist/src/actions/modules.js +22 -0
- package/dist/src/actions/passkeys.d.ts +2 -2
- package/dist/src/actions/passkeys.d.ts.map +1 -1
- package/dist/src/actions/passkeys.js +19 -14
- package/dist/src/actions/runtime.d.ts +12 -0
- package/dist/src/actions/runtime.d.ts.map +1 -0
- package/dist/src/actions/runtime.js +158 -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/api/account.d.ts +265 -0
- package/dist/src/api/account.d.ts.map +1 -0
- package/dist/src/api/account.js +637 -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 +766 -0
- package/dist/src/api/direct-signing.d.ts +27 -0
- package/dist/src/api/direct-signing.d.ts.map +1 -0
- package/dist/src/api/direct-signing.js +191 -0
- package/dist/src/api/project-mappers.d.ts +7 -0
- package/dist/src/api/project-mappers.d.ts.map +1 -0
- package/dist/src/api/project-mappers.js +23 -0
- package/dist/src/api/queries/app-fees.d.ts +4 -0
- package/dist/src/api/queries/app-fees.d.ts.map +1 -0
- package/dist/src/api/queries/app-fees.js +3 -0
- package/dist/src/api/queries/portfolio.d.ts +9 -0
- package/dist/src/api/queries/portfolio.d.ts.map +1 -0
- package/dist/src/api/queries/portfolio.js +28 -0
- package/dist/src/api/queries/session.d.ts +8 -0
- package/dist/src/api/queries/session.d.ts.map +1 -0
- package/dist/src/api/queries/session.js +15 -0
- package/dist/src/api/sdk.d.ts +80 -0
- package/dist/src/api/sdk.d.ts.map +1 -0
- package/dist/src/api/sdk.js +103 -0
- package/dist/src/api/signer-selection.d.ts +7 -0
- package/dist/src/api/signer-selection.d.ts.map +1 -0
- package/dist/src/api/signer-selection.js +109 -0
- package/dist/src/calls/normalize.d.ts +9 -0
- package/dist/src/calls/normalize.d.ts.map +1 -0
- package/dist/src/calls/normalize.js +17 -0
- package/dist/src/calls/resolve.d.ts +3 -0
- package/dist/src/calls/resolve.d.ts.map +1 -0
- package/dist/src/calls/resolve.js +15 -0
- package/dist/src/calls/types.d.ts +25 -0
- package/dist/src/calls/types.d.ts.map +1 -0
- package/dist/src/calls/types.js +1 -0
- package/dist/src/chains/caip2.d.ts +10 -0
- package/dist/src/chains/caip2.d.ts.map +1 -0
- package/dist/src/chains/caip2.js +85 -0
- package/dist/src/chains/catalog.d.ts +5 -0
- package/dist/src/chains/catalog.d.ts.map +1 -0
- package/dist/src/chains/catalog.js +41 -0
- package/dist/src/chains/errors.d.ts +15 -0
- package/dist/src/chains/errors.d.ts.map +1 -0
- package/dist/src/chains/errors.js +21 -0
- package/dist/src/chains/non-evm.d.ts +26 -0
- 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} +115 -42
- 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 +743 -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 +54 -0
- package/dist/src/config/input.d.ts.map +1 -0
- package/dist/src/config/input.js +1 -0
- package/dist/src/config/legacy.d.ts +22 -0
- package/dist/src/config/legacy.d.ts.map +1 -0
- package/dist/src/config/legacy.js +23 -0
- package/dist/src/config/resolve.d.ts +13 -0
- package/dist/src/config/resolve.d.ts.map +1 -0
- package/dist/src/config/resolve.js +174 -0
- package/dist/src/config/resolved.d.ts +77 -0
- package/dist/src/config/resolved.d.ts.map +1 -0
- package/dist/src/config/resolved.js +1 -0
- package/dist/src/config/validate.d.ts +3 -0
- package/dist/src/config/validate.d.ts.map +1 -0
- package/dist/src/config/validate.js +6 -0
- package/dist/src/{execution/error.d.ts → errors/execution.d.ts} +43 -12
- package/dist/src/errors/execution.d.ts.map +1 -0
- package/dist/src/errors/execution.js +123 -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 -83
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -290
- 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 +39 -0
- package/dist/src/modules/read-core.d.ts.map +1 -0
- package/dist/src/modules/read-core.js +149 -0
- package/dist/src/modules/types.d.ts +46 -0
- package/dist/src/modules/types.d.ts.map +1 -0
- package/dist/src/modules/types.js +1 -0
- package/dist/src/modules/validators/capabilities.d.ts +4 -0
- package/dist/src/modules/validators/capabilities.d.ts.map +1 -0
- package/dist/src/modules/validators/capabilities.js +58 -0
- package/dist/src/modules/validators/contribution.d.ts +4 -0
- package/dist/src/modules/validators/contribution.d.ts.map +1 -0
- package/dist/src/modules/validators/contribution.js +64 -0
- package/dist/src/modules/validators/definition.d.ts +3 -0
- package/dist/src/modules/validators/definition.d.ts.map +1 -0
- package/dist/src/modules/validators/definition.js +68 -0
- package/dist/src/modules/validators/ens.d.ts +5 -0
- package/dist/src/modules/validators/ens.d.ts.map +1 -0
- package/dist/src/modules/validators/ens.js +34 -0
- package/dist/src/modules/validators/k1.d.ts +2 -0
- package/dist/src/modules/validators/k1.d.ts.map +1 -0
- package/dist/src/modules/validators/k1.js +1 -0
- package/dist/src/modules/validators/multi-factor.d.ts +18 -0
- package/dist/src/modules/validators/multi-factor.d.ts.map +1 -0
- package/dist/src/modules/validators/multi-factor.js +79 -0
- package/dist/src/modules/validators/ownable.d.ts +26 -0
- package/dist/src/modules/validators/ownable.d.ts.map +1 -0
- package/dist/src/modules/validators/ownable.js +84 -0
- package/dist/src/modules/validators/permissions.d.ts +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/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 +6 -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/actions/recovery.d.ts +0 -33
- package/dist/src/actions/recovery.d.ts.map +0 -1
- package/dist/src/actions/recovery.js +0 -189
- 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 -41
- 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 -126
- package/dist/src/execution/utils.d.ts.map +0 -1
- package/dist/src/execution/utils.js +0 -1054
- 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 -7
- package/dist/src/orchestrator/caip2.d.ts.map +0 -1
- package/dist/src/orchestrator/caip2.js +0 -17
- 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 -291
- 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/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 -11
- package/dist/src/orchestrator/index.d.ts.map +0 -1
- package/dist/src/orchestrator/index.js +0 -9
- package/dist/src/orchestrator/registry.d.ts +0 -16
- package/dist/src/orchestrator/registry.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.js +0 -90
- 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 -446
- 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 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../../modules/validators/definition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,2BAA2B,EAC3B,cAAc,EAGf,MAAM,SAAS,CAAA;AAsEhB,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,EACrB,EAAE,SAAoB,EACtB,QAAQ,GAAE,MAAM,GAAG,KAAK,MAAM,EAAM,GACnC,2BAA2B,CAe7B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ecdsaSignerId, webauthnSignerId } from './signer-id.js';
|
|
2
|
+
function moduleSelection(address, profile) {
|
|
3
|
+
return address === undefined
|
|
4
|
+
? { source: 'default', profile }
|
|
5
|
+
: { source: 'explicit', address };
|
|
6
|
+
}
|
|
7
|
+
function defineAtomicValidator(input, id, publicId) {
|
|
8
|
+
const ownerId = (index) => `${id}/owner/${index}`;
|
|
9
|
+
switch (input.type) {
|
|
10
|
+
case 'ecdsa':
|
|
11
|
+
return {
|
|
12
|
+
kind: 'ecdsa',
|
|
13
|
+
id,
|
|
14
|
+
publicId,
|
|
15
|
+
module: moduleSelection(input.module, 'ownable'),
|
|
16
|
+
owners: input.accounts.map((account, index) => ({
|
|
17
|
+
kind: 'ecdsa',
|
|
18
|
+
id: ownerId(index),
|
|
19
|
+
signerId: ecdsaSignerId(account),
|
|
20
|
+
account,
|
|
21
|
+
})),
|
|
22
|
+
threshold: input.threshold ?? 1,
|
|
23
|
+
};
|
|
24
|
+
case 'ens':
|
|
25
|
+
return {
|
|
26
|
+
kind: 'ens',
|
|
27
|
+
id,
|
|
28
|
+
publicId,
|
|
29
|
+
module: moduleSelection(undefined, 'ens'),
|
|
30
|
+
owners: input.owners.map((owner, index) => ({
|
|
31
|
+
kind: 'ens',
|
|
32
|
+
id: ownerId(index),
|
|
33
|
+
signerId: ecdsaSignerId(owner.account),
|
|
34
|
+
account: owner.account,
|
|
35
|
+
...(owner.expiration ? { expiration: owner.expiration } : {}),
|
|
36
|
+
})),
|
|
37
|
+
threshold: input.threshold ?? 1,
|
|
38
|
+
};
|
|
39
|
+
case 'passkey':
|
|
40
|
+
return {
|
|
41
|
+
kind: 'passkey',
|
|
42
|
+
id,
|
|
43
|
+
publicId,
|
|
44
|
+
module: moduleSelection(input.module, 'webauthn'),
|
|
45
|
+
owners: input.accounts.map((account, index) => ({
|
|
46
|
+
kind: 'webauthn',
|
|
47
|
+
id: ownerId(index),
|
|
48
|
+
signerId: webauthnSignerId(account),
|
|
49
|
+
account,
|
|
50
|
+
})),
|
|
51
|
+
threshold: input.threshold ?? 1,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function defineValidator(input, id = 'owner-validator', publicId = 0) {
|
|
56
|
+
if (input.type !== 'multi-factor') {
|
|
57
|
+
return defineAtomicValidator(input, id, Number(publicId));
|
|
58
|
+
}
|
|
59
|
+
const definition = {
|
|
60
|
+
kind: 'multi-factor',
|
|
61
|
+
id,
|
|
62
|
+
publicId,
|
|
63
|
+
module: moduleSelection(input.module, 'multi-factor'),
|
|
64
|
+
validators: input.validators.map((validator, index) => defineAtomicValidator(validator, `${id}/factor/${index}`, index)),
|
|
65
|
+
threshold: input.threshold ?? 1,
|
|
66
|
+
};
|
|
67
|
+
return definition;
|
|
68
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ResolvedModule } from '../types.js';
|
|
2
|
+
import type { AtomicValidatorDefinition } from './types.js';
|
|
3
|
+
export declare const ENS_HCA_MODULE: "0x5049ecBd4d961aE6DFEED9b7ccCe7f026454970E";
|
|
4
|
+
export declare function resolveEnsValidator(definition: AtomicValidatorDefinition): ResolvedModule;
|
|
5
|
+
//# sourceMappingURL=ens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ens.d.ts","sourceRoot":"","sources":["../../../../modules/validators/ens.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExD,eAAO,MAAM,cAAc,EACzB,4CAAqD,CAAA;AAEvD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,yBAAyB,GACpC,cAAc,CAkChB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { encodeAbiParameters, maxUint48 } from 'viem';
|
|
2
|
+
export const ENS_HCA_MODULE = '0x5049ecBd4d961aE6DFEED9b7ccCe7f026454970E';
|
|
3
|
+
export function resolveEnsValidator(definition) {
|
|
4
|
+
const owners = definition.owners
|
|
5
|
+
.map((owner) => {
|
|
6
|
+
if (owner.kind !== 'ens') {
|
|
7
|
+
throw new Error('ENS validator contains a non-ENS owner');
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
addr: owner.account.address.toLowerCase(),
|
|
11
|
+
expiration: owner.expiration
|
|
12
|
+
? Math.floor(owner.expiration.getTime() / 1000)
|
|
13
|
+
: Number(maxUint48),
|
|
14
|
+
};
|
|
15
|
+
})
|
|
16
|
+
.sort((left, right) => left.addr.localeCompare(right.addr));
|
|
17
|
+
return {
|
|
18
|
+
kind: 'validator',
|
|
19
|
+
address: ENS_HCA_MODULE,
|
|
20
|
+
initData: encodeAbiParameters([
|
|
21
|
+
{ name: 'threshold', type: 'uint256' },
|
|
22
|
+
{
|
|
23
|
+
name: 'owners',
|
|
24
|
+
type: 'tuple[]',
|
|
25
|
+
components: [
|
|
26
|
+
{ name: 'addr', type: 'address' },
|
|
27
|
+
{ name: 'expiration', type: 'uint48' },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
], [BigInt(definition.threshold), owners]),
|
|
31
|
+
deInitData: '0x',
|
|
32
|
+
additionalContext: '0x',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"k1.d.ts","sourceRoot":"","sources":["../../../../modules/validators/k1.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,EACvC,4CAAqD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const K1_DEFAULT_VALIDATOR_ADDRESS = '0x00000072f286204bb934ed49d8969e86f7dec7b1';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Address, type Hex } from 'viem';
|
|
2
|
+
import type { ResolvedModule } from '../types.js';
|
|
3
|
+
import type { MultiFactorValidatorDefinition } from './types.js';
|
|
4
|
+
export declare const MULTI_FACTOR_VALIDATOR_ADDRESS: Address;
|
|
5
|
+
export type AtomicValidatorResolver = (definition: MultiFactorValidatorDefinition['validators'][number]) => ResolvedModule;
|
|
6
|
+
export declare function encodeValidatorId(id: number | Hex): Hex;
|
|
7
|
+
export declare function resolveMultiFactorValidator(definition: MultiFactorValidatorDefinition, resolveAtomic: AtomicValidatorResolver): ResolvedModule;
|
|
8
|
+
export declare function encodeMultiFactorContribution(input: {
|
|
9
|
+
readonly factorOrder: readonly string[];
|
|
10
|
+
readonly threshold: number;
|
|
11
|
+
readonly contributions: readonly {
|
|
12
|
+
readonly factorId: string;
|
|
13
|
+
readonly publicId: number | Hex;
|
|
14
|
+
readonly validator: `0x${string}`;
|
|
15
|
+
readonly contribution: Hex;
|
|
16
|
+
}[];
|
|
17
|
+
}): Hex;
|
|
18
|
+
//# sourceMappingURL=multi-factor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-factor.d.ts","sourceRoot":"","sources":["../../../../modules/validators/multi-factor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAIZ,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAA;AAE7D,eAAO,MAAM,8BAA8B,EAAE,OACC,CAAA;AAE9C,MAAM,MAAM,uBAAuB,GAAG,CACpC,UAAU,EAAE,8BAA8B,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,KAC7D,cAAc,CAAA;AAEnB,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,GAAG,GAAG,CAEvD;AAED,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,8BAA8B,EAC1C,aAAa,EAAE,uBAAuB,GACrC,cAAc,CAuChB;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,aAAa,EAAE,SAAS;QAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;QACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAA;QAC/B,QAAQ,CAAC,SAAS,EAAE,KAAK,MAAM,EAAE,CAAA;QACjC,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAA;KAC3B,EAAE,CAAA;CACJ,GAAG,GAAG,CA6CN"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { concat, encodeAbiParameters, encodePacked, pad, toHex, } from 'viem';
|
|
2
|
+
export const MULTI_FACTOR_VALIDATOR_ADDRESS = '0xf6bdf42c9be18ceca5c06c42a43daf7fbbe7896b';
|
|
3
|
+
export function encodeValidatorId(id) {
|
|
4
|
+
return pad(typeof id === 'number' ? toHex(id) : id, { size: 12 });
|
|
5
|
+
}
|
|
6
|
+
export function resolveMultiFactorValidator(definition, resolveAtomic) {
|
|
7
|
+
const validators = definition.validators.map((validator) => {
|
|
8
|
+
const module = resolveAtomic(validator);
|
|
9
|
+
return {
|
|
10
|
+
packedValidatorAndId: concat([
|
|
11
|
+
encodeValidatorId(validator.publicId),
|
|
12
|
+
module.address,
|
|
13
|
+
]),
|
|
14
|
+
data: module.initData,
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
kind: 'validator',
|
|
19
|
+
address: definition.module.source === 'explicit'
|
|
20
|
+
? definition.module.address
|
|
21
|
+
: MULTI_FACTOR_VALIDATOR_ADDRESS,
|
|
22
|
+
initData: encodePacked(['uint8', 'bytes'], [
|
|
23
|
+
definition.threshold,
|
|
24
|
+
encodeAbiParameters([
|
|
25
|
+
{
|
|
26
|
+
name: 'validators',
|
|
27
|
+
type: 'tuple[]',
|
|
28
|
+
components: [
|
|
29
|
+
{ name: 'packedValidatorAndId', type: 'bytes32' },
|
|
30
|
+
{ name: 'data', type: 'bytes' },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
], [validators]),
|
|
34
|
+
]),
|
|
35
|
+
deInitData: '0x',
|
|
36
|
+
additionalContext: '0x',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function encodeMultiFactorContribution(input) {
|
|
40
|
+
if (input.threshold < 1 || input.threshold > input.factorOrder.length) {
|
|
41
|
+
throw new Error('Validator threshold is outside the configured factor set');
|
|
42
|
+
}
|
|
43
|
+
const configured = new Set(input.factorOrder);
|
|
44
|
+
const contributions = new Map();
|
|
45
|
+
for (const contribution of input.contributions) {
|
|
46
|
+
if (!configured.has(contribution.factorId)) {
|
|
47
|
+
throw new Error(`Unknown validator factor ${contribution.factorId}`);
|
|
48
|
+
}
|
|
49
|
+
if (contributions.has(contribution.factorId)) {
|
|
50
|
+
throw new Error(`Duplicate validator factor ${contribution.factorId}`);
|
|
51
|
+
}
|
|
52
|
+
contributions.set(contribution.factorId, contribution);
|
|
53
|
+
}
|
|
54
|
+
const ordered = input.factorOrder.flatMap((factorId) => {
|
|
55
|
+
const contribution = contributions.get(factorId);
|
|
56
|
+
return contribution ? [contribution] : [];
|
|
57
|
+
});
|
|
58
|
+
if (ordered.length < input.threshold) {
|
|
59
|
+
throw new Error(`Insufficient validator contributions: required ${input.threshold}, received ${ordered.length}`);
|
|
60
|
+
}
|
|
61
|
+
return encodeAbiParameters([
|
|
62
|
+
{
|
|
63
|
+
name: 'validators',
|
|
64
|
+
type: 'tuple[]',
|
|
65
|
+
components: [
|
|
66
|
+
{ name: 'packedValidatorAndId', type: 'bytes32' },
|
|
67
|
+
{ name: 'data', type: 'bytes' },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
], [
|
|
71
|
+
ordered.map((contribution) => ({
|
|
72
|
+
packedValidatorAndId: concat([
|
|
73
|
+
encodeValidatorId(contribution.publicId),
|
|
74
|
+
contribution.validator,
|
|
75
|
+
]),
|
|
76
|
+
data: contribution.contribution,
|
|
77
|
+
})),
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Address, type Hex } from 'viem';
|
|
2
|
+
import type { ResolvedModule } from '../types.js';
|
|
3
|
+
import type { AtomicValidatorDefinition } from './types.js';
|
|
4
|
+
export declare const OWNABLE_VALIDATOR_ADDRESS: Address;
|
|
5
|
+
export declare const OWNABLE_V0_VALIDATOR_ADDRESS: "0x2483da3a338895199e5e538530213157e931bf06";
|
|
6
|
+
export declare const OWNABLE_BETA_VALIDATOR_ADDRESS: "0x0000000000e9e6e96bcaa3c113187cdb7e38aed9";
|
|
7
|
+
export declare const ECDSA_MOCK_SIGNATURE: "0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b";
|
|
8
|
+
export declare function resolveOwnableAddresses(input: {
|
|
9
|
+
readonly owners: readonly `0x${string}`[];
|
|
10
|
+
readonly threshold: number;
|
|
11
|
+
readonly address?: `0x${string}`;
|
|
12
|
+
}): ResolvedModule;
|
|
13
|
+
export declare function resolveOwnableValidator(definition: AtomicValidatorDefinition): ResolvedModule;
|
|
14
|
+
export declare function encodeOwnableMockSignature(ownerCount: number): Hex;
|
|
15
|
+
export declare function encodeEcdsaValidatorContribution(input: {
|
|
16
|
+
readonly ownerOrder: readonly string[];
|
|
17
|
+
readonly threshold: number;
|
|
18
|
+
readonly recoveryEncoding: 'ethereum' | 'validator-offset-4';
|
|
19
|
+
readonly contributions: readonly {
|
|
20
|
+
readonly ownerId: string;
|
|
21
|
+
readonly signature: Hex;
|
|
22
|
+
readonly encoding: 'raw-signer' | 'validator-contribution';
|
|
23
|
+
}[];
|
|
24
|
+
}): Hex;
|
|
25
|
+
export declare function encodeEcdsaRecoveryValue(signature: Hex, encoding: 'ethereum' | 'validator-offset-4'): Hex;
|
|
26
|
+
//# sourceMappingURL=ownable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownable.d.ts","sourceRoot":"","sources":["../../../../modules/validators/ownable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAGZ,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExD,eAAO,MAAM,yBAAyB,EAAE,OACM,CAAA;AAC9C,eAAO,MAAM,4BAA4B,EACvC,4CAAqD,CAAA;AACvD,eAAO,MAAM,8BAA8B,EACzC,4CAAqD,CAAA;AAEvD,eAAO,MAAM,oBAAoB,EAC/B,sIAA+I,CAAA;AAQjJ,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,MAAM,EAAE,EAAE,CAAA;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,MAAM,EAAE,CAAA;CACjC,GAAG,cAAc,CAmBjB;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,yBAAyB,GACpC,cAAc,CAchB;AAED,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAElE;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,UAAU,GAAG,oBAAoB,CAAA;IAC5D,QAAQ,CAAC,aAAa,EAAE,SAAS;QAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAA;QACvB,QAAQ,CAAC,QAAQ,EAAE,YAAY,GAAG,wBAAwB,CAAA;KAC3D,EAAE,CAAA;CACJ,GAAG,GAAG,CAiCN;AAED,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,GAAG,EACd,QAAQ,EAAE,UAAU,GAAG,oBAAoB,GAC1C,GAAG,CAaL"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { concat, encodeAbiParameters, hexToBytes, toHex, } from 'viem';
|
|
2
|
+
export const OWNABLE_VALIDATOR_ADDRESS = '0x000000000013fdb5234e4e3162a810f54d9f7e98';
|
|
3
|
+
export const OWNABLE_V0_VALIDATOR_ADDRESS = '0x2483da3a338895199e5e538530213157e931bf06';
|
|
4
|
+
export const OWNABLE_BETA_VALIDATOR_ADDRESS = '0x0000000000e9e6e96bcaa3c113187cdb7e38aed9';
|
|
5
|
+
export const ECDSA_MOCK_SIGNATURE = '0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b';
|
|
6
|
+
function moduleAddress(definition) {
|
|
7
|
+
return definition.module.source === 'explicit'
|
|
8
|
+
? definition.module.address
|
|
9
|
+
: OWNABLE_VALIDATOR_ADDRESS;
|
|
10
|
+
}
|
|
11
|
+
export function resolveOwnableAddresses(input) {
|
|
12
|
+
return {
|
|
13
|
+
kind: 'validator',
|
|
14
|
+
address: input.address ?? OWNABLE_VALIDATOR_ADDRESS,
|
|
15
|
+
initData: encodeAbiParameters([
|
|
16
|
+
{ name: 'threshold', type: 'uint256' },
|
|
17
|
+
{ name: 'owners', type: 'address[]' },
|
|
18
|
+
], [
|
|
19
|
+
BigInt(input.threshold),
|
|
20
|
+
input.owners
|
|
21
|
+
.map((owner) => owner.toLowerCase())
|
|
22
|
+
.sort(),
|
|
23
|
+
]),
|
|
24
|
+
deInitData: '0x',
|
|
25
|
+
additionalContext: '0x',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function resolveOwnableValidator(definition) {
|
|
29
|
+
const owners = definition.owners
|
|
30
|
+
.map((owner) => {
|
|
31
|
+
if (owner.kind === 'webauthn') {
|
|
32
|
+
throw new Error('Ownable validator contains a WebAuthn owner');
|
|
33
|
+
}
|
|
34
|
+
return owner.account.address.toLowerCase();
|
|
35
|
+
})
|
|
36
|
+
.sort();
|
|
37
|
+
return resolveOwnableAddresses({
|
|
38
|
+
owners,
|
|
39
|
+
threshold: definition.threshold,
|
|
40
|
+
address: moduleAddress(definition),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export function encodeOwnableMockSignature(ownerCount) {
|
|
44
|
+
return concat(Array.from({ length: ownerCount }, () => ECDSA_MOCK_SIGNATURE));
|
|
45
|
+
}
|
|
46
|
+
export function encodeEcdsaValidatorContribution(input) {
|
|
47
|
+
if (input.threshold < 1 || input.threshold > input.ownerOrder.length) {
|
|
48
|
+
throw new Error('Validator threshold is outside the configured owner set');
|
|
49
|
+
}
|
|
50
|
+
const configured = new Set(input.ownerOrder);
|
|
51
|
+
const contributions = new Map();
|
|
52
|
+
for (const contribution of input.contributions) {
|
|
53
|
+
if (!configured.has(contribution.ownerId)) {
|
|
54
|
+
throw new Error(`Unknown validator owner ${contribution.ownerId}`);
|
|
55
|
+
}
|
|
56
|
+
if (contributions.has(contribution.ownerId)) {
|
|
57
|
+
throw new Error(`Duplicate validator owner ${contribution.ownerId}`);
|
|
58
|
+
}
|
|
59
|
+
contributions.set(contribution.ownerId, contribution.encoding === 'validator-contribution'
|
|
60
|
+
? contribution.signature
|
|
61
|
+
: encodeEcdsaRecoveryValue(contribution.signature, input.recoveryEncoding));
|
|
62
|
+
}
|
|
63
|
+
const ordered = input.ownerOrder.flatMap((ownerId) => {
|
|
64
|
+
const contribution = contributions.get(ownerId);
|
|
65
|
+
return contribution ? [contribution] : [];
|
|
66
|
+
});
|
|
67
|
+
if (ordered.length < input.threshold) {
|
|
68
|
+
throw new Error(`Insufficient validator contributions: required ${input.threshold}, received ${ordered.length}`);
|
|
69
|
+
}
|
|
70
|
+
return concat(ordered);
|
|
71
|
+
}
|
|
72
|
+
export function encodeEcdsaRecoveryValue(signature, encoding) {
|
|
73
|
+
const bytes = hexToBytes(signature);
|
|
74
|
+
if (bytes.length !== 65) {
|
|
75
|
+
throw new Error('ECDSA signatures must contain 65 bytes');
|
|
76
|
+
}
|
|
77
|
+
const recovery = bytes[64];
|
|
78
|
+
const ethereumRecovery = recovery < 27 ? recovery + 27 : recovery;
|
|
79
|
+
const encodedRecovery = encoding === 'validator-offset-4' ? ethereumRecovery + 4 : ethereumRecovery;
|
|
80
|
+
if (encodedRecovery > 255) {
|
|
81
|
+
throw new Error('ECDSA recovery value does not fit in one byte');
|
|
82
|
+
}
|
|
83
|
+
return concat([signature.slice(0, -2), toHex(encodedRecovery)]);
|
|
84
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Permission, ScopedAction } from '
|
|
1
|
+
import type { Permission, ScopedAction } from './smart-sessions/types.js';
|
|
2
|
+
export declare const FAR_FUTURE_MS = 4102444800000;
|
|
2
3
|
declare function resolvePermission(permission: Permission): ScopedAction[];
|
|
3
4
|
declare function resolvePermissions(permissions: readonly Permission[]): ScopedAction[];
|
|
4
5
|
export { resolvePermissions, resolvePermission };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/permissions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/permissions.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,UAAU,EACV,YAAY,EAGb,MAAM,wBAAwB,CAAA;AAiH/B,eAAO,MAAM,aAAa,gBAAoB,CAAA;AAE9C,iBAAS,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,EAAE,CA0NjE;AAkBD,iBAAS,kBAAkB,CACzB,WAAW,EAAE,SAAS,UAAU,EAAE,GACjC,YAAY,EAAE,CAwBhB;AAED,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAddress, isHex, size, toFunctionSelector, } from 'viem';
|
|
1
|
+
import { isAddress, isHex, padHex, size, toFunctionSelector, } from 'viem';
|
|
2
2
|
function isStaticAbiType(type) {
|
|
3
3
|
if (type === 'address' || type === 'bool')
|
|
4
4
|
return true;
|
|
@@ -33,12 +33,53 @@ function toReferenceValue(value, abiType) {
|
|
|
33
33
|
if (typeof value === 'string' &&
|
|
34
34
|
isHex(value) &&
|
|
35
35
|
size(value) === expectedSize) {
|
|
36
|
-
|
|
36
|
+
// Solidity calldata encodes bytesN (N<32) left-aligned + right-padded
|
|
37
|
+
// inside its 32-byte word, whereas address/uint*/bool are right-aligned
|
|
38
|
+
// + left-padded. Downstream `encodeActionParamRule` unconditionally
|
|
39
|
+
// left-pads with `padHex`, which is correct for the right-aligned types
|
|
40
|
+
// but wrong for bytesN. Pre-encode here to the full 32-byte hex with
|
|
41
|
+
// the correct alignment so the policy's bytes32 == bytes32 comparison
|
|
42
|
+
// matches what's actually in calldata.
|
|
43
|
+
return padHex(value, { size: 32, dir: 'right' });
|
|
37
44
|
}
|
|
38
45
|
throw new Error(`Expected ${expectedSize}-byte hex string for ${abiType}`);
|
|
39
46
|
}
|
|
40
47
|
throw new Error(`Unsupported ABI type: ${abiType}`);
|
|
41
48
|
}
|
|
49
|
+
// Right-fold an array of leaves into a right-leaning OR chain:
|
|
50
|
+
// [a, b, c] → OR(a, OR(b, c))
|
|
51
|
+
// Right-leaning is fine because ArgPolicy evaluates with short-circuit; any
|
|
52
|
+
// shape that uses every leaf and respects post-order produces the same result.
|
|
53
|
+
function orChain(leaves) {
|
|
54
|
+
let acc = leaves[leaves.length - 1];
|
|
55
|
+
for (let i = leaves.length - 2; i >= 0; i--) {
|
|
56
|
+
acc = { type: 'or', left: leaves[i], right: acc };
|
|
57
|
+
}
|
|
58
|
+
return acc;
|
|
59
|
+
}
|
|
60
|
+
function andChain(leaves) {
|
|
61
|
+
let acc = leaves[leaves.length - 1];
|
|
62
|
+
for (let i = leaves.length - 2; i >= 0; i--) {
|
|
63
|
+
acc = { type: 'and', left: leaves[i], right: acc };
|
|
64
|
+
}
|
|
65
|
+
return acc;
|
|
66
|
+
}
|
|
67
|
+
// On-chain ERC20SpendingLimitPolicy._isTokenTransferOrApprove matches by
|
|
68
|
+
// 4-byte selector, accepting only these four. Selector-gating here keeps the
|
|
69
|
+
// SDK's accepted set congruent with the contract's — a same-shaped function
|
|
70
|
+
// like `mint(address,uint256)` would otherwise pass argument-type checks and
|
|
71
|
+
// fail every call on-chain.
|
|
72
|
+
const ERC20_SPENDING_LIMIT_SELECTORS = new Set([
|
|
73
|
+
'0x095ea7b3', // approve(address,uint256)
|
|
74
|
+
'0x39509351', // increaseAllowance(address,uint256)
|
|
75
|
+
'0xa9059cbb', // transfer(address,uint256)
|
|
76
|
+
'0x23b872dd', // transferFrom(address,address,uint256)
|
|
77
|
+
]);
|
|
78
|
+
// Year 2100 in ms — well within uint128 after the encoder's ms→s conversion.
|
|
79
|
+
// Used as the one-sided default for `validUntil` when only `validAfter` is set.
|
|
80
|
+
// Exported so the cross-chain permit expansion (smart-sessions.ts) applies the
|
|
81
|
+
// same always-passing upper bound instead of defaulting to 0 (already expired).
|
|
82
|
+
export const FAR_FUTURE_MS = 4_102_444_800_000;
|
|
42
83
|
function resolvePermission(permission) {
|
|
43
84
|
const { abi, address, functions } = permission;
|
|
44
85
|
const actions = [];
|
|
@@ -58,11 +99,57 @@ function resolvePermission(permission) {
|
|
|
58
99
|
}
|
|
59
100
|
const abiEntry = abiEntries[0];
|
|
60
101
|
const selector = toFunctionSelector(abiEntry);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
102
|
+
if (Object.hasOwn(config, 'policies')) {
|
|
103
|
+
throw new Error(`Function "${fnName}": \`policies\` was removed from permission configs. ` +
|
|
104
|
+
'Use params, maxUses, validUntil/validAfter, valueLimit, or spendingLimit instead.');
|
|
105
|
+
}
|
|
106
|
+
const policies = [];
|
|
107
|
+
// --- Sugar field expansion -----------------------------------------------
|
|
108
|
+
if (config.maxUses !== undefined) {
|
|
109
|
+
policies.push({ type: 'usage-limit', limit: config.maxUses });
|
|
110
|
+
}
|
|
111
|
+
if (config.validUntil !== undefined || config.validAfter !== undefined) {
|
|
112
|
+
const validUntil = config.validUntil !== undefined
|
|
113
|
+
? config.validUntil.getTime()
|
|
114
|
+
: FAR_FUTURE_MS;
|
|
115
|
+
const validAfter = config.validAfter !== undefined ? config.validAfter.getTime() : 0;
|
|
116
|
+
if (validUntil < validAfter) {
|
|
117
|
+
throw new Error(`Function "${fnName}": validUntil (${validUntil}) is before validAfter (${validAfter}).`);
|
|
118
|
+
}
|
|
119
|
+
policies.push({ type: 'time-frame', validUntil, validAfter });
|
|
120
|
+
}
|
|
121
|
+
if (config.valueLimit !== undefined) {
|
|
122
|
+
// Runtime backstop: payable-gating is enforced at the type level, but
|
|
123
|
+
// users can bypass with `as` casts. valueLimit on a non-payable function
|
|
124
|
+
// is harmless on-chain (msg.value is always 0, the cap always passes)
|
|
125
|
+
// but it leaks intent — throw rather than encode dead weight.
|
|
126
|
+
if (abiEntry.stateMutability !== 'payable') {
|
|
127
|
+
throw new Error(`Function "${fnName}" is not payable — \`valueLimit\` only constrains native ETH ` +
|
|
128
|
+
'attached to the call, which is always zero for non-payable functions. ' +
|
|
129
|
+
'Remove `valueLimit`.');
|
|
130
|
+
}
|
|
131
|
+
policies.push({ type: 'value-limit', limit: config.valueLimit });
|
|
132
|
+
}
|
|
133
|
+
if (config.spendingLimit !== undefined) {
|
|
134
|
+
// Runtime backstop: type-level gate restricts shape, but ERC20SpendingLimitPolicy
|
|
135
|
+
// dispatches by selector on-chain — a same-shaped function like
|
|
136
|
+
// mint(address,uint256) would encode successfully and fail every call.
|
|
137
|
+
if (!ERC20_SPENDING_LIMIT_SELECTORS.has(selector)) {
|
|
138
|
+
throw new Error(`Function "${fnName}" (selector ${selector}) is not an ERC-20 transfer/approve ` +
|
|
139
|
+
'selector; `spendingLimit` only works on approve, increaseAllowance, ' +
|
|
140
|
+
'transfer, or transferFrom. The on-chain policy dispatches by selector ' +
|
|
141
|
+
'and would fail every call for other functions.');
|
|
142
|
+
}
|
|
143
|
+
policies.push({
|
|
144
|
+
type: 'spending-limits',
|
|
145
|
+
limits: [config.spendingLimit],
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// --- End sugar field expansion -------------------------------------------
|
|
149
|
+
const rawParams = config.params ?? {};
|
|
150
|
+
const paramEntries = Object.entries(rawParams).filter(([, v]) => v !== undefined);
|
|
64
151
|
if (paramEntries.length > 0) {
|
|
65
|
-
const
|
|
152
|
+
const normalized = paramEntries.map(([paramName, rule]) => {
|
|
66
153
|
const paramIndex = abiEntry.inputs.findIndex((p) => p.name === paramName);
|
|
67
154
|
if (paramIndex === -1) {
|
|
68
155
|
throw new Error(`Parameter "${paramName}" not found in function "${fnName}". ` +
|
|
@@ -75,21 +162,79 @@ function resolvePermission(permission) {
|
|
|
75
162
|
'(address, bool, uint*, int*, bytes1–bytes32).');
|
|
76
163
|
}
|
|
77
164
|
const calldataOffset = BigInt(paramIndex) * 32n;
|
|
78
|
-
|
|
165
|
+
if (rule.anyOf !== undefined) {
|
|
166
|
+
if (rule.anyOf.length === 0) {
|
|
167
|
+
throw new Error(`Parameter "${paramName}" has empty anyOf — provide at least one value.`);
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
paramName,
|
|
171
|
+
calldataOffset,
|
|
172
|
+
abiType: param.type,
|
|
173
|
+
anyOf: rule.anyOf,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
79
176
|
return {
|
|
80
|
-
|
|
177
|
+
paramName,
|
|
81
178
|
calldataOffset,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
179
|
+
abiType: param.type,
|
|
180
|
+
condition: rule.condition,
|
|
181
|
+
value: rule.value,
|
|
182
|
+
usageLimit: rule.usageLimit,
|
|
86
183
|
};
|
|
87
184
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
185
|
+
const usesArgPolicy = normalized.some((n) => n.anyOf !== undefined);
|
|
186
|
+
// UniActionPolicy/ArgPolicy reject `msg.value > valueLimitPerUse`, so a
|
|
187
|
+
// default of 0 would block any non-zero msg.value before the standalone
|
|
188
|
+
// value-limit policy (sugar) could allow it. Inherit the sugar's cap so
|
|
189
|
+
// the per-use gate matches user intent; value-limit still enforces the
|
|
190
|
+
// cumulative cap on top.
|
|
191
|
+
const embeddedValueLimit = config.valueLimitPerUse ?? config.valueLimit ?? 0n;
|
|
192
|
+
if (usesArgPolicy) {
|
|
193
|
+
// One sub-expression per param, then AND across params.
|
|
194
|
+
const perParam = normalized.map((n) => {
|
|
195
|
+
if (n.anyOf !== undefined) {
|
|
196
|
+
const leaves = n.anyOf.map((v) => ({
|
|
197
|
+
type: 'rule',
|
|
198
|
+
rule: {
|
|
199
|
+
condition: 'equal',
|
|
200
|
+
calldataOffset: n.calldataOffset,
|
|
201
|
+
referenceValue: toReferenceValue(v, n.abiType),
|
|
202
|
+
},
|
|
203
|
+
}));
|
|
204
|
+
return leaves.length === 1 ? leaves[0] : orChain(leaves);
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
type: 'rule',
|
|
208
|
+
rule: {
|
|
209
|
+
condition: n.condition,
|
|
210
|
+
calldataOffset: n.calldataOffset,
|
|
211
|
+
referenceValue: toReferenceValue(n.value, n.abiType),
|
|
212
|
+
...(n.usageLimit !== undefined
|
|
213
|
+
? { usageLimit: n.usageLimit }
|
|
214
|
+
: {}),
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
});
|
|
218
|
+
policies.push({
|
|
219
|
+
type: 'arg-policy',
|
|
220
|
+
valueLimitPerUse: embeddedValueLimit,
|
|
221
|
+
expression: perParam.length === 1 ? perParam[0] : andChain(perParam),
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
// Flat AND-of-rules — cheaper to init via UniActionPolicy.
|
|
226
|
+
const rules = normalized.map((n) => ({
|
|
227
|
+
condition: n.condition,
|
|
228
|
+
calldataOffset: n.calldataOffset,
|
|
229
|
+
referenceValue: toReferenceValue(n.value, n.abiType),
|
|
230
|
+
...(n.usageLimit !== undefined ? { usageLimit: n.usageLimit } : {}),
|
|
231
|
+
}));
|
|
232
|
+
policies.push({
|
|
233
|
+
type: 'universal-action',
|
|
234
|
+
valueLimitPerUse: embeddedValueLimit,
|
|
235
|
+
rules: rules,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
93
238
|
}
|
|
94
239
|
else if (config.valueLimitPerUse !== undefined) {
|
|
95
240
|
policies.push({
|
|
@@ -105,7 +250,36 @@ function resolvePermission(permission) {
|
|
|
105
250
|
}
|
|
106
251
|
return actions;
|
|
107
252
|
}
|
|
253
|
+
// Error-path only: recover the function name behind a selector for the
|
|
254
|
+
// duplicate-permission message.
|
|
255
|
+
function findFunctionName(permission, selector) {
|
|
256
|
+
return Object.keys(permission.functions).find((name) => {
|
|
257
|
+
const entry = permission.abi.find((e) => e.type === 'function' &&
|
|
258
|
+
e.name === name);
|
|
259
|
+
return entry !== undefined && toFunctionSelector(entry) === selector;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
108
262
|
function resolvePermissions(permissions) {
|
|
109
|
-
|
|
263
|
+
// On-chain, actions are keyed by keccak(target, selector): two permission
|
|
264
|
+
// entries for the same function on the same contract share one actionId,
|
|
265
|
+
// and the later entry's `initializeWithMultiplexer` silently overwrites the
|
|
266
|
+
// earlier one's policy config. Reject at build time instead of letting the
|
|
267
|
+
// collision surface as an opaque InvalidSignature() at execution.
|
|
268
|
+
const seen = new Set();
|
|
269
|
+
return permissions.flatMap((permission) => {
|
|
270
|
+
const actions = resolvePermission(permission);
|
|
271
|
+
for (const action of actions) {
|
|
272
|
+
const key = `${action.target.toLowerCase()}:${action.selector.toLowerCase()}`;
|
|
273
|
+
if (seen.has(key)) {
|
|
274
|
+
const fnName = findFunctionName(permission, action.selector);
|
|
275
|
+
throw new Error(`Duplicate permission for function "${fnName}" (selector ${action.selector}) ` +
|
|
276
|
+
`on ${action.target}: permission entries for the same function on the same ` +
|
|
277
|
+
"contract share one on-chain action, so the later entry's policies would " +
|
|
278
|
+
'silently overwrite the earlier ones. Merge them into a single entry.');
|
|
279
|
+
}
|
|
280
|
+
seen.add(key);
|
|
281
|
+
}
|
|
282
|
+
return actions;
|
|
283
|
+
});
|
|
110
284
|
}
|
|
111
285
|
export { resolvePermissions, resolvePermission };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import type { CrossChainSettlementLayer } from '../../smart-sessions/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Collects every distinct arbiter address for the given settlement layers. The
|
|
5
|
+
* resulting whitelist is what the Permit2 claim policy enforces on-chain — a
|
|
6
|
+
* session signed once with this whitelist is valid against any of those
|
|
7
|
+
* arbiters.
|
|
8
|
+
*
|
|
9
|
+
* **"Any" means any of the *supported* settlement layers**, not any address on
|
|
10
|
+
* earth. When `layers` is empty or undefined, this expands to the union of
|
|
11
|
+
* every layer in {@link SETTLEMENT_LAYER_CONTRACT_KEYS}, so the on-chain arbiter
|
|
12
|
+
* check stays meaningful (the worst case is still a Rhinestone-blessed arbiter).
|
|
13
|
+
*
|
|
14
|
+
* @param layers Settlement layers the session is permitted to use.
|
|
15
|
+
* Empty/undefined ⇒ all supported layers.
|
|
16
|
+
* @param useDevContracts Pull from the dev address book instead of mainnet.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getArbitersForSettlementLayers(layers: readonly CrossChainSettlementLayer[] | undefined, useDevContracts?: boolean): Address[] | undefined;
|
|
19
|
+
//# sourceMappingURL=arbiters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arbiters.d.ts","sourceRoot":"","sources":["../../../../../../modules/validators/policies/claim/arbiters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAoD3E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,SAAS,yBAAyB,EAAE,GAAG,SAAS,EACxD,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,EAAE,GAAG,SAAS,CA6BvB"}
|