@rhinestone/sdk 2.0.0-beta.44 → 2.0.0-beta.46
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/dist/src/accounts/adapter.d.ts +31 -0
- package/dist/src/accounts/adapter.d.ts.map +1 -0
- package/dist/src/accounts/adapters/eoa.d.ts +4 -0
- package/dist/src/accounts/adapters/eoa.d.ts.map +1 -0
- package/dist/src/accounts/adapters/eoa.js +45 -0
- package/dist/src/accounts/adapters/hca.d.ts +5 -0
- package/dist/src/accounts/adapters/hca.d.ts.map +1 -0
- package/dist/src/accounts/adapters/hca.js +118 -0
- package/dist/src/accounts/adapters/kernel.d.ts +9 -0
- package/dist/src/accounts/adapters/kernel.d.ts.map +1 -0
- package/dist/src/accounts/adapters/kernel.js +159 -0
- package/dist/src/accounts/adapters/nexus.d.ts +17 -0
- package/dist/src/accounts/adapters/nexus.d.ts.map +1 -0
- package/dist/src/accounts/adapters/nexus.js +227 -0
- package/dist/src/accounts/adapters/safe.d.ts +6 -0
- package/dist/src/accounts/adapters/safe.d.ts.map +1 -0
- package/dist/src/accounts/adapters/safe.js +194 -0
- package/dist/src/accounts/adapters/shared.d.ts +9 -0
- package/dist/src/accounts/adapters/shared.d.ts.map +1 -0
- package/dist/src/accounts/adapters/shared.js +62 -0
- package/dist/src/accounts/adapters/startale.d.ts +14 -0
- package/dist/src/accounts/adapters/startale.d.ts.map +1 -0
- package/dist/src/accounts/adapters/startale.js +165 -0
- package/dist/src/accounts/construction.d.ts +25 -0
- package/dist/src/accounts/construction.d.ts.map +1 -0
- package/dist/src/accounts/construction.js +34 -0
- package/dist/src/accounts/deployment.d.ts +12 -0
- package/dist/src/accounts/deployment.d.ts.map +1 -0
- package/dist/src/accounts/deployment.js +33 -0
- package/dist/src/accounts/erc7579-calls.d.ts +4 -0
- package/dist/src/accounts/erc7579-calls.d.ts.map +1 -0
- package/dist/src/accounts/erc7579-calls.js +57 -0
- package/dist/src/accounts/error.d.ts +1 -1
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/legacy.d.ts +14 -0
- package/dist/src/accounts/legacy.d.ts.map +1 -0
- package/dist/src/accounts/legacy.js +40 -0
- package/dist/src/accounts/registry.d.ts +4 -0
- package/dist/src/accounts/registry.d.ts.map +1 -0
- package/dist/src/accounts/registry.js +22 -0
- package/dist/src/accounts/types.d.ts +131 -0
- package/dist/src/accounts/types.d.ts.map +1 -0
- package/dist/src/accounts/wallet-account.d.ts +3 -0
- package/dist/src/accounts/wallet-account.d.ts.map +1 -0
- package/dist/src/accounts/wallet-account.js +12 -0
- package/dist/src/actions/deploy.d.ts +4 -0
- package/dist/src/actions/deploy.d.ts.map +1 -0
- package/dist/src/actions/deploy.js +8 -0
- package/dist/src/actions/ecdsa.d.ts +1 -1
- package/dist/src/actions/ecdsa.d.ts.map +1 -1
- package/dist/src/actions/ecdsa.js +8 -8
- package/dist/src/actions/index.d.ts +2 -16
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +3 -49
- package/dist/src/actions/mfa.d.ts +1 -1
- package/dist/src/actions/mfa.d.ts.map +1 -1
- package/dist/src/actions/mfa.js +30 -10
- package/dist/src/actions/modules.d.ts +4 -0
- package/dist/src/actions/modules.d.ts.map +1 -0
- package/dist/src/actions/modules.js +22 -0
- package/dist/src/actions/passkeys.d.ts +2 -2
- package/dist/src/actions/passkeys.d.ts.map +1 -1
- package/dist/src/actions/passkeys.js +19 -14
- package/dist/src/actions/runtime.d.ts +12 -0
- package/dist/src/actions/runtime.d.ts.map +1 -0
- package/dist/src/actions/runtime.js +161 -0
- package/dist/src/actions/smart-sessions.d.ts +2 -2
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +35 -12
- package/dist/src/api/account.d.ts +265 -0
- package/dist/src/api/account.d.ts.map +1 -0
- package/dist/src/api/account.js +640 -0
- package/dist/src/api/accounts.d.ts +12 -0
- package/dist/src/api/accounts.d.ts.map +1 -0
- package/dist/src/api/accounts.js +17 -0
- package/dist/src/api/compose-types.d.ts +147 -0
- package/dist/src/api/compose-types.d.ts.map +1 -0
- package/dist/src/api/compose.d.ts +6 -0
- package/dist/src/api/compose.d.ts.map +1 -0
- package/dist/src/api/compose.js +766 -0
- package/dist/src/api/direct-signing.d.ts +27 -0
- package/dist/src/api/direct-signing.d.ts.map +1 -0
- package/dist/src/api/direct-signing.js +191 -0
- package/dist/src/api/project-mappers.d.ts +7 -0
- package/dist/src/api/project-mappers.d.ts.map +1 -0
- package/dist/src/api/project-mappers.js +23 -0
- package/dist/src/api/queries/app-fees.d.ts +4 -0
- package/dist/src/api/queries/app-fees.d.ts.map +1 -0
- package/dist/src/api/queries/app-fees.js +3 -0
- package/dist/src/api/queries/portfolio.d.ts +9 -0
- package/dist/src/api/queries/portfolio.d.ts.map +1 -0
- package/dist/src/api/queries/portfolio.js +28 -0
- package/dist/src/api/queries/session.d.ts +8 -0
- package/dist/src/api/queries/session.d.ts.map +1 -0
- package/dist/src/api/queries/session.js +15 -0
- package/dist/src/api/sdk.d.ts +80 -0
- package/dist/src/api/sdk.d.ts.map +1 -0
- package/dist/src/api/sdk.js +103 -0
- package/dist/src/api/signer-selection.d.ts +7 -0
- package/dist/src/api/signer-selection.d.ts.map +1 -0
- package/dist/src/api/signer-selection.js +109 -0
- package/dist/src/calls/normalize.d.ts +9 -0
- package/dist/src/calls/normalize.d.ts.map +1 -0
- package/dist/src/calls/normalize.js +17 -0
- package/dist/src/calls/resolve.d.ts +3 -0
- package/dist/src/calls/resolve.d.ts.map +1 -0
- package/dist/src/calls/resolve.js +15 -0
- package/dist/src/calls/types.d.ts +25 -0
- package/dist/src/calls/types.d.ts.map +1 -0
- package/dist/src/calls/types.js +1 -0
- package/dist/src/chains/caip2.d.ts +10 -0
- package/dist/src/chains/caip2.d.ts.map +1 -0
- package/dist/src/chains/caip2.js +85 -0
- package/dist/src/chains/catalog.d.ts +5 -0
- package/dist/src/chains/catalog.d.ts.map +1 -0
- package/dist/src/chains/catalog.js +41 -0
- package/dist/src/chains/errors.d.ts +15 -0
- package/dist/src/chains/errors.d.ts.map +1 -0
- package/dist/src/chains/errors.js +21 -0
- package/dist/src/{orchestrator/destinations.d.ts → chains/non-evm.d.ts} +7 -5
- package/dist/src/chains/non-evm.d.ts.map +1 -0
- package/dist/src/chains/non-evm.js +30 -0
- package/dist/src/chains/tokens.d.ts +4 -0
- package/dist/src/chains/tokens.d.ts.map +1 -0
- package/dist/src/chains/tokens.js +22 -0
- package/dist/src/chains/types.d.ts +25 -0
- package/dist/src/chains/types.d.ts.map +1 -0
- package/dist/src/chains/types.js +1 -0
- package/dist/src/clients/bundler/client.d.ts +10 -0
- package/dist/src/clients/bundler/client.d.ts.map +1 -0
- package/dist/src/clients/bundler/client.js +85 -0
- package/dist/src/clients/bundler/endpoints.d.ts +3 -0
- package/dist/src/clients/bundler/endpoints.d.ts.map +1 -0
- package/dist/src/clients/bundler/endpoints.js +18 -0
- package/dist/src/clients/bundler/port.d.ts +22 -0
- package/dist/src/clients/bundler/port.d.ts.map +1 -0
- package/dist/src/clients/bundler/port.js +1 -0
- package/dist/src/clients/json-rpc.d.ts +20 -0
- package/dist/src/clients/json-rpc.d.ts.map +1 -0
- package/dist/src/clients/json-rpc.js +56 -0
- package/dist/src/clients/orchestrator/auth.d.ts +7 -0
- package/dist/src/clients/orchestrator/auth.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/auth.js +27 -0
- package/dist/src/{orchestrator → clients/orchestrator}/chain-catalog.d.ts +5 -3
- package/dist/src/clients/orchestrator/chain-catalog.d.ts.map +1 -0
- package/dist/src/{orchestrator → clients/orchestrator}/chain-catalog.js +24 -3
- package/dist/src/clients/orchestrator/client.d.ts +13 -0
- package/dist/src/clients/orchestrator/client.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/client.js +97 -0
- package/dist/src/{orchestrator/error.d.ts → clients/orchestrator/errors.d.ts} +2 -16
- package/dist/src/clients/orchestrator/errors.d.ts.map +1 -0
- package/dist/src/{orchestrator/error.js → clients/orchestrator/errors.js} +1 -22
- package/dist/src/clients/orchestrator/fetch.d.ts +7 -0
- package/dist/src/clients/orchestrator/fetch.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/fetch.js +37 -0
- package/dist/src/clients/orchestrator/mappers.d.ts +9 -0
- package/dist/src/clients/orchestrator/mappers.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/mappers.js +198 -0
- package/dist/src/clients/orchestrator/port.d.ts +26 -0
- package/dist/src/clients/orchestrator/port.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/port.js +1 -0
- package/dist/src/{orchestrator/types.d.ts → clients/orchestrator/public.d.ts} +16 -4
- package/dist/src/clients/orchestrator/public.d.ts.map +1 -0
- package/dist/src/{orchestrator/types.js → clients/orchestrator/public.js} +3 -0
- package/dist/src/clients/orchestrator/types.d.ts +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/{orchestrator → clients/orchestrator}/wire.gen.d.ts +1193 -499
- package/dist/src/clients/orchestrator/wire.gen.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/wire.gen.js +1 -0
- package/dist/src/clients/orchestrator/wire.js +1 -0
- package/dist/src/clients/paymaster/client.d.ts +8 -0
- package/dist/src/clients/paymaster/client.d.ts.map +1 -0
- package/dist/src/clients/paymaster/client.js +38 -0
- package/dist/src/clients/paymaster/endpoints.d.ts +3 -0
- package/dist/src/clients/paymaster/endpoints.d.ts.map +1 -0
- package/dist/src/clients/paymaster/endpoints.js +16 -0
- package/dist/src/clients/paymaster/port.d.ts +17 -0
- package/dist/src/clients/paymaster/port.d.ts.map +1 -0
- package/dist/src/clients/paymaster/port.js +1 -0
- package/dist/src/clients/rpc/client.d.ts +6 -0
- package/dist/src/clients/rpc/client.d.ts.map +1 -0
- package/dist/src/clients/rpc/client.js +66 -0
- package/dist/src/clients/rpc/compatibility.d.ts +12 -0
- package/dist/src/clients/rpc/compatibility.d.ts.map +1 -0
- package/dist/src/clients/rpc/compatibility.js +16 -0
- package/dist/src/clients/rpc/port.d.ts +13 -0
- package/dist/src/clients/rpc/port.d.ts.map +1 -0
- package/dist/src/clients/rpc/port.js +1 -0
- package/dist/src/clients/rpc/providers.d.ts +3 -0
- package/dist/src/clients/rpc/providers.d.ts.map +1 -0
- package/dist/src/clients/rpc/providers.js +8 -0
- package/dist/src/clients/rpc/transport.d.ts +4 -0
- package/dist/src/clients/rpc/transport.d.ts.map +1 -0
- package/dist/src/clients/rpc/transport.js +5 -0
- package/dist/src/clients/rpc/types.d.ts +23 -0
- package/dist/src/clients/rpc/types.d.ts.map +1 -0
- package/dist/src/clients/rpc/types.js +1 -0
- package/dist/src/config/account-runtime.d.ts +7 -0
- package/dist/src/config/account-runtime.d.ts.map +1 -0
- package/dist/src/config/account-runtime.js +36 -0
- package/dist/src/{types.d.ts → config/account.d.ts} +37 -14
- package/dist/src/config/account.d.ts.map +1 -0
- package/dist/src/config/account.js +10 -0
- package/dist/src/config/defaults.d.ts +14 -0
- package/dist/src/config/defaults.d.ts.map +1 -0
- package/dist/src/config/defaults.js +26 -0
- package/dist/src/config/input.d.ts +54 -0
- package/dist/src/config/input.d.ts.map +1 -0
- package/dist/src/config/input.js +1 -0
- package/dist/src/config/legacy.d.ts +22 -0
- package/dist/src/config/legacy.d.ts.map +1 -0
- package/dist/src/config/legacy.js +23 -0
- package/dist/src/config/resolve.d.ts +13 -0
- package/dist/src/config/resolve.d.ts.map +1 -0
- package/dist/src/config/resolve.js +174 -0
- package/dist/src/config/resolved.d.ts +77 -0
- package/dist/src/config/resolved.d.ts.map +1 -0
- package/dist/src/config/resolved.js +1 -0
- package/dist/src/config/validate.d.ts +3 -0
- package/dist/src/config/validate.d.ts.map +1 -0
- package/dist/src/config/validate.js +6 -0
- package/dist/src/{execution/error.d.ts → errors/execution.d.ts} +2 -2
- package/dist/src/errors/execution.d.ts.map +1 -0
- package/dist/src/{execution/error.js → errors/execution.js} +1 -1
- package/dist/src/errors/index.d.ts +4 -4
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +4 -3
- package/dist/src/index.d.ts +13 -324
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -286
- package/dist/src/modules/erc7579-abi.d.ts +4 -0
- package/dist/src/modules/erc7579-abi.d.ts.map +1 -0
- package/dist/src/modules/erc7579-abi.js +12 -0
- package/dist/src/modules/intent-executor.d.ts +6 -0
- package/dist/src/modules/intent-executor.d.ts.map +1 -0
- package/dist/src/modules/intent-executor.js +13 -0
- package/dist/src/modules/legacy-core.d.ts +29 -0
- package/dist/src/modules/legacy-core.d.ts.map +1 -0
- package/dist/src/modules/legacy-core.js +80 -0
- package/dist/src/modules/normalize.d.ts +4 -0
- package/dist/src/modules/normalize.d.ts.map +1 -0
- package/dist/src/modules/normalize.js +15 -0
- package/dist/src/modules/plan.d.ts +16 -0
- package/dist/src/modules/plan.d.ts.map +1 -0
- package/dist/src/modules/plan.js +51 -0
- package/dist/src/modules/read-core.d.ts +39 -0
- package/dist/src/modules/read-core.d.ts.map +1 -0
- package/dist/src/modules/read-core.js +149 -0
- package/dist/src/modules/types.d.ts +46 -0
- package/dist/src/modules/types.d.ts.map +1 -0
- package/dist/src/modules/types.js +1 -0
- package/dist/src/modules/validators/capabilities.d.ts +4 -0
- package/dist/src/modules/validators/capabilities.d.ts.map +1 -0
- package/dist/src/modules/validators/capabilities.js +58 -0
- package/dist/src/modules/validators/contribution.d.ts +4 -0
- package/dist/src/modules/validators/contribution.d.ts.map +1 -0
- package/dist/src/modules/validators/contribution.js +64 -0
- package/dist/src/modules/validators/definition.d.ts +3 -0
- package/dist/src/modules/validators/definition.d.ts.map +1 -0
- package/dist/src/modules/validators/definition.js +68 -0
- package/dist/src/modules/validators/ens.d.ts +5 -0
- package/dist/src/modules/validators/ens.d.ts.map +1 -0
- package/dist/src/modules/validators/ens.js +34 -0
- package/dist/src/modules/validators/k1.d.ts +2 -0
- package/dist/src/modules/validators/k1.d.ts.map +1 -0
- package/dist/src/modules/validators/k1.js +1 -0
- package/dist/src/modules/validators/multi-factor.d.ts +18 -0
- package/dist/src/modules/validators/multi-factor.d.ts.map +1 -0
- package/dist/src/modules/validators/multi-factor.js +79 -0
- package/dist/src/modules/validators/ownable.d.ts +26 -0
- package/dist/src/modules/validators/ownable.d.ts.map +1 -0
- package/dist/src/modules/validators/ownable.js +84 -0
- package/dist/src/modules/validators/permissions.d.ts +1 -1
- package/dist/src/modules/validators/permissions.d.ts.map +1 -1
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts +1 -1
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -1
- package/dist/src/modules/validators/policies/claim/arbiters.js +3 -1
- package/dist/src/modules/validators/resolve.d.ts +5 -0
- package/dist/src/modules/validators/resolve.d.ts.map +1 -0
- package/dist/src/modules/validators/resolve.js +22 -0
- package/dist/src/modules/validators/signer-id.d.ts +5 -0
- package/dist/src/modules/validators/signer-id.d.ts.map +1 -0
- package/dist/src/modules/validators/signer-id.js +8 -0
- package/dist/src/modules/validators/smart-session-signature-types.d.ts +35 -0
- package/dist/src/modules/validators/smart-session-signature-types.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-session-signature-types.js +1 -0
- package/dist/src/modules/validators/smart-sessions/authorization.d.ts +99 -0
- package/dist/src/modules/validators/smart-sessions/authorization.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/authorization.js +101 -0
- package/dist/src/modules/validators/smart-sessions/calls.d.ts +19 -0
- package/dist/src/modules/validators/smart-sessions/calls.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/calls.js +85 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.d.ts +4 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.js +77 -0
- package/dist/src/modules/validators/smart-sessions/digest.d.ts +5 -0
- package/dist/src/modules/validators/smart-sessions/digest.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/digest.js +30 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.d.ts +10 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.js +31 -0
- package/dist/src/modules/validators/smart-sessions/module.d.ts +11 -0
- package/dist/src/modules/validators/smart-sessions/module.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/module.js +18 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.d.ts +23 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.js +29 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.d.ts +10 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.js +106 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.d.ts +4 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.js +197 -0
- package/dist/src/modules/validators/smart-sessions/resolve.d.ts +16 -0
- package/dist/src/modules/validators/smart-sessions/resolve.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/resolve.js +120 -0
- package/dist/src/modules/validators/smart-sessions/signature.d.ts +14 -0
- package/dist/src/modules/validators/smart-sessions/signature.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/signature.js +167 -0
- package/dist/src/modules/validators/smart-sessions/state.d.ts +19 -0
- package/dist/src/modules/validators/smart-sessions/state.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/state.js +42 -0
- package/dist/src/modules/validators/smart-sessions/types.d.ts +227 -0
- package/dist/src/modules/validators/smart-sessions/types.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/types.js +1 -0
- package/dist/src/modules/validators/types.d.ts +143 -0
- package/dist/src/modules/validators/types.d.ts.map +1 -0
- package/dist/src/modules/validators/types.js +1 -0
- package/dist/src/modules/validators/webauthn.d.ts +54 -0
- package/dist/src/modules/validators/webauthn.d.ts.map +1 -0
- package/dist/src/modules/validators/webauthn.js +159 -0
- package/dist/src/signing/context.d.ts +25 -0
- package/dist/src/signing/context.d.ts.map +1 -0
- package/dist/src/signing/context.js +163 -0
- package/dist/src/signing/contribution.d.ts +13 -0
- package/dist/src/signing/contribution.d.ts.map +1 -0
- package/dist/src/signing/contribution.js +83 -0
- package/dist/src/signing/eip7702.d.ts +41 -0
- package/dist/src/signing/eip7702.d.ts.map +1 -0
- package/dist/src/signing/eip7702.js +215 -0
- package/dist/src/signing/error.d.ts +27 -0
- package/dist/src/signing/error.d.ts.map +1 -0
- package/dist/src/signing/error.js +25 -0
- package/dist/src/signing/execute.d.ts +17 -0
- package/dist/src/signing/execute.d.ts.map +1 -0
- package/dist/src/signing/execute.js +138 -0
- package/dist/src/signing/intent-plans/assemble.d.ts +15 -0
- package/dist/src/signing/intent-plans/assemble.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/assemble.js +96 -0
- package/dist/src/signing/intent-plans/independent.d.ts +48 -0
- package/dist/src/signing/intent-plans/independent.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/independent.js +150 -0
- package/dist/src/signing/intent-plans/plan.d.ts +14 -0
- package/dist/src/signing/intent-plans/plan.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/plan.js +187 -0
- package/dist/src/signing/intent-plans/types.d.ts +63 -0
- package/dist/src/signing/intent-plans/types.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/types.js +1 -0
- package/dist/src/signing/message.d.ts +28 -0
- package/dist/src/signing/message.d.ts.map +1 -0
- package/dist/src/signing/message.js +90 -0
- package/dist/src/signing/passkeys.d.ts +28 -0
- package/dist/src/signing/passkeys.d.ts.map +1 -0
- package/dist/src/signing/passkeys.js +17 -0
- package/dist/src/signing/plan.d.ts +35 -0
- package/dist/src/signing/plan.d.ts.map +1 -0
- package/dist/src/signing/plan.js +377 -0
- package/dist/src/signing/protocols/erc6492.d.ts +11 -0
- package/dist/src/signing/protocols/erc6492.d.ts.map +1 -0
- package/dist/src/signing/protocols/erc6492.js +24 -0
- package/dist/src/signing/protocols/erc7739.d.ts +17 -0
- package/dist/src/signing/protocols/erc7739.d.ts.map +1 -0
- package/dist/src/signing/protocols/erc7739.js +84 -0
- package/dist/src/signing/session-enable.d.ts +35 -0
- package/dist/src/signing/session-enable.d.ts.map +1 -0
- package/dist/src/signing/session-enable.js +62 -0
- package/dist/src/signing/signers/compatibility.d.ts +4 -0
- package/dist/src/signing/signers/compatibility.d.ts.map +1 -0
- package/dist/src/signing/signers/compatibility.js +51 -0
- package/dist/src/signing/signers/ecdsa.d.ts +14 -0
- package/dist/src/signing/signers/ecdsa.d.ts.map +1 -0
- package/dist/src/signing/signers/ecdsa.js +54 -0
- package/dist/src/signing/signers/registry.d.ts +7 -0
- package/dist/src/signing/signers/registry.d.ts.map +1 -0
- package/dist/src/signing/signers/registry.js +33 -0
- package/dist/src/signing/signers/types.d.ts +16 -0
- package/dist/src/signing/signers/types.d.ts.map +1 -0
- package/dist/src/signing/signers/types.js +1 -0
- package/dist/src/signing/signers/wallet-chain.d.ts +9 -0
- package/dist/src/signing/signers/wallet-chain.d.ts.map +1 -0
- package/dist/src/signing/signers/wallet-chain.js +15 -0
- package/dist/src/signing/signers/webauthn.d.ts +11 -0
- package/dist/src/signing/signers/webauthn.d.ts.map +1 -0
- package/dist/src/signing/signers/webauthn.js +14 -0
- package/dist/src/signing/typed-data.d.ts +39 -0
- package/dist/src/signing/typed-data.d.ts.map +1 -0
- package/dist/src/signing/typed-data.js +135 -0
- package/dist/src/signing/types.d.ts +346 -0
- package/dist/src/signing/types.d.ts.map +1 -0
- package/dist/src/signing/types.js +1 -0
- package/dist/src/signing/user-operation.d.ts +23 -0
- package/dist/src/signing/user-operation.d.ts.map +1 -0
- package/dist/src/signing/user-operation.js +61 -0
- package/dist/src/smart-sessions/index.d.ts +13 -3
- package/dist/src/smart-sessions/index.d.ts.map +1 -1
- package/dist/src/smart-sessions/index.js +44 -6
- package/dist/src/transactions/intents/account.d.ts +15 -0
- package/dist/src/transactions/intents/account.d.ts.map +1 -0
- package/dist/src/transactions/intents/account.js +48 -0
- package/dist/src/transactions/intents/compatibility.d.ts +4 -0
- package/dist/src/transactions/intents/compatibility.d.ts.map +1 -0
- package/dist/src/transactions/intents/compatibility.js +19 -0
- package/dist/src/transactions/intents/normalize.d.ts +5 -0
- package/dist/src/transactions/intents/normalize.d.ts.map +1 -0
- package/dist/src/transactions/intents/normalize.js +48 -0
- package/dist/src/transactions/intents/prepare.d.ts +7 -0
- package/dist/src/transactions/intents/prepare.d.ts.map +1 -0
- package/dist/src/transactions/intents/prepare.js +249 -0
- package/dist/src/transactions/intents/quotes.d.ts +3 -0
- package/dist/src/transactions/intents/quotes.d.ts.map +1 -0
- package/dist/src/transactions/intents/quotes.js +11 -0
- package/dist/src/transactions/intents/request.d.ts +11 -0
- package/dist/src/transactions/intents/request.d.ts.map +1 -0
- package/dist/src/transactions/intents/request.js +55 -0
- package/dist/src/transactions/intents/send.d.ts +3 -0
- package/dist/src/transactions/intents/send.d.ts.map +1 -0
- package/dist/src/transactions/intents/send.js +22 -0
- package/dist/src/transactions/intents/session-signing.d.ts +7 -0
- package/dist/src/transactions/intents/session-signing.d.ts.map +1 -0
- package/dist/src/transactions/intents/session-signing.js +363 -0
- package/dist/src/transactions/intents/sessions.d.ts +17 -0
- package/dist/src/transactions/intents/sessions.d.ts.map +1 -0
- package/dist/src/transactions/intents/sessions.js +85 -0
- package/dist/src/transactions/intents/sign-transaction.d.ts +10 -0
- package/dist/src/transactions/intents/sign-transaction.d.ts.map +1 -0
- package/dist/src/transactions/intents/sign-transaction.js +386 -0
- package/dist/src/transactions/intents/split.d.ts +13 -0
- package/dist/src/transactions/intents/split.d.ts.map +1 -0
- package/dist/src/transactions/intents/split.js +3 -0
- package/dist/src/transactions/intents/status-policy.d.ts +13 -0
- package/dist/src/transactions/intents/status-policy.d.ts.map +1 -0
- package/dist/src/transactions/intents/status-policy.js +39 -0
- package/dist/src/transactions/intents/status.d.ts +4 -0
- package/dist/src/transactions/intents/status.d.ts.map +1 -0
- package/dist/src/transactions/intents/status.js +50 -0
- package/dist/src/transactions/intents/submit.d.ts +3 -0
- package/dist/src/transactions/intents/submit.d.ts.map +1 -0
- package/dist/src/transactions/intents/submit.js +32 -0
- package/dist/src/transactions/intents/types.d.ts +136 -0
- package/dist/src/transactions/intents/types.d.ts.map +1 -0
- package/dist/src/transactions/intents/types.js +1 -0
- package/dist/src/transactions/user-operations/hash.d.ts +5 -0
- package/dist/src/transactions/user-operations/hash.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/hash.js +9 -0
- package/dist/src/transactions/user-operations/nonce.d.ts +18 -0
- package/dist/src/transactions/user-operations/nonce.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/nonce.js +43 -0
- package/dist/src/transactions/user-operations/prepare.d.ts +12 -0
- package/dist/src/transactions/user-operations/prepare.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/prepare.js +138 -0
- package/dist/src/transactions/user-operations/reconstruct.d.ts +28 -0
- package/dist/src/transactions/user-operations/reconstruct.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/reconstruct.js +52 -0
- package/dist/src/transactions/user-operations/send.d.ts +3 -0
- package/dist/src/transactions/user-operations/send.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/send.js +8 -0
- package/dist/src/transactions/user-operations/sign.d.ts +3 -0
- package/dist/src/transactions/user-operations/sign.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/sign.js +14 -0
- package/dist/src/transactions/user-operations/status.d.ts +4 -0
- package/dist/src/transactions/user-operations/status.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/status.js +37 -0
- package/dist/src/transactions/user-operations/submit.d.ts +3 -0
- package/dist/src/transactions/user-operations/submit.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/submit.js +8 -0
- package/dist/src/transactions/user-operations/types.d.ts +68 -0
- package/dist/src/transactions/user-operations/types.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/types.js +1 -0
- package/dist/src/transactions/user-operations/validator-account.d.ts +5 -0
- package/dist/src/transactions/user-operations/validator-account.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/validator-account.js +26 -0
- package/dist/src/utils/index.d.ts +9 -4
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +54 -51
- package/package.json +3 -3
- package/dist/src/accounts/hca.d.ts +0 -25
- package/dist/src/accounts/hca.d.ts.map +0 -1
- package/dist/src/accounts/hca.js +0 -148
- package/dist/src/accounts/index.d.ts +0 -64
- package/dist/src/accounts/index.d.ts.map +0 -1
- package/dist/src/accounts/index.js +0 -680
- package/dist/src/accounts/json-rpc/index.d.ts +0 -5
- package/dist/src/accounts/json-rpc/index.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.js +0 -13
- package/dist/src/accounts/json-rpc/providers.d.ts +0 -3
- package/dist/src/accounts/json-rpc/providers.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.js +0 -4
- package/dist/src/accounts/kernel.d.ts +0 -26
- package/dist/src/accounts/kernel.d.ts.map +0 -1
- package/dist/src/accounts/kernel.js +0 -265
- package/dist/src/accounts/nexus.d.ts +0 -34
- package/dist/src/accounts/nexus.d.ts.map +0 -1
- package/dist/src/accounts/nexus.js +0 -520
- package/dist/src/accounts/safe.d.ts +0 -32
- package/dist/src/accounts/safe.d.ts.map +0 -1
- package/dist/src/accounts/safe.js +0 -337
- package/dist/src/accounts/signing/common.d.ts +0 -38
- package/dist/src/accounts/signing/common.d.ts.map +0 -1
- package/dist/src/accounts/signing/common.js +0 -186
- package/dist/src/accounts/signing/message.d.ts +0 -7
- package/dist/src/accounts/signing/message.d.ts.map +0 -1
- package/dist/src/accounts/signing/message.js +0 -42
- package/dist/src/accounts/signing/passkeys.d.ts +0 -36
- package/dist/src/accounts/signing/passkeys.d.ts.map +0 -1
- package/dist/src/accounts/signing/passkeys.js +0 -119
- package/dist/src/accounts/signing/typedData.d.ts +0 -5
- package/dist/src/accounts/signing/typedData.d.ts.map +0 -1
- package/dist/src/accounts/signing/typedData.js +0 -30
- package/dist/src/accounts/startale.d.ts +0 -25
- package/dist/src/accounts/startale.d.ts.map +0 -1
- package/dist/src/accounts/startale.js +0 -188
- package/dist/src/accounts/utils.d.ts +0 -33
- package/dist/src/accounts/utils.d.ts.map +0 -1
- package/dist/src/accounts/utils.js +0 -202
- package/dist/src/auth/provider.d.ts +0 -7
- package/dist/src/auth/provider.d.ts.map +0 -1
- package/dist/src/auth/provider.js +0 -38
- package/dist/src/execution/compact.d.ts +0 -5
- package/dist/src/execution/compact.d.ts.map +0 -1
- package/dist/src/execution/compact.js +0 -4
- package/dist/src/execution/error.d.ts.map +0 -1
- package/dist/src/execution/index.d.ts +0 -42
- package/dist/src/execution/index.d.ts.map +0 -1
- package/dist/src/execution/index.js +0 -186
- package/dist/src/execution/utils.d.ts +0 -167
- package/dist/src/execution/utils.d.ts.map +0 -1
- package/dist/src/execution/utils.js +0 -1603
- package/dist/src/modules/abi/smart-sessions.d.ts +0 -104
- package/dist/src/modules/abi/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/abi/smart-sessions.js +0 -128
- package/dist/src/modules/chain-abstraction.d.ts +0 -5
- package/dist/src/modules/chain-abstraction.d.ts.map +0 -1
- package/dist/src/modules/chain-abstraction.js +0 -3
- package/dist/src/modules/common.d.ts +0 -30
- package/dist/src/modules/common.d.ts.map +0 -1
- package/dist/src/modules/common.js +0 -30
- package/dist/src/modules/index.d.ts +0 -11
- package/dist/src/modules/index.d.ts.map +0 -1
- package/dist/src/modules/index.js +0 -85
- package/dist/src/modules/legacy.d.ts +0 -10
- package/dist/src/modules/legacy.d.ts.map +0 -1
- package/dist/src/modules/legacy.js +0 -62
- package/dist/src/modules/read.d.ts +0 -11
- package/dist/src/modules/read.d.ts.map +0 -1
- package/dist/src/modules/read.js +0 -219
- package/dist/src/modules/validators/core.d.ts +0 -31
- package/dist/src/modules/validators/core.d.ts.map +0 -1
- package/dist/src/modules/validators/core.js +0 -269
- package/dist/src/modules/validators/cross-chain-permits.d.ts +0 -22
- package/dist/src/modules/validators/cross-chain-permits.d.ts.map +0 -1
- package/dist/src/modules/validators/cross-chain-permits.js +0 -107
- 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 -226
- package/dist/src/modules/validators/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.js +0 -1197
- package/dist/src/orchestrator/caip2.d.ts +0 -18
- package/dist/src/orchestrator/caip2.d.ts.map +0 -1
- package/dist/src/orchestrator/caip2.js +0 -58
- package/dist/src/orchestrator/chain-catalog.d.ts.map +0 -1
- package/dist/src/orchestrator/client.d.ts +0 -43
- package/dist/src/orchestrator/client.d.ts.map +0 -1
- package/dist/src/orchestrator/client.js +0 -336
- package/dist/src/orchestrator/consts.d.ts +0 -6
- package/dist/src/orchestrator/consts.d.ts.map +0 -1
- package/dist/src/orchestrator/consts.js +0 -5
- package/dist/src/orchestrator/destinations.d.ts.map +0 -1
- package/dist/src/orchestrator/destinations.js +0 -59
- package/dist/src/orchestrator/error.d.ts.map +0 -1
- package/dist/src/orchestrator/index.d.ts +0 -12
- 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 -7
- package/dist/src/orchestrator/registry.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.js +0 -46
- package/dist/src/orchestrator/types.d.ts.map +0 -1
- package/dist/src/orchestrator/utils.d.ts +0 -3
- package/dist/src/orchestrator/utils.d.ts.map +0 -1
- package/dist/src/orchestrator/utils.js +0 -22
- package/dist/src/orchestrator/wire.d.ts +0 -31
- package/dist/src/orchestrator/wire.d.ts.map +0 -1
- package/dist/src/orchestrator/wire.gen.d.ts.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/utils/walletClient.d.ts +0 -34
- package/dist/src/utils/walletClient.d.ts.map +0 -1
- package/dist/src/utils/walletClient.js +0 -117
- /package/dist/src/{orchestrator/wire.gen.js → accounts/adapter.js} +0 -0
- /package/dist/src/{types.js → accounts/types.js} +0 -0
- /package/dist/src/{orchestrator/wire.js → api/compose-types.js} +0 -0
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { bytesToHex, encodeAbiParameters, hexToBytes, keccak256, } from 'viem';
|
|
2
|
-
function parsePublicKey(publicKey) {
|
|
3
|
-
const bytes = typeof publicKey === 'string' ? hexToBytes(publicKey) : publicKey;
|
|
4
|
-
const offset = bytes.length === 65 ? 1 : 0;
|
|
5
|
-
const x = bytes.slice(offset, 32 + offset);
|
|
6
|
-
const y = bytes.slice(32 + offset, 64 + offset);
|
|
7
|
-
return {
|
|
8
|
-
x: BigInt(bytesToHex(x)),
|
|
9
|
-
y: BigInt(bytesToHex(y)),
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function parseSignature(signature) {
|
|
13
|
-
const bytes = typeof signature === 'string' ? hexToBytes(signature) : signature;
|
|
14
|
-
const r = bytes.slice(0, 32);
|
|
15
|
-
const s = bytes.slice(32, 64);
|
|
16
|
-
return {
|
|
17
|
-
r: BigInt(bytesToHex(r)),
|
|
18
|
-
s: BigInt(bytesToHex(s)),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function generateCredentialId(pubKeyX, pubKeyY, account) {
|
|
22
|
-
return keccak256(encodeAbiParameters([
|
|
23
|
-
{
|
|
24
|
-
type: 'uint256',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
type: 'uint256',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'address',
|
|
31
|
-
},
|
|
32
|
-
], [pubKeyX, pubKeyY, account]));
|
|
33
|
-
}
|
|
34
|
-
function packSignature(credIds, usePrecompile, webAuthns) {
|
|
35
|
-
// Sort both `credIds` and `webAuthns` by credIds
|
|
36
|
-
const credIdsAndWebAuthns = credIds.map((credId, index) => ({
|
|
37
|
-
credId,
|
|
38
|
-
webAuthn: webAuthns[index],
|
|
39
|
-
}));
|
|
40
|
-
credIdsAndWebAuthns.sort((a, b) => a.credId.localeCompare(b.credId));
|
|
41
|
-
credIds = credIdsAndWebAuthns.map(({ credId }) => credId);
|
|
42
|
-
webAuthns = credIdsAndWebAuthns.map(({ webAuthn }) => webAuthn);
|
|
43
|
-
// Encode
|
|
44
|
-
return encodeAbiParameters([
|
|
45
|
-
{
|
|
46
|
-
type: 'bytes32[]',
|
|
47
|
-
name: 'credIds',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: 'bool',
|
|
51
|
-
name: 'usePrecompile',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
type: 'tuple[]',
|
|
55
|
-
name: 'webAuthns',
|
|
56
|
-
components: [
|
|
57
|
-
{
|
|
58
|
-
type: 'bytes',
|
|
59
|
-
name: 'authenticatorData',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
type: 'string',
|
|
63
|
-
name: 'clientDataJSON',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
type: 'uint256',
|
|
67
|
-
name: 'challengeIndex',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: 'uint256',
|
|
71
|
-
name: 'typeIndex',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
type: 'uint256',
|
|
75
|
-
name: 'r',
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
type: 'uint256',
|
|
79
|
-
name: 's',
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
], [credIds, usePrecompile, webAuthns]);
|
|
84
|
-
}
|
|
85
|
-
function packSignatureV0(webauthn, usePrecompiled) {
|
|
86
|
-
return encodeAbiParameters([
|
|
87
|
-
{ type: 'bytes', name: 'authenticatorData' },
|
|
88
|
-
{
|
|
89
|
-
type: 'string',
|
|
90
|
-
name: 'clientDataJSON',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
type: 'uint256',
|
|
94
|
-
name: 'responseTypeLocation',
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
type: 'uint256',
|
|
98
|
-
name: 'r',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
type: 'uint256',
|
|
102
|
-
name: 's',
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
type: 'bool',
|
|
106
|
-
name: 'usePrecompiled',
|
|
107
|
-
},
|
|
108
|
-
], [
|
|
109
|
-
webauthn.authenticatorData,
|
|
110
|
-
webauthn.clientDataJSON,
|
|
111
|
-
typeof webauthn.typeIndex === 'bigint'
|
|
112
|
-
? webauthn.typeIndex
|
|
113
|
-
: BigInt(webauthn.typeIndex),
|
|
114
|
-
webauthn.r,
|
|
115
|
-
webauthn.s,
|
|
116
|
-
usePrecompiled,
|
|
117
|
-
]);
|
|
118
|
-
}
|
|
119
|
-
export { parsePublicKey, parseSignature, generateCredentialId, packSignature, packSignatureV0, };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Address, Chain, HashTypedDataParameters, Hex, TypedData } from 'viem';
|
|
2
|
-
import type { SignerSet } from '../../types.js';
|
|
3
|
-
declare function sign<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(signers: SignerSet, chain: Chain, address: Address, parameters: HashTypedDataParameters<typedData, primaryType>): Promise<Hex>;
|
|
4
|
-
export { sign };
|
|
5
|
-
//# sourceMappingURL=typedData.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typedData.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/typedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,OAAO,EACP,KAAK,EACL,uBAAuB,EACvB,GAAG,EACH,SAAS,EACV,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAI5C,iBAAe,IAAI,CACjB,SAAS,SAAS,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACjE,WAAW,SAAS,MAAM,SAAS,GAAG,cAAc,GAAG,MAAM,SAAS,EAEtE,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,uBAAuB,CAAC,SAAS,EAAE,WAAW,CAAC,GAC1D,OAAO,CAAC,GAAG,CAAC,CAwBd;AA6BD,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { SigningNotSupportedForAccountError } from '../error.js';
|
|
2
|
-
import { signWithOwners } from './common.js';
|
|
3
|
-
async function sign(signers, chain, address, parameters) {
|
|
4
|
-
const signingFunctions = {
|
|
5
|
-
signEcdsa: (account, params) => signEcdsa(account, params),
|
|
6
|
-
signPasskey: (account, params) => signPasskey(account, params),
|
|
7
|
-
};
|
|
8
|
-
switch (signers.type) {
|
|
9
|
-
case 'owner': {
|
|
10
|
-
return signWithOwners(signers, chain, address, parameters, signingFunctions, false, sign);
|
|
11
|
-
}
|
|
12
|
-
case 'experimental_session': {
|
|
13
|
-
throw new Error('Not supported');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
async function signEcdsa(account, parameters) {
|
|
18
|
-
if (!account.signTypedData) {
|
|
19
|
-
throw new SigningNotSupportedForAccountError();
|
|
20
|
-
}
|
|
21
|
-
return await account.signTypedData(parameters);
|
|
22
|
-
}
|
|
23
|
-
async function signPasskey(account, parameters) {
|
|
24
|
-
const { webauthn, signature } = await account.signTypedData(parameters);
|
|
25
|
-
return {
|
|
26
|
-
webauthn,
|
|
27
|
-
signature,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export { sign };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Address, Chain, Hex, PublicClient } from 'viem';
|
|
2
|
-
import type { Module } from '../modules/common.js';
|
|
3
|
-
import type { OwnerSet, RhinestoneAccountConfig } from '../types.js';
|
|
4
|
-
import type { ValidatorConfig } from './utils.js';
|
|
5
|
-
declare const K1_DEFAULT_VALIDATOR_ADDRESS: Address;
|
|
6
|
-
declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
7
|
-
factory: `0x${string}`;
|
|
8
|
-
factoryData: `0x${string}`;
|
|
9
|
-
salt: `0x${string}`;
|
|
10
|
-
implementation: `0x${string}`;
|
|
11
|
-
initializationCallData: `0x${string}`;
|
|
12
|
-
} | null;
|
|
13
|
-
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
14
|
-
declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
|
|
15
|
-
name: string;
|
|
16
|
-
version: string;
|
|
17
|
-
chainId: number;
|
|
18
|
-
verifyingContract: `0x${string}`;
|
|
19
|
-
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
20
|
-
};
|
|
21
|
-
declare function getInstallData(module: Module): `0x${string}`;
|
|
22
|
-
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
23
|
-
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
24
|
-
export { K1_DEFAULT_VALIDATOR_ADDRESS, getEip712Domain, getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, };
|
|
25
|
-
//# sourceMappingURL=startale.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"startale.d.ts","sourceRoot":"","sources":["../../../accounts/startale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAc7D,OAAO,KAAK,EAAe,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE5D,OAAO,KAAK,EAEV,QAAQ,EACR,uBAAuB,EAExB,MAAM,UAAU,CAAA;AAOjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,QAAA,MAAM,4BAA4B,EAAE,OACU,CAAA;AAW9C,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;SAwErD;AAoFD,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBAmClD;AAED,iBAAS,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK;;;;;;EAWrE;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,iBAErC;AAED,iBAAe,aAAa,CAC1B,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,eAAe,EAC1B,kBAAkB,GAAE,CAAC,SAAS,EAAE,GAAG,KAAK,GAA8B,0BAQvE;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,QAAQ,EAChB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAUlC;AAED,OAAO,EACL,4BAA4B,EAC5B,eAAe,EACf,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,GAChB,CAAA"}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { concat, decodeFunctionData, encodeAbiParameters, encodeFunctionData, encodePacked, keccak256, parseAbi, slice, zeroAddress, zeroHash, } from 'viem';
|
|
2
|
-
import { getSetup as getModuleSetup } from '../modules/index.js';
|
|
3
|
-
import { getOwnerValidator } from '../modules/validators/core.js';
|
|
4
|
-
import { AccountConfigurationNotSupportedError } from './error.js';
|
|
5
|
-
import { getInstallData as getNexusInstallData, getSmartAccount as getNexusSmartAccount, packSignature as packNexusSignature, } from './nexus.js';
|
|
6
|
-
const K1_DEFAULT_VALIDATOR_ADDRESS = '0x00000072f286204bb934ed49d8969e86f7dec7b1';
|
|
7
|
-
const STARTALE_VERSION = '1.0.0';
|
|
8
|
-
const IMPLEMENTATION_ADDRESS = '0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a';
|
|
9
|
-
const FACTORY_ADDRESS = '0x0000003b3e7b530b4f981ae80d9350392defef90';
|
|
10
|
-
const BOOTSTRAP_ADDRESS = '0x000000552a5fae3db7a8f3917c435448f49ba6a9';
|
|
11
|
-
const CREATION_CODE = '0x608060405261029d803803806100148161018c565b92833981016040828203126101885781516001600160a01b03811692909190838303610188576020810151906001600160401b03821161018857019281601f8501121561018857835161006e610069826101c5565b61018c565b9481865260208601936020838301011161018857815f926020809301865e8601015260017f754fd8b321c4649cb777ae6fdce7e89e9cceaa31a4f639795c7807eb7f1a27005d823b15610176577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916821790557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b5f80a282511561015e575f8091610146945190845af43d15610156573d91610137610069846101c5565b9283523d5f602085013e6101e0565b505b604051605e908161023f8239f35b6060916101e0565b50505034156101485763b398979f60e01b5f5260045ffd5b634c9c8ce360e01b5f5260045260245ffd5b5f80fd5b6040519190601f01601f191682016001600160401b038111838210176101b157604052565b634e487b7160e01b5f52604160045260245ffd5b6001600160401b0381116101b157601f01601f191660200190565b9061020457508051156101f557805190602001fd5b63d6bda27560e01b5f5260045ffd5b81511580610235575b610215575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b1561020d56fe60806040523615605c575f8073ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5416368280378136915af43d5f803e156058573d5ff35b3d5ffd5b00';
|
|
12
|
-
function getDeployArgs(config) {
|
|
13
|
-
if (config.initData) {
|
|
14
|
-
if (!('factory' in config.initData)) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const { factory, factoryData } = config.initData;
|
|
18
|
-
try {
|
|
19
|
-
const decoded = decodeFunctionData({
|
|
20
|
-
abi: parseAbi(['function createAccount(bytes,bytes32)']),
|
|
21
|
-
data: factoryData,
|
|
22
|
-
});
|
|
23
|
-
const initData = decoded.args[0];
|
|
24
|
-
const salt = decoded.args[1];
|
|
25
|
-
const initializationCallData = encodeFunctionData({
|
|
26
|
-
abi: parseAbi(['function initializeAccount(bytes)']),
|
|
27
|
-
functionName: 'initializeAccount',
|
|
28
|
-
args: [initData],
|
|
29
|
-
});
|
|
30
|
-
return {
|
|
31
|
-
factory,
|
|
32
|
-
factoryData,
|
|
33
|
-
salt,
|
|
34
|
-
implementation: IMPLEMENTATION_ADDRESS,
|
|
35
|
-
initializationCallData,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const account = config.account;
|
|
43
|
-
const salt = account?.salt ?? zeroHash;
|
|
44
|
-
const moduleSetup = getModuleSetup(config);
|
|
45
|
-
const ownerValidator = getOwnerValidator(config);
|
|
46
|
-
const isK1 = ownerValidator.address.toLowerCase() ===
|
|
47
|
-
K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
|
|
48
|
-
if (isK1 &&
|
|
49
|
-
config.owners &&
|
|
50
|
-
'accounts' in config.owners &&
|
|
51
|
-
config.owners.accounts.length > 1) {
|
|
52
|
-
throw new AccountConfigurationNotSupportedError('K1 validator only supports a single owner', 'startale');
|
|
53
|
-
}
|
|
54
|
-
const initData = isK1
|
|
55
|
-
? getK1InitData(config, moduleSetup)
|
|
56
|
-
: getOwnableInitData(moduleSetup);
|
|
57
|
-
const factoryData = encodeFunctionData({
|
|
58
|
-
abi: parseAbi(['function createAccount(bytes,bytes32)']),
|
|
59
|
-
functionName: 'createAccount',
|
|
60
|
-
args: [initData, salt],
|
|
61
|
-
});
|
|
62
|
-
const initializationCallData = encodeFunctionData({
|
|
63
|
-
abi: parseAbi(['function initializeAccount(bytes)']),
|
|
64
|
-
functionName: 'initializeAccount',
|
|
65
|
-
args: [initData],
|
|
66
|
-
});
|
|
67
|
-
return {
|
|
68
|
-
factory: FACTORY_ADDRESS,
|
|
69
|
-
factoryData,
|
|
70
|
-
salt,
|
|
71
|
-
implementation: IMPLEMENTATION_ADDRESS,
|
|
72
|
-
initializationCallData,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function getK1InitData(config, moduleSetup) {
|
|
76
|
-
const ownerAddress = config.owners.accounts[0]
|
|
77
|
-
.address;
|
|
78
|
-
const validators = moduleSetup.validators.filter((v) => v.address.toLowerCase() !== K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase());
|
|
79
|
-
return encodeAbiParameters([{ type: 'address' }, { type: 'bytes' }], [
|
|
80
|
-
BOOTSTRAP_ADDRESS,
|
|
81
|
-
encodeFunctionData({
|
|
82
|
-
abi: parseAbi([
|
|
83
|
-
'struct BootstrapConfig {address module;bytes initData;}',
|
|
84
|
-
'struct BootstrapPreValidationHookConfig {uint256 hookType;address module;bytes data;}',
|
|
85
|
-
'function initWithDefaultValidatorAndOtherModules(bytes calldata defaultValidatorInitData,BootstrapConfig[] calldata validators,BootstrapConfig[] calldata executors,BootstrapConfig calldata hook,BootstrapConfig[] calldata fallbacks,BootstrapPreValidationHookConfig[] calldata preValidationHooks) external payable',
|
|
86
|
-
]),
|
|
87
|
-
functionName: 'initWithDefaultValidatorAndOtherModules',
|
|
88
|
-
args: [
|
|
89
|
-
ownerAddress,
|
|
90
|
-
validators.map((v) => ({
|
|
91
|
-
module: v.address,
|
|
92
|
-
initData: v.initData,
|
|
93
|
-
})),
|
|
94
|
-
moduleSetup.executors.map((e) => ({
|
|
95
|
-
module: e.address,
|
|
96
|
-
initData: e.initData,
|
|
97
|
-
})),
|
|
98
|
-
{
|
|
99
|
-
module: zeroAddress,
|
|
100
|
-
initData: zeroHash,
|
|
101
|
-
},
|
|
102
|
-
moduleSetup.fallbacks.map((f) => ({
|
|
103
|
-
module: f.address,
|
|
104
|
-
initData: f.initData,
|
|
105
|
-
})),
|
|
106
|
-
[],
|
|
107
|
-
],
|
|
108
|
-
}),
|
|
109
|
-
]);
|
|
110
|
-
}
|
|
111
|
-
function getOwnableInitData(moduleSetup) {
|
|
112
|
-
return encodeAbiParameters([{ type: 'address' }, { type: 'bytes' }], [
|
|
113
|
-
BOOTSTRAP_ADDRESS,
|
|
114
|
-
encodeFunctionData({
|
|
115
|
-
abi: parseAbi([
|
|
116
|
-
'struct BootstrapConfig {address module;bytes initData;}',
|
|
117
|
-
'struct BootstrapPreValidationHookConfig {uint256 hookType;address module;bytes data;}',
|
|
118
|
-
'function init(BootstrapConfig[] calldata validators,BootstrapConfig[] calldata executors,BootstrapConfig calldata hook,BootstrapConfig[] calldata fallbacks,BootstrapPreValidationHookConfig[] calldata preValidationHooks) external',
|
|
119
|
-
]),
|
|
120
|
-
functionName: 'init',
|
|
121
|
-
args: [
|
|
122
|
-
moduleSetup.validators.map((v) => ({
|
|
123
|
-
module: v.address,
|
|
124
|
-
initData: v.initData,
|
|
125
|
-
})),
|
|
126
|
-
moduleSetup.executors.map((e) => ({
|
|
127
|
-
module: e.address,
|
|
128
|
-
initData: e.initData,
|
|
129
|
-
})),
|
|
130
|
-
{
|
|
131
|
-
module: zeroAddress,
|
|
132
|
-
initData: '0x',
|
|
133
|
-
},
|
|
134
|
-
moduleSetup.fallbacks.map((f) => ({
|
|
135
|
-
module: f.address,
|
|
136
|
-
initData: f.initData,
|
|
137
|
-
})),
|
|
138
|
-
[],
|
|
139
|
-
],
|
|
140
|
-
}),
|
|
141
|
-
]);
|
|
142
|
-
}
|
|
143
|
-
function getAddress(config) {
|
|
144
|
-
const deployArgs = getDeployArgs(config);
|
|
145
|
-
if (!deployArgs) {
|
|
146
|
-
if (config.initData?.address) {
|
|
147
|
-
return config.initData.address;
|
|
148
|
-
}
|
|
149
|
-
throw new Error('Cannot derive address: deploy args not available');
|
|
150
|
-
}
|
|
151
|
-
const { factory, salt, initializationCallData } = deployArgs;
|
|
152
|
-
const accountInitData = encodeAbiParameters([
|
|
153
|
-
{
|
|
154
|
-
name: 'address',
|
|
155
|
-
type: 'address',
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
name: 'calldata',
|
|
159
|
-
type: 'bytes',
|
|
160
|
-
},
|
|
161
|
-
], [IMPLEMENTATION_ADDRESS, initializationCallData]);
|
|
162
|
-
const hashedInitcode = keccak256(concat([CREATION_CODE, accountInitData]));
|
|
163
|
-
const hash = keccak256(encodePacked(['bytes1', 'address', 'bytes32', 'bytes'], ['0xff', factory, salt, hashedInitcode]));
|
|
164
|
-
const address = slice(hash, 12, 32);
|
|
165
|
-
return address;
|
|
166
|
-
}
|
|
167
|
-
function getEip712Domain(config, chain) {
|
|
168
|
-
// Works for adopted accounts too: getAddress resolves the initData cases
|
|
169
|
-
// (returns initData.address, or recomputes the CREATE2 address from
|
|
170
|
-
// initData.factory/factoryData).
|
|
171
|
-
return {
|
|
172
|
-
name: 'Startale',
|
|
173
|
-
version: STARTALE_VERSION,
|
|
174
|
-
chainId: chain.id,
|
|
175
|
-
verifyingContract: getAddress(config),
|
|
176
|
-
salt: zeroHash,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function getInstallData(module) {
|
|
180
|
-
return getNexusInstallData(module);
|
|
181
|
-
}
|
|
182
|
-
async function packSignature(signature, validator, transformSignature = (signature) => signature) {
|
|
183
|
-
return packNexusSignature(signature, validator, transformSignature, K1_DEFAULT_VALIDATOR_ADDRESS);
|
|
184
|
-
}
|
|
185
|
-
async function getSmartAccount(client, address, owners, validatorAddress, sign) {
|
|
186
|
-
return getNexusSmartAccount(client, address, owners, validatorAddress, sign, K1_DEFAULT_VALIDATOR_ADDRESS);
|
|
187
|
-
}
|
|
188
|
-
export { K1_DEFAULT_VALIDATOR_ADDRESS, getEip712Domain, getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Address, Client, Hex } from 'viem';
|
|
2
|
-
import type { RhinestoneConfig } from '../types.js';
|
|
3
|
-
import { createTransport } from './json-rpc/index.js';
|
|
4
|
-
type CallType = 'call' | 'delegatecall' | 'batchcall';
|
|
5
|
-
interface ValidatorConfig {
|
|
6
|
-
address: Address;
|
|
7
|
-
isRoot: boolean;
|
|
8
|
-
}
|
|
9
|
-
interface ExecutionMode<callType extends CallType> {
|
|
10
|
-
type: callType;
|
|
11
|
-
revertOnError?: boolean;
|
|
12
|
-
selector?: Hex;
|
|
13
|
-
context?: Hex;
|
|
14
|
-
}
|
|
15
|
-
interface EncodeCallDataParams<callType extends CallType> {
|
|
16
|
-
mode: ExecutionMode<callType>;
|
|
17
|
-
callData: readonly {
|
|
18
|
-
to: Address;
|
|
19
|
-
value?: bigint | undefined;
|
|
20
|
-
data?: Hex | undefined;
|
|
21
|
-
}[];
|
|
22
|
-
}
|
|
23
|
-
interface GetAccountNonceParams {
|
|
24
|
-
address: Address;
|
|
25
|
-
entryPointAddress: Address;
|
|
26
|
-
key?: bigint;
|
|
27
|
-
}
|
|
28
|
-
declare function encode7579Calls<callType extends CallType>({ mode, callData, }: EncodeCallDataParams<callType>): Hex;
|
|
29
|
-
declare function getAccountNonce(client: Client, args: GetAccountNonceParams): Promise<bigint>;
|
|
30
|
-
declare function getBundlerClient(config: RhinestoneConfig, client: Client): import("viem/account-abstraction").BundlerClient<import("viem").HttpTransport<undefined, false>, undefined, undefined, Client, undefined>;
|
|
31
|
-
export { encode7579Calls, getAccountNonce, getBundlerClient, createTransport };
|
|
32
|
-
export type { ValidatorConfig };
|
|
33
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../accounts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAgBhD,OAAO,KAAK,EAAkC,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,KAAK,QAAQ,GAAG,MAAM,GAAG,cAAc,GAAG,WAAW,CAAA;AAErD,UAAU,eAAe;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,UAAU,aAAa,CAAC,QAAQ,SAAS,QAAQ;IAC/C,IAAI,EAAE,QAAQ,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,GAAG,CAAA;IACd,OAAO,CAAC,EAAE,GAAG,CAAA;CACd;AAED,UAAU,oBAAoB,CAAC,QAAQ,SAAS,QAAQ;IACtD,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IAC7B,QAAQ,EAAE,SAAS;QACjB,EAAE,EAAE,OAAO,CAAA;QACX,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,EAAE,GAAG,GAAG,SAAS,CAAA;KACvB,EAAE,CAAA;CACJ;AAED,UAAU,qBAAqB;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAkDD,iBAAS,eAAe,CAAC,QAAQ,SAAS,QAAQ,EAAE,EAClD,IAAI,EACJ,QAAQ,GACT,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,GAAG,CAuFtC;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAmCjB;AAED,iBAAS,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,6IAuDjE;AAyBD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAA;AAC9E,YAAY,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { concatHex, encodeAbiParameters, encodeFunctionData, encodePacked, http, toBytes, toHex, } from 'viem';
|
|
2
|
-
import { createBundlerClient, createPaymasterClient, } from 'viem/account-abstraction';
|
|
3
|
-
import { readContract } from 'viem/actions';
|
|
4
|
-
import { getAction } from 'viem/utils';
|
|
5
|
-
import { createTransport } from './json-rpc/index.js';
|
|
6
|
-
function parseCallType(callType) {
|
|
7
|
-
switch (callType) {
|
|
8
|
-
case 'call':
|
|
9
|
-
return '0x00';
|
|
10
|
-
case 'batchcall':
|
|
11
|
-
return '0x01';
|
|
12
|
-
case 'delegatecall':
|
|
13
|
-
return '0xff';
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function encodeExecutionMode({ type, revertOnError, selector, context, }) {
|
|
17
|
-
return encodePacked(['bytes1', 'bytes1', 'bytes4', 'bytes4', 'bytes22'], [
|
|
18
|
-
toHex(toBytes(parseCallType(type), { size: 1 })),
|
|
19
|
-
toHex(toBytes(revertOnError ? '0x01' : '0x00', { size: 1 })),
|
|
20
|
-
toHex(toBytes('0x0', { size: 4 })),
|
|
21
|
-
toHex(toBytes(selector ?? '0x', { size: 4 })),
|
|
22
|
-
toHex(toBytes(context ?? '0x', { size: 22 })),
|
|
23
|
-
]);
|
|
24
|
-
}
|
|
25
|
-
function encode7579Calls({ mode, callData, }) {
|
|
26
|
-
if (callData.length > 1 && mode?.type !== 'batchcall') {
|
|
27
|
-
throw new Error(`mode ${JSON.stringify(mode)} does not supported for batchcall calldata`);
|
|
28
|
-
}
|
|
29
|
-
const executeAbi = [
|
|
30
|
-
{
|
|
31
|
-
type: 'function',
|
|
32
|
-
name: 'execute',
|
|
33
|
-
inputs: [
|
|
34
|
-
{
|
|
35
|
-
name: 'execMode',
|
|
36
|
-
type: 'bytes32',
|
|
37
|
-
internalType: 'ExecMode',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'executionCalldata',
|
|
41
|
-
type: 'bytes',
|
|
42
|
-
internalType: 'bytes',
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
outputs: [],
|
|
46
|
-
stateMutability: 'payable',
|
|
47
|
-
},
|
|
48
|
-
];
|
|
49
|
-
if (callData.length > 1) {
|
|
50
|
-
return encodeFunctionData({
|
|
51
|
-
abi: executeAbi,
|
|
52
|
-
functionName: 'execute',
|
|
53
|
-
args: [
|
|
54
|
-
encodeExecutionMode(mode),
|
|
55
|
-
encodeAbiParameters([
|
|
56
|
-
{
|
|
57
|
-
name: 'executionBatch',
|
|
58
|
-
type: 'tuple[]',
|
|
59
|
-
components: [
|
|
60
|
-
{
|
|
61
|
-
name: 'target',
|
|
62
|
-
type: 'address',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: 'value',
|
|
66
|
-
type: 'uint256',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'callData',
|
|
70
|
-
type: 'bytes',
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
], [
|
|
75
|
-
callData.map((arg) => {
|
|
76
|
-
return {
|
|
77
|
-
target: arg.to,
|
|
78
|
-
value: arg.value ?? 0n,
|
|
79
|
-
callData: arg.data ?? '0x',
|
|
80
|
-
};
|
|
81
|
-
}),
|
|
82
|
-
]),
|
|
83
|
-
],
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
const call = callData.length === 0 ? undefined : callData[0];
|
|
87
|
-
if (!call) {
|
|
88
|
-
throw new Error('No calls to encode');
|
|
89
|
-
}
|
|
90
|
-
return encodeFunctionData({
|
|
91
|
-
abi: executeAbi,
|
|
92
|
-
functionName: 'execute',
|
|
93
|
-
args: [
|
|
94
|
-
encodeExecutionMode(mode),
|
|
95
|
-
concatHex([
|
|
96
|
-
call.to,
|
|
97
|
-
toHex(call.value ?? 0n, { size: 32 }),
|
|
98
|
-
call.data ?? '0x',
|
|
99
|
-
]),
|
|
100
|
-
],
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
async function getAccountNonce(client, args) {
|
|
104
|
-
const { address, entryPointAddress, key = 0n } = args;
|
|
105
|
-
return await getAction(client, readContract, 'readContract')({
|
|
106
|
-
address: entryPointAddress,
|
|
107
|
-
abi: [
|
|
108
|
-
{
|
|
109
|
-
inputs: [
|
|
110
|
-
{
|
|
111
|
-
name: 'sender',
|
|
112
|
-
type: 'address',
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: 'key',
|
|
116
|
-
type: 'uint192',
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
name: 'getNonce',
|
|
120
|
-
outputs: [
|
|
121
|
-
{
|
|
122
|
-
name: 'nonce',
|
|
123
|
-
type: 'uint256',
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
stateMutability: 'view',
|
|
127
|
-
type: 'function',
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
functionName: 'getNonce',
|
|
131
|
-
args: [address, key],
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
function getBundlerClient(config, client) {
|
|
135
|
-
function getBundlerEndpoint(config, chainId) {
|
|
136
|
-
switch (config.type) {
|
|
137
|
-
case 'pimlico':
|
|
138
|
-
return `https://api.pimlico.io/v2/${chainId}/rpc?apikey=${config.apiKey}`;
|
|
139
|
-
case 'biconomy':
|
|
140
|
-
return `https://bundler.biconomy.io/api/v3/${chainId}/${config.apiKey}`;
|
|
141
|
-
case 'custom':
|
|
142
|
-
return typeof config.url === 'string' ? config.url : config.url[chainId];
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function getPaymasterEndpoint(config, chainId) {
|
|
146
|
-
switch (config.type) {
|
|
147
|
-
case 'pimlico':
|
|
148
|
-
return `https://api.pimlico.io/v2/${chainId}/rpc?apikey=${config.apiKey}`;
|
|
149
|
-
case 'biconomy':
|
|
150
|
-
return `https://paymaster.biconomy.io/api/v2/${chainId}/${config.apiKey}`;
|
|
151
|
-
case 'custom':
|
|
152
|
-
return typeof config.url === 'string' ? config.url : config.url[chainId];
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
const { bundler, paymaster } = config;
|
|
156
|
-
const chainId = client.chain?.id;
|
|
157
|
-
if (!chainId) {
|
|
158
|
-
throw new Error('Chain id is required');
|
|
159
|
-
}
|
|
160
|
-
const endpoint = bundler
|
|
161
|
-
? getBundlerEndpoint(bundler, chainId)
|
|
162
|
-
: `https://public.pimlico.io/v2/${chainId}/rpc`;
|
|
163
|
-
const paymasterEndpoint = paymaster
|
|
164
|
-
? getPaymasterEndpoint(paymaster, chainId)
|
|
165
|
-
: undefined;
|
|
166
|
-
const isCustomBundler = bundler?.type === 'custom';
|
|
167
|
-
return createBundlerClient({
|
|
168
|
-
client,
|
|
169
|
-
transport: http(endpoint),
|
|
170
|
-
paymaster: paymasterEndpoint
|
|
171
|
-
? createPaymasterClient({
|
|
172
|
-
transport: http(paymasterEndpoint),
|
|
173
|
-
})
|
|
174
|
-
: undefined,
|
|
175
|
-
userOperation: isCustomBundler
|
|
176
|
-
? undefined
|
|
177
|
-
: {
|
|
178
|
-
estimateFeesPerGas: () => getGasPriceEstimate(endpoint),
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
async function getGasPriceEstimate(bundlerUrl) {
|
|
183
|
-
const response = await fetch(bundlerUrl, {
|
|
184
|
-
method: 'POST',
|
|
185
|
-
headers: {
|
|
186
|
-
'Content-Type': 'application/json',
|
|
187
|
-
},
|
|
188
|
-
body: JSON.stringify({
|
|
189
|
-
jsonrpc: '2.0',
|
|
190
|
-
id: Date.now(),
|
|
191
|
-
// TODO do not rely on vendor-specific methods
|
|
192
|
-
method: 'pimlico_getUserOperationGasPrice',
|
|
193
|
-
params: [],
|
|
194
|
-
}),
|
|
195
|
-
});
|
|
196
|
-
const json = (await response.json());
|
|
197
|
-
return {
|
|
198
|
-
maxFeePerGas: BigInt(json.result.fast.maxFeePerGas),
|
|
199
|
-
maxPriorityFeePerGas: BigInt(json.result.fast.maxPriorityFeePerGas),
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
export { encode7579Calls, getAccountNonce, getBundlerClient, createTransport };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { RhinestoneConfig, RhinestoneSDKConfig } from '../types.js';
|
|
2
|
-
export interface AuthProvider {
|
|
3
|
-
getHeaders(): Promise<Record<string, string>>;
|
|
4
|
-
getSubmitHeaders(intentInput: unknown, isSponsored: boolean): Promise<Record<string, string>>;
|
|
5
|
-
}
|
|
6
|
-
export declare function createAuthProvider(config: RhinestoneSDKConfig | RhinestoneConfig): AuthProvider;
|
|
7
|
-
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../auth/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,YAAY;IAC3B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC7C,gBAAgB,CACd,WAAW,EAAE,OAAO,EACpB,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACnC;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,mBAAmB,GAAG,gBAAgB,GAC7C,YAAY,CAqCd"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export function createAuthProvider(config) {
|
|
2
|
-
const resolved = resolveAuth(config);
|
|
3
|
-
if (resolved.mode === 'apiKey') {
|
|
4
|
-
const headers = { 'x-api-key': resolved.apiKey };
|
|
5
|
-
return {
|
|
6
|
-
getHeaders: async () => headers,
|
|
7
|
-
getSubmitHeaders: async () => headers,
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
const { accessToken, getIntentExtensionToken } = resolved;
|
|
11
|
-
const resolveAccessToken = async () => typeof accessToken === 'function' ? await accessToken() : accessToken;
|
|
12
|
-
return {
|
|
13
|
-
async getHeaders() {
|
|
14
|
-
const token = await resolveAccessToken();
|
|
15
|
-
return { Authorization: `Bearer ${token}`, 'x-api-key': 'jwt' };
|
|
16
|
-
},
|
|
17
|
-
async getSubmitHeaders(intentInput, isSponsored) {
|
|
18
|
-
const token = await resolveAccessToken();
|
|
19
|
-
const headers = {
|
|
20
|
-
Authorization: `Bearer ${token}`,
|
|
21
|
-
'x-api-key': 'jwt',
|
|
22
|
-
};
|
|
23
|
-
if (isSponsored && getIntentExtensionToken) {
|
|
24
|
-
const extensionToken = await getIntentExtensionToken(intentInput);
|
|
25
|
-
headers['X-Intent-Extension'] = `Bearer ${extensionToken}`;
|
|
26
|
-
}
|
|
27
|
-
return headers;
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function resolveAuth(config) {
|
|
32
|
-
if ('auth' in config && config.auth)
|
|
33
|
-
return config.auth;
|
|
34
|
-
if ('apiKey' in config && config.apiKey) {
|
|
35
|
-
return { mode: 'apiKey', apiKey: config.apiKey };
|
|
36
|
-
}
|
|
37
|
-
throw new Error('RhinestoneSDK requires either `apiKey` or `auth` in config');
|
|
38
|
-
}
|