@rhinestone/sdk 1.0.0-alpha.2 → 1.0.0-alpha.3
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.d.ts +3 -3
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +10 -9
- package/dist/src/accounts/kernel.d.ts +6 -6
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/nexus.d.ts +3 -3
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/safe.d.ts +3 -3
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/utils.d.ts +4 -3
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +44 -0
- package/dist/src/actions/index.d.ts +5 -5
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +8 -4
- package/dist/src/actions/index.test.js +18 -0
- package/dist/src/actions/registry.d.ts +1 -1
- package/dist/src/actions/registry.d.ts.map +1 -1
- package/dist/src/actions/registry.test.js +1 -2
- package/dist/src/actions/smart-session.d.ts +2 -2
- package/dist/src/actions/smart-session.d.ts.map +1 -1
- package/dist/src/execution/compact.d.ts +2 -2
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +3 -1
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +14 -10
- package/dist/src/execution/smart-session.d.ts +1 -1
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +10 -10
- package/dist/src/execution/utils.d.ts +7 -6
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +18 -12
- package/dist/src/index.d.ts +8 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +10 -8
- package/dist/src/modules/read.d.ts +5 -5
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +7 -6
- package/dist/src/modules/registry.d.ts +2 -2
- package/dist/src/modules/registry.d.ts.map +1 -1
- package/dist/src/modules/validators/core.d.ts +1 -1
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.d.ts +3 -3
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +7 -6
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- 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 +1 -7
- package/dist/src/orchestrator/registry.d.ts +31 -12
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +56 -379
- package/dist/src/orchestrator/registry.json +356 -0
- package/dist/src/orchestrator/registry.test.d.ts +2 -0
- package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
- package/dist/src/orchestrator/registry.test.js +137 -0
- package/dist/src/orchestrator/types.d.ts +1 -2
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.d.ts.map +1 -1
- package/dist/src/types.d.ts +20 -17
- package/dist/src/types.d.ts.map +1 -1
- package/dist/test/consts.d.ts +2 -2
- package/dist/test/consts.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Orchestrator } from './client';
|
|
2
2
|
import { RHINESTONE_SPOKE_POOL_ADDRESS } from './consts';
|
|
3
3
|
import { AuthenticationRequiredError, InsufficientBalanceError, IntentNotFoundError, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './error';
|
|
4
|
-
import {
|
|
4
|
+
import { getSupportedTokens, getTokenAddress, getTokenSymbol, getWethAddress, isTokenAddressSupported } from './registry';
|
|
5
5
|
import type { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, Portfolio, SettlementSystem, SignedIntentOp, SupportedChain, TokenConfig } from './types';
|
|
6
6
|
import { INTENT_STATUS_COMPLETED, INTENT_STATUS_EXPIRED, INTENT_STATUS_FAILED, INTENT_STATUS_FILLED, INTENT_STATUS_PARTIALLY_COMPLETED, INTENT_STATUS_PENDING, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_UNKNOWN } from './types';
|
|
7
7
|
import { getIntentOpHash } from './utils';
|
|
8
8
|
declare function getOrchestrator(apiKey: string, orchestratorUrl?: string): Orchestrator;
|
|
9
9
|
export type { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, SupportedChain, TokenConfig, Portfolio, };
|
|
10
|
-
export { INTENT_STATUS_PENDING, INTENT_STATUS_EXPIRED, INTENT_STATUS_PARTIALLY_COMPLETED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_FAILED, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getOrchestrator, getIntentOpHash, getWethAddress,
|
|
10
|
+
export { INTENT_STATUS_PENDING, INTENT_STATUS_EXPIRED, INTENT_STATUS_PARTIALLY_COMPLETED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_FAILED, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getOrchestrator, getIntentOpHash, getWethAddress, getTokenSymbol, getTokenAddress, getSupportedTokens, isOrchestratorError, isTokenAddressSupported, };
|
|
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,EAAyB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAyB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,cAAc,EACd,uBAAuB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACZ,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,iCAAiC,EACjC,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,iBAAS,eAAe,CACtB,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM,GACvB,YAAY,CAEd;AAED,YAAY,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,GACV,CAAA;AACD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iCAAiC,EACjC,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,6BAA6B,EAC7B,YAAY,EACZ,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,GACxB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTokenAddressSupported = exports.isOrchestratorError = exports.getSupportedTokens = exports.getTokenAddress = exports.
|
|
3
|
+
exports.isTokenAddressSupported = exports.isOrchestratorError = exports.getSupportedTokens = exports.getTokenAddress = exports.getTokenSymbol = exports.getWethAddress = exports.getIntentOpHash = exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.Orchestrator = exports.RHINESTONE_SPOKE_POOL_ADDRESS = exports.INTENT_STATUS_UNKNOWN = exports.INTENT_STATUS_PRECONFIRMED = exports.INTENT_STATUS_FAILED = exports.INTENT_STATUS_FILLED = exports.INTENT_STATUS_COMPLETED = exports.INTENT_STATUS_PARTIALLY_COMPLETED = exports.INTENT_STATUS_EXPIRED = exports.INTENT_STATUS_PENDING = void 0;
|
|
4
4
|
exports.getOrchestrator = getOrchestrator;
|
|
5
5
|
const client_1 = require("./client");
|
|
6
6
|
Object.defineProperty(exports, "Orchestrator", { enumerable: true, get: function () { return client_1.Orchestrator; } });
|
|
@@ -21,14 +21,8 @@ Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get:
|
|
|
21
21
|
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return error_1.UnsupportedChainIdError; } });
|
|
22
22
|
Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return error_1.UnsupportedTokenError; } });
|
|
23
23
|
const registry_1 = require("./registry");
|
|
24
|
-
Object.defineProperty(exports, "getHookAddress", { enumerable: true, get: function () { return registry_1.getHookAddress; } });
|
|
25
|
-
Object.defineProperty(exports, "getRhinestoneSpokePoolAddress", { enumerable: true, get: function () { return registry_1.getRhinestoneSpokePoolAddress; } });
|
|
26
|
-
Object.defineProperty(exports, "getSameChainModuleAddress", { enumerable: true, get: function () { return registry_1.getSameChainModuleAddress; } });
|
|
27
24
|
Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return registry_1.getSupportedTokens; } });
|
|
28
|
-
Object.defineProperty(exports, "getTargetModuleAddress", { enumerable: true, get: function () { return registry_1.getTargetModuleAddress; } });
|
|
29
25
|
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return registry_1.getTokenAddress; } });
|
|
30
|
-
Object.defineProperty(exports, "getTokenBalanceSlot", { enumerable: true, get: function () { return registry_1.getTokenBalanceSlot; } });
|
|
31
|
-
Object.defineProperty(exports, "getTokenRootBalanceSlot", { enumerable: true, get: function () { return registry_1.getTokenRootBalanceSlot; } });
|
|
32
26
|
Object.defineProperty(exports, "getTokenSymbol", { enumerable: true, get: function () { return registry_1.getTokenSymbol; } });
|
|
33
27
|
Object.defineProperty(exports, "getWethAddress", { enumerable: true, get: function () { return registry_1.getWethAddress; } });
|
|
34
28
|
Object.defineProperty(exports, "isTokenAddressSupported", { enumerable: true, get: function () { return registry_1.isTokenAddressSupported; } });
|
|
@@ -1,20 +1,39 @@
|
|
|
1
|
-
import { type Address, type Chain
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { type Address, type Chain } from 'viem';
|
|
2
|
+
import type { TokenSymbol } from '../types';
|
|
3
|
+
import type { TokenConfig } from './types';
|
|
4
|
+
interface TokenEntry {
|
|
5
|
+
symbol: string;
|
|
6
|
+
address: Address;
|
|
7
|
+
decimals: number;
|
|
8
|
+
balanceSlot: number | null;
|
|
9
|
+
}
|
|
10
|
+
interface ChainContracts {
|
|
11
|
+
spokepool: Address;
|
|
12
|
+
hook: Address;
|
|
13
|
+
originModule: Address;
|
|
14
|
+
targetModule: Address;
|
|
15
|
+
sameChainModule: Address;
|
|
16
|
+
}
|
|
17
|
+
interface ChainEntry {
|
|
18
|
+
name: string;
|
|
19
|
+
contracts: ChainContracts;
|
|
20
|
+
tokens: TokenEntry[];
|
|
21
|
+
}
|
|
22
|
+
interface Registry {
|
|
23
|
+
[chainId: string]: ChainEntry;
|
|
24
|
+
}
|
|
25
|
+
declare function getSupportedChainIds(): number[];
|
|
26
|
+
declare function getWethAddress(chain: Chain): Address;
|
|
10
27
|
declare function getTokenSymbol(tokenAddress: Address, chainId: number): string;
|
|
11
|
-
declare function getTokenAddress(tokenSymbol:
|
|
28
|
+
declare function getTokenAddress(tokenSymbol: TokenSymbol, chainId: number): Address;
|
|
12
29
|
declare function getChainById(chainId: number): Chain | undefined;
|
|
13
30
|
declare function isTestnet(chainId: number): boolean;
|
|
14
31
|
declare function isTokenAddressSupported(address: Address, chainId: number): boolean;
|
|
15
32
|
declare function getSupportedTokens(chainId: number): TokenConfig[];
|
|
16
33
|
declare function getDefaultAccountAccessList(onTestnets?: boolean): {
|
|
17
|
-
chainIds:
|
|
34
|
+
chainIds: number[];
|
|
18
35
|
};
|
|
19
|
-
|
|
36
|
+
declare function resolveTokenAddress(token: TokenSymbol | Address, chainId: number): Address;
|
|
37
|
+
export { getTokenSymbol, getTokenAddress, getWethAddress, getChainById, getSupportedTokens, getSupportedChainIds, isTestnet, isTokenAddressSupported, getDefaultAccountAccessList, resolveTokenAddress, };
|
|
38
|
+
export type { TokenEntry, ChainContracts, ChainEntry, Registry };
|
|
20
39
|
//# 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,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAA0B,MAAM,MAAM,CAAA;AAcvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED,UAAU,cAAc;IACtB,SAAS,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,OAAO,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,eAAe,EAAE,OAAO,CAAA;CACzB;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,cAAc,CAAA;IACzB,MAAM,EAAE,UAAU,EAAE,CAAA;CACrB;AAED,UAAU,QAAQ;IAChB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAAA;CAC9B;AAID,iBAAS,oBAAoB,IAAI,MAAM,EAAE,CAExC;AAMD,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAY7C;AAED,iBAAS,cAAc,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAiBtE;AAED,iBAAS,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAmB3E;AAED,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAexD;AAED,iBAAS,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAM3C;AAED,iBAAS,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAS3E;AAED,iBAAS,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,CAO1D;AAED,iBAAS,2BAA2B,CAAC,UAAU,CAAC,EAAE,OAAO;;EAaxD;AAED,iBAAS,mBAAmB,CAC1B,KAAK,EAAE,WAAW,GAAG,OAAO,EAC5B,OAAO,EAAE,MAAM,GACd,OAAO,CAKT;AAED,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,uBAAuB,EACvB,2BAA2B,EAC3B,mBAAmB,GACpB,CAAA;AAGD,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,345 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getTokenSymbol = getTokenSymbol;
|
|
4
7
|
exports.getTokenAddress = getTokenAddress;
|
|
5
|
-
exports.getTokenRootBalanceSlot = getTokenRootBalanceSlot;
|
|
6
|
-
exports.getTokenBalanceSlot = getTokenBalanceSlot;
|
|
7
8
|
exports.getWethAddress = getWethAddress;
|
|
8
|
-
exports.getHookAddress = getHookAddress;
|
|
9
|
-
exports.getSameChainModuleAddress = getSameChainModuleAddress;
|
|
10
|
-
exports.getTargetModuleAddress = getTargetModuleAddress;
|
|
11
|
-
exports.getRhinestoneSpokePoolAddress = getRhinestoneSpokePoolAddress;
|
|
12
9
|
exports.getChainById = getChainById;
|
|
13
10
|
exports.getSupportedTokens = getSupportedTokens;
|
|
11
|
+
exports.getSupportedChainIds = getSupportedChainIds;
|
|
14
12
|
exports.isTestnet = isTestnet;
|
|
15
13
|
exports.isTokenAddressSupported = isTokenAddressSupported;
|
|
16
14
|
exports.getDefaultAccountAccessList = getDefaultAccountAccessList;
|
|
15
|
+
exports.resolveTokenAddress = resolveTokenAddress;
|
|
17
16
|
const viem_1 = require("viem");
|
|
18
17
|
const chains_1 = require("viem/chains");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
case chains_1.sepolia.id: {
|
|
25
|
-
return '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14';
|
|
26
|
-
}
|
|
27
|
-
case chains_1.base.id: {
|
|
28
|
-
return '0x4200000000000000000000000000000000000006';
|
|
29
|
-
}
|
|
30
|
-
case chains_1.baseSepolia.id: {
|
|
31
|
-
return '0x4200000000000000000000000000000000000006';
|
|
32
|
-
}
|
|
33
|
-
case chains_1.arbitrum.id: {
|
|
34
|
-
return '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1';
|
|
35
|
-
}
|
|
36
|
-
case chains_1.arbitrumSepolia.id: {
|
|
37
|
-
return '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73';
|
|
38
|
-
}
|
|
39
|
-
case chains_1.optimism.id: {
|
|
40
|
-
return '0x4200000000000000000000000000000000000006';
|
|
41
|
-
}
|
|
42
|
-
case chains_1.optimismSepolia.id: {
|
|
43
|
-
return '0x4200000000000000000000000000000000000006';
|
|
44
|
-
}
|
|
45
|
-
case chains_1.polygon.id: {
|
|
46
|
-
return '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619';
|
|
47
|
-
}
|
|
48
|
-
case chains_1.polygonAmoy.id: {
|
|
49
|
-
return '0x52eF3d68BaB452a294342DC3e5f464d7f610f72E';
|
|
50
|
-
}
|
|
51
|
-
case chains_1.zksync.id: {
|
|
52
|
-
return '0x5aea5775959fbc2557cc8789bc1bf90a239d9a91';
|
|
53
|
-
}
|
|
54
|
-
default: {
|
|
55
|
-
throw new Error(`Unsupported chain ${chain.id}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function getUsdcAddress(chain) {
|
|
60
|
-
switch (chain.id) {
|
|
61
|
-
case chains_1.mainnet.id: {
|
|
62
|
-
return '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
|
|
63
|
-
}
|
|
64
|
-
case chains_1.sepolia.id: {
|
|
65
|
-
return '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238';
|
|
66
|
-
}
|
|
67
|
-
case chains_1.base.id: {
|
|
68
|
-
return '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
|
|
69
|
-
}
|
|
70
|
-
case chains_1.baseSepolia.id: {
|
|
71
|
-
return '0x036CbD53842c5426634e7929541eC2318f3dCF7e';
|
|
72
|
-
}
|
|
73
|
-
case chains_1.arbitrum.id: {
|
|
74
|
-
return '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
|
|
75
|
-
}
|
|
76
|
-
case chains_1.arbitrumSepolia.id: {
|
|
77
|
-
return '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d';
|
|
78
|
-
}
|
|
79
|
-
case chains_1.optimism.id: {
|
|
80
|
-
return '0x0b2c639c533813f4aa9d7837caf62653d097ff85';
|
|
81
|
-
}
|
|
82
|
-
case chains_1.optimismSepolia.id: {
|
|
83
|
-
return '0x5fd84259d66Cd46123540766Be93DFE6D43130D7';
|
|
84
|
-
}
|
|
85
|
-
case chains_1.polygon.id: {
|
|
86
|
-
return '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359';
|
|
87
|
-
}
|
|
88
|
-
case chains_1.polygonAmoy.id: {
|
|
89
|
-
return '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582';
|
|
90
|
-
}
|
|
91
|
-
case chains_1.zksync.id: {
|
|
92
|
-
return '0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4';
|
|
93
|
-
}
|
|
94
|
-
default: {
|
|
95
|
-
throw new Error(`Unsupported chain ${chain.id}`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
18
|
+
const registry_json_1 = __importDefault(require("./registry.json"));
|
|
19
|
+
const registry = registry_json_1.default;
|
|
20
|
+
function getSupportedChainIds() {
|
|
21
|
+
return Object.keys(registry).map((chainId) => parseInt(chainId, 10));
|
|
98
22
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
case chains_1.mainnet.id: {
|
|
102
|
-
return '0xdAC17F958D2ee523a2206206994597C13D831ec7';
|
|
103
|
-
}
|
|
104
|
-
case chains_1.base.id: {
|
|
105
|
-
return '0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2';
|
|
106
|
-
}
|
|
107
|
-
case chains_1.arbitrum.id: {
|
|
108
|
-
return '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9';
|
|
109
|
-
}
|
|
110
|
-
case chains_1.optimism.id: {
|
|
111
|
-
return '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58';
|
|
112
|
-
}
|
|
113
|
-
case chains_1.polygon.id: {
|
|
114
|
-
return '0xc2132D05D31c914a87C6611C10748AEb04B58e8F';
|
|
115
|
-
}
|
|
116
|
-
case chains_1.zksync.id: {
|
|
117
|
-
return '0x493257fD37EDB34451f62EDf8D2a0C418852bA4C';
|
|
118
|
-
}
|
|
119
|
-
default: {
|
|
120
|
-
throw new Error(`Unsupported chain ${chain.id}`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
23
|
+
function getChainEntry(chainId) {
|
|
24
|
+
return registry[chainId.toString()];
|
|
123
25
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (tokenAddress === viem_1.zeroAddress) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
// USDC
|
|
132
|
-
if (tokenAddress === '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48') {
|
|
133
|
-
return 9n;
|
|
134
|
-
}
|
|
135
|
-
// WETH
|
|
136
|
-
if (tokenAddress === '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2') {
|
|
137
|
-
return 3n;
|
|
138
|
-
}
|
|
139
|
-
// USDT
|
|
140
|
-
if (tokenAddress === '0xdAC17F958D2ee523a2206206994597C13D831ec7') {
|
|
141
|
-
return 2n;
|
|
142
|
-
}
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
case chains_1.sepolia.id: {
|
|
146
|
-
// ETH
|
|
147
|
-
if (tokenAddress === viem_1.zeroAddress) {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
// USDC
|
|
151
|
-
if (tokenAddress === '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238') {
|
|
152
|
-
return 9n;
|
|
153
|
-
}
|
|
154
|
-
// WETH
|
|
155
|
-
if (tokenAddress === '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14') {
|
|
156
|
-
return 3n;
|
|
157
|
-
}
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
case chains_1.base.id: {
|
|
161
|
-
// ETH
|
|
162
|
-
if (tokenAddress === viem_1.zeroAddress) {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
// USDC
|
|
166
|
-
if (tokenAddress === '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913') {
|
|
167
|
-
return 9n;
|
|
168
|
-
}
|
|
169
|
-
// WETH
|
|
170
|
-
if (tokenAddress === '0x4200000000000000000000000000000000000006') {
|
|
171
|
-
return 3n;
|
|
172
|
-
}
|
|
173
|
-
// USDT
|
|
174
|
-
if (tokenAddress === '0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2') {
|
|
175
|
-
return 51n;
|
|
176
|
-
}
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
case chains_1.baseSepolia.id: {
|
|
180
|
-
// ETH
|
|
181
|
-
if (tokenAddress === viem_1.zeroAddress) {
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
// USDC
|
|
185
|
-
if (tokenAddress === '0x036CbD53842c5426634e7929541eC2318f3dCF7e') {
|
|
186
|
-
return 9n;
|
|
187
|
-
}
|
|
188
|
-
// WETH
|
|
189
|
-
if (tokenAddress === '0x4200000000000000000000000000000000000006') {
|
|
190
|
-
return 3n;
|
|
191
|
-
}
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
case chains_1.arbitrum.id: {
|
|
195
|
-
// ETH
|
|
196
|
-
if (tokenAddress === viem_1.zeroAddress) {
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
// USDC
|
|
200
|
-
if (tokenAddress === '0xaf88d065e77c8cC2239327C5EDb3A432268e5831') {
|
|
201
|
-
return 9n;
|
|
202
|
-
}
|
|
203
|
-
// WETH
|
|
204
|
-
if (tokenAddress === '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1') {
|
|
205
|
-
return 51n;
|
|
206
|
-
}
|
|
207
|
-
// USDT
|
|
208
|
-
if (tokenAddress === '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9') {
|
|
209
|
-
return 51n;
|
|
210
|
-
}
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
case chains_1.arbitrumSepolia.id: {
|
|
214
|
-
// ETH
|
|
215
|
-
if (tokenAddress === viem_1.zeroAddress) {
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
// USDC
|
|
219
|
-
if (tokenAddress === '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d') {
|
|
220
|
-
return 9n;
|
|
221
|
-
}
|
|
222
|
-
// WETH
|
|
223
|
-
if (tokenAddress === '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73') {
|
|
224
|
-
return 51n;
|
|
225
|
-
}
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
case chains_1.optimism.id: {
|
|
229
|
-
// ETH
|
|
230
|
-
if (tokenAddress === viem_1.zeroAddress) {
|
|
231
|
-
return null;
|
|
232
|
-
}
|
|
233
|
-
// USDC
|
|
234
|
-
if (tokenAddress === '0x0b2c639c533813f4aa9d7837caf62653d097ff85') {
|
|
235
|
-
return 9n;
|
|
236
|
-
}
|
|
237
|
-
// WETH
|
|
238
|
-
if (tokenAddress === '0x4200000000000000000000000000000000000006') {
|
|
239
|
-
return 3n;
|
|
240
|
-
}
|
|
241
|
-
// USDT
|
|
242
|
-
if (tokenAddress === '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58') {
|
|
243
|
-
return 0n;
|
|
244
|
-
}
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
case chains_1.optimismSepolia.id: {
|
|
248
|
-
// ETH
|
|
249
|
-
if (tokenAddress === viem_1.zeroAddress) {
|
|
250
|
-
return null;
|
|
251
|
-
}
|
|
252
|
-
// USDC
|
|
253
|
-
if (tokenAddress === '0x5fd84259d66Cd46123540766Be93DFE6D43130D7') {
|
|
254
|
-
return 9n;
|
|
255
|
-
}
|
|
256
|
-
// WETH
|
|
257
|
-
if (tokenAddress === '0x4200000000000000000000000000000000000006') {
|
|
258
|
-
return 3n;
|
|
259
|
-
}
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
case chains_1.polygon.id: {
|
|
263
|
-
// USDC
|
|
264
|
-
if (tokenAddress === '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359') {
|
|
265
|
-
return 9n;
|
|
266
|
-
}
|
|
267
|
-
// WETH
|
|
268
|
-
if (tokenAddress === '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619') {
|
|
269
|
-
return 3n;
|
|
270
|
-
}
|
|
271
|
-
// USDT
|
|
272
|
-
if (tokenAddress === '0xc2132D05D31c914a87C6611C10748AEb04B58e8F') {
|
|
273
|
-
return 0n;
|
|
274
|
-
}
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
case chains_1.polygonAmoy.id: {
|
|
278
|
-
// USDC
|
|
279
|
-
if (tokenAddress === '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582') {
|
|
280
|
-
return 9n;
|
|
281
|
-
}
|
|
282
|
-
// WETH
|
|
283
|
-
if (tokenAddress === '0x52eF3d68BaB452a294342DC3e5f464d7f610f72E') {
|
|
284
|
-
return 3n;
|
|
285
|
-
}
|
|
286
|
-
break;
|
|
287
|
-
}
|
|
288
|
-
case chains_1.zksync.id: {
|
|
289
|
-
// ETH
|
|
290
|
-
if (tokenAddress === viem_1.zeroAddress) {
|
|
291
|
-
return null;
|
|
292
|
-
}
|
|
293
|
-
// USDC
|
|
294
|
-
if (tokenAddress === '0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4') {
|
|
295
|
-
return 9n;
|
|
296
|
-
}
|
|
297
|
-
// WETH
|
|
298
|
-
if (tokenAddress === '0x5aea5775959fbc2557cc8789bc1bf90a239d9a91') {
|
|
299
|
-
return 3n;
|
|
300
|
-
}
|
|
301
|
-
// USDT
|
|
302
|
-
if (tokenAddress === '0x493257fD37EDB34451f62EDf8D2a0C418852bA4C') {
|
|
303
|
-
return 2n;
|
|
304
|
-
}
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
26
|
+
function getWethAddress(chain) {
|
|
27
|
+
const chainEntry = getChainEntry(chain.id);
|
|
28
|
+
if (!chainEntry) {
|
|
29
|
+
throw new Error(`Unsupported chain ${chain.id}`);
|
|
307
30
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const tokenAddress = getTokenAddress(tokenSymbol, chainId);
|
|
312
|
-
const chain = getChainById(chainId);
|
|
313
|
-
if (!chain) {
|
|
314
|
-
throw new Error(`Unsupported chain: ${chainId}`);
|
|
31
|
+
const wethToken = chainEntry.tokens.find((token) => token.symbol === 'WETH');
|
|
32
|
+
if (!wethToken) {
|
|
33
|
+
throw new Error(`WETH not found for chain ${chain.id}`);
|
|
315
34
|
}
|
|
316
|
-
|
|
317
|
-
const balanceSlot = rootBalanceSlot
|
|
318
|
-
? (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: 'address' }, { type: 'uint256' }], [accountAddress, rootBalanceSlot]))
|
|
319
|
-
: '0x';
|
|
320
|
-
return balanceSlot;
|
|
321
|
-
}
|
|
322
|
-
function getHookAddress(_chainId) {
|
|
323
|
-
return '0x0000000000f6Ed8Be424d673c63eeFF8b9267420';
|
|
324
|
-
}
|
|
325
|
-
function getSameChainModuleAddress(_chainId) {
|
|
326
|
-
return '0x000000000043ff16d5776c7F0f65Ec485C17Ca04';
|
|
327
|
-
}
|
|
328
|
-
function getTargetModuleAddress(_chainId) {
|
|
329
|
-
return '0x0000000000E5a37279A001301A837a91b5de1D5E';
|
|
330
|
-
}
|
|
331
|
-
function getRhinestoneSpokePoolAddress(_chainId) {
|
|
332
|
-
return '0x000000000060f6e853447881951574CDd0663530';
|
|
35
|
+
return wethToken.address;
|
|
333
36
|
}
|
|
334
37
|
function getTokenSymbol(tokenAddress, chainId) {
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
38
|
+
const chainEntry = getChainEntry(chainId);
|
|
39
|
+
if (!chainEntry) {
|
|
40
|
+
throw new Error(`Unsupported chain ${chainId}`);
|
|
41
|
+
}
|
|
42
|
+
const token = chainEntry.tokens.find((t) => t.address.toLowerCase() === tokenAddress.toLowerCase());
|
|
43
|
+
if (!token) {
|
|
44
|
+
throw new Error(`Unsupported token address ${tokenAddress} for chain ${chainId}`);
|
|
341
45
|
}
|
|
342
|
-
|
|
46
|
+
return token.symbol;
|
|
343
47
|
}
|
|
344
48
|
function getTokenAddress(tokenSymbol, chainId) {
|
|
345
49
|
if (chainId === 137 && tokenSymbol === 'ETH') {
|
|
@@ -348,20 +52,15 @@ function getTokenAddress(tokenSymbol, chainId) {
|
|
|
348
52
|
if (tokenSymbol === 'ETH') {
|
|
349
53
|
return viem_1.zeroAddress;
|
|
350
54
|
}
|
|
351
|
-
const
|
|
352
|
-
if (!
|
|
55
|
+
const chainEntry = getChainEntry(chainId);
|
|
56
|
+
if (!chainEntry) {
|
|
353
57
|
throw new Error(`Unsupported chain ${chainId}`);
|
|
354
58
|
}
|
|
355
|
-
|
|
356
|
-
|
|
59
|
+
const token = chainEntry.tokens.find((t) => t.symbol === tokenSymbol);
|
|
60
|
+
if (!token) {
|
|
61
|
+
throw new Error(`Unsupported token symbol ${tokenSymbol}`);
|
|
357
62
|
}
|
|
358
|
-
|
|
359
|
-
return getUsdcAddress(chain);
|
|
360
|
-
}
|
|
361
|
-
if (tokenSymbol === 'USDT') {
|
|
362
|
-
return getUsdtAddress(chain);
|
|
363
|
-
}
|
|
364
|
-
throw new Error(`Unsupported token symbol ${tokenSymbol}`);
|
|
63
|
+
return token.address;
|
|
365
64
|
}
|
|
366
65
|
function getChainById(chainId) {
|
|
367
66
|
const supportedChains = [
|
|
@@ -377,11 +76,7 @@ function getChainById(chainId) {
|
|
|
377
76
|
chains_1.polygonAmoy,
|
|
378
77
|
chains_1.zksync,
|
|
379
78
|
];
|
|
380
|
-
|
|
381
|
-
if (chain.id === chainId) {
|
|
382
|
-
return chain;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
79
|
+
return supportedChains.find((chain) => chain.id === chainId);
|
|
385
80
|
}
|
|
386
81
|
function isTestnet(chainId) {
|
|
387
82
|
const chain = getChainById(chainId);
|
|
@@ -391,54 +86,36 @@ function isTestnet(chainId) {
|
|
|
391
86
|
return chain.testnet ?? false;
|
|
392
87
|
}
|
|
393
88
|
function isTokenAddressSupported(address, chainId) {
|
|
394
|
-
const
|
|
395
|
-
if (!
|
|
396
|
-
throw new Error(`Chain not supported: ${chainId}`);
|
|
397
|
-
}
|
|
398
|
-
try {
|
|
399
|
-
getTokenSymbol(address, chainId);
|
|
400
|
-
return true;
|
|
401
|
-
}
|
|
402
|
-
catch {
|
|
89
|
+
const chainEntry = getChainEntry(chainId);
|
|
90
|
+
if (!chainEntry) {
|
|
403
91
|
return false;
|
|
404
92
|
}
|
|
93
|
+
return chainEntry.tokens.some((token) => token.address.toLowerCase() === address.toLowerCase());
|
|
405
94
|
}
|
|
406
95
|
function getSupportedTokens(chainId) {
|
|
407
|
-
const
|
|
408
|
-
if (!
|
|
96
|
+
const chainEntry = getChainEntry(chainId);
|
|
97
|
+
if (!chainEntry) {
|
|
409
98
|
throw new Error(`Chain not supported: ${chainId}`);
|
|
410
99
|
}
|
|
411
|
-
|
|
412
|
-
return knownSymbols.map((symbol) => {
|
|
413
|
-
const decimals = getTokenDecimals(symbol);
|
|
414
|
-
const address = getTokenAddress(symbol, chainId);
|
|
415
|
-
return {
|
|
416
|
-
symbol,
|
|
417
|
-
address,
|
|
418
|
-
decimals,
|
|
419
|
-
balanceSlot: (accountAddress) => getTokenBalanceSlot(symbol, chainId, accountAddress),
|
|
420
|
-
};
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
function getKnownSymbols() {
|
|
424
|
-
return ['ETH', 'WETH', 'USDC', 'USDT'];
|
|
425
|
-
}
|
|
426
|
-
function getTokenDecimals(symbol) {
|
|
427
|
-
switch (symbol) {
|
|
428
|
-
case 'ETH':
|
|
429
|
-
case 'WETH':
|
|
430
|
-
return 18;
|
|
431
|
-
case 'USDC':
|
|
432
|
-
case 'USDT':
|
|
433
|
-
return 6;
|
|
434
|
-
default:
|
|
435
|
-
throw new Error(`Symbol not supported: ${symbol}`);
|
|
436
|
-
}
|
|
100
|
+
return chainEntry.tokens;
|
|
437
101
|
}
|
|
438
102
|
function getDefaultAccountAccessList(onTestnets) {
|
|
103
|
+
const supportedChainIds = getSupportedChainIds();
|
|
104
|
+
const filteredChainIds = supportedChainIds.filter((chainId) => {
|
|
105
|
+
try {
|
|
106
|
+
return isTestnet(chainId) === !!onTestnets;
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
439
112
|
return {
|
|
440
|
-
chainIds:
|
|
441
|
-
? [chains_1.sepolia.id, chains_1.baseSepolia.id, chains_1.arbitrumSepolia.id, chains_1.optimismSepolia.id]
|
|
442
|
-
: [chains_1.mainnet.id, chains_1.base.id, chains_1.arbitrum.id, chains_1.optimism.id],
|
|
113
|
+
chainIds: filteredChainIds,
|
|
443
114
|
};
|
|
444
115
|
}
|
|
116
|
+
function resolveTokenAddress(token, chainId) {
|
|
117
|
+
if ((0, viem_1.isAddress)(token)) {
|
|
118
|
+
return token;
|
|
119
|
+
}
|
|
120
|
+
return getTokenAddress(token, chainId);
|
|
121
|
+
}
|