@0xkey-io/gas-station 0.1.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 (51) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +655 -0
  3. package/dist/abi/gas-station.d.ts +500 -0
  4. package/dist/abi/gas-station.d.ts.map +1 -0
  5. package/dist/abi/gas-station.js +252 -0
  6. package/dist/abi/gas-station.js.map +1 -0
  7. package/dist/abi/gas-station.mjs +250 -0
  8. package/dist/abi/gas-station.mjs.map +1 -0
  9. package/dist/abi/reimbursable-gas-station.d.ts +756 -0
  10. package/dist/abi/reimbursable-gas-station.d.ts.map +1 -0
  11. package/dist/abi/reimbursable-gas-station.js +625 -0
  12. package/dist/abi/reimbursable-gas-station.js.map +1 -0
  13. package/dist/abi/reimbursable-gas-station.mjs +623 -0
  14. package/dist/abi/reimbursable-gas-station.mjs.map +1 -0
  15. package/dist/config.d.ts +57 -0
  16. package/dist/config.d.ts.map +1 -0
  17. package/dist/config.js +59 -0
  18. package/dist/config.js.map +1 -0
  19. package/dist/config.mjs +52 -0
  20. package/dist/config.mjs.map +1 -0
  21. package/dist/gasStationClient.d.ts +110 -0
  22. package/dist/gasStationClient.d.ts.map +1 -0
  23. package/dist/gasStationClient.js +415 -0
  24. package/dist/gasStationClient.js.map +1 -0
  25. package/dist/gasStationClient.mjs +413 -0
  26. package/dist/gasStationClient.mjs.map +1 -0
  27. package/dist/gasStationUtils.d.ts +7250 -0
  28. package/dist/gasStationUtils.d.ts.map +1 -0
  29. package/dist/gasStationUtils.js +147 -0
  30. package/dist/gasStationUtils.js.map +1 -0
  31. package/dist/gasStationUtils.mjs +137 -0
  32. package/dist/gasStationUtils.mjs.map +1 -0
  33. package/dist/index.d.ts +10 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +36 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/index.mjs +8 -0
  38. package/dist/index.mjs.map +1 -0
  39. package/dist/intentBuilder.d.ts +75 -0
  40. package/dist/intentBuilder.d.ts.map +1 -0
  41. package/dist/intentBuilder.js +259 -0
  42. package/dist/intentBuilder.js.map +1 -0
  43. package/dist/intentBuilder.mjs +257 -0
  44. package/dist/intentBuilder.mjs.map +1 -0
  45. package/dist/policyUtils.d.ts +271 -0
  46. package/dist/policyUtils.d.ts.map +1 -0
  47. package/dist/policyUtils.js +386 -0
  48. package/dist/policyUtils.js.map +1 -0
  49. package/dist/policyUtils.mjs +380 -0
  50. package/dist/policyUtils.mjs.map +1 -0
  51. package/package.json +61 -0
