@t402/evm 2.2.0 → 2.3.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.
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.js';
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.js';
2
+ import { C as ClientEvmSigner } from './signer-DcavxxZt.js';
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.js';
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,154 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
+
22
+ // src/upto/client/index.ts
23
+ var client_exports = {};
24
+ __export(client_exports, {
25
+ UptoEvmScheme: () => UptoEvmScheme,
26
+ createUptoEvmScheme: () => createUptoEvmScheme
27
+ });
28
+ module.exports = __toCommonJS(client_exports);
29
+
30
+ // src/upto/client/scheme.ts
31
+ var import_viem2 = require("viem");
32
+
33
+ // src/types.ts
34
+ var permitTypes = {
35
+ Permit: [
36
+ { name: "owner", type: "address" },
37
+ { name: "spender", type: "address" },
38
+ { name: "value", type: "uint256" },
39
+ { name: "nonce", type: "uint256" },
40
+ { name: "deadline", type: "uint256" }
41
+ ]
42
+ };
43
+
44
+ // src/utils.ts
45
+ var import_viem = require("viem");
46
+ function createNonce() {
47
+ const cryptoObj = typeof globalThis.crypto !== "undefined" ? globalThis.crypto : globalThis.crypto;
48
+ if (!cryptoObj) {
49
+ throw new Error("Crypto API not available");
50
+ }
51
+ return (0, import_viem.toHex)(cryptoObj.getRandomValues(new Uint8Array(32)));
52
+ }
53
+
54
+ // src/upto/client/scheme.ts
55
+ var UptoEvmScheme = class {
56
+ /**
57
+ * Creates a new UptoEvmScheme instance.
58
+ *
59
+ * @param signer - The EVM signer for client operations
60
+ */
61
+ constructor(signer) {
62
+ this.signer = signer;
63
+ __publicField(this, "scheme", "upto");
64
+ }
65
+ /**
66
+ * Creates a payment payload for the Up-To scheme.
67
+ *
68
+ * The payload contains an EIP-2612 permit signature authorizing
69
+ * the router contract (or facilitator) to transfer up to the
70
+ * specified maximum amount.
71
+ *
72
+ * @param t402Version - The t402 protocol version
73
+ * @param paymentRequirements - The payment requirements (must include maxAmount)
74
+ * @returns Promise resolving to a payment payload
75
+ */
76
+ async createPaymentPayload(t402Version, paymentRequirements) {
77
+ if (paymentRequirements.scheme !== "upto") {
78
+ throw new Error(`Expected upto scheme, got ${paymentRequirements.scheme}`);
79
+ }
80
+ const extra = paymentRequirements.extra;
81
+ if (!extra?.name || !extra?.version) {
82
+ throw new Error("EIP-712 domain parameters (name, version) are required for upto scheme");
83
+ }
84
+ const maxAmount = paymentRequirements.maxAmount;
85
+ if (!maxAmount) {
86
+ throw new Error("maxAmount is required for upto scheme");
87
+ }
88
+ const spender = extra.routerAddress ? (0, import_viem2.getAddress)(extra.routerAddress) : (0, import_viem2.getAddress)(paymentRequirements.payTo);
89
+ const now = Math.floor(Date.now() / 1e3);
90
+ const deadline = now + paymentRequirements.maxTimeoutSeconds;
91
+ const permitNonce = extra.permitNonce ?? 0;
92
+ const authorization = {
93
+ owner: this.signer.address,
94
+ spender,
95
+ value: maxAmount,
96
+ deadline: deadline.toString(),
97
+ nonce: permitNonce
98
+ };
99
+ const signature = await this.signPermit(authorization, paymentRequirements);
100
+ const paymentNonce = createNonce();
101
+ const payload = {
102
+ signature,
103
+ authorization,
104
+ paymentNonce
105
+ };
106
+ return {
107
+ t402Version,
108
+ payload
109
+ };
110
+ }
111
+ /**
112
+ * Sign the EIP-2612 permit using EIP-712
113
+ *
114
+ * @param authorization - The permit authorization to sign
115
+ * @param requirements - The payment requirements
116
+ * @returns Promise resolving to the signature components
117
+ */
118
+ async signPermit(authorization, requirements) {
119
+ const chainId = parseInt(requirements.network.split(":")[1]);
120
+ const extra = requirements.extra;
121
+ const domain = {
122
+ name: extra.name,
123
+ version: extra.version,
124
+ chainId,
125
+ verifyingContract: (0, import_viem2.getAddress)(requirements.asset)
126
+ };
127
+ const message = {
128
+ owner: (0, import_viem2.getAddress)(authorization.owner),
129
+ spender: (0, import_viem2.getAddress)(authorization.spender),
130
+ value: BigInt(authorization.value),
131
+ nonce: BigInt(authorization.nonce),
132
+ deadline: BigInt(authorization.deadline)
133
+ };
134
+ const signature = await this.signer.signTypedData({
135
+ domain,
136
+ types: permitTypes,
137
+ primaryType: "Permit",
138
+ message
139
+ });
140
+ const r = `0x${signature.slice(2, 66)}`;
141
+ const s = `0x${signature.slice(66, 130)}`;
142
+ const v = parseInt(signature.slice(130, 132), 16);
143
+ return { v, r, s };
144
+ }
145
+ };
146
+ function createUptoEvmScheme(signer) {
147
+ return new UptoEvmScheme(signer);
148
+ }
149
+ // Annotate the CommonJS export names for ESM import in node:
150
+ 0 && (module.exports = {
151
+ UptoEvmScheme,
152
+ createUptoEvmScheme
153
+ });
154
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/upto/client/index.ts","../../../../src/upto/client/scheme.ts","../../../../src/types.ts","../../../../src/utils.ts"],"sourcesContent":["/**\n * Up-To Scheme Client for EVM\n *\n * @example\n * ```typescript\n * import { UptoEvmScheme, createUptoEvmScheme } from \"@t402/evm/upto/client\";\n * import { privateKeyToAccount } from \"viem/accounts\";\n *\n * const signer = privateKeyToAccount(privateKey);\n * const scheme = createUptoEvmScheme(signer);\n *\n * // Register with t402 client\n * client.registerScheme(\"eip155:8453\", scheme);\n * ```\n */\nexport { UptoEvmScheme, createUptoEvmScheme } from \"./scheme\";\n","import { PaymentPayload, PaymentRequirements, SchemeNetworkClient } from \"@t402/core/types\";\nimport { getAddress } from \"viem\";\nimport { permitTypes, UptoEIP2612Payload, UptoEvmExtra } from \"../../types\";\nimport { ClientEvmSigner } from \"../../signer\";\nimport { createNonce } from \"../../utils\";\n\n/**\n * EVM client implementation for the Up-To payment scheme.\n *\n * Uses EIP-2612 Permit to authorize up to a maximum amount,\n * enabling usage-based billing where the actual settlement\n * amount is determined by the server based on usage.\n *\n * @example\n * ```typescript\n * import { UptoEvmScheme } from \"@t402/evm/upto/client\";\n * import { privateKeyToAccount } from \"viem/accounts\";\n *\n * const signer = privateKeyToAccount(privateKey);\n * const scheme = new UptoEvmScheme(signer);\n *\n * // Client will register this with the t402 client\n * client.registerScheme(\"eip155:8453\", scheme);\n * ```\n */\nexport class UptoEvmScheme implements SchemeNetworkClient {\n readonly scheme = \"upto\";\n\n /**\n * Creates a new UptoEvmScheme instance.\n *\n * @param signer - The EVM signer for client operations\n */\n constructor(private readonly signer: ClientEvmSigner) {}\n\n /**\n * Creates a payment payload for the Up-To scheme.\n *\n * The payload contains an EIP-2612 permit signature authorizing\n * the router contract (or facilitator) to transfer up to the\n * specified maximum amount.\n *\n * @param t402Version - The t402 protocol version\n * @param paymentRequirements - The payment requirements (must include maxAmount)\n * @returns Promise resolving to a payment payload\n */\n async createPaymentPayload(\n t402Version: number,\n paymentRequirements: PaymentRequirements,\n ): Promise<Pick<PaymentPayload, \"t402Version\" | \"payload\">> {\n // Validate that this is an upto requirement\n if (paymentRequirements.scheme !== \"upto\") {\n throw new Error(`Expected upto scheme, got ${paymentRequirements.scheme}`);\n }\n\n const extra = paymentRequirements.extra as UptoEvmExtra;\n if (!extra?.name || !extra?.version) {\n throw new Error(\"EIP-712 domain parameters (name, version) are required for upto scheme\");\n }\n\n // Get maxAmount from the requirements\n const maxAmount = (paymentRequirements as unknown as { maxAmount: string }).maxAmount;\n if (!maxAmount) {\n throw new Error(\"maxAmount is required for upto scheme\");\n }\n\n // Determine the spender (router contract or payTo address)\n const spender = extra.routerAddress\n ? getAddress(extra.routerAddress)\n : getAddress(paymentRequirements.payTo);\n\n // Calculate deadline\n const now = Math.floor(Date.now() / 1000);\n const deadline = now + paymentRequirements.maxTimeoutSeconds;\n\n // Get the permit nonce from the token contract\n // Note: In a real implementation, this would query the token contract\n // For now, we'll use 0 and expect the caller to provide it via extra\n const permitNonce = (extra as { permitNonce?: number }).permitNonce ?? 0;\n\n // Create the permit authorization\n const authorization: UptoEIP2612Payload[\"authorization\"] = {\n owner: this.signer.address,\n spender,\n value: maxAmount,\n deadline: deadline.toString(),\n nonce: permitNonce,\n };\n\n // Sign the permit\n const signature = await this.signPermit(authorization, paymentRequirements);\n\n // Create unique payment nonce\n const paymentNonce = createNonce();\n\n const payload: UptoEIP2612Payload = {\n signature,\n authorization,\n paymentNonce,\n };\n\n return {\n t402Version,\n payload,\n };\n }\n\n /**\n * Sign the EIP-2612 permit using EIP-712\n *\n * @param authorization - The permit authorization to sign\n * @param requirements - The payment requirements\n * @returns Promise resolving to the signature components\n */\n private async signPermit(\n authorization: UptoEIP2612Payload[\"authorization\"],\n requirements: PaymentRequirements,\n ): Promise<UptoEIP2612Payload[\"signature\"]> {\n const chainId = parseInt(requirements.network.split(\":\")[1]);\n const extra = requirements.extra as UptoEvmExtra;\n\n const domain = {\n name: extra.name,\n version: extra.version,\n chainId,\n verifyingContract: getAddress(requirements.asset),\n };\n\n const message = {\n owner: getAddress(authorization.owner),\n spender: getAddress(authorization.spender),\n value: BigInt(authorization.value),\n nonce: BigInt(authorization.nonce),\n deadline: BigInt(authorization.deadline),\n };\n\n // Sign with EIP-712\n const signature = await this.signer.signTypedData({\n domain,\n types: permitTypes,\n primaryType: \"Permit\",\n message,\n });\n\n // Parse signature into v, r, s components\n const r = `0x${signature.slice(2, 66)}` as `0x${string}`;\n const s = `0x${signature.slice(66, 130)}` as `0x${string}`;\n const v = parseInt(signature.slice(130, 132), 16);\n\n return { v, r, s };\n }\n}\n\n/**\n * Factory function to create an UptoEvmScheme.\n *\n * @param signer - The EVM signer\n * @returns A new UptoEvmScheme instance\n */\nexport function createUptoEvmScheme(signer: ClientEvmSigner): UptoEvmScheme {\n return new UptoEvmScheme(signer);\n}\n","export type ExactEIP3009Payload = {\n signature?: `0x${string}`;\n authorization: {\n from: `0x${string}`;\n to: `0x${string}`;\n value: string;\n validAfter: string;\n validBefore: string;\n nonce: `0x${string}`;\n };\n};\n\nexport type ExactEvmPayloadV1 = ExactEIP3009Payload;\n\nexport type ExactEvmPayloadV2 = ExactEIP3009Payload;\n\n/**\n * Payload for exact-legacy scheme (approve + transferFrom pattern)\n * Used for legacy USDT and other tokens without EIP-3009 support\n */\nexport type ExactLegacyPayload = {\n signature?: `0x${string}`;\n authorization: {\n /** Payer address */\n from: `0x${string}`;\n /** Recipient address */\n to: `0x${string}`;\n /** Payment amount in token units */\n value: string;\n /** Unix timestamp after which the authorization is valid */\n validAfter: string;\n /** Unix timestamp before which the authorization is valid */\n validBefore: string;\n /** Unique nonce to prevent replay attacks */\n nonce: `0x${string}`;\n /** Facilitator address that will call transferFrom */\n spender: `0x${string}`;\n };\n};\n\n// ============================================================================\n// Up-To Scheme Types (EIP-2612 Permit)\n// ============================================================================\n\n/**\n * EIP-2612 Permit signature components\n */\nexport type PermitSignature = {\n v: number;\n r: `0x${string}`;\n s: `0x${string}`;\n};\n\n/**\n * EIP-2612 Permit authorization parameters\n */\nexport type PermitAuthorization = {\n /** Token owner address */\n owner: `0x${string}`;\n /** Spender address (router contract or facilitator) */\n spender: `0x${string}`;\n /** Maximum authorized value */\n value: string;\n /** Permit deadline (unix timestamp) */\n deadline: string;\n /** Permit nonce from token contract */\n nonce: number;\n};\n\n/**\n * Payload for upto scheme using EIP-2612 Permit\n */\nexport type UptoEIP2612Payload = {\n /** EIP-2612 permit signature */\n signature: PermitSignature;\n /** Permit authorization parameters */\n authorization: PermitAuthorization;\n /** Unique payment nonce (separate from permit nonce) */\n paymentNonce: `0x${string}`;\n};\n\n/**\n * Compact payload with combined signature bytes\n */\nexport type UptoEIP2612PayloadCompact = {\n /** Combined permit signature (65 bytes) */\n signature: `0x${string}`;\n /** Permit authorization parameters */\n authorization: PermitAuthorization;\n /** Unique payment nonce */\n paymentNonce: `0x${string}`;\n};\n\nexport type UptoEvmPayloadV2 = UptoEIP2612Payload | UptoEIP2612PayloadCompact;\n\n/**\n * Extra fields for upto scheme requirements on EVM\n */\nexport type UptoEvmExtra = {\n /** EIP-712 domain name (from token contract) */\n name: string;\n /** EIP-712 domain version */\n version: string;\n /** Router contract address for settlement */\n routerAddress?: `0x${string}`;\n /** Billing unit */\n unit?: string;\n /** Price per unit */\n unitPrice?: string;\n};\n\n/**\n * Settlement data for upto scheme\n */\nexport type UptoEvmSettlement = {\n /** Actual amount to settle (must be <= maxAmount) */\n settleAmount: string;\n /** Usage details for auditing */\n usageDetails?: {\n unitsConsumed?: number;\n unitPrice?: string;\n unitType?: string;\n startTime?: number;\n endTime?: number;\n };\n};\n\n/**\n * EIP-712 typed data for EIP-2612 Permit\n */\nexport const permitTypes = {\n Permit: [\n { name: \"owner\", type: \"address\" },\n { name: \"spender\", type: \"address\" },\n { name: \"value\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\n/**\n * Type guard for UptoEIP2612Payload\n *\n * @param payload - The payload to check\n * @returns True if the payload is a valid UptoEIP2612Payload\n */\nexport function isUptoEIP2612Payload(payload: unknown): payload is UptoEIP2612Payload {\n if (typeof payload !== \"object\" || payload === null) return false;\n const p = payload as Record<string, unknown>;\n return (\n \"signature\" in p &&\n \"authorization\" in p &&\n \"paymentNonce\" in p &&\n typeof p.authorization === \"object\" &&\n p.authorization !== null &&\n \"owner\" in (p.authorization as Record<string, unknown>) &&\n \"spender\" in (p.authorization as Record<string, unknown>) &&\n \"value\" in (p.authorization as Record<string, unknown>) &&\n \"deadline\" in (p.authorization as Record<string, unknown>) &&\n \"nonce\" in (p.authorization as Record<string, unknown>)\n );\n}\n","import { toHex } from \"viem\";\nimport { Network } from \"@t402/core/types\";\n\n/**\n * Extract chain ID from network string (e.g., \"base-sepolia\" -> 84532)\n * Used by v1 implementations\n *\n * @param network - The network identifier\n * @returns The numeric chain ID\n */\nexport function getEvmChainId(network: Network): number {\n const networkMap: Record<string, number> = {\n base: 8453,\n \"base-sepolia\": 84532,\n ethereum: 1,\n sepolia: 11155111,\n polygon: 137,\n \"polygon-amoy\": 80002,\n };\n return networkMap[network] || 1;\n}\n\n/**\n * Create a random 32-byte nonce for authorization\n *\n * @returns A hex-encoded 32-byte nonce\n */\nexport function createNonce(): `0x${string}` {\n // Use dynamic import to avoid require() in ESM context\n const cryptoObj =\n typeof globalThis.crypto !== \"undefined\"\n ? globalThis.crypto\n : (globalThis as { crypto?: Crypto }).crypto;\n\n if (!cryptoObj) {\n throw new Error(\"Crypto API not available\");\n }\n\n return toHex(cryptoObj.getRandomValues(new Uint8Array(32)));\n}\n"],"mappings":"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","names":["import_viem"]}
@@ -0,0 +1,111 @@
1
+ export { UptoEvmScheme, createUptoEvmScheme } from './client/index.js';
2
+ export { b as UptoEvmFacilitatorScheme, e as UptoEvmFacilitatorSchemeConfig, U as UptoEvmServerScheme, a as UptoEvmServerSchemeConfig, d as createUptoEvmFacilitatorScheme, c as createUptoEvmServerScheme } from '../scheme-CIar5W2B.js';
3
+ import '@t402/core/types';
4
+ import '../signer-DcavxxZt.js';
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 };