@charterlabs/rhinestone-sdk 0.2.8 → 0.3.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/error.d.ts +4 -1
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +9 -1
- package/dist/src/accounts/index.d.ts +11 -4
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +32 -10
- package/dist/src/accounts/json-rpc/index.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/index.js +4 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.test.js +33 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +2 -1
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/providers.js +8 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.test.js +43 -0
- package/dist/src/accounts/kernel.d.ts +9 -2
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +15 -1
- package/dist/src/accounts/nexus.d.ts +11 -4
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +19 -3
- package/dist/src/accounts/passport.d.ts +4 -4
- package/dist/src/accounts/passport.d.ts.map +1 -1
- package/dist/src/accounts/safe.d.ts +9 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +17 -1
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +26 -5
- package/dist/src/accounts/signing/message.js +1 -1
- package/dist/src/accounts/startale.d.ts +9 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +17 -1
- package/dist/src/accounts/walletClient.d.ts +27 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -1
- package/dist/src/accounts/walletClient.js +77 -0
- package/dist/src/actions/index.d.ts +1 -10
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.d.ts +2 -11
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +0 -10
- package/dist/src/errors/index.d.ts +3 -3
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +3 -1
- package/dist/src/execution/error.d.ts +8 -1
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +10 -1
- package/dist/src/execution/index.d.ts +9 -4
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +32 -12
- package/dist/src/execution/singleChainOps.d.ts +28 -0
- package/dist/src/execution/singleChainOps.d.ts.map +1 -0
- package/dist/src/execution/{multiChainOps.js → singleChainOps.js} +7 -14
- package/dist/src/execution/smart-session.d.ts +5 -7
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +113 -228
- package/dist/src/execution/utils.d.ts +4 -4
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +125 -29
- package/dist/src/index.d.ts +13 -15
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -6
- package/dist/src/modules/common.d.ts +3 -1
- package/dist/src/modules/common.d.ts.map +1 -1
- package/dist/src/modules/common.js +10 -0
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +15 -1
- package/dist/src/modules/validators/core.d.ts +5 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +39 -2
- package/dist/src/modules/validators/smart-sessions.d.ts +6 -6
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +23 -12
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +13 -1
- package/dist/src/orchestrator/error.d.ts +27 -1
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +10 -1
- package/dist/src/orchestrator/index.d.ts +6 -6
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +4 -3
- package/dist/src/orchestrator/registry.d.ts +6 -2
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +30 -70
- package/dist/src/orchestrator/registry.test.js +24 -24
- package/dist/src/orchestrator/types.d.ts +31 -21
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.js +3 -5
- package/dist/src/types.d.ts +43 -8
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +12 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +16 -0
- package/package.json +5 -5
- package/dist/src/execution/multiChainOps.d.ts +0 -40
- package/dist/src/execution/multiChainOps.d.ts.map +0 -1
- package/dist/src/execution/smart-session.test.d.ts +0 -2
- package/dist/src/execution/smart-session.test.d.ts.map +0 -1
- package/dist/src/execution/smart-session.test.js +0 -34
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WEBAUTHN_V0_VALIDATOR_ADDRESS = exports.MULTI_FACTOR_VALIDATOR_ADDRESS = exports.WEBAUTHN_VALIDATOR_ADDRESS = exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
|
|
3
|
+
exports.WEBAUTHN_V0_VALIDATOR_ADDRESS = exports.MULTI_FACTOR_VALIDATOR_ADDRESS = exports.WEBAUTHN_VALIDATOR_ADDRESS = exports.ENS_VALIDATOR_ADDRESS = exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
|
|
4
4
|
exports.getOwnerValidator = getOwnerValidator;
|
|
5
5
|
exports.getOwnableValidator = getOwnableValidator;
|
|
6
|
+
exports.getENSValidator = getENSValidator;
|
|
6
7
|
exports.getWebAuthnValidator = getWebAuthnValidator;
|
|
7
8
|
exports.getMultiFactorValidator = getMultiFactorValidator;
|
|
8
9
|
exports.getSocialRecoveryValidator = getSocialRecoveryValidator;
|
|
@@ -14,6 +15,8 @@ const error_1 = require("../../accounts/error");
|
|
|
14
15
|
const common_1 = require("../common");
|
|
15
16
|
const OWNABLE_VALIDATOR_ADDRESS = '0x000000000013fdb5234e4e3162a810f54d9f7e98';
|
|
16
17
|
exports.OWNABLE_VALIDATOR_ADDRESS = OWNABLE_VALIDATOR_ADDRESS;
|
|
18
|
+
const ENS_VALIDATOR_ADDRESS = '0xdc38f07b060374b6480c4bf06231e7d10955bca4';
|
|
19
|
+
exports.ENS_VALIDATOR_ADDRESS = ENS_VALIDATOR_ADDRESS;
|
|
17
20
|
const WEBAUTHN_VALIDATOR_ADDRESS = '0x0000000000578c4cb0e472a5462da43c495c3f33';
|
|
18
21
|
exports.WEBAUTHN_VALIDATOR_ADDRESS = WEBAUTHN_VALIDATOR_ADDRESS;
|
|
19
22
|
const SOCIAL_RECOVERY_VALIDATOR_ADDRESS = '0xa04d053b3c8021e8d5bf641816c42daa75d8b597';
|
|
@@ -34,7 +37,9 @@ function getOwnerValidator(config) {
|
|
|
34
37
|
}
|
|
35
38
|
function getMockSignature(ownerSet) {
|
|
36
39
|
switch (ownerSet.type) {
|
|
37
|
-
case 'ecdsa':
|
|
40
|
+
case 'ecdsa':
|
|
41
|
+
case 'ens': {
|
|
42
|
+
// ENS validator uses same mock signature format as ECDSA for UserOps
|
|
38
43
|
const owners = ownerSet.accounts.map((account) => account.address);
|
|
39
44
|
const signatures = owners.map(() => ECDSA_MOCK_SIGNATURE);
|
|
40
45
|
return (0, viem_1.concat)(signatures);
|
|
@@ -76,6 +81,8 @@ function getValidator(owners) {
|
|
|
76
81
|
switch (owners.type) {
|
|
77
82
|
case 'ecdsa':
|
|
78
83
|
return getOwnableValidator(owners.threshold ?? 1, owners.accounts.map((account) => account.address), owners.module);
|
|
84
|
+
case 'ens':
|
|
85
|
+
return getENSValidator(owners.threshold ?? 1, owners.accounts.map((account) => account.address), owners.ownerExpirations, owners.module);
|
|
79
86
|
case 'passkey':
|
|
80
87
|
return getWebAuthnValidator(owners.threshold ?? 1, owners.accounts.map((account) => ({
|
|
81
88
|
pubKey: account.publicKey,
|
|
@@ -101,6 +108,36 @@ function getOwnableValidator(threshold, owners, address) {
|
|
|
101
108
|
type: common_1.MODULE_TYPE_ID_VALIDATOR,
|
|
102
109
|
};
|
|
103
110
|
}
|
|
111
|
+
function getENSValidator(threshold, owners, ownerExpirations, address) {
|
|
112
|
+
// format: (uint256 threshold, Owner[] owners)
|
|
113
|
+
// where Owner is a tuple of (address addr, uint48 expiration)
|
|
114
|
+
const ownerPairs = owners.map((owner, index) => ({
|
|
115
|
+
addr: owner.toLowerCase(),
|
|
116
|
+
expiration: ownerExpirations[index] ?? viem_1.maxUint48,
|
|
117
|
+
}));
|
|
118
|
+
// Sort by address to match ENS validator's expectations
|
|
119
|
+
const sortedPairs = ownerPairs.sort((a, b) => a.addr.localeCompare(b.addr));
|
|
120
|
+
const ownersWithExpiration = sortedPairs;
|
|
121
|
+
const initData = (0, viem_1.encodeAbiParameters)([
|
|
122
|
+
{ name: 'threshold', type: 'uint256' },
|
|
123
|
+
{
|
|
124
|
+
name: 'owners',
|
|
125
|
+
type: 'tuple[]',
|
|
126
|
+
components: [
|
|
127
|
+
{ name: 'addr', type: 'address' },
|
|
128
|
+
{ name: 'expiration', type: 'uint48' },
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
], [BigInt(threshold), ownersWithExpiration]);
|
|
132
|
+
const moduleAddress = address ?? ENS_VALIDATOR_ADDRESS;
|
|
133
|
+
return {
|
|
134
|
+
address: moduleAddress,
|
|
135
|
+
initData,
|
|
136
|
+
deInitData: '0x',
|
|
137
|
+
additionalContext: '0x',
|
|
138
|
+
type: common_1.MODULE_TYPE_ID_VALIDATOR,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
104
141
|
function getWebAuthnValidator(threshold, webAuthnCredentials, address) {
|
|
105
142
|
function getPublicKey(webAuthnCredential) {
|
|
106
143
|
if (typeof webAuthnCredential.pubKey === 'string' ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address, type Hex, type PublicClient } from 'viem';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RhinestoneAccountConfig, Session } from '../../types';
|
|
3
3
|
import { type Module } from '../common';
|
|
4
4
|
interface SessionData {
|
|
5
5
|
sessionValidator: Address;
|
|
@@ -70,27 +70,27 @@ interface ERC7739Context {
|
|
|
70
70
|
contentName: readonly string[];
|
|
71
71
|
}
|
|
72
72
|
interface EnableSessionData {
|
|
73
|
-
permissionId: Hex;
|
|
74
|
-
accountType: AccountType;
|
|
75
73
|
chainDigestIndex: number;
|
|
76
74
|
hashesAndChainIds: ChainDigest[];
|
|
77
75
|
sessionToEnable: SessionData;
|
|
78
76
|
signature: Hex;
|
|
79
|
-
validator: Address;
|
|
80
77
|
}
|
|
81
78
|
declare const SMART_SESSIONS_VALIDATOR_ADDRESS: Address;
|
|
82
79
|
declare const SMART_SESSION_MODE_USE = "0x00";
|
|
83
80
|
declare const SMART_SESSION_MODE_ENABLE = "0x01";
|
|
84
81
|
declare const SMART_SESSION_MODE_UNSAFE_ENABLE = "0x02";
|
|
85
|
-
declare
|
|
82
|
+
declare const SMART_SESSIONS_FALLBACK_TARGET_FLAG: Address;
|
|
83
|
+
declare const SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG: Hex;
|
|
84
|
+
declare const SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION: Hex;
|
|
86
85
|
declare function getEnableSessionCall(session: Session): Promise<{
|
|
87
86
|
to: `0x${string}`;
|
|
88
87
|
data: `0x${string}`;
|
|
89
88
|
}>;
|
|
89
|
+
declare function getSmartSessionData(session: Session): SessionData;
|
|
90
90
|
declare function getSmartSessionValidator(config: RhinestoneAccountConfig): Module | null;
|
|
91
91
|
declare function isSessionEnabled(client: PublicClient, address: Address, permissionId: Hex): Promise<boolean>;
|
|
92
92
|
declare function encodeSmartSessionSignature(mode: SmartSessionModeType, permissionId: Hex, signature: Hex, enableSessionData?: EnableSessionData): `0x${string}`;
|
|
93
93
|
declare function getPermissionId(session: Session): `0x${string}`;
|
|
94
|
-
export { SMART_SESSION_MODE_USE, SMART_SESSION_MODE_ENABLE, SMART_SESSIONS_VALIDATOR_ADDRESS,
|
|
94
|
+
export { SMART_SESSION_MODE_USE, SMART_SESSION_MODE_ENABLE, SMART_SESSIONS_VALIDATOR_ADDRESS, SMART_SESSIONS_FALLBACK_TARGET_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION, getSmartSessionData, getSmartSessionValidator, getEnableSessionCall, encodeSmartSessionSignature, getPermissionId, isSessionEnabled, };
|
|
95
95
|
export type { EnableSessionData, ChainSession, ChainDigest, SessionData, SmartSessionModeType, };
|
|
96
96
|
//# sourceMappingURL=smart-sessions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EAIZ,KAAK,GAAG,EAGR,KAAK,YAAY,EAIlB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAEV,uBAAuB,EACvB,OAAO,EAER,MAAM,aAAa,CAAA;AAEpB,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AASjE,UAAU,WAAW;IACnB,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B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,GAAG,oBAiClB;AAED,iBAAS,2BAA2B,CAClC,IAAI,EAAE,oBAAoB,EAC1B,YAAY,EAAE,GAAG,EACjB,SAAS,EAAE,GAAG,EACd,iBAAiB,CAAC,EAAE,iBAAiB,iBAyBtC;AAoKD,iBAAS,eAAe,CAAC,OAAO,EAAE,OAAO,iBAyBxC;AAED,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,gCAAgC,EAChC,mCAAmC,EACnC,4CAA4C,EAC5C,2EAA2E,EAC3E,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC3B,eAAe,EACf,gBAAgB,GACjB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,oBAAoB,GACrB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SMART_SESSIONS_VALIDATOR_ADDRESS = exports.SMART_SESSION_MODE_ENABLE = exports.SMART_SESSION_MODE_USE = void 0;
|
|
4
|
-
exports.
|
|
3
|
+
exports.SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION = exports.SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG = exports.SMART_SESSIONS_FALLBACK_TARGET_FLAG = exports.SMART_SESSIONS_VALIDATOR_ADDRESS = exports.SMART_SESSION_MODE_ENABLE = exports.SMART_SESSION_MODE_USE = void 0;
|
|
4
|
+
exports.getSmartSessionData = getSmartSessionData;
|
|
5
5
|
exports.getSmartSessionValidator = getSmartSessionValidator;
|
|
6
6
|
exports.getEnableSessionCall = getEnableSessionCall;
|
|
7
7
|
exports.encodeSmartSessionSignature = encodeSmartSessionSignature;
|
|
@@ -26,7 +26,11 @@ const UNIVERSAL_ACTION_POLICY_ADDRESS = '0x0000006DDA6c463511C4e9B05CFc34C1247fC
|
|
|
26
26
|
const USAGE_LIMIT_POLICY_ADDRESS = '0x1F34eF8311345A3A4a4566aF321b313052F51493';
|
|
27
27
|
const VALUE_LIMIT_POLICY_ADDRESS = '0x730DA93267E7E513e932301B47F2ac7D062abC83';
|
|
28
28
|
const SMART_SESSIONS_FALLBACK_TARGET_FLAG = '0x0000000000000000000000000000000000000001';
|
|
29
|
+
exports.SMART_SESSIONS_FALLBACK_TARGET_FLAG = SMART_SESSIONS_FALLBACK_TARGET_FLAG;
|
|
29
30
|
const SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG = '0x00000001';
|
|
31
|
+
exports.SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG = SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG;
|
|
32
|
+
const SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION = '0x00000002';
|
|
33
|
+
exports.SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION = SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION;
|
|
30
34
|
const ACTION_CONDITION_EQUAL = 0;
|
|
31
35
|
const ACTION_CONDITION_GREATER_THAN = 1;
|
|
32
36
|
const ACTION_CONDITION_LESS_THAN = 2;
|
|
@@ -34,9 +38,6 @@ const ACTION_CONDITION_GREATER_THAN_OR_EQUAL = 3;
|
|
|
34
38
|
const ACTION_CONDITION_LESS_THAN_OR_EQUAL = 4;
|
|
35
39
|
const ACTION_CONDITION_NOT_EQUAL = 5;
|
|
36
40
|
const ACTION_CONDITION_IN_RANGE = 6;
|
|
37
|
-
async function getSessionData(session) {
|
|
38
|
-
return getSmartSessionData(session);
|
|
39
|
-
}
|
|
40
41
|
async function getEnableSessionCall(session) {
|
|
41
42
|
const sessionData = getSmartSessionData(session);
|
|
42
43
|
return {
|
|
@@ -73,19 +74,29 @@ function getSmartSessionData(session) {
|
|
|
73
74
|
{
|
|
74
75
|
type: 'sudo',
|
|
75
76
|
},
|
|
76
|
-
]).map((policy) =>
|
|
77
|
-
return getPolicyData(policy);
|
|
78
|
-
});
|
|
77
|
+
]).map((policy) => getPolicyData(policy));
|
|
79
78
|
return {
|
|
80
79
|
actionTargetSelector: action.selector,
|
|
81
80
|
actionTarget: action.target,
|
|
82
81
|
actionPolicies,
|
|
83
82
|
};
|
|
84
83
|
}),
|
|
85
|
-
erc7739Policies:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
erc7739Policies: session.signing
|
|
85
|
+
? {
|
|
86
|
+
allowedERC7739Content: session.signing.allowedContent.map((content) => ({
|
|
87
|
+
appDomainSeparator: content.domainSeparator,
|
|
88
|
+
contentName: content.contentName,
|
|
89
|
+
})),
|
|
90
|
+
erc1271Policies: (session.signing.policies || [
|
|
91
|
+
{
|
|
92
|
+
type: 'sudo',
|
|
93
|
+
},
|
|
94
|
+
]).map((policy) => getPolicyData(policy)),
|
|
95
|
+
}
|
|
96
|
+
: {
|
|
97
|
+
allowedERC7739Content: [],
|
|
98
|
+
erc1271Policies: [],
|
|
99
|
+
},
|
|
89
100
|
permitERC4337Paymaster: true,
|
|
90
101
|
};
|
|
91
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAe,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAe,MAAM,MAAM,CAAA;AAyBhD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EAET,cAAc,EACf,MAAM,SAAS,CAAA;AAGhB,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAAC,CAAQ;gBAEX,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAKxC,YAAY,CAChB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,MAAM,CAAC,EAAE;YACP,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAAA;SAC7B,CAAA;KACF,GACA,OAAO,CAAC,SAAS,CAAC;IA+Cf,iBAAiB,CACrB,WAAW,EAAE,OAAO,EACpB,kBAAkB,EAAE,MAAM,EAC1B,uBAAuB,EAAE,OAAO,EAChC,mBAAmB,EAAE,MAAM,EAC3B,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,MAAM,CAAC;IAqDZ,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAQtD,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAQxD,YAAY,CAChB,yBAAyB,EAAE,cAAc,EACzC,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,YAAY,CAAC;IAgBlB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IASlE,OAAO,CAAC,UAAU;YAUJ,KAAK;IA4BnB,OAAO,CAAC,UAAU;IA6GlB,OAAO,CAAC,iBAAiB;CAmG1B"}
|
|
@@ -58,7 +58,7 @@ class Orchestrator {
|
|
|
58
58
|
destinationExecutions: [],
|
|
59
59
|
destinationChainId,
|
|
60
60
|
destinationGasUnits,
|
|
61
|
-
|
|
61
|
+
tokenRequests: [
|
|
62
62
|
{
|
|
63
63
|
tokenAddress: destinationTokenAddress,
|
|
64
64
|
},
|
|
@@ -344,6 +344,18 @@ class Orchestrator {
|
|
|
344
344
|
message === 'encoding.unsupported') {
|
|
345
345
|
throw new error_1.BodyParserError({ message, ...errorParams });
|
|
346
346
|
}
|
|
347
|
+
else if (message === 'Bundle simulation failed') {
|
|
348
|
+
const simulations = errorParams.context.error.simulations;
|
|
349
|
+
const { traceId, errorType, statusCode, context } = errorParams;
|
|
350
|
+
throw new error_1.SimulationFailedError({
|
|
351
|
+
message,
|
|
352
|
+
context,
|
|
353
|
+
errorType,
|
|
354
|
+
traceId,
|
|
355
|
+
statusCode,
|
|
356
|
+
simulations,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
347
359
|
else {
|
|
348
360
|
throw new error_1.OrchestratorError({ message, ...errorParams });
|
|
349
361
|
}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
interface Simulation {
|
|
3
|
+
success: boolean;
|
|
4
|
+
call: {
|
|
5
|
+
chainId: number;
|
|
6
|
+
to: Address;
|
|
7
|
+
data: Hex;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
details: {
|
|
11
|
+
stateOverride: unknown[];
|
|
12
|
+
blockNumber: string;
|
|
13
|
+
relayer: string;
|
|
14
|
+
simulationUrl: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
1
17
|
declare class OrchestratorError extends Error {
|
|
2
18
|
private readonly _message;
|
|
3
19
|
private readonly _context;
|
|
@@ -197,10 +213,20 @@ declare class BodyParserError extends OrchestratorError {
|
|
|
197
213
|
statusCode?: number;
|
|
198
214
|
});
|
|
199
215
|
}
|
|
216
|
+
declare class SimulationFailedError extends OrchestratorError {
|
|
217
|
+
constructor(params?: {
|
|
218
|
+
message?: string;
|
|
219
|
+
context?: any;
|
|
220
|
+
errorType?: string;
|
|
221
|
+
traceId?: string;
|
|
222
|
+
statusCode?: number;
|
|
223
|
+
simulations?: Simulation[];
|
|
224
|
+
});
|
|
225
|
+
}
|
|
200
226
|
declare function isOrchestratorError(error: Error): error is OrchestratorError;
|
|
201
227
|
declare function isRateLimited(error: unknown): error is RateLimitedError;
|
|
202
228
|
declare function isValidationError(error: unknown): boolean;
|
|
203
229
|
declare function isAuthError(error: unknown): boolean;
|
|
204
230
|
declare function isRetryable(error: unknown): boolean;
|
|
205
|
-
export { isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, OrchestratorError, InsufficientBalanceError, UnsupportedChainIdError, UnsupportedChainError, UnsupportedTokenError, TokenNotSupportedError, AuthenticationRequiredError, InvalidApiKeyError, InvalidIntentSignatureError, OnlyOneTargetTokenAmountCanBeUnsetError, NoPathFoundError, IntentNotFoundError, SchemaValidationError, RateLimitedError, ServiceUnavailableError, UnauthorizedError, ForbiddenError, ResourceNotFoundError, ConflictError, BadRequestError, UnprocessableEntityError, InternalServerError, BodyParserError, };
|
|
231
|
+
export { isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, OrchestratorError, InsufficientBalanceError, UnsupportedChainIdError, UnsupportedChainError, UnsupportedTokenError, TokenNotSupportedError, AuthenticationRequiredError, InvalidApiKeyError, InvalidIntentSignatureError, OnlyOneTargetTokenAmountCanBeUnsetError, NoPathFoundError, IntentNotFoundError, SchemaValidationError, RateLimitedError, ServiceUnavailableError, UnauthorizedError, ForbiddenError, ResourceNotFoundError, ConflictError, BadRequestError, UnprocessableEntityError, InternalServerError, BodyParserError, SimulationFailedError, };
|
|
206
232
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../orchestrator/error.ts"],"names":[],"mappings":"AAAA,cAAM,iBAAkB,SAAQ,KAAK;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAQ;gBAE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,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB;CAMF;AAED,cAAM,eAAgB,SAAQ,iBAAiB;gBACjC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB;CAMF;AAED,iBAAS,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,iBAAiB,CAErE;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAKhE;AAED,iBAAS,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGlD;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK5C;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG5C;AAED,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,kBAAkB,EAClB,2BAA2B,EAC3B,uCAAuC,EACvC,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../orchestrator/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,E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AA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;KAC3B;CAMF;AAED,iBAAS,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,iBAAiB,CAErE;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAKhE;AAED,iBAAS,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGlD;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK5C;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG5C;AAED,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,kBAAkB,EAClB,2BAA2B,EAC3B,uCAAuC,EACvC,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACtB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BodyParserError = exports.InternalServerError = exports.UnprocessableEntityError = exports.BadRequestError = exports.ConflictError = exports.ResourceNotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.ServiceUnavailableError = exports.RateLimitedError = exports.SchemaValidationError = exports.IntentNotFoundError = exports.NoPathFoundError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.AuthenticationRequiredError = exports.TokenNotSupportedError = exports.UnsupportedTokenError = exports.UnsupportedChainError = exports.UnsupportedChainIdError = exports.InsufficientBalanceError = exports.OrchestratorError = void 0;
|
|
3
|
+
exports.SimulationFailedError = exports.BodyParserError = exports.InternalServerError = exports.UnprocessableEntityError = exports.BadRequestError = exports.ConflictError = exports.ResourceNotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.ServiceUnavailableError = exports.RateLimitedError = exports.SchemaValidationError = exports.IntentNotFoundError = exports.NoPathFoundError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.AuthenticationRequiredError = exports.TokenNotSupportedError = exports.UnsupportedTokenError = exports.UnsupportedChainError = exports.UnsupportedChainIdError = exports.InsufficientBalanceError = exports.OrchestratorError = void 0;
|
|
4
4
|
exports.isOrchestratorError = isOrchestratorError;
|
|
5
5
|
exports.isRetryable = isRetryable;
|
|
6
6
|
exports.isAuthError = isAuthError;
|
|
@@ -235,6 +235,15 @@ class BodyParserError extends OrchestratorError {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
exports.BodyParserError = BodyParserError;
|
|
238
|
+
class SimulationFailedError extends OrchestratorError {
|
|
239
|
+
constructor(params) {
|
|
240
|
+
super({
|
|
241
|
+
message: params?.message || 'Simulation failed',
|
|
242
|
+
...params,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.SimulationFailedError = SimulationFailedError;
|
|
238
247
|
function isOrchestratorError(error) {
|
|
239
248
|
return error instanceof OrchestratorError;
|
|
240
249
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Orchestrator } from './client';
|
|
2
2
|
import { RHINESTONE_SPOKE_POOL_ADDRESS } from './consts';
|
|
3
|
-
import { AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, IntentNotFoundError, InternalServerError, InvalidApiKeyError, InvalidIntentSignatureError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, RateLimitedError, ResourceNotFoundError, SchemaValidationError, ServiceUnavailableError, TokenNotSupportedError, UnauthorizedError, UnprocessableEntityError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './error';
|
|
4
|
-
import { getSupportedTokens, getTokenAddress, getTokenSymbol, getWethAddress, isTokenAddressSupported } from './registry';
|
|
5
|
-
import type { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, Portfolio, SettlementLayer, SignedIntentOp, SupportedChain, TokenConfig } from './types';
|
|
6
|
-
import { INTENT_STATUS_COMPLETED, INTENT_STATUS_EXPIRED, INTENT_STATUS_FAILED, INTENT_STATUS_FILLED,
|
|
3
|
+
import { AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, IntentNotFoundError, InternalServerError, InvalidApiKeyError, InvalidIntentSignatureError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, RateLimitedError, ResourceNotFoundError, SchemaValidationError, ServiceUnavailableError, SimulationFailedError, TokenNotSupportedError, UnauthorizedError, UnprocessableEntityError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './error';
|
|
4
|
+
import { getAllSupportedChainsAndTokens, getSupportedTokens, getTokenAddress, getTokenSymbol, getWethAddress, isTokenAddressSupported } from './registry';
|
|
5
|
+
import type { ApprovalRequired, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, Portfolio, SettlementLayer, SignedIntentOp, SupportedChain, TokenConfig, TokenRequirements, WrapRequired } from './types';
|
|
6
|
+
import { INTENT_STATUS_CLAIMED, INTENT_STATUS_COMPLETED, INTENT_STATUS_EXPIRED, INTENT_STATUS_FAILED, INTENT_STATUS_FILLED, INTENT_STATUS_PENDING, INTENT_STATUS_PRECONFIRMED } from './types';
|
|
7
7
|
declare function getOrchestrator(apiKey?: string, orchestratorUrl?: string): Orchestrator;
|
|
8
|
-
export type { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementLayer, SignedIntentOp, SupportedChain, TokenConfig, Portfolio, };
|
|
9
|
-
export { INTENT_STATUS_PENDING, INTENT_STATUS_EXPIRED,
|
|
8
|
+
export type { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementLayer, SignedIntentOp, SupportedChain, TokenConfig, Portfolio, TokenRequirements, WrapRequired, ApprovalRequired, };
|
|
9
|
+
export { INTENT_STATUS_PENDING, INTENT_STATUS_EXPIRED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_FAILED, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_CLAIMED, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, InternalServerError, ResourceNotFoundError, RateLimitedError, SchemaValidationError, ServiceUnavailableError, SimulationFailedError, UnprocessableEntityError, UnauthorizedError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getOrchestrator, getWethAddress, getTokenSymbol, getTokenAddress, getSupportedTokens, getAllSupportedChainsAndTokens, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, isTokenAddressSupported, };
|
|
10
10
|
//# 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,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,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,eAAe,EACf,cAAc,EACd,cAAc,EACd,WAAW,
|
|
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,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB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qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,8BAA8B,EAC9B,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,uBAAuB,GACxB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTokenAddressSupported = exports.isRateLimited = exports.isValidationError = exports.isAuthError = exports.isRetryable = exports.isOrchestratorError = exports.getSupportedTokens = exports.getTokenAddress = exports.getTokenSymbol = exports.getWethAddress = exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.UnauthorizedError = exports.UnprocessableEntityError = exports.ServiceUnavailableError = exports.SchemaValidationError = exports.RateLimitedError = exports.ResourceNotFoundError = exports.InternalServerError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.ForbiddenError = exports.ConflictError = exports.BodyParserError = exports.BadRequestError = exports.AuthenticationRequiredError = exports.Orchestrator = exports.RHINESTONE_SPOKE_POOL_ADDRESS = exports.
|
|
3
|
+
exports.isTokenAddressSupported = exports.isRateLimited = exports.isValidationError = exports.isAuthError = exports.isRetryable = exports.isOrchestratorError = exports.getAllSupportedChainsAndTokens = exports.getSupportedTokens = exports.getTokenAddress = exports.getTokenSymbol = exports.getWethAddress = exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.UnauthorizedError = exports.UnprocessableEntityError = exports.SimulationFailedError = exports.ServiceUnavailableError = exports.SchemaValidationError = exports.RateLimitedError = exports.ResourceNotFoundError = exports.InternalServerError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.ForbiddenError = exports.ConflictError = exports.BodyParserError = exports.BadRequestError = exports.AuthenticationRequiredError = exports.Orchestrator = exports.RHINESTONE_SPOKE_POOL_ADDRESS = exports.INTENT_STATUS_CLAIMED = exports.INTENT_STATUS_PRECONFIRMED = exports.INTENT_STATUS_FAILED = exports.INTENT_STATUS_FILLED = exports.INTENT_STATUS_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; } });
|
|
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "RateLimitedError", { enumerable: true, get: func
|
|
|
29
29
|
Object.defineProperty(exports, "ResourceNotFoundError", { enumerable: true, get: function () { return error_1.ResourceNotFoundError; } });
|
|
30
30
|
Object.defineProperty(exports, "SchemaValidationError", { enumerable: true, get: function () { return error_1.SchemaValidationError; } });
|
|
31
31
|
Object.defineProperty(exports, "ServiceUnavailableError", { enumerable: true, get: function () { return error_1.ServiceUnavailableError; } });
|
|
32
|
+
Object.defineProperty(exports, "SimulationFailedError", { enumerable: true, get: function () { return error_1.SimulationFailedError; } });
|
|
32
33
|
Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return error_1.TokenNotSupportedError; } });
|
|
33
34
|
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return error_1.UnauthorizedError; } });
|
|
34
35
|
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
|
|
@@ -36,20 +37,20 @@ Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get:
|
|
|
36
37
|
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return error_1.UnsupportedChainIdError; } });
|
|
37
38
|
Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return error_1.UnsupportedTokenError; } });
|
|
38
39
|
const registry_1 = require("./registry");
|
|
40
|
+
Object.defineProperty(exports, "getAllSupportedChainsAndTokens", { enumerable: true, get: function () { return registry_1.getAllSupportedChainsAndTokens; } });
|
|
39
41
|
Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return registry_1.getSupportedTokens; } });
|
|
40
42
|
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return registry_1.getTokenAddress; } });
|
|
41
43
|
Object.defineProperty(exports, "getTokenSymbol", { enumerable: true, get: function () { return registry_1.getTokenSymbol; } });
|
|
42
44
|
Object.defineProperty(exports, "getWethAddress", { enumerable: true, get: function () { return registry_1.getWethAddress; } });
|
|
43
45
|
Object.defineProperty(exports, "isTokenAddressSupported", { enumerable: true, get: function () { return registry_1.isTokenAddressSupported; } });
|
|
44
46
|
const types_1 = require("./types");
|
|
47
|
+
Object.defineProperty(exports, "INTENT_STATUS_CLAIMED", { enumerable: true, get: function () { return types_1.INTENT_STATUS_CLAIMED; } });
|
|
45
48
|
Object.defineProperty(exports, "INTENT_STATUS_COMPLETED", { enumerable: true, get: function () { return types_1.INTENT_STATUS_COMPLETED; } });
|
|
46
49
|
Object.defineProperty(exports, "INTENT_STATUS_EXPIRED", { enumerable: true, get: function () { return types_1.INTENT_STATUS_EXPIRED; } });
|
|
47
50
|
Object.defineProperty(exports, "INTENT_STATUS_FAILED", { enumerable: true, get: function () { return types_1.INTENT_STATUS_FAILED; } });
|
|
48
51
|
Object.defineProperty(exports, "INTENT_STATUS_FILLED", { enumerable: true, get: function () { return types_1.INTENT_STATUS_FILLED; } });
|
|
49
|
-
Object.defineProperty(exports, "INTENT_STATUS_PARTIALLY_COMPLETED", { enumerable: true, get: function () { return types_1.INTENT_STATUS_PARTIALLY_COMPLETED; } });
|
|
50
52
|
Object.defineProperty(exports, "INTENT_STATUS_PENDING", { enumerable: true, get: function () { return types_1.INTENT_STATUS_PENDING; } });
|
|
51
53
|
Object.defineProperty(exports, "INTENT_STATUS_PRECONFIRMED", { enumerable: true, get: function () { return types_1.INTENT_STATUS_PRECONFIRMED; } });
|
|
52
|
-
Object.defineProperty(exports, "INTENT_STATUS_UNKNOWN", { enumerable: true, get: function () { return types_1.INTENT_STATUS_UNKNOWN; } });
|
|
53
54
|
function getOrchestrator(apiKey, orchestratorUrl) {
|
|
54
55
|
return new client_1.Orchestrator(orchestratorUrl ?? consts_1.PROD_ORCHESTRATOR_URL, apiKey);
|
|
55
56
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address, type Chain } from 'viem';
|
|
2
2
|
import type { TokenSymbol } from '../types';
|
|
3
3
|
import type { TokenConfig } from './types';
|
|
4
4
|
declare function getSupportedChainIds(): number[];
|
|
@@ -13,5 +13,9 @@ declare function getDefaultAccountAccessList(onTestnets?: boolean): {
|
|
|
13
13
|
chainIds: number[];
|
|
14
14
|
};
|
|
15
15
|
declare function resolveTokenAddress(token: TokenSymbol | Address, chainId: number): Address;
|
|
16
|
-
|
|
16
|
+
declare function getAllSupportedChainsAndTokens(): {
|
|
17
|
+
chainId: number;
|
|
18
|
+
tokens: TokenConfig[];
|
|
19
|
+
}[];
|
|
20
|
+
export { getTokenSymbol, getTokenAddress, getWethAddress, getChainById, getSupportedTokens, getSupportedChainIds, isTestnet, isTokenAddressSupported, getDefaultAccountAccessList, resolveTokenAddress, getAllSupportedChainsAndTokens, };
|
|
17
21
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../orchestrator/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../orchestrator/registry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,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ding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.getTokenSymbol = getTokenSymbol;
|
|
37
4
|
exports.getTokenAddress = getTokenAddress;
|
|
@@ -43,17 +10,15 @@ exports.isTestnet = isTestnet;
|
|
|
43
10
|
exports.isTokenAddressSupported = isTokenAddressSupported;
|
|
44
11
|
exports.getDefaultAccountAccessList = getDefaultAccountAccessList;
|
|
45
12
|
exports.resolveTokenAddress = resolveTokenAddress;
|
|
46
|
-
|
|
13
|
+
exports.getAllSupportedChainsAndTokens = getAllSupportedChainsAndTokens;
|
|
14
|
+
const shared_configs_1 = require("@rhinestone/shared-configs");
|
|
47
15
|
const viem_1 = require("viem");
|
|
48
|
-
const chains_1 = require("viem/chains");
|
|
49
16
|
const error_1 = require("./error");
|
|
50
17
|
function getSupportedChainIds() {
|
|
51
|
-
|
|
52
|
-
return arr.map((c) => c.id);
|
|
18
|
+
return shared_configs_1.chains.map((chain) => chain.id);
|
|
53
19
|
}
|
|
54
20
|
function getChainEntry(chainId) {
|
|
55
|
-
|
|
56
|
-
return registry[chainId.toString()];
|
|
21
|
+
return shared_configs_1.chainRegistry[chainId.toString()];
|
|
57
22
|
}
|
|
58
23
|
function getWethAddress(chain) {
|
|
59
24
|
const chainEntry = getChainEntry(chain.id);
|
|
@@ -78,40 +43,24 @@ function getTokenSymbol(tokenAddress, chainId) {
|
|
|
78
43
|
return token.symbol;
|
|
79
44
|
}
|
|
80
45
|
function getTokenAddress(token, chainId) {
|
|
81
|
-
if (!isChainIdSupported(chainId)) {
|
|
82
|
-
throw new error_1.UnsupportedChainError(chainId);
|
|
83
|
-
}
|
|
84
46
|
if (typeof token === 'string' && (0, viem_1.isAddress)(token))
|
|
85
47
|
return token;
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
48
|
+
const chainEntry = getChainEntry(chainId);
|
|
49
|
+
if (!chainEntry) {
|
|
50
|
+
throw new error_1.UnsupportedChainError(chainId);
|
|
51
|
+
}
|
|
52
|
+
const tokenEntry = chainEntry.tokens.find((t) => t.symbol === token);
|
|
53
|
+
if (!tokenEntry) {
|
|
89
54
|
throw new error_1.UnsupportedTokenError(token, chainId);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
function isChainIdSupported(chainId) {
|
|
93
|
-
const arr = (shared.chains ?? []);
|
|
94
|
-
const chainIds = arr.map((c) => c.id);
|
|
95
|
-
return chainIds.includes(chainId);
|
|
55
|
+
}
|
|
56
|
+
return tokenEntry.address;
|
|
96
57
|
}
|
|
97
58
|
function getChainById(chainId) {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
[chains_1.sepolia.id]: chains_1.sepolia,
|
|
101
|
-
[chains_1.base.id]: chains_1.base,
|
|
102
|
-
[chains_1.baseSepolia.id]: chains_1.baseSepolia,
|
|
103
|
-
[chains_1.arbitrum.id]: chains_1.arbitrum,
|
|
104
|
-
[chains_1.arbitrumSepolia.id]: chains_1.arbitrumSepolia,
|
|
105
|
-
[chains_1.optimism.id]: chains_1.optimism,
|
|
106
|
-
[chains_1.optimismSepolia.id]: chains_1.optimismSepolia,
|
|
107
|
-
[chains_1.polygon.id]: chains_1.polygon,
|
|
108
|
-
[chains_1.soneium.id]: chains_1.soneium,
|
|
109
|
-
[chains_1.sonic.id]: chains_1.sonic,
|
|
110
|
-
};
|
|
111
|
-
if (!isChainIdSupported(chainId)) {
|
|
59
|
+
const chain = shared_configs_1.chains.find((chain) => chain.id === chainId);
|
|
60
|
+
if (!chain) {
|
|
112
61
|
throw new error_1.UnsupportedChainError(chainId);
|
|
113
62
|
}
|
|
114
|
-
return
|
|
63
|
+
return chain;
|
|
115
64
|
}
|
|
116
65
|
function isTestnet(chainId) {
|
|
117
66
|
const chain = getChainById(chainId);
|
|
@@ -122,14 +71,18 @@ function isTokenAddressSupported(address, chainId) {
|
|
|
122
71
|
if (!chainEntry) {
|
|
123
72
|
return false;
|
|
124
73
|
}
|
|
125
|
-
return chainEntry.tokens
|
|
74
|
+
return chainEntry.tokens
|
|
75
|
+
.filter((token) => token.supportsMultichain)
|
|
76
|
+
.some((token) => token.address.toLowerCase() === address.toLowerCase());
|
|
126
77
|
}
|
|
127
78
|
function getSupportedTokens(chainId) {
|
|
128
|
-
|
|
79
|
+
const chainEntry = getChainEntry(chainId);
|
|
80
|
+
if (!chainEntry) {
|
|
129
81
|
throw new error_1.UnsupportedChainError(chainId);
|
|
130
82
|
}
|
|
131
|
-
|
|
132
|
-
|
|
83
|
+
return chainEntry.tokens
|
|
84
|
+
.filter((token) => token.supportsMultichain)
|
|
85
|
+
.map((t) => ({
|
|
133
86
|
symbol: t.symbol,
|
|
134
87
|
address: t.address,
|
|
135
88
|
decimals: t.decimals,
|
|
@@ -155,3 +108,10 @@ function resolveTokenAddress(token, chainId) {
|
|
|
155
108
|
}
|
|
156
109
|
return getTokenAddress(token, chainId);
|
|
157
110
|
}
|
|
111
|
+
function getAllSupportedChainsAndTokens() {
|
|
112
|
+
const supportedChainIds = getSupportedChainIds();
|
|
113
|
+
return supportedChainIds.map((chainId) => ({
|
|
114
|
+
chainId,
|
|
115
|
+
tokens: getSupportedTokens(chainId),
|
|
116
|
+
}));
|
|
117
|
+
}
|