@t402/evm 2.2.0 → 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.
Files changed (83) hide show
  1. package/dist/cjs/exact/client/index.d.ts +2 -2
  2. package/dist/cjs/exact/client/index.js +4 -2
  3. package/dist/cjs/exact/client/index.js.map +1 -1
  4. package/dist/cjs/exact/facilitator/index.d.ts +1 -1
  5. package/dist/cjs/exact/facilitator/index.js +40 -4
  6. package/dist/cjs/exact/facilitator/index.js.map +1 -1
  7. package/dist/cjs/exact/server/index.d.ts +1 -1
  8. package/dist/cjs/exact/server/index.js +301 -33
  9. package/dist/cjs/exact/server/index.js.map +1 -1
  10. package/dist/cjs/exact/v1/client/index.d.ts +1 -1
  11. package/dist/cjs/exact/v1/client/index.js +3 -1
  12. package/dist/cjs/exact/v1/client/index.js.map +1 -1
  13. package/dist/cjs/exact/v1/facilitator/index.d.ts +1 -1
  14. package/dist/cjs/exact/v1/facilitator/index.js +21 -2
  15. package/dist/cjs/exact/v1/facilitator/index.js.map +1 -1
  16. package/dist/cjs/index.d.ts +606 -352
  17. package/dist/cjs/index.js +1436 -268
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/{esm/scheme-yqGaK9rK.d.mts → cjs/scheme-B4rXSKCN.d.ts} +18 -16
  20. package/dist/cjs/scheme-CIar5W2B.d.ts +200 -0
  21. package/dist/cjs/{scheme-OojTBKAz.d.ts → scheme-CjijeY7y.d.ts} +1 -1
  22. package/dist/{esm/signer-BkcAzwYi.d.mts → cjs/signer-DcavxxZt.d.ts} +1 -18
  23. package/dist/cjs/upto/client/index.d.ts +61 -0
  24. package/dist/cjs/upto/client/index.js +154 -0
  25. package/dist/cjs/upto/client/index.js.map +1 -0
  26. package/dist/cjs/upto/index.d.ts +111 -0
  27. package/dist/cjs/upto/index.js +1030 -0
  28. package/dist/cjs/upto/index.js.map +1 -0
  29. package/dist/cjs/v1/index.d.ts +1 -1
  30. package/dist/cjs/v1/index.js +3 -1
  31. package/dist/cjs/v1/index.js.map +1 -1
  32. package/dist/esm/{chunk-ACDQ5QNT.mjs → chunk-4FBTQTNM.mjs} +27 -5
  33. package/dist/esm/chunk-4FBTQTNM.mjs.map +1 -0
  34. package/dist/esm/chunk-IWSDEZKI.mjs +477 -0
  35. package/dist/esm/chunk-IWSDEZKI.mjs.map +1 -0
  36. package/dist/esm/{chunk-LGSG73NJ.mjs → chunk-LM5RZBVP.mjs} +9 -4
  37. package/dist/esm/{chunk-LGSG73NJ.mjs.map → chunk-LM5RZBVP.mjs.map} +1 -1
  38. package/dist/esm/chunk-NSSMTXJJ.mjs +8 -0
  39. package/dist/esm/chunk-NSSMTXJJ.mjs.map +1 -0
  40. package/dist/esm/chunk-SJ52GTJJ.mjs +411 -0
  41. package/dist/esm/chunk-SJ52GTJJ.mjs.map +1 -0
  42. package/dist/esm/chunk-SURTCHSX.mjs +129 -0
  43. package/dist/esm/chunk-SURTCHSX.mjs.map +1 -0
  44. package/dist/esm/chunk-SYVPLXYV.mjs +26 -0
  45. package/dist/esm/chunk-SYVPLXYV.mjs.map +1 -0
  46. package/dist/esm/{chunk-XYKAO6KJ.mjs → chunk-Y4U7Q543.mjs} +2 -25
  47. package/dist/esm/chunk-Y4U7Q543.mjs.map +1 -0
  48. package/dist/esm/{chunk-JBWWBRYY.mjs → chunk-ZWEYARER.mjs} +9 -4
  49. package/dist/esm/{chunk-JBWWBRYY.mjs.map → chunk-ZWEYARER.mjs.map} +1 -1
  50. package/dist/esm/exact/client/index.d.mts +2 -2
  51. package/dist/esm/exact/client/index.mjs +6 -4
  52. package/dist/esm/exact/client/index.mjs.map +1 -1
  53. package/dist/esm/exact/facilitator/index.d.mts +1 -1
  54. package/dist/esm/exact/facilitator/index.mjs +26 -5
  55. package/dist/esm/exact/facilitator/index.mjs.map +1 -1
  56. package/dist/esm/exact/server/index.d.mts +1 -1
  57. package/dist/esm/exact/server/index.mjs +29 -30
  58. package/dist/esm/exact/server/index.mjs.map +1 -1
  59. package/dist/esm/exact/v1/client/index.d.mts +1 -1
  60. package/dist/esm/exact/v1/client/index.mjs +4 -2
  61. package/dist/esm/exact/v1/facilitator/index.d.mts +1 -1
  62. package/dist/esm/exact/v1/facilitator/index.mjs +4 -2
  63. package/dist/esm/index.d.mts +606 -352
  64. package/dist/esm/index.mjs +626 -138
  65. package/dist/esm/index.mjs.map +1 -1
  66. package/dist/{cjs/scheme-yqGaK9rK.d.ts → esm/scheme-B4rXSKCN.d.mts} +18 -16
  67. package/dist/esm/scheme-DATfd6oM.d.mts +200 -0
  68. package/dist/esm/{scheme-D4mOqq9l.d.mts → scheme-Ddb0dG_F.d.mts} +1 -1
  69. package/dist/{cjs/signer-BkcAzwYi.d.ts → esm/signer-DcavxxZt.d.mts} +1 -18
  70. package/dist/esm/upto/client/index.d.mts +61 -0
  71. package/dist/esm/upto/client/index.mjs +11 -0
  72. package/dist/esm/upto/client/index.mjs.map +1 -0
  73. package/dist/esm/upto/index.d.mts +111 -0
  74. package/dist/esm/upto/index.mjs +26 -0
  75. package/dist/esm/upto/index.mjs.map +1 -0
  76. package/dist/esm/v1/index.d.mts +1 -1
  77. package/dist/esm/v1/index.mjs +5 -3
  78. package/package.json +30 -6
  79. package/dist/cjs/scheme-C6uD7PdY.d.ts +0 -130
  80. package/dist/esm/chunk-ACDQ5QNT.mjs.map +0 -1
  81. package/dist/esm/chunk-OEXW2OK2.mjs +0 -251
  82. package/dist/esm/chunk-OEXW2OK2.mjs.map +0 -1
  83. package/dist/esm/chunk-XYKAO6KJ.mjs.map +0 -1
