@rhinestone/sdk 0.12.1 → 0.12.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 +5 -3
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +16 -15
- package/dist/src/accounts/kernel.d.ts +2 -1
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +7 -1
- package/dist/src/accounts/nexus.d.ts +2 -1
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +7 -1
- package/dist/src/accounts/safe.d.ts +2 -1
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +7 -1
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +15 -2
- package/dist/src/actions/index.d.ts +3 -1
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +5 -0
- package/dist/src/actions/registry.d.ts +7 -0
- package/dist/src/actions/registry.d.ts.map +1 -0
- package/dist/src/actions/registry.js +7 -0
- package/dist/src/actions/registry.test.d.ts +2 -0
- package/dist/src/actions/registry.test.d.ts.map +1 -0
- package/dist/src/actions/registry.test.js +25 -0
- package/dist/src/actions/smart-session.d.ts +5 -0
- package/dist/src/actions/smart-session.d.ts.map +1 -0
- package/dist/src/actions/smart-session.js +7 -0
- package/dist/src/execution/index.d.ts +2 -2
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +4 -1
- package/dist/src/execution/smart-session.d.ts +11 -1
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +264 -0
- package/dist/src/execution/smart-session.test.js +28 -0
- package/dist/src/execution/utils.d.ts +3 -3
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +76 -7
- package/dist/src/index.d.ts +11 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +25 -1
- package/dist/src/modules/index.d.ts +6 -1
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +15 -6
- package/dist/src/modules/read.d.ts +10 -0
- package/dist/src/modules/read.d.ts.map +1 -0
- package/dist/src/modules/read.js +152 -0
- package/dist/src/modules/validators/core.d.ts +2 -1
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +2 -1
- package/dist/src/modules/validators/smart-sessions.d.ts +49 -5
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +176 -4
- package/dist/src/orchestrator/client.js +1 -1
- package/dist/src/orchestrator/registry.d.ts +2 -2
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +4 -2
- package/dist/src/types.d.ts +11 -2
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOwnerValidator = exports.getTrustedAttesters = exports.getTrustAttesterCall = exports.HOOK_ADDRESS = void 0;
|
|
3
|
+
exports.getValidators = exports.getOwners = exports.areAttestersTrusted = exports.getOwnerValidator = exports.getTrustedAttesters = exports.getTrustAttesterCall = exports.HOOK_ADDRESS = void 0;
|
|
4
4
|
exports.getSetup = getSetup;
|
|
5
5
|
exports.getWebauthnValidatorSignature = getWebauthnValidatorSignature;
|
|
6
|
+
exports.getAttesters = getAttesters;
|
|
6
7
|
exports.isRip7212SupportedNetwork = isRip7212SupportedNetwork;
|
|
7
8
|
const viem_1 = require("viem");
|
|
8
9
|
const chains_1 = require("viem/chains");
|
|
9
10
|
const common_1 = require("./common");
|
|
10
11
|
const omni_account_1 = require("./omni-account");
|
|
11
12
|
Object.defineProperty(exports, "HOOK_ADDRESS", { enumerable: true, get: function () { return omni_account_1.HOOK_ADDRESS; } });
|
|
13
|
+
const read_1 = require("./read");
|
|
14
|
+
Object.defineProperty(exports, "areAttestersTrusted", { enumerable: true, get: function () { return read_1.areAttestersTrusted; } });
|
|
15
|
+
Object.defineProperty(exports, "getOwners", { enumerable: true, get: function () { return read_1.getOwners; } });
|
|
16
|
+
Object.defineProperty(exports, "getValidators", { enumerable: true, get: function () { return read_1.getValidators; } });
|
|
12
17
|
const registry_1 = require("./registry");
|
|
13
18
|
Object.defineProperty(exports, "getTrustAttesterCall", { enumerable: true, get: function () { return registry_1.getTrustAttesterCall; } });
|
|
14
19
|
Object.defineProperty(exports, "getTrustedAttesters", { enumerable: true, get: function () { return registry_1.getTrustedAttesters; } });
|
|
@@ -80,17 +85,15 @@ function getSetup(config) {
|
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
87
|
const hooks = [];
|
|
88
|
+
const attesters = getAttesters();
|
|
83
89
|
return {
|
|
84
90
|
validators,
|
|
85
91
|
executors,
|
|
86
92
|
fallbacks,
|
|
87
93
|
hooks,
|
|
88
94
|
registry: omni_account_1.RHINESTONE_MODULE_REGISTRY_ADDRESS,
|
|
89
|
-
attesters:
|
|
90
|
-
|
|
91
|
-
omni_account_1.OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS,
|
|
92
|
-
],
|
|
93
|
-
threshold: 1,
|
|
95
|
+
attesters: attesters.list,
|
|
96
|
+
threshold: attesters.threshold,
|
|
94
97
|
};
|
|
95
98
|
}
|
|
96
99
|
function getWebauthnValidatorSignature({ webauthn, signature, usePrecompiled = false, }) {
|
|
@@ -159,3 +162,9 @@ function parseSignature(signature) {
|
|
|
159
162
|
s: BigInt((0, viem_1.bytesToHex)(s)),
|
|
160
163
|
};
|
|
161
164
|
}
|
|
165
|
+
function getAttesters() {
|
|
166
|
+
return {
|
|
167
|
+
list: [omni_account_1.RHINESTONE_ATTESTER_ADDRESS, omni_account_1.OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS],
|
|
168
|
+
threshold: 1,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Address, Chain } from 'viem';
|
|
2
|
+
import { AccountType } from '../types';
|
|
3
|
+
declare function getValidators(accountType: AccountType, account: Address, chain: Chain): Promise<Address[]>;
|
|
4
|
+
declare function getOwners(account: Address, chain: Chain): Promise<{
|
|
5
|
+
accounts: Address[];
|
|
6
|
+
threshold: number;
|
|
7
|
+
} | null>;
|
|
8
|
+
declare function areAttestersTrusted(account: Address, chain: Chain): Promise<boolean>;
|
|
9
|
+
export { getValidators, getOwners, areAttestersTrusted };
|
|
10
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../modules/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAwC,MAAM,MAAM,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAKtC,iBAAe,aAAa,CAC1B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,OAAO,EAAE,CAAC,CA6CpB;AAED,iBAAe,SAAS,CACtB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,GACX,OAAO,CAAC;IACT,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,IAAI,CAAC,CAkER;AAED,iBAAe,mBAAmB,CAChC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,OAAO,CAAC,CA+BlB;AAED,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getValidators = getValidators;
|
|
4
|
+
exports.getOwners = getOwners;
|
|
5
|
+
exports.areAttestersTrusted = areAttestersTrusted;
|
|
6
|
+
const viem_1 = require("viem");
|
|
7
|
+
const _1 = require(".");
|
|
8
|
+
const omni_account_1 = require("./omni-account");
|
|
9
|
+
const core_1 = require("./validators/core");
|
|
10
|
+
async function getValidators(accountType, account, chain) {
|
|
11
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
12
|
+
chain,
|
|
13
|
+
transport: (0, viem_1.http)(),
|
|
14
|
+
});
|
|
15
|
+
switch (accountType) {
|
|
16
|
+
case 'safe':
|
|
17
|
+
case 'nexus': {
|
|
18
|
+
const validators = await publicClient.readContract({
|
|
19
|
+
abi: [
|
|
20
|
+
{
|
|
21
|
+
name: 'getValidatorsPaginated',
|
|
22
|
+
type: 'function',
|
|
23
|
+
inputs: [
|
|
24
|
+
{
|
|
25
|
+
name: 'cursor',
|
|
26
|
+
type: 'address',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'pageSize',
|
|
30
|
+
type: 'uint256',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
outputs: [
|
|
34
|
+
{
|
|
35
|
+
name: 'array',
|
|
36
|
+
type: 'address[]',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'next',
|
|
40
|
+
type: 'address',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
functionName: 'getValidatorsPaginated',
|
|
46
|
+
address: account,
|
|
47
|
+
args: ['0x0000000000000000000000000000000000000001', 100n],
|
|
48
|
+
});
|
|
49
|
+
return validators[0];
|
|
50
|
+
}
|
|
51
|
+
case 'kernel': {
|
|
52
|
+
throw new Error('Kernel not supported');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function getOwners(account, chain) {
|
|
57
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
58
|
+
chain,
|
|
59
|
+
transport: (0, viem_1.http)(),
|
|
60
|
+
});
|
|
61
|
+
const moduleAddress = core_1.OWNABLE_VALIDATOR_ADDRESS;
|
|
62
|
+
const [ownerResult, thresholdResult] = await publicClient.multicall({
|
|
63
|
+
contracts: [
|
|
64
|
+
{
|
|
65
|
+
abi: [
|
|
66
|
+
{
|
|
67
|
+
name: 'getOwners',
|
|
68
|
+
type: 'function',
|
|
69
|
+
inputs: [
|
|
70
|
+
{
|
|
71
|
+
name: 'account',
|
|
72
|
+
type: 'address',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
outputs: [
|
|
76
|
+
{
|
|
77
|
+
name: '',
|
|
78
|
+
type: 'address[]',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
functionName: 'getOwners',
|
|
84
|
+
address: moduleAddress,
|
|
85
|
+
args: [account],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
abi: [
|
|
89
|
+
{
|
|
90
|
+
name: 'threshold',
|
|
91
|
+
type: 'function',
|
|
92
|
+
inputs: [
|
|
93
|
+
{
|
|
94
|
+
name: 'module',
|
|
95
|
+
type: 'address',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
outputs: [
|
|
99
|
+
{
|
|
100
|
+
name: '',
|
|
101
|
+
type: 'uint256',
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
functionName: 'threshold',
|
|
107
|
+
address: moduleAddress,
|
|
108
|
+
args: [account],
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
});
|
|
112
|
+
if (ownerResult.error) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
if (thresholdResult.error) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
accounts: ownerResult.result,
|
|
120
|
+
threshold: thresholdResult.result,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
async function areAttestersTrusted(account, chain) {
|
|
124
|
+
const { list: requiredAttesters } = (0, _1.getAttesters)();
|
|
125
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
126
|
+
chain,
|
|
127
|
+
transport: (0, viem_1.http)(),
|
|
128
|
+
});
|
|
129
|
+
const trustedAttesters = await publicClient.readContract({
|
|
130
|
+
abi: [
|
|
131
|
+
{
|
|
132
|
+
type: 'function',
|
|
133
|
+
name: 'findTrustedAttesters',
|
|
134
|
+
inputs: [
|
|
135
|
+
{
|
|
136
|
+
type: 'address',
|
|
137
|
+
name: 'smartAccount',
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
outputs: [
|
|
141
|
+
{
|
|
142
|
+
type: 'address[]',
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
functionName: 'findTrustedAttesters',
|
|
148
|
+
address: omni_account_1.RHINESTONE_MODULE_REGISTRY_ADDRESS,
|
|
149
|
+
args: [account],
|
|
150
|
+
});
|
|
151
|
+
return requiredAttesters.every((attester) => trustedAttesters.includes((0, viem_1.getAddress)(attester)));
|
|
152
|
+
}
|
|
@@ -11,6 +11,7 @@ interface WebauthnCredential {
|
|
|
11
11
|
authenticatorId: string;
|
|
12
12
|
}
|
|
13
13
|
declare const OWNABLE_VALIDATOR_ADDRESS: Address;
|
|
14
|
+
declare const WEBAUTHN_VALIDATOR_ADDRESS: Address;
|
|
14
15
|
declare function getOwnerValidator(config: RhinestoneAccountConfig): Module;
|
|
15
16
|
declare function getMockSignature(ownerSet: OwnerSet): Hex;
|
|
16
17
|
declare function getValidator(owners: OwnerSet): Module;
|
|
@@ -20,6 +21,6 @@ declare function getOwnableValidator({ threshold, owners, }: {
|
|
|
20
21
|
}): Module;
|
|
21
22
|
declare function getWebAuthnValidator(webAuthnCredential: WebauthnCredential): Module;
|
|
22
23
|
declare function getSocialRecoveryValidator(guardians: Account[], threshold?: number): Module;
|
|
23
|
-
export { OWNABLE_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
|
|
24
|
+
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
|
|
24
25
|
export type { WebauthnCredential };
|
|
25
26
|
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,OAAO,EAIZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAEjE,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,SAAS,GAAG,GAAG,GAAG,UAAU,CAAA;IACpC,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,QAAA,MAAM,yBAAyB,EAAE,OACa,CAAA;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,OAAO,EAIZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAEjE,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,SAAS,GAAG,GAAG,GAAG,UAAU,CAAA;IACpC,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,QAAA,MAAM,yBAAyB,EAAE,OACa,CAAA;AAC9C,QAAA,MAAM,0BAA0B,EAAE,OACY,CAAA;AAS9C,iBAAS,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,UAEzD;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAUjD;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,QAAQ,UAarC;AAED,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,OAAO,EAAE,CAAA;CAClB,GAAG,MAAM,CAiBT;AAED,iBAAS,oBAAoB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,MAAM,CAwD5E;AAED,iBAAS,0BAA0B,CACjC,SAAS,EAAE,OAAO,EAAE,EACpB,SAAS,SAAI,GACZ,MAAM,CAsBR;AAeD,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,CAAA;AACD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
|
|
3
|
+
exports.WEBAUTHN_VALIDATOR_ADDRESS = exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
|
|
4
4
|
exports.getOwnerValidator = getOwnerValidator;
|
|
5
5
|
exports.getOwnableValidator = getOwnableValidator;
|
|
6
6
|
exports.getWebAuthnValidator = getWebAuthnValidator;
|
|
@@ -12,6 +12,7 @@ const common_1 = require("../common");
|
|
|
12
12
|
const OWNABLE_VALIDATOR_ADDRESS = '0x2483DA3A338895199E5e538530213157e931Bf06';
|
|
13
13
|
exports.OWNABLE_VALIDATOR_ADDRESS = OWNABLE_VALIDATOR_ADDRESS;
|
|
14
14
|
const WEBAUTHN_VALIDATOR_ADDRESS = '0x2f167e55d42584f65e2e30a748f41ee75a311414';
|
|
15
|
+
exports.WEBAUTHN_VALIDATOR_ADDRESS = WEBAUTHN_VALIDATOR_ADDRESS;
|
|
15
16
|
const SOCIAL_RECOVERY_VALIDATOR_ADDRESS = '0xA04D053b3C8021e8D5bF641816c42dAA75D8b597';
|
|
16
17
|
const ECDSA_MOCK_SIGNATURE = '0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b';
|
|
17
18
|
const WEBAUTHN_MOCK_SIGNATURE = '0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001635bc6d0f68ff895cae8a288ecf7542a6a9cd555df784b73e1e2ea7e9104b1db15e9015d280cb19527881c625fee43fd3a405d5b0d199a8c8e6589a7381209e40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f47b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22746278584e465339585f3442797231634d77714b724947422d5f3330613051685a36793775634d30424f45222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73652c20226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d000000000000000000000000';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address, type Chain, type Hex, type PublicClient } from 'viem';
|
|
2
|
-
import type { RhinestoneAccountConfig, Session } from '../../types';
|
|
2
|
+
import type { AccountType, RhinestoneAccountConfig, Session } from '../../types';
|
|
3
3
|
import { type Module } from '../common';
|
|
4
4
|
interface SessionData {
|
|
5
5
|
sessionValidator: Address;
|
|
@@ -26,8 +26,8 @@ interface AllowedERC7739Content {
|
|
|
26
26
|
contentName: readonly string[];
|
|
27
27
|
}
|
|
28
28
|
interface ActionData {
|
|
29
|
-
actionTarget: Address;
|
|
30
29
|
actionTargetSelector: Hex;
|
|
30
|
+
actionTarget: Address;
|
|
31
31
|
actionPolicies: readonly PolicyData[];
|
|
32
32
|
}
|
|
33
33
|
interface PolicyData {
|
|
@@ -35,10 +35,54 @@ interface PolicyData {
|
|
|
35
35
|
initData: Hex;
|
|
36
36
|
}
|
|
37
37
|
type SmartSessionModeType = typeof SMART_SESSION_MODE_USE | typeof SMART_SESSION_MODE_ENABLE | typeof SMART_SESSION_MODE_UNSAFE_ENABLE;
|
|
38
|
+
interface ChainDigest {
|
|
39
|
+
chainId: bigint;
|
|
40
|
+
sessionDigest: Hex;
|
|
41
|
+
}
|
|
42
|
+
interface SignedPermissions {
|
|
43
|
+
permitGenericPolicy: boolean;
|
|
44
|
+
permitAdminAccess: boolean;
|
|
45
|
+
ignoreSecurityAttestations: boolean;
|
|
46
|
+
permitERC4337Paymaster: boolean;
|
|
47
|
+
userOpPolicies: readonly PolicyData[];
|
|
48
|
+
erc7739Policies: ERC7739Data;
|
|
49
|
+
actions: readonly ActionData[];
|
|
50
|
+
}
|
|
51
|
+
interface SignedSession {
|
|
52
|
+
account: Address;
|
|
53
|
+
permissions: SignedPermissions;
|
|
54
|
+
sessionValidator: Address;
|
|
55
|
+
sessionValidatorInitData: Hex;
|
|
56
|
+
salt: Hex;
|
|
57
|
+
smartSession: Address;
|
|
58
|
+
nonce: bigint;
|
|
59
|
+
}
|
|
60
|
+
interface ChainSession {
|
|
61
|
+
chainId: bigint;
|
|
62
|
+
session: SignedSession;
|
|
63
|
+
}
|
|
64
|
+
interface ERC7739Data {
|
|
65
|
+
allowedERC7739Content: readonly ERC7739Context[];
|
|
66
|
+
erc1271Policies: readonly PolicyData[];
|
|
67
|
+
}
|
|
68
|
+
interface ERC7739Context {
|
|
69
|
+
appDomainSeparator: Hex;
|
|
70
|
+
contentName: readonly string[];
|
|
71
|
+
}
|
|
72
|
+
interface EnableSessionData {
|
|
73
|
+
permissionId: Hex;
|
|
74
|
+
accountType: AccountType;
|
|
75
|
+
chainDigestIndex: number;
|
|
76
|
+
hashesAndChainIds: ChainDigest[];
|
|
77
|
+
sessionToEnable: SessionData;
|
|
78
|
+
signature: Hex;
|
|
79
|
+
validator: Address;
|
|
80
|
+
}
|
|
38
81
|
declare const SMART_SESSIONS_VALIDATOR_ADDRESS: Address;
|
|
39
82
|
declare const SMART_SESSION_MODE_USE = "0x00";
|
|
40
83
|
declare const SMART_SESSION_MODE_ENABLE = "0x01";
|
|
41
84
|
declare const SMART_SESSION_MODE_UNSAFE_ENABLE = "0x02";
|
|
85
|
+
declare function getSessionData(chain: Chain, session: Session): Promise<SessionData>;
|
|
42
86
|
declare function getEnableSessionCall(chain: Chain, session: Session): Promise<{
|
|
43
87
|
to: `0x${string}`;
|
|
44
88
|
data: `0x${string}`;
|
|
@@ -49,7 +93,7 @@ declare function getSessionAllowedERC7739Content(chain: Chain): Promise<{
|
|
|
49
93
|
}>;
|
|
50
94
|
declare function getSmartSessionValidator(config: RhinestoneAccountConfig): Module | null;
|
|
51
95
|
declare function isSessionEnabled(client: PublicClient, address: Address, permissionId: Hex): Promise<boolean>;
|
|
52
|
-
declare function encodeSmartSessionSignature(mode: SmartSessionModeType, permissionId: Hex, signature: Hex): `0x${string}`;
|
|
96
|
+
declare function encodeSmartSessionSignature(mode: SmartSessionModeType, permissionId: Hex, signature: Hex, enableSessionData?: EnableSessionData): `0x${string}`;
|
|
53
97
|
declare function getPermissionId(session: Session): `0x${string}`;
|
|
54
98
|
declare function getAccountEIP712Domain(client: PublicClient, account: Address): Promise<{
|
|
55
99
|
name: string;
|
|
@@ -58,6 +102,6 @@ declare function getAccountEIP712Domain(client: PublicClient, account: Address):
|
|
|
58
102
|
verifyingContract: `0x${string}`;
|
|
59
103
|
salt: `0x${string}`;
|
|
60
104
|
}>;
|
|
61
|
-
export { SMART_SESSION_MODE_USE, SMART_SESSION_MODE_ENABLE, SMART_SESSIONS_VALIDATOR_ADDRESS, getSmartSessionValidator, getEnableSessionCall, encodeSmartSessionSignature, getPermissionId, getAccountEIP712Domain, isSessionEnabled, getSessionAllowedERC7739Content, };
|
|
62
|
-
export type { SessionData };
|
|
105
|
+
export { SMART_SESSION_MODE_USE, SMART_SESSION_MODE_ENABLE, SMART_SESSIONS_VALIDATOR_ADDRESS, getSessionData, getSmartSessionValidator, getEnableSessionCall, encodeSmartSessionSignature, getPermissionId, getAccountEIP712Domain, isSessionEnabled, getSessionAllowedERC7739Content, };
|
|
106
|
+
export type { EnableSessionData, ChainSession, ChainDigest, SessionData, SmartSessionModeType, };
|
|
63
107
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAKV,KAAK,GAAG,EAIR,KAAK,YAAY,EAKlB,MAAM,MAAM,CAAA;AAKb,OAAO,KAAK,EACV,WAAW,EAEX,uBAAuB,EACvB,OAAO,EAER,MAAM,aAAa,CAAA;AAEpB,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAUjE,UAAU,WAAW;IACnB,gBAAgB,EAAE,OA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,CAWf;AA8KD,iBAAe,gBAAgB,CAC7B,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,iBAAe,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO;;;;;;GAoD3E;AAED,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,gCAAgC,EAChC,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC3B,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,+BAA+B,GAChC,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,oBAAoB,GACrB,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SMART_SESSIONS_VALIDATOR_ADDRESS = exports.SMART_SESSION_MODE_ENABLE = exports.SMART_SESSION_MODE_USE = void 0;
|
|
4
|
+
exports.getSessionData = getSessionData;
|
|
4
5
|
exports.getSmartSessionValidator = getSmartSessionValidator;
|
|
5
6
|
exports.getEnableSessionCall = getEnableSessionCall;
|
|
6
7
|
exports.encodeSmartSessionSignature = encodeSmartSessionSignature;
|
|
@@ -8,6 +9,7 @@ exports.getPermissionId = getPermissionId;
|
|
|
8
9
|
exports.getAccountEIP712Domain = getAccountEIP712Domain;
|
|
9
10
|
exports.isSessionEnabled = isSessionEnabled;
|
|
10
11
|
exports.getSessionAllowedERC7739Content = getSessionAllowedERC7739Content;
|
|
12
|
+
const solady_1 = require("solady");
|
|
11
13
|
const viem_1 = require("viem");
|
|
12
14
|
const orchestrator_1 = require("../../orchestrator");
|
|
13
15
|
const smart_sessions_1 = require("../abi/smart-sessions");
|
|
@@ -36,6 +38,16 @@ const ACTION_CONDITION_GREATER_THAN_OR_EQUAL = 3;
|
|
|
36
38
|
const ACTION_CONDITION_LESS_THAN_OR_EQUAL = 4;
|
|
37
39
|
const ACTION_CONDITION_NOT_EQUAL = 5;
|
|
38
40
|
const ACTION_CONDITION_IN_RANGE = 6;
|
|
41
|
+
async function getSessionData(chain, session) {
|
|
42
|
+
const { appDomainSeparator, contentsType } = await getSessionAllowedERC7739Content(chain);
|
|
43
|
+
const allowedERC7739Content = [
|
|
44
|
+
{
|
|
45
|
+
appDomainSeparator,
|
|
46
|
+
contentName: [contentsType],
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
return getSmartSessionData(chain, session, allowedERC7739Content);
|
|
50
|
+
}
|
|
39
51
|
async function getEnableSessionCall(chain, session) {
|
|
40
52
|
const { appDomainSeparator, contentsType } = await getSessionAllowedERC7739Content(chain);
|
|
41
53
|
const allowedERC7739Content = [
|
|
@@ -44,7 +56,7 @@ async function getEnableSessionCall(chain, session) {
|
|
|
44
56
|
contentName: [contentsType],
|
|
45
57
|
},
|
|
46
58
|
];
|
|
47
|
-
const sessionData =
|
|
59
|
+
const sessionData = getSmartSessionData(chain, session, allowedERC7739Content);
|
|
48
60
|
return {
|
|
49
61
|
to: SMART_SESSIONS_VALIDATOR_ADDRESS,
|
|
50
62
|
data: (0, viem_1.encodeFunctionData)({
|
|
@@ -96,7 +108,7 @@ async function getSessionAllowedERC7739Content(chain) {
|
|
|
96
108
|
contentsType,
|
|
97
109
|
};
|
|
98
110
|
}
|
|
99
|
-
|
|
111
|
+
function getSmartSessionData(chain, session, allowedERC7739Content) {
|
|
100
112
|
const omniActions = getOmniAccountActions(chain);
|
|
101
113
|
const sessionValidator = (0, core_1.getValidator)(session.owners);
|
|
102
114
|
const userOpPolicies = (session.policies || [
|
|
@@ -339,17 +351,177 @@ async function isSessionEnabled(client, address, permissionId) {
|
|
|
339
351
|
args: [permissionId, address],
|
|
340
352
|
});
|
|
341
353
|
}
|
|
342
|
-
function encodeSmartSessionSignature(mode, permissionId, signature) {
|
|
354
|
+
function encodeSmartSessionSignature(mode, permissionId, signature, enableSessionData) {
|
|
343
355
|
switch (mode) {
|
|
344
356
|
case SMART_SESSION_MODE_USE:
|
|
345
357
|
return (0, viem_1.encodePacked)(['bytes1', 'bytes32', 'bytes'], [mode, permissionId, signature]);
|
|
346
358
|
case SMART_SESSION_MODE_ENABLE:
|
|
347
359
|
case SMART_SESSION_MODE_UNSAFE_ENABLE:
|
|
348
|
-
|
|
360
|
+
if (!enableSessionData) {
|
|
361
|
+
throw new Error('enableSession is required for ENABLE mode');
|
|
362
|
+
}
|
|
363
|
+
return (0, viem_1.encodePacked)(['bytes1', 'bytes'], [
|
|
364
|
+
mode,
|
|
365
|
+
solady_1.LibZip.flzCompress(encodeEnableSessionSignature(enableSessionData, signature)),
|
|
366
|
+
]);
|
|
349
367
|
default:
|
|
350
368
|
throw new Error(`Unknown mode ${mode}`);
|
|
351
369
|
}
|
|
352
370
|
}
|
|
371
|
+
function encodeEnableSessionSignature(enableSessionData, signature) {
|
|
372
|
+
return (0, viem_1.encodeAbiParameters)([
|
|
373
|
+
{
|
|
374
|
+
components: [
|
|
375
|
+
{
|
|
376
|
+
type: 'uint8',
|
|
377
|
+
name: 'chainDigestIndex',
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
type: 'tuple[]',
|
|
381
|
+
components: [
|
|
382
|
+
{
|
|
383
|
+
internalType: 'uint64',
|
|
384
|
+
name: 'chainId',
|
|
385
|
+
type: 'uint64',
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
internalType: 'bytes32',
|
|
389
|
+
name: 'sessionDigest',
|
|
390
|
+
type: 'bytes32',
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
name: 'hashesAndChainIds',
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
components: [
|
|
397
|
+
{
|
|
398
|
+
internalType: 'contract ISessionValidator',
|
|
399
|
+
name: 'sessionValidator',
|
|
400
|
+
type: 'address',
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
internalType: 'bytes',
|
|
404
|
+
name: 'sessionValidatorInitData',
|
|
405
|
+
type: 'bytes',
|
|
406
|
+
},
|
|
407
|
+
{ internalType: 'bytes32', name: 'salt', type: 'bytes32' },
|
|
408
|
+
{
|
|
409
|
+
components: [
|
|
410
|
+
{ internalType: 'address', name: 'policy', type: 'address' },
|
|
411
|
+
{ internalType: 'bytes', name: 'initData', type: 'bytes' },
|
|
412
|
+
],
|
|
413
|
+
internalType: 'struct PolicyData[]',
|
|
414
|
+
name: 'userOpPolicies',
|
|
415
|
+
type: 'tuple[]',
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
components: [
|
|
419
|
+
{
|
|
420
|
+
components: [
|
|
421
|
+
{
|
|
422
|
+
internalType: 'bytes32',
|
|
423
|
+
name: 'appDomainSeparator',
|
|
424
|
+
type: 'bytes32',
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
internalType: 'string[]',
|
|
428
|
+
name: 'contentName',
|
|
429
|
+
type: 'string[]',
|
|
430
|
+
},
|
|
431
|
+
],
|
|
432
|
+
internalType: 'struct ERC7739Context[]',
|
|
433
|
+
name: 'allowedERC7739Content',
|
|
434
|
+
type: 'tuple[]',
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
components: [
|
|
438
|
+
{
|
|
439
|
+
internalType: 'address',
|
|
440
|
+
name: 'policy',
|
|
441
|
+
type: 'address',
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
internalType: 'bytes',
|
|
445
|
+
name: 'initData',
|
|
446
|
+
type: 'bytes',
|
|
447
|
+
},
|
|
448
|
+
],
|
|
449
|
+
internalType: 'struct PolicyData[]',
|
|
450
|
+
name: 'erc1271Policies',
|
|
451
|
+
type: 'tuple[]',
|
|
452
|
+
},
|
|
453
|
+
],
|
|
454
|
+
internalType: 'struct ERC7739Data',
|
|
455
|
+
name: 'erc7739Policies',
|
|
456
|
+
type: 'tuple',
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
components: [
|
|
460
|
+
{
|
|
461
|
+
internalType: 'bytes4',
|
|
462
|
+
name: 'actionTargetSelector',
|
|
463
|
+
type: 'bytes4',
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
internalType: 'address',
|
|
467
|
+
name: 'actionTarget',
|
|
468
|
+
type: 'address',
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
components: [
|
|
472
|
+
{
|
|
473
|
+
internalType: 'address',
|
|
474
|
+
name: 'policy',
|
|
475
|
+
type: 'address',
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
internalType: 'bytes',
|
|
479
|
+
name: 'initData',
|
|
480
|
+
type: 'bytes',
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
internalType: 'struct PolicyData[]',
|
|
484
|
+
name: 'actionPolicies',
|
|
485
|
+
type: 'tuple[]',
|
|
486
|
+
},
|
|
487
|
+
],
|
|
488
|
+
internalType: 'struct ActionData[]',
|
|
489
|
+
name: 'actions',
|
|
490
|
+
type: 'tuple[]',
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
internalType: 'bool',
|
|
494
|
+
name: 'permitERC4337Paymaster',
|
|
495
|
+
type: 'bool',
|
|
496
|
+
},
|
|
497
|
+
],
|
|
498
|
+
internalType: 'struct Session',
|
|
499
|
+
name: 'sessionToEnable',
|
|
500
|
+
type: 'tuple',
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
type: 'bytes',
|
|
504
|
+
name: 'permissionEnableSig',
|
|
505
|
+
},
|
|
506
|
+
],
|
|
507
|
+
internalType: 'struct EnableSession',
|
|
508
|
+
name: 'enableSession',
|
|
509
|
+
type: 'tuple',
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
type: 'bytes',
|
|
513
|
+
name: 'signature',
|
|
514
|
+
},
|
|
515
|
+
], [
|
|
516
|
+
{
|
|
517
|
+
chainDigestIndex: enableSessionData.chainDigestIndex,
|
|
518
|
+
hashesAndChainIds: enableSessionData.hashesAndChainIds,
|
|
519
|
+
sessionToEnable: enableSessionData.sessionToEnable,
|
|
520
|
+
permissionEnableSig: enableSessionData.signature,
|
|
521
|
+
},
|
|
522
|
+
signature,
|
|
523
|
+
]);
|
|
524
|
+
}
|
|
353
525
|
function getPermissionId(session) {
|
|
354
526
|
const sessionValidator = (0, core_1.getValidator)(session.owners);
|
|
355
527
|
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([
|
|
@@ -19,7 +19,7 @@ class Orchestrator {
|
|
|
19
19
|
try {
|
|
20
20
|
const response = await axios_1.default.get(`${this.serverUrl}/accounts/${userAddress}/portfolio`, {
|
|
21
21
|
params: {
|
|
22
|
-
chainIds: filter?.chainIds,
|
|
22
|
+
chainIds: filter?.chainIds?.join(','),
|
|
23
23
|
tokens: filter?.tokens
|
|
24
24
|
? Object.entries(filter.tokens)
|
|
25
25
|
.map(([chainId, tokens]) => tokens.map((token) => `${chainId}:${token}`))
|
|
@@ -13,8 +13,8 @@ declare function getChainById(chainId: number): Chain | undefined;
|
|
|
13
13
|
declare function isTestnet(chainId: number): boolean;
|
|
14
14
|
declare function isTokenAddressSupported(address: Address, chainId: number): boolean;
|
|
15
15
|
declare function getSupportedTokens(chainId: number): TokenConfig[];
|
|
16
|
-
declare function getDefaultAccountAccessList(): {
|
|
17
|
-
chainIds: (
|
|
16
|
+
declare function getDefaultAccountAccessList(onTestnets?: boolean): {
|
|
17
|
+
chainIds: (11155111 | 84532 | 421614 | 11155420)[] | (1 | 8453 | 42161 | 10)[];
|
|
18
18
|
};
|
|
19
19
|
export { getTokenSymbol, getTokenAddress, getTokenRootBalanceSlot, getTokenBalanceSlot, getWethAddress, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getChainById, getSupportedTokens, isTestnet, isTokenAddressSupported, getDefaultAccountAccessList, };
|
|
20
20
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../orchestrator/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAeb,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,yXAuCnC;AAqED,iBAAS,uBAAuB,CAC9B,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,OAAO,GACpB,MAAM,GAAG,IAAI,CA4Lf;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,CAqBtE;AAED,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,qBAmBpC;AAED,iBAAS,SAAS,CAAC,OAAO,EAAE,MAAM,WAMjC;AAED,iBAAS,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,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AAE,MAAM,GAAG,OAAO,CAW3E;AAED,iBAAS,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,CAkB1D;AAmBD,iBAAS,2BAA2B,CAAC,UAAU,CAAC,EAAE,OAAO;;EAMxD;AAED,OAAO,EACL,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,6BAA6B,EAC7B,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,uBAAuB,EACvB,2BAA2B,GAC5B,CAAA"}
|
|
@@ -435,8 +435,10 @@ function getTokenDecimals(symbol) {
|
|
|
435
435
|
throw new Error(`Symbol not supported: ${symbol}`);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
function getDefaultAccountAccessList() {
|
|
438
|
+
function getDefaultAccountAccessList(onTestnets) {
|
|
439
439
|
return {
|
|
440
|
-
chainIds:
|
|
440
|
+
chainIds: onTestnets
|
|
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],
|
|
441
443
|
};
|
|
442
444
|
}
|