@rhinestone/sdk 1.4.2 → 2.0.0-beta.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 (202) hide show
  1. package/README.md +89 -1
  2. package/dist/src/accounts/error.d.ts +1 -1
  3. package/dist/src/accounts/error.js +1 -19
  4. package/dist/src/accounts/index.d.ts +5 -5
  5. package/dist/src/accounts/index.js +121 -157
  6. package/dist/src/accounts/json-rpc/index.d.ts +1 -1
  7. package/dist/src/accounts/json-rpc/index.js +8 -10
  8. package/dist/src/accounts/json-rpc/providers.d.ts +1 -1
  9. package/dist/src/accounts/json-rpc/providers.js +4 -7
  10. package/dist/src/accounts/kernel.d.ts +3 -3
  11. package/dist/src/accounts/kernel.js +66 -75
  12. package/dist/src/accounts/nexus.d.ts +3 -3
  13. package/dist/src/accounts/nexus.js +62 -73
  14. package/dist/src/accounts/passport.d.ts +3 -3
  15. package/dist/src/accounts/passport.js +9 -13
  16. package/dist/src/accounts/safe.d.ts +3 -3
  17. package/dist/src/accounts/safe.js +54 -63
  18. package/dist/src/accounts/signing/common.d.ts +10 -4
  19. package/dist/src/accounts/signing/common.d.ts.map +1 -1
  20. package/dist/src/accounts/signing/common.js +30 -36
  21. package/dist/src/accounts/signing/message.d.ts +2 -2
  22. package/dist/src/accounts/signing/message.js +10 -12
  23. package/dist/src/accounts/signing/passkeys.js +11 -17
  24. package/dist/src/accounts/signing/typedData.d.ts +1 -1
  25. package/dist/src/accounts/signing/typedData.js +6 -8
  26. package/dist/src/accounts/startale.d.ts +3 -3
  27. package/dist/src/accounts/startale.js +37 -47
  28. package/dist/src/accounts/utils.d.ts +2 -2
  29. package/dist/src/accounts/utils.js +22 -28
  30. package/dist/src/accounts/walletClient.js +4 -8
  31. package/dist/src/actions/compact.d.ts +1 -1
  32. package/dist/src/actions/compact.js +22 -35
  33. package/dist/src/actions/deployment.d.ts +1 -1
  34. package/dist/src/actions/deployment.js +11 -13
  35. package/dist/src/actions/ecdsa.d.ts +1 -1
  36. package/dist/src/actions/ecdsa.js +14 -20
  37. package/dist/src/actions/index.d.ts +2 -2
  38. package/dist/src/actions/index.js +6 -10
  39. package/dist/src/actions/mfa.d.ts +1 -1
  40. package/dist/src/actions/mfa.js +18 -24
  41. package/dist/src/actions/passkeys.d.ts +2 -2
  42. package/dist/src/actions/passkeys.js +14 -20
  43. package/dist/src/actions/recovery.d.ts +1 -1
  44. package/dist/src/actions/recovery.js +25 -29
  45. package/dist/src/actions/smart-sessions.d.ts +1 -1
  46. package/dist/src/actions/smart-sessions.js +8 -12
  47. package/dist/src/auth/provider.d.ts +7 -0
  48. package/dist/src/auth/provider.d.ts.map +1 -0
  49. package/dist/src/auth/provider.js +38 -0
  50. package/dist/src/errors/index.d.ts +3 -3
  51. package/dist/src/errors/index.js +10 -54
  52. package/dist/src/execution/compact.d.ts +3 -3
  53. package/dist/src/execution/compact.js +10 -18
  54. package/dist/src/execution/error.js +1 -11
  55. package/dist/src/execution/index.d.ts +9 -8
  56. package/dist/src/execution/index.d.ts.map +1 -1
  57. package/dist/src/execution/index.js +54 -67
  58. package/dist/src/execution/permit2.d.ts +5 -5
  59. package/dist/src/execution/permit2.js +8 -13
  60. package/dist/src/execution/singleChainOps.d.ts +2 -2
  61. package/dist/src/execution/singleChainOps.js +1 -3
  62. package/dist/src/execution/types.d.ts +1 -1
  63. package/dist/src/execution/types.js +1 -2
  64. package/dist/src/execution/utils.d.ts +10 -6
  65. package/dist/src/execution/utils.d.ts.map +1 -1
  66. package/dist/src/execution/utils.js +159 -162
  67. package/dist/src/index.d.ts +10 -10
  68. package/dist/src/index.d.ts.map +1 -1
  69. package/dist/src/index.js +57 -67
  70. package/dist/src/jwt-server/digest.d.ts +11 -0
  71. package/dist/src/jwt-server/digest.d.ts.map +1 -0
  72. package/dist/src/jwt-server/digest.js +19 -0
  73. package/dist/src/jwt-server/express.d.ts +16 -0
  74. package/dist/src/jwt-server/express.d.ts.map +1 -0
  75. package/dist/src/jwt-server/express.js +23 -0
  76. package/dist/src/jwt-server/handlers.d.ts +10 -0
  77. package/dist/src/jwt-server/handlers.d.ts.map +1 -0
  78. package/dist/src/jwt-server/handlers.js +37 -0
  79. package/dist/src/jwt-server/index.d.ts +8 -0
  80. package/dist/src/jwt-server/index.d.ts.map +1 -0
  81. package/dist/src/jwt-server/index.js +7 -0
  82. package/dist/src/jwt-server/jcs.d.ts +12 -0
  83. package/dist/src/jwt-server/jcs.d.ts.map +1 -0
  84. package/dist/src/jwt-server/jcs.js +57 -0
  85. package/dist/src/jwt-server/signer.d.ts +18 -0
  86. package/dist/src/jwt-server/signer.d.ts.map +1 -0
  87. package/dist/src/jwt-server/signer.js +68 -0
  88. package/dist/src/jwt-server/sponsorship.d.ts +19 -0
  89. package/dist/src/jwt-server/sponsorship.d.ts.map +1 -0
  90. package/dist/src/jwt-server/sponsorship.js +51 -0
  91. package/dist/src/jwt-server/web.d.ts +4 -0
  92. package/dist/src/jwt-server/web.d.ts.map +1 -0
  93. package/dist/src/jwt-server/web.js +23 -0
  94. package/dist/src/modules/abi/smart-session-emissary.js +1 -3
  95. package/dist/src/modules/abi/smart-sessions.js +1 -4
  96. package/dist/src/modules/chain-abstraction.js +1 -5
  97. package/dist/src/modules/common.d.ts +1 -1
  98. package/dist/src/modules/common.js +1 -13
  99. package/dist/src/modules/index.d.ts +5 -5
  100. package/dist/src/modules/index.js +35 -50
  101. package/dist/src/modules/legacy.d.ts +2 -2
  102. package/dist/src/modules/legacy.js +11 -14
  103. package/dist/src/modules/read.d.ts +1 -1
  104. package/dist/src/modules/read.js +11 -15
  105. package/dist/src/modules/validators/core.d.ts +2 -2
  106. package/dist/src/modules/validators/core.js +26 -44
  107. package/dist/src/modules/validators/index.d.ts +2 -2
  108. package/dist/src/modules/validators/index.js +3 -19
  109. package/dist/src/modules/validators/policies/claim/permit2.d.ts +1 -1
  110. package/dist/src/modules/validators/policies/claim/permit2.js +39 -44
  111. package/dist/src/modules/validators/policies/claim/types.js +11 -14
  112. package/dist/src/modules/validators/smart-sessions.d.ts +4 -4
  113. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  114. package/dist/src/modules/validators/smart-sessions.js +77 -97
  115. package/dist/src/orchestrator/client.d.ts +10 -5
  116. package/dist/src/orchestrator/client.d.ts.map +1 -1
  117. package/dist/src/orchestrator/client.js +73 -66
  118. package/dist/src/orchestrator/consts.d.ts +1 -1
  119. package/dist/src/orchestrator/consts.d.ts.map +1 -1
  120. package/dist/src/orchestrator/consts.js +2 -8
  121. package/dist/src/orchestrator/error.js +1 -33
  122. package/dist/src/orchestrator/index.d.ts +8 -7
  123. package/dist/src/orchestrator/index.d.ts.map +1 -1
  124. package/dist/src/orchestrator/index.js +8 -57
  125. package/dist/src/orchestrator/registry.d.ts +2 -2
  126. package/dist/src/orchestrator/registry.js +19 -33
  127. package/dist/src/orchestrator/types.d.ts +5 -1
  128. package/dist/src/orchestrator/types.d.ts.map +1 -1
  129. package/dist/src/orchestrator/types.js +1 -17
  130. package/dist/src/orchestrator/utils.js +1 -3
  131. package/dist/src/types.d.ts +29 -5
  132. package/dist/src/types.d.ts.map +1 -1
  133. package/dist/src/types.js +1 -2
  134. package/dist/src/utils/index.d.ts +2 -2
  135. package/dist/src/utils/index.js +9 -15
  136. package/package.json +29 -98
  137. package/dist/src/accounts/index.test.d.ts +0 -2
  138. package/dist/src/accounts/index.test.d.ts.map +0 -1
  139. package/dist/src/accounts/index.test.js +0 -33
  140. package/dist/src/accounts/json-rpc/index.test.d.ts +0 -2
  141. package/dist/src/accounts/json-rpc/index.test.d.ts.map +0 -1
  142. package/dist/src/accounts/json-rpc/index.test.js +0 -35
  143. package/dist/src/accounts/json-rpc/providers.test.d.ts +0 -2
  144. package/dist/src/accounts/json-rpc/providers.test.d.ts.map +0 -1
  145. package/dist/src/accounts/json-rpc/providers.test.js +0 -43
  146. package/dist/src/accounts/kernel.test.d.ts +0 -2
  147. package/dist/src/accounts/kernel.test.d.ts.map +0 -1
  148. package/dist/src/accounts/kernel.test.js +0 -132
  149. package/dist/src/accounts/nexus.test.d.ts +0 -2
  150. package/dist/src/accounts/nexus.test.d.ts.map +0 -1
  151. package/dist/src/accounts/nexus.test.js +0 -118
  152. package/dist/src/accounts/safe.test.d.ts +0 -2
  153. package/dist/src/accounts/safe.test.d.ts.map +0 -1
  154. package/dist/src/accounts/safe.test.js +0 -168
  155. package/dist/src/accounts/signing/passkeys.test.d.ts +0 -2
  156. package/dist/src/accounts/signing/passkeys.test.d.ts.map +0 -1
  157. package/dist/src/accounts/signing/passkeys.test.js +0 -88
  158. package/dist/src/accounts/startale.test.d.ts +0 -2
  159. package/dist/src/accounts/startale.test.d.ts.map +0 -1
  160. package/dist/src/accounts/startale.test.js +0 -189
  161. package/dist/src/accounts/utils.test.d.ts +0 -2
  162. package/dist/src/accounts/utils.test.d.ts.map +0 -1
  163. package/dist/src/accounts/utils.test.js +0 -49
  164. package/dist/src/actions/ecdsa.test.d.ts +0 -2
  165. package/dist/src/actions/ecdsa.test.d.ts.map +0 -1
  166. package/dist/src/actions/ecdsa.test.js +0 -99
  167. package/dist/src/actions/passkeys.test.d.ts +0 -2
  168. package/dist/src/actions/passkeys.test.d.ts.map +0 -1
  169. package/dist/src/actions/passkeys.test.js +0 -54
  170. package/dist/src/actions/recovery.test.d.ts +0 -2
  171. package/dist/src/actions/recovery.test.d.ts.map +0 -1
  172. package/dist/src/actions/recovery.test.js +0 -168
  173. package/dist/src/execution/signing.test.d.ts +0 -2
  174. package/dist/src/execution/signing.test.d.ts.map +0 -1
  175. package/dist/src/execution/signing.test.js +0 -465
  176. package/dist/src/execution/utils.test.d.ts +0 -2
  177. package/dist/src/execution/utils.test.d.ts.map +0 -1
  178. package/dist/src/execution/utils.test.js +0 -388
  179. package/dist/src/modules/index.test.d.ts +0 -2
  180. package/dist/src/modules/index.test.d.ts.map +0 -1
  181. package/dist/src/modules/index.test.js +0 -81
  182. package/dist/src/modules/validators/core.test.d.ts +0 -2
  183. package/dist/src/modules/validators/core.test.d.ts.map +0 -1
  184. package/dist/src/modules/validators/core.test.js +0 -101
  185. package/dist/src/modules/validators/policies/claim/permit2.test.d.ts +0 -2
  186. package/dist/src/modules/validators/policies/claim/permit2.test.d.ts.map +0 -1
  187. package/dist/src/modules/validators/policies/claim/permit2.test.js +0 -519
  188. package/dist/src/modules/validators/smart-sessions.test.d.ts +0 -2
  189. package/dist/src/modules/validators/smart-sessions.test.d.ts.map +0 -1
  190. package/dist/src/modules/validators/smart-sessions.test.js +0 -311
  191. package/dist/src/orchestrator/registry.test.d.ts +0 -2
  192. package/dist/src/orchestrator/registry.test.d.ts.map +0 -1
  193. package/dist/src/orchestrator/registry.test.js +0 -154
  194. package/dist/src/utils/index.test.d.ts +0 -2
  195. package/dist/src/utils/index.test.d.ts.map +0 -1
  196. package/dist/src/utils/index.test.js +0 -42
  197. package/dist/test/consts.d.ts +0 -10
  198. package/dist/test/consts.d.ts.map +0 -1
  199. package/dist/test/consts.js +0 -22
  200. package/dist/test/utils/utils.d.ts +0 -5
  201. package/dist/test/utils/utils.d.ts.map +0 -1
  202. package/dist/test/utils/utils.js +0 -20