@@ -15,7 +15,25 @@ declare class ExactEvmScheme implements SchemeNetworkServer {
15
15
  readonly scheme = "exact";
16
16
  private moneyParsers;
17
17
  private config;
18
+ /**
19
+ * Creates a new ExactEvmScheme instance.
20
+ *
21
+ * @param config - Optional configuration options for the scheme
22
+ */
18
23
  constructor(config?: ExactEvmSchemeConfig);
24
+ /**
25
+ * Get all supported networks
26
+ *
27
+ * @returns Array of network identifiers in CAIP-2 format
28
+ */
29
+ static getSupportedNetworks(): string[];
30
+ /**
31
+ * Check if a network is supported
32
+ *
33
+ * @param network - The network identifier to check
34
+ * @returns True if the network is supported
35
+ */
36
+ static isNetworkSupported(network: string): boolean;
19
37
  /**
20
38
  * Register a custom money parser in the parser chain.
21
39
  * Multiple parsers can be registered - they will be tried in registration order.
@@ -101,14 +119,6 @@ declare class ExactEvmScheme implements SchemeNetworkServer {
101
119
  * @returns The asset information including address, name, version, and decimals
102
120
  */
103
121
  private getDefaultAsset;
104
- /**
105
- * Get asset info for a given symbol on a network
106
- *
107
- * @param symbol - The asset symbol (e.g., "USDT0", "USDC", "USDT")
108
- * @param network - The network to use
109
- * @returns The token configuration
110
- */
111
- private getAssetInfo;
112
122
  /**
113
123
  * Get the number of decimals for the asset on a network
114
124
  *
@@ -117,14 +127,6 @@ declare class ExactEvmScheme implements SchemeNetworkServer {
117
127
  * @returns The number of decimals for the asset
118
128
  */
119
129
  private getAssetDecimals;
120
- /**
121
- * Get all supported networks
122
- */
123
- static getSupportedNetworks(): string[];
124
- /**
125
- * Check if a network is supported
126
- */
127
- static isNetworkSupported(network: string): boolean;
128
130
  }
129
131
 
130
132
  export { ExactEvmScheme as E, type ExactEvmSchemeConfig as a };
@@ -0,0 +1,200 @@
1
+ import { SchemeNetworkServer, MoneyParser, Price, Network, AssetAmount, PaymentRequirements, SchemeNetworkFacilitator, PaymentPayload, VerifyResponse, SettleResponse } from '@t402/core/types';
2
+ import { F as FacilitatorEvmSigner } from './signer-DcavxxZt.mjs';
3
+
4
+ /**
5
+ * Configuration options for UptoEvmServerScheme
6
+ */
7
+ interface UptoEvmServerSchemeConfig {
8
+ /** Preferred token symbol (e.g., "USDT0", "USDC"). Defaults to network's highest priority token. */
9
+ preferredToken?: string;
10
+ /** Router contract address for upto payments. If not set, payTo address is used as spender. */
11
+ routerAddress?: string;
12
+ /** Default billing unit */
13
+ defaultUnit?: string;
14
+ /** Default unit price in smallest denomination */
15
+ defaultUnitPrice?: string;
16
+ }
17
+ /**
18
+ * EVM server implementation for the Up-To payment scheme.
19
+ *
20
+ * Enables usage-based billing by creating payment requirements
21
+ * that authorize up to a maximum amount, with actual settlement
22
+ * determined by usage.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import { UptoEvmServerScheme } from "@t402/evm/upto/server";
27
+ *
28
+ * const scheme = new UptoEvmServerScheme({
29
+ * routerAddress: "0x...", // T402UptoRouter contract
30
+ * defaultUnit: "token",
31
+ * defaultUnitPrice: "100", // $0.0001 per token
32
+ * });
33
+ *
34
+ * server.registerScheme("eip155:8453", scheme);
35
+ * ```
36
+ */
37
+ declare class UptoEvmServerScheme implements SchemeNetworkServer {
38
+ readonly scheme = "upto";
39
+ private moneyParsers;
40
+ private config;
41
+ /**
42
+ * Creates a new UptoEvmServerScheme instance.
43
+ *
44
+ * @param config - Optional configuration options for the scheme
45
+ */
46
+ constructor(config?: UptoEvmServerSchemeConfig);
47
+ /**
48
+ * Get all supported networks
49
+ *
50
+ * @returns Array of network identifiers in CAIP-2 format
51
+ */
52
+ static getSupportedNetworks(): string[];
53
+ /**
54
+ * Check if a network is supported
55
+ *
56
+ * @param network - The network identifier to check
57
+ * @returns True if the network is supported
58
+ */
59
+ static isNetworkSupported(network: string): boolean;
60
+ /**
61
+ * Register a custom money parser in the parser chain.
62
+ *
63
+ * @param parser - Custom function to convert amount to AssetAmount
64
+ * @returns The server instance for chaining
65
+ */
66
+ registerMoneyParser(parser: MoneyParser): UptoEvmServerScheme;
67
+ /**
68
+ * Parses a price into an asset amount for maxAmount.
69
+ *
70
+ * @param price - The price to parse (represents maxAmount)
71
+ * @param network - The network to use
72
+ * @returns Promise resolving to the parsed asset amount
73
+ */
74
+ parsePrice(price: Price, network: Network): Promise<AssetAmount>;
75
+ /**
76
+ * Enhance payment requirements for the upto scheme.
77
+ *
78
+ * @param paymentRequirements - Base payment requirements
79
+ * @param supportedKind - The supported kind from facilitator
80
+ * @param supportedKind.t402Version - T402 protocol version
81
+ * @param supportedKind.scheme - Payment scheme
82
+ * @param supportedKind.network - Network identifier
83
+ * @param supportedKind.extra - Extra configuration
84
+ * @param facilitatorExtensions - Extensions supported by the facilitator
85
+ * @returns Enhanced payment requirements for upto scheme
86
+ */
87
+ enhancePaymentRequirements(paymentRequirements: PaymentRequirements, supportedKind: {
88
+ t402Version: number;
89
+ scheme: string;
90
+ network: Network;
91
+ extra?: Record<string, unknown>;
92
+ }, facilitatorExtensions: string[]): Promise<PaymentRequirements>;
93
+ /**
94
+ * Get the preferred token for a network.
95
+ *
96
+ * @param network - The network identifier
97
+ * @returns Token configuration
98
+ * @throws Error if no token is found for the network
99
+ */
100
+ private getPreferredToken;
101
+ /**
102
+ * Parse price to decimal value.
103
+ *
104
+ * @param price - Price string or number
105
+ * @returns Decimal amount
106
+ */
107
+ private parseToDecimal;
108
+ }
109
+ /**
110
+ * Factory function to create an UptoEvmServerScheme.
111
+ *
112
+ * @param config - Configuration options
113
+ * @returns A new UptoEvmServerScheme instance
114
+ */
115
+ declare function createUptoEvmServerScheme(config?: UptoEvmServerSchemeConfig): UptoEvmServerScheme;
116
+
117
+ /**
118
+ * Configuration for UptoEvmFacilitatorScheme
119
+ */
120
+ interface UptoEvmFacilitatorSchemeConfig {
121
+ /**
122
+ * Router contract addresses by network (CAIP-2 format)
123
+ *
124
+ * @example { "eip155:8453": "0x..." }
125
+ */
126
+ routerAddresses?: Record<string, string>;
127
+ }
128
+ /**
129
+ * EVM facilitator implementation for the Up-To payment scheme.
130
+ *
131
+ * Handles verification and settlement of upto payments using
132
+ * the T402UptoRouter contract.
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * import { UptoEvmFacilitatorScheme } from "@t402/evm/upto/facilitator";
137
+ *
138
+ * const facilitator = new UptoEvmFacilitatorScheme(signer, {
139
+ * routerAddresses: {
140
+ * "eip155:8453": "0x...", // Base mainnet router
141
+ * "eip155:84532": "0x...", // Base Sepolia router
142
+ * },
143
+ * });
144
+ *
145
+ * facilitatorServer.registerScheme(facilitator);
146
+ * ```
147
+ */
148
+ declare class UptoEvmFacilitatorScheme implements SchemeNetworkFacilitator {
149
+ private readonly signer;
150
+ readonly scheme = "upto";
151
+ readonly caipFamily = "eip155:*";
152
+ private readonly config;
153
+ /**
154
+ * Creates a new UptoEvmFacilitatorScheme instance.
155
+ *
156
+ * @param signer - The EVM signer for facilitator operations
157
+ * @param config - Optional configuration
158
+ */
159
+ constructor(signer: FacilitatorEvmSigner, config?: UptoEvmFacilitatorSchemeConfig);
160
+ /**
161
+ * Get mechanism-specific extra data for the supported kinds endpoint.
162
+ *
163
+ * @param network - The network identifier
164
+ * @returns Extra data including router address if configured
165
+ */
166
+ getExtra(network: string): Record<string, unknown> | undefined;
167
+ /**
168
+ * Get signer addresses used by this facilitator.
169
+ *
170
+ * @param _ - The network identifier (unused for EVM)
171
+ * @returns Array of facilitator wallet addresses
172
+ */
173
+ getSigners(_: string): string[];
174
+ /**
175
+ * Verifies an upto payment payload.
176
+ *
177
+ * @param payload - The payment payload to verify
178
+ * @param requirements - The payment requirements
179
+ * @returns Promise resolving to verification response
180
+ */
181
+ verify(payload: PaymentPayload, requirements: PaymentRequirements): Promise<VerifyResponse>;
182
+ /**
183
+ * Settles an upto payment by calling the T402UptoRouter contract.
184
+ *
185
+ * @param payload - The verified payment payload
186
+ * @param requirements - The payment requirements
187
+ * @returns Promise resolving to settlement response
188
+ */
189
+ settle(payload: PaymentPayload, requirements: PaymentRequirements): Promise<SettleResponse>;
190
+ }
191
+ /**
192
+ * Factory function to create an UptoEvmFacilitatorScheme.
193
+ *
194
+ * @param signer - The EVM signer
195
+ * @param config - Configuration options
196
+ * @returns A new UptoEvmFacilitatorScheme instance
197
+ */
198
+ declare function createUptoEvmFacilitatorScheme(signer: FacilitatorEvmSigner, config?: UptoEvmFacilitatorSchemeConfig): UptoEvmFacilitatorScheme;
199
+
200
+ export { UptoEvmServerScheme as U, type UptoEvmServerSchemeConfig as a, UptoEvmFacilitatorScheme as b, createUptoEvmServerScheme as c, createUptoEvmFacilitatorScheme as d, type UptoEvmFacilitatorSchemeConfig as e };
@@ -1,5 +1,5 @@
1
1
  import { SchemeNetworkClient, PaymentRequirements, PaymentPayload } from '@t402/core/types';
2
- import { C as ClientEvmSigner } from './signer-BkcAzwYi.mjs';
2
+ import { C as ClientEvmSigner } from './signer-DcavxxZt.mjs';
3
3
 
4
4
  /**
5
5
  * EVM client implementation for the Exact payment scheme.
@@ -58,22 +58,5 @@ type FacilitatorEvmSigner = {
58
58
  address: `0x${string}`;
59
59
  }): Promise<`0x${string}` | undefined>;
60
60
  };
61
- /**
62
- * Converts a signer to a ClientEvmSigner
63
- *
64
- * @param signer - The signer to convert to a ClientEvmSigner
65
- * @returns The converted signer
66
- */
67
- declare function toClientEvmSigner(signer: ClientEvmSigner): ClientEvmSigner;
68
- /**
69
- * Converts a viem client with single address to a FacilitatorEvmSigner
70
- * Wraps the single address in a getAddresses() function for compatibility
71
- *
72
- * @param client - The client to convert (must have 'address' property)
73
- * @returns FacilitatorEvmSigner with getAddresses() support
74
- */
75
- declare function toFacilitatorEvmSigner(client: Omit<FacilitatorEvmSigner, "getAddresses"> & {
76
- address: `0x${string}`;
77
- }): FacilitatorEvmSigner;
78
61
 
79
- export { type ClientEvmSigner as C, type FacilitatorEvmSigner as F, toFacilitatorEvmSigner as a, toClientEvmSigner as t };
62
+ export type { ClientEvmSigner as C, FacilitatorEvmSigner as F };
@@ -0,0 +1,61 @@
1
+ import { SchemeNetworkClient, PaymentRequirements, PaymentPayload } from '@t402/core/types';
2
+ import { C as ClientEvmSigner } from '../../signer-DcavxxZt.mjs';
3
+
4
+ /**
5
+ * EVM client implementation for the Up-To payment scheme.
6
+ *
7
+ * Uses EIP-2612 Permit to authorize up to a maximum amount,
8
+ * enabling usage-based billing where the actual settlement
9
+ * amount is determined by the server based on usage.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { UptoEvmScheme } from "@t402/evm/upto/client";
14
+ * import { privateKeyToAccount } from "viem/accounts";
15
+ *
16
+ * const signer = privateKeyToAccount(privateKey);
17
+ * const scheme = new UptoEvmScheme(signer);
18
+ *
19
+ * // Client will register this with the t402 client
20
+ * client.registerScheme("eip155:8453", scheme);
21
+ * ```
22
+ */
23
+ declare class UptoEvmScheme implements SchemeNetworkClient {
24
+ private readonly signer;
25
+ readonly scheme = "upto";
26
+ /**
27
+ * Creates a new UptoEvmScheme instance.
28
+ *
29
+ * @param signer - The EVM signer for client operations
30
+ */
31
+ constructor(signer: ClientEvmSigner);
32
+ /**
33
+ * Creates a payment payload for the Up-To scheme.
34
+ *
35
+ * The payload contains an EIP-2612 permit signature authorizing
36
+ * the router contract (or facilitator) to transfer up to the
37
+ * specified maximum amount.
38
+ *
39
+ * @param t402Version - The t402 protocol version
40
+ * @param paymentRequirements - The payment requirements (must include maxAmount)
41
+ * @returns Promise resolving to a payment payload
42
+ */
43
+ createPaymentPayload(t402Version: number, paymentRequirements: PaymentRequirements): Promise<Pick<PaymentPayload, "t402Version" | "payload">>;
44
+ /**
45
+ * Sign the EIP-2612 permit using EIP-712
46
+ *
47
+ * @param authorization - The permit authorization to sign
48
+ * @param requirements - The payment requirements
49
+ * @returns Promise resolving to the signature components
50
+ */
51
+ private signPermit;
52
+ }
53
+ /**
54
+ * Factory function to create an UptoEvmScheme.
55
+ *
56
+ * @param signer - The EVM signer
57
+ * @returns A new UptoEvmScheme instance
58
+ */
59
+ declare function createUptoEvmScheme(signer: ClientEvmSigner): UptoEvmScheme;
60
+
61
+ export { UptoEvmScheme, createUptoEvmScheme };
@@ -0,0 +1,11 @@
1
+ import {
2
+ UptoEvmScheme,
3
+ createUptoEvmScheme
4
+ } from "../../chunk-SURTCHSX.mjs";
5
+ import "../../chunk-SYVPLXYV.mjs";
6
+ import "../../chunk-NSSMTXJJ.mjs";
7
+ export {
8
+ UptoEvmScheme,
9
+ createUptoEvmScheme
10
+ };
11
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,111 @@
1
+ export { UptoEvmScheme, createUptoEvmScheme } from './client/index.mjs';
2
+ export { b as UptoEvmFacilitatorScheme, e as UptoEvmFacilitatorSchemeConfig, U as UptoEvmServerScheme, a as UptoEvmServerSchemeConfig, d as createUptoEvmFacilitatorScheme, c as createUptoEvmServerScheme } from '../scheme-DATfd6oM.mjs';
3
+ import '@t402/core/types';
4
+ import '../signer-DcavxxZt.mjs';
5
+
6
+ /**
7
+ * EIP-2612 Permit signature components
8
+ */
9
+ type PermitSignature = {
10
+ v: number;
11
+ r: `0x${string}`;
12
+ s: `0x${string}`;
13
+ };
14
+ /**
15
+ * EIP-2612 Permit authorization parameters
16
+ */
17
+ type PermitAuthorization = {
18
+ /** Token owner address */
19
+ owner: `0x${string}`;
20
+ /** Spender address (router contract or facilitator) */
21
+ spender: `0x${string}`;
22
+ /** Maximum authorized value */
23
+ value: string;
24
+ /** Permit deadline (unix timestamp) */
25
+ deadline: string;
26
+ /** Permit nonce from token contract */
27
+ nonce: number;
28
+ };
29
+ /**
30
+ * Payload for upto scheme using EIP-2612 Permit
31
+ */
32
+ type UptoEIP2612Payload = {
33
+ /** EIP-2612 permit signature */
34
+ signature: PermitSignature;
35
+ /** Permit authorization parameters */
36
+ authorization: PermitAuthorization;
37
+ /** Unique payment nonce (separate from permit nonce) */
38
+ paymentNonce: `0x${string}`;
39
+ };
40
+ /**
41
+ * Compact payload with combined signature bytes
42
+ */
43
+ type UptoEIP2612PayloadCompact = {
44
+ /** Combined permit signature (65 bytes) */
45
+ signature: `0x${string}`;
46
+ /** Permit authorization parameters */
47
+ authorization: PermitAuthorization;
48
+ /** Unique payment nonce */
49
+ paymentNonce: `0x${string}`;
50
+ };
51
+ type UptoEvmPayloadV2 = UptoEIP2612Payload | UptoEIP2612PayloadCompact;
52
+ /**
53
+ * Extra fields for upto scheme requirements on EVM
54
+ */
55
+ type UptoEvmExtra = {
56
+ /** EIP-712 domain name (from token contract) */
57
+ name: string;
58
+ /** EIP-712 domain version */
59
+ version: string;
60
+ /** Router contract address for settlement */
61
+ routerAddress?: `0x${string}`;
62
+ /** Billing unit */
63
+ unit?: string;
64
+ /** Price per unit */
65
+ unitPrice?: string;
66
+ };
67
+ /**
68
+ * Settlement data for upto scheme
69
+ */
70
+ type UptoEvmSettlement = {
71
+ /** Actual amount to settle (must be <= maxAmount) */
72
+ settleAmount: string;
73
+ /** Usage details for auditing */
74
+ usageDetails?: {
75
+ unitsConsumed?: number;
76
+ unitPrice?: string;
77
+ unitType?: string;
78
+ startTime?: number;
79
+ endTime?: number;
80
+ };
81
+ };
82
+ /**
83
+ * EIP-712 typed data for EIP-2612 Permit
84
+ */
85
+ declare const permitTypes: {
86
+ readonly Permit: readonly [{
87
+ readonly name: "owner";
88
+ readonly type: "address";
89
+ }, {
90
+ readonly name: "spender";
91
+ readonly type: "address";
92
+ }, {
93
+ readonly name: "value";
94
+ readonly type: "uint256";
95
+ }, {
96
+ readonly name: "nonce";
97
+ readonly type: "uint256";
98
+ }, {
99
+ readonly name: "deadline";
100
+ readonly type: "uint256";
101
+ }];
102
+ };
103
+ /**
104
+ * Type guard for UptoEIP2612Payload
105
+ *
106
+ * @param payload - The payload to check
107
+ * @returns True if the payload is a valid UptoEIP2612Payload
108
+ */
109
+ declare function isUptoEIP2612Payload(payload: unknown): payload is UptoEIP2612Payload;
110
+
111
+ export { type PermitAuthorization, type PermitSignature, type UptoEIP2612Payload, type UptoEIP2612PayloadCompact, type UptoEvmExtra, type UptoEvmPayloadV2, type UptoEvmSettlement, isUptoEIP2612Payload, permitTypes };
@@ -0,0 +1,26 @@
1
+ import {
2
+ UptoEvmFacilitatorScheme,
3
+ UptoEvmServerScheme,
4
+ createUptoEvmFacilitatorScheme,
5
+ createUptoEvmServerScheme
6
+ } from "../chunk-SJ52GTJJ.mjs";
7
+ import "../chunk-IWSDEZKI.mjs";
8
+ import {
9
+ UptoEvmScheme,
10
+ createUptoEvmScheme,
11
+ isUptoEIP2612Payload,
12
+ permitTypes
13
+ } from "../chunk-SURTCHSX.mjs";
14
+ import "../chunk-SYVPLXYV.mjs";
15
+ import "../chunk-NSSMTXJJ.mjs";
16
+ export {
17
+ UptoEvmFacilitatorScheme,
18
+ UptoEvmScheme,
19
+ UptoEvmServerScheme,
20
+ createUptoEvmFacilitatorScheme,
21
+ createUptoEvmScheme,
22
+ createUptoEvmServerScheme,
23
+ isUptoEIP2612Payload,
24
+ permitTypes
25
+ };
26
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,6 +1,6 @@
1
1
  export { ExactEvmSchemeV1 } from '../exact/v1/client/index.mjs';
2
2
  import '@t402/core/types';
3
- import '../signer-BkcAzwYi.mjs';
3
+ import '../signer-DcavxxZt.mjs';
4
4
 
5
5
  declare const NETWORKS: string[];
6
6
 
@@ -3,9 +3,11 @@ import {
3
3
  } from "../chunk-QLXM7BIB.mjs";
4
4
  import {
5
5
  ExactEvmSchemeV1
6
- } from "../chunk-JBWWBRYY.mjs";
7
- import "../chunk-ACDQ5QNT.mjs";
8
- import "../chunk-XYKAO6KJ.mjs";
6
+ } from "../chunk-ZWEYARER.mjs";
7
+ import "../chunk-4FBTQTNM.mjs";
8
+ import "../chunk-Y4U7Q543.mjs";
9
+ import "../chunk-SYVPLXYV.mjs";
10
+ import "../chunk-NSSMTXJJ.mjs";
9
11
  export {
10
12
  ExactEvmSchemeV1,
11
13
  NETWORKS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t402/evm",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "main": "./dist/cjs/index.js",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/cjs/index.d.ts",
@@ -24,18 +24,22 @@
24
24
  "eslint-plugin-import": "^2.31.0",
25
25
  "eslint-plugin-jsdoc": "^50.6.9",
26
26
  "eslint-plugin-prettier": "^5.2.6",
27
+ "glob": "^13.0.0",
27
28
  "prettier": "3.5.2",
28
29
  "tsup": "^8.4.0",
29
- "tsx": "^4.19.2",
30
+ "tsx": "^4.21.0",
30
31
  "typescript": "^5.7.3",
31
- "vite": "^6.2.6",
32
+ "vite": "^7.3.1",
32
33
  "vite-tsconfig-paths": "^5.1.4",
33
- "vitest": "^3.0.5"
34
+ "vitest": "^3.2.4"
34
35
  },
35
36
  "dependencies": {
36
- "viem": "^2.39.3",
37
37
  "zod": "^3.24.2",
38
- "@t402/core": "2.0.0"
38
+ "@t402/core": "2.3.0",
39
+ "@t402/evm-core": "2.3.0"
40
+ },
41
+ "peerDependencies": {
42
+ "viem": "^2.0.0"
39
43
  },
40
44
  "exports": {
41
45
  ".": {
@@ -107,6 +111,26 @@
107
111
  "types": "./dist/cjs/exact/v1/facilitator/index.d.ts",
108
112
  "default": "./dist/cjs/exact/v1/facilitator/index.js"
109
113
  }
114
+ },
115
+ "./upto": {
116
+ "import": {
117
+ "types": "./dist/esm/upto/index.d.mts",
118
+ "default": "./dist/esm/upto/index.mjs"
119
+ },
120
+ "require": {
121
+ "types": "./dist/cjs/upto/index.d.ts",
122
+ "default": "./dist/cjs/upto/index.js"
123
+ }
124
+ },
125
+ "./upto/client": {
126
+ "import": {
127
+ "types": "./dist/esm/upto/client/index.d.mts",
128
+ "default": "./dist/esm/upto/client/index.mjs"
129
+ },
130
+ "require": {
131
+ "types": "./dist/cjs/upto/client/index.d.ts",
132
+ "default": "./dist/cjs/upto/client/index.js"
133
+ }
110
134
  }
111
135
  },
112
136
  "files": [