@rhinestone/sdk 2.0.0-beta.44 → 2.0.0-beta.45
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 +635 -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} +4 -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 +140 -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 +498 -498
- 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} +23 -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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Hex, type SignableMessage, type TypedDataDefinition } from 'viem';
|
|
2
|
+
import type { AccountRuntime } from '../accounts/adapter.js';
|
|
3
|
+
import type { EvmChainReference } from '../chains/types.js';
|
|
4
|
+
import type { ResolvedSessionSignerSet } from '../modules/validators/smart-sessions/types.js';
|
|
5
|
+
import type { OwnerSignerSelection, SignerInvocationPort, SigningCheckpointPort, SigningTranscript } from '../signing/types.js';
|
|
6
|
+
interface RuntimeSigningInput {
|
|
7
|
+
readonly chain: EvmChainReference;
|
|
8
|
+
readonly runtime: AccountRuntime;
|
|
9
|
+
readonly signerInvoker: SignerInvocationPort;
|
|
10
|
+
readonly checkpoints: SigningCheckpointPort;
|
|
11
|
+
readonly selection?: OwnerSignerSelection;
|
|
12
|
+
readonly session?: ResolvedSessionSignerSet;
|
|
13
|
+
}
|
|
14
|
+
export declare function signRuntimeMessage(input: RuntimeSigningInput & {
|
|
15
|
+
readonly message: SignableMessage;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
readonly signature: Hex;
|
|
18
|
+
readonly transcript: SigningTranscript;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function signRuntimeTypedData(input: RuntimeSigningInput & {
|
|
21
|
+
readonly typedData: TypedDataDefinition;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
readonly signature: Hex;
|
|
24
|
+
readonly transcript: SigningTranscript;
|
|
25
|
+
}>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=direct-signing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct-signing.d.ts","sourceRoot":"","sources":["../../../api/direct-signing.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,GAAG,EAGR,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAEzB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAIxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAA;AAa1F,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AAEzB,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAA;IAC5C,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAA;IAC3C,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAA;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,wBAAwB,CAAA;CAC5C;AAED,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,mBAAmB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GACjE,OAAO,CAAC;IACT,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAA;IACvB,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAA;CACvC,CAAC,CA4ED;AAED,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,mBAAmB,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;CAAE,GACvE,OAAO,CAAC;IACT,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAA;IACvB,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAA;CACvC,CAAC,CAyDD"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { encodePacked, hashMessage, pad, zeroHash, } from 'viem';
|
|
2
|
+
import { wrapKernelMessageHash } from '../accounts/adapters/kernel.js';
|
|
3
|
+
import { defineValidator } from '../modules/validators/definition.js';
|
|
4
|
+
import { getPermissionId } from '../modules/validators/smart-sessions/digest.js';
|
|
5
|
+
import { getSmartSessionEmissaryAddress } from '../modules/validators/smart-sessions/module.js';
|
|
6
|
+
import { createAccountSigningContext, getAccountSignatureRoute, getSigningValidatorCodec, } from '../signing/context.js';
|
|
7
|
+
import { signAccountMessage } from '../signing/message.js';
|
|
8
|
+
import { createValidatorSigningTasks, signingTopology } from '../signing/plan.js';
|
|
9
|
+
import { resolveAccountTypedDataSigning, signAccountTypedData, } from '../signing/typed-data.js';
|
|
10
|
+
export async function signRuntimeMessage(input) {
|
|
11
|
+
const selection = input.session
|
|
12
|
+
? sessionOwnerSelection(input.session)
|
|
13
|
+
: input.selection;
|
|
14
|
+
const context = createAccountSigningContext({
|
|
15
|
+
runtime: input.runtime,
|
|
16
|
+
purpose: 'erc1271',
|
|
17
|
+
signerInvoker: input.signerInvoker,
|
|
18
|
+
...(selection ? { selection } : {}),
|
|
19
|
+
});
|
|
20
|
+
const topology = signingTopology(context.validator, selection?.signerIds);
|
|
21
|
+
const payload = hashMessage(input.message);
|
|
22
|
+
const accountHash = input.runtime.construction.account.kind === 'kernel'
|
|
23
|
+
? wrapKernelMessageHash(payload, context.account.address)
|
|
24
|
+
: payload;
|
|
25
|
+
const signingMaterial = input.session
|
|
26
|
+
? {
|
|
27
|
+
kind: 'message',
|
|
28
|
+
message: {
|
|
29
|
+
raw: hashMessage({
|
|
30
|
+
raw: encodePacked(['bytes32', 'bytes32'], [pad(context.account.address, { size: 32 }), accountHash]),
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
: input.runtime.construction.account.kind === 'kernel'
|
|
35
|
+
? {
|
|
36
|
+
kind: 'message',
|
|
37
|
+
message: { raw: accountHash },
|
|
38
|
+
}
|
|
39
|
+
: undefined;
|
|
40
|
+
const route = getAccountSignatureRoute(input.runtime, context);
|
|
41
|
+
return signAccountMessage({
|
|
42
|
+
context,
|
|
43
|
+
checkpoints: input.checkpoints,
|
|
44
|
+
planInput: {
|
|
45
|
+
message: input.message,
|
|
46
|
+
...(signingMaterial ? { signingMaterial } : {}),
|
|
47
|
+
chain: input.chain,
|
|
48
|
+
...topology,
|
|
49
|
+
tasks: createValidatorSigningTasks({
|
|
50
|
+
validator: context.validator,
|
|
51
|
+
signerReferences: context.signerReferences,
|
|
52
|
+
taskPrefix: 'message',
|
|
53
|
+
ecdsaInvocation: 'ecdsa-sign-message',
|
|
54
|
+
webauthnInvocation: 'webauthn-sign-hash',
|
|
55
|
+
...(selection ? { selectedSignerIds: selection.signerIds } : {}),
|
|
56
|
+
}),
|
|
57
|
+
route: input.session
|
|
58
|
+
? {
|
|
59
|
+
...route,
|
|
60
|
+
validatorCodec: {
|
|
61
|
+
kind: 'smart-session',
|
|
62
|
+
validator: {
|
|
63
|
+
kind: 'validator',
|
|
64
|
+
address: getSmartSessionEmissaryAddress(input.runtime.construction.sessions.environment),
|
|
65
|
+
},
|
|
66
|
+
mode: 'notarized',
|
|
67
|
+
permissionId: getPermissionId(input.session.session),
|
|
68
|
+
signerCodec: requireSessionOwnerCodec(getSigningValidatorCodec(context)),
|
|
69
|
+
},
|
|
70
|
+
accountEnvelope: smartSessionEnvelope(route.accountEnvelope, input.runtime.construction.sessions.environment),
|
|
71
|
+
}
|
|
72
|
+
: route,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
export async function signRuntimeTypedData(input) {
|
|
77
|
+
const selection = input.session
|
|
78
|
+
? sessionOwnerSelection(input.session)
|
|
79
|
+
: input.selection;
|
|
80
|
+
const context = createAccountSigningContext({
|
|
81
|
+
runtime: input.runtime,
|
|
82
|
+
purpose: 'erc1271',
|
|
83
|
+
signerInvoker: input.signerInvoker,
|
|
84
|
+
...(selection ? { selection } : {}),
|
|
85
|
+
});
|
|
86
|
+
const topology = signingTopology(context.validator, selection?.signerIds);
|
|
87
|
+
const typedData = input.session
|
|
88
|
+
? sessionTypedData(input.typedData, input.runtime, input.chain)
|
|
89
|
+
: input.typedData;
|
|
90
|
+
const route = resolveAccountTypedDataSigning({
|
|
91
|
+
typedData,
|
|
92
|
+
chain: input.chain,
|
|
93
|
+
context,
|
|
94
|
+
});
|
|
95
|
+
const accountRoute = getAccountSignatureRoute(input.runtime, context, route.erc7739, route.payloadKind);
|
|
96
|
+
return signAccountTypedData({
|
|
97
|
+
context,
|
|
98
|
+
checkpoints: input.checkpoints,
|
|
99
|
+
planInput: {
|
|
100
|
+
typedData,
|
|
101
|
+
signingMaterial: route.material,
|
|
102
|
+
chain: input.chain,
|
|
103
|
+
...topology,
|
|
104
|
+
tasks: createValidatorSigningTasks({
|
|
105
|
+
validator: context.validator,
|
|
106
|
+
signerReferences: context.signerReferences,
|
|
107
|
+
taskPrefix: 'typed-data',
|
|
108
|
+
ecdsaInvocation: route.ecdsaInvocation,
|
|
109
|
+
webauthnInvocation: route.webauthnInvocation,
|
|
110
|
+
...(selection ? { selectedSignerIds: selection.signerIds } : {}),
|
|
111
|
+
}),
|
|
112
|
+
route: input.session
|
|
113
|
+
? {
|
|
114
|
+
...accountRoute,
|
|
115
|
+
erc7739: {
|
|
116
|
+
kind: 'wrap-session-typed-data',
|
|
117
|
+
typedData: input.typedData,
|
|
118
|
+
permissionId: getPermissionId(input.session.session),
|
|
119
|
+
},
|
|
120
|
+
accountEnvelope: smartSessionEnvelope(accountRoute.accountEnvelope, input.runtime.construction.sessions.environment),
|
|
121
|
+
}
|
|
122
|
+
: accountRoute,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function sessionOwnerSelection(session) {
|
|
127
|
+
const validator = defineValidator(session.session.owners, 'smart-session-validator');
|
|
128
|
+
return {
|
|
129
|
+
kind: 'owner',
|
|
130
|
+
validator,
|
|
131
|
+
signerIds: validator.kind === 'multi-factor'
|
|
132
|
+
? validator.validators.flatMap((factor) => factor.owners.map(({ signerId }) => signerId))
|
|
133
|
+
: validator.owners.map(({ signerId }) => signerId),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function requireSessionOwnerCodec(codec) {
|
|
137
|
+
if (codec.kind === 'smart-session') {
|
|
138
|
+
throw new Error('A Smart Session owner cannot use a session validator');
|
|
139
|
+
}
|
|
140
|
+
return codec;
|
|
141
|
+
}
|
|
142
|
+
function smartSessionEnvelope(envelope, environment) {
|
|
143
|
+
if (envelope.kind === 'none')
|
|
144
|
+
return envelope;
|
|
145
|
+
const validator = getSmartSessionEmissaryAddress(environment);
|
|
146
|
+
return envelope.kind === 'kernel'
|
|
147
|
+
? { ...envelope, validator, isRoot: false }
|
|
148
|
+
: { ...envelope, validator };
|
|
149
|
+
}
|
|
150
|
+
function sessionTypedData(typedData, runtime, chain) {
|
|
151
|
+
const verifier = sessionVerifierDomain(runtime, chain);
|
|
152
|
+
return {
|
|
153
|
+
domain: typedData.domain,
|
|
154
|
+
primaryType: 'TypedDataSign',
|
|
155
|
+
types: {
|
|
156
|
+
...typedData.types,
|
|
157
|
+
TypedDataSign: [
|
|
158
|
+
{ name: 'contents', type: typedData.primaryType },
|
|
159
|
+
{ name: 'name', type: 'string' },
|
|
160
|
+
{ name: 'version', type: 'string' },
|
|
161
|
+
{ name: 'chainId', type: 'uint256' },
|
|
162
|
+
{ name: 'verifyingContract', type: 'address' },
|
|
163
|
+
{ name: 'salt', type: 'bytes32' },
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
message: {
|
|
167
|
+
contents: typedData.message,
|
|
168
|
+
...verifier,
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function sessionVerifierDomain(runtime, chain) {
|
|
173
|
+
const common = {
|
|
174
|
+
chainId: chain.id,
|
|
175
|
+
verifyingContract: runtime.identity.address,
|
|
176
|
+
salt: zeroHash,
|
|
177
|
+
};
|
|
178
|
+
switch (runtime.construction.account.kind) {
|
|
179
|
+
case 'safe':
|
|
180
|
+
return { ...common, name: 'rhinestone safe7579', version: 'v1.0.0' };
|
|
181
|
+
case 'nexus':
|
|
182
|
+
case 'hca':
|
|
183
|
+
return { ...common, name: 'Nexus', version: '1.2.0' };
|
|
184
|
+
case 'kernel':
|
|
185
|
+
return { ...common, name: 'Kernel', version: '0.3.3' };
|
|
186
|
+
case 'startale':
|
|
187
|
+
return { ...common, name: 'Startale', version: '1.0.0' };
|
|
188
|
+
case 'eoa':
|
|
189
|
+
throw new Error('EOA accounts do not have an EIP-712 domain');
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SplitIntentsInput, SplitIntentsResult } from '../clients/orchestrator/public.js';
|
|
2
|
+
import type { OrchestratorSplitRequest, OrchestratorSplitResult } from '../clients/orchestrator/types.js';
|
|
3
|
+
import type { IntentStatus, TransactionStatus } from '../transactions/intents/types.js';
|
|
4
|
+
export declare function toPublicTransactionStatus(status: IntentStatus): TransactionStatus;
|
|
5
|
+
export declare function toOrchestratorSplitRequest(input: SplitIntentsInput): OrchestratorSplitRequest;
|
|
6
|
+
export declare function toPublicSplitResult(result: OrchestratorSplitResult): SplitIntentsResult;
|
|
7
|
+
//# sourceMappingURL=project-mappers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-mappers.d.ts","sourceRoot":"","sources":["../../../api/project-mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,+BAA+B,CAAA;AAEtC,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,GACnB,iBAAiB,CAOnB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,iBAAiB,GACvB,wBAAwB,CAQ1B;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,uBAAuB,GAC9B,kBAAkB,CAKpB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function toPublicTransactionStatus(status) {
|
|
2
|
+
return {
|
|
3
|
+
traceId: status.traceId,
|
|
4
|
+
status: status.status,
|
|
5
|
+
accountAddress: status.account,
|
|
6
|
+
operations: [...status.operations],
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function toOrchestratorSplitRequest(input) {
|
|
10
|
+
return {
|
|
11
|
+
chainId: input.chain.id,
|
|
12
|
+
tokens: input.tokens,
|
|
13
|
+
...(input.settlementLayers
|
|
14
|
+
? { settlementLayers: input.settlementLayers }
|
|
15
|
+
: {}),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function toPublicSplitResult(result) {
|
|
19
|
+
return {
|
|
20
|
+
traceId: result.traceId,
|
|
21
|
+
intents: result.intents.map((intent) => ({ ...intent })),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProjectQueryPort } from '../../clients/orchestrator/port.js';
|
|
2
|
+
import type { OrchestratorAppFeeBalances } from '../../clients/orchestrator/types.js';
|
|
3
|
+
export declare function getAppFeeBalances(client: ProjectQueryPort): Promise<OrchestratorAppFeeBalances>;
|
|
4
|
+
//# sourceMappingURL=app-fees.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-fees.d.ts","sourceRoot":"","sources":["../../../../api/queries/app-fees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAA;AAElF,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,0BAA0B,CAAC,CAErC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AccountRuntimePort } from '../../accounts/adapter.js';
|
|
2
|
+
import type { AccountQueryPort, ChainCatalogPort } from '../../clients/orchestrator/port.js';
|
|
3
|
+
import type { OrchestratorPortfolio } from '../../clients/orchestrator/types.js';
|
|
4
|
+
export declare function getPortfolio(input: {
|
|
5
|
+
readonly account: AccountRuntimePort;
|
|
6
|
+
readonly client: AccountQueryPort & ChainCatalogPort;
|
|
7
|
+
readonly onTestnets: boolean;
|
|
8
|
+
}): Promise<OrchestratorPortfolio>;
|
|
9
|
+
//# sourceMappingURL=portfolio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolio.d.ts","sourceRoot":"","sources":["../../../../api/queries/portfolio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAEhE,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAE7E,wBAAsB,YAAY,CAAC,KAAK,EAAE;IACxC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAA;IACpC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAAA;IACpD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAC7B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA6BjC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { toEvmChainReference } from '../../chains/caip2.js';
|
|
2
|
+
export async function getPortfolio(input) {
|
|
3
|
+
// Filter on the catalog's own `testnet` flag — authoritative for every chain
|
|
4
|
+
// the orchestrator supports (incl. non-EVM and chains newer than the SDK's
|
|
5
|
+
// viem). Filtering through viem would silently drop unknown chains, so their
|
|
6
|
+
// balances would disappear until an SDK/viem bump.
|
|
7
|
+
const catalog = await input.client.getChainCatalog();
|
|
8
|
+
const chainIds = catalog
|
|
9
|
+
.getSupportedChainIds()
|
|
10
|
+
.filter((chainId) => catalog.isTestnet(chainId) === input.onTestnets);
|
|
11
|
+
const accountChainId = chainIds.find((chainId) => {
|
|
12
|
+
try {
|
|
13
|
+
toEvmChainReference(chainId);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
if (accountChainId === undefined) {
|
|
21
|
+
throw new Error('No EVM chain is available for portfolio account resolution');
|
|
22
|
+
}
|
|
23
|
+
const runtime = await input.account.forChain(toEvmChainReference(accountChainId));
|
|
24
|
+
return input.client.getPortfolio({
|
|
25
|
+
account: runtime.identity.address,
|
|
26
|
+
chainIds,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChainCatalogPort } from '../../clients/orchestrator/port.js';
|
|
2
|
+
import type { Session, SessionDefinition } from '../../modules/validators/smart-sessions/types.js';
|
|
3
|
+
export declare function createSession(input: {
|
|
4
|
+
readonly orchestrator: ChainCatalogPort;
|
|
5
|
+
readonly environment: 'production' | 'development';
|
|
6
|
+
readonly definition: SessionDefinition;
|
|
7
|
+
}): Promise<Session>;
|
|
8
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../api/queries/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAEvE,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EAClB,MAAM,+CAA+C,CAAA;AAEtD,wBAAsB,aAAa,CAAC,KAAK,EAAE;IACzC,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAA;IACvC,QAAQ,CAAC,WAAW,EAAE,YAAY,GAAG,aAAa,CAAA;IAClD,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAA;CACvC,GAAG,OAAO,CAAC,OAAO,CAAC,CAiBnB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { toSession } from '../../modules/validators/smart-sessions/resolve.js';
|
|
2
|
+
export async function createSession(input) {
|
|
3
|
+
const catalog = await input.orchestrator.getChainCatalog();
|
|
4
|
+
const wrappedNativeToken = catalog.getWrappedNativeToken(input.definition.chain.id)?.address;
|
|
5
|
+
// Fail fast: without the wrapped-native address we can't add the native-wrap
|
|
6
|
+
// `deposit()` permission, and a silently under-scoped session would
|
|
7
|
+
// sign/enable fine but break native-wrap intents later.
|
|
8
|
+
if (!wrappedNativeToken) {
|
|
9
|
+
throw new Error(`createSession: the orchestrator's /chains has no wrapped-native token for chain ${input.definition.chain.id}. The chain must be supported and advertise its wrappedNativeToken.`);
|
|
10
|
+
}
|
|
11
|
+
return toSession(input.definition, {
|
|
12
|
+
wrappedNativeToken,
|
|
13
|
+
environment: input.environment,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { AppFeeBalances, SplitIntentsInput, SplitIntentsResult } from '../clients/orchestrator/public.js';
|
|
2
|
+
import type { RhinestoneAccountConfig, RhinestoneSDKConfig } from '../config/account.js';
|
|
3
|
+
import type { Session, SessionDefinition } from '../modules/validators/smart-sessions/types.js';
|
|
4
|
+
import type { TransactionStatus } from '../transactions/intents/types.js';
|
|
5
|
+
import type { RhinestoneAccount } from './account.js';
|
|
6
|
+
/**
|
|
7
|
+
* Stateful entry point that holds shared configuration (auth, provider,
|
|
8
|
+
* bundler, paymaster) and creates accounts from it, delegating all work to the
|
|
9
|
+
* SDK-core composition.
|
|
10
|
+
*/
|
|
11
|
+
declare class RhinestoneSDK {
|
|
12
|
+
#private;
|
|
13
|
+
private authProvider;
|
|
14
|
+
private endpointUrl;
|
|
15
|
+
private provider;
|
|
16
|
+
private bundler;
|
|
17
|
+
private paymaster;
|
|
18
|
+
private useDevContracts;
|
|
19
|
+
private headers;
|
|
20
|
+
/**
|
|
21
|
+
* Create a Rhinestone SDK instance.
|
|
22
|
+
* @param options Shared configuration applied to every account created by this instance
|
|
23
|
+
*/
|
|
24
|
+
constructor(options: RhinestoneSDKConfig);
|
|
25
|
+
/**
|
|
26
|
+
* Create an account using this instance's shared configuration.
|
|
27
|
+
* @param config Per-account configuration (owners, account type, modules, sessions)
|
|
28
|
+
* @returns The account instance
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { RhinestoneSDK } from '@rhinestone/sdk'
|
|
32
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
33
|
+
*
|
|
34
|
+
* const owner = privateKeyToAccount('0x...')
|
|
35
|
+
*
|
|
36
|
+
* const sdk = new RhinestoneSDK({
|
|
37
|
+
* auth: { mode: 'apiKey', apiKey: process.env.RHINESTONE_API_KEY! },
|
|
38
|
+
* })
|
|
39
|
+
*
|
|
40
|
+
* const account = await sdk.createAccount({
|
|
41
|
+
* owners: { type: 'ecdsa', accounts: [owner] },
|
|
42
|
+
* })
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
createAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
46
|
+
/**
|
|
47
|
+
* Get the current status of a submitted intent.
|
|
48
|
+
* @param intentId The intent ID returned when the transaction was submitted
|
|
49
|
+
* @returns The intent status
|
|
50
|
+
*/
|
|
51
|
+
getIntentStatus(intentId: string): Promise<TransactionStatus>;
|
|
52
|
+
/**
|
|
53
|
+
* Split a transaction into multiple intents across chains.
|
|
54
|
+
* @param input The intents to split
|
|
55
|
+
* @returns The split-intents result
|
|
56
|
+
*/
|
|
57
|
+
splitIntents(input: SplitIntentsInput): Promise<SplitIntentsResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Get the integrator's accrued app-fee balance, as USD totals.
|
|
60
|
+
*
|
|
61
|
+
* App fees are earned by the integrator identified by this instance's API key
|
|
62
|
+
* (project-scoped, not tied to any account) and valued in USD at the moment
|
|
63
|
+
* each fee is collected, so the balance is not affected by later price
|
|
64
|
+
* movements of the collected tokens.
|
|
65
|
+
* @returns The withdrawable and pending app-fee balances in USD
|
|
66
|
+
*/
|
|
67
|
+
getAppFeeBalances(): Promise<AppFeeBalances>;
|
|
68
|
+
/**
|
|
69
|
+
* Create a smart session, resolving the chain's wrapped-native token from the
|
|
70
|
+
* orchestrator's chain catalog (`GET /chains`) so native-token wrapping is
|
|
71
|
+
* permitted automatically. Project-scoped — needs the API key but no account.
|
|
72
|
+
* For a fully offline build, use the standalone {@link toSession} and pass
|
|
73
|
+
* `wrappedNativeToken` yourself.
|
|
74
|
+
* @param definition The session definition
|
|
75
|
+
* @returns The resolved session
|
|
76
|
+
*/
|
|
77
|
+
createSession(definition: SessionDefinition): Promise<Session>;
|
|
78
|
+
}
|
|
79
|
+
export { RhinestoneSDK };
|
|
80
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../api/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EAClB,MAAM,4CAA4C,CAAA;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAQlD;;;;GAIG;AACH,cAAM,aAAa;;IAKjB,OAAO,CAAC,YAAY,CAAA;IACpB,OAAO,CAAC,WAAW,CAAA;IACnB,OAAO,CAAC,QAAQ,CAAA;IAChB,OAAO,CAAC,OAAO,CAAA;IACf,OAAO,CAAC,SAAS,CAAA;IACjB,OAAO,CAAC,eAAe,CAAA;IACvB,OAAO,CAAC,OAAO,CAAA;IAEf;;;OAGG;gBACS,OAAO,EAAE,mBAAmB;IAYxC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,aAAa,CACjB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,iBAAiB,CAAC;IAI7B;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAM7D;;;;OAIG;IACH,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAMnE;;;;;;;;OAQG;IACH,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC;IAI5C;;;;;;;;OAQG;IACH,aAAa,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;CAG/D;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { attachAccount, composeSdk } from './accounts.js';
|
|
2
|
+
import { toOrchestratorSplitRequest, toPublicSplitResult, toPublicTransactionStatus, } from './project-mappers.js';
|
|
3
|
+
/**
|
|
4
|
+
* Stateful entry point that holds shared configuration (auth, provider,
|
|
5
|
+
* bundler, paymaster) and creates accounts from it, delegating all work to the
|
|
6
|
+
* SDK-core composition.
|
|
7
|
+
*/
|
|
8
|
+
class RhinestoneSDK {
|
|
9
|
+
#sdk;
|
|
10
|
+
// Retained shared-config slots. The composition owns the resolved values;
|
|
11
|
+
// these mirror the published field surface and let the instance answer
|
|
12
|
+
// config questions without re-reaching into the composition internals.
|
|
13
|
+
authProvider;
|
|
14
|
+
endpointUrl;
|
|
15
|
+
provider;
|
|
16
|
+
bundler;
|
|
17
|
+
paymaster;
|
|
18
|
+
useDevContracts;
|
|
19
|
+
headers;
|
|
20
|
+
/**
|
|
21
|
+
* Create a Rhinestone SDK instance.
|
|
22
|
+
* @param options Shared configuration applied to every account created by this instance
|
|
23
|
+
*/
|
|
24
|
+
constructor(options) {
|
|
25
|
+
const input = options;
|
|
26
|
+
this.provider = input.provider;
|
|
27
|
+
this.bundler = input.bundler;
|
|
28
|
+
this.paymaster = input.paymaster;
|
|
29
|
+
this.endpointUrl = input.endpointUrl;
|
|
30
|
+
this.useDevContracts = input.useDevContracts;
|
|
31
|
+
this.headers = input.headers;
|
|
32
|
+
this.#sdk = composeSdk(input);
|
|
33
|
+
this.authProvider = this.#sdk.snapshot.authProvider;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Create an account using this instance's shared configuration.
|
|
37
|
+
* @param config Per-account configuration (owners, account type, modules, sessions)
|
|
38
|
+
* @returns The account instance
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { RhinestoneSDK } from '@rhinestone/sdk'
|
|
42
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
43
|
+
*
|
|
44
|
+
* const owner = privateKeyToAccount('0x...')
|
|
45
|
+
*
|
|
46
|
+
* const sdk = new RhinestoneSDK({
|
|
47
|
+
* auth: { mode: 'apiKey', apiKey: process.env.RHINESTONE_API_KEY! },
|
|
48
|
+
* })
|
|
49
|
+
*
|
|
50
|
+
* const account = await sdk.createAccount({
|
|
51
|
+
* owners: { type: 'ecdsa', accounts: [owner] },
|
|
52
|
+
* })
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
async createAccount(config) {
|
|
56
|
+
return attachAccount(this.#sdk, config);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get the current status of a submitted intent.
|
|
60
|
+
* @param intentId The intent ID returned when the transaction was submitted
|
|
61
|
+
* @returns The intent status
|
|
62
|
+
*/
|
|
63
|
+
getIntentStatus(intentId) {
|
|
64
|
+
return this.#sdk.composition.project
|
|
65
|
+
.getIntentStatus(intentId)
|
|
66
|
+
.then(toPublicTransactionStatus);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Split a transaction into multiple intents across chains.
|
|
70
|
+
* @param input The intents to split
|
|
71
|
+
* @returns The split-intents result
|
|
72
|
+
*/
|
|
73
|
+
splitIntents(input) {
|
|
74
|
+
return this.#sdk.composition.project
|
|
75
|
+
.splitIntents(toOrchestratorSplitRequest(input))
|
|
76
|
+
.then(toPublicSplitResult);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get the integrator's accrued app-fee balance, as USD totals.
|
|
80
|
+
*
|
|
81
|
+
* App fees are earned by the integrator identified by this instance's API key
|
|
82
|
+
* (project-scoped, not tied to any account) and valued in USD at the moment
|
|
83
|
+
* each fee is collected, so the balance is not affected by later price
|
|
84
|
+
* movements of the collected tokens.
|
|
85
|
+
* @returns The withdrawable and pending app-fee balances in USD
|
|
86
|
+
*/
|
|
87
|
+
getAppFeeBalances() {
|
|
88
|
+
return this.#sdk.composition.project.getAppFeeBalances();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create a smart session, resolving the chain's wrapped-native token from the
|
|
92
|
+
* orchestrator's chain catalog (`GET /chains`) so native-token wrapping is
|
|
93
|
+
* permitted automatically. Project-scoped — needs the API key but no account.
|
|
94
|
+
* For a fully offline build, use the standalone {@link toSession} and pass
|
|
95
|
+
* `wrappedNativeToken` yourself.
|
|
96
|
+
* @param definition The session definition
|
|
97
|
+
* @returns The resolved session
|
|
98
|
+
*/
|
|
99
|
+
createSession(definition) {
|
|
100
|
+
return this.#sdk.composition.project.createSession(definition);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export { RhinestoneSDK };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SignerSet } from '../config/account.js';
|
|
2
|
+
import type { ResolvedAccountConfig } from '../config/resolved.js';
|
|
3
|
+
import type { OwnerSignerSelection } from '../signing/types.js';
|
|
4
|
+
import type { IntentSessionSelection } from '../transactions/intents/types.js';
|
|
5
|
+
export type AdaptedSignerSelection = OwnerSignerSelection | IntentSessionSelection;
|
|
6
|
+
export declare function adaptSignerSelection(account: ResolvedAccountConfig, signers: SignerSet): AdaptedSignerSelection;
|
|
7
|
+
//# sourceMappingURL=signer-selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer-selection.d.ts","sourceRoot":"","sources":["../../../api/signer-selection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAW/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAI3E,MAAM,MAAM,sBAAsB,GAC9B,oBAAoB,GACpB,sBAAsB,CAAA;AAE1B,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,SAAS,GACjB,sBAAsB,CAKxB"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { defineValidator } from '../modules/validators/definition.js';
|
|
2
|
+
import { ecdsaSignerId, webauthnSignerId, } from '../modules/validators/signer-id.js';
|
|
3
|
+
export function adaptSignerSelection(account, signers) {
|
|
4
|
+
if (signers.type === 'experimental_session') {
|
|
5
|
+
return adaptSessionSelection(signers);
|
|
6
|
+
}
|
|
7
|
+
return adaptOwnerSelection(account, signers);
|
|
8
|
+
}
|
|
9
|
+
function adaptOwnerSelection(account, signers) {
|
|
10
|
+
switch (signers.kind) {
|
|
11
|
+
case 'ecdsa': {
|
|
12
|
+
const signerIds = signers.accounts.map(ecdsaSignerId);
|
|
13
|
+
return {
|
|
14
|
+
kind: 'owner',
|
|
15
|
+
validator: account.owners
|
|
16
|
+
? replaceValidatorAccounts(account.owners, signers.accounts)
|
|
17
|
+
: defineValidator({ type: 'ecdsa', accounts: signers.accounts }),
|
|
18
|
+
signerIds,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
case 'passkey': {
|
|
22
|
+
const signerIds = signers.accounts.map(webauthnSignerId);
|
|
23
|
+
return {
|
|
24
|
+
kind: 'owner',
|
|
25
|
+
validator: defineValidator({
|
|
26
|
+
type: 'passkey',
|
|
27
|
+
accounts: signers.accounts,
|
|
28
|
+
...(signers.module ? { module: signers.module } : {}),
|
|
29
|
+
}),
|
|
30
|
+
signerIds,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
case 'multi-factor': {
|
|
34
|
+
const validator = defineValidator({
|
|
35
|
+
type: 'multi-factor',
|
|
36
|
+
validators: signers.validators.map((factor) => factor.type === 'passkey'
|
|
37
|
+
? { type: 'passkey', accounts: factor.accounts }
|
|
38
|
+
: { type: 'ecdsa', accounts: factor.accounts }),
|
|
39
|
+
...(signers.module ? { module: signers.module } : {}),
|
|
40
|
+
});
|
|
41
|
+
if (validator.kind !== 'multi-factor') {
|
|
42
|
+
throw new Error('Multi-factor signer selection did not resolve');
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
kind: 'owner',
|
|
46
|
+
validator: {
|
|
47
|
+
...validator,
|
|
48
|
+
validators: validator.validators.map((factor, index) => ({
|
|
49
|
+
...factor,
|
|
50
|
+
publicId: signers.validators[index]?.id ?? factor.publicId,
|
|
51
|
+
})),
|
|
52
|
+
},
|
|
53
|
+
signerIds: signers.validators.flatMap((factor) => factor.type === 'passkey'
|
|
54
|
+
? factor.accounts.map(webauthnSignerId)
|
|
55
|
+
: factor.accounts.map(ecdsaSignerId)),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function replaceValidatorAccounts(configured, selectedAccounts) {
|
|
61
|
+
const accounts = new Map(selectedAccounts.map((account) => [
|
|
62
|
+
account.type === 'webAuthn'
|
|
63
|
+
? webauthnSignerId(account)
|
|
64
|
+
: ecdsaSignerId(account),
|
|
65
|
+
account,
|
|
66
|
+
]));
|
|
67
|
+
if (configured.kind === 'multi-factor') {
|
|
68
|
+
return {
|
|
69
|
+
...configured,
|
|
70
|
+
validators: configured.validators.map((validator) => replaceAtomicValidatorAccounts(validator, accounts)),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return replaceAtomicValidatorAccounts(configured, accounts);
|
|
74
|
+
}
|
|
75
|
+
function replaceAtomicValidatorAccounts(configured, accounts) {
|
|
76
|
+
return {
|
|
77
|
+
...configured,
|
|
78
|
+
owners: configured.owners.map((owner) => replaceOwnerAccount(owner, accounts.get(owner.signerId))),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function replaceOwnerAccount(owner, account) {
|
|
82
|
+
if (!account)
|
|
83
|
+
return owner;
|
|
84
|
+
return owner.kind === 'webauthn' && account.type === 'webAuthn'
|
|
85
|
+
? { ...owner, account }
|
|
86
|
+
: owner.kind !== 'webauthn' && account.type !== 'webAuthn'
|
|
87
|
+
? { ...owner, account }
|
|
88
|
+
: owner;
|
|
89
|
+
}
|
|
90
|
+
function adaptSessionSelection(signers) {
|
|
91
|
+
if ('sessions' in signers) {
|
|
92
|
+
return {
|
|
93
|
+
kind: 'smart-session',
|
|
94
|
+
byChain: Object.fromEntries(Object.entries(signers.sessions).map(([chainId, selection]) => [
|
|
95
|
+
Number(chainId),
|
|
96
|
+
selection,
|
|
97
|
+
])),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
kind: 'smart-session',
|
|
102
|
+
byChain: {
|
|
103
|
+
[signers.session.chain.id]: {
|
|
104
|
+
session: signers.session,
|
|
105
|
+
...(signers.enableData ? { enableData: signers.enableData } : {}),
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|