@@ -1,41 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SMART_SESSION_EMISSARY_ADDRESS_DEV = exports.SMART_SESSION_EMISSARY_ADDRESS = exports.WEBAUTHN_V0_VALIDATOR_ADDRESS = exports.MULTI_FACTOR_VALIDATOR_ADDRESS = exports.WEBAUTHN_VALIDATOR_ADDRESS = exports.ENS_VALIDATOR_ADDRESS = exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
4
- exports.getOwnerValidator = getOwnerValidator;
5
- exports.getOwnableValidator = getOwnableValidator;
6
- exports.getENSValidator = getENSValidator;
7
- exports.getWebAuthnValidator = getWebAuthnValidator;
8
- exports.getMultiFactorValidator = getMultiFactorValidator;
9
- exports.getSocialRecoveryValidator = getSocialRecoveryValidator;
10
- exports.getValidator = getValidator;
11
- exports.getMockSignature = getMockSignature;
12
- exports.supportsEip712 = supportsEip712;
13
- const viem_1 = require("viem");
14
- const error_1 = require("../../accounts/error");
15
- const common_1 = require("../common");
1
+ import { bytesToHex, concat, encodeAbiParameters, encodePacked, hexToBytes, maxUint48, pad, toHex, } from 'viem';
2
+ import { OwnersFieldRequiredError } from '../../accounts/error.js';
3
+ import { MODULE_TYPE_ID_VALIDATOR } from '../common.js';
16
4
  const SMART_SESSION_EMISSARY_ADDRESS_DEV = '0x60731de80d78548875f8a67c4fec2a8660194e0c';
