@rhinestone/sdk 0.6.4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/accounts/index.js +5 -5
- package/dist/src/accounts/nexus.js +3 -3
- package/dist/src/accounts/safe.js +3 -3
- package/dist/src/execution/index.js +8 -8
- package/dist/src/execution/smart-session.js +4 -4
- package/dist/src/index.js +2 -2
- package/dist/src/modules/index.js +3 -3
- package/dist/src/modules/validators/core.js +1 -1
- package/dist/src/modules/validators/index.js +2 -2
- package/dist/src/modules/validators/smart-sessions.js +5 -5
- package/dist/src/orchestrator/client.js +2 -2
- package/dist/src/orchestrator/index.d.ts +2 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +7 -7
- package/dist/src/orchestrator/registry.d.ts +4 -3
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +15 -3
- package/dist/src/orchestrator/utils.js +2 -2
- package/dist/test/modules/validators/smart-sessions.test.js +1 -1
- package/package.json +1 -1
- package/dist/package.json +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { concat, createPublicClient, createWalletClient, encodePacked, http, keccak256, size, slice, zeroHash, } from 'viem';
|
|
2
|
-
import { getWebauthnValidatorSignature, isRip7212SupportedNetwork, } from '../modules';
|
|
3
|
-
import { getOwnerValidator, getSmartSessionValidator, } from '../modules/validators';
|
|
4
|
-
import { get7702SmartAccount as get7702NexusAccount, get7702InitCalls as get7702NexusInitCalls, getDeployArgs as getNexusDeployArgs, getSessionSmartAccount as getNexusSessionSmartAccount, getSmartAccount as getNexusSmartAccount, } from './nexus';
|
|
5
|
-
import { get7702SmartAccount as get7702SafeAccount, get7702InitCalls as get7702SafeInitCalls, getDeployArgs as getSafeDeployArgs, getSessionSmartAccount as getSafeSessionSmartAccount, getSmartAccount as getSafeSmartAccount, } from './safe';
|
|
6
|
-
import { getBundlerClient } from './utils';
|
|
2
|
+
import { getWebauthnValidatorSignature, isRip7212SupportedNetwork, } from '../modules/index.js';
|
|
3
|
+
import { getOwnerValidator, getSmartSessionValidator, } from '../modules/validators/index.js';
|
|
4
|
+
import { get7702SmartAccount as get7702NexusAccount, get7702InitCalls as get7702NexusInitCalls, getDeployArgs as getNexusDeployArgs, getSessionSmartAccount as getNexusSessionSmartAccount, getSmartAccount as getNexusSmartAccount, } from './nexus.js';
|
|
5
|
+
import { get7702SmartAccount as get7702SafeAccount, get7702InitCalls as get7702SafeInitCalls, getDeployArgs as getSafeDeployArgs, getSessionSmartAccount as getSafeSessionSmartAccount, getSmartAccount as getSafeSmartAccount, } from './safe.js';
|
|
6
|
+
import { getBundlerClient } from './utils.js';
|
|
7
7
|
function getDeployArgs(config) {
|
|
8
8
|
const account = getAccount(config);
|
|
9
9
|
switch (account.type) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { concat, encodeAbiParameters, encodeFunctionData, keccak256, parseAbi, toHex, zeroAddress, } from 'viem';
|
|
2
2
|
import { entryPoint07Abi, entryPoint07Address, getUserOperationHash, toSmartAccount, } from 'viem/account-abstraction';
|
|
3
|
-
import { getSetup as getModuleSetup } from '../modules';
|
|
4
|
-
import { encodeSmartSessionSignature, getMockSignature, getPermissionId, SMART_SESSION_MODE_USE, } from '../modules/validators';
|
|
5
|
-
import { encode7579Calls, getAccountNonce } from './utils';
|
|
3
|
+
import { getSetup as getModuleSetup } from '../modules/index.js';
|
|
4
|
+
import { encodeSmartSessionSignature, getMockSignature, getPermissionId, SMART_SESSION_MODE_USE, } from '../modules/validators/index.js';
|
|
5
|
+
import { encode7579Calls, getAccountNonce } from './utils.js';
|
|
6
6
|
const NEXUS_IMPLEMENTATION_ADDRESS = '0x000000004f43c49e93c970e84001853a70923b03';
|
|
7
7
|
const NEXUS_FACTORY_ADDRESS = '0x000000001D1D5004a02bAfAb9de2D6CE5b7B13de';
|
|
8
8
|
const NEXUS_BOOTSTRAP_ADDRESS = '0x00000000D3254452a909E4eeD47455Af7E27C289';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { concat, encodeFunctionData, encodePacked, keccak256, parseAbi, zeroAddress, } from 'viem';
|
|
2
2
|
import { entryPoint07Abi, entryPoint07Address, getUserOperationHash, toSmartAccount, } from 'viem/account-abstraction';
|
|
3
|
-
import { getSetup as getModuleSetup } from '../modules';
|
|
4
|
-
import { encodeSmartSessionSignature, getMockSignature, getPermissionId, SMART_SESSION_MODE_USE, } from '../modules/validators';
|
|
5
|
-
import { encode7579Calls, getAccountNonce } from './utils';
|
|
3
|
+
import { getSetup as getModuleSetup } from '../modules/index.js';
|
|
4
|
+
import { encodeSmartSessionSignature, getMockSignature, getPermissionId, SMART_SESSION_MODE_USE, } from '../modules/validators/index.js';
|
|
5
|
+
import { encode7579Calls, getAccountNonce } from './utils.js';
|
|
6
6
|
const SAFE_7579_LAUNCHPAD_ADDRESS = '0x7579011aB74c46090561ea277Ba79D510c6C00ff';
|
|
7
7
|
const SAFE_7579_ADAPTER_ADDRESS = '0x7579ee8307284f293b1927136486880611f20002';
|
|
8
8
|
const SAFE_SINGLETON_ADDRESS = '0x29fcb43b46531bca003ddc8fcb67ffe91900c762';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createPublicClient, encodeAbiParameters, encodePacked, http, keccak256, pad, toHex, } from 'viem';
|
|
2
2
|
import { entryPoint07Address, getUserOperationHash, } from 'viem/account-abstraction';
|
|
3
|
-
import { deploySource, deployTarget, getAddress, getBundleInitCode, getSmartSessionSmartAccount, isDeployed, sign, } from '../accounts';
|
|
4
|
-
import { getBundlerClient } from '../accounts/utils';
|
|
5
|
-
import { getOwnerValidator } from '../modules';
|
|
6
|
-
import { getSmartSessionValidator } from '../modules/validators';
|
|
7
|
-
import { BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_FILLED, getEmptyUserOp, getOrchestrator, getOrderBundleHash,
|
|
8
|
-
import { getChainById } from '../orchestrator/registry';
|
|
9
|
-
import { enableSmartSession, getSessionSignature, hashErc7739, } from './smart-session';
|
|
3
|
+
import { deploySource, deployTarget, getAddress, getBundleInitCode, getSmartSessionSmartAccount, isDeployed, sign, } from '../accounts/index.js';
|
|
4
|
+
import { getBundlerClient } from '../accounts/utils.js';
|
|
5
|
+
import { getOwnerValidator } from '../modules/index.js';
|
|
6
|
+
import { getSmartSessionValidator } from '../modules/validators/index.js';
|
|
7
|
+
import { BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_FILLED, getEmptyUserOp, getOrchestrator, getOrderBundleHash, getTokenRootBalanceSlot, } from '../orchestrator/index.js';
|
|
8
|
+
import { getChainById } from '../orchestrator/registry.js';
|
|
9
|
+
import { enableSmartSession, getSessionSignature, hashErc7739, } from './smart-session.js';
|
|
10
10
|
const POLLING_INTERVAL = 500;
|
|
11
11
|
async function sendTransaction(config, transaction) {
|
|
12
12
|
if ('chain' in transaction) {
|
|
@@ -79,7 +79,7 @@ async function sendTransactionAsUserOp(config, sourceChain, targetChain, calls,
|
|
|
79
79
|
calls: [...orderPath[0].injectedExecutions, ...calls],
|
|
80
80
|
stateOverride: [
|
|
81
81
|
...tokenRequests.map((request) => {
|
|
82
|
-
const rootBalanceSlot =
|
|
82
|
+
const rootBalanceSlot = getTokenRootBalanceSlot(targetChain, request.address);
|
|
83
83
|
const balanceSlot = rootBalanceSlot
|
|
84
84
|
? keccak256(encodeAbiParameters([{ type: 'address' }, { type: 'uint256' }], [accountAddress, rootBalanceSlot]))
|
|
85
85
|
: '0x';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createPublicClient, encodeAbiParameters, encodePacked, http, keccak256, } from 'viem';
|
|
2
|
-
import { getAddress, getSmartAccount } from '../accounts';
|
|
3
|
-
import { getBundlerClient } from '../accounts/utils';
|
|
4
|
-
import { getAccountEIP712Domain, getEnableSessionCall, getPermissionId, getSessionAllowedERC7739Content, isSessionEnabled, } from '../modules/validators';
|
|
5
|
-
import { hashMultichainCompactWithoutDomainSeparator } from '../orchestrator/utils';
|
|
2
|
+
import { getAddress, getSmartAccount } from '../accounts/index.js';
|
|
3
|
+
import { getBundlerClient } from '../accounts/utils.js';
|
|
4
|
+
import { getAccountEIP712Domain, getEnableSessionCall, getPermissionId, getSessionAllowedERC7739Content, isSessionEnabled, } from '../modules/validators/index.js';
|
|
5
|
+
import { hashMultichainCompactWithoutDomainSeparator } from '../orchestrator/utils.js';
|
|
6
6
|
async function enableSmartSession(chain, config, session) {
|
|
7
7
|
const publicClient = createPublicClient({
|
|
8
8
|
chain,
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getAddress as getAddressInternal } from './accounts';
|
|
2
|
-
import { getMaxSpendableAmount as getMaxSpendableAmountInternal, sendTransaction as sendTransactionInternal, waitForExecution as waitForExecutionInternal, } from './execution';
|
|
1
|
+
import { getAddress as getAddressInternal } from './accounts/index.js';
|
|
2
|
+
import { getMaxSpendableAmount as getMaxSpendableAmountInternal, sendTransaction as sendTransactionInternal, waitForExecution as waitForExecutionInternal, } from './execution/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Initialize a Rhinestone account
|
|
5
5
|
* Note: accounts are deployed onchain only when the first transaction is sent.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { bytesToHex, encodeAbiParameters, hexToBytes, } from 'viem';
|
|
2
2
|
import { arbitrum, arbitrumSepolia, base, baseSepolia, optimism, optimismSepolia, polygon, polygonAmoy, } from 'viem/chains';
|
|
3
|
-
import { MODULE_TYPE_ID_EXECUTOR, MODULE_TYPE_ID_FALLBACK, } from './common';
|
|
4
|
-
import { HOOK_ADDRESS, OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS, RHINESTONE_ATTESTER_ADDRESS, RHINESTONE_MODULE_REGISTRY_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, TARGET_MODULE_ADDRESS, } from './omni-account';
|
|
5
|
-
import { getOwnerValidator, getSmartSessionValidator } from './validators';
|
|
3
|
+
import { MODULE_TYPE_ID_EXECUTOR, MODULE_TYPE_ID_FALLBACK, } from './common.js';
|
|
4
|
+
import { HOOK_ADDRESS, OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS, RHINESTONE_ATTESTER_ADDRESS, RHINESTONE_MODULE_REGISTRY_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, TARGET_MODULE_ADDRESS, } from './omni-account.js';
|
|
5
|
+
import { getOwnerValidator, getSmartSessionValidator } from './validators/index.js';
|
|
6
6
|
const SMART_SESSION_COMPATIBILITY_FALLBACK_ADDRESS = '0x12cae64c42f362e7d5a847c2d33388373f629177';
|
|
7
7
|
function getSetup(config) {
|
|
8
8
|
const ownerValidator = getOwnerValidator(config);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bytesToHex, concat, encodeAbiParameters, hexToBytes, keccak256, toHex, } from 'viem';
|
|
2
|
-
import { MODULE_TYPE_ID_VALIDATOR } from '../common';
|
|
2
|
+
import { MODULE_TYPE_ID_VALIDATOR } from '../common.js';
|
|
3
3
|
const OWNABLE_VALIDATOR_ADDRESS = '0x2483DA3A338895199E5e538530213157e931Bf06';
|
|
4
4
|
const WEBAUTHN_VALIDATOR_ADDRESS = '0x2f167e55d42584f65e2e30a748f41ee75a311414';
|
|
5
5
|
const ECDSA_MOCK_SIGNATURE = '0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { getMockSignature, getOwnerValidator } from './core';
|
|
2
|
-
import { encodeSmartSessionSignature, getAccountEIP712Domain, getEnableSessionCall, getPermissionId, getSessionAllowedERC7739Content, getSmartSessionValidator, isSessionEnabled, SMART_SESSION_MODE_ENABLE, SMART_SESSION_MODE_USE, SMART_SESSIONS_VALIDATOR_ADDRESS, } from './smart-sessions';
|
|
1
|
+
import { getMockSignature, getOwnerValidator } from './core.js';
|
|
2
|
+
import { encodeSmartSessionSignature, getAccountEIP712Domain, getEnableSessionCall, getPermissionId, getSessionAllowedERC7739Content, getSmartSessionValidator, isSessionEnabled, SMART_SESSION_MODE_ENABLE, SMART_SESSION_MODE_USE, SMART_SESSIONS_VALIDATOR_ADDRESS, } from './smart-sessions.js';
|
|
3
3
|
export { SMART_SESSION_MODE_USE, SMART_SESSION_MODE_ENABLE, SMART_SESSIONS_VALIDATOR_ADDRESS, getOwnerValidator, getSmartSessionValidator, getEnableSessionCall, encodeSmartSessionSignature, getPermissionId, getMockSignature, getAccountEIP712Domain, isSessionEnabled, getSessionAllowedERC7739Content, };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createPublicClient, encodeAbiParameters, encodeFunctionData, encodePacked, http, isHex, keccak256, padHex, parseAbi, toHex, zeroHash, } from 'viem';
|
|
2
|
-
import { getWethAddress, RHINESTONE_SPOKE_POOL_ADDRESS, } from '../../orchestrator';
|
|
3
|
-
import { enableSessionsAbi } from '../abi/smart-sessions';
|
|
4
|
-
import { MODULE_TYPE_ID_VALIDATOR } from '../common';
|
|
5
|
-
import { HOOK_ADDRESS } from '../omni-account';
|
|
6
|
-
import { getValidator } from './core';
|
|
2
|
+
import { getWethAddress, RHINESTONE_SPOKE_POOL_ADDRESS, } from '../../orchestrator/index.js';
|
|
3
|
+
import { enableSessionsAbi } from '../abi/smart-sessions.js';
|
|
4
|
+
import { MODULE_TYPE_ID_VALIDATOR } from '../common.js';
|
|
5
|
+
import { HOOK_ADDRESS } from '../omni-account.js';
|
|
6
|
+
import { getValidator } from './core.js';
|
|
7
7
|
const SMART_SESSIONS_VALIDATOR_ADDRESS = '0x00000000002b0ecfbd0496ee71e01257da0e37de';
|
|
8
8
|
const SMART_SESSION_MODE_USE = '0x00';
|
|
9
9
|
const SMART_SESSION_MODE_ENABLE = '0x01';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { concat } from 'viem';
|
|
3
|
-
import { OrchestratorError } from './error';
|
|
4
|
-
import { convertBigIntFields, parseCompactResponse, parseOrderCost, parseOrderCostResult, parsePendingBundleEvent, } from './utils';
|
|
3
|
+
import { OrchestratorError } from './error.js';
|
|
4
|
+
import { convertBigIntFields, parseCompactResponse, parseOrderCost, parseOrderCostResult, parsePendingBundleEvent, } from './utils.js';
|
|
5
5
|
export class Orchestrator {
|
|
6
6
|
serverUrl;
|
|
7
7
|
apiKey;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Orchestrator } from './client';
|
|
2
2
|
import { RHINESTONE_SPOKE_POOL_ADDRESS } from './consts';
|
|
3
3
|
import { OrchestratorError } from './error';
|
|
4
|
-
import { getHookAddress, getRhinestoneSpokePoolAddress, getSameChainModuleAddress, getTargetModuleAddress, getTokenAddress, getTokenBalanceSlot, getTokenSymbol, getWethAddress } from './registry';
|
|
4
|
+
import { getHookAddress, getRhinestoneSpokePoolAddress, getSameChainModuleAddress, getTargetModuleAddress, getTokenAddress, getTokenBalanceSlot, getTokenRootBalanceSlot, getTokenSymbol, getWethAddress } from './registry';
|
|
5
5
|
import type { BundleResult, Execution, MetaIntent, MultiChainCompact, OrderPath, PostOrderBundleResult, SignedMultiChainCompact } from './types';
|
|
6
6
|
import { BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_UNKNOWN } from './types';
|
|
7
7
|
import { BundleStatusEnum, getEmptyUserOp, getOrderBundleHash } from './utils';
|
|
8
8
|
declare function getOrchestrator(apiKey: string, orchestratorUrl?: string): Orchestrator;
|
|
9
9
|
export type { Execution, BundleResult, MetaIntent, MultiChainCompact, OrderPath, SignedMultiChainCompact, PostOrderBundleResult, };
|
|
10
|
-
export { BundleStatusEnum as BundleStatus, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, OrchestratorError, getOrchestrator, getOrderBundleHash, getEmptyUserOp, getWethAddress, getTokenBalanceSlot, getTokenSymbol, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getTokenAddress, };
|
|
10
|
+
export { BundleStatusEnum as BundleStatus, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, OrchestratorError, getOrchestrator, getOrderBundleHash, getEmptyUserOp, getWethAddress, getTokenBalanceSlot, getTokenRootBalanceSlot, getTokenSymbol, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getTokenAddress, };
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAoB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EACL,cAAc,EACd,6BAA6B,EAC7B,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,cAAc,EACf,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,iCAAiC,EACjC,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE9E,iBAAS,eAAe,CACtB,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM,GACvB,YAAY,CAEd;AAED,YAAY,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,uBAAuB,EACvB,qBAAqB,GACtB,CAAA;AACD,OAAO,EACL,gBAAgB,IAAI,YAAY,EAChC,qBAAqB,EACrB,qBAAqB,EACrB,iCAAiC,EACjC,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,6BAA6B,EAC7B,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,6BAA6B,EAC7B,eAAe,GAChB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAoB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EACL,cAAc,EACd,6BAA6B,EAC7B,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACf,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,iCAAiC,EACjC,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE9E,iBAAS,eAAe,CACtB,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM,GACvB,YAAY,CAEd;AAED,YAAY,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,uBAAuB,EACvB,qBAAqB,GACtB,CAAA;AACD,OAAO,EACL,gBAAgB,IAAI,YAAY,EAChC,qBAAqB,EACrB,qBAAqB,EACrB,iCAAiC,EACjC,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,6BAA6B,EAC7B,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,6BAA6B,EAC7B,eAAe,GAChB,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Orchestrator } from './client';
|
|
2
|
-
import { ORCHESTRATOR_URL, RHINESTONE_SPOKE_POOL_ADDRESS } from './consts';
|
|
3
|
-
import { OrchestratorError } from './error';
|
|
4
|
-
import { getHookAddress, getRhinestoneSpokePoolAddress, getSameChainModuleAddress, getTargetModuleAddress, getTokenAddress, getTokenBalanceSlot, getTokenSymbol, getWethAddress, } from './registry';
|
|
5
|
-
import { BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_UNKNOWN, } from './types';
|
|
6
|
-
import { BundleStatusEnum, getEmptyUserOp, getOrderBundleHash } from './utils';
|
|
1
|
+
import { Orchestrator } from './client.js';
|
|
2
|
+
import { ORCHESTRATOR_URL, RHINESTONE_SPOKE_POOL_ADDRESS } from './consts.js';
|
|
3
|
+
import { OrchestratorError } from './error.js';
|
|
4
|
+
import { getHookAddress, getRhinestoneSpokePoolAddress, getSameChainModuleAddress, getTargetModuleAddress, getTokenAddress, getTokenBalanceSlot, getTokenRootBalanceSlot, getTokenSymbol, getWethAddress, } from './registry.js';
|
|
5
|
+
import { BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_UNKNOWN, } from './types.js';
|
|
6
|
+
import { BundleStatusEnum, getEmptyUserOp, getOrderBundleHash } from './utils.js';
|
|
7
7
|
function getOrchestrator(apiKey, orchestratorUrl) {
|
|
8
8
|
return new Orchestrator(orchestratorUrl ?? ORCHESTRATOR_URL, apiKey);
|
|
9
9
|
}
|
|
10
|
-
export { BundleStatusEnum as BundleStatus, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, OrchestratorError, getOrchestrator, getOrderBundleHash, getEmptyUserOp, getWethAddress, getTokenBalanceSlot, getTokenSymbol, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getTokenAddress, };
|
|
10
|
+
export { BundleStatusEnum as BundleStatus, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, OrchestratorError, getOrchestrator, getOrderBundleHash, getEmptyUserOp, getWethAddress, getTokenBalanceSlot, getTokenRootBalanceSlot, getTokenSymbol, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getTokenAddress, };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Address, Chain } from 'viem';
|
|
1
|
+
import { Address, Chain, Hex } from 'viem';
|
|
2
2
|
declare function getWethAddress(chain: Chain): "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" | "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14" | "0x4200000000000000000000000000000000000006" | "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" | "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73" | "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619" | "0x52eF3d68BaB452a294342DC3e5f464d7f610f72E";
|
|
3
|
-
declare function
|
|
3
|
+
declare function getTokenRootBalanceSlot(chain: Chain, tokenAddress: Address): bigint | null;
|
|
4
|
+
declare function getTokenBalanceSlot(tokenSymbol: string, chainId: number, accountAddress: Address): Hex;
|
|
4
5
|
declare function getHookAddress(_chainId?: number): Address;
|
|
5
6
|
declare function getSameChainModuleAddress(_chainId?: number): Address;
|
|
6
7
|
declare function getTargetModuleAddress(_chainId?: number): Address;
|
|
@@ -8,5 +9,5 @@ declare function getRhinestoneSpokePoolAddress(_chainId?: number): Address;
|
|
|
8
9
|
declare function getTokenSymbol(tokenAddress: Address, chainId: number): string;
|
|
9
10
|
declare function getTokenAddress(tokenSymbol: string, chainId: number): Address;
|
|
10
11
|
declare function getChainById(chainId: number): Chain | undefined;
|
|
11
|
-
export { getTokenSymbol, getTokenAddress, getTokenBalanceSlot, getWethAddress, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getChainById, };
|
|
12
|
+
export { getTokenSymbol, getTokenAddress, getTokenRootBalanceSlot, getTokenBalanceSlot, getWethAddress, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getChainById, };
|
|
12
13
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../orchestrator/registry.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../orchestrator/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAEL,GAAG,EAGJ,MAAM,MAAM,CAAA;AAcb,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,0UAoCnC;AAwCD,iBAAS,uBAAuB,CAC9B,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,OAAO,GACpB,MAAM,GAAG,IAAI,CAqJf;AAED,iBAAS,mBAAmB,CAC1B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,OAAO,GACtB,GAAG,CAgBL;AAED,iBAAS,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,iBAAS,yBAAyB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,iBAAS,sBAAsB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,iBAAS,6BAA6B,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED,iBAAS,cAAc,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAWtE;AAED,iBAAS,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAetE;AAED,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,qBAkBpC;AAED,OAAO,EACL,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,6BAA6B,EAC7B,YAAY,GACb,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { zeroAddress } from 'viem';
|
|
1
|
+
import { encodeAbiParameters, keccak256, zeroAddress, } from 'viem';
|
|
2
2
|
import { arbitrum, arbitrumSepolia, base, baseSepolia, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sepolia, } from 'viem/chains';
|
|
3
3
|
function getWethAddress(chain) {
|
|
4
4
|
switch (chain.id) {
|
|
@@ -74,7 +74,7 @@ function getUsdcAddress(chain) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function getTokenRootBalanceSlot(chain, tokenAddress) {
|
|
78
78
|
switch (chain.id) {
|
|
79
79
|
case mainnet.id: {
|
|
80
80
|
// ETH
|
|
@@ -221,6 +221,18 @@ function getTokenBalanceSlot(chain, tokenAddress) {
|
|
|
221
221
|
}
|
|
222
222
|
throw new Error(`Unsupported token address ${tokenAddress} for chain ${chain.id}`);
|
|
223
223
|
}
|
|
224
|
+
function getTokenBalanceSlot(tokenSymbol, chainId, accountAddress) {
|
|
225
|
+
const tokenAddress = getTokenAddress(tokenSymbol, chainId);
|
|
226
|
+
const chain = getChainById(chainId);
|
|
227
|
+
if (!chain) {
|
|
228
|
+
throw new Error(`Unsupported chain: ${chainId}`);
|
|
229
|
+
}
|
|
230
|
+
const rootBalanceSlot = getTokenRootBalanceSlot(chain, tokenAddress);
|
|
231
|
+
const balanceSlot = rootBalanceSlot
|
|
232
|
+
? keccak256(encodeAbiParameters([{ type: 'address' }, { type: 'uint256' }], [accountAddress, rootBalanceSlot]))
|
|
233
|
+
: '0x';
|
|
234
|
+
return balanceSlot;
|
|
235
|
+
}
|
|
224
236
|
function getHookAddress(_chainId) {
|
|
225
237
|
return '0x0000000000f6Ed8Be424d673c63eeFF8b9267420';
|
|
226
238
|
}
|
|
@@ -278,4 +290,4 @@ function getChainById(chainId) {
|
|
|
278
290
|
}
|
|
279
291
|
}
|
|
280
292
|
}
|
|
281
|
-
export { getTokenSymbol, getTokenAddress, getTokenBalanceSlot, getWethAddress, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getChainById, };
|
|
293
|
+
export { getTokenSymbol, getTokenAddress, getTokenRootBalanceSlot, getTokenBalanceSlot, getWethAddress, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getChainById, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { domainSeparator, encodeAbiParameters, encodePacked, keccak256, zeroAddress, } from 'viem';
|
|
2
|
-
import { HOOK_ADDRESS } from '../modules';
|
|
3
|
-
import { BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_UNKNOWN, } from './types';
|
|
2
|
+
import { HOOK_ADDRESS } from '../modules/index.js';
|
|
3
|
+
import { BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_UNKNOWN, } from './types.js';
|
|
4
4
|
const MULTICHAIN_COMPACT_TYPEHASH = '0xee54591377b86e048be6b2fbd8913598a6270aed3415776321279495bf4efae5';
|
|
5
5
|
const SEGMENT_TYPEHASH = '0x54ada5b33a7390e2883c985295cfa2dcd9bb46515ad10cbdfc22a7c73f9807db';
|
|
6
6
|
const WITNESS_TYPEHASH = '0x78e29a727cef567e7d6dddf5bf7eedf0c84af60d4a57512c586c787aae731629';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
2
2
|
import { expect, test } from 'vitest';
|
|
3
|
-
import { getPermissionId } from '../../../src/modules/validators/smart-sessions';
|
|
3
|
+
import { getPermissionId } from '../../../src/modules/validators/smart-sessions.js';
|
|
4
4
|
test('getPermissionId', () => {
|
|
5
5
|
const accountA = privateKeyToAccount('0x2be89d993f98bbaab8b83f1a2830cb9414e19662967c7ba2a0f43d2a9125bd6d');
|
|
6
6
|
const accountB = privateKeyToAccount('0x39e2fec1a04c088f939d81de8f1abebdebf899a6cfb9968f9b663a7afba8301b');
|
package/package.json
CHANGED
package/dist/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type": "module","sideEffects":false}
|