@rhinestone/sdk 0.7.10 → 0.8.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.
Files changed (138) hide show
  1. package/dist/{src/accounts → accounts}/index.d.ts +2 -2
  2. package/dist/accounts/index.d.ts.map +1 -0
  3. package/dist/{src/accounts → accounts}/index.js +55 -45
  4. package/dist/accounts/nexus.d.ts.map +1 -0
  5. package/dist/{src/accounts → accounts}/nexus.js +48 -42
  6. package/dist/accounts/safe.d.ts.map +1 -0
  7. package/dist/{src/accounts → accounts}/safe.js +35 -29
  8. package/dist/accounts/utils.d.ts.map +1 -0
  9. package/dist/{src/accounts → accounts}/utils.js +23 -19
  10. package/dist/execution/index.d.ts.map +1 -0
  11. package/dist/{src/execution → execution}/index.js +66 -61
  12. package/dist/execution/smart-session.d.ts.map +1 -0
  13. package/dist/execution/smart-session.js +85 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/{src/index.js → index.js} +10 -8
  16. package/dist/modules/abi/smart-sessions.d.ts.map +1 -0
  17. package/dist/modules/common.d.ts.map +1 -0
  18. package/dist/modules/index.d.ts.map +1 -0
  19. package/dist/modules/omni-account.d.ts.map +1 -0
  20. package/dist/modules/validators/core.d.ts.map +1 -0
  21. package/dist/modules/validators/index.d.ts.map +1 -0
  22. package/dist/modules/validators/smart-sessions.d.ts.map +1 -0
  23. package/dist/orchestrator/client.d.ts.map +1 -0
  24. package/dist/orchestrator/consts.d.ts.map +1 -0
  25. package/dist/orchestrator/error.d.ts.map +1 -0
  26. package/dist/orchestrator/index.d.ts.map +1 -0
  27. package/dist/orchestrator/registry.d.ts.map +1 -0
  28. package/dist/orchestrator/types.d.ts.map +1 -0
  29. package/dist/orchestrator/utils.d.ts.map +1 -0
  30. package/dist/types.d.ts.map +1 -0
  31. package/package.json +13 -13
  32. package/dist/cjs/modules/abi/smart-sessions.d.ts.map +0 -1
  33. package/dist/cjs/modules/common.d.ts.map +0 -1
  34. package/dist/cjs/modules/index.d.ts.map +0 -1
  35. package/dist/cjs/modules/omni-account.d.ts.map +0 -1
  36. package/dist/cjs/modules/validators/core.d.ts.map +0 -1
  37. package/dist/cjs/modules/validators/index.d.ts.map +0 -1
  38. package/dist/cjs/modules/validators/smart-sessions.d.ts.map +0 -1
  39. package/dist/cjs/orchestrator/client.d.ts.map +0 -1
  40. package/dist/cjs/orchestrator/consts.d.ts.map +0 -1
  41. package/dist/cjs/orchestrator/error.d.ts.map +0 -1
  42. package/dist/cjs/orchestrator/index.d.ts.map +0 -1
  43. package/dist/cjs/orchestrator/registry.d.ts.map +0 -1
  44. package/dist/cjs/orchestrator/types.d.ts.map +0 -1
  45. package/dist/cjs/orchestrator/utils.d.ts.map +0 -1
  46. package/dist/cjs/types.d.ts.map +0 -1
  47. package/dist/src/accounts/index.d.ts.map +0 -1
  48. package/dist/src/accounts/nexus.d.ts.map +0 -1
  49. package/dist/src/accounts/safe.d.ts.map +0 -1
  50. package/dist/src/accounts/utils.d.ts.map +0 -1
  51. package/dist/src/execution/index.d.ts.map +0 -1
  52. package/dist/src/execution/smart-session.d.ts.map +0 -1
  53. package/dist/src/execution/smart-session.js +0 -81
  54. package/dist/src/index.d.ts.map +0 -1
  55. package/dist/src/modules/abi/smart-sessions.d.ts +0 -42
  56. package/dist/src/modules/abi/smart-sessions.d.ts.map +0 -1
  57. package/dist/src/modules/abi/smart-sessions.js +0 -128
  58. package/dist/src/modules/common.d.ts +0 -16
  59. package/dist/src/modules/common.d.ts.map +0 -1
  60. package/dist/src/modules/common.js +0 -5
  61. package/dist/src/modules/index.d.ts +0 -33
  62. package/dist/src/modules/index.d.ts.map +0 -1
  63. package/dist/src/modules/index.js +0 -146
  64. package/dist/src/modules/omni-account.d.ts +0 -9
  65. package/dist/src/modules/omni-account.d.ts.map +0 -1
  66. package/dist/src/modules/omni-account.js +0 -7
  67. package/dist/src/modules/validators/core.d.ts +0 -23
  68. package/dist/src/modules/validators/core.d.ts.map +0 -1
  69. package/dist/src/modules/validators/core.js +0 -112
  70. package/dist/src/modules/validators/index.d.ts +0 -4
  71. package/dist/src/modules/validators/index.d.ts.map +0 -1
  72. package/dist/src/modules/validators/index.js +0 -3
  73. package/dist/src/modules/validators/smart-sessions.d.ts +0 -29
  74. package/dist/src/modules/validators/smart-sessions.d.ts.map +0 -1
  75. package/dist/src/modules/validators/smart-sessions.js +0 -414
  76. package/dist/src/orchestrator/client.d.ts +0 -29
  77. package/dist/src/orchestrator/client.d.ts.map +0 -1
  78. package/dist/src/orchestrator/client.js +0 -243
  79. package/dist/src/orchestrator/consts.d.ts +0 -5
  80. package/dist/src/orchestrator/consts.d.ts.map +0 -1
  81. package/dist/src/orchestrator/consts.js +0 -4
  82. package/dist/src/orchestrator/error.d.ts +0 -18
  83. package/dist/src/orchestrator/error.d.ts.map +0 -1
  84. package/dist/src/orchestrator/error.js +0 -28
  85. package/dist/src/orchestrator/index.d.ts +0 -11
  86. package/dist/src/orchestrator/index.d.ts.map +0 -1
  87. package/dist/src/orchestrator/index.js +0 -10
  88. package/dist/src/orchestrator/registry.d.ts +0 -17
  89. package/dist/src/orchestrator/registry.d.ts.map +0 -1
  90. package/dist/src/orchestrator/registry.js +0 -344
  91. package/dist/src/orchestrator/types.d.ts +0 -222
  92. package/dist/src/orchestrator/types.d.ts.map +0 -1
  93. package/dist/src/orchestrator/types.js +0 -9
  94. package/dist/src/orchestrator/utils.d.ts +0 -29
  95. package/dist/src/orchestrator/utils.d.ts.map +0 -1
  96. package/dist/src/orchestrator/utils.js +0 -303
  97. package/dist/src/types.d.ts +0 -113
  98. package/dist/src/types.d.ts.map +0 -1
  99. package/dist/src/types.js +0 -1
  100. package/dist/test/modules/validators/smart-sessions.test.d.ts +0 -2
  101. package/dist/test/modules/validators/smart-sessions.test.d.ts.map +0 -1
  102. package/dist/test/modules/validators/smart-sessions.test.js +0 -20
  103. /package/dist/{src/accounts → accounts}/nexus.d.ts +0 -0
  104. /package/dist/{src/accounts → accounts}/safe.d.ts +0 -0
  105. /package/dist/{src/accounts → accounts}/utils.d.ts +0 -0
  106. /package/dist/{src/execution → execution}/index.d.ts +0 -0
  107. /package/dist/{src/execution → execution}/smart-session.d.ts +0 -0
  108. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  109. /package/dist/{cjs/modules → modules}/abi/smart-sessions.d.ts +0 -0
  110. /package/dist/{cjs/modules → modules}/abi/smart-sessions.js +0 -0
  111. /package/dist/{cjs/modules → modules}/common.d.ts +0 -0
  112. /package/dist/{cjs/modules → modules}/common.js +0 -0
  113. /package/dist/{cjs/modules → modules}/index.d.ts +0 -0
  114. /package/dist/{cjs/modules → modules}/index.js +0 -0
  115. /package/dist/{cjs/modules → modules}/omni-account.d.ts +0 -0
  116. /package/dist/{cjs/modules → modules}/omni-account.js +0 -0
  117. /package/dist/{cjs/modules → modules}/validators/core.d.ts +0 -0
  118. /package/dist/{cjs/modules → modules}/validators/core.js +0 -0
  119. /package/dist/{cjs/modules → modules}/validators/index.d.ts +0 -0
  120. /package/dist/{cjs/modules → modules}/validators/index.js +0 -0
  121. /package/dist/{cjs/modules → modules}/validators/smart-sessions.d.ts +0 -0
  122. /package/dist/{cjs/modules → modules}/validators/smart-sessions.js +0 -0
  123. /package/dist/{cjs/orchestrator → orchestrator}/client.d.ts +0 -0
  124. /package/dist/{cjs/orchestrator → orchestrator}/client.js +0 -0
  125. /package/dist/{cjs/orchestrator → orchestrator}/consts.d.ts +0 -0
  126. /package/dist/{cjs/orchestrator → orchestrator}/consts.js +0 -0
  127. /package/dist/{cjs/orchestrator → orchestrator}/error.d.ts +0 -0
  128. /package/dist/{cjs/orchestrator → orchestrator}/error.js +0 -0
  129. /package/dist/{cjs/orchestrator → orchestrator}/index.d.ts +0 -0
  130. /package/dist/{cjs/orchestrator → orchestrator}/index.js +0 -0
  131. /package/dist/{cjs/orchestrator → orchestrator}/registry.d.ts +0 -0
  132. /package/dist/{cjs/orchestrator → orchestrator}/registry.js +0 -0
  133. /package/dist/{cjs/orchestrator → orchestrator}/types.d.ts +0 -0
  134. /package/dist/{cjs/orchestrator → orchestrator}/types.js +0 -0
  135. /package/dist/{cjs/orchestrator → orchestrator}/utils.d.ts +0 -0
  136. /package/dist/{cjs/orchestrator → orchestrator}/utils.js +0 -0
  137. /package/dist/{cjs/types.d.ts → types.d.ts} +0 -0
  138. /package/dist/{cjs/types.js → types.js} +0 -0
