@t402/evm 2.6.1 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants-05D7IZJA.d.ts +136 -0
- package/dist/cjs/permit2/index.d.ts +1 -137
- package/dist/cjs/permit2-proxy/client/index.d.ts +83 -0
- package/dist/cjs/permit2-proxy/client/index.js +182 -0
- package/dist/cjs/permit2-proxy/client/index.js.map +1 -0
- package/dist/cjs/permit2-proxy/facilitator/index.d.ts +93 -0
- package/dist/cjs/permit2-proxy/facilitator/index.js +368 -0
- package/dist/cjs/permit2-proxy/facilitator/index.js.map +1 -0
- package/dist/cjs/permit2-proxy/index.d.ts +344 -0
- package/dist/cjs/permit2-proxy/index.js +1274 -0
- package/dist/cjs/permit2-proxy/index.js.map +1 -0
- package/dist/cjs/permit2-proxy/server/index.d.ts +130 -0
- package/dist/cjs/permit2-proxy/server/index.js +695 -0
- package/dist/cjs/permit2-proxy/server/index.js.map +1 -0
- package/dist/esm/chunk-A2U6NWHQ.mjs +199 -0
- package/dist/esm/chunk-A2U6NWHQ.mjs.map +1 -0
- package/dist/esm/chunk-HUUYTNV2.mjs +138 -0
- package/dist/esm/chunk-HUUYTNV2.mjs.map +1 -0
- package/dist/esm/chunk-THXENBBU.mjs +251 -0
- package/dist/esm/chunk-THXENBBU.mjs.map +1 -0
- package/dist/esm/chunk-UK2POASM.mjs +204 -0
- package/dist/esm/chunk-UK2POASM.mjs.map +1 -0
- package/dist/esm/constants-05D7IZJA.d.mts +136 -0
- package/dist/esm/permit2/index.d.mts +1 -137
- package/dist/esm/permit2-proxy/client/index.d.mts +83 -0
- package/dist/esm/permit2-proxy/client/index.mjs +12 -0
- package/dist/esm/permit2-proxy/client/index.mjs.map +1 -0
- package/dist/esm/permit2-proxy/facilitator/index.d.mts +93 -0
- package/dist/esm/permit2-proxy/facilitator/index.mjs +12 -0
- package/dist/esm/permit2-proxy/facilitator/index.mjs.map +1 -0
- package/dist/esm/permit2-proxy/index.d.mts +344 -0
- package/dist/esm/permit2-proxy/index.mjs +45 -0
- package/dist/esm/permit2-proxy/index.mjs.map +1 -0
- package/dist/esm/permit2-proxy/server/index.d.mts +130 -0
- package/dist/esm/permit2-proxy/server/index.mjs +13 -0
- package/dist/esm/permit2-proxy/server/index.mjs.map +1 -0
- package/package.json +43 -3
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
export { Permit2ProxyEvmClientConfig, Permit2ProxyEvmScheme as Permit2ProxyEvmClientScheme, registerPermit2ProxyEvmScheme as registerPermit2ProxyEvmClientScheme } from './client/index.mjs';
|
|
2
|
+
export { Permit2ProxyEvmResourceServerConfig, Permit2ProxyEvmScheme as Permit2ProxyEvmServerScheme, Permit2ProxyEvmSchemeConfig as Permit2ProxyEvmServerSchemeConfig, registerPermit2ProxyEvmScheme as registerPermit2ProxyEvmServerScheme } from './server/index.mjs';
|
|
3
|
+
export { Permit2ProxyEvmFacilitatorConfig, Permit2ProxyEvmScheme as Permit2ProxyEvmFacilitatorScheme, Permit2ProxyEvmSchemeConfig as Permit2ProxyEvmFacilitatorSchemeConfig, registerPermit2ProxyEvmScheme as registerPermit2ProxyEvmFacilitatorScheme } from './facilitator/index.mjs';
|
|
4
|
+
import { b as PermitTransferFrom } from '../constants-05D7IZJA.mjs';
|
|
5
|
+
export { P as PERMIT2_ADDRESS, T as TokenPermissions } from '../constants-05D7IZJA.mjs';
|
|
6
|
+
import '@t402/core/types';
|
|
7
|
+
import '../signer-DcavxxZt.mjs';
|
|
8
|
+
import '@t402/core/client';
|
|
9
|
+
import '@t402/core/server';
|
|
10
|
+
import '@t402/core/facilitator';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Permit2 Proxy Types
|
|
14
|
+
*
|
|
15
|
+
* Type definitions for T402 Permit2 proxy scheme with witness-based
|
|
16
|
+
* facilitator binding via proxy contracts.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Witness data bound into the payer's EIP-712 signature.
|
|
21
|
+
* Matches the Witness struct in T402BasePermit2Proxy.sol.
|
|
22
|
+
*/
|
|
23
|
+
type T402Witness = {
|
|
24
|
+
/** Destination address for the token transfer */
|
|
25
|
+
to: `0x${string}`;
|
|
26
|
+
/** Address authorized to call settle (must match facilitator) */
|
|
27
|
+
facilitator: `0x${string}`;
|
|
28
|
+
/** Earliest timestamp when settlement is permitted (0 = immediate) */
|
|
29
|
+
validAfter: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Permit2 Proxy payment payload (V2)
|
|
33
|
+
*/
|
|
34
|
+
type Permit2ProxyPayloadV2 = {
|
|
35
|
+
/** The permit parameters */
|
|
36
|
+
permit: PermitTransferFrom;
|
|
37
|
+
/** Witness data bound into the signature */
|
|
38
|
+
witness: T402Witness;
|
|
39
|
+
/** EIP-712 signature over PermitWitnessTransferFrom with Witness */
|
|
40
|
+
signature: `0x${string}`;
|
|
41
|
+
/** Token owner address */
|
|
42
|
+
owner: `0x${string}`;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Permit2 Proxy Constants
|
|
47
|
+
*
|
|
48
|
+
* Contract addresses, EIP-712 type definitions, and ABI fragments
|
|
49
|
+
* for T402 Permit2 proxy contracts with witness-based settlement.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/** Scheme identifier for Permit2 proxy */
|
|
53
|
+
declare const SCHEME_PERMIT2_PROXY: "permit2-proxy";
|
|
54
|
+
/** T402 Exact Permit2 Proxy contract address (TBD - not yet deployed) */
|
|
55
|
+
declare const T402_EXACT_PERMIT2_PROXY: `0x${string}`;
|
|
56
|
+
/** T402 Upto Permit2 Proxy contract address (TBD - not yet deployed) */
|
|
57
|
+
declare const T402_UPTO_PERMIT2_PROXY: `0x${string}`;
|
|
58
|
+
/**
|
|
59
|
+
* EIP-712 typehash for the Witness struct.
|
|
60
|
+
* Must match WITNESS_TYPEHASH in T402BasePermit2Proxy.sol:
|
|
61
|
+
* keccak256("Witness(address to,address facilitator,uint256 validAfter)")
|
|
62
|
+
*/
|
|
63
|
+
declare const WITNESS_TYPEHASH: "0x5e3bbbe812684a9a24e1e1b7fe7c5b763bfb791ee8423aed3b4e1a5a9e25c255";
|
|
64
|
+
/**
|
|
65
|
+
* Witness type string for Permit2's permitWitnessTransferFrom.
|
|
66
|
+
* Format: "Witness witness)TokenPermissions(...)Witness(...)" -- types listed alphabetically.
|
|
67
|
+
* Must match WITNESS_TYPE_STRING in T402BasePermit2Proxy.sol.
|
|
68
|
+
*/
|
|
69
|
+
declare const WITNESS_TYPE_STRING: "Witness witness)TokenPermissions(address token,uint256 amount)Witness(address to,address facilitator,uint256 validAfter)";
|
|
70
|
+
/**
|
|
71
|
+
* EIP-712 type definitions for PermitWitnessTransferFrom with Witness.
|
|
72
|
+
* Used by clients when signing the permit with witness data.
|
|
73
|
+
*/
|
|
74
|
+
declare const permit2WitnessTypes: {
|
|
75
|
+
readonly PermitWitnessTransferFrom: readonly [{
|
|
76
|
+
readonly name: "permitted";
|
|
77
|
+
readonly type: "TokenPermissions";
|
|
78
|
+
}, {
|
|
79
|
+
readonly name: "spender";
|
|
80
|
+
readonly type: "address";
|
|
81
|
+
}, {
|
|
82
|
+
readonly name: "nonce";
|
|
83
|
+
readonly type: "uint256";
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "deadline";
|
|
86
|
+
readonly type: "uint256";
|
|
87
|
+
}, {
|
|
88
|
+
readonly name: "witness";
|
|
89
|
+
readonly type: "Witness";
|
|
90
|
+
}];
|
|
91
|
+
readonly TokenPermissions: readonly [{
|
|
92
|
+
readonly name: "token";
|
|
93
|
+
readonly type: "address";
|
|
94
|
+
}, {
|
|
95
|
+
readonly name: "amount";
|
|
96
|
+
readonly type: "uint256";
|
|
97
|
+
}];
|
|
98
|
+
readonly Witness: readonly [{
|
|
99
|
+
readonly name: "to";
|
|
100
|
+
readonly type: "address";
|
|
101
|
+
}, {
|
|
102
|
+
readonly name: "facilitator";
|
|
103
|
+
readonly type: "address";
|
|
104
|
+
}, {
|
|
105
|
+
readonly name: "validAfter";
|
|
106
|
+
readonly type: "uint256";
|
|
107
|
+
}];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* ABI for T402ExactPermit2Proxy contract.
|
|
111
|
+
* Includes settle() and settleWithPermit() functions.
|
|
112
|
+
*/
|
|
113
|
+
declare const permit2ProxyExactABI: readonly [{
|
|
114
|
+
readonly inputs: readonly [{
|
|
115
|
+
readonly components: readonly [{
|
|
116
|
+
readonly components: readonly [{
|
|
117
|
+
readonly name: "token";
|
|
118
|
+
readonly type: "address";
|
|
119
|
+
}, {
|
|
120
|
+
readonly name: "amount";
|
|
121
|
+
readonly type: "uint256";
|
|
122
|
+
}];
|
|
123
|
+
readonly name: "permitted";
|
|
124
|
+
readonly type: "tuple";
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "nonce";
|
|
127
|
+
readonly type: "uint256";
|
|
128
|
+
}, {
|
|
129
|
+
readonly name: "deadline";
|
|
130
|
+
readonly type: "uint256";
|
|
131
|
+
}];
|
|
132
|
+
readonly name: "permit";
|
|
133
|
+
readonly type: "tuple";
|
|
134
|
+
}, {
|
|
135
|
+
readonly name: "owner";
|
|
136
|
+
readonly type: "address";
|
|
137
|
+
}, {
|
|
138
|
+
readonly components: readonly [{
|
|
139
|
+
readonly name: "to";
|
|
140
|
+
readonly type: "address";
|
|
141
|
+
}, {
|
|
142
|
+
readonly name: "facilitator";
|
|
143
|
+
readonly type: "address";
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "validAfter";
|
|
146
|
+
readonly type: "uint256";
|
|
147
|
+
}];
|
|
148
|
+
readonly name: "witness";
|
|
149
|
+
readonly type: "tuple";
|
|
150
|
+
}, {
|
|
151
|
+
readonly name: "signature";
|
|
152
|
+
readonly type: "bytes";
|
|
153
|
+
}];
|
|
154
|
+
readonly name: "settle";
|
|
155
|
+
readonly outputs: readonly [];
|
|
156
|
+
readonly stateMutability: "nonpayable";
|
|
157
|
+
readonly type: "function";
|
|
158
|
+
}, {
|
|
159
|
+
readonly inputs: readonly [{
|
|
160
|
+
readonly components: readonly [{
|
|
161
|
+
readonly name: "value";
|
|
162
|
+
readonly type: "uint256";
|
|
163
|
+
}, {
|
|
164
|
+
readonly name: "deadline";
|
|
165
|
+
readonly type: "uint256";
|
|
166
|
+
}, {
|
|
167
|
+
readonly name: "v";
|
|
168
|
+
readonly type: "uint8";
|
|
169
|
+
}, {
|
|
170
|
+
readonly name: "r";
|
|
171
|
+
readonly type: "bytes32";
|
|
172
|
+
}, {
|
|
173
|
+
readonly name: "s";
|
|
174
|
+
readonly type: "bytes32";
|
|
175
|
+
}];
|
|
176
|
+
readonly name: "permit2612";
|
|
177
|
+
readonly type: "tuple";
|
|
178
|
+
}, {
|
|
179
|
+
readonly components: readonly [{
|
|
180
|
+
readonly components: readonly [{
|
|
181
|
+
readonly name: "token";
|
|
182
|
+
readonly type: "address";
|
|
183
|
+
}, {
|
|
184
|
+
readonly name: "amount";
|
|
185
|
+
readonly type: "uint256";
|
|
186
|
+
}];
|
|
187
|
+
readonly name: "permitted";
|
|
188
|
+
readonly type: "tuple";
|
|
189
|
+
}, {
|
|
190
|
+
readonly name: "nonce";
|
|
191
|
+
readonly type: "uint256";
|
|
192
|
+
}, {
|
|
193
|
+
readonly name: "deadline";
|
|
194
|
+
readonly type: "uint256";
|
|
195
|
+
}];
|
|
196
|
+
readonly name: "permit";
|
|
197
|
+
readonly type: "tuple";
|
|
198
|
+
}, {
|
|
199
|
+
readonly name: "owner";
|
|
200
|
+
readonly type: "address";
|
|
201
|
+
}, {
|
|
202
|
+
readonly components: readonly [{
|
|
203
|
+
readonly name: "to";
|
|
204
|
+
readonly type: "address";
|
|
205
|
+
}, {
|
|
206
|
+
readonly name: "facilitator";
|
|
207
|
+
readonly type: "address";
|
|
208
|
+
}, {
|
|
209
|
+
readonly name: "validAfter";
|
|
210
|
+
readonly type: "uint256";
|
|
211
|
+
}];
|
|
212
|
+
readonly name: "witness";
|
|
213
|
+
readonly type: "tuple";
|
|
214
|
+
}, {
|
|
215
|
+
readonly name: "signature";
|
|
216
|
+
readonly type: "bytes";
|
|
217
|
+
}];
|
|
218
|
+
readonly name: "settleWithPermit";
|
|
219
|
+
readonly outputs: readonly [];
|
|
220
|
+
readonly stateMutability: "nonpayable";
|
|
221
|
+
readonly type: "function";
|
|
222
|
+
}];
|
|
223
|
+
/**
|
|
224
|
+
* ABI for T402UptoPermit2Proxy contract.
|
|
225
|
+
* Includes settle() and settleWithPermit() functions.
|
|
226
|
+
*/
|
|
227
|
+
declare const permit2ProxyUptoABI: readonly [{
|
|
228
|
+
readonly inputs: readonly [{
|
|
229
|
+
readonly components: readonly [{
|
|
230
|
+
readonly components: readonly [{
|
|
231
|
+
readonly name: "token";
|
|
232
|
+
readonly type: "address";
|
|
233
|
+
}, {
|
|
234
|
+
readonly name: "amount";
|
|
235
|
+
readonly type: "uint256";
|
|
236
|
+
}];
|
|
237
|
+
readonly name: "permitted";
|
|
238
|
+
readonly type: "tuple";
|
|
239
|
+
}, {
|
|
240
|
+
readonly name: "nonce";
|
|
241
|
+
readonly type: "uint256";
|
|
242
|
+
}, {
|
|
243
|
+
readonly name: "deadline";
|
|
244
|
+
readonly type: "uint256";
|
|
245
|
+
}];
|
|
246
|
+
readonly name: "permit";
|
|
247
|
+
readonly type: "tuple";
|
|
248
|
+
}, {
|
|
249
|
+
readonly name: "amount";
|
|
250
|
+
readonly type: "uint256";
|
|
251
|
+
}, {
|
|
252
|
+
readonly name: "owner";
|
|
253
|
+
readonly type: "address";
|
|
254
|
+
}, {
|
|
255
|
+
readonly components: readonly [{
|
|
256
|
+
readonly name: "to";
|
|
257
|
+
readonly type: "address";
|
|
258
|
+
}, {
|
|
259
|
+
readonly name: "facilitator";
|
|
260
|
+
readonly type: "address";
|
|
261
|
+
}, {
|
|
262
|
+
readonly name: "validAfter";
|
|
263
|
+
readonly type: "uint256";
|
|
264
|
+
}];
|
|
265
|
+
readonly name: "witness";
|
|
266
|
+
readonly type: "tuple";
|
|
267
|
+
}, {
|
|
268
|
+
readonly name: "signature";
|
|
269
|
+
readonly type: "bytes";
|
|
270
|
+
}];
|
|
271
|
+
readonly name: "settle";
|
|
272
|
+
readonly outputs: readonly [];
|
|
273
|
+
readonly stateMutability: "nonpayable";
|
|
274
|
+
readonly type: "function";
|
|
275
|
+
}, {
|
|
276
|
+
readonly inputs: readonly [{
|
|
277
|
+
readonly components: readonly [{
|
|
278
|
+
readonly name: "value";
|
|
279
|
+
readonly type: "uint256";
|
|
280
|
+
}, {
|
|
281
|
+
readonly name: "deadline";
|
|
282
|
+
readonly type: "uint256";
|
|
283
|
+
}, {
|
|
284
|
+
readonly name: "v";
|
|
285
|
+
readonly type: "uint8";
|
|
286
|
+
}, {
|
|
287
|
+
readonly name: "r";
|
|
288
|
+
readonly type: "bytes32";
|
|
289
|
+
}, {
|
|
290
|
+
readonly name: "s";
|
|
291
|
+
readonly type: "bytes32";
|
|
292
|
+
}];
|
|
293
|
+
readonly name: "permit2612";
|
|
294
|
+
readonly type: "tuple";
|
|
295
|
+
}, {
|
|
296
|
+
readonly components: readonly [{
|
|
297
|
+
readonly components: readonly [{
|
|
298
|
+
readonly name: "token";
|
|
299
|
+
readonly type: "address";
|
|
300
|
+
}, {
|
|
301
|
+
readonly name: "amount";
|
|
302
|
+
readonly type: "uint256";
|
|
303
|
+
}];
|
|
304
|
+
readonly name: "permitted";
|
|
305
|
+
readonly type: "tuple";
|
|
306
|
+
}, {
|
|
307
|
+
readonly name: "nonce";
|
|
308
|
+
readonly type: "uint256";
|
|
309
|
+
}, {
|
|
310
|
+
readonly name: "deadline";
|
|
311
|
+
readonly type: "uint256";
|
|
312
|
+
}];
|
|
313
|
+
readonly name: "permit";
|
|
314
|
+
readonly type: "tuple";
|
|
315
|
+
}, {
|
|
316
|
+
readonly name: "amount";
|
|
317
|
+
readonly type: "uint256";
|
|
318
|
+
}, {
|
|
319
|
+
readonly name: "owner";
|
|
320
|
+
readonly type: "address";
|
|
321
|
+
}, {
|
|
322
|
+
readonly components: readonly [{
|
|
323
|
+
readonly name: "to";
|
|
324
|
+
readonly type: "address";
|
|
325
|
+
}, {
|
|
326
|
+
readonly name: "facilitator";
|
|
327
|
+
readonly type: "address";
|
|
328
|
+
}, {
|
|
329
|
+
readonly name: "validAfter";
|
|
330
|
+
readonly type: "uint256";
|
|
331
|
+
}];
|
|
332
|
+
readonly name: "witness";
|
|
333
|
+
readonly type: "tuple";
|
|
334
|
+
}, {
|
|
335
|
+
readonly name: "signature";
|
|
336
|
+
readonly type: "bytes";
|
|
337
|
+
}];
|
|
338
|
+
readonly name: "settleWithPermit";
|
|
339
|
+
readonly outputs: readonly [];
|
|
340
|
+
readonly stateMutability: "nonpayable";
|
|
341
|
+
readonly type: "function";
|
|
342
|
+
}];
|
|
343
|
+
|
|
344
|
+
export { type Permit2ProxyPayloadV2, PermitTransferFrom, SCHEME_PERMIT2_PROXY, type T402Witness, T402_EXACT_PERMIT2_PROXY, T402_UPTO_PERMIT2_PROXY, WITNESS_TYPEHASH, WITNESS_TYPE_STRING, permit2ProxyExactABI, permit2ProxyUptoABI, permit2WitnessTypes };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Permit2ProxyEvmScheme,
|
|
3
|
+
registerPermit2ProxyEvmScheme
|
|
4
|
+
} from "../chunk-HUUYTNV2.mjs";
|
|
5
|
+
import {
|
|
6
|
+
Permit2ProxyEvmScheme as Permit2ProxyEvmScheme2,
|
|
7
|
+
registerPermit2ProxyEvmScheme as registerPermit2ProxyEvmScheme2
|
|
8
|
+
} from "../chunk-A2U6NWHQ.mjs";
|
|
9
|
+
import {
|
|
10
|
+
Permit2ProxyEvmScheme as Permit2ProxyEvmScheme3,
|
|
11
|
+
registerPermit2ProxyEvmScheme as registerPermit2ProxyEvmScheme3
|
|
12
|
+
} from "../chunk-THXENBBU.mjs";
|
|
13
|
+
import {
|
|
14
|
+
SCHEME_PERMIT2_PROXY,
|
|
15
|
+
T402_EXACT_PERMIT2_PROXY,
|
|
16
|
+
T402_UPTO_PERMIT2_PROXY,
|
|
17
|
+
WITNESS_TYPEHASH,
|
|
18
|
+
WITNESS_TYPE_STRING,
|
|
19
|
+
permit2ProxyExactABI,
|
|
20
|
+
permit2ProxyUptoABI,
|
|
21
|
+
permit2WitnessTypes
|
|
22
|
+
} from "../chunk-UK2POASM.mjs";
|
|
23
|
+
import {
|
|
24
|
+
PERMIT2_ADDRESS
|
|
25
|
+
} from "../chunk-URG4HEYQ.mjs";
|
|
26
|
+
import "../chunk-FUUW3JGG.mjs";
|
|
27
|
+
import "../chunk-NSSMTXJJ.mjs";
|
|
28
|
+
export {
|
|
29
|
+
PERMIT2_ADDRESS,
|
|
30
|
+
Permit2ProxyEvmScheme as Permit2ProxyEvmClientScheme,
|
|
31
|
+
Permit2ProxyEvmScheme3 as Permit2ProxyEvmFacilitatorScheme,
|
|
32
|
+
Permit2ProxyEvmScheme2 as Permit2ProxyEvmServerScheme,
|
|
33
|
+
SCHEME_PERMIT2_PROXY,
|
|
34
|
+
T402_EXACT_PERMIT2_PROXY,
|
|
35
|
+
T402_UPTO_PERMIT2_PROXY,
|
|
36
|
+
WITNESS_TYPEHASH,
|
|
37
|
+
WITNESS_TYPE_STRING,
|
|
38
|
+
permit2ProxyExactABI,
|
|
39
|
+
permit2ProxyUptoABI,
|
|
40
|
+
permit2WitnessTypes,
|
|
41
|
+
registerPermit2ProxyEvmScheme as registerPermit2ProxyEvmClientScheme,
|
|
42
|
+
registerPermit2ProxyEvmScheme3 as registerPermit2ProxyEvmFacilitatorScheme,
|
|
43
|
+
registerPermit2ProxyEvmScheme2 as registerPermit2ProxyEvmServerScheme
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { SchemeNetworkServer, MoneyParser, Price, Network, AssetAmount, PaymentRequirements } from '@t402/core/types';
|
|
2
|
+
import { t402ResourceServer } from '@t402/core/server';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for Permit2ProxyEvmScheme server
|
|
6
|
+
*/
|
|
7
|
+
interface Permit2ProxyEvmSchemeConfig {
|
|
8
|
+
/** Preferred token symbol (e.g., "USDT0", "USDC"). Defaults to network's highest priority token. */
|
|
9
|
+
preferredToken?: string;
|
|
10
|
+
/** Override exact proxy contract address */
|
|
11
|
+
exactProxyAddress?: `0x${string}`;
|
|
12
|
+
/** Override upto proxy contract address */
|
|
13
|
+
uptoProxyAddress?: `0x${string}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* EVM server implementation for the Permit2 Proxy payment scheme.
|
|
17
|
+
* Supports USDT0, USDC, and other ERC20 tokens via T402 Permit2 proxy contracts.
|
|
18
|
+
*/
|
|
19
|
+
declare class Permit2ProxyEvmScheme implements SchemeNetworkServer {
|
|
20
|
+
readonly scheme: "permit2-proxy";
|
|
21
|
+
private moneyParsers;
|
|
22
|
+
private config;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new Permit2ProxyEvmScheme server instance.
|
|
25
|
+
*
|
|
26
|
+
* @param config - Server configuration options
|
|
27
|
+
*/
|
|
28
|
+
constructor(config?: Permit2ProxyEvmSchemeConfig);
|
|
29
|
+
/**
|
|
30
|
+
* Get the list of supported EVM networks.
|
|
31
|
+
*
|
|
32
|
+
* @returns Array of supported network identifiers
|
|
33
|
+
*/
|
|
34
|
+
static getSupportedNetworks(): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Check if a network is supported.
|
|
37
|
+
*
|
|
38
|
+
* @param network - Network identifier to check
|
|
39
|
+
* @returns Whether the network is supported
|
|
40
|
+
*/
|
|
41
|
+
static isNetworkSupported(network: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Register a custom money parser for price conversion.
|
|
44
|
+
*
|
|
45
|
+
* @param parser - The money parser to register
|
|
46
|
+
* @returns This instance for chaining
|
|
47
|
+
*/
|
|
48
|
+
registerMoneyParser(parser: MoneyParser): Permit2ProxyEvmScheme;
|
|
49
|
+
/**
|
|
50
|
+
* Parse a price into an AssetAmount for the given network.
|
|
51
|
+
*
|
|
52
|
+
* @param price - The price to parse
|
|
53
|
+
* @param network - The target network
|
|
54
|
+
* @returns The parsed asset amount
|
|
55
|
+
*/
|
|
56
|
+
parsePrice(price: Price, network: Network): Promise<AssetAmount>;
|
|
57
|
+
/**
|
|
58
|
+
* Enhance payment requirements with Permit2 Proxy-specific data.
|
|
59
|
+
*
|
|
60
|
+
* @param paymentRequirements - The base payment requirements
|
|
61
|
+
* @param supportedKind - The supported kind metadata
|
|
62
|
+
* @param supportedKind.t402Version - Protocol version
|
|
63
|
+
* @param supportedKind.scheme - Payment scheme
|
|
64
|
+
* @param supportedKind.network - Target network
|
|
65
|
+
* @param supportedKind.extra - Extra metadata
|
|
66
|
+
* @param extensionKeys - Active extension keys
|
|
67
|
+
* @returns Enhanced payment requirements
|
|
68
|
+
*/
|
|
69
|
+
enhancePaymentRequirements(paymentRequirements: PaymentRequirements, supportedKind: {
|
|
70
|
+
t402Version: number;
|
|
71
|
+
scheme: string;
|
|
72
|
+
network: Network;
|
|
73
|
+
extra?: Record<string, unknown>;
|
|
74
|
+
}, extensionKeys: string[]): Promise<PaymentRequirements>;
|
|
75
|
+
/**
|
|
76
|
+
* Parse a money value into a decimal number.
|
|
77
|
+
*
|
|
78
|
+
* @param money - The money value to parse
|
|
79
|
+
* @returns The decimal amount
|
|
80
|
+
*/
|
|
81
|
+
private parseMoneyToDecimal;
|
|
82
|
+
/**
|
|
83
|
+
* Convert a decimal amount to a token amount using default network token.
|
|
84
|
+
*
|
|
85
|
+
* @param amount - The decimal amount
|
|
86
|
+
* @param network - The target network
|
|
87
|
+
* @returns The asset amount with token details
|
|
88
|
+
*/
|
|
89
|
+
private defaultMoneyConversion;
|
|
90
|
+
/**
|
|
91
|
+
* Convert a decimal amount string to token smallest units.
|
|
92
|
+
*
|
|
93
|
+
* @param decimalAmount - The decimal amount as a string
|
|
94
|
+
* @param decimals - The token's decimal places
|
|
95
|
+
* @returns The amount in smallest units
|
|
96
|
+
*/
|
|
97
|
+
private convertToTokenAmount;
|
|
98
|
+
/**
|
|
99
|
+
* Get the default token asset for a network.
|
|
100
|
+
*
|
|
101
|
+
* @param network - The target network
|
|
102
|
+
* @returns The token configuration
|
|
103
|
+
*/
|
|
104
|
+
private getDefaultAsset;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Configuration options for registering Permit2 Proxy schemes to an t402ResourceServer
|
|
109
|
+
*/
|
|
110
|
+
interface Permit2ProxyEvmResourceServerConfig {
|
|
111
|
+
/**
|
|
112
|
+
* Optional specific networks to register
|
|
113
|
+
* If not provided, registers wildcard support (eip155:*)
|
|
114
|
+
*/
|
|
115
|
+
networks?: Network[];
|
|
116
|
+
/**
|
|
117
|
+
* Optional scheme configuration
|
|
118
|
+
*/
|
|
119
|
+
schemeConfig?: Permit2ProxyEvmSchemeConfig;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Registers Permit2 Proxy EVM payment schemes to an t402ResourceServer instance.
|
|
123
|
+
*
|
|
124
|
+
* @param server - The t402ResourceServer instance to register schemes to
|
|
125
|
+
* @param config - Configuration for Permit2 Proxy resource server registration
|
|
126
|
+
* @returns The server instance for chaining
|
|
127
|
+
*/
|
|
128
|
+
declare function registerPermit2ProxyEvmScheme(server: t402ResourceServer, config?: Permit2ProxyEvmResourceServerConfig): t402ResourceServer;
|
|
129
|
+
|
|
130
|
+
export { type Permit2ProxyEvmResourceServerConfig, Permit2ProxyEvmScheme, type Permit2ProxyEvmSchemeConfig, registerPermit2ProxyEvmScheme };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Permit2ProxyEvmScheme,
|
|
3
|
+
registerPermit2ProxyEvmScheme
|
|
4
|
+
} from "../../chunk-A2U6NWHQ.mjs";
|
|
5
|
+
import "../../chunk-UK2POASM.mjs";
|
|
6
|
+
import "../../chunk-URG4HEYQ.mjs";
|
|
7
|
+
import "../../chunk-FUUW3JGG.mjs";
|
|
8
|
+
import "../../chunk-NSSMTXJJ.mjs";
|
|
9
|
+
export {
|
|
10
|
+
Permit2ProxyEvmScheme,
|
|
11
|
+
registerPermit2ProxyEvmScheme
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t402/evm",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"main": "./dist/cjs/index.js",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/cjs/index.d.ts",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"vitest": "^3.2.4"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@t402/core": "2.
|
|
42
|
-
"@t402/evm-core": "2.
|
|
41
|
+
"@t402/core": "2.7.1",
|
|
42
|
+
"@t402/evm-core": "2.7.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"viem": "^2.0.0"
|
|
@@ -155,6 +155,46 @@
|
|
|
155
155
|
"default": "./dist/cjs/permit2/facilitator/index.js"
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
|
+
"./permit2-proxy": {
|
|
159
|
+
"import": {
|
|
160
|
+
"types": "./dist/esm/permit2-proxy/index.d.mts",
|
|
161
|
+
"default": "./dist/esm/permit2-proxy/index.mjs"
|
|
162
|
+
},
|
|
163
|
+
"require": {
|
|
164
|
+
"types": "./dist/cjs/permit2-proxy/index.d.ts",
|
|
165
|
+
"default": "./dist/cjs/permit2-proxy/index.js"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"./permit2-proxy/client": {
|
|
169
|
+
"import": {
|
|
170
|
+
"types": "./dist/esm/permit2-proxy/client/index.d.mts",
|
|
171
|
+
"default": "./dist/esm/permit2-proxy/client/index.mjs"
|
|
172
|
+
},
|
|
173
|
+
"require": {
|
|
174
|
+
"types": "./dist/cjs/permit2-proxy/client/index.d.ts",
|
|
175
|
+
"default": "./dist/cjs/permit2-proxy/client/index.js"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"./permit2-proxy/server": {
|
|
179
|
+
"import": {
|
|
180
|
+
"types": "./dist/esm/permit2-proxy/server/index.d.mts",
|
|
181
|
+
"default": "./dist/esm/permit2-proxy/server/index.mjs"
|
|
182
|
+
},
|
|
183
|
+
"require": {
|
|
184
|
+
"types": "./dist/cjs/permit2-proxy/server/index.d.ts",
|
|
185
|
+
"default": "./dist/cjs/permit2-proxy/server/index.js"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"./permit2-proxy/facilitator": {
|
|
189
|
+
"import": {
|
|
190
|
+
"types": "./dist/esm/permit2-proxy/facilitator/index.d.mts",
|
|
191
|
+
"default": "./dist/esm/permit2-proxy/facilitator/index.mjs"
|
|
192
|
+
},
|
|
193
|
+
"require": {
|
|
194
|
+
"types": "./dist/cjs/permit2-proxy/facilitator/index.d.ts",
|
|
195
|
+
"default": "./dist/cjs/permit2-proxy/facilitator/index.js"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
158
198
|
"./upto": {
|
|
159
199
|
"import": {
|
|
160
200
|
"types": "./dist/esm/upto/index.d.mts",
|