17
- exports.SMART_SESSION_EMISSARY_ADDRESS_DEV = SMART_SESSION_EMISSARY_ADDRESS_DEV;
18
5
  const SMART_SESSION_EMISSARY_ADDRESS = '0xad568b3f825a8d5ffc06dd3253526b64d810ae89';
19
- exports.SMART_SESSION_EMISSARY_ADDRESS = SMART_SESSION_EMISSARY_ADDRESS;
20
6
  const OWNABLE_VALIDATOR_ADDRESS = '0x000000000013fdb5234e4e3162a810f54d9f7e98';
21
- exports.OWNABLE_VALIDATOR_ADDRESS = OWNABLE_VALIDATOR_ADDRESS;
22
7
  const ENS_VALIDATOR_ADDRESS = '0xdc38f07b060374b6480c4bf06231e7d10955bca4';
23
- exports.ENS_VALIDATOR_ADDRESS = ENS_VALIDATOR_ADDRESS;
24
8
  const WEBAUTHN_VALIDATOR_ADDRESS = '0x0000000000578c4cb0e472a5462da43c495c3f33';
25
- exports.WEBAUTHN_VALIDATOR_ADDRESS = WEBAUTHN_VALIDATOR_ADDRESS;
26
9
  const SOCIAL_RECOVERY_VALIDATOR_ADDRESS = '0xa04d053b3c8021e8d5bf641816c42daa75d8b597';
27
10
  const MULTI_FACTOR_VALIDATOR_ADDRESS = '0xf6bdf42c9be18ceca5c06c42a43daf7fbbe7896b';
28
- exports.MULTI_FACTOR_VALIDATOR_ADDRESS = MULTI_FACTOR_VALIDATOR_ADDRESS;
29
11
  // Legacy
30
12
  const OWNABLE_V0_VALIDATOR_ADDRESS = '0x2483da3a338895199e5e538530213157e931bf06';
31
13
  const OWNABLE_BETA_VALIDATOR_ADDRESS = '0x0000000000e9e6e96bcaa3c113187cdb7e38aed9';
32
14
  const WEBAUTHN_V0_VALIDATOR_ADDRESS = '0x0000000000578c4cb0e472a5462da43c495c3f33';
33
- exports.WEBAUTHN_V0_VALIDATOR_ADDRESS = WEBAUTHN_V0_VALIDATOR_ADDRESS;
34
15
  const ECDSA_MOCK_SIGNATURE = '0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b';
35
16
  const WEBAUTHN_MOCK_SIGNATURE = '0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001b9b86eb98fda3ed4d797d9e690588dfadf17b329a76a47cec935bebf92d7ddc80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000019b2e9410bb6850f9f660a03d609d5a844fb96bcdc87a15139b03ee22c70f469100d2b865a215c3bf786387064effa8fcedcb1d625b5148f8a1236d5e3ff11acf000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d9763050000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22396a4546696a75684557724d34534f572d7443684a625545484550343456636a634a2d42716f3166544d38222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a38303830222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000';
36
17
  function getOwnerValidator(config) {
37
18
  if (!config.owners) {
38
- throw new error_1.OwnersFieldRequiredError();
19
+ throw new OwnersFieldRequiredError();
39
20
  }
40
21
  return getValidator(config.owners);
41
22
  }
@@ -46,7 +27,7 @@ function getMockSignature(ownerSet) {
46
27
  // ENS validator uses same mock signature format as ECDSA for UserOps
47
28
  const owners = ownerSet.accounts.map((account) => account.address);
48
29
  const signatures = owners.map(() => ECDSA_MOCK_SIGNATURE);
49
- return (0, viem_1.concat)(signatures);
30
+ return concat(signatures);
50
31
  }
51
32
  case 'passkey':
52
33
  return WEBAUTHN_MOCK_SIGNATURE;