@@ -0,0 +1,259 @@
1
+ 'use strict';
2
+
3
+ var viem = require('viem');
4
+ var gasStationUtils = require('./gasStationUtils.js');
5
+
6
+ class IntentBuilder {
7
+ constructor(config) {
8
+ this.callData = "0x";
9
+ this.ethAmount = 0n;
10
+ this.config = config;
11
+ }
12
+ /**
13
+ * Set the target contract for this intent execution
14
+ */
15
+ setTarget(contract) {
16
+ this.outputContract = contract;
17
+ return this;
18
+ }
19
+ /**
20
+ * Set the ETH value to send with this intent
21
+ */
22
+ withValue(value) {
23
+ this.ethAmount = value;
24
+ return this;
25
+ }
26
+ /**
27
+ * Set a specific nonce (otherwise will be auto-fetched)
28
+ */
29
+ withNonce(nonce) {
30
+ this.nonce = nonce;
31
+ return this;
32
+ }
33
+ /**
34
+ * Set an expiration deadline (unix timestamp in seconds)
35
+ * If not set, defaults to 1 hour from now
36
+ */
37
+ withDeadline(deadline) {
38
+ this.deadline = deadline;
39
+ return this;
40
+ }
41
+ /**
42
+ * Set the call data directly (for pre-encoded function calls)
43
+ */
44
+ withCallData(callData) {
45
+ this.callData = callData;
46
+ return this;
47
+ }
48
+ /**
49
+ * Add a contract call to this intent
50
+ */
51
+ callContract(params) {
52
+ this.outputContract = params.contract;
53
+ this.callData = viem.encodeFunctionData({
54
+ abi: params.abi,
55
+ functionName: params.functionName,
56
+ args: params.args,
57
+ });
58
+ if (params.value) {
59
+ this.ethAmount = params.value;
60
+ }
61
+ return this;
62
+ }
63
+ /**
64
+ * Convenience method for ERC20 transfers
65
+ */
66
+ transferToken(token, to, amount) {
67
+ return this.callContract({
68
+ contract: token,
69
+ abi: gasStationUtils.ERC20_ABI,
70
+ functionName: "transfer",
71
+ args: [to, amount],
72
+ });
73
+ }
74
+ /**
75
+ * Convenience method for ERC20 approvals
76
+ */
77
+ approveToken(token, spender, amount) {
78
+ return this.callContract({
79
+ contract: token,
80
+ abi: gasStationUtils.ERC20_ABI,
81
+ functionName: "approve",
82
+ args: [spender, amount],
83
+ });
84
+ }
85
+ /**
86
+ * Convenience method for native ETH transfers
87
+ */
88
+ transferETH(to, amount) {
89
+ this.outputContract = to;
90
+ this.callData = "0x";
91
+ this.ethAmount = amount;
92
+ return this;
93
+ }
94
+ /**
95
+ * Signs the execution intent using EIP-712
96
+ * Returns a complete ExecutionIntent ready for execution
97
+ */
98
+ async sign(currentNonce) {
99
+ if (!this.outputContract) {
100
+ throw new Error("No target contract set. Use setTarget() or callContract()");
101
+ }
102
+ const nonce = this.nonce ?? currentNonce;
103
+ // Default deadline: 1 hour from now
104
+ const deadline = this.deadline ?? Math.floor(Date.now() / 1000) + 60 * 60;
105
+ // EIP-712 domain and types for gas station execution
106
+ const domain = {
107
+ name: "TKGasDelegate",
108
+ version: "1",
109
+ chainId: this.config.chainId,
110
+ verifyingContract: this.config.eoaAddress,
111
+ };
112
+ // keccak256("Execution(uint128 nonce,uint32 deadline,address to,uint256 value,bytes data)")
113
+ const types = {
114
+ Execution: [
115
+ { name: "nonce", type: "uint128" },
116
+ { name: "deadline", type: "uint32" },
117
+ { name: "to", type: "address" },
118
+ { name: "value", type: "uint256" },
119
+ { name: "data", type: "bytes" },
120
+ ],
121
+ };
122
+ const message = {
123
+ nonce,
124
+ deadline,
125
+ to: this.outputContract,
126
+ value: this.ethAmount,
127
+ data: this.callData,
128
+ };
129
+ const signature = await this.config.eoaWalletClient.signTypedData({
130
+ account: this.config.eoaWalletClient.account,
131
+ domain,
132
+ types,
133
+ primaryType: "Execution",
134
+ message,
135
+ });
136
+ return {
137
+ nonce,
138
+ deadline,
139
+ outputContract: this.outputContract,
140
+ ethAmount: this.ethAmount,
141
+ callData: this.callData,
142
+ signature,
143
+ eoaAddress: this.config.eoaAddress,
144
+ };
145
+ }
146
+ /**
147
+ * Signs an approval then execution intent using EIP-712
148
+ * This allows atomic approval of an ERC20 token followed by execution
149
+ * Returns a complete ApprovalExecutionIntent ready for execution
150
+ */
151
+ async signApprovalExecution(currentNonce, erc20Address, spender, approveAmount) {
152
+ if (!this.outputContract) {
153
+ throw new Error("No target contract set. Use setTarget() or callContract()");
154
+ }
155
+ const nonce = this.nonce ?? currentNonce;
156
+ // Default deadline: 1 hour from now
157
+ const deadline = this.deadline ?? Math.floor(Date.now() / 1000) + 60 * 60;
158
+ // EIP-712 domain and types for approve then execute
159
+ const domain = {
160
+ name: "TKGasDelegate",
161
+ version: "1",
162
+ chainId: this.config.chainId,
163
+ verifyingContract: this.config.eoaAddress,
164
+ };
165
+ // Based on hashApproveThenExecute from the contract
166
+ // keccak256("ApproveThenExecute(uint128 nonce,uint32 deadline,address erc20Contract,address spender,uint256 approveAmount,address to,uint256 value,bytes data)")
167
+ const types = {
168
+ ApproveThenExecute: [
169
+ { name: "nonce", type: "uint128" },
170
+ { name: "deadline", type: "uint32" },
171
+ { name: "erc20Contract", type: "address" },
172
+ { name: "spender", type: "address" },
173
+ { name: "approveAmount", type: "uint256" },
174
+ { name: "to", type: "address" },
175
+ { name: "value", type: "uint256" },
176
+ { name: "data", type: "bytes" },
177
+ ],
178
+ };
179
+ const message = {
180
+ nonce,
181
+ deadline,
182
+ erc20Contract: erc20Address,
183
+ spender,
184
+ approveAmount,
185
+ to: this.outputContract,
186
+ value: this.ethAmount,
187
+ data: this.callData,
188
+ };
189
+ const signature = await this.config.eoaWalletClient.signTypedData({
190
+ account: this.config.eoaWalletClient.account,
191
+ domain,
192
+ types,
193
+ primaryType: "ApproveThenExecute",
194
+ message,
195
+ });
196
+ return {
197
+ nonce,
198
+ deadline,
199
+ outputContract: this.outputContract,
200
+ ethAmount: this.ethAmount,
201
+ callData: this.callData,
202
+ signature,
203
+ eoaAddress: this.config.eoaAddress,
204
+ erc20Address,
205
+ spender,
206
+ approveAmount,
207
+ };
208
+ }
209
+ /**
210
+ * Signs a session signature for USDC transfer authorization in the reimbursable gas station.
211
+ * This authorizes the reimbursable contract to interact with the USDC contract on behalf of the EOA.
212
+ * The session signature does NOT commit to a specific amount - amounts are specified at execution time.
213
+ * This allows the same session signature to be cached and reused for multiple transactions.
214
+ * Returns an 85-byte packed signature that can be passed to executeWithReimbursement().
215
+ */
216
+ async signSessionForUSDCTransfer(currentNonce, usdcAddress, reimbursableContract, sessionDeadline) {
217
+ const nonce = this.nonce ?? currentNonce;
218
+ // Default deadline: 1 hour from now
219
+ const deadline = sessionDeadline ?? Math.floor(Date.now() / 1000) + 60 * 60;
220
+ // EIP-712 domain and types for session execution
221
+ const domain = {
222
+ name: "TKGasDelegate",
223
+ version: "1",
224
+ chainId: this.config.chainId,
225
+ verifyingContract: this.config.eoaAddress,
226
+ };
227
+ // Based on hashSessionExecution from the delegate contract
228
+ // keccak256("SessionExecution(uint128 counter,uint32 deadline,address sender,address to)")
229
+ const types = {
230
+ SessionExecution: [
231
+ { name: "counter", type: "uint128" },
232
+ { name: "deadline", type: "uint32" },
233
+ { name: "sender", type: "address" },
234
+ { name: "to", type: "address" },
235
+ ],
236
+ };
237
+ const message = {
238
+ counter: nonce,
239
+ deadline,
240
+ sender: reimbursableContract,
241
+ to: usdcAddress,
242
+ };
243
+ const signature = await this.config.eoaWalletClient.signTypedData({
244
+ account: this.config.eoaWalletClient.account,
245
+ domain,
246
+ types,
247
+ primaryType: "SessionExecution",
248
+ message,
249
+ });
250
+ return gasStationUtils.packSessionSignature({ signature, nonce, deadline });
251
+ }
252
+ // Static factory method for quick intent creation
253
+ static create(config) {
254
+ return new IntentBuilder(config);
255
+ }
256
+ }
257
+
258
+ exports.IntentBuilder = IntentBuilder;
259
+ //# sourceMappingURL=intentBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intentBuilder.js","sources":["../src/intentBuilder.ts"],"sourcesContent":[null],"names":["encodeFunctionData","ERC20_ABI","packSessionSignature"],"mappings":";;;;;MAqBa,aAAa,CAAA;AAQxB,IAAA,WAAA,CAAY,MAA2B,EAAA;QAL/B,IAAA,CAAA,QAAQ,GAAQ,IAAI;QACpB,IAAA,CAAA,SAAS,GAAW,EAAE;AAK5B,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;IACtB;AAEA;;AAEG;AACH,IAAA,SAAS,CAAC,QAAa,EAAA;AACrB,QAAA,IAAI,CAAC,cAAc,GAAG,QAAQ;AAC9B,QAAA,OAAO,IAAI;IACb;AAEA;;AAEG;AACH,IAAA,SAAS,CAAC,KAAa,EAAA;AACrB,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK;AACtB,QAAA,OAAO,IAAI;IACb;AAEA;;AAEG;AACH,IAAA,SAAS,CAAC,KAAa,EAAA;AACrB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,QAAA,OAAO,IAAI;IACb;AAEA;;;AAGG;AACH,IAAA,YAAY,CAAC,QAAgB,EAAA;AAC3B,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;AACxB,QAAA,OAAO,IAAI;IACb;AAEA;;AAEG;AACH,IAAA,YAAY,CAAC,QAAa,EAAA;AACxB,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;AACxB,QAAA,OAAO,IAAI;IACb;AAEA;;AAEG;AACH,IAAA,YAAY,CAAC,MAA0B,EAAA;AACrC,QAAA,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,QAAQ;AACrC,QAAA,IAAI,CAAC,QAAQ,GAAGA,uBAAkB,CAAC;YACjC,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,IAAI,EAAE,MAAM,CAAC,IAAI;AAClB,SAA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;AAID,QAAA,MAAM,KAAK,GAAG;AACZ,YAAA,gBAAgB,EAAE;AAChB,gBAAA,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;AACpC,gBAAA,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;AACpC,gBAAA,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;AACnC,gBAAA,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;AAChC,aAAA;SACF;AAED,QAAA,MAAM,OAAO,GAAG;AACd,YAAA,OAAO,EAAE,KAAK;YACd,QAAQ;AACR,YAAA,MAAM,EAAE,oBAAoB;AAC5B,YAAA,EAAE,EAAE,WAAW;SAChB;QAED,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,aAAa,CAAC;AAChE,YAAA,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO;YAC5C,MAAM;YACN,KAAK;AACL,YAAA,WAAW,EAAE,kBAAkB;YAC/B,OAAO;AACR,SAAA,CAAC;QAEF,OAAOC,oCAAoB,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAC7D;;IAGA,OAAO,MAAM,CAAC,MAA2B,EAAA;AACvC,QAAA,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC;IAClC;AACD;;;;"}
@@ -0,0 +1,257 @@
1
+ import { encodeFunctionData } from 'viem';
2
+ import { ERC20_ABI, packSessionSignature } from './gasStationUtils.mjs';
3
+
4
+ class IntentBuilder {
5
+ constructor(config) {
6
+ this.callData = "0x";
7
+ this.ethAmount = 0n;
8
+ this.config = config;
9
+ }
10
+ /**
11
+ * Set the target contract for this intent execution
12
+ */
13
+ setTarget(contract) {
14
+ this.outputContract = contract;
15
+ return this;
16
+ }
17
+ /**
18
+ * Set the ETH value to send with this intent
19
+ */
20
+ withValue(value) {
21
+ this.ethAmount = value;
22
+ return this;
23
+ }
24
+ /**
25
+ * Set a specific nonce (otherwise will be auto-fetched)
26
+ */
27
+ withNonce(nonce) {
28
+ this.nonce = nonce;
29
+ return this;
30
+ }
31
+ /**
32
+ * Set an expiration deadline (unix timestamp in seconds)
33
+ * If not set, defaults to 1 hour from now
34
+ */
35
+ withDeadline(deadline) {
36
+ this.deadline = deadline;
37
+ return this;
38
+ }
39
+ /**
40
+ * Set the call data directly (for pre-encoded function calls)
41
+ */
42
+ withCallData(callData) {
43
+ this.callData = callData;
44
+ return this;
45
+ }
46
+ /**
47
+ * Add a contract call to this intent
48
+ */
49
+ callContract(params) {
50
+ this.outputContract = params.contract;
51
+ this.callData = encodeFunctionData({
52
+ abi: params.abi,
53
+ functionName: params.functionName,
54
+ args: params.args,
55
+ });
56
+ if (params.value) {
57
+ this.ethAmount = params.value;
58
+ }
59
+ return this;
60
+ }
61
+ /**
62
+ * Convenience method for ERC20 transfers
63
+ */
64
+ transferToken(token, to, amount) {
65
+ return this.callContract({
66
+ contract: token,
67
+ abi: ERC20_ABI,
68
+ functionName: "transfer",
69
+ args: [to, amount],
70
+ });
71
+ }
72
+ /**
73
+ * Convenience method for ERC20 approvals
74
+ */
75
+ approveToken(token, spender, amount) {
76
+ return this.callContract({
77
+ contract: token,
78
+ abi: ERC20_ABI,
79
+ functionName: "approve",
80
+ args: [spender, amount],
81
+ });
82
+ }
83
+ /**
84
+ * Convenience method for native ETH transfers
85
+ */
86
+ transferETH(to, amount) {
87
+ this.outputContract = to;
88
+ this.callData = "0x";
89
+ this.ethAmount = amount;
90
+ return this;
91
+ }
92
+ /**
93
+ * Signs the execution intent using EIP-712
94
+ * Returns a complete ExecutionIntent ready for execution
95
+ */
96
+ async sign(currentNonce) {
97
+ if (!this.outputContract) {
98
+ throw new Error("No target contract set. Use setTarget() or callContract()");
99
+ }
100
+ const nonce = this.nonce ?? currentNonce;
101
+ // Default deadline: 1 hour from now
102
+ const deadline = this.deadline ?? Math.floor(Date.now() / 1000) + 60 * 60;
103
+ // EIP-712 domain and types for gas station execution
104
+ const domain = {
105
+ name: "TKGasDelegate",
106
+ version: "1",
107
+ chainId: this.config.chainId,
108
+ verifyingContract: this.config.eoaAddress,
109
+ };
110
+ // keccak256("Execution(uint128 nonce,uint32 deadline,address to,uint256 value,bytes data)")
111
+ const types = {
112
+ Execution: [
113
+ { name: "nonce", type: "uint128" },
114
+ { name: "deadline", type: "uint32" },
115
+ { name: "to", type: "address" },
116
+ { name: "value", type: "uint256" },
117
+ { name: "data", type: "bytes" },
118
+ ],
119
+ };
120
+ const message = {
121
+ nonce,
122
+ deadline,
123
+ to: this.outputContract,
124
+ value: this.ethAmount,
125
+ data: this.callData,
126
+ };
127
+ const signature = await this.config.eoaWalletClient.signTypedData({
128
+ account: this.config.eoaWalletClient.account,
129
+ domain,
130
+ types,
131
+ primaryType: "Execution",
132
+ message,
133
+ });
134
+ return {
135
+ nonce,
136
+ deadline,
137
+ outputContract: this.outputContract,
138
+ ethAmount: this.ethAmount,
139
+ callData: this.callData,
140
+ signature,
141
+ eoaAddress: this.config.eoaAddress,
142
+ };
143
+ }
144
+ /**
145
+ * Signs an approval then execution intent using EIP-712
146
+ * This allows atomic approval of an ERC20 token followed by execution
147
+ * Returns a complete ApprovalExecutionIntent ready for execution
148
+ */
149
+ async signApprovalExecution(currentNonce, erc20Address, spender, approveAmount) {
150
+ if (!this.outputContract) {
151
+ throw new Error("No target contract set. Use setTarget() or callContract()");
152
+ }
153
+ const nonce = this.nonce ?? currentNonce;
154
+ // Default deadline: 1 hour from now
155
+ const deadline = this.deadline ?? Math.floor(Date.now() / 1000) + 60 * 60;
156
+ // EIP-712 domain and types for approve then execute
157
+ const domain = {
158
+ name: "TKGasDelegate",
159
+ version: "1",
160
+ chainId: this.config.chainId,
161
+ verifyingContract: this.config.eoaAddress,
162
+ };
163
+ // Based on hashApproveThenExecute from the contract
164
+ // keccak256("ApproveThenExecute(uint128 nonce,uint32 deadline,address erc20Contract,address spender,uint256 approveAmount,address to,uint256 value,bytes data)")
165
+ const types = {
166
+ ApproveThenExecute: [
167
+ { name: "nonce", type: "uint128" },
168
+ { name: "deadline", type: "uint32" },
169
+ { name: "erc20Contract", type: "address" },
170
+ { name: "spender", type: "address" },
171
+ { name: "approveAmount", type: "uint256" },
172
+ { name: "to", type: "address" },
173
+ { name: "value", type: "uint256" },
174
+ { name: "data", type: "bytes" },
175
+ ],
176
+ };
177
+ const message = {
178
+ nonce,
179
+ deadline,
180
+ erc20Contract: erc20Address,
181
+ spender,
182
+ approveAmount,
183
+ to: this.outputContract,
184
+ value: this.ethAmount,
185
+ data: this.callData,
186
+ };
187
+ const signature = await this.config.eoaWalletClient.signTypedData({
188
+ account: this.config.eoaWalletClient.account,
189
+ domain,
190
+ types,
191
+ primaryType: "ApproveThenExecute",
192
+ message,
193
+ });
194
+ return {
195
+ nonce,
196
+ deadline,
197
+ outputContract: this.outputContract,
198
+ ethAmount: this.ethAmount,
199
+ callData: this.callData,
200
+ signature,
201
+ eoaAddress: this.config.eoaAddress,
202
+ erc20Address,
203
+ spender,
204
+ approveAmount,
205
+ };
206
+ }
207
+ /**
208
+ * Signs a session signature for USDC transfer authorization in the reimbursable gas station.
209
+ * This authorizes the reimbursable contract to interact with the USDC contract on behalf of the EOA.
210
+ * The session signature does NOT commit to a specific amount - amounts are specified at execution time.
211
+ * This allows the same session signature to be cached and reused for multiple transactions.
212
+ * Returns an 85-byte packed signature that can be passed to executeWithReimbursement().
213
+ */
214
+ async signSessionForUSDCTransfer(currentNonce, usdcAddress, reimbursableContract, sessionDeadline) {
215
+ const nonce = this.nonce ?? currentNonce;
216
+ // Default deadline: 1 hour from now
217
+ const deadline = sessionDeadline ?? Math.floor(Date.now() / 1000) + 60 * 60;
218
+ // EIP-712 domain and types for session execution
219
+ const domain = {
220
+ name: "TKGasDelegate",
221
+ version: "1",
222
+ chainId: this.config.chainId,
223
+ verifyingContract: this.config.eoaAddress,
224
+ };
225
+ // Based on hashSessionExecution from the delegate contract
226
+ // keccak256("SessionExecution(uint128 counter,uint32 deadline,address sender,address to)")
227
+ const types = {
228
+ SessionExecution: [
229
+ { name: "counter", type: "uint128" },
230
+ { name: "deadline", type: "uint32" },
231
+ { name: "sender", type: "address" },
232
+ { name: "to", type: "address" },
233
+ ],
234
+ };
235
+ const message = {
236
+ counter: nonce,
237
+ deadline,
238
+ sender: reimbursableContract,
239
+ to: usdcAddress,
240
+ };
241
+ const signature = await this.config.eoaWalletClient.signTypedData({
242
+ account: this.config.eoaWalletClient.account,
243
+ domain,
244
+ types,
245
+ primaryType: "SessionExecution",
246
+ message,
247
+ });
248
+ return packSessionSignature({ signature, nonce, deadline });
249
+ }
250
+ // Static factory method for quick intent creation
251
+ static create(config) {
252
+ return new IntentBuilder(config);
253
+ }
254
+ }
255
+
256
+ export { IntentBuilder };
257
+ //# sourceMappingURL=intentBuilder.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intentBuilder.mjs","sources":["../src/intentBuilder.ts"],"sourcesContent":[null],"names":[],"mappings":";;;MAqBa,aAAa,CAAA;AAQxB,IAAA,WAAA,CAAY,MAA2B,EAAA;QAL/B,IAAA,CAAA,QAAQ,GAAQ,IAAI;QACpB,IAAA,CAAA,SAAS,GAAW,EAAE;AAK5B,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;IACtB;AAEA;;AAEG;AACH,IAAA,SAAS,CAAC,QAAa,EAAA;AACrB,QAAA,IAAI,CAAC,cAAc,GAAG,QAAQ;AAC9B,QAAA,OAAO,IAAI;IACb;AAEA;;AAEG;AACH,IAAA,SAAS,CAAC,KAAa,EAAA;AACrB,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK;AACtB,QAAA,OAAO,IAAI;IACb;AAEA;;AAEG;AACH,IAAA,SAAS,CAAC,KAAa,EAAA;AACrB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,QAAA,OAAO,IAAI;IACb;AAEA;;;AAGG;AACH,IAAA,YAAY,CAAC,Q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