@t402/evm-core 2.3.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.
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ # @t402/evm-core
2
+
3
+ T402 EVM Core Types and Utilities - Zero external dependencies.
4
+
5
+ ## Overview
6
+
7
+ This package provides EVM types, constants, and utilities for the T402 payment protocol without requiring viem as a dependency. Use this package when you want to work with T402 EVM types without bundling the full viem library.
8
+
9
+ For full EVM functionality with viem integration, use `@t402/evm` instead.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @t402/evm-core
15
+ # or
16
+ pnpm add @t402/evm-core
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```typescript
22
+ import {
23
+ // Primitive types
24
+ type Address,
25
+ type Hex,
26
+ bytesToHex,
27
+ hexToBytes,
28
+
29
+ // Payment types
30
+ type ExactEIP3009Payload,
31
+ type UptoEIP2612Payload,
32
+
33
+ // Constants
34
+ authorizationTypes,
35
+ eip3009ABI,
36
+
37
+ // Signer interfaces
38
+ type ClientEvmSigner,
39
+ type FacilitatorEvmSigner,
40
+
41
+ // Token registry
42
+ TOKEN_REGISTRY,
43
+ getTokenConfig,
44
+ getNetworkTokens,
45
+
46
+ // Utilities
47
+ createNonce,
48
+ getEvmChainId,
49
+ } from "@t402/evm-core";
50
+
51
+ // Use types without viem
52
+ const payload: ExactEIP3009Payload = {
53
+ authorization: {
54
+ from: "0x...",
55
+ to: "0x...",
56
+ value: "1000000",
57
+ validAfter: "0",
58
+ validBefore: "1893456000",
59
+ nonce: createNonce(),
60
+ },
61
+ };
62
+ ```
63
+
64
+ ## When to Use This Package
65
+
66
+ Use `@t402/evm-core` when:
67
+
68
+ - You only need types and don't need viem functionality
69
+ - You're building a type-only package that depends on T402 types
70
+ - You want to reduce bundle size by avoiding viem
71
+ - You're using a different EVM library (ethers.js, web3.js, etc.)
72
+
73
+ Use `@t402/evm` when:
74
+
75
+ - You need full EVM signing and verification
76
+ - You're using viem in your project
77
+ - You need the client or facilitator scheme implementations
78
+
79
+ ## Exports
80
+
81
+ ### Primitive Types
82
+
83
+ - `Address` - Ethereum address type (`` `0x${string}` ``)
84
+ - `Hex` - Hexadecimal string type
85
+ - `Bytes32` - 32-byte hex value
86
+ - `bytesToHex()` - Convert Uint8Array to hex
87
+ - `hexToBytes()` - Convert hex to Uint8Array
88
+
89
+ ### Payment Types
90
+
91
+ - `ExactEIP3009Payload` - EIP-3009 TransferWithAuthorization payload
92
+ - `ExactLegacyPayload` - Legacy approve+transferFrom payload
93
+ - `UptoEIP2612Payload` - EIP-2612 Permit payload for metered payments
94
+ - `PermitSignature` - EIP-2612 signature components
95
+ - `PermitAuthorization` - EIP-2612 permit parameters
96
+
97
+ ### Constants
98
+
99
+ - `authorizationTypes` - EIP-712 type definitions for EIP-3009
100
+ - `legacyAuthorizationTypes` - EIP-712 type definitions for legacy flow
101
+ - `eip3009ABI` - ABI for EIP-3009 token contracts
102
+ - `erc20LegacyABI` - ABI for standard ERC-20 operations
103
+
104
+ ### Signer Interfaces
105
+
106
+ - `ClientEvmSigner` - Interface for client-side signing
107
+ - `FacilitatorEvmSigner` - Interface for facilitator operations
108
+ - `toClientEvmSigner()` - Convert to ClientEvmSigner
109
+ - `toFacilitatorEvmSigner()` - Convert to FacilitatorEvmSigner
110
+
111
+ ### Token Registry
112
+
113
+ - `TOKEN_REGISTRY` - Complete token configuration by network
114
+ - `USDT0_ADDRESSES` - USDT0 contract addresses
115
+ - `USDC_ADDRESSES` - USDC contract addresses
116
+ - `getTokenConfig()` - Get token config by network/symbol
117
+ - `getNetworkTokens()` - Get all tokens for a network
118
+ - `getTokenByAddress()` - Find token by contract address
119
+ - `getEIP712Domain()` - Get EIP-712 domain for token
120
+
121
+ ### Utilities
122
+
123
+ - `createNonce()` - Generate random 32-byte nonce
124
+ - `getEvmChainId()` - Get chain ID from network name
125
+
126
+ ## License
127
+
128
+ Apache-2.0
@@ -0,0 +1,595 @@
1
+ import { Network } from '@t402/core/types';
2
+
3
+ /**
4
+ * EVM Primitive Types
5
+ *
6
+ * These type aliases are compatible with viem's types but don't require viem as a dependency.
7
+ * When used with viem, these types are structurally identical and fully interoperable.
8
+ */
9
+ /**
10
+ * Ethereum address (20 bytes, checksummed or lowercase)
11
+ * Compatible with viem's Address type
12
+ */
13
+ type Address = `0x${string}`;
14
+ /**
15
+ * Hexadecimal string
16
+ * Compatible with viem's Hex type
17
+ */
18
+ type Hex = `0x${string}`;
19
+ /**
20
+ * Bytes32 value (32 bytes as hex)
21
+ */
22
+ type Bytes32 = `0x${string}`;
23
+ /**
24
+ * Convert a Uint8Array to a hex string
25
+ * Standalone implementation - no viem dependency
26
+ */
27
+ declare function bytesToHex(bytes: Uint8Array): Hex;
28
+ /**
29
+ * Convert a hex string to Uint8Array
30
+ * Standalone implementation - no viem dependency
31
+ */
32
+ declare function hexToBytes(hex: Hex): Uint8Array;
33
+
34
+ /**
35
+ * EVM Payment Types
36
+ *
37
+ * Type definitions for T402 EVM payment schemes.
38
+ * These types have no external dependencies and can be used independently.
39
+ */
40
+
41
+ /**
42
+ * EIP-3009 TransferWithAuthorization payload
43
+ */
44
+ type ExactEIP3009Payload = {
45
+ signature?: Hex;
46
+ authorization: {
47
+ from: Address;
48
+ to: Address;
49
+ value: string;
50
+ validAfter: string;
51
+ validBefore: string;
52
+ nonce: Hex;
53
+ };
54
+ };
55
+ type ExactEvmPayloadV1 = ExactEIP3009Payload;
56
+ type ExactEvmPayloadV2 = ExactEIP3009Payload;
57
+ /**
58
+ * Payload for exact-legacy scheme (approve + transferFrom pattern)
59
+ * Used for legacy USDT and other tokens without EIP-3009 support
60
+ */
61
+ type ExactLegacyPayload = {
62
+ signature?: Hex;
63
+ authorization: {
64
+ /** Payer address */
65
+ from: Address;
66
+ /** Recipient address */
67
+ to: Address;
68
+ /** Payment amount in token units */
69
+ value: string;
70
+ /** Unix timestamp after which the authorization is valid */
71
+ validAfter: string;
72
+ /** Unix timestamp before which the authorization is valid */
73
+ validBefore: string;
74
+ /** Unique nonce to prevent replay attacks */
75
+ nonce: Hex;
76
+ /** Facilitator address that will call transferFrom */
77
+ spender: Address;
78
+ };
79
+ };
80
+ /**
81
+ * EIP-2612 Permit signature components
82
+ */
83
+ type PermitSignature = {
84
+ v: number;
85
+ r: Hex;
86
+ s: Hex;
87
+ };
88
+ /**
89
+ * EIP-2612 Permit authorization parameters
90
+ */
91
+ type PermitAuthorization = {
92
+ /** Token owner address */
93
+ owner: Address;
94
+ /** Spender address (router contract or facilitator) */
95
+ spender: Address;
96
+ /** Maximum authorized value */
97
+ value: string;
98
+ /** Permit deadline (unix timestamp) */
99
+ deadline: string;
100
+ /** Permit nonce from token contract */
101
+ nonce: number;
102
+ };
103
+ /**
104
+ * Payload for upto scheme using EIP-2612 Permit
105
+ */
106
+ type UptoEIP2612Payload = {
107
+ /** EIP-2612 permit signature */
108
+ signature: PermitSignature;
109
+ /** Permit authorization parameters */
110
+ authorization: PermitAuthorization;
111
+ /** Unique payment nonce (separate from permit nonce) */
112
+ paymentNonce: Hex;
113
+ };
114
+ /**
115
+ * Compact payload with combined signature bytes
116
+ */
117
+ type UptoEIP2612PayloadCompact = {
118
+ /** Combined permit signature (65 bytes) */
119
+ signature: Hex;
120
+ /** Permit authorization parameters */
121
+ authorization: PermitAuthorization;
122
+ /** Unique payment nonce */
123
+ paymentNonce: Hex;
124
+ };
125
+ type UptoEvmPayloadV2 = UptoEIP2612Payload | UptoEIP2612PayloadCompact;
126
+ /**
127
+ * Extra fields for upto scheme requirements on EVM
128
+ */
129
+ type UptoEvmExtra = {
130
+ /** EIP-712 domain name (from token contract) */
131
+ name: string;
132
+ /** EIP-712 domain version */
133
+ version: string;
134
+ /** Router contract address for settlement */
135
+ routerAddress?: Address;
136
+ /** Billing unit */
137
+ unit?: string;
138
+ /** Price per unit */
139
+ unitPrice?: string;
140
+ };
141
+ /**
142
+ * Settlement data for upto scheme
143
+ */
144
+ type UptoEvmSettlement = {
145
+ /** Actual amount to settle (must be <= maxAmount) */
146
+ settleAmount: string;
147
+ /** Usage details for auditing */
148
+ usageDetails?: {
149
+ unitsConsumed?: number;
150
+ unitPrice?: string;
151
+ unitType?: string;
152
+ startTime?: number;
153
+ endTime?: number;
154
+ };
155
+ };
156
+ /**
157
+ * EIP-712 typed data for EIP-2612 Permit
158
+ */
159
+ declare const permitTypes: {
160
+ readonly Permit: readonly [{
161
+ readonly name: "owner";
162
+ readonly type: "address";
163
+ }, {
164
+ readonly name: "spender";
165
+ readonly type: "address";
166
+ }, {
167
+ readonly name: "value";
168
+ readonly type: "uint256";
169
+ }, {
170
+ readonly name: "nonce";
171
+ readonly type: "uint256";
172
+ }, {
173
+ readonly name: "deadline";
174
+ readonly type: "uint256";
175
+ }];
176
+ };
177
+ /**
178
+ * Type guard for UptoEIP2612Payload
179
+ */
180
+ declare function isUptoEIP2612Payload(payload: unknown): payload is UptoEIP2612Payload;
181
+
182
+ /**
183
+ * EVM Constants
184
+ *
185
+ * EIP-712 type definitions and ABI constants for T402 EVM payments.
186
+ * No external dependencies.
187
+ */
188
+ declare const authorizationTypes: {
189
+ readonly TransferWithAuthorization: readonly [{
190
+ readonly name: "from";
191
+ readonly type: "address";
192
+ }, {
193
+ readonly name: "to";
194
+ readonly type: "address";
195
+ }, {
196
+ readonly name: "value";
197
+ readonly type: "uint256";
198
+ }, {
199
+ readonly name: "validAfter";
200
+ readonly type: "uint256";
201
+ }, {
202
+ readonly name: "validBefore";
203
+ readonly type: "uint256";
204
+ }, {
205
+ readonly name: "nonce";
206
+ readonly type: "bytes32";
207
+ }];
208
+ };
209
+ declare const legacyAuthorizationTypes: {
210
+ readonly LegacyTransferAuthorization: readonly [{
211
+ readonly name: "from";
212
+ readonly type: "address";
213
+ }, {
214
+ readonly name: "to";
215
+ readonly type: "address";
216
+ }, {
217
+ readonly name: "value";
218
+ readonly type: "uint256";
219
+ }, {
220
+ readonly name: "validAfter";
221
+ readonly type: "uint256";
222
+ }, {
223
+ readonly name: "validBefore";
224
+ readonly type: "uint256";
225
+ }, {
226
+ readonly name: "nonce";
227
+ readonly type: "bytes32";
228
+ }, {
229
+ readonly name: "spender";
230
+ readonly type: "address";
231
+ }];
232
+ };
233
+ declare const eip3009ABI: readonly [{
234
+ readonly inputs: readonly [{
235
+ readonly name: "from";
236
+ readonly type: "address";
237
+ }, {
238
+ readonly name: "to";
239
+ readonly type: "address";
240
+ }, {
241
+ readonly name: "value";
242
+ readonly type: "uint256";
243
+ }, {
244
+ readonly name: "validAfter";
245
+ readonly type: "uint256";
246
+ }, {
247
+ readonly name: "validBefore";
248
+ readonly type: "uint256";
249
+ }, {
250
+ readonly name: "nonce";
251
+ readonly type: "bytes32";
252
+ }, {
253
+ readonly name: "v";
254
+ readonly type: "uint8";
255
+ }, {
256
+ readonly name: "r";
257
+ readonly type: "bytes32";
258
+ }, {
259
+ readonly name: "s";
260
+ readonly type: "bytes32";
261
+ }];
262
+ readonly name: "transferWithAuthorization";
263
+ readonly outputs: readonly [];
264
+ readonly stateMutability: "nonpayable";
265
+ readonly type: "function";
266
+ }, {
267
+ readonly inputs: readonly [{
268
+ readonly name: "from";
269
+ readonly type: "address";
270
+ }, {
271
+ readonly name: "to";
272
+ readonly type: "address";
273
+ }, {
274
+ readonly name: "value";
275
+ readonly type: "uint256";
276
+ }, {
277
+ readonly name: "validAfter";
278
+ readonly type: "uint256";
279
+ }, {
280
+ readonly name: "validBefore";
281
+ readonly type: "uint256";
282
+ }, {
283
+ readonly name: "nonce";
284
+ readonly type: "bytes32";
285
+ }, {
286
+ readonly name: "signature";
287
+ readonly type: "bytes";
288
+ }];
289
+ readonly name: "transferWithAuthorization";
290
+ readonly outputs: readonly [];
291
+ readonly stateMutability: "nonpayable";
292
+ readonly type: "function";
293
+ }, {
294
+ readonly inputs: readonly [{
295
+ readonly name: "account";
296
+ readonly type: "address";
297
+ }];
298
+ readonly name: "balanceOf";
299
+ readonly outputs: readonly [{
300
+ readonly name: "";
301
+ readonly type: "uint256";
302
+ }];
303
+ readonly stateMutability: "view";
304
+ readonly type: "function";
305
+ }, {
306
+ readonly inputs: readonly [];
307
+ readonly name: "version";
308
+ readonly outputs: readonly [{
309
+ readonly name: "";
310
+ readonly type: "string";
311
+ }];
312
+ readonly stateMutability: "view";
313
+ readonly type: "function";
314
+ }];
315
+ declare const erc20LegacyABI: readonly [{
316
+ readonly inputs: readonly [{
317
+ readonly name: "account";
318
+ readonly type: "address";
319
+ }];
320
+ readonly name: "balanceOf";
321
+ readonly outputs: readonly [{
322
+ readonly name: "";
323
+ readonly type: "uint256";
324
+ }];
325
+ readonly stateMutability: "view";
326
+ readonly type: "function";
327
+ }, {
328
+ readonly inputs: readonly [{
329
+ readonly name: "owner";
330
+ readonly type: "address";
331
+ }, {
332
+ readonly name: "spender";
333
+ readonly type: "address";
334
+ }];
335
+ readonly name: "allowance";
336
+ readonly outputs: readonly [{
337
+ readonly name: "";
338
+ readonly type: "uint256";
339
+ }];
340
+ readonly stateMutability: "view";
341
+ readonly type: "function";
342
+ }, {
343
+ readonly inputs: readonly [{
344
+ readonly name: "spender";
345
+ readonly type: "address";
346
+ }, {
347
+ readonly name: "amount";
348
+ readonly type: "uint256";
349
+ }];
350
+ readonly name: "approve";
351
+ readonly outputs: readonly [{
352
+ readonly name: "";
353
+ readonly type: "bool";
354
+ }];
355
+ readonly stateMutability: "nonpayable";
356
+ readonly type: "function";
357
+ }, {
358
+ readonly inputs: readonly [{
359
+ readonly name: "from";
360
+ readonly type: "address";
361
+ }, {
362
+ readonly name: "to";
363
+ readonly type: "address";
364
+ }, {
365
+ readonly name: "amount";
366
+ readonly type: "uint256";
367
+ }];
368
+ readonly name: "transferFrom";
369
+ readonly outputs: readonly [{
370
+ readonly name: "";
371
+ readonly type: "bool";
372
+ }];
373
+ readonly stateMutability: "nonpayable";
374
+ readonly type: "function";
375
+ }];
376
+
377
+ /**
378
+ * EVM Signer Types
379
+ *
380
+ * Type definitions for T402 EVM signers (clients and facilitators).
381
+ * These interfaces are compatible with viem but don't require it.
382
+ */
383
+
384
+ /**
385
+ * ClientEvmSigner - Used by T402 clients to sign payment authorizations
386
+ *
387
+ * This is typically a LocalAccount or wallet that holds private keys
388
+ * and can sign EIP-712 typed data for payment authorizations.
389
+ * Compatible with viem's LocalAccount interface.
390
+ */
391
+ type ClientEvmSigner = {
392
+ readonly address: Address;
393
+ signTypedData(message: {
394
+ domain: Record<string, unknown>;
395
+ types: Record<string, unknown>;
396
+ primaryType: string;
397
+ message: Record<string, unknown>;
398
+ }): Promise<Hex>;
399
+ };
400
+ /**
401
+ * FacilitatorEvmSigner - Used by T402 facilitators to verify and settle payments
402
+ *
403
+ * This is typically a viem PublicClient + WalletClient combination that can
404
+ * read contract state, verify signatures, write transactions, and wait for receipts.
405
+ * Compatible with viem's client interface.
406
+ *
407
+ * Supports multiple addresses for load balancing, key rotation, and high availability.
408
+ */
409
+ type FacilitatorEvmSigner = {
410
+ /**
411
+ * Get all addresses this facilitator can use for signing
412
+ * Enables dynamic address selection for load balancing and key rotation
413
+ */
414
+ getAddresses(): readonly Address[];
415
+ readContract(args: {
416
+ address: Address;
417
+ abi: readonly unknown[];
418
+ functionName: string;
419
+ args?: readonly unknown[];
420
+ }): Promise<unknown>;
421
+ verifyTypedData(args: {
422
+ address: Address;
423
+ domain: Record<string, unknown>;
424
+ types: Record<string, unknown>;
425
+ primaryType: string;
426
+ message: Record<string, unknown>;
427
+ signature: Hex;
428
+ }): Promise<boolean>;
429
+ writeContract(args: {
430
+ address: Address;
431
+ abi: readonly unknown[];
432
+ functionName: string;
433
+ args: readonly unknown[];
434
+ }): Promise<Hex>;
435
+ sendTransaction(args: {
436
+ to: Address;
437
+ data: Hex;
438
+ }): Promise<Hex>;
439
+ waitForTransactionReceipt(args: {
440
+ hash: Hex;
441
+ }): Promise<{
442
+ status: string;
443
+ }>;
444
+ getCode(args: {
445
+ address: Address;
446
+ }): Promise<Hex | undefined>;
447
+ };
448
+ /**
449
+ * Converts a signer to a ClientEvmSigner
450
+ *
451
+ * @param signer - The signer to convert to a ClientEvmSigner
452
+ * @returns The converted signer
453
+ */
454
+ declare function toClientEvmSigner(signer: ClientEvmSigner): ClientEvmSigner;
455
+ /**
456
+ * Converts a viem client with single address to a FacilitatorEvmSigner
457
+ * Wraps the single address in a getAddresses() function for compatibility
458
+ *
459
+ * @param client - The client to convert (must have 'address' property)
460
+ * @returns FacilitatorEvmSigner with getAddresses() support
461
+ */
462
+ declare function toFacilitatorEvmSigner(client: Omit<FacilitatorEvmSigner, "getAddresses"> & {
463
+ address: Address;
464
+ }): FacilitatorEvmSigner;
465
+
466
+ /**
467
+ * Token Configuration for T402 EVM Payments
468
+ *
469
+ * This module provides comprehensive token definitions including:
470
+ * - USDT0 (Tether's new omnichain token with EIP-3009 support)
471
+ * - USDC (USD Coin with EIP-3009 support)
472
+ * - Legacy tokens configuration
473
+ *
474
+ * No external dependencies - uses local Address type.
475
+ */
476
+
477
+ /**
478
+ * Token type classification for payment scheme selection
479
+ */
480
+ type TokenType = "eip3009" | "legacy";
481
+ /**
482
+ * Token configuration with EIP-712 domain parameters
483
+ */
484
+ interface TokenConfig {
485
+ /** Token contract address */
486
+ address: Address;
487
+ /** Token symbol (e.g., "USDT0", "USDC") */
488
+ symbol: string;
489
+ /** EIP-712 domain name for signing */
490
+ name: string;
491
+ /** EIP-712 domain version for signing */
492
+ version: string;
493
+ /** Number of decimal places */
494
+ decimals: number;
495
+ /** Token type for scheme selection */
496
+ tokenType: TokenType;
497
+ /** Payment priority (lower = higher priority) */
498
+ priority: number;
499
+ }
500
+ /**
501
+ * Network token registry mapping network -> symbol -> config
502
+ */
503
+ type NetworkTokenRegistry = Record<string, Record<string, TokenConfig>>;
504
+ /**
505
+ * USDT0 Contract Addresses by Network
506
+ * Source: https://docs.tether.io/usdt0/integration-guide/deployed-contracts
507
+ *
508
+ * USDT0 is Tether's new omnichain token using LayerZero OFT standard.
509
+ * Key features:
510
+ * - Supports EIP-3009 transferWithAuthorization (gasless transfers)
511
+ * - Supports EIP-2612 permit
512
+ * - Native cross-chain via LayerZero
513
+ */
514
+ declare const USDT0_ADDRESSES: Record<string, Address>;
515
+ /**
516
+ * USDC Contract Addresses by Network
517
+ * Native USDC with EIP-3009 support
518
+ */
519
+ declare const USDC_ADDRESSES: Record<string, Address>;
520
+ /**
521
+ * Traditional USDT Addresses (Legacy - no EIP-3009 support)
522
+ * These require the approve + transferFrom pattern
523
+ */
524
+ declare const USDT_LEGACY_ADDRESSES: Record<string, Address>;
525
+ /**
526
+ * Complete token registry with all supported tokens per network
527
+ */
528
+ declare const TOKEN_REGISTRY: NetworkTokenRegistry;
529
+ /**
530
+ * Token priority for payment method selection
531
+ * Lower number = higher priority
532
+ */
533
+ declare const TOKEN_PRIORITY: Record<string, number>;
534
+ /**
535
+ * Get token configuration for a specific token on a network
536
+ */
537
+ declare function getTokenConfig(network: string, symbol: string): TokenConfig | undefined;
538
+ /**
539
+ * Get all tokens available on a network
540
+ */
541
+ declare function getNetworkTokens(network: string): TokenConfig[];
542
+ /**
543
+ * Get the default/preferred token for a network
544
+ * Prefers USDT0 > USDC > others based on priority
545
+ */
546
+ declare function getDefaultToken(network: string): TokenConfig | undefined;
547
+ /**
548
+ * Get token by contract address on a network
549
+ */
550
+ declare function getTokenByAddress(network: string, address: Address): TokenConfig | undefined;
551
+ /**
552
+ * Check if a token supports EIP-3009 (gasless transfers)
553
+ */
554
+ declare function supportsEIP3009(network: string, symbol: string): boolean;
555
+ /**
556
+ * Get all networks that support a specific token
557
+ */
558
+ declare function getNetworksForToken(symbol: string): string[];
559
+ /**
560
+ * Get USDT0 networks (primary T402 token)
561
+ */
562
+ declare function getUsdt0Networks(): string[];
563
+ /**
564
+ * EIP-712 domain configuration for a token
565
+ */
566
+ declare function getEIP712Domain(network: string, tokenAddress: Address, chainId: number): {
567
+ name: string;
568
+ version: string;
569
+ chainId: number;
570
+ verifyingContract: Address;
571
+ } | undefined;
572
+
573
+ /**
574
+ * EVM Utilities
575
+ *
576
+ * Utility functions for T402 EVM payments.
577
+ * No external dependencies - uses local implementations.
578
+ */
579
+
580
+ /**
581
+ * Extract chain ID from network string (e.g., "base-sepolia" -> 84532)
582
+ * Used by v1 implementations
583
+ *
584
+ * @param network - The network identifier
585
+ * @returns The numeric chain ID
586
+ */
587
+ declare function getEvmChainId(network: Network): number;
588
+ /**
589
+ * Create a random 32-byte nonce for authorization
590
+ *
591
+ * @returns A hex-encoded 32-byte nonce
592
+ */
593
+ declare function createNonce(): Hex;
594
+
595
+ export { type Address, type Bytes32, type ClientEvmSigner, type ExactEIP3009Payload, type ExactEvmPayloadV1, type ExactEvmPayloadV2, type ExactLegacyPayload, type FacilitatorEvmSigner, type Hex, type NetworkTokenRegistry, type PermitAuthorization, type PermitSignature, TOKEN_PRIORITY, TOKEN_REGISTRY, type TokenConfig, type TokenType, USDC_ADDRESSES, USDT0_ADDRESSES, USDT_LEGACY_ADDRESSES, type UptoEIP2612Payload, type UptoEIP2612PayloadCompact, type UptoEvmExtra, type UptoEvmPayloadV2, type UptoEvmSettlement, authorizationTypes, bytesToHex, createNonce, eip3009ABI, erc20LegacyABI, getDefaultToken, getEIP712Domain, getEvmChainId, getNetworkTokens, getNetworksForToken, getTokenByAddress, getTokenConfig, getUsdt0Networks, hexToBytes, isUptoEIP2612Payload, legacyAuthorizationTypes, permitTypes, supportsEIP3009, toClientEvmSigner, toFacilitatorEvmSigner };