@@ -55,8 +36,8 @@ function getMockSignature(ownerSet) {
55
36
  const validatorModule = getValidator(validator);
56
37
  const signature = getMockSignature(validator);
57
38
  return {
58
- packedValidatorAndId: (0, viem_1.encodePacked)(['bytes12', 'address'], [
59
- (0, viem_1.pad)((0, viem_1.toHex)(index), {
39
+ packedValidatorAndId: encodePacked(['bytes12', 'address'], [
40
+ pad(toHex(index), {
60
41
  size: 12,
61
42
  }),
62
43
  validatorModule.address,
@@ -64,7 +45,7 @@ function getMockSignature(ownerSet) {
64
45
  data: signature,
65
46
  };
66
47
  });
67
- return (0, viem_1.encodeAbiParameters)([
48
+ return encodeAbiParameters([
68
49
  {
69
50
  components: [
70
51
  {
@@ -100,7 +81,7 @@ function getValidator(owners) {
100
81
  function getOwnableValidator(threshold, owners, address) {
101
82
  return {
102
83
  address: address ?? OWNABLE_VALIDATOR_ADDRESS,
103
- initData: (0, viem_1.encodeAbiParameters)([
84
+ initData: encodeAbiParameters([
104
85
  { name: 'threshold', type: 'uint256' },
105
86
  { name: 'owners', type: 'address[]' },
106
87
  ], [
@@ -109,7 +90,7 @@ function getOwnableValidator(threshold, owners, address) {
109
90
  ]),
110
91
  deInitData: '0x',
111
92
  additionalContext: '0x',
112
- type: common_1.MODULE_TYPE_ID_VALIDATOR,
93
+ type: MODULE_TYPE_ID_VALIDATOR,
113
94
  };
114
95
  }
115
96
  function getENSValidator(threshold, owners, ownerExpirations, address) {
@@ -117,12 +98,12 @@ function getENSValidator(threshold, owners, ownerExpirations, address) {
117
98
  // where Owner is a tuple of (address addr, uint48 expiration)
118
99
  const ownerPairs = owners.map((owner, index) => ({
119
100
  addr: owner.toLowerCase(),
120
- expiration: ownerExpirations[index] ?? viem_1.maxUint48,
101
+ expiration: ownerExpirations[index] ?? maxUint48,
121
102
  }));
122
103
  // Sort by address to match ENS validator's expectations
123
104
  const sortedPairs = ownerPairs.sort((a, b) => a.addr.localeCompare(b.addr));
124
105
  const ownersWithExpiration = sortedPairs;
125
- const initData = (0, viem_1.encodeAbiParameters)([
106
+ const initData = encodeAbiParameters([
126
107
  { name: 'threshold', type: 'uint256' },
127
108
  {
128
109
  name: 'owners',
@@ -139,7 +120,7 @@ function getENSValidator(threshold, owners, ownerExpirations, address) {
139
120
  initData,
140
121
  deInitData: '0x',
141
122
  additionalContext: '0x',
142
- type: common_1.MODULE_TYPE_ID_VALIDATOR,
123
+ type: MODULE_TYPE_ID_VALIDATOR,
143
124
  };
144
125
  }
145
126
  function getWebAuthnValidator(threshold, webAuthnCredentials, address) {
@@ -164,7 +145,7 @@ function getWebAuthnValidator(threshold, webAuthnCredentials, address) {
164
145
  const publicKeys = webAuthnCredentials.map(getPublicKey);
165
146
  return {
166
147
  address: address ?? WEBAUTHN_VALIDATOR_ADDRESS,
167
- initData: (0, viem_1.encodeAbiParameters)([
148
+ initData: encodeAbiParameters([
168
149
  { name: 'threshold', type: 'uint256' },
169
150
  {
170
151
  name: 'credentials',
@@ -194,15 +175,15 @@ function getWebAuthnValidator(threshold, webAuthnCredentials, address) {
194
175
  ]),
195
176
  deInitData: '0x',
196
177
  additionalContext: '0x',
197
- type: common_1.MODULE_TYPE_ID_VALIDATOR,
178
+ type: MODULE_TYPE_ID_VALIDATOR,
198
179
  };
199
180
  }
200
181
  function getMultiFactorValidator(threshold, validators) {
201
182
  return {
202
183
  address: MULTI_FACTOR_VALIDATOR_ADDRESS,
203
- initData: (0, viem_1.encodePacked)(['uint8', 'bytes'], [
184
+ initData: encodePacked(['uint8', 'bytes'], [
204
185
  threshold,
205
- (0, viem_1.encodeAbiParameters)([
186
+ encodeAbiParameters([
206
187
  {
207
188
  components: [
208
189
  {
@@ -223,8 +204,8 @@ function getMultiFactorValidator(threshold, validators) {
223
204
  }
224
205
  const validatorModule = getValidator(validator);
225
206
  return {
226
- packedValidatorAndId: (0, viem_1.concat)([
227
- (0, viem_1.pad)((0, viem_1.toHex)(index), {
207
+ packedValidatorAndId: concat([
208
+ pad(toHex(index), {
228
209
  size: 12,
229
210
  }),
230
211
  validatorModule.address,
@@ -237,16 +218,16 @@ function getMultiFactorValidator(threshold, validators) {
237
218
  ]),
238
219
  deInitData: '0x',
239
220
  additionalContext: '0x',
240
- type: common_1.MODULE_TYPE_ID_VALIDATOR,
221
+ type: MODULE_TYPE_ID_VALIDATOR,
241
222
  };
242
223
  }
243
224
  function getSocialRecoveryValidator(guardians, threshold = 1) {
244
225
  const guardianAddresses = guardians.map((guardian) => guardian.address);
245
226
  guardianAddresses.sort();
246
227
  return {
247
- type: common_1.MODULE_TYPE_ID_VALIDATOR,
228
+ type: MODULE_TYPE_ID_VALIDATOR,
248
229
  address: SOCIAL_RECOVERY_VALIDATOR_ADDRESS,
249
- initData: (0, viem_1.encodeAbiParameters)([
230
+ initData: encodeAbiParameters([
250
231
  {
251
232
  type: 'uint256',
252
233
  name: 'threshold',
@@ -261,14 +242,14 @@ function getSocialRecoveryValidator(guardians, threshold = 1) {
261
242
  };
262
243
  }
263
244
  function parsePublicKey(publicKey) {
264
- const bytes = typeof publicKey === 'string' ? (0, viem_1.hexToBytes)(publicKey) : publicKey;
245
+ const bytes = typeof publicKey === 'string' ? hexToBytes(publicKey) : publicKey;
265
246
  const offset = bytes.length === 65 ? 1 : 0;
266
247
  const x = bytes.slice(offset, 32 + offset);
267
248
  const y = bytes.slice(32 + offset, 64 + offset);
268
249
  return {
269
250
  prefix: bytes.length === 65 ? bytes[0] : undefined,
270
- x: BigInt((0, viem_1.bytesToHex)(x)),
271
- y: BigInt((0, viem_1.bytesToHex)(y)),
251
+ x: BigInt(bytesToHex(x)),
252
+ y: BigInt(bytesToHex(y)),
272
253
  };
273
254
  }
274
255
  function supportsEip712(validator) {
@@ -282,3 +263,4 @@ function supportsEip712(validator) {
282
263
  return true;
283
264
  }
284
265
  }
266
+ export { OWNABLE_VALIDATOR_ADDRESS, ENS_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, WEBAUTHN_V0_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV, getOwnerValidator, getOwnableValidator, getENSValidator, getWebAuthnValidator, getMultiFactorValidator, getSocialRecoveryValidator, getValidator, getMockSignature, supportsEip712, };
@@ -1,4 +1,4 @@
1
- import { getMockSignature, getOwnerValidator, MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS } from './core';
2
- import { buildMockSignature, DUMMY_PRECLAIMOP_SELECTOR, DUMMY_PRECLAIMOP_TARGET, getEnableSessionCall, getPermissionId, getSmartSessionValidator, isSessionEnabled, packSignature } from './smart-sessions';
1
+ import { getMockSignature, getOwnerValidator, MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS } from './core.js';
2
+ import { buildMockSignature, DUMMY_PRECLAIMOP_SELECTOR, DUMMY_PRECLAIMOP_TARGET, getEnableSessionCall, getPermissionId, getSmartSessionValidator, isSessionEnabled, packSignature } from './smart-sessions.js';
3
3
  export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, DUMMY_PRECLAIMOP_TARGET, DUMMY_PRECLAIMOP_SELECTOR, getOwnerValidator, getSmartSessionValidator, getEnableSessionCall, getPermissionId, getMockSignature, buildMockSignature, isSessionEnabled, packSignature, };
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,19 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.packSignature = exports.isSessionEnabled = exports.buildMockSignature = exports.getMockSignature = exports.getPermissionId = exports.getEnableSessionCall = exports.getSmartSessionValidator = exports.getOwnerValidator = exports.DUMMY_PRECLAIMOP_SELECTOR = exports.DUMMY_PRECLAIMOP_TARGET = exports.SMART_SESSION_EMISSARY_ADDRESS = exports.MULTI_FACTOR_VALIDATOR_ADDRESS = exports.WEBAUTHN_VALIDATOR_ADDRESS = exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
4
- const core_1 = require("./core");
5
- Object.defineProperty(exports, "getMockSignature", { enumerable: true, get: function () { return core_1.getMockSignature; } });
6
- Object.defineProperty(exports, "getOwnerValidator", { enumerable: true, get: function () { return core_1.getOwnerValidator; } });
7
- Object.defineProperty(exports, "MULTI_FACTOR_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return core_1.MULTI_FACTOR_VALIDATOR_ADDRESS; } });
8
- Object.defineProperty(exports, "OWNABLE_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return core_1.OWNABLE_VALIDATOR_ADDRESS; } });
9
- Object.defineProperty(exports, "SMART_SESSION_EMISSARY_ADDRESS", { enumerable: true, get: function () { return core_1.SMART_SESSION_EMISSARY_ADDRESS; } });
10
- Object.defineProperty(exports, "WEBAUTHN_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return core_1.WEBAUTHN_VALIDATOR_ADDRESS; } });
11
- const smart_sessions_1 = require("./smart-sessions");
12
- Object.defineProperty(exports, "buildMockSignature", { enumerable: true, get: function () { return smart_sessions_1.buildMockSignature; } });
13
- Object.defineProperty(exports, "DUMMY_PRECLAIMOP_SELECTOR", { enumerable: true, get: function () { return smart_sessions_1.DUMMY_PRECLAIMOP_SELECTOR; } });
14
- Object.defineProperty(exports, "DUMMY_PRECLAIMOP_TARGET", { enumerable: true, get: function () { return smart_sessions_1.DUMMY_PRECLAIMOP_TARGET; } });
15
- Object.defineProperty(exports, "getEnableSessionCall", { enumerable: true, get: function () { return smart_sessions_1.getEnableSessionCall; } });
16
- Object.defineProperty(exports, "getPermissionId", { enumerable: true, get: function () { return smart_sessions_1.getPermissionId; } });
17
- Object.defineProperty(exports, "getSmartSessionValidator", { enumerable: true, get: function () { return smart_sessions_1.getSmartSessionValidator; } });
18
- Object.defineProperty(exports, "isSessionEnabled", { enumerable: true, get: function () { return smart_sessions_1.isSessionEnabled; } });
19
- Object.defineProperty(exports, "packSignature", { enumerable: true, get: function () { return smart_sessions_1.packSignature; } });
1
+ import { getMockSignature, getOwnerValidator, MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, } from './core.js';
2
+ import { buildMockSignature, DUMMY_PRECLAIMOP_SELECTOR, DUMMY_PRECLAIMOP_TARGET, getEnableSessionCall, getPermissionId, getSmartSessionValidator, isSessionEnabled, packSignature, } from './smart-sessions.js';
3
+ export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, DUMMY_PRECLAIMOP_TARGET, DUMMY_PRECLAIMOP_SELECTOR, getOwnerValidator, getSmartSessionValidator, getEnableSessionCall, getPermissionId, getMockSignature, buildMockSignature, isSessionEnabled, packSignature, };
@@ -1,5 +1,5 @@
1
1
  import { type Address, type Hex } from 'viem';
2
- import type { Permit2ClaimPolicy } from '../../../../types';
2
+ import type { Permit2ClaimPolicy } from '../../../../types.js';
3
3
  /** Typed representation of the Permit2 message fields used for calldata building */
4
4
  export interface Permit2ClaimMessage {
5
5
  permitted: readonly {
@@ -1,10 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PERMIT2_CLAIM_POLICY_ADDRESS = void 0;
4
- exports.buildPermit2ClaimPolicyCalldata = buildPermit2ClaimPolicyCalldata;
5
- exports.encodePermit2ClaimPolicyInitData = encodePermit2ClaimPolicyInitData;
6
- const viem_1 = require("viem");
7
- const types_1 = require("./types");
1
+ import { concat, encodeAbiParameters, encodePacked, hashStruct, keccak256, maxUint256, toHex, } from 'viem';
2
+ import { ANY_ADDRESS, FIELD_ARBITER, FIELD_EXPIRY, FIELD_FILL_EXPIRY, FIELD_RECIPIENT, FIELD_RECIPIENT_IS_SPONSOR, FIELD_TOKEN_IN, FIELD_TOKEN_OUT, MODE_CHECK_STORAGE, } from './types.js';
8
3
  // EIP-712 type definitions for Permit2/Mandate struct encoding.
9
4
  // Note: the token-out struct is named 'Token' in the Solidity contract (matching the
10
5
  // signed Permit2 message types in execution/permit2.ts).
@@ -42,31 +37,31 @@ const PERMIT2_TYPES = {
42
37
  };
43
38
  // --- EIP-712 hash helpers ---
44
39
  function hashArray(hashes) {
45
- return (0, viem_1.keccak256)(hashes.length > 0 ? (0, viem_1.concat)(hashes) : '0x');
40
+ return keccak256(hashes.length > 0 ? concat(hashes) : '0x');
46
41
  }
47
42
  function hashTokenPermissionsArray(permitted) {
48
- return hashArray(permitted.map(({ token, amount }) => (0, viem_1.hashStruct)({
43
+ return hashArray(permitted.map(({ token, amount }) => hashStruct({
49
44
  primaryType: 'TokenPermissions',
50
45
  types: PERMIT2_TYPES,
51
46
  data: { token, amount },
52
47
  })));
53
48
  }
54
49
  function hashTokenOutArray(tokenOut) {
55
- return hashArray(tokenOut.map(({ token, amount }) => (0, viem_1.hashStruct)({
50
+ return hashArray(tokenOut.map(({ token, amount }) => hashStruct({
56
51
  primaryType: 'Token',
57
52
  types: PERMIT2_TYPES,
58
53
  data: { token, amount },
59
54
  })));
60
55
  }
61
56
  function hashOpStruct(op) {
62
- return (0, viem_1.hashStruct)({
57
+ return hashStruct({
63
58
  primaryType: 'Op',
64
59
  types: PERMIT2_TYPES,
65
60
  data: { vt: op.vt, ops: Array.from(op.ops) },
66
61
  });
67
62
  }
68
63
  function hashMandateStruct(mandate) {
69
- return (0, viem_1.hashStruct)({
64
+ return hashStruct({
70
65
  primaryType: 'Mandate',
71
66
  types: PERMIT2_TYPES,
72
67
  data: {
@@ -89,7 +84,7 @@ function hashMandateStruct(mandate) {
89
84
  // --- Token array encoding helpers ---
90
85
  /** Encodes a token+amount pair as [token_as_uint256:32][amount:32] (64 bytes) */
91
86
  function encodeTokenEntry(token, amount) {
92
- return (0, viem_1.encodeAbiParameters)([{ type: 'address' }, { type: 'uint256' }], [token, amount]);
87
+ return encodeAbiParameters([{ type: 'address' }, { type: 'uint256' }], [token, amount]);
93
88
  }
94
89
  /**
95
90
  * Builds the policySpecificData calldata for a Permit2ClaimPolicy EIP-1271 check.
@@ -101,7 +96,7 @@ function encodeTokenEntry(token, amount) {
101
96
  * else — pre-computed mandateHash [32]
102
97
  *
103
98
  */
104
- function buildPermit2ClaimPolicyCalldata(policy, message) {
99
+ export function buildPermit2ClaimPolicyCalldata(policy, message) {
105
100
  const tokenInEnabled = !!policy.tokensIn?.length;
106
101
  const recipientEnabled = !!policy.recipients?.length;
107
102
  const fillExpiryEnabled = !!policy.fillExpiryBounds?.length;
@@ -114,13 +109,13 @@ function buildPermit2ClaimPolicyCalldata(policy, message) {
114
109
  recipientIsSponsorEnabled;
115
110
  const parts = [];
116
111
  // Header: [spender:20][nonce:32][deadline:32] (spender == arbiter in Permit2 context)
117
- parts.push((0, viem_1.encodePacked)(['address', 'uint256', 'uint256'], [message.spender, message.nonce, message.deadline]));
112
+ parts.push(encodePacked(['address', 'uint256', 'uint256'], [message.spender, message.nonce, message.deadline]));
118
113
  // TokenIn section
119
114
  if (tokenInEnabled) {
120
115
  // Expanded: [count:1][token_as_uint256:32][amount:32]...
121
116
  if (message.permitted.length > 255)
122
117
  throw new Error('permitted array exceeds max length of 255');
123
- parts.push((0, viem_1.toHex)(message.permitted.length, { size: 1 }));
118
+ parts.push(toHex(message.permitted.length, { size: 1 }));
124
119
  for (const { token, amount } of message.permitted) {
125
120
  parts.push(encodeTokenEntry(token, amount));
126
121
  }
@@ -137,12 +132,12 @@ function buildPermit2ClaimPolicyCalldata(policy, message) {
137
132
  // Expanded mandate: target fields + minGas + ops hashes + q
138
133
  const target = message.mandate.target;
139
134
  // Target: [recipient:20][targetChain:32][fillExpiry:32]
140
- parts.push((0, viem_1.encodePacked)(['address', 'uint256', 'uint256'], [target.recipient, target.targetChain, target.fillExpiry]));
135
+ parts.push(encodePacked(['address', 'uint256', 'uint256'], [target.recipient, target.targetChain, target.fillExpiry]));
141
136
  // TokenOut (inside target)
142
137
  if (tokenOutEnabled) {
143
138
  if (target.tokenOut.length > 255)
144
139
  throw new Error('tokenOut array exceeds max length of 255');
145
- parts.push((0, viem_1.toHex)(target.tokenOut.length, { size: 1 }));
140
+ parts.push(toHex(target.tokenOut.length, { size: 1 }));
146
141
  for (const { token, amount } of target.tokenOut) {
147
142
  parts.push(encodeTokenEntry(token, amount));
148
143
  }
@@ -151,65 +146,65 @@ function buildPermit2ClaimPolicyCalldata(policy, message) {
151
146
  parts.push(hashTokenOutArray(target.tokenOut));
152
147
  }
153
148
  // minGas: uint128 = 16 bytes
154
- parts.push((0, viem_1.toHex)(message.mandate.minGas, { size: 16 }));
149
+ parts.push(toHex(message.mandate.minGas, { size: 16 }));
155
150
  // originOpsHash and destOpsHash: always 32-byte hashes (we don't support ops checks)
156
151
  parts.push(hashOpStruct(message.mandate.originOps));
157
152
  parts.push(hashOpStruct(message.mandate.destOps));
158
153
  // qualificationHash: q is already keccak256(qualifier.encodedVal)
159
154
  parts.push(message.mandate.q);
160
155
  }
161
- return (0, viem_1.concat)(parts);
156
+ return concat(parts);
162
157
  }
163
- exports.PERMIT2_CLAIM_POLICY_ADDRESS = '0x62E3588C6d861C9f986E82EC3757434EDF16ce91';
164
- function encodePermit2ClaimPolicyInitData(policy) {
158
+ export const PERMIT2_CLAIM_POLICY_ADDRESS = '0x62E3588C6d861C9f986E82EC3757434EDF16ce91';
159
+ export function encodePermit2ClaimPolicyInitData(policy) {
165
160
  let modeConfig = 0;
166
161
  const setMode = (fieldId) => {
167
- modeConfig |= types_1.MODE_CHECK_STORAGE << (fieldId * 2);
162
+ modeConfig |= MODE_CHECK_STORAGE << (fieldId * 2);
168
163
  };
169
164
  if (policy.arbiters?.length)
170
- setMode(types_1.FIELD_ARBITER);
165
+ setMode(FIELD_ARBITER);
171
166
  if (policy.expiryBounds)
172
- setMode(types_1.FIELD_EXPIRY);
167
+ setMode(FIELD_EXPIRY);
173
168
  if (policy.tokensIn?.length)
174
- setMode(types_1.FIELD_TOKEN_IN);
169
+ setMode(FIELD_TOKEN_IN);
175
170
  if (policy.recipients?.length)
176
- setMode(types_1.FIELD_RECIPIENT);
171
+ setMode(FIELD_RECIPIENT);
177
172
  if (policy.fillExpiryBounds?.length)
178
- setMode(types_1.FIELD_FILL_EXPIRY);
173
+ setMode(FIELD_FILL_EXPIRY);
179
174
  if (policy.tokensOut?.length)
180
- setMode(types_1.FIELD_TOKEN_OUT);
175
+ setMode(FIELD_TOKEN_OUT);
181
176
  if (policy.recipientIsSponsor)
182
- setMode(types_1.FIELD_RECIPIENT_IS_SPONSOR);
183
- const parts = [(0, viem_1.toHex)(modeConfig, { size: 4 })];
177
+ setMode(FIELD_RECIPIENT_IS_SPONSOR);
178
+ const parts = [toHex(modeConfig, { size: 4 })];
184
179
  // Arbiter: [count: 1][address: 20] each
185
180
  if (policy.arbiters?.length) {
186
181
  if (policy.arbiters.length > 255)
187
182
  throw new Error('arbiters array exceeds max length of 255');
188
- parts.push((0, viem_1.encodePacked)(['uint8', ...policy.arbiters.map(() => 'address')], [policy.arbiters.length, ...policy.arbiters]));
183
+ parts.push(encodePacked(['uint8', ...policy.arbiters.map(() => 'address')], [policy.arbiters.length, ...policy.arbiters]));
189
184
  }
190
185
  // Expiry: [maxExpiry: 16][minExpiry: 16] packed into uint256
191
186
  if (policy.expiryBounds) {
192
187
  const mask128 = (1n << 128n) - 1n;
193
188
  const min = (policy.expiryBounds.min ?? 0n) & mask128;
194
- const max = (policy.expiryBounds.max ?? viem_1.maxUint256) & mask128;
195
- parts.push((0, viem_1.toHex)((min & mask128) | (max << 128n), { size: 32 }));
189
+ const max = (policy.expiryBounds.max ?? maxUint256) & mask128;
190
+ parts.push(toHex((min & mask128) | (max << 128n), { size: 32 }));
196
191
  }
197
192
  // TokenIn: [count: 1][chainId: 32][token: 20] each
198
193
  if (policy.tokensIn?.length) {
199
194
  if (policy.tokensIn.length > 255)
200
195
  throw new Error('tokensIn array exceeds max length of 255');
201
- parts.push((0, viem_1.toHex)(policy.tokensIn.length, { size: 1 }));
196
+ parts.push(toHex(policy.tokensIn.length, { size: 1 }));
202
197
  for (const { chainId, token } of policy.tokensIn) {
203
- parts.push((0, viem_1.encodePacked)(['uint256', 'address'], [BigInt(chainId), token]));
198
+ parts.push(encodePacked(['uint256', 'address'], [BigInt(chainId), token]));
204
199
  }
205
200
  }
206
201
  // Recipient: [count: 1][chainId: 32][recipient: 20] each
207
202
  if (policy.recipients?.length) {
208
203
  if (policy.recipients.length > 255)
209
204
  throw new Error('recipients array exceeds max length of 255');
210
- parts.push((0, viem_1.toHex)(policy.recipients.length, { size: 1 }));
205
+ parts.push(toHex(policy.recipients.length, { size: 1 }));
211
206
  for (const { chainId, recipient } of policy.recipients) {
212
- parts.push((0, viem_1.encodePacked)(['uint256', 'address'], [BigInt(chainId), recipient === 'any' ? types_1.ANY_ADDRESS : recipient]));
207
+ parts.push(encodePacked(['uint256', 'address'], [BigInt(chainId), recipient === 'any' ? ANY_ADDRESS : recipient]));
213
208
  }
214
209
  }
215
210
  // FillExpiry: [count: 1][chainId: 32][max<<128|min packed into uint256] each
@@ -217,23 +212,23 @@ function encodePermit2ClaimPolicyInitData(policy) {
217
212
  if (policy.fillExpiryBounds.length > 255)
218
213
  throw new Error('fillExpiryBounds array exceeds max length of 255');
219
214
  const mask128 = (1n << 128n) - 1n;
220
- parts.push((0, viem_1.toHex)(policy.fillExpiryBounds.length, { size: 1 }));
215
+ parts.push(toHex(policy.fillExpiryBounds.length, { size: 1 }));
221
216
  for (const { chainId, min: fMin, max: fMax } of policy.fillExpiryBounds) {
222
217
  const minVal = (fMin ?? 0n) & mask128;
223
- const maxVal = (fMax ?? viem_1.maxUint256) & mask128;
218
+ const maxVal = (fMax ?? maxUint256) & mask128;
224
219
  const packed = minVal | (maxVal << 128n);
225
- parts.push((0, viem_1.encodePacked)(['uint256', 'uint256'], [BigInt(chainId), packed]));
220
+ parts.push(encodePacked(['uint256', 'uint256'], [BigInt(chainId), packed]));
226
221
  }
227
222
  }
228
223
  // TokenOut: [count: 1][chainId: 32][token: 20] each
229
224
  if (policy.tokensOut?.length) {
230
225
  if (policy.tokensOut.length > 255)
231
226
  throw new Error('tokensOut array exceeds max length of 255');
232
- parts.push((0, viem_1.toHex)(policy.tokensOut.length, { size: 1 }));
227
+ parts.push(toHex(policy.tokensOut.length, { size: 1 }));
233
228
  for (const { chainId, token } of policy.tokensOut) {
234
- parts.push((0, viem_1.encodePacked)(['uint256', 'address'], [BigInt(chainId), token]));
229
+ parts.push(encodePacked(['uint256', 'address'], [BigInt(chainId), token]));
235
230
  }
236
231
  }
237
232
  // RecipientIsSponsor has no data payload — mode bit alone enables it
238
- return (0, viem_1.concat)(parts);
233
+ return concat(parts);
239
234
  }
@@ -1,18 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ANY_ADDRESS = exports.MODE_CHECK_STORAGE = exports.FIELD_RECIPIENT_IS_SPONSOR = exports.FIELD_DEST_OPS = exports.FIELD_ORIGIN_OPS = exports.FIELD_TOKEN_OUT = exports.FIELD_FILL_EXPIRY = exports.FIELD_RECIPIENT = exports.FIELD_TOKEN_IN = exports.FIELD_EXPIRY = exports.FIELD_ARBITER = void 0;
4
1
  // Field IDs matching BaseDataTypes.sol
5
- exports.FIELD_ARBITER = 0;
6
- exports.FIELD_EXPIRY = 1;
7
- exports.FIELD_TOKEN_IN = 2;
8
- exports.FIELD_RECIPIENT = 3;
9
- exports.FIELD_FILL_EXPIRY = 4;
10
- exports.FIELD_TOKEN_OUT = 5;
11
- exports.FIELD_ORIGIN_OPS = 6;
12
- exports.FIELD_DEST_OPS = 7;
2
+ export const FIELD_ARBITER = 0;
3
+ export const FIELD_EXPIRY = 1;
4
+ export const FIELD_TOKEN_IN = 2;
5
+ export const FIELD_RECIPIENT = 3;
6
+ export const FIELD_FILL_EXPIRY = 4;
7
+ export const FIELD_TOKEN_OUT = 5;
8
+ export const FIELD_ORIGIN_OPS = 6;
9
+ export const FIELD_DEST_OPS = 7;
13
10
  // Field 8 is reserved in BaseDataTypes.sol
14
- exports.FIELD_RECIPIENT_IS_SPONSOR = 9;
11
+ export const FIELD_RECIPIENT_IS_SPONSOR = 9;
15
12
  // Mode values
16
- exports.MODE_CHECK_STORAGE = 1;
13
+ export const MODE_CHECK_STORAGE = 1;
17
14
  // Sentinel: allows any recipient address
18
- exports.ANY_ADDRESS = '0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF';
15
+ export const ANY_ADDRESS = '0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF';
@@ -1,7 +1,7 @@
1
1
  import { type Address, type Hex, type TypedDataDefinition } from 'viem';
2
- import type { Policy, ProviderConfig, RhinestoneAccountConfig, RhinestoneConfig, Session, SessionEnableData } from '../../types';
3
- import { type Module } from '../common';
4
- import { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV } from './core';
2
+ import type { Policy, ProviderConfig, RhinestoneAccountConfig, RhinestoneConfig, Session, SessionEnableData } from '../../types.js';
3
+ import { type Module } from '../common.js';
4
+ import { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV } from './core.js';
5
5
  interface SessionData {
6
6
  sessionValidator: Address;
7
7
  sessionValidatorInitData: Hex;
@@ -203,7 +203,7 @@ declare function getSmartSessionValidator(config: RhinestoneConfig): Module | nu
203
203
  * The orchestrator slices off the first 20 bytes to identify the validator, then
204
204
  * simulates verifyExecution with the mock emissary to estimate gas before the user signs.
205
205
  */
206
- declare function buildMockSignature(session: Session, useDevContracts?: boolean, chainCount?: number): Hex;
206
+ declare function buildMockSignature(session: Session, useDevContracts?: boolean, chainCount?: number, targetChainId?: number): Hex;
207
207
  export { SMART_SESSION_EMISSARY_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS_DEV, SMART_SESSIONS_FALLBACK_TARGET_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG, SMART_SESSIONS_FALLBACK_TARGET_SELECTOR_FLAG_PERMITTED_TO_CALL_SMARTSESSION, DUMMY_PRECLAIMOP_TARGET, DUMMY_PRECLAIMOP_SELECTOR, SPENDING_LIMITS_POLICY_ADDRESS, TIME_FRAME_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, UNIVERSAL_ACTION_POLICY_ADDRESS, USAGE_LIMIT_POLICY_ADDRESS, VALUE_LIMIT_POLICY_ADDRESS, INTENT_EXECUTION_POLICY_ADDRESS, packSignature, getSessionData, getPolicyData, getEnableSessionCall, getPermissionId, getSmartSessionValidator, getSessionDetails, isSessionEnabled, signEnableSession, buildMockSignature, };
208
208
  export type { ChainSession, ChainDigest, ResolvedSessionSignerSet, SessionData, SmartSessionModeType, SessionDetails, };
209
209
  //# sourceMappingURL=smart-sessions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EAMZ,KAAK,GAAG,EAOR,KAAK,mBAAmB,EAKzB,MAAM,MAAM,CAAA;AAcb,OAAO,KAAK,EAEV,MAAM,EACN,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,OAAO,EACP,iBAAiB,EAElB,MAAM,aAAa,CAAA;AAEpB,OAAO,E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AAC,EAAE,OAAO;;;GA8B1B;AAED,iBAAS,cAAc,CACrB,OAAO,EAAE,OAAO,EAChB,eAAe,CAAC,EAAE,OAAO,GACxB,WAAW,CA6Fb;AAED,iBAAS,eAAe,CAAC,OAAO,EAAE,OAAO,iBAyBxC;AAED,iBAAS,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,UAAU,CA0K5E;AAED,iBAAS,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAezE;AAQD;;;;;;;GAOG;AACH,iBAAS,kBAAkB,CACzB,OAAO,EAAE,OAAO,EAChB,eAAe,CAAC,EAAE,OAAO,EACzB,UAAU,GAAE,MAAU,GACrB,GAAG,CAyBL;AASD,OAAO,EACL,8BAA8B,EAC9B,kCAAkC,EAClC,mCAAmC,EACnC,4CAA4C,EAC5C,2EAA2E,EAC3E,uBAAuB,EACvB,yBAAyB,EACzB,8BAA8B,EAC9B,yBAAyB,EACzB,mBAAmB,EACnB,+BAA+B,EAC/B,0BAA0B,EAC1B,0BAA0B,EAC1B,+BAA+B,EAC/B,aAAa,EACb,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,CAAA;AACD,YAAY,EACV,YAAY,EACZ,WAAW,EACX,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,cAAc,GACf,CAAA"}
1
+ {"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EAMZ,KAAK,GAAG,EAOR,KAAK,mBAAmB,EAKzB,MAAM,MAAM,CAAA;AAcb,OAAO,KAAK,EAEV,MAAM,EACN,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,OAAO,EACP,iBAAiB,EAElB,MAAM,aAAa,CA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