@@ -1,303 +0,0 @@
1
- import { domainSeparator, encodeAbiParameters, encodePacked, keccak256, zeroAddress, } from 'viem';
2
- import { HOOK_ADDRESS } from '../modules/index.js';
3
- import { BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_PRECONFIRMED, BUNDLE_STATUS_UNKNOWN, } from './types.js';
4
- const MULTICHAIN_COMPACT_TYPEHASH = '0xee54591377b86e048be6b2fbd8913598a6270aed3415776321279495bf4efae5';
5
- const SEGMENT_TYPEHASH = '0x54ada5b33a7390e2883c985295cfa2dcd9bb46515ad10cbdfc22a7c73f9807db';
6
- const WITNESS_TYPEHASH = '0x78e29a727cef567e7d6dddf5bf7eedf0c84af60d4a57512c586c787aae731629';
7
- const EXECUTION_TYPEHASH = '0xa222cbaaad3b88446c3ca031429dafb24afdbda10c5dbd9882c294762857141a';
8
- var BundleStatusEnum;
9
- (function (BundleStatusEnum) {
10
- BundleStatusEnum["PENDING"] = "PENDING";
11
- BundleStatusEnum["EXPIRED"] = "EXPIRED";
12
- BundleStatusEnum["PARTIALLY_COMPLETED"] = "PARTIALLY_COMPLETED";
13
- BundleStatusEnum["PRECONFIRMED"] = "PRECONFIRMED";
14
- BundleStatusEnum["COMPLETED"] = "COMPLETED";
15
- BundleStatusEnum["FILLED"] = "FILLED";
16
- BundleStatusEnum["FAILED"] = "FAILED";
17
- BundleStatusEnum["UNKNOWN"] = "UNKNOWN";
18
- })(BundleStatusEnum || (BundleStatusEnum = {}));
19
- function getEmptyUserOp() {
20
- return {
21
- sender: zeroAddress,
22
- nonce: 0n,
23
- callData: '0x',
24
- preVerificationGas: 0n,
25
- maxFeePerGas: 0n,
26
- maxPriorityFeePerGas: 0n,
27
- verificationGasLimit: 0n,
28
- callGasLimit: 0n,
29
- signature: '0x',
30
- };
31
- }
32
- function getOrderBundleHash(orderBundle) {
33
- const notarizedChainId = Number(orderBundle.segments[0].chainId);
34
- return hashMultiChainCompactWithDomainSeparator(orderBundle, getCompactDomainSeparator(notarizedChainId, HOOK_ADDRESS));
35
- }
36
- function convertBigIntFields(obj) {
37
- if (obj === null || obj === undefined) {
38
- return obj;
39
- }
40
- if (typeof obj === 'bigint') {
41
- return obj.toString();
42
- }
43
- if (Array.isArray(obj)) {
44
- return obj.map(convertBigIntFields);
45
- }
46
- if (typeof obj === 'object') {
47
- const result = {};
48
- for (const key in obj) {
49
- if (Object.hasOwn(obj, key)) {
50
- result[key] = convertBigIntFields(obj[key]);
51
- }
52
- }
53
- return result;
54
- }
55
- return obj;
56
- }
57
- function parseCompactResponse(response) {
58
- return {
59
- sponsor: response.sponsor,
60
- nonce: BigInt(response.nonce),
61
- expires: BigInt(response.expires),
62
- segments: response.segments.map((segment) => {
63
- return {
64
- arbiter: segment.arbiter,
65
- chainId: BigInt(segment.chainId),
66
- idsAndAmounts: segment.idsAndAmounts.map((idsAndAmount) => {
67
- return [BigInt(idsAndAmount[0]), BigInt(idsAndAmount[1])];
68
- }),
69
- witness: {
70
- recipient: segment.witness.recipient,
71
- tokenOut: segment.witness.tokenOut.map((tokenOut) => {
72
- return [BigInt(tokenOut[0]), BigInt(tokenOut[1])];
73
- }),
74
- depositId: BigInt(segment.witness.depositId),
75
- targetChain: BigInt(segment.witness.targetChain),
76
- fillDeadline: segment.witness.fillDeadline,
77
- execs: segment.witness.execs.map((exec) => {
78
- return {
79
- to: exec.to,
80
- value: BigInt(exec.value),
81
- data: exec.data,
82
- };
83
- }),
84
- userOpHash: segment.witness.userOpHash,
85
- maxFeeBps: segment.witness.maxFeeBps,
86
- },
87
- };
88
- }),
89
- };
90
- }
91
- function parseUseChainBalances(response) {
92
- const result = {};
93
- for (const chainIdStr in response) {
94
- const chainId = Number(chainIdStr);
95
- const chainData = response[chainIdStr];
96
- result[chainId] = {};
97
- for (const tokenAddress in chainData) {
98
- const balanceStr = chainData[tokenAddress]?.balance;
99
- result[chainId][tokenAddress] = BigInt(balanceStr);
100
- }
101
- }
102
- return result;
103
- }
104
- function parseOrderCost(response) {
105
- const tokensSpent = {};
106
- for (const chainIdStr in response.tokensSpent) {
107
- const chainId = Number(chainIdStr);
108
- tokensSpent[chainId] = {};
109
- const chainTokens = response.tokensSpent[chainIdStr];
110
- for (const tokenAddress in chainTokens) {
111
- const balanceStr = chainTokens[tokenAddress];
112
- if (typeof balanceStr !== 'string') {
113
- throw new Error(`Expected string balance for token ${tokenAddress} on chain ${chainId}`);
114
- }
115
- tokensSpent[chainId][tokenAddress] = BigInt(balanceStr);
116
- }
117
- }
118
- const tokensReceived = response.tokensReceived.map((entry) => {
119
- return {
120
- tokenAddress: entry.tokenAddress,
121
- hasFulfilled: entry.hasFulfilled,
122
- amountSpent: BigInt(entry.amountSpent),
123
- targetAmount: BigInt(entry.targetAmount),
124
- fee: BigInt(entry.fee),
125
- };
126
- });
127
- return {
128
- hasFulfilledAll: true,
129
- tokensSpent,
130
- tokensReceived,
131
- };
132
- }
133
- function parseInsufficientBalanceResult(response) {
134
- if (!Array.isArray(response.tokenShortfall)) {
135
- throw new Error('Expected tokenShortfall to be an array');
136
- }
137
- const tokenShortfall = response.tokenShortfall.map((entry) => {
138
- return {
139
- tokenAddress: entry.tokenAddress,
140
- targetAmount: BigInt(entry.targetAmount),
141
- amountSpent: BigInt(entry.amountSpent),
142
- fee: BigInt(entry.fee),
143
- tokenSymbol: entry.tokenSymbol,
144
- tokenDecimals: entry.tokenDecimals,
145
- };
146
- });
147
- const result = {
148
- hasFulfilledAll: false,
149
- tokenShortfall,
150
- totalTokenShortfallInUSD: BigInt(response.totalTokenShortfallInUSD),
151
- };
152
- return result;
153
- }
154
- function parseOrderCostResult(response) {
155
- if (typeof response.hasFulfilledAll !== 'boolean') {
156
- throw new Error('Missing or invalid hasFulfilledAll field');
157
- }
158
- if (response.hasFulfilledAll) {
159
- return parseOrderCost(response);
160
- }
161
- else {
162
- return parseInsufficientBalanceResult(response);
163
- }
164
- }
165
- function parsePendingBundleEvent(response) {
166
- return {
167
- type: response.type,
168
- bundleId: BigInt(response.bundleId),
169
- targetFillPayload: {
170
- to: response.targetFillPayload.to,
171
- data: response.targetFillPayload.data,
172
- value: BigInt(response.targetFillPayload.value),
173
- chainId: response.targetFillPayload.chainId,
174
- },
175
- acrossDepositEvents: response.acrossDepositEvents.map((event) => {
176
- return {
177
- message: event.message,
178
- depositId: BigInt(event.depositId),
179
- depositor: event.depositor,
180
- recipient: event.recipient,
181
- inputToken: event.inputToken,
182
- inputAmount: BigInt(event.inputAmount),
183
- outputToken: event.outputToken,
184
- fillDeadline: event.fillDeadline,
185
- outputAmount: BigInt(event.outputAmount),
186
- quoteTimestamp: event.quoteTimestamp,
187
- exclusiveRelayer: event.exclusiveRelayer,
188
- destinationChainId: event.destinationChainId,
189
- originClaimPayload: {
190
- to: event.originClaimPayload.to,
191
- data: event.originClaimPayload.data,
192
- value: BigInt(event.originClaimPayload.value),
193
- chainId: event.originClaimPayload.chainId,
194
- },
195
- exclusivityDeadline: event.exclusivityDeadline,
196
- };
197
- }),
198
- };
199
- }
200
- function hashMultiChainCompactWithDomainSeparator(multiChainCompact, domainSeparator) {
201
- return keccak256(encodePacked(['string', 'bytes32', 'bytes32'], [
202
- '\x19\x01',
203
- domainSeparator,
204
- hashMultichainCompactWithoutDomainSeparator(multiChainCompact),
205
- ]));
206
- }
207
- function hashMultichainCompactWithoutDomainSeparator(multiChainCompact) {
208
- return keccak256(encodeAbiParameters([
209
- { name: 'typehash', type: 'bytes32' },
210
- { name: 'sponsor', type: 'address' },
211
- { name: 'nonce', type: 'uint256' },
212
- { name: 'expires', type: 'uint256' },
213
- { name: 'segments', type: 'bytes32' },
214
- ], [
215
- MULTICHAIN_COMPACT_TYPEHASH,
216
- multiChainCompact.sponsor,
217
- multiChainCompact.nonce,
218
- multiChainCompact.expires,
219
- hashSegments([...multiChainCompact.segments]),
220
- ]));
221
- }
222
- function hashSegments(segment) {
223
- return keccak256(encodePacked(['bytes32[]'], [segment.map(hashSegment)]));
224
- }
225
- function hashSegment(segment) {
226
- return keccak256(encodeAbiParameters([
227
- { name: 'typehash', type: 'bytes32' },
228
- { name: 'arbiter', type: 'address' },
229
- { name: 'chainId', type: 'uint256' },
230
- { name: 'idsAndAmounts', type: 'bytes32' },
231
- { name: 'witness', type: 'bytes32' },
232
- ], [
233
- SEGMENT_TYPEHASH,
234
- segment.arbiter,
235
- segment.chainId,
236
- hashIdsAndAmounts(segment.idsAndAmounts),
237
- hashWitness(segment.witness),
238
- ]));
239
- }
240
- function hashWitness(witness) {
241
- return keccak256(encodeAbiParameters([
242
- { name: 'typehash', type: 'bytes32' },
243
- { name: 'recipient', type: 'address' },
244
- { name: 'tokenOut', type: 'bytes32' },
245
- { name: 'depositId', type: 'uint256' },
246
- { name: 'targetChain', type: 'uint256' },
247
- { name: 'fillDeadline', type: 'uint32' },
248
- { name: 'execs', type: 'bytes32' }, // Assuming XchainExec[] is complex
249
- { name: 'userOpHash', type: 'bytes32' },
250
- { name: 'maxFeeBps', type: 'uint32' },
251
- ], [
252
- WITNESS_TYPEHASH,
253
- witness.recipient,
254
- hashIdsAndAmounts(witness.tokenOut),
255
- witness.depositId,
256
- witness.targetChain,
257
- witness.fillDeadline,
258
- hashExecutionArray(witness.execs),
259
- witness.userOpHash,
260
- witness.maxFeeBps,
261
- ]));
262
- }
263
- function getCompactDomainSeparator(chainId, verifyingContract) {
264
- return domainSeparator({
265
- domain: getCompactDomain(chainId, verifyingContract),
266
- });
267
- }
268
- function getCompactDomain(chainId, verifyingContract) {
269
- return {
270
- name: 'The Compact',
271
- version: '0',
272
- chainId: chainId,
273
- verifyingContract: verifyingContract,
274
- };
275
- }
276
- function hashIdsAndAmounts(idsAndAmounts) {
277
- return keccak256(encodePacked(['uint256[2][]'], [idsAndAmounts]));
278
- }
279
- function hashExecutionArray(executionArray) {
280
- const hashes = executionArray.map(hashExecution);
281
- return keccak256(encodePacked(['bytes32[]'], [hashes]));
282
- }
283
- function hashExecution(execution) {
284
- return keccak256(encodeAbiParameters([
285
- { name: 'typehash', type: 'bytes32' },
286
- { name: 'target', type: 'address' },
287
- { name: 'value', type: 'uint256' },
288
- { name: 'callData', type: 'bytes32' },
289
- ], [
290
- EXECUTION_TYPEHASH,
291
- execution.to,
292
- execution.value,
293
- keccak256(execution.data),
294
- ]));
295
- }
296
- function applyInjectedExecutions(orderPath) {
297
- if (orderPath.injectedExecutions.length > 0) {
298
- orderPath.orderBundle.segments[0].witness.execs =
299
- orderPath.injectedExecutions.concat(orderPath.orderBundle.segments[0].witness.execs);
300
- }
301
- return orderPath.orderBundle;
302
- }
303
- export { BundleStatusEnum, getEmptyUserOp, getOrderBundleHash, convertBigIntFields, parseCompactResponse, parsePendingBundleEvent, hashMultichainCompactWithoutDomainSeparator, parseUseChainBalances, parseOrderCost, parseInsufficientBalanceResult, parseOrderCostResult, applyInjectedExecutions, };
@@ -1,113 +0,0 @@
1
- import type { Account, Address, Chain, Hex } from 'viem';
2
- import type { WebAuthnAccount } from 'viem/account-abstraction';
3
- interface AccountProviderConfig {
4
- type: 'safe' | 'nexus';
5
- }
6
- interface OwnableValidatorConfig {
7
- type: 'ecdsa';
8
- accounts: Account[];
9
- threshold?: number;
10
- }
11
- interface WebauthnValidatorConfig {
12
- type: 'passkey';
13
- account: WebAuthnAccount;
14
- }
15
- interface BundlerConfig {
16
- type: 'pimlico';
17
- apiKey: string;
18
- }
19
- type OwnerSet = OwnableValidatorConfig | WebauthnValidatorConfig;
20
- interface SudoPolicy {
21
- type: 'sudo';
22
- }
23
- interface UniversalActionPolicy {
24
- type: 'universal-action';
25
- valueLimitPerUse?: bigint;
26
- rules: [UniversalActionPolicyParamRule, ...UniversalActionPolicyParamRule[]];
27
- }
28
- interface UniversalActionPolicyParamRule {
29
- condition: UniversalActionPolicyParamCondition;
30
- calldataOffset: bigint;
31
- usageLimit?: bigint;
32
- referenceValue: Hex | bigint;
33
- }
34
- type UniversalActionPolicyParamCondition = 'equal' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'notEqual' | 'inRange';
35
- interface SpendingLimitsPolicy {
36
- type: 'spending-limits';
37
- limits: {
38
- token: Address;
39
- amount: bigint;
40
- }[];
41
- }
42
- interface TimeFramePolicy {
43
- type: 'time-frame';
44
- validUntil: number;
45
- validAfter: number;
46
- }
47
- interface UsageLimitPolicy {
48
- type: 'usage-limit';
49
- limit: bigint;
50
- }
51
- interface ValueLimitPolicy {
52
- type: 'value-limit';
53
- limit: bigint;
54
- }
55
- type Policy = SudoPolicy | UniversalActionPolicy | SpendingLimitsPolicy | TimeFramePolicy | UsageLimitPolicy | ValueLimitPolicy;
56
- interface Action {
57
- target: Address;
58
- selector: Hex;
59
- policies?: [Policy, ...Policy[]];
60
- }
61
- interface Session {
62
- owners: OwnerSet;
63
- policies?: [Policy, ...Policy[]];
64
- actions?: [Action, ...Action[]];
65
- salt?: Hex;
66
- }
67
- interface RhinestoneAccountConfig {
68
- account?: AccountProviderConfig;
69
- owners: OwnerSet;
70
- rhinestoneApiKey: string;
71
- deployerAccount?: Account;
72
- sessions?: Session[];
73
- eoa?: Account;
74
- provider?: {
75
- type: 'alchemy';
76
- apiKey: string;
77
- };
78
- bundler?: BundlerConfig;
79
- }
80
- interface Call {
81
- to: Address;
82
- data?: Hex;
83
- value?: bigint;
84
- }
85
- /**
86
- * @deprecated Use the `Call` type instead.
87
- */
88
- type Execution = Call;
89
- interface TokenRequest {
90
- address: Address;
91
- amount: bigint;
92
- }
93
- interface SessionSignerSet {
94
- type: 'session';
95
- session: Session;
96
- }
97
- type SignerSet = SessionSignerSet;
98
- interface BaseTransaction {
99
- calls: Call[];
100
- tokenRequests: TokenRequest[];
101
- gasLimit?: bigint;
102
- signers?: SignerSet;
103
- }
104
- interface SameChainTransaction extends BaseTransaction {
105
- chain: Chain;
106
- }
107
- interface CrossChainTransaction extends BaseTransaction {
108
- sourceChain?: Chain;
109
- targetChain: Chain;
110
- }
111
- type Transaction = SameChainTransaction | CrossChainTransaction;
112
- export type { RhinestoneAccountConfig, AccountProviderConfig, BundlerConfig, Transaction, Call, Execution, TokenRequest, OwnerSet, SignerSet, Session, Policy, UniversalActionPolicyParamCondition, };
113
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
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;AAE/D,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,eAAe,CAAA;CACzB;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf;AAED,KAAK,QAAQ,GAAG,sBAAsB,GAAG,uBAAuB,CAAA;AAEhE,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,UAAU,qBAAqB;IAC7B,IAAI,EAAE,kBAAkB,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,KAAK,EAAE,C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AW,EACX,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,OAAO,EACP,MAAM,EACN,mCAAmC,GACpC,CAAA"}
package/dist/src/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=smart-sessions.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"smart-sessions.test.d.ts","sourceRoot":"","sources":["../../../../../test/modules/validators/smart-sessions.test.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
1
- import { privateKeyToAccount } from 'viem/accounts';
2
- import { expect, test } from 'vitest';
3
- import { getPermissionId } from '../../../src/modules/validators/smart-sessions.js';
4
- test('getPermissionId', () => {
5
- const accountA = privateKeyToAccount('0x2be89d993f98bbaab8b83f1a2830cb9414e19662967c7ba2a0f43d2a9125bd6d');
6
- const accountB = privateKeyToAccount('0x39e2fec1a04c088f939d81de8f1abebdebf899a6cfb9968f9b663a7afba8301b');
7
- expect(getPermissionId({
8
- owners: {
9
- type: 'ecdsa',
10
- accounts: [accountA, accountB],
11
- },
12
- })).toBe('0xa16d89135da22ae1b97b6ac6ebc047dce282640bbbf56059958d96527b720344');
13
- expect(getPermissionId({
14
- owners: {
15
- type: 'ecdsa',
16
- accounts: [accountA, accountB],
17
- },
18
- salt: '0x97340e1cfff3319c76ef22b2bc9d3231071d550125d68c9d4a8972823f166320',
19
- })).toBe('0x85ff7cd77e7e0f8fbc2e42c86cdb948e4c79ac5a5e4595def4c38d7ed804eef9');
20
- });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes