@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
|
@@ -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"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The arbiter contract keys that each settlement layer expands to. `ACROSS`
|
|
3
|
+
* whitelists both arbiter impls so a session is permissioned for the 7579 and
|
|
4
|
+
* multicall paths regardless of which one the orchestrator picks at intent time.
|
|
5
|
+
*/
|
|
6
|
+
const SETTLEMENT_LAYER_CONTRACT_KEYS = {
|
|
7
|
+
SAME_CHAIN: ['samechainArbiter'],
|
|
8
|
+
ECO: ['ecoArbiter'],
|
|
9
|
+
ACROSS: ['across7579Arbiter', 'acrossMulticallArbiter'],
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Bundled arbiter allow-set — the deployed arbiter addresses per key, per
|
|
13
|
+
* environment (the union across chains).
|
|
14
|
+
*
|
|
15
|
+
* v2: this is a small, signed-path **constant** bundled in the SDK rather than
|
|
16
|
+
* read from `@rhinestone/shared-configs`. The arbiter is baked into the user's
|
|
17
|
+
* Permit2 session signature, so it must stay **client-trusted** — never sourced
|
|
18
|
+
* from the orchestrator you transact against. Rhinestone's arbiters are CREATE2
|
|
19
|
+
* and near-uniform across chains, so this is a handful of addresses per key
|
|
20
|
+
* (e.g. `ecoArbiter` has a mainnet and a testnet address). A new *chain* reuses
|
|
21
|
+
* these; only a contract redeploy or a new settlement layer changes them.
|
|
22
|
+
*/
|
|
23
|
+
const ARBITER_ADDRESSES = {
|
|
24
|
+
prod: {
|
|
25
|
+
samechainArbiter: ['0x000000000006e2569CaF8Ff021810790e0A0D740'],
|
|
26
|
+
ecoArbiter: [
|
|
27
|
+
'0x2e7627CCfAe4eDb336eEb5a70f08415B0F1a2b8C',
|
|
28
|
+
'0xA212A6ACCC8db0e4cdf4394D0A851c70Fc27A8F0',
|
|
29
|
+
],
|
|
30
|
+
across7579Arbiter: ['0x28a4D41776968c1201A807ec51fFB405362B8882'],
|
|
31
|
+
acrossMulticallArbiter: ['0xA162fabb9a0EeF2736485A587aAAB3d015e14224'],
|
|
32
|
+
},
|
|
33
|
+
dev: {
|
|
34
|
+
samechainArbiter: ['0x8fA7720Eee299223f25De8DC03C68A28541dCD10'],
|
|
35
|
+
ecoArbiter: [
|
|
36
|
+
'0x1BeBAfb3D05d84A5Bfd94800c88d1342f755d8AB',
|
|
37
|
+
'0x8A061029AE4c5Cf69b5368119B3b0C80B31F55fE',
|
|
38
|
+
],
|
|
39
|
+
across7579Arbiter: ['0x1b19973F7a29E950ad4FaF8872745B6378005517'],
|
|
40
|
+
acrossMulticallArbiter: ['0x8343FBBA0526deC1c952A098057021027648bcf9'],
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Collects every distinct arbiter address for the given settlement layers. The
|
|
45
|
+
* resulting whitelist is what the Permit2 claim policy enforces on-chain — a
|
|
46
|
+
* session signed once with this whitelist is valid against any of those
|
|
47
|
+
* arbiters.
|
|
48
|
+
*
|
|
49
|
+
* **"Any" means any of the *supported* settlement layers**, not any address on
|
|
50
|
+
* earth. When `layers` is empty or undefined, this expands to the union of
|
|
51
|
+
* every layer in {@link SETTLEMENT_LAYER_CONTRACT_KEYS}, so the on-chain arbiter
|
|
52
|
+
* check stays meaningful (the worst case is still a Rhinestone-blessed arbiter).
|
|
53
|
+
*
|
|
54
|
+
* @param layers Settlement layers the session is permitted to use.
|
|
55
|
+
* Empty/undefined ⇒ all supported layers.
|
|
56
|
+
* @param useDevContracts Pull from the dev address book instead of mainnet.
|
|
57
|
+
*/
|
|
58
|
+
export function getArbitersForSettlementLayers(layers, useDevContracts) {
|
|
59
|
+
const effectiveLayers = !layers || layers.length === 0
|
|
60
|
+
? Object.keys(SETTLEMENT_LAYER_CONTRACT_KEYS)
|
|
61
|
+
: layers;
|
|
62
|
+
const book = ARBITER_ADDRESSES[useDevContracts ? 'dev' : 'prod'];
|
|
63
|
+
const keys = effectiveLayers.flatMap((l) => SETTLEMENT_LAYER_CONTRACT_KEYS[l]);
|
|
64
|
+
const seen = new Set();
|
|
65
|
+
const addresses = [];
|
|
66
|
+
// The same logical arbiter often shares an address across chains, but a given
|
|
67
|
+
// key may have multiple addresses live (e.g. a mainnet + testnet deployment).
|
|
68
|
+
// Collect every unique address for the requested keys, deduped
|
|
69
|
+
// case-insensitively.
|
|
70
|
+
for (const key of keys) {
|
|
71
|
+
// `keys` are `SETTLEMENT_LAYER_CONTRACT_KEYS` values, so `book` always has
|
|
72
|
+
// an entry for each — no missing-key fallback needed.
|
|
73
|
+
for (const addr of book[key]) {
|
|
74
|
+
const norm = addr.toLowerCase();
|
|
75
|
+
if (seen.has(norm))
|
|
76
|
+
continue;
|
|
77
|
+
seen.add(norm);
|
|
78
|
+
addresses.push(addr);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return addresses.length ? addresses : undefined;
|
|
82
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ResolvedModule } from '../types.js';
|
|
2
|
+
import type { AtomicValidatorDefinition, ResolvedValidatorDefinition } from './types.js';
|
|
3
|
+
export declare function resolveAtomicValidator(definition: AtomicValidatorDefinition): ResolvedModule;
|
|
4
|
+
export declare function resolveValidator(definition: ResolvedValidatorDefinition): ResolvedModule;
|
|
5
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../modules/validators/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,SAAS,CAAA;AAGhB,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,yBAAyB,GACpC,cAAc,CAYhB;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,2BAA2B,GACtC,cAAc,CAIhB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { resolveEnsValidator } from './ens.js';
|
|
2
|
+
import { resolveMultiFactorValidator } from './multi-factor.js';
|
|
3
|
+
import { resolveOwnableValidator } from './ownable.js';
|
|
4
|
+
import { resolveWebauthnValidator } from './webauthn.js';
|
|
5
|
+
export function resolveAtomicValidator(definition) {
|
|
6
|
+
switch (definition.kind) {
|
|
7
|
+
case 'ecdsa':
|
|
8
|
+
return resolveOwnableValidator(definition);
|
|
9
|
+
case 'ens':
|
|
10
|
+
return resolveEnsValidator(definition);
|
|
11
|
+
case 'passkey':
|
|
12
|
+
return resolveWebauthnValidator(definition);
|
|
13
|
+
case 'k1':
|
|
14
|
+
case 'smart-session':
|
|
15
|
+
throw new Error(`Validator ${definition.kind} requires feature input`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function resolveValidator(definition) {
|
|
19
|
+
return definition.kind === 'multi-factor'
|
|
20
|
+
? resolveMultiFactorValidator(definition, resolveAtomicValidator)
|
|
21
|
+
: resolveAtomicValidator(definition);
|
|
22
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Account, Address, Hex } from 'viem';
|
|
2
|
+
import type { WebAuthnAccount } from 'viem/account-abstraction';
|
|
3
|
+
export declare function ecdsaSignerId(account: Account | Address): string;
|
|
4
|
+
export declare function webauthnSignerId(account: WebAuthnAccount | Hex): string;
|
|
5
|
+
//# sourceMappingURL=signer-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer-id.d.ts","sourceRoot":"","sources":["../../../../modules/validators/signer-id.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE/D,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAGhE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG,GAAG,MAAM,CAGvE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function ecdsaSignerId(account) {
|
|
2
|
+
const address = typeof account === 'string' ? account : account.address;
|
|
3
|
+
return `ecdsa:${address.toLowerCase()}`;
|
|
4
|
+
}
|
|
5
|
+
export function webauthnSignerId(account) {
|
|
6
|
+
const publicKey = typeof account === 'string' ? account : account.publicKey;
|
|
7
|
+
return `webauthn:${publicKey.toLowerCase()}`;
|
|
8
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
interface SmartSessionPolicyData {
|
|
3
|
+
readonly policy: Address;
|
|
4
|
+
readonly initData: Hex;
|
|
5
|
+
}
|
|
6
|
+
interface SmartSessionActionData {
|
|
7
|
+
readonly actionTargetSelector: Hex;
|
|
8
|
+
readonly actionTarget: Address;
|
|
9
|
+
readonly actionPolicies: readonly SmartSessionPolicyData[];
|
|
10
|
+
}
|
|
11
|
+
interface SmartSessionErc7739PolicyData {
|
|
12
|
+
readonly allowedERC7739Content: readonly {
|
|
13
|
+
readonly appDomainSeparator: Hex;
|
|
14
|
+
readonly contentNames: readonly string[];
|
|
15
|
+
}[];
|
|
16
|
+
readonly erc1271Policies: readonly SmartSessionPolicyData[];
|
|
17
|
+
}
|
|
18
|
+
export interface SmartSessionEnableContributionData {
|
|
19
|
+
readonly userSignature: Hex;
|
|
20
|
+
readonly hashesAndChainIds: readonly {
|
|
21
|
+
readonly chainId: bigint;
|
|
22
|
+
readonly sessionDigest: Hex;
|
|
23
|
+
}[];
|
|
24
|
+
readonly sessionToEnableIndex: number;
|
|
25
|
+
readonly session: {
|
|
26
|
+
readonly sessionValidator: Address;
|
|
27
|
+
readonly sessionValidatorInitData: Hex;
|
|
28
|
+
readonly salt: Hex;
|
|
29
|
+
readonly erc7739Policies: SmartSessionErc7739PolicyData;
|
|
30
|
+
readonly actions: readonly SmartSessionActionData[];
|
|
31
|
+
readonly claimPolicies: readonly SmartSessionPolicyData[];
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=smart-session-signature-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smart-session-signature-types.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-session-signature-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAExC,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAA;CACvB;AAED,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,oBAAoB,EAAE,GAAG,CAAA;IAClC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,cAAc,EAAE,SAAS,sBAAsB,EAAE,CAAA;CAC3D;AAED,UAAU,6BAA6B;IACrC,QAAQ,CAAC,qBAAqB,EAAE,SAAS;QACvC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,CAAA;QAChC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;KACzC,EAAE,CAAA;IACH,QAAQ,CAAC,eAAe,EAAE,SAAS,sBAAsB,EAAE,CAAA;CAC5D;AAED,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAA;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,SAAS;QACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAA;KAC5B,EAAE,CAAA;IACH,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAA;IACrC,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;QAClC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,CAAA;QACtC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAA;QAClB,QAAQ,CAAC,eAAe,EAAE,6BAA6B,CAAA;QACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAA;QACnD,QAAQ,CAAC,aAAa,EAAE,SAAS,sBAAsB,EAAE,CAAA;KAC1D,CAAA;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
import type { Session, SessionDetails } from './types.js';
|
|
3
|
+
export declare const SESSION_LOCK_TAG: "0x000000000000000000000000";
|
|
4
|
+
export declare const types: {
|
|
5
|
+
readonly PolicyData: readonly [{
|
|
6
|
+
readonly name: "policy";
|
|
7
|
+
readonly type: "address";
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "initData";
|
|
10
|
+
readonly type: "bytes";
|
|
11
|
+
}];
|
|
12
|
+
readonly ActionData: readonly [{
|
|
13
|
+
readonly name: "actionTargetSelector";
|
|
14
|
+
readonly type: "bytes4";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "actionTarget";
|
|
17
|
+
readonly type: "address";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "actionPolicies";
|
|
20
|
+
readonly type: "PolicyData[]";
|
|
21
|
+
}];
|
|
22
|
+
readonly ERC7739Context: readonly [{
|
|
23
|
+
readonly name: "appDomainSeparator";
|
|
24
|
+
readonly type: "bytes32";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "contentName";
|
|
27
|
+
readonly type: "string[]";
|
|
28
|
+
}];
|
|
29
|
+
readonly ERC7739Data: readonly [{
|
|
30
|
+
readonly name: "allowedERC7739Content";
|
|
31
|
+
readonly type: "ERC7739Context[]";
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "erc1271Policies";
|
|
34
|
+
readonly type: "PolicyData[]";
|
|
35
|
+
}];
|
|
36
|
+
readonly LockTagData: readonly [{
|
|
37
|
+
readonly name: "lockTag";
|
|
38
|
+
readonly type: "bytes12";
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "claimPolicies";
|
|
41
|
+
readonly type: "PolicyData[]";
|
|
42
|
+
}];
|
|
43
|
+
readonly SignedPermissions: readonly [{
|
|
44
|
+
readonly name: "actions";
|
|
45
|
+
readonly type: "ActionData[]";
|
|
46
|
+
}, {
|
|
47
|
+
readonly name: "erc7739Policies";
|
|
48
|
+
readonly type: "ERC7739Data";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "lockTagPolicies";
|
|
51
|
+
readonly type: "LockTagData";
|
|
52
|
+
}, {
|
|
53
|
+
readonly name: "permitGenericPolicy";
|
|
54
|
+
readonly type: "bool";
|
|
55
|
+
}];
|
|
56
|
+
readonly SignedSession: readonly [{
|
|
57
|
+
readonly name: "account";
|
|
58
|
+
readonly type: "address";
|
|
59
|
+
}, {
|
|
60
|
+
readonly name: "expires";
|
|
61
|
+
readonly type: "uint256";
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "nonce";
|
|
64
|
+
readonly type: "uint256";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "permissions";
|
|
67
|
+
readonly type: "SignedPermissions";
|
|
68
|
+
}, {
|
|
69
|
+
readonly name: "salt";
|
|
70
|
+
readonly type: "bytes32";
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "sessionValidator";
|
|
73
|
+
readonly type: "address";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "sessionValidatorInitData";
|
|
76
|
+
readonly type: "bytes";
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "smartSessionEmissary";
|
|
79
|
+
readonly type: "address";
|
|
80
|
+
}];
|
|
81
|
+
readonly ChainSession: readonly [{
|
|
82
|
+
readonly name: "chainId";
|
|
83
|
+
readonly type: "uint64";
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "session";
|
|
86
|
+
readonly type: "SignedSession";
|
|
87
|
+
}];
|
|
88
|
+
readonly MultiChainSession: readonly [{
|
|
89
|
+
readonly name: "sessionsAndChainIds";
|
|
90
|
+
readonly type: "ChainSession[]";
|
|
91
|
+
}];
|
|
92
|
+
};
|
|
93
|
+
export declare function getSessionDetails(input: {
|
|
94
|
+
readonly account: Address;
|
|
95
|
+
readonly sessions: readonly Session[];
|
|
96
|
+
readonly environment: 'production' | 'development';
|
|
97
|
+
readonly readNonce: (session: Session) => Promise<bigint>;
|
|
98
|
+
}): Promise<SessionDetails>;
|
|
99
|
+
//# sourceMappingURL=authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../../../../modules/validators/smart-sessions/authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAIb,MAAM,MAAM,CAAA;AAOb,OAAO,KAAK,EAAE,OAAO,EAAe,cAAc,EAAE,MAAM,SAAS,CAAA;AAEnE,eAAO,MAAM,gBAAgB,EAAG,4BAAqC,CAAA;AAErE,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CR,CAAA;AAyCV,wBAAsB,iBAAiB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;IACrC,QAAQ,CAAC,WAAW,EAAE,YAAY,GAAG,aAAa,CAAA;IAClD,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC1D,GAAG,OAAO,CAAC,cAAc,CAAC,CA8B1B"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { hashStruct, maxUint256, } from 'viem';
|
|
2
|
+
import { getSessionData } from './digest.js';
|
|
3
|
+
import { getSmartSessionEmissaryAddress } from './module.js';
|
|
4
|
+
import { SMART_SESSIONS_FALLBACK_TARGET_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG, } from './resolve.js';
|
|
5
|
+
export const SESSION_LOCK_TAG = '0x000000000000000000000000';
|
|
6
|
+
export const types = {
|
|
7
|
+
PolicyData: [
|
|
8
|
+
{ name: 'policy', type: 'address' },
|
|
9
|
+
{ name: 'initData', type: 'bytes' },
|
|
10
|
+
],
|
|
11
|
+
ActionData: [
|
|
12
|
+
{ name: 'actionTargetSelector', type: 'bytes4' },
|
|
13
|
+
{ name: 'actionTarget', type: 'address' },
|
|
14
|
+
{ name: 'actionPolicies', type: 'PolicyData[]' },
|
|
15
|
+
],
|
|
16
|
+
ERC7739Context: [
|
|
17
|
+
{ name: 'appDomainSeparator', type: 'bytes32' },
|
|
18
|
+
{ name: 'contentName', type: 'string[]' },
|
|
19
|
+
],
|
|
20
|
+
ERC7739Data: [
|
|
21
|
+
{ name: 'allowedERC7739Content', type: 'ERC7739Context[]' },
|
|
22
|
+
{ name: 'erc1271Policies', type: 'PolicyData[]' },
|
|
23
|
+
],
|
|
24
|
+
LockTagData: [
|
|
25
|
+
{ name: 'lockTag', type: 'bytes12' },
|
|
26
|
+
{ name: 'claimPolicies', type: 'PolicyData[]' },
|
|
27
|
+
],
|
|
28
|
+
SignedPermissions: [
|
|
29
|
+
{ name: 'actions', type: 'ActionData[]' },
|
|
30
|
+
{ name: 'erc7739Policies', type: 'ERC7739Data' },
|
|
31
|
+
{ name: 'lockTagPolicies', type: 'LockTagData' },
|
|
32
|
+
{ name: 'permitGenericPolicy', type: 'bool' },
|
|
33
|
+
],
|
|
34
|
+
SignedSession: [
|
|
35
|
+
{ name: 'account', type: 'address' },
|
|
36
|
+
{ name: 'expires', type: 'uint256' },
|
|
37
|
+
{ name: 'nonce', type: 'uint256' },
|
|
38
|
+
{ name: 'permissions', type: 'SignedPermissions' },
|
|
39
|
+
{ name: 'salt', type: 'bytes32' },
|
|
40
|
+
{ name: 'sessionValidator', type: 'address' },
|
|
41
|
+
{ name: 'sessionValidatorInitData', type: 'bytes' },
|
|
42
|
+
{ name: 'smartSessionEmissary', type: 'address' },
|
|
43
|
+
],
|
|
44
|
+
ChainSession: [
|
|
45
|
+
{ name: 'chainId', type: 'uint64' },
|
|
46
|
+
{ name: 'session', type: 'SignedSession' },
|
|
47
|
+
],
|
|
48
|
+
MultiChainSession: [{ name: 'sessionsAndChainIds', type: 'ChainSession[]' }],
|
|
49
|
+
};
|
|
50
|
+
function signedSession(account, data, nonce, environment) {
|
|
51
|
+
return {
|
|
52
|
+
account,
|
|
53
|
+
permissions: {
|
|
54
|
+
permitGenericPolicy: data.actions.some((action) => action.actionTarget === SMART_SESSIONS_FALLBACK_TARGET_FLAG &&
|
|
55
|
+
action.actionTargetSelector ===
|
|
56
|
+
SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG),
|
|
57
|
+
lockTagPolicies: {
|
|
58
|
+
lockTag: SESSION_LOCK_TAG,
|
|
59
|
+
claimPolicies: data.claimPolicies,
|
|
60
|
+
},
|
|
61
|
+
erc7739Policies: {
|
|
62
|
+
allowedERC7739Content: data.erc7739Policies.allowedERC7739Content.map((content) => ({
|
|
63
|
+
contentName: content.contentNames,
|
|
64
|
+
appDomainSeparator: content.appDomainSeparator,
|
|
65
|
+
})),
|
|
66
|
+
erc1271Policies: data.erc7739Policies.erc1271Policies,
|
|
67
|
+
},
|
|
68
|
+
actions: data.actions,
|
|
69
|
+
},
|
|
70
|
+
sessionValidator: data.sessionValidator,
|
|
71
|
+
sessionValidatorInitData: data.sessionValidatorInitData,
|
|
72
|
+
salt: data.salt,
|
|
73
|
+
smartSessionEmissary: getSmartSessionEmissaryAddress(environment),
|
|
74
|
+
expires: maxUint256,
|
|
75
|
+
nonce,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export async function getSessionDetails(input) {
|
|
79
|
+
const nonces = await Promise.all(input.sessions.map(input.readNonce));
|
|
80
|
+
const signed = input.sessions.map((session, index) => signedSession(input.account, getSessionData(session), nonces[index], input.environment));
|
|
81
|
+
const hashesAndChainIds = signed.map((session, index) => ({
|
|
82
|
+
chainId: BigInt(input.sessions[index].chain.id),
|
|
83
|
+
sessionDigest: hashStruct({
|
|
84
|
+
types,
|
|
85
|
+
primaryType: 'SignedSession',
|
|
86
|
+
data: session,
|
|
87
|
+
}),
|
|
88
|
+
}));
|
|
89
|
+
const data = {
|
|
90
|
+
domain: { name: 'SmartSessionEmissary', version: '1' },
|
|
91
|
+
types,
|
|
92
|
+
primaryType: 'MultiChainSession',
|
|
93
|
+
message: {
|
|
94
|
+
sessionsAndChainIds: signed.map((session, index) => ({
|
|
95
|
+
chainId: BigInt(input.sessions[index].chain.id),
|
|
96
|
+
session,
|
|
97
|
+
})),
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
return { nonces, hashesAndChainIds, data };
|
|
101
|
+
}
|