@charterlabs/rhinestone-sdk 0.3.0 → 0.3.2
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/README.md +31 -200
- package/dist/src/accounts/error.d.ts +8 -1
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +10 -1
- package/dist/src/accounts/index.d.ts +11 -10
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +79 -50
- package/dist/src/accounts/kernel.d.ts +3 -5
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +8 -17
- package/dist/src/accounts/kernel.test.js +10 -3
- package/dist/src/accounts/nexus.d.ts +3 -5
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +108 -57
- package/dist/src/accounts/nexus.test.js +10 -3
- package/dist/src/accounts/passport.d.ts +4 -7
- package/dist/src/accounts/passport.d.ts.map +1 -1
- package/dist/src/accounts/passport.js +0 -91
- package/dist/src/accounts/safe.d.ts +9 -4
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +108 -38
- package/dist/src/accounts/safe.test.js +10 -3
- package/dist/src/accounts/signing/common.d.ts +3 -3
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +29 -5
- package/dist/src/accounts/signing/message.js +2 -2
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
- package/dist/src/accounts/signing/typedData.js +3 -3
- package/dist/src/accounts/startale.d.ts +2 -4
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +0 -4
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +10 -3
- package/dist/src/accounts/walletClient.d.ts.map +1 -1
- package/dist/src/accounts/walletClient.js +6 -0
- package/dist/src/actions/compact.d.ts +4 -2
- package/dist/src/actions/compact.d.ts.map +1 -1
- package/dist/src/actions/compact.js +4 -1
- package/dist/src/actions/deployment.d.ts +19 -0
- package/dist/src/actions/deployment.d.ts.map +1 -0
- package/dist/src/actions/deployment.js +78 -0
- 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 +12 -0
- package/dist/src/actions/smart-sessions.d.ts +17 -8
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +40 -4
- 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/compact.d.ts +15 -18
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +15 -17
- package/dist/src/execution/error.d.ts +2 -8
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +1 -10
- package/dist/src/execution/index.d.ts +6 -6
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +22 -28
- package/dist/src/execution/permit2.d.ts +12 -17
- package/dist/src/execution/permit2.d.ts.map +1 -1
- package/dist/src/execution/permit2.js +10 -16
- package/dist/src/execution/singleChainOps.d.ts +15 -3
- package/dist/src/execution/singleChainOps.d.ts.map +1 -1
- package/dist/src/execution/singleChainOps.js +17 -3
- package/dist/src/execution/utils.d.ts +36 -12
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +180 -133
- package/dist/src/index.d.ts +26 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +49 -16
- package/dist/src/modules/abi/smart-session-emissary.d.ts +696 -0
- package/dist/src/modules/abi/smart-session-emissary.d.ts.map +1 -0
- package/dist/src/modules/abi/smart-session-emissary.js +565 -0
- package/dist/src/modules/chain-abstraction.d.ts +5 -0
- package/dist/src/modules/chain-abstraction.d.ts.map +1 -0
- package/dist/src/modules/chain-abstraction.js +7 -0
- package/dist/src/modules/common.d.ts +7 -1
- package/dist/src/modules/common.d.ts.map +1 -1
- package/dist/src/modules/index.d.ts +3 -9
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +11 -8
- package/dist/src/modules/index.test.js +3 -9
- package/dist/src/modules/legacy.d.ts +10 -0
- package/dist/src/modules/legacy.d.ts.map +1 -0
- package/dist/src/modules/legacy.js +65 -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 +4 -1
- package/dist/src/modules/validators/index.d.ts +2 -2
- package/dist/src/modules/validators/index.d.ts.map +1 -1
- package/dist/src/modules/validators/index.js +1 -6
- package/dist/src/modules/validators/smart-sessions.d.ts +112 -23
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +426 -301
- package/dist/src/orchestrator/client.d.ts +3 -4
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +49 -53
- package/dist/src/orchestrator/error.d.ts +11 -1
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +16 -1
- package/dist/src/orchestrator/index.d.ts +5 -5
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +3 -1
- package/dist/src/orchestrator/registry.d.ts +3 -2
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +15 -14
- package/dist/src/orchestrator/registry.test.js +18 -1
- package/dist/src/orchestrator/types.d.ts +33 -8
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.js +15 -1
- package/dist/src/types.d.ts +57 -28
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +14 -2
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +46 -4
- package/dist/test/utils/utils.d.ts +5 -0
- package/dist/test/utils/utils.d.ts.map +1 -0
- package/dist/test/utils/utils.js +20 -0
- package/package.json +33 -3
- package/dist/src/execution/smart-session.d.ts +0 -13
- package/dist/src/execution/smart-session.d.ts.map +0 -1
- package/dist/src/execution/smart-session.js +0 -178
- package/dist/src/modules/omni-account.d.ts +0 -8
- package/dist/src/modules/omni-account.d.ts.map +0 -1
- package/dist/src/modules/omni-account.js +0 -13
- package/dist/src/modules/validators/smart-sessions.test.d.ts +0 -2
- package/dist/src/modules/validators/smart-sessions.test.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.test.js +0 -222
package/dist/src/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Account, Address, Chain, Hex } from 'viem';
|
|
2
2
|
import type { WebAuthnAccount } from 'viem/account-abstraction';
|
|
3
3
|
import type { ModuleType } from './modules/common';
|
|
4
|
-
import type { EnableSessionData } from './modules/validators/smart-sessions';
|
|
5
4
|
import type { SettlementLayer } from './orchestrator/types';
|
|
6
5
|
type AccountType = 'safe' | 'nexus' | 'kernel' | 'startale' | 'passport' | 'eoa';
|
|
7
6
|
interface SafeAccount {
|
|
@@ -63,14 +62,20 @@ type ProviderConfig = {
|
|
|
63
62
|
type: 'custom';
|
|
64
63
|
urls: Record<number, string>;
|
|
65
64
|
};
|
|
66
|
-
|
|
65
|
+
type BundlerConfig = {
|
|
67
66
|
type: 'pimlico' | 'biconomy';
|
|
68
67
|
apiKey: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
68
|
+
} | {
|
|
69
|
+
type: 'custom';
|
|
70
|
+
url: string | Record<number, string>;
|
|
71
|
+
};
|
|
72
|
+
type PaymasterConfig = {
|
|
71
73
|
type: 'pimlico' | 'biconomy';
|
|
72
74
|
apiKey: string;
|
|
73
|
-
}
|
|
75
|
+
} | {
|
|
76
|
+
type: 'custom';
|
|
77
|
+
url: string | Record<number, string>;
|
|
78
|
+
};
|
|
74
79
|
type OwnerSet = OwnableValidatorConfig | ENSValidatorConfig | WebauthnValidatorConfig | MultiFactorValidatorConfig;
|
|
75
80
|
interface SudoPolicy {
|
|
76
81
|
type: 'sudo';
|
|
@@ -109,23 +114,16 @@ interface ValueLimitPolicy {
|
|
|
109
114
|
}
|
|
110
115
|
type Policy = SudoPolicy | UniversalActionPolicy | SpendingLimitsPolicy | TimeFramePolicy | UsageLimitPolicy | ValueLimitPolicy;
|
|
111
116
|
interface Action {
|
|
112
|
-
target
|
|
113
|
-
selector
|
|
117
|
+
target?: Address;
|
|
118
|
+
selector?: Hex;
|
|
114
119
|
policies?: [Policy, ...Policy[]];
|
|
115
120
|
}
|
|
116
|
-
interface
|
|
121
|
+
interface SessionInput {
|
|
117
122
|
owners: OwnerSet;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
allowedContent: {
|
|
123
|
-
domainSeparator: string;
|
|
124
|
-
contentName: string[];
|
|
125
|
-
}[];
|
|
126
|
-
policies?: [Policy, ...Policy[]];
|
|
127
|
-
};
|
|
128
|
-
salt?: Hex;
|
|
123
|
+
actions?: Action[];
|
|
124
|
+
}
|
|
125
|
+
interface Session extends SessionInput {
|
|
126
|
+
chain: Chain;
|
|
129
127
|
}
|
|
130
128
|
interface Recovery {
|
|
131
129
|
guardians: Account[];
|
|
@@ -141,7 +139,11 @@ interface ModuleInput {
|
|
|
141
139
|
interface RhinestoneAccountConfig {
|
|
142
140
|
account?: AccountProviderConfig;
|
|
143
141
|
owners?: OwnerSet;
|
|
144
|
-
|
|
142
|
+
experimental_sessions?: {
|
|
143
|
+
enabled: boolean;
|
|
144
|
+
module?: Address;
|
|
145
|
+
compatibilityFallback?: Address;
|
|
146
|
+
};
|
|
145
147
|
recovery?: Recovery;
|
|
146
148
|
eoa?: Account;
|
|
147
149
|
modules?: ModuleInput[];
|
|
@@ -150,6 +152,8 @@ interface RhinestoneAccountConfig {
|
|
|
150
152
|
factory: Address;
|
|
151
153
|
factoryData: Hex;
|
|
152
154
|
intentExecutorInstalled: boolean;
|
|
155
|
+
} | {
|
|
156
|
+
address: Address;
|
|
153
157
|
};
|
|
154
158
|
}
|
|
155
159
|
interface RhinestoneSDKConfig {
|
|
@@ -189,13 +193,24 @@ interface Call {
|
|
|
189
193
|
data: Hex;
|
|
190
194
|
value: bigint;
|
|
191
195
|
}
|
|
192
|
-
interface
|
|
196
|
+
interface TokenRequestWithAmount {
|
|
193
197
|
address: Address | TokenSymbol;
|
|
194
198
|
amount: bigint;
|
|
195
199
|
}
|
|
196
|
-
|
|
197
|
-
|
|
200
|
+
interface TokenRequestWithoutAmount {
|
|
201
|
+
address: Address | TokenSymbol;
|
|
202
|
+
amount?: undefined;
|
|
203
|
+
}
|
|
204
|
+
type TokenRequest = TokenRequestWithAmount | TokenRequestWithoutAmount;
|
|
205
|
+
type TokenRequests = [TokenRequestWithoutAmount] | TokenRequestWithAmount[];
|
|
206
|
+
export type SimpleTokenList = (Address | TokenSymbol)[];
|
|
207
|
+
export type ChainTokenMap = Record<number, SimpleTokenList>;
|
|
208
|
+
export type ExactInputConfig = {
|
|
209
|
+
chain: Chain;
|
|
210
|
+
address: Address | TokenSymbol;
|
|
211
|
+
amount?: bigint;
|
|
198
212
|
};
|
|
213
|
+
type SourceAssetInput = SimpleTokenList | ChainTokenMap | ExactInputConfig[];
|
|
199
214
|
type OwnerSignerSet = {
|
|
200
215
|
type: 'owner';
|
|
201
216
|
kind: 'ecdsa';
|
|
@@ -220,23 +235,37 @@ type OwnerSignerSet = {
|
|
|
220
235
|
})[];
|
|
221
236
|
module?: Address;
|
|
222
237
|
};
|
|
238
|
+
interface SessionEnableData {
|
|
239
|
+
userSignature: Hex;
|
|
240
|
+
hashesAndChainIds: {
|
|
241
|
+
chainId: bigint;
|
|
242
|
+
sessionDigest: Hex;
|
|
243
|
+
}[];
|
|
244
|
+
sessionToEnableIndex: number;
|
|
245
|
+
}
|
|
223
246
|
interface SessionSignerSet {
|
|
224
|
-
type: '
|
|
247
|
+
type: 'experimental_session';
|
|
225
248
|
session: Session;
|
|
226
|
-
|
|
249
|
+
verifyExecutions?: boolean;
|
|
250
|
+
enableData?: SessionEnableData;
|
|
227
251
|
}
|
|
228
252
|
interface GuardiansSignerSet {
|
|
229
253
|
type: 'guardians';
|
|
230
254
|
guardians: Account[];
|
|
231
255
|
}
|
|
232
256
|
type SignerSet = OwnerSignerSet | SessionSignerSet | GuardiansSignerSet;
|
|
257
|
+
type Sponsorship = boolean | {
|
|
258
|
+
gas: boolean;
|
|
259
|
+
bridging: boolean;
|
|
260
|
+
swaps: boolean;
|
|
261
|
+
};
|
|
233
262
|
interface BaseTransaction {
|
|
234
263
|
calls?: CallInput[];
|
|
235
|
-
tokenRequests?:
|
|
264
|
+
tokenRequests?: TokenRequests;
|
|
236
265
|
recipient?: RhinestoneAccountConfig | Address;
|
|
237
266
|
gasLimit?: bigint;
|
|
238
267
|
signers?: SignerSet;
|
|
239
|
-
sponsored?:
|
|
268
|
+
sponsored?: Sponsorship;
|
|
240
269
|
eip7702InitSignature?: Hex;
|
|
241
270
|
sourceAssets?: SourceAssetInput;
|
|
242
271
|
feeAsset?: Address | TokenSymbol;
|
|
@@ -263,5 +292,5 @@ interface UserOperationTransaction {
|
|
|
263
292
|
chain: Chain;
|
|
264
293
|
}
|
|
265
294
|
type Transaction = SameChainTransaction | CrossChainTransaction;
|
|
266
|
-
export type { AccountType, SafeAccount, NexusAccount, KernelAccount, StartaleAccount, PassportAccount, EoaAccount, RhinestoneAccountConfig, RhinestoneSDKConfig, RhinestoneConfig, AccountProviderConfig, ProviderConfig, BundlerConfig, PaymasterConfig, Transaction, UserOperationTransaction, TokenSymbol, CalldataInput, LazyCallInput, CallInput, CallResolveContext, Call, TokenRequest, SourceAssetInput, OwnerSet, OwnableValidatorConfig, ENSValidatorConfig, WebauthnValidatorConfig, MultiFactorValidatorConfig, SignerSet, Session, Recovery, ModuleType, ModuleInput, Policy, UniversalActionPolicyParamCondition, };
|
|
295
|
+
export type { AccountType, SafeAccount, NexusAccount, KernelAccount, StartaleAccount, PassportAccount, EoaAccount, RhinestoneAccountConfig, RhinestoneSDKConfig, RhinestoneConfig, AccountProviderConfig, ProviderConfig, BundlerConfig, PaymasterConfig, Transaction, UserOperationTransaction, TokenSymbol, CalldataInput, LazyCallInput, CallInput, CallResolveContext, Call, Sponsorship, TokenRequest, TokenRequests, SourceAssetInput, OwnerSet, OwnableValidatorConfig, ENSValidatorConfig, WebauthnValidatorConfig, MultiFactorValidatorConfig, SignerSet, SessionInput, SessionEnableData, Session, Recovery, ModuleType, ModuleInput, Policy, UniversalActionPolicyParamCondition, };
|
|
267
296
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,KAAK,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,CAAA;AAEhF,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,GA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AChB,QAAQ,EACR,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,OAAO,EACP,QAAQ,EACR,UAAU,EACV,WAAW,EACX,MAAM,EACN,mCAAmC,GACpC,CAAA"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import type { Address, Hex } from 'viem';
|
|
1
|
+
import type { Account, Address, Hex } from 'viem';
|
|
2
2
|
import { getSetup as experimental_getModuleSetup } from '../modules';
|
|
3
3
|
import type { AccountProviderConfig, OwnerSet } from '../types';
|
|
4
|
+
declare function experimental_getV0InitData(config: {
|
|
5
|
+
account?: AccountProviderConfig;
|
|
6
|
+
owners?: OwnerSet;
|
|
7
|
+
}): {
|
|
8
|
+
address: Address;
|
|
9
|
+
factory: Address;
|
|
10
|
+
factoryData: Hex;
|
|
11
|
+
intentExecutorInstalled: boolean;
|
|
12
|
+
};
|
|
4
13
|
declare function experimental_getRhinestoneInitData(config: {
|
|
5
14
|
account?: AccountProviderConfig;
|
|
6
15
|
owners?: OwnerSet;
|
|
@@ -9,6 +18,9 @@ declare function experimental_getRhinestoneInitData(config: {
|
|
|
9
18
|
factory: Address;
|
|
10
19
|
factoryData: Hex;
|
|
11
20
|
intentExecutorInstalled: boolean;
|
|
21
|
+
} | {
|
|
22
|
+
address: Address;
|
|
12
23
|
};
|
|
13
|
-
|
|
24
|
+
declare function toViewOnlyAccount(address: Address): Account;
|
|
25
|
+
export { experimental_getV0InitData, experimental_getModuleSetup, experimental_getRhinestoneInitData, toViewOnlyAccount, };
|
|
14
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAGjD,OAAO,EAAE,QAAQ,IAAI,2BAA2B,EAAE,MAAM,YAAY,CAAA;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE/D,iBAAS,0BAA0B,CAAC,MAAM,EAAE;IAC1C,OAAO,CAAC,EAAE,qBAAqB,CAAA;IAC/B,MAAM,CAAC,EAAE,QAAQ,CAAA;CAClB,GAAG;IACF,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,GAAG,CAAA;IAChB,uBAAuB,EAAE,OAAO,CAAA;CACjC,CAgBA;AAED,iBAAS,kCAAkC,CAAC,MAAM,EAAE;IAClD,OAAO,CAAC,EAAE,qBAAqB,CAAA;IAC/B,MAAM,CAAC,EAAE,QAAQ,CAAA;CAClB,GACG;IACE,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,GAAG,CAAA;IAChB,uBAAuB,EAAE,OAAO,CAAA;CACjC,GACD;IACE,OAAO,EAAE,OAAO,CAAA;CACjB,CAmBJ;AAED,iBAAS,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAcpD;AAED,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,kCAAkC,EAClC,iBAAiB,GAClB,CAAA"}
|
package/dist/src/utils/index.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.experimental_getModuleSetup = void 0;
|
|
4
|
+
exports.experimental_getV0InitData = experimental_getV0InitData;
|
|
4
5
|
exports.experimental_getRhinestoneInitData = experimental_getRhinestoneInitData;
|
|
5
|
-
|
|
6
|
+
exports.toViewOnlyAccount = toViewOnlyAccount;
|
|
7
|
+
const accounts_1 = require("viem/accounts");
|
|
8
|
+
const accounts_2 = require("../accounts");
|
|
6
9
|
const modules_1 = require("../modules");
|
|
7
10
|
Object.defineProperty(exports, "experimental_getModuleSetup", { enumerable: true, get: function () { return modules_1.getSetup; } });
|
|
8
|
-
function
|
|
9
|
-
const initCode = (0,
|
|
11
|
+
function experimental_getV0InitData(config) {
|
|
12
|
+
const initCode = (0, accounts_2.getV0InitCode)(config);
|
|
10
13
|
if (!initCode) {
|
|
11
14
|
throw new Error('Init code not available');
|
|
12
15
|
}
|
|
16
|
+
if (!('factory' in initCode)) {
|
|
17
|
+
throw new Error('Factory not available');
|
|
18
|
+
}
|
|
13
19
|
const { factory, factoryData } = initCode;
|
|
14
|
-
const address = (0,
|
|
20
|
+
const address = (0, accounts_2.getAddress)(config);
|
|
15
21
|
return {
|
|
16
22
|
address,
|
|
17
23
|
factory,
|
|
@@ -19,3 +25,39 @@ function experimental_getRhinestoneInitData(config) {
|
|
|
19
25
|
intentExecutorInstalled: true,
|
|
20
26
|
};
|
|
21
27
|
}
|
|
28
|
+
function experimental_getRhinestoneInitData(config) {
|
|
29
|
+
const initCode = (0, accounts_2.getInitCode)(config);
|
|
30
|
+
if (!initCode) {
|
|
31
|
+
throw new Error('Init code not available');
|
|
32
|
+
}
|
|
33
|
+
const address = (0, accounts_2.getAddress)(config);
|
|
34
|
+
if ('factory' in initCode) {
|
|
35
|
+
const { factory, factoryData } = initCode;
|
|
36
|
+
return {
|
|
37
|
+
address,
|
|
38
|
+
factory,
|
|
39
|
+
factoryData,
|
|
40
|
+
intentExecutorInstalled: true,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return {
|
|
45
|
+
address,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function toViewOnlyAccount(address) {
|
|
50
|
+
const errorMessage = 'Signing is not supported for view-only accounts';
|
|
51
|
+
return (0, accounts_1.toAccount)({
|
|
52
|
+
address,
|
|
53
|
+
signMessage: async () => {
|
|
54
|
+
throw new Error(errorMessage);
|
|
55
|
+
},
|
|
56
|
+
signTypedData: async () => {
|
|
57
|
+
throw new Error(errorMessage);
|
|
58
|
+
},
|
|
59
|
+
signTransaction: async () => {
|
|
60
|
+
throw new Error(errorMessage);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../test/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAIjC,iBAAS,UAAU,CAAC,KAAK,EAAE,KAAK,UAU/B;AAED,iBAAS,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAE7D;AAED,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getForkUrl = getForkUrl;
|
|
4
|
+
exports.assertNotNull = assertNotNull;
|
|
5
|
+
const chains_1 = require("viem/chains");
|
|
6
|
+
const vitest_1 = require("vitest");
|
|
7
|
+
function getForkUrl(chain) {
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const alchemyApiKey = import.meta.env.VITE_ALCHEMY_API_KEY;
|
|
10
|
+
if (!alchemyApiKey) {
|
|
11
|
+
throw new Error('VITE_ALCHEMY_API_KEY is not set');
|
|
12
|
+
}
|
|
13
|
+
if (chain.id === chains_1.base.id) {
|
|
14
|
+
return `https://base-mainnet.g.alchemy.com/v2/${alchemyApiKey}`;
|
|
15
|
+
}
|
|
16
|
+
throw new Error(`Unsupported chain: ${chain.id}`);
|
|
17
|
+
}
|
|
18
|
+
function assertNotNull(value) {
|
|
19
|
+
(0, vitest_1.expect)(value).not.toBeNull();
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charterlabs/rhinestone-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Rhinestone SDK for Charter Labs",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Charter Labs",
|
|
@@ -89,6 +89,36 @@
|
|
|
89
89
|
"types": "./dist/src/errors/index.d.ts",
|
|
90
90
|
"import": "./dist/src/errors/index.js",
|
|
91
91
|
"require": "./dist/src/errors/index.js"
|
|
92
|
+
},
|
|
93
|
+
"./dist/src/utils": {
|
|
94
|
+
"types": "./dist/src/utils/index.d.ts",
|
|
95
|
+
"import": "./dist/src/utils/index.js",
|
|
96
|
+
"require": "./dist/src/utils/index.js"
|
|
97
|
+
},
|
|
98
|
+
"./dist/src/orchestrator": {
|
|
99
|
+
"types": "./dist/src/orchestrator/index.d.ts",
|
|
100
|
+
"import": "./dist/src/orchestrator/index.js",
|
|
101
|
+
"require": "./dist/src/orchestrator/index.js"
|
|
102
|
+
},
|
|
103
|
+
"./dist/src/orchestrator/types": {
|
|
104
|
+
"types": "./dist/src/orchestrator/types.d.ts",
|
|
105
|
+
"import": "./dist/src/orchestrator/types.js",
|
|
106
|
+
"require": "./dist/src/orchestrator/types.js"
|
|
107
|
+
},
|
|
108
|
+
"./dist/src/execution/compact": {
|
|
109
|
+
"types": "./dist/src/execution/compact.d.ts",
|
|
110
|
+
"import": "./dist/src/execution/compact.js",
|
|
111
|
+
"require": "./dist/src/execution/compact.js"
|
|
112
|
+
},
|
|
113
|
+
"./dist/src/execution/permit2": {
|
|
114
|
+
"types": "./dist/src/execution/permit2.d.ts",
|
|
115
|
+
"import": "./dist/src/execution/permit2.js",
|
|
116
|
+
"require": "./dist/src/execution/permit2.js"
|
|
117
|
+
},
|
|
118
|
+
"./dist/src/execution/singleChainOps": {
|
|
119
|
+
"types": "./dist/src/execution/singleChainOps.d.ts",
|
|
120
|
+
"import": "./dist/src/execution/singleChainOps.js",
|
|
121
|
+
"require": "./dist/src/execution/singleChainOps.js"
|
|
92
122
|
}
|
|
93
123
|
},
|
|
94
124
|
"files": [
|
|
@@ -106,8 +136,8 @@
|
|
|
106
136
|
"access": "public"
|
|
107
137
|
},
|
|
108
138
|
"dependencies": {
|
|
109
|
-
"@rhinestone/shared-configs": "
|
|
110
|
-
"ox": "^0.
|
|
139
|
+
"@rhinestone/shared-configs": "1.4.91",
|
|
140
|
+
"ox": "^0.11.3",
|
|
111
141
|
"solady": "^0.1.26"
|
|
112
142
|
},
|
|
113
143
|
"peerDependencies": {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type Chain, type Hex } from 'viem';
|
|
2
|
-
import { type EnableSessionData } from '../modules/validators/smart-sessions';
|
|
3
|
-
import type { RhinestoneConfig, Session } from '../types';
|
|
4
|
-
interface SessionDetails {
|
|
5
|
-
signature: Hex;
|
|
6
|
-
nonces: bigint[];
|
|
7
|
-
enableSessionData: EnableSessionData;
|
|
8
|
-
}
|
|
9
|
-
declare function getSessionDetails(config: RhinestoneConfig, sessions: Session[], sessionIndex: number, initialNonces?: bigint[], signature?: Hex): Promise<SessionDetails>;
|
|
10
|
-
declare function enableSmartSession(chain: Chain, config: RhinestoneConfig, session: Session): Promise<void>;
|
|
11
|
-
export { enableSmartSession, getSessionDetails };
|
|
12
|
-
export type { SessionDetails };
|
|
13
|
-
//# sourceMappingURL=smart-session.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smart-session.d.ts","sourceRoot":"","sources":["../../../execution/smart-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,EAEV,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAiBb,OAAO,EACL,KAAK,iBAAiB,EAKvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGzD,UAAU,cAAc;IACtB,SAAS,EAAE,GAAG,CAAA;IACd,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,iBAAiB,EAAE,iBAAiB,CAAA;CACrC;AA6CD,iBAAe,iBAAiB,CAC9B,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,OAAO,EAAE,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,cAAc,CAAC,CAiHzB;AA+BD,iBAAe,kBAAkB,CAC/B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,OAAO,iBA2BjB;AAED,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAA;AAChD,YAAY,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enableSmartSession = enableSmartSession;
|
|
4
|
-
exports.getSessionDetails = getSessionDetails;
|
|
5
|
-
const viem_1 = require("viem");
|
|
6
|
-
const accounts_1 = require("../accounts");
|
|
7
|
-
const utils_1 = require("../accounts/utils");
|
|
8
|
-
const validators_1 = require("../modules/validators");
|
|
9
|
-
const smart_sessions_1 = require("../modules/validators/smart-sessions");
|
|
10
|
-
const error_1 = require("./error");
|
|
11
|
-
const smartSessionTypes = {
|
|
12
|
-
PolicyData: [
|
|
13
|
-
{ name: 'policy', type: 'address' },
|
|
14
|
-
{ name: 'initData', type: 'bytes' },
|
|
15
|
-
],
|
|
16
|
-
ActionData: [
|
|
17
|
-
{ name: 'actionTargetSelector', type: 'bytes4' },
|
|
18
|
-
{ name: 'actionTarget', type: 'address' },
|
|
19
|
-
{ name: 'actionPolicies', type: 'PolicyData[]' },
|
|
20
|
-
],
|
|
21
|
-
ERC7739Context: [
|
|
22
|
-
{ name: 'appDomainSeparator', type: 'bytes32' },
|
|
23
|
-
{ name: 'contentName', type: 'string[]' },
|
|
24
|
-
],
|
|
25
|
-
ERC7739Data: [
|
|
26
|
-
{ name: 'allowedERC7739Content', type: 'ERC7739Context[]' },
|
|
27
|
-
{ name: 'erc1271Policies', type: 'PolicyData[]' },
|
|
28
|
-
],
|
|
29
|
-
SignedPermissions: [
|
|
30
|
-
{ name: 'permitGenericPolicy', type: 'bool' },
|
|
31
|
-
{ name: 'permitAdminAccess', type: 'bool' },
|
|
32
|
-
{ name: 'ignoreSecurityAttestations', type: 'bool' },
|
|
33
|
-
{ name: 'permitERC4337Paymaster', type: 'bool' },
|
|
34
|
-
{ name: 'userOpPolicies', type: 'PolicyData[]' },
|
|
35
|
-
{ name: 'erc7739Policies', type: 'ERC7739Data' },
|
|
36
|
-
{ name: 'actions', type: 'ActionData[]' },
|
|
37
|
-
],
|
|
38
|
-
SignedSession: [
|
|
39
|
-
{ name: 'account', type: 'address' },
|
|
40
|
-
{ name: 'permissions', type: 'SignedPermissions' },
|
|
41
|
-
{ name: 'sessionValidator', type: 'address' },
|
|
42
|
-
{ name: 'sessionValidatorInitData', type: 'bytes' },
|
|
43
|
-
{ name: 'salt', type: 'bytes32' },
|
|
44
|
-
{ name: 'smartSession', type: 'address' },
|
|
45
|
-
{ name: 'nonce', type: 'uint256' },
|
|
46
|
-
],
|
|
47
|
-
ChainSession: [
|
|
48
|
-
{ name: 'chainId', type: 'uint64' },
|
|
49
|
-
{ name: 'session', type: 'SignedSession' },
|
|
50
|
-
],
|
|
51
|
-
MultiChainSession: [{ name: 'sessionsAndChainIds', type: 'ChainSession[]' }],
|
|
52
|
-
};
|
|
53
|
-
async function getSessionDetails(config, sessions, sessionIndex, initialNonces, signature) {
|
|
54
|
-
const chains = sessions
|
|
55
|
-
.map((session) => session.chain)
|
|
56
|
-
.filter((chain) => !!chain);
|
|
57
|
-
if (chains.length !== sessions.length) {
|
|
58
|
-
throw new error_1.SessionChainRequiredError();
|
|
59
|
-
}
|
|
60
|
-
const accountAddress = (0, accounts_1.getAddress)(config);
|
|
61
|
-
const publicClients = chains.map((chain) => (0, viem_1.createPublicClient)({
|
|
62
|
-
chain,
|
|
63
|
-
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
64
|
-
}));
|
|
65
|
-
const sessionDatas = sessions.map((session) => (0, smart_sessions_1.getSmartSessionData)(session));
|
|
66
|
-
const sessionNonces = await Promise.all(sessions.map((session, index) => initialNonces?.[index] ??
|
|
67
|
-
getSessionNonce(publicClients[index], accountAddress, (0, validators_1.getPermissionId)(session))));
|
|
68
|
-
const signedSessions = sessionDatas.map((session, index) => ({
|
|
69
|
-
account: accountAddress,
|
|
70
|
-
permissions: {
|
|
71
|
-
permitGenericPolicy: session.actions.some((action) => action.actionTarget === smart_sessions_1.SMART_SESSIONS_FALLBACK_TARGET_FLAG &&
|
|
72
|
-
action.actionTargetSelector ===
|
|
73
|
-
smart_sessions_1.SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG),
|
|
74
|
-
permitAdminAccess: session.actions.some((action) => action.actionTargetSelector ===
|
|
75
|
-
smart_sessions_1.SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION),
|
|
76
|
-
ignoreSecurityAttestations: false,
|
|
77
|
-
permitERC4337Paymaster: session.permitERC4337Paymaster,
|
|
78
|
-
userOpPolicies: session.userOpPolicies,
|
|
79
|
-
erc7739Policies: session.erc7739Policies,
|
|
80
|
-
actions: session.actions,
|
|
81
|
-
},
|
|
82
|
-
sessionValidator: session.sessionValidator,
|
|
83
|
-
sessionValidatorInitData: session.sessionValidatorInitData,
|
|
84
|
-
salt: session.salt,
|
|
85
|
-
smartSession: validators_1.SMART_SESSIONS_VALIDATOR_ADDRESS,
|
|
86
|
-
nonce: sessionNonces[index],
|
|
87
|
-
}));
|
|
88
|
-
const chainDigests = signedSessions.map((session, index) => ({
|
|
89
|
-
chainId: BigInt(chains[index].id),
|
|
90
|
-
sessionDigest: (0, viem_1.hashStruct)({
|
|
91
|
-
types: smartSessionTypes,
|
|
92
|
-
primaryType: 'SignedSession',
|
|
93
|
-
data: session,
|
|
94
|
-
}),
|
|
95
|
-
}));
|
|
96
|
-
const typedData = {
|
|
97
|
-
domain: {
|
|
98
|
-
name: 'SmartSession',
|
|
99
|
-
version: '1',
|
|
100
|
-
},
|
|
101
|
-
types: smartSessionTypes,
|
|
102
|
-
primaryType: 'MultiChainSession',
|
|
103
|
-
message: {
|
|
104
|
-
sessionsAndChainIds: signedSessions.map((session, index) => ({
|
|
105
|
-
chainId: BigInt(chains[index].id),
|
|
106
|
-
session,
|
|
107
|
-
})),
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
const chain = sessions[sessionIndex].chain;
|
|
111
|
-
if (!chain) {
|
|
112
|
-
throw new error_1.SessionChainRequiredError();
|
|
113
|
-
}
|
|
114
|
-
const validator = {
|
|
115
|
-
address: sessionDatas[sessionIndex].sessionValidator,
|
|
116
|
-
isRoot: false,
|
|
117
|
-
};
|
|
118
|
-
const sessionSignature = signature ??
|
|
119
|
-
(await (0, accounts_1.getTypedDataPackedSignature)(config, undefined, chain, validator, typedData));
|
|
120
|
-
return {
|
|
121
|
-
nonces: sessionNonces,
|
|
122
|
-
signature: sessionSignature,
|
|
123
|
-
enableSessionData: {
|
|
124
|
-
chainDigestIndex: sessionIndex,
|
|
125
|
-
hashesAndChainIds: chainDigests.map((chainDigest) => ({
|
|
126
|
-
chainId: BigInt(chainDigest.chainId),
|
|
127
|
-
sessionDigest: chainDigest.sessionDigest,
|
|
128
|
-
})),
|
|
129
|
-
sessionToEnable: sessionDatas[sessionIndex],
|
|
130
|
-
signature: sessionSignature,
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
async function getSessionNonce(client, account, permissionId) {
|
|
135
|
-
const nonce = await client.readContract({
|
|
136
|
-
address: validators_1.SMART_SESSIONS_VALIDATOR_ADDRESS,
|
|
137
|
-
abi: [
|
|
138
|
-
{
|
|
139
|
-
type: 'function',
|
|
140
|
-
name: 'getNonce',
|
|
141
|
-
inputs: [
|
|
142
|
-
{
|
|
143
|
-
name: 'permissionId',
|
|
144
|
-
type: 'bytes32',
|
|
145
|
-
internalType: 'PermissionId',
|
|
146
|
-
},
|
|
147
|
-
{ name: 'account', type: 'address', internalType: 'address' },
|
|
148
|
-
],
|
|
149
|
-
outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
|
|
150
|
-
stateMutability: 'view',
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
functionName: 'getNonce',
|
|
154
|
-
args: [permissionId, account],
|
|
155
|
-
});
|
|
156
|
-
return nonce;
|
|
157
|
-
}
|
|
158
|
-
async function enableSmartSession(chain, config, session) {
|
|
159
|
-
const publicClient = (0, viem_1.createPublicClient)({
|
|
160
|
-
chain,
|
|
161
|
-
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
162
|
-
});
|
|
163
|
-
const address = (0, accounts_1.getAddress)(config);
|
|
164
|
-
const isEnabled = await (0, validators_1.isSessionEnabled)(publicClient, address, (0, validators_1.getPermissionId)(session));
|
|
165
|
-
if (isEnabled) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const enableSessionCall = await (0, validators_1.getEnableSessionCall)(session);
|
|
169
|
-
const smartAccount = await (0, accounts_1.getSmartAccount)(config, publicClient, chain);
|
|
170
|
-
const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
|
|
171
|
-
const opHash = await bundlerClient.sendUserOperation({
|
|
172
|
-
account: smartAccount,
|
|
173
|
-
calls: [enableSessionCall],
|
|
174
|
-
});
|
|
175
|
-
await bundlerClient.waitForUserOperationReceipt({
|
|
176
|
-
hash: opHash,
|
|
177
|
-
});
|
|
178
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Address } from 'viem';
|
|
2
|
-
declare const HOOK_ADDRESS: Address;
|
|
3
|
-
declare const TARGET_MODULE_ADDRESS: Address;
|
|
4
|
-
declare const SAME_CHAIN_MODULE_ADDRESS: Address;
|
|
5
|
-
declare const INTENT_EXECUTOR_ADDRESS: Address;
|
|
6
|
-
declare const INTENT_EXECUTOR_ADDRESS_DEV: Address;
|
|
7
|
-
export { HOOK_ADDRESS, TARGET_MODULE_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, INTENT_EXECUTOR_ADDRESS, INTENT_EXECUTOR_ADDRESS_DEV, };
|
|
8
|
-
//# sourceMappingURL=omni-account.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"omni-account.d.ts","sourceRoot":"","sources":["../../../modules/omni-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,QAAA,MAAM,YAAY,EAAE,OAAsD,CAAA;AAC1E,QAAA,MAAM,qBAAqB,EAAE,OACiB,CAAA;AAC9C,QAAA,MAAM,yBAAyB,EAAE,OACa,CAAA;AAE9C,QAAA,MAAM,uBAAuB,EAAE,OACe,CAAA;AAC9C,QAAA,MAAM,2BAA2B,EAAE,OACW,CAAA;AAE9C,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,GAC5B,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INTENT_EXECUTOR_ADDRESS_DEV = exports.INTENT_EXECUTOR_ADDRESS = exports.SAME_CHAIN_MODULE_ADDRESS = exports.TARGET_MODULE_ADDRESS = exports.HOOK_ADDRESS = void 0;
|
|
4
|
-
const HOOK_ADDRESS = '0x0000000000f6Ed8Be424d673c63eeFF8b9267420';
|
|
5
|
-
exports.HOOK_ADDRESS = HOOK_ADDRESS;
|
|
6
|
-
const TARGET_MODULE_ADDRESS = '0x0000000000E5a37279A001301A837a91b5de1D5E';
|
|
7
|
-
exports.TARGET_MODULE_ADDRESS = TARGET_MODULE_ADDRESS;
|
|
8
|
-
const SAME_CHAIN_MODULE_ADDRESS = '0x000000000043ff16d5776c7F0f65Ec485C17Ca04';
|
|
9
|
-
exports.SAME_CHAIN_MODULE_ADDRESS = SAME_CHAIN_MODULE_ADDRESS;
|
|
10
|
-
const INTENT_EXECUTOR_ADDRESS = '0x00000000005aD9ce1f5035FD62CA96CEf16AdAAF';
|
|
11
|
-
exports.INTENT_EXECUTOR_ADDRESS = INTENT_EXECUTOR_ADDRESS;
|
|
12
|
-
const INTENT_EXECUTOR_ADDRESS_DEV = '0xbf9b5b917a83f8adac17b0752846d41d8d7b7e17';
|
|
13
|
-
exports.INTENT_EXECUTOR_ADDRESS_DEV = INTENT_EXECUTOR_ADDRESS_DEV;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smart-sessions.test.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.test.ts"],"names":[],"mappings":""}
|