@t402/evm 2.1.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.
- package/dist/cjs/exact/client/index.d.ts +2 -2
- package/dist/cjs/exact/client/index.js +4 -2
- package/dist/cjs/exact/client/index.js.map +1 -1
- package/dist/cjs/exact/facilitator/index.d.ts +1 -1
- package/dist/cjs/exact/facilitator/index.js +40 -4
- package/dist/cjs/exact/facilitator/index.js.map +1 -1
- package/dist/cjs/exact/server/index.d.ts +1 -1
- package/dist/cjs/exact/server/index.js +301 -33
- package/dist/cjs/exact/server/index.js.map +1 -1
- package/dist/cjs/exact/v1/client/index.d.ts +1 -1
- package/dist/cjs/exact/v1/client/index.js +3 -1
- package/dist/cjs/exact/v1/client/index.js.map +1 -1
- package/dist/cjs/exact/v1/facilitator/index.d.ts +1 -1
- package/dist/cjs/exact/v1/facilitator/index.js +21 -2
- package/dist/cjs/exact/v1/facilitator/index.js.map +1 -1
- package/dist/cjs/index.d.ts +636 -355
- package/dist/cjs/index.js +1451 -261
- package/dist/cjs/index.js.map +1 -1
- package/dist/{esm/scheme-yqGaK9rK.d.mts → cjs/scheme-B4rXSKCN.d.ts} +18 -16
- package/dist/cjs/scheme-CIar5W2B.d.ts +200 -0
- package/dist/cjs/{scheme-OojTBKAz.d.ts → scheme-CjijeY7y.d.ts} +1 -1
- package/dist/{esm/signer-BkcAzwYi.d.mts → cjs/signer-DcavxxZt.d.ts} +1 -18
- package/dist/cjs/upto/client/index.d.ts +61 -0
- package/dist/cjs/upto/client/index.js +154 -0
- package/dist/cjs/upto/client/index.js.map +1 -0
- package/dist/cjs/upto/index.d.ts +111 -0
- package/dist/cjs/upto/index.js +1030 -0
- package/dist/cjs/upto/index.js.map +1 -0
- package/dist/cjs/v1/index.d.ts +1 -1
- package/dist/cjs/v1/index.js +3 -1
- package/dist/cjs/v1/index.js.map +1 -1
- package/dist/esm/{chunk-ACDQ5QNT.mjs → chunk-4FBTQTNM.mjs} +27 -5
- package/dist/esm/chunk-4FBTQTNM.mjs.map +1 -0
- package/dist/esm/chunk-IWSDEZKI.mjs +477 -0
- package/dist/esm/chunk-IWSDEZKI.mjs.map +1 -0
- package/dist/esm/{chunk-LGSG73NJ.mjs → chunk-LM5RZBVP.mjs} +9 -4
- package/dist/esm/{chunk-LGSG73NJ.mjs.map → chunk-LM5RZBVP.mjs.map} +1 -1
- package/dist/esm/chunk-NSSMTXJJ.mjs +8 -0
- package/dist/esm/chunk-NSSMTXJJ.mjs.map +1 -0
- package/dist/esm/chunk-SJ52GTJJ.mjs +411 -0
- package/dist/esm/chunk-SJ52GTJJ.mjs.map +1 -0
- package/dist/esm/chunk-SURTCHSX.mjs +129 -0
- package/dist/esm/chunk-SURTCHSX.mjs.map +1 -0
- package/dist/esm/chunk-SYVPLXYV.mjs +26 -0
- package/dist/esm/chunk-SYVPLXYV.mjs.map +1 -0
- package/dist/esm/{chunk-XYKAO6KJ.mjs → chunk-Y4U7Q543.mjs} +2 -25
- package/dist/esm/chunk-Y4U7Q543.mjs.map +1 -0
- package/dist/esm/{chunk-JBWWBRYY.mjs → chunk-ZWEYARER.mjs} +9 -4
- package/dist/esm/{chunk-JBWWBRYY.mjs.map → chunk-ZWEYARER.mjs.map} +1 -1
- package/dist/esm/exact/client/index.d.mts +2 -2
- package/dist/esm/exact/client/index.mjs +6 -4
- package/dist/esm/exact/client/index.mjs.map +1 -1
- package/dist/esm/exact/facilitator/index.d.mts +1 -1
- package/dist/esm/exact/facilitator/index.mjs +26 -5
- package/dist/esm/exact/facilitator/index.mjs.map +1 -1
- package/dist/esm/exact/server/index.d.mts +1 -1
- package/dist/esm/exact/server/index.mjs +29 -30
- package/dist/esm/exact/server/index.mjs.map +1 -1
- package/dist/esm/exact/v1/client/index.d.mts +1 -1
- package/dist/esm/exact/v1/client/index.mjs +4 -2
- package/dist/esm/exact/v1/facilitator/index.d.mts +1 -1
- package/dist/esm/exact/v1/facilitator/index.mjs +4 -2
- package/dist/esm/index.d.mts +636 -355
- package/dist/esm/index.mjs +645 -135
- package/dist/esm/index.mjs.map +1 -1
- package/dist/{cjs/scheme-yqGaK9rK.d.ts → esm/scheme-B4rXSKCN.d.mts} +18 -16
- package/dist/esm/scheme-DATfd6oM.d.mts +200 -0
- package/dist/esm/{scheme-D4mOqq9l.d.mts → scheme-Ddb0dG_F.d.mts} +1 -1
- package/dist/{cjs/signer-BkcAzwYi.d.ts → esm/signer-DcavxxZt.d.mts} +1 -18
- package/dist/esm/upto/client/index.d.mts +61 -0
- package/dist/esm/upto/client/index.mjs +11 -0
- package/dist/esm/upto/client/index.mjs.map +1 -0
- package/dist/esm/upto/index.d.mts +111 -0
- package/dist/esm/upto/index.mjs +26 -0
- package/dist/esm/upto/index.mjs.map +1 -0
- package/dist/esm/v1/index.d.mts +1 -1
- package/dist/esm/v1/index.mjs +5 -3
- package/package.json +30 -6
- package/dist/cjs/scheme-C6uD7PdY.d.ts +0 -130
- package/dist/esm/chunk-ACDQ5QNT.mjs.map +0 -1
- package/dist/esm/chunk-OEXW2OK2.mjs +0 -251
- package/dist/esm/chunk-OEXW2OK2.mjs.map +0 -1
- package/dist/esm/chunk-XYKAO6KJ.mjs.map +0 -1
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
1
|
+
export * from '@t402/evm-core';
|
|
2
|
+
export { E as ExactEvmScheme } from './scheme-Ddb0dG_F.mjs';
|
|
3
|
+
export { a as ExactEvmSchemeConfig } from './scheme-B4rXSKCN.mjs';
|
|
3
4
|
import { SchemeNetworkClient, PaymentRequirements, PaymentPayload, SchemeNetworkServer, MoneyParser, Price, Network, AssetAmount, SchemeNetworkFacilitator, VerifyResponse, SettleResponse } from '@t402/core/types';
|
|
4
|
-
import { C as ClientEvmSigner, F as FacilitatorEvmSigner } from './signer-
|
|
5
|
-
export {
|
|
5
|
+
import { C as ClientEvmSigner, F as FacilitatorEvmSigner } from './signer-DcavxxZt.mjs';
|
|
6
|
+
export { UptoEvmScheme, createUptoEvmScheme } from './upto/client/index.mjs';
|
|
7
|
+
export { b as UptoEvmFacilitatorScheme, e as UptoEvmFacilitatorSchemeConfig, U as UptoEvmServerScheme, a as UptoEvmServerSchemeConfig, d as createUptoEvmFacilitatorScheme, c as createUptoEvmServerScheme } from './scheme-DATfd6oM.mjs';
|
|
6
8
|
import { Address, Hex, PublicClient } from 'viem';
|
|
7
9
|
|
|
8
10
|
/**
|
|
@@ -59,18 +61,52 @@ declare class ExactLegacyEvmScheme$1 implements SchemeNetworkServer {
|
|
|
59
61
|
readonly scheme = "exact-legacy";
|
|
60
62
|
private moneyParsers;
|
|
61
63
|
private config;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a new ExactLegacyEvmScheme instance.
|
|
66
|
+
*
|
|
67
|
+
* @param config - Optional configuration options for the scheme
|
|
68
|
+
*/
|
|
62
69
|
constructor(config?: ExactLegacyEvmSchemeConfig$1);
|
|
70
|
+
/**
|
|
71
|
+
* Get all supported networks that have legacy tokens
|
|
72
|
+
*
|
|
73
|
+
* @returns Array of network identifiers with legacy token support
|
|
74
|
+
*/
|
|
75
|
+
static getSupportedNetworks(): string[];
|
|
76
|
+
/**
|
|
77
|
+
* Check if a network has legacy token support
|
|
78
|
+
*
|
|
79
|
+
* @param network - The network identifier to check
|
|
80
|
+
* @returns True if the network has legacy token support
|
|
81
|
+
*/
|
|
82
|
+
static isNetworkSupported(network: string): boolean;
|
|
63
83
|
/**
|
|
64
84
|
* Register a custom money parser in the parser chain.
|
|
85
|
+
*
|
|
86
|
+
* @param parser - Custom function to convert amount to AssetAmount
|
|
87
|
+
* @returns The scheme instance for method chaining
|
|
65
88
|
*/
|
|
66
89
|
registerMoneyParser(parser: MoneyParser): ExactLegacyEvmScheme$1;
|
|
67
90
|
/**
|
|
68
91
|
* Parses a price into an asset amount for legacy tokens.
|
|
92
|
+
*
|
|
93
|
+
* @param price - The price to parse (Money or AssetAmount)
|
|
94
|
+
* @param network - The network identifier in CAIP-2 format
|
|
95
|
+
* @returns Promise resolving to the parsed asset amount
|
|
69
96
|
*/
|
|
70
97
|
parsePrice(price: Price, network: Network): Promise<AssetAmount>;
|
|
71
98
|
/**
|
|
72
99
|
* Build payment requirements for this scheme/network combination.
|
|
73
100
|
* Adds the spender (facilitator) address to the extra field.
|
|
101
|
+
*
|
|
102
|
+
* @param paymentRequirements - The base payment requirements to enhance
|
|
103
|
+
* @param supportedKind - The supported kind from facilitator
|
|
104
|
+
* @param supportedKind.t402Version - The t402 protocol version
|
|
105
|
+
* @param supportedKind.scheme - The logical payment scheme identifier
|
|
106
|
+
* @param supportedKind.network - The network identifier in CAIP-2 format
|
|
107
|
+
* @param supportedKind.extra - Optional extra metadata with spender address
|
|
108
|
+
* @param extensionKeys - Extension keys supported by the facilitator (unused)
|
|
109
|
+
* @returns Promise resolving to enhanced payment requirements
|
|
74
110
|
*/
|
|
75
111
|
enhancePaymentRequirements(paymentRequirements: PaymentRequirements, supportedKind: {
|
|
76
112
|
t402Version: number;
|
|
@@ -80,28 +116,34 @@ declare class ExactLegacyEvmScheme$1 implements SchemeNetworkServer {
|
|
|
80
116
|
}, extensionKeys: string[]): Promise<PaymentRequirements>;
|
|
81
117
|
/**
|
|
82
118
|
* Parse Money (string | number) to a decimal number.
|
|
119
|
+
*
|
|
120
|
+
* @param money - The money value to parse (e.g., "$1.50" or 1.50)
|
|
121
|
+
* @returns The decimal number representation
|
|
83
122
|
*/
|
|
84
123
|
private parseMoneyToDecimal;
|
|
85
124
|
/**
|
|
86
125
|
* Default money conversion implementation for legacy tokens.
|
|
126
|
+
*
|
|
127
|
+
* @param amount - The decimal amount to convert (e.g., 1.50)
|
|
128
|
+
* @param network - The network identifier in CAIP-2 format
|
|
129
|
+
* @returns The asset amount in token units
|
|
87
130
|
*/
|
|
88
131
|
private defaultMoneyConversion;
|
|
89
132
|
/**
|
|
90
133
|
* Convert decimal amount to token units
|
|
134
|
+
*
|
|
135
|
+
* @param decimalAmount - The decimal amount as a string (e.g., "1.50")
|
|
136
|
+
* @param decimals - The number of decimal places for the token
|
|
137
|
+
* @returns The token amount as a string in smallest units
|
|
91
138
|
*/
|
|
92
139
|
private convertToTokenAmount;
|
|
93
140
|
/**
|
|
94
141
|
* Get the default legacy token for a network.
|
|
142
|
+
*
|
|
143
|
+
* @param network - The network identifier in CAIP-2 format
|
|
144
|
+
* @returns The token configuration for the default legacy token
|
|
95
145
|
*/
|
|
96
146
|
private getDefaultAsset;
|
|
97
|
-
/**
|
|
98
|
-
* Get all supported networks that have legacy tokens
|
|
99
|
-
*/
|
|
100
|
-
static getSupportedNetworks(): string[];
|
|
101
|
-
/**
|
|
102
|
-
* Check if a network has legacy token support
|
|
103
|
-
*/
|
|
104
|
-
static isNetworkSupported(network: string): boolean;
|
|
105
147
|
}
|
|
106
148
|
|
|
107
149
|
interface ExactLegacyEvmSchemeConfig {
|
|
@@ -140,349 +182,29 @@ declare class ExactLegacyEvmScheme implements SchemeNetworkFacilitator {
|
|
|
140
182
|
getExtra(network: string): Record<string, unknown> | undefined;
|
|
141
183
|
/**
|
|
142
184
|
* Get signer addresses used by this facilitator.
|
|
185
|
+
*
|
|
186
|
+
* @param network - The network identifier (unused, returns same addresses for all networks)
|
|
187
|
+
* @returns Array of signer addresses
|
|
143
188
|
*/
|
|
144
189
|
getSigners(network: string): string[];
|
|
145
190
|
/**
|
|
146
191
|
* Verifies a payment payload.
|
|
192
|
+
*
|
|
193
|
+
* @param payload - The payment payload to verify
|
|
194
|
+
* @param requirements - The payment requirements to verify against
|
|
195
|
+
* @returns Promise resolving to verification response with validity status
|
|
147
196
|
*/
|
|
148
197
|
verify(payload: PaymentPayload, requirements: PaymentRequirements): Promise<VerifyResponse>;
|
|
149
198
|
/**
|
|
150
199
|
* Settles a payment by executing transferFrom.
|
|
200
|
+
*
|
|
201
|
+
* @param payload - The payment payload containing transfer authorization
|
|
202
|
+
* @param requirements - The payment requirements specifying amount and recipient
|
|
203
|
+
* @returns Promise resolving to settlement response with transaction hash
|
|
151
204
|
*/
|
|
152
205
|
settle(payload: PaymentPayload, requirements: PaymentRequirements): Promise<SettleResponse>;
|
|
153
206
|
}
|
|
154
207
|
|
|
155
|
-
/**
|
|
156
|
-
* Token configuration for T402 EVM payments
|
|
157
|
-
*
|
|
158
|
-
* This module provides comprehensive token definitions including:
|
|
159
|
-
* - USDT0 (Tether's new omnichain token with EIP-3009 support)
|
|
160
|
-
* - USDC (USD Coin with EIP-3009 support)
|
|
161
|
-
* - Legacy tokens configuration
|
|
162
|
-
*/
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Token type classification for payment scheme selection
|
|
166
|
-
*/
|
|
167
|
-
type TokenType = "eip3009" | "legacy";
|
|
168
|
-
/**
|
|
169
|
-
* Token configuration with EIP-712 domain parameters
|
|
170
|
-
*/
|
|
171
|
-
interface TokenConfig {
|
|
172
|
-
/** Token contract address */
|
|
173
|
-
address: Address;
|
|
174
|
-
/** Token symbol (e.g., "USDT0", "USDC") */
|
|
175
|
-
symbol: string;
|
|
176
|
-
/** EIP-712 domain name for signing */
|
|
177
|
-
name: string;
|
|
178
|
-
/** EIP-712 domain version for signing */
|
|
179
|
-
version: string;
|
|
180
|
-
/** Number of decimal places */
|
|
181
|
-
decimals: number;
|
|
182
|
-
/** Token type for scheme selection */
|
|
183
|
-
tokenType: TokenType;
|
|
184
|
-
/** Payment priority (lower = higher priority) */
|
|
185
|
-
priority: number;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Network token registry mapping network -> symbol -> config
|
|
189
|
-
*/
|
|
190
|
-
type NetworkTokenRegistry = Record<string, Record<string, TokenConfig>>;
|
|
191
|
-
/**
|
|
192
|
-
* USDT0 Contract Addresses by Network
|
|
193
|
-
* Source: https://docs.tether.io/usdt0/integration-guide/deployed-contracts
|
|
194
|
-
*
|
|
195
|
-
* USDT0 is Tether's new omnichain token using LayerZero OFT standard.
|
|
196
|
-
* Key features:
|
|
197
|
-
* - Supports EIP-3009 transferWithAuthorization (gasless transfers)
|
|
198
|
-
* - Supports EIP-2612 permit
|
|
199
|
-
* - Native cross-chain via LayerZero
|
|
200
|
-
*/
|
|
201
|
-
declare const USDT0_ADDRESSES: Record<string, Address>;
|
|
202
|
-
/**
|
|
203
|
-
* USDC Contract Addresses by Network
|
|
204
|
-
* Native USDC with EIP-3009 support
|
|
205
|
-
*/
|
|
206
|
-
declare const USDC_ADDRESSES: Record<string, Address>;
|
|
207
|
-
/**
|
|
208
|
-
* Traditional USDT Addresses (Legacy - no EIP-3009 support)
|
|
209
|
-
* These require the approve + transferFrom pattern
|
|
210
|
-
*/
|
|
211
|
-
declare const USDT_LEGACY_ADDRESSES: Record<string, Address>;
|
|
212
|
-
/**
|
|
213
|
-
* Complete token registry with all supported tokens per network
|
|
214
|
-
*/
|
|
215
|
-
declare const TOKEN_REGISTRY: NetworkTokenRegistry;
|
|
216
|
-
/**
|
|
217
|
-
* Token priority for payment method selection
|
|
218
|
-
* Lower number = higher priority
|
|
219
|
-
*/
|
|
220
|
-
declare const TOKEN_PRIORITY: Record<string, number>;
|
|
221
|
-
/**
|
|
222
|
-
* Get token configuration for a specific token on a network
|
|
223
|
-
*/
|
|
224
|
-
declare function getTokenConfig(network: string, symbol: string): TokenConfig | undefined;
|
|
225
|
-
/**
|
|
226
|
-
* Get all tokens available on a network
|
|
227
|
-
*/
|
|
228
|
-
declare function getNetworkTokens(network: string): TokenConfig[];
|
|
229
|
-
/**
|
|
230
|
-
* Get the default/preferred token for a network
|
|
231
|
-
* Prefers USDT0 > USDC > others based on priority
|
|
232
|
-
*/
|
|
233
|
-
declare function getDefaultToken(network: string): TokenConfig | undefined;
|
|
234
|
-
/**
|
|
235
|
-
* Get token by contract address on a network
|
|
236
|
-
*/
|
|
237
|
-
declare function getTokenByAddress(network: string, address: Address): TokenConfig | undefined;
|
|
238
|
-
/**
|
|
239
|
-
* Check if a token supports EIP-3009 (gasless transfers)
|
|
240
|
-
*/
|
|
241
|
-
declare function supportsEIP3009(network: string, symbol: string): boolean;
|
|
242
|
-
/**
|
|
243
|
-
* Get all networks that support a specific token
|
|
244
|
-
*/
|
|
245
|
-
declare function getNetworksForToken(symbol: string): string[];
|
|
246
|
-
/**
|
|
247
|
-
* Get USDT0 networks (primary T402 token)
|
|
248
|
-
*/
|
|
249
|
-
declare function getUsdt0Networks(): string[];
|
|
250
|
-
/**
|
|
251
|
-
* EIP-712 domain configuration for a token
|
|
252
|
-
*/
|
|
253
|
-
declare function getEIP712Domain(network: string, tokenAddress: Address, chainId: number): {
|
|
254
|
-
name: string;
|
|
255
|
-
version: string;
|
|
256
|
-
chainId: number;
|
|
257
|
-
verifyingContract: Address;
|
|
258
|
-
} | undefined;
|
|
259
|
-
|
|
260
|
-
type ExactEIP3009Payload = {
|
|
261
|
-
signature?: `0x${string}`;
|
|
262
|
-
authorization: {
|
|
263
|
-
from: `0x${string}`;
|
|
264
|
-
to: `0x${string}`;
|
|
265
|
-
value: string;
|
|
266
|
-
validAfter: string;
|
|
267
|
-
validBefore: string;
|
|
268
|
-
nonce: `0x${string}`;
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
type ExactEvmPayloadV1 = ExactEIP3009Payload;
|
|
272
|
-
type ExactEvmPayloadV2 = ExactEIP3009Payload;
|
|
273
|
-
/**
|
|
274
|
-
* Payload for exact-legacy scheme (approve + transferFrom pattern)
|
|
275
|
-
* Used for legacy USDT and other tokens without EIP-3009 support
|
|
276
|
-
*/
|
|
277
|
-
type ExactLegacyPayload = {
|
|
278
|
-
signature?: `0x${string}`;
|
|
279
|
-
authorization: {
|
|
280
|
-
/** Payer address */
|
|
281
|
-
from: `0x${string}`;
|
|
282
|
-
/** Recipient address */
|
|
283
|
-
to: `0x${string}`;
|
|
284
|
-
/** Payment amount in token units */
|
|
285
|
-
value: string;
|
|
286
|
-
/** Unix timestamp after which the authorization is valid */
|
|
287
|
-
validAfter: string;
|
|
288
|
-
/** Unix timestamp before which the authorization is valid */
|
|
289
|
-
validBefore: string;
|
|
290
|
-
/** Unique nonce to prevent replay attacks */
|
|
291
|
-
nonce: `0x${string}`;
|
|
292
|
-
/** Facilitator address that will call transferFrom */
|
|
293
|
-
spender: `0x${string}`;
|
|
294
|
-
};
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
declare const authorizationTypes: {
|
|
298
|
-
readonly TransferWithAuthorization: readonly [{
|
|
299
|
-
readonly name: "from";
|
|
300
|
-
readonly type: "address";
|
|
301
|
-
}, {
|
|
302
|
-
readonly name: "to";
|
|
303
|
-
readonly type: "address";
|
|
304
|
-
}, {
|
|
305
|
-
readonly name: "value";
|
|
306
|
-
readonly type: "uint256";
|
|
307
|
-
}, {
|
|
308
|
-
readonly name: "validAfter";
|
|
309
|
-
readonly type: "uint256";
|
|
310
|
-
}, {
|
|
311
|
-
readonly name: "validBefore";
|
|
312
|
-
readonly type: "uint256";
|
|
313
|
-
}, {
|
|
314
|
-
readonly name: "nonce";
|
|
315
|
-
readonly type: "bytes32";
|
|
316
|
-
}];
|
|
317
|
-
};
|
|
318
|
-
declare const legacyAuthorizationTypes: {
|
|
319
|
-
readonly LegacyTransferAuthorization: readonly [{
|
|
320
|
-
readonly name: "from";
|
|
321
|
-
readonly type: "address";
|
|
322
|
-
}, {
|
|
323
|
-
readonly name: "to";
|
|
324
|
-
readonly type: "address";
|
|
325
|
-
}, {
|
|
326
|
-
readonly name: "value";
|
|
327
|
-
readonly type: "uint256";
|
|
328
|
-
}, {
|
|
329
|
-
readonly name: "validAfter";
|
|
330
|
-
readonly type: "uint256";
|
|
331
|
-
}, {
|
|
332
|
-
readonly name: "validBefore";
|
|
333
|
-
readonly type: "uint256";
|
|
334
|
-
}, {
|
|
335
|
-
readonly name: "nonce";
|
|
336
|
-
readonly type: "bytes32";
|
|
337
|
-
}, {
|
|
338
|
-
readonly name: "spender";
|
|
339
|
-
readonly type: "address";
|
|
340
|
-
}];
|
|
341
|
-
};
|
|
342
|
-
declare const eip3009ABI: readonly [{
|
|
343
|
-
readonly inputs: readonly [{
|
|
344
|
-
readonly name: "from";
|
|
345
|
-
readonly type: "address";
|
|
346
|
-
}, {
|
|
347
|
-
readonly name: "to";
|
|
348
|
-
readonly type: "address";
|
|
349
|
-
}, {
|
|
350
|
-
readonly name: "value";
|
|
351
|
-
readonly type: "uint256";
|
|
352
|
-
}, {
|
|
353
|
-
readonly name: "validAfter";
|
|
354
|
-
readonly type: "uint256";
|
|
355
|
-
}, {
|
|
356
|
-
readonly name: "validBefore";
|
|
357
|
-
readonly type: "uint256";
|
|
358
|
-
}, {
|
|
359
|
-
readonly name: "nonce";
|
|
360
|
-
readonly type: "bytes32";
|
|
361
|
-
}, {
|
|
362
|
-
readonly name: "v";
|
|
363
|
-
readonly type: "uint8";
|
|
364
|
-
}, {
|
|
365
|
-
readonly name: "r";
|
|
366
|
-
readonly type: "bytes32";
|
|
367
|
-
}, {
|
|
368
|
-
readonly name: "s";
|
|
369
|
-
readonly type: "bytes32";
|
|
370
|
-
}];
|
|
371
|
-
readonly name: "transferWithAuthorization";
|
|
372
|
-
readonly outputs: readonly [];
|
|
373
|
-
readonly stateMutability: "nonpayable";
|
|
374
|
-
readonly type: "function";
|
|
375
|
-
}, {
|
|
376
|
-
readonly inputs: readonly [{
|
|
377
|
-
readonly name: "from";
|
|
378
|
-
readonly type: "address";
|
|
379
|
-
}, {
|
|
380
|
-
readonly name: "to";
|
|
381
|
-
readonly type: "address";
|
|
382
|
-
}, {
|
|
383
|
-
readonly name: "value";
|
|
384
|
-
readonly type: "uint256";
|
|
385
|
-
}, {
|
|
386
|
-
readonly name: "validAfter";
|
|
387
|
-
readonly type: "uint256";
|
|
388
|
-
}, {
|
|
389
|
-
readonly name: "validBefore";
|
|
390
|
-
readonly type: "uint256";
|
|
391
|
-
}, {
|
|
392
|
-
readonly name: "nonce";
|
|
393
|
-
readonly type: "bytes32";
|
|
394
|
-
}, {
|
|
395
|
-
readonly name: "signature";
|
|
396
|
-
readonly type: "bytes";
|
|
397
|
-
}];
|
|
398
|
-
readonly name: "transferWithAuthorization";
|
|
399
|
-
readonly outputs: readonly [];
|
|
400
|
-
readonly stateMutability: "nonpayable";
|
|
401
|
-
readonly type: "function";
|
|
402
|
-
}, {
|
|
403
|
-
readonly inputs: readonly [{
|
|
404
|
-
readonly name: "account";
|
|
405
|
-
readonly type: "address";
|
|
406
|
-
}];
|
|
407
|
-
readonly name: "balanceOf";
|
|
408
|
-
readonly outputs: readonly [{
|
|
409
|
-
readonly name: "";
|
|
410
|
-
readonly type: "uint256";
|
|
411
|
-
}];
|
|
412
|
-
readonly stateMutability: "view";
|
|
413
|
-
readonly type: "function";
|
|
414
|
-
}, {
|
|
415
|
-
readonly inputs: readonly [];
|
|
416
|
-
readonly name: "version";
|
|
417
|
-
readonly outputs: readonly [{
|
|
418
|
-
readonly name: "";
|
|
419
|
-
readonly type: "string";
|
|
420
|
-
}];
|
|
421
|
-
readonly stateMutability: "view";
|
|
422
|
-
readonly type: "function";
|
|
423
|
-
}];
|
|
424
|
-
declare const erc20LegacyABI: readonly [{
|
|
425
|
-
readonly inputs: readonly [{
|
|
426
|
-
readonly name: "account";
|
|
427
|
-
readonly type: "address";
|
|
428
|
-
}];
|
|
429
|
-
readonly name: "balanceOf";
|
|
430
|
-
readonly outputs: readonly [{
|
|
431
|
-
readonly name: "";
|
|
432
|
-
readonly type: "uint256";
|
|
433
|
-
}];
|
|
434
|
-
readonly stateMutability: "view";
|
|
435
|
-
readonly type: "function";
|
|
436
|
-
}, {
|
|
437
|
-
readonly inputs: readonly [{
|
|
438
|
-
readonly name: "owner";
|
|
439
|
-
readonly type: "address";
|
|
440
|
-
}, {
|
|
441
|
-
readonly name: "spender";
|
|
442
|
-
readonly type: "address";
|
|
443
|
-
}];
|
|
444
|
-
readonly name: "allowance";
|
|
445
|
-
readonly outputs: readonly [{
|
|
446
|
-
readonly name: "";
|
|
447
|
-
readonly type: "uint256";
|
|
448
|
-
}];
|
|
449
|
-
readonly stateMutability: "view";
|
|
450
|
-
readonly type: "function";
|
|
451
|
-
}, {
|
|
452
|
-
readonly inputs: readonly [{
|
|
453
|
-
readonly name: "spender";
|
|
454
|
-
readonly type: "address";
|
|
455
|
-
}, {
|
|
456
|
-
readonly name: "amount";
|
|
457
|
-
readonly type: "uint256";
|
|
458
|
-
}];
|
|
459
|
-
readonly name: "approve";
|
|
460
|
-
readonly outputs: readonly [{
|
|
461
|
-
readonly name: "";
|
|
462
|
-
readonly type: "bool";
|
|
463
|
-
}];
|
|
464
|
-
readonly stateMutability: "nonpayable";
|
|
465
|
-
readonly type: "function";
|
|
466
|
-
}, {
|
|
467
|
-
readonly inputs: readonly [{
|
|
468
|
-
readonly name: "from";
|
|
469
|
-
readonly type: "address";
|
|
470
|
-
}, {
|
|
471
|
-
readonly name: "to";
|
|
472
|
-
readonly type: "address";
|
|
473
|
-
}, {
|
|
474
|
-
readonly name: "amount";
|
|
475
|
-
readonly type: "uint256";
|
|
476
|
-
}];
|
|
477
|
-
readonly name: "transferFrom";
|
|
478
|
-
readonly outputs: readonly [{
|
|
479
|
-
readonly name: "";
|
|
480
|
-
readonly type: "bool";
|
|
481
|
-
}];
|
|
482
|
-
readonly stateMutability: "nonpayable";
|
|
483
|
-
readonly type: "function";
|
|
484
|
-
}];
|
|
485
|
-
|
|
486
208
|
/**
|
|
487
209
|
* Type definitions for USDT0 cross-chain bridging
|
|
488
210
|
*/
|
|
@@ -574,6 +296,28 @@ interface BridgeTransaction {
|
|
|
574
296
|
/** Destination chain transaction hash (when completed) */
|
|
575
297
|
dstTxHash?: `0x${string}`;
|
|
576
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Transaction log entry
|
|
301
|
+
*/
|
|
302
|
+
interface TransactionLog {
|
|
303
|
+
/** Contract address that emitted the log */
|
|
304
|
+
address: Address;
|
|
305
|
+
/** Indexed event parameters */
|
|
306
|
+
topics: readonly `0x${string}`[];
|
|
307
|
+
/** Non-indexed event data */
|
|
308
|
+
data: `0x${string}`;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Transaction receipt with logs
|
|
312
|
+
*/
|
|
313
|
+
interface TransactionReceipt {
|
|
314
|
+
/** Transaction status ("success" or "reverted") */
|
|
315
|
+
status: string;
|
|
316
|
+
/** Transaction hash */
|
|
317
|
+
transactionHash: `0x${string}`;
|
|
318
|
+
/** Event logs emitted during transaction */
|
|
319
|
+
logs: readonly TransactionLog[];
|
|
320
|
+
}
|
|
577
321
|
/**
|
|
578
322
|
* Signer interface for bridge operations
|
|
579
323
|
*/
|
|
@@ -598,9 +342,87 @@ interface BridgeSigner {
|
|
|
598
342
|
/** Wait for transaction receipt */
|
|
599
343
|
waitForTransactionReceipt(args: {
|
|
600
344
|
hash: `0x${string}`;
|
|
601
|
-
}): Promise<
|
|
602
|
-
|
|
603
|
-
|
|
345
|
+
}): Promise<TransactionReceipt>;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* LayerZero message status from Scan API
|
|
349
|
+
*/
|
|
350
|
+
type LayerZeroMessageStatus = "INFLIGHT" | "CONFIRMING" | "DELIVERED" | "FAILED" | "BLOCKED";
|
|
351
|
+
/**
|
|
352
|
+
* LayerZero message from Scan API
|
|
353
|
+
*/
|
|
354
|
+
interface LayerZeroMessage {
|
|
355
|
+
/** Unique message identifier */
|
|
356
|
+
guid: string;
|
|
357
|
+
/** Source chain LayerZero endpoint ID */
|
|
358
|
+
srcEid: number;
|
|
359
|
+
/** Destination chain LayerZero endpoint ID */
|
|
360
|
+
dstEid: number;
|
|
361
|
+
/** Source chain OApp address */
|
|
362
|
+
srcUaAddress: string;
|
|
363
|
+
/** Destination chain OApp address */
|
|
364
|
+
dstUaAddress: string;
|
|
365
|
+
/** Source chain transaction hash */
|
|
366
|
+
srcTxHash: string;
|
|
367
|
+
/** Destination chain transaction hash (when delivered) */
|
|
368
|
+
dstTxHash?: string;
|
|
369
|
+
/** Current message status */
|
|
370
|
+
status: LayerZeroMessageStatus;
|
|
371
|
+
/** Source chain block number */
|
|
372
|
+
srcBlockNumber: number;
|
|
373
|
+
/** Destination chain block number (when delivered) */
|
|
374
|
+
dstBlockNumber?: number;
|
|
375
|
+
/** Timestamp when message was created */
|
|
376
|
+
created: string;
|
|
377
|
+
/** Timestamp when message was last updated */
|
|
378
|
+
updated: string;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Options for waiting for message delivery
|
|
382
|
+
*/
|
|
383
|
+
interface WaitForDeliveryOptions {
|
|
384
|
+
/** Maximum time to wait in milliseconds (default: 600000 = 10 minutes) */
|
|
385
|
+
timeout?: number;
|
|
386
|
+
/** Polling interval in milliseconds (default: 10000 = 10 seconds) */
|
|
387
|
+
pollInterval?: number;
|
|
388
|
+
/** Callback when status changes */
|
|
389
|
+
onStatusChange?: (status: LayerZeroMessageStatus) => void;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Parameters for cross-chain payment routing
|
|
393
|
+
*/
|
|
394
|
+
interface CrossChainPaymentParams {
|
|
395
|
+
/** Source chain where user has funds */
|
|
396
|
+
sourceChain: string;
|
|
397
|
+
/** Destination chain where payment is needed */
|
|
398
|
+
destinationChain: string;
|
|
399
|
+
/** Amount to transfer (in token units, 6 decimals for USDT0) */
|
|
400
|
+
amount: bigint;
|
|
401
|
+
/** Payment recipient on destination chain */
|
|
402
|
+
payTo: Address;
|
|
403
|
+
/** Payer address (receives bridged funds on destination) */
|
|
404
|
+
payer: Address;
|
|
405
|
+
/** Slippage tolerance percentage (default: 0.5) */
|
|
406
|
+
slippageTolerance?: number;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Result of cross-chain payment routing
|
|
410
|
+
*/
|
|
411
|
+
interface CrossChainPaymentResult {
|
|
412
|
+
/** Bridge transaction hash on source chain */
|
|
413
|
+
bridgeTxHash: `0x${string}`;
|
|
414
|
+
/** LayerZero message GUID for tracking */
|
|
415
|
+
messageGuid: `0x${string}`;
|
|
416
|
+
/** Amount bridged from source chain */
|
|
417
|
+
amountBridged: bigint;
|
|
418
|
+
/** Estimated amount to receive on destination */
|
|
419
|
+
estimatedReceiveAmount: bigint;
|
|
420
|
+
/** Source chain name */
|
|
421
|
+
sourceChain: string;
|
|
422
|
+
/** Destination chain name */
|
|
423
|
+
destinationChain: string;
|
|
424
|
+
/** Estimated delivery time in seconds */
|
|
425
|
+
estimatedDeliveryTime: number;
|
|
604
426
|
}
|
|
605
427
|
|
|
606
428
|
/**
|
|
@@ -667,31 +489,272 @@ declare class Usdt0Bridge {
|
|
|
667
489
|
* @returns Bridge result with transaction hash
|
|
668
490
|
*/
|
|
669
491
|
send(params: BridgeExecuteParams): Promise<BridgeResult>;
|
|
492
|
+
/**
|
|
493
|
+
* Get all supported destination chains from current chain
|
|
494
|
+
*
|
|
495
|
+
* @returns Array of supported destination chain names
|
|
496
|
+
*/
|
|
497
|
+
getSupportedDestinations(): string[];
|
|
498
|
+
/**
|
|
499
|
+
* Check if a destination chain is supported
|
|
500
|
+
*
|
|
501
|
+
* @param toChain - The destination chain to check
|
|
502
|
+
* @returns True if the destination chain is supported
|
|
503
|
+
*/
|
|
504
|
+
supportsDestination(toChain: string): boolean;
|
|
505
|
+
/**
|
|
506
|
+
* Extract LayerZero message GUID from OFTSent event logs
|
|
507
|
+
*
|
|
508
|
+
* @param receipt - Transaction receipt with logs
|
|
509
|
+
* @returns Message GUID as hex string
|
|
510
|
+
*/
|
|
511
|
+
private extractMessageGuid;
|
|
670
512
|
/**
|
|
671
513
|
* Ensure sufficient token allowance for the OFT contract
|
|
514
|
+
*
|
|
515
|
+
* @param oftAddress - The OFT contract address
|
|
516
|
+
* @param amount - The amount to approve
|
|
672
517
|
*/
|
|
673
518
|
private ensureAllowance;
|
|
674
519
|
/**
|
|
675
520
|
* Build SendParam struct for LayerZero
|
|
521
|
+
*
|
|
522
|
+
* @param params - Bridge parameters
|
|
523
|
+
* @returns SendParam struct for the OFT contract
|
|
676
524
|
*/
|
|
677
525
|
private buildSendParam;
|
|
678
526
|
/**
|
|
679
527
|
* Validate bridge parameters
|
|
528
|
+
*
|
|
529
|
+
* @param params - Bridge parameters to validate
|
|
680
530
|
*/
|
|
681
531
|
private validateBridgeParams;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Create a bridge client for a specific chain
|
|
535
|
+
*
|
|
536
|
+
* @param signer - Wallet signer with read/write capabilities
|
|
537
|
+
* @param chain - Source chain name
|
|
538
|
+
* @returns New Usdt0Bridge instance
|
|
539
|
+
*/
|
|
540
|
+
declare function createUsdt0Bridge(signer: BridgeSigner, chain: string): Usdt0Bridge;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* LayerZero Scan API Client
|
|
544
|
+
*
|
|
545
|
+
* Provides tracking for cross-chain messages via LayerZero Scan.
|
|
546
|
+
*
|
|
547
|
+
* @see https://docs.layerzero.network/v2/tools/api/scan/mainnet
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```typescript
|
|
551
|
+
* import { LayerZeroScanClient } from '@t402/evm';
|
|
552
|
+
*
|
|
553
|
+
* const scanClient = new LayerZeroScanClient();
|
|
554
|
+
*
|
|
555
|
+
* // Get message status
|
|
556
|
+
* const message = await scanClient.getMessage(messageGuid);
|
|
557
|
+
* console.log(`Status: ${message.status}`);
|
|
558
|
+
*
|
|
559
|
+
* // Wait for delivery
|
|
560
|
+
* const delivered = await scanClient.waitForDelivery(messageGuid, {
|
|
561
|
+
* onStatusChange: (status) => console.log(`Status changed: ${status}`),
|
|
562
|
+
* });
|
|
563
|
+
* console.log(`Delivered! Destination TX: ${delivered.dstTxHash}`);
|
|
564
|
+
* ```
|
|
565
|
+
*/
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* LayerZero Scan API base URL
|
|
569
|
+
*/
|
|
570
|
+
declare const LAYERZERO_SCAN_BASE_URL = "https://scan.layerzero-api.com/v1";
|
|
571
|
+
/**
|
|
572
|
+
* LayerZero Scan API Client
|
|
573
|
+
*
|
|
574
|
+
* Use this client to track the status of cross-chain messages sent via LayerZero.
|
|
575
|
+
*/
|
|
576
|
+
declare class LayerZeroScanClient {
|
|
577
|
+
private readonly baseUrl;
|
|
682
578
|
/**
|
|
683
|
-
*
|
|
579
|
+
* Create a new LayerZero Scan client
|
|
580
|
+
*
|
|
581
|
+
* @param baseUrl - API base URL (default: production endpoint)
|
|
582
|
+
*/
|
|
583
|
+
constructor(baseUrl?: string);
|
|
584
|
+
/**
|
|
585
|
+
* Get message by GUID
|
|
586
|
+
*
|
|
587
|
+
* @param guid - LayerZero message GUID
|
|
588
|
+
* @returns Message details including status
|
|
589
|
+
* @throws Error if message not found or API error
|
|
590
|
+
*/
|
|
591
|
+
getMessage(guid: string): Promise<LayerZeroMessage>;
|
|
592
|
+
/**
|
|
593
|
+
* Get messages by wallet address
|
|
594
|
+
*
|
|
595
|
+
* @param address - Wallet address that initiated messages
|
|
596
|
+
* @param limit - Maximum number of messages to return (default: 20)
|
|
597
|
+
* @returns Array of messages
|
|
598
|
+
*/
|
|
599
|
+
getMessagesByWallet(address: string, limit?: number): Promise<LayerZeroMessage[]>;
|
|
600
|
+
/**
|
|
601
|
+
* Poll message status until delivered or failed
|
|
602
|
+
*
|
|
603
|
+
* @param guid - LayerZero message GUID
|
|
604
|
+
* @param options - Wait configuration options
|
|
605
|
+
* @returns Final message state (DELIVERED)
|
|
606
|
+
* @throws Error if message fails, is blocked, or times out
|
|
607
|
+
*/
|
|
608
|
+
waitForDelivery(guid: string, options?: WaitForDeliveryOptions): Promise<LayerZeroMessage>;
|
|
609
|
+
/**
|
|
610
|
+
* Check if a message has been delivered
|
|
611
|
+
*
|
|
612
|
+
* @param guid - LayerZero message GUID
|
|
613
|
+
* @returns True if delivered, false otherwise
|
|
614
|
+
*/
|
|
615
|
+
isDelivered(guid: string): Promise<boolean>;
|
|
616
|
+
/**
|
|
617
|
+
* Map API response to our interface
|
|
618
|
+
*
|
|
619
|
+
* @param data - The raw API response data
|
|
620
|
+
* @returns The mapped LayerZeroMessage object
|
|
621
|
+
*/
|
|
622
|
+
private mapApiResponse;
|
|
623
|
+
/**
|
|
624
|
+
* Sleep helper
|
|
625
|
+
*
|
|
626
|
+
* @param ms - The number of milliseconds to sleep
|
|
627
|
+
* @returns A promise that resolves after the specified delay
|
|
628
|
+
*/
|
|
629
|
+
private sleep;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Create a LayerZero Scan client
|
|
633
|
+
*
|
|
634
|
+
* @param baseUrl - Optional custom API base URL
|
|
635
|
+
* @returns A new LayerZeroScanClient instance
|
|
636
|
+
*/
|
|
637
|
+
declare function createLayerZeroScanClient(baseUrl?: string): LayerZeroScanClient;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Cross-Chain Payment Router
|
|
641
|
+
*
|
|
642
|
+
* Enables payments on a destination chain using funds from a source chain.
|
|
643
|
+
* Uses USDT0 bridge via LayerZero for cross-chain transfers.
|
|
644
|
+
*
|
|
645
|
+
* @example
|
|
646
|
+
* ```typescript
|
|
647
|
+
* import { CrossChainPaymentRouter } from '@t402/evm';
|
|
648
|
+
*
|
|
649
|
+
* const router = new CrossChainPaymentRouter(signer, 'arbitrum');
|
|
650
|
+
*
|
|
651
|
+
* // Route payment from Arbitrum to Ethereum
|
|
652
|
+
* const result = await router.routePayment({
|
|
653
|
+
* sourceChain: 'arbitrum',
|
|
654
|
+
* destinationChain: 'ethereum',
|
|
655
|
+
* amount: 100_000000n, // 100 USDT0
|
|
656
|
+
* payTo: recipientAddress,
|
|
657
|
+
* payer: userAddress,
|
|
658
|
+
* });
|
|
659
|
+
*
|
|
660
|
+
* // Track delivery
|
|
661
|
+
* const message = await router.trackMessage(result.messageGuid);
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Cross-Chain Payment Router
|
|
667
|
+
*
|
|
668
|
+
* Routes payments across chains using USDT0 bridge.
|
|
669
|
+
* Handles fee estimation, bridge execution, and delivery tracking.
|
|
670
|
+
*/
|
|
671
|
+
declare class CrossChainPaymentRouter {
|
|
672
|
+
private readonly bridge;
|
|
673
|
+
private readonly scanClient;
|
|
674
|
+
private readonly sourceChain;
|
|
675
|
+
/**
|
|
676
|
+
* Create a cross-chain payment router
|
|
677
|
+
*
|
|
678
|
+
* @param signer - Wallet signer for bridge operations
|
|
679
|
+
* @param sourceChain - Chain where user's funds are located
|
|
680
|
+
*/
|
|
681
|
+
constructor(signer: BridgeSigner, sourceChain: string);
|
|
682
|
+
/**
|
|
683
|
+
* Get all bridgeable chains
|
|
684
|
+
*
|
|
685
|
+
* @returns Array of all chain names that support USDT0 bridging
|
|
686
|
+
*/
|
|
687
|
+
static getBridgeableChains(): string[];
|
|
688
|
+
/**
|
|
689
|
+
* Route payment across chains
|
|
690
|
+
*
|
|
691
|
+
* This method:
|
|
692
|
+
* 1. Bridges USDT0 from source chain to destination chain
|
|
693
|
+
* 2. Sends funds to the payer's address on destination chain
|
|
694
|
+
* 3. Returns tracking info for monitoring delivery
|
|
695
|
+
*
|
|
696
|
+
* After delivery, the payer can use the bridged funds to pay on the destination chain.
|
|
697
|
+
*
|
|
698
|
+
* @param params - Payment routing parameters
|
|
699
|
+
* @returns Result with transaction hash and tracking info
|
|
700
|
+
*/
|
|
701
|
+
routePayment(params: CrossChainPaymentParams): Promise<CrossChainPaymentResult>;
|
|
702
|
+
/**
|
|
703
|
+
* Get estimated fees for routing a payment
|
|
704
|
+
*
|
|
705
|
+
* @param params - Payment parameters
|
|
706
|
+
* @returns Quote with native fee and estimated receive amount
|
|
707
|
+
*/
|
|
708
|
+
estimateFees(params: CrossChainPaymentParams): Promise<{
|
|
709
|
+
nativeFee: bigint;
|
|
710
|
+
estimatedReceiveAmount: bigint;
|
|
711
|
+
estimatedTime: number;
|
|
712
|
+
}>;
|
|
713
|
+
/**
|
|
714
|
+
* Track message delivery status
|
|
715
|
+
*
|
|
716
|
+
* @param messageGuid - LayerZero message GUID from routePayment result
|
|
717
|
+
* @returns Current message status
|
|
718
|
+
*/
|
|
719
|
+
trackMessage(messageGuid: string): Promise<LayerZeroMessage>;
|
|
720
|
+
/**
|
|
721
|
+
* Wait for payment to be delivered on destination chain
|
|
722
|
+
*
|
|
723
|
+
* @param messageGuid - LayerZero message GUID from routePayment result
|
|
724
|
+
* @param options - Wait options (timeout, poll interval, callbacks)
|
|
725
|
+
* @returns Final message state when delivered
|
|
726
|
+
*/
|
|
727
|
+
waitForDelivery(messageGuid: string, options?: WaitForDeliveryOptions): Promise<LayerZeroMessage>;
|
|
728
|
+
/**
|
|
729
|
+
* Check if routing between two chains is supported
|
|
730
|
+
*
|
|
731
|
+
* @param sourceChain - Source chain name
|
|
732
|
+
* @param destinationChain - Destination chain name
|
|
733
|
+
* @returns True if routing is supported
|
|
734
|
+
*/
|
|
735
|
+
canRoute(sourceChain: string, destinationChain: string): boolean;
|
|
736
|
+
/**
|
|
737
|
+
* Get all supported destination chains from source chain
|
|
738
|
+
*
|
|
739
|
+
* @returns Array of chain names that can receive bridged funds
|
|
684
740
|
*/
|
|
685
741
|
getSupportedDestinations(): string[];
|
|
686
742
|
/**
|
|
687
|
-
*
|
|
743
|
+
* Validate routing parameters
|
|
744
|
+
*
|
|
745
|
+
* @param params - The cross-chain payment parameters to validate
|
|
746
|
+
* @throws Error if parameters are invalid or routing is not supported
|
|
688
747
|
*/
|
|
689
|
-
|
|
748
|
+
private validateParams;
|
|
690
749
|
}
|
|
691
750
|
/**
|
|
692
|
-
* Create a
|
|
751
|
+
* Create a cross-chain payment router
|
|
752
|
+
*
|
|
753
|
+
* @param signer - Wallet signer for bridge operations
|
|
754
|
+
* @param sourceChain - Chain where funds are located
|
|
755
|
+
* @returns A new CrossChainPaymentRouter instance
|
|
693
756
|
*/
|
|
694
|
-
declare function
|
|
757
|
+
declare function createCrossChainPaymentRouter(signer: BridgeSigner, sourceChain: string): CrossChainPaymentRouter;
|
|
695
758
|
|
|
696
759
|
/**
|
|
697
760
|
* LayerZero OFT Bridge Constants for USDT0
|
|
@@ -721,27 +784,44 @@ declare const USDT0_OFT_ADDRESSES: Record<string, Address>;
|
|
|
721
784
|
declare const LAYERZERO_ENDPOINT_V2: Address;
|
|
722
785
|
/**
|
|
723
786
|
* Get LayerZero endpoint ID for a chain
|
|
787
|
+
*
|
|
788
|
+
* @param chain - The chain name (e.g., 'ethereum', 'arbitrum')
|
|
789
|
+
* @returns The LayerZero endpoint ID, or undefined if chain not supported
|
|
724
790
|
*/
|
|
725
791
|
declare function getEndpointId(chain: string): number | undefined;
|
|
726
792
|
/**
|
|
727
793
|
* Get USDT0 OFT contract address for a chain
|
|
794
|
+
*
|
|
795
|
+
* @param chain - The chain name (e.g., 'ethereum', 'arbitrum')
|
|
796
|
+
* @returns The USDT0 OFT contract address, or undefined if chain not supported
|
|
728
797
|
*/
|
|
729
798
|
declare function getUsdt0OftAddress(chain: string): Address | undefined;
|
|
730
799
|
/**
|
|
731
800
|
* Check if a chain supports USDT0 bridging
|
|
801
|
+
*
|
|
802
|
+
* @param chain - The chain name to check (e.g., 'ethereum', 'arbitrum')
|
|
803
|
+
* @returns True if the chain supports USDT0 bridging, false otherwise
|
|
732
804
|
*/
|
|
733
805
|
declare function supportsBridging(chain: string): boolean;
|
|
734
806
|
/**
|
|
735
807
|
* Get all chains that support USDT0 bridging
|
|
808
|
+
*
|
|
809
|
+
* @returns Array of chain names that support USDT0 bridging
|
|
736
810
|
*/
|
|
737
811
|
declare function getBridgeableChains(): string[];
|
|
738
812
|
/**
|
|
739
813
|
* Convert address to bytes32 format for LayerZero
|
|
740
814
|
* Pads address with leading zeros to 32 bytes
|
|
815
|
+
*
|
|
816
|
+
* @param address - The EVM address to convert
|
|
817
|
+
* @returns The address as a bytes32 hex string with leading zeros
|
|
741
818
|
*/
|
|
742
819
|
declare function addressToBytes32(address: Address): `0x${string}`;
|
|
743
820
|
/**
|
|
744
821
|
* Convert bytes32 to address
|
|
822
|
+
*
|
|
823
|
+
* @param bytes32 - The bytes32 hex string to convert
|
|
824
|
+
* @returns The extracted EVM address from the last 20 bytes
|
|
745
825
|
*/
|
|
746
826
|
declare function bytes32ToAddress(bytes32: `0x${string}`): Address;
|
|
747
827
|
|
|
@@ -1183,10 +1263,17 @@ declare enum PaymasterType {
|
|
|
1183
1263
|
}
|
|
1184
1264
|
/**
|
|
1185
1265
|
* Pack verification and call gas limits into bytes32
|
|
1266
|
+
*
|
|
1267
|
+
* @param verificationGasLimit - The verification gas limit
|
|
1268
|
+
* @param callGasLimit - The call gas limit
|
|
1269
|
+
* @returns Packed bytes32 with gas limits
|
|
1186
1270
|
*/
|
|
1187
1271
|
declare function packAccountGasLimits(verificationGasLimit: bigint, callGasLimit: bigint): `0x${string}`;
|
|
1188
1272
|
/**
|
|
1189
1273
|
* Unpack account gas limits from bytes32
|
|
1274
|
+
*
|
|
1275
|
+
* @param packed - The packed bytes32 containing gas limits
|
|
1276
|
+
* @returns Object containing verificationGasLimit and callGasLimit
|
|
1190
1277
|
*/
|
|
1191
1278
|
declare function unpackAccountGasLimits(packed: `0x${string}`): {
|
|
1192
1279
|
verificationGasLimit: bigint;
|
|
@@ -1194,10 +1281,17 @@ declare function unpackAccountGasLimits(packed: `0x${string}`): {
|
|
|
1194
1281
|
};
|
|
1195
1282
|
/**
|
|
1196
1283
|
* Pack max priority fee and max fee per gas into bytes32
|
|
1284
|
+
*
|
|
1285
|
+
* @param maxPriorityFeePerGas - The max priority fee per gas (tip)
|
|
1286
|
+
* @param maxFeePerGas - The max fee per gas
|
|
1287
|
+
* @returns Packed bytes32 with gas fees
|
|
1197
1288
|
*/
|
|
1198
1289
|
declare function packGasFees(maxPriorityFeePerGas: bigint, maxFeePerGas: bigint): `0x${string}`;
|
|
1199
1290
|
/**
|
|
1200
1291
|
* Unpack gas fees from bytes32
|
|
1292
|
+
*
|
|
1293
|
+
* @param packed - The packed bytes32 containing gas fees
|
|
1294
|
+
* @returns Object containing maxPriorityFeePerGas and maxFeePerGas
|
|
1201
1295
|
*/
|
|
1202
1296
|
declare function unpackGasFees(packed: `0x${string}`): {
|
|
1203
1297
|
maxPriorityFeePerGas: bigint;
|
|
@@ -1226,46 +1320,95 @@ interface UserOpBuilderOptions {
|
|
|
1226
1320
|
declare class UserOpBuilder {
|
|
1227
1321
|
private readonly entryPoint;
|
|
1228
1322
|
private readonly gasMultiplier;
|
|
1323
|
+
/**
|
|
1324
|
+
* Create a new UserOpBuilder instance
|
|
1325
|
+
*
|
|
1326
|
+
* @param options - Optional configuration for the builder
|
|
1327
|
+
*/
|
|
1229
1328
|
constructor(options?: UserOpBuilderOptions);
|
|
1230
1329
|
/**
|
|
1231
1330
|
* Build a UserOperation from a transaction intent
|
|
1331
|
+
*
|
|
1332
|
+
* @param signer - The smart account signer
|
|
1333
|
+
* @param intent - The transaction intent to execute
|
|
1334
|
+
* @param client - The public client for chain interaction
|
|
1335
|
+
* @param gasEstimate - Optional gas estimates (uses defaults if not provided)
|
|
1336
|
+
* @param paymaster - Optional paymaster data for sponsored transactions
|
|
1337
|
+
* @returns A UserOperation ready for signing
|
|
1232
1338
|
*/
|
|
1233
1339
|
buildUserOp(signer: SmartAccountSigner, intent: TransactionIntent, client: PublicClient, gasEstimate?: GasEstimate, paymaster?: PaymasterData): Promise<UserOperation>;
|
|
1234
1340
|
/**
|
|
1235
1341
|
* Build a batch UserOperation from multiple transaction intents
|
|
1342
|
+
*
|
|
1343
|
+
* @param signer - The smart account signer
|
|
1344
|
+
* @param intents - Array of transaction intents to execute
|
|
1345
|
+
* @param client - The public client for chain interaction
|
|
1346
|
+
* @param gasEstimate - Optional gas estimates (uses defaults if not provided)
|
|
1347
|
+
* @param paymaster - Optional paymaster data for sponsored transactions
|
|
1348
|
+
* @returns A UserOperation ready for signing
|
|
1236
1349
|
*/
|
|
1237
1350
|
buildBatchUserOp(signer: SmartAccountSigner, intents: TransactionIntent[], client: PublicClient, gasEstimate?: GasEstimate, paymaster?: PaymasterData): Promise<UserOperation>;
|
|
1238
1351
|
/**
|
|
1239
1352
|
* Pack a UserOperation for on-chain submission (v0.7 format)
|
|
1353
|
+
*
|
|
1354
|
+
* @param userOp - The UserOperation to pack
|
|
1355
|
+
* @returns The packed UserOperation for on-chain submission
|
|
1240
1356
|
*/
|
|
1241
1357
|
packUserOp(userOp: UserOperation): PackedUserOperation;
|
|
1242
1358
|
/**
|
|
1243
1359
|
* Compute the UserOperation hash for signing
|
|
1360
|
+
*
|
|
1361
|
+
* @param userOp - The UserOperation to hash
|
|
1362
|
+
* @param client - The public client for chain interaction
|
|
1363
|
+
* @param _ - The chain ID (reserved for future use)
|
|
1364
|
+
* @returns The UserOperation hash
|
|
1244
1365
|
*/
|
|
1245
|
-
getUserOpHash(userOp: UserOperation, client: PublicClient,
|
|
1366
|
+
getUserOpHash(userOp: UserOperation, client: PublicClient, _: number): Promise<Hex>;
|
|
1246
1367
|
/**
|
|
1247
1368
|
* Sign a UserOperation
|
|
1369
|
+
*
|
|
1370
|
+
* @param userOp - The UserOperation to sign
|
|
1371
|
+
* @param signer - The smart account signer
|
|
1372
|
+
* @param client - The public client for chain interaction
|
|
1373
|
+
* @param chainId - The chain ID for the signature
|
|
1374
|
+
* @returns The UserOperation with signature attached
|
|
1248
1375
|
*/
|
|
1249
1376
|
signUserOp(userOp: UserOperation, signer: SmartAccountSigner, client: PublicClient, chainId: number): Promise<UserOperation>;
|
|
1250
1377
|
/**
|
|
1251
1378
|
* Get the nonce for an account from EntryPoint
|
|
1379
|
+
*
|
|
1380
|
+
* @param client - The public client for chain interaction
|
|
1381
|
+
* @param sender - The smart account address
|
|
1382
|
+
* @returns The current nonce for the account
|
|
1252
1383
|
*/
|
|
1253
1384
|
private getNonce;
|
|
1254
1385
|
/**
|
|
1255
1386
|
* Get current gas prices from the chain
|
|
1387
|
+
*
|
|
1388
|
+
* @param client - The public client for chain interaction
|
|
1389
|
+
* @returns The current gas prices for EIP-1559 transactions
|
|
1256
1390
|
*/
|
|
1257
1391
|
private getGasPrices;
|
|
1258
1392
|
/**
|
|
1259
1393
|
* Apply gas multiplier for safety margin
|
|
1394
|
+
*
|
|
1395
|
+
* @param gas - The gas amount to multiply
|
|
1396
|
+
* @returns The gas amount with safety margin applied
|
|
1260
1397
|
*/
|
|
1261
1398
|
private applyMultiplier;
|
|
1262
1399
|
/**
|
|
1263
1400
|
* Encode paymaster data for the UserOperation
|
|
1401
|
+
*
|
|
1402
|
+
* @param paymaster - The paymaster configuration
|
|
1403
|
+
* @returns The encoded paymaster data
|
|
1264
1404
|
*/
|
|
1265
1405
|
private encodePaymasterData;
|
|
1266
1406
|
}
|
|
1267
1407
|
/**
|
|
1268
1408
|
* Create a UserOpBuilder instance
|
|
1409
|
+
*
|
|
1410
|
+
* @param options - Optional configuration for the builder
|
|
1411
|
+
* @returns A new UserOpBuilder instance
|
|
1269
1412
|
*/
|
|
1270
1413
|
declare function createUserOpBuilder(options?: UserOpBuilderOptions): UserOpBuilder;
|
|
1271
1414
|
|
|
@@ -1282,6 +1425,13 @@ declare function createUserOpBuilder(options?: UserOpBuilderOptions): UserOpBuil
|
|
|
1282
1425
|
declare class BundlerError extends Error {
|
|
1283
1426
|
code?: number | undefined;
|
|
1284
1427
|
data?: unknown | undefined;
|
|
1428
|
+
/**
|
|
1429
|
+
* Create a new BundlerError
|
|
1430
|
+
*
|
|
1431
|
+
* @param message - The error message
|
|
1432
|
+
* @param code - Optional JSON-RPC error code
|
|
1433
|
+
* @param data - Optional additional error data
|
|
1434
|
+
*/
|
|
1285
1435
|
constructor(message: string, code?: number | undefined, data?: unknown | undefined);
|
|
1286
1436
|
}
|
|
1287
1437
|
/**
|
|
@@ -1290,15 +1440,25 @@ declare class BundlerError extends Error {
|
|
|
1290
1440
|
declare class BundlerClient {
|
|
1291
1441
|
private readonly bundlerUrl;
|
|
1292
1442
|
private readonly entryPoint;
|
|
1293
|
-
private readonly chainId;
|
|
1294
1443
|
private requestId;
|
|
1444
|
+
/**
|
|
1445
|
+
* Create a new BundlerClient instance
|
|
1446
|
+
*
|
|
1447
|
+
* @param config - Configuration for the bundler client
|
|
1448
|
+
*/
|
|
1295
1449
|
constructor(config: BundlerConfig);
|
|
1296
1450
|
/**
|
|
1297
1451
|
* Send a UserOperation to the bundler
|
|
1452
|
+
*
|
|
1453
|
+
* @param userOp - The UserOperation to send
|
|
1454
|
+
* @returns The result containing the userOpHash and a wait function
|
|
1298
1455
|
*/
|
|
1299
1456
|
sendUserOperation(userOp: UserOperation): Promise<UserOperationResult>;
|
|
1300
1457
|
/**
|
|
1301
1458
|
* Estimate gas for a UserOperation
|
|
1459
|
+
*
|
|
1460
|
+
* @param userOp - Partial UserOperation with required sender and callData
|
|
1461
|
+
* @returns Gas estimates for the UserOperation
|
|
1302
1462
|
*/
|
|
1303
1463
|
estimateUserOperationGas(userOp: Partial<UserOperation> & {
|
|
1304
1464
|
sender: Address;
|
|
@@ -1306,6 +1466,9 @@ declare class BundlerClient {
|
|
|
1306
1466
|
}): Promise<GasEstimate>;
|
|
1307
1467
|
/**
|
|
1308
1468
|
* Get UserOperation by hash
|
|
1469
|
+
*
|
|
1470
|
+
* @param userOpHash - The hash of the UserOperation to retrieve
|
|
1471
|
+
* @returns The UserOperation and EntryPoint, or null if not found
|
|
1309
1472
|
*/
|
|
1310
1473
|
getUserOperationByHash(userOpHash: Hex): Promise<{
|
|
1311
1474
|
userOperation: PackedUserOperation;
|
|
@@ -1313,18 +1476,31 @@ declare class BundlerClient {
|
|
|
1313
1476
|
} | null>;
|
|
1314
1477
|
/**
|
|
1315
1478
|
* Get UserOperation receipt
|
|
1479
|
+
*
|
|
1480
|
+
* @param userOpHash - The hash of the UserOperation
|
|
1481
|
+
* @returns The receipt, or null if not yet included
|
|
1316
1482
|
*/
|
|
1317
1483
|
getUserOperationReceipt(userOpHash: Hex): Promise<UserOperationReceipt | null>;
|
|
1318
1484
|
/**
|
|
1319
1485
|
* Get supported EntryPoints
|
|
1486
|
+
*
|
|
1487
|
+
* @returns Array of supported EntryPoint addresses
|
|
1320
1488
|
*/
|
|
1321
1489
|
getSupportedEntryPoints(): Promise<Address[]>;
|
|
1322
1490
|
/**
|
|
1323
1491
|
* Get chain ID from bundler
|
|
1492
|
+
*
|
|
1493
|
+
* @returns The chain ID
|
|
1324
1494
|
*/
|
|
1325
1495
|
getChainId(): Promise<number>;
|
|
1326
1496
|
/**
|
|
1327
1497
|
* Wait for UserOperation receipt with polling
|
|
1498
|
+
*
|
|
1499
|
+
* @param userOpHash - The hash of the UserOperation to wait for
|
|
1500
|
+
* @param options - Polling options
|
|
1501
|
+
* @param options.timeout - Maximum time to wait in milliseconds (default: 60000)
|
|
1502
|
+
* @param options.pollingInterval - Interval between polls in milliseconds (default: 2000)
|
|
1503
|
+
* @returns The UserOperation receipt
|
|
1328
1504
|
*/
|
|
1329
1505
|
waitForReceipt(userOpHash: Hex, options?: {
|
|
1330
1506
|
timeout?: number;
|
|
@@ -1332,19 +1508,32 @@ declare class BundlerClient {
|
|
|
1332
1508
|
}): Promise<UserOperationReceipt>;
|
|
1333
1509
|
/**
|
|
1334
1510
|
* Pack UserOperation for RPC (convert bigints to hex strings)
|
|
1511
|
+
*
|
|
1512
|
+
* @param userOp - The UserOperation to pack
|
|
1513
|
+
* @returns The packed UserOperation for RPC transmission
|
|
1335
1514
|
*/
|
|
1336
1515
|
private packForRpc;
|
|
1337
1516
|
/**
|
|
1338
1517
|
* Convert bigint to hex string
|
|
1518
|
+
*
|
|
1519
|
+
* @param value - The bigint value to convert
|
|
1520
|
+
* @returns The hex string representation
|
|
1339
1521
|
*/
|
|
1340
1522
|
private toHex;
|
|
1341
1523
|
/**
|
|
1342
1524
|
* Make a JSON-RPC call to the bundler
|
|
1525
|
+
*
|
|
1526
|
+
* @param method - The JSON-RPC method name
|
|
1527
|
+
* @param params - The method parameters
|
|
1528
|
+
* @returns The result from the bundler
|
|
1343
1529
|
*/
|
|
1344
1530
|
private rpcCall;
|
|
1345
1531
|
}
|
|
1346
1532
|
/**
|
|
1347
1533
|
* Create a BundlerClient instance
|
|
1534
|
+
*
|
|
1535
|
+
* @param config - Configuration for the bundler client
|
|
1536
|
+
* @returns A new BundlerClient instance
|
|
1348
1537
|
*/
|
|
1349
1538
|
declare function createBundlerClient(config: BundlerConfig): BundlerClient;
|
|
1350
1539
|
|
|
@@ -1386,50 +1575,106 @@ interface SponsorRequest {
|
|
|
1386
1575
|
*/
|
|
1387
1576
|
declare class PaymasterClient {
|
|
1388
1577
|
private readonly config;
|
|
1578
|
+
/**
|
|
1579
|
+
* Creates a new PaymasterClient instance
|
|
1580
|
+
*
|
|
1581
|
+
* @param config - Paymaster configuration including type, address, and optional URL
|
|
1582
|
+
*/
|
|
1389
1583
|
constructor(config: PaymasterConfig);
|
|
1390
1584
|
/**
|
|
1391
1585
|
* Get paymaster data for a UserOperation
|
|
1586
|
+
*
|
|
1587
|
+
* @param userOp - Partial UserOperation to get paymaster data for
|
|
1588
|
+
* @param chainId - The chain ID for the operation
|
|
1589
|
+
* @param entryPoint - The EntryPoint contract address
|
|
1590
|
+
* @param context - Optional context data for the paymaster
|
|
1591
|
+
* @returns Paymaster data including address and gas limits
|
|
1392
1592
|
*/
|
|
1393
1593
|
getPaymasterData(userOp: Partial<UserOperation>, chainId: number, entryPoint: Address, context?: Record<string, unknown>): Promise<PaymasterData>;
|
|
1394
1594
|
/**
|
|
1395
1595
|
* Get gas estimates including paymaster gas
|
|
1596
|
+
*
|
|
1597
|
+
* @param _userOp - Partial UserOperation to estimate gas for (reserved for future use)
|
|
1598
|
+
* @param _chainId - The chain ID for the operation (reserved for future use)
|
|
1599
|
+
* @returns Gas estimates including paymaster verification and postOp gas
|
|
1396
1600
|
*/
|
|
1397
|
-
estimatePaymasterGas(
|
|
1601
|
+
estimatePaymasterGas(_userOp: Partial<UserOperation>, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
1602
|
+
_chainId: number): Promise<GasEstimate>;
|
|
1398
1603
|
/**
|
|
1399
1604
|
* Check if the paymaster will sponsor this operation
|
|
1605
|
+
*
|
|
1606
|
+
* @param userOp - Partial UserOperation to check sponsorship for
|
|
1607
|
+
* @param chainId - The chain ID for the operation
|
|
1608
|
+
* @param entryPoint - The EntryPoint contract address
|
|
1609
|
+
* @param context - Optional context data for policy validation
|
|
1610
|
+
* @returns True if the paymaster will sponsor the operation
|
|
1400
1611
|
*/
|
|
1401
1612
|
willSponsor(userOp: Partial<UserOperation>, chainId: number, entryPoint: Address, context?: Record<string, unknown>): Promise<boolean>;
|
|
1402
1613
|
/**
|
|
1403
1614
|
* Get verifying paymaster data (off-chain signature)
|
|
1615
|
+
*
|
|
1616
|
+
* @param userOp - Partial UserOperation to get paymaster data for
|
|
1617
|
+
* @param chainId - The chain ID for the operation
|
|
1618
|
+
* @param entryPoint - The EntryPoint contract address
|
|
1619
|
+
* @returns Paymaster data with verification signature
|
|
1404
1620
|
*/
|
|
1405
1621
|
private getVerifyingPaymasterData;
|
|
1406
1622
|
/**
|
|
1407
1623
|
* Get sponsoring paymaster data (third-party pays)
|
|
1624
|
+
*
|
|
1625
|
+
* @param userOp - Partial UserOperation to get sponsorship for
|
|
1626
|
+
* @param chainId - The chain ID for the operation
|
|
1627
|
+
* @param entryPoint - The EntryPoint contract address
|
|
1628
|
+
* @param context - Optional context data for sponsorship validation
|
|
1629
|
+
* @returns Paymaster data for sponsored operation
|
|
1408
1630
|
*/
|
|
1409
1631
|
private getSponsoringPaymasterData;
|
|
1410
1632
|
/**
|
|
1411
1633
|
* Get token paymaster data (pay gas with ERC20)
|
|
1634
|
+
*
|
|
1635
|
+
* @param userOp - Partial UserOperation to get token paymaster data for
|
|
1636
|
+
* @param chainId - The chain ID for the operation
|
|
1637
|
+
* @param entryPoint - The EntryPoint contract address
|
|
1638
|
+
* @returns Paymaster data for ERC20 token payment
|
|
1412
1639
|
*/
|
|
1413
1640
|
private getTokenPaymasterData;
|
|
1414
1641
|
/**
|
|
1415
1642
|
* Call paymaster service API
|
|
1643
|
+
*
|
|
1644
|
+
* @param userOp - Partial UserOperation to send to the service
|
|
1645
|
+
* @param chainId - The chain ID for the operation
|
|
1646
|
+
* @param entryPoint - The EntryPoint contract address
|
|
1647
|
+
* @param context - Optional context data for the service
|
|
1648
|
+
* @returns Paymaster data from the service response
|
|
1416
1649
|
*/
|
|
1417
1650
|
private callPaymasterService;
|
|
1418
1651
|
/**
|
|
1419
1652
|
* Serialize UserOperation for API calls
|
|
1653
|
+
*
|
|
1654
|
+
* @param userOp - Partial UserOperation to serialize
|
|
1655
|
+
* @returns Serialized UserOperation with hex-encoded values
|
|
1420
1656
|
*/
|
|
1421
1657
|
private serializeUserOp;
|
|
1422
1658
|
}
|
|
1423
1659
|
/**
|
|
1424
1660
|
* Create a PaymasterClient instance
|
|
1661
|
+
*
|
|
1662
|
+
* @param config - Paymaster configuration including type, address, and optional URL
|
|
1663
|
+
* @returns A new PaymasterClient instance
|
|
1425
1664
|
*/
|
|
1426
1665
|
declare function createPaymasterClient(config: PaymasterConfig): PaymasterClient;
|
|
1427
1666
|
/**
|
|
1428
1667
|
* Encode paymaster data for inclusion in UserOperation
|
|
1668
|
+
*
|
|
1669
|
+
* @param data - Paymaster data to encode
|
|
1670
|
+
* @returns Encoded paymasterAndData hex string
|
|
1429
1671
|
*/
|
|
1430
1672
|
declare function encodePaymasterAndData(data: PaymasterData): Hex;
|
|
1431
1673
|
/**
|
|
1432
1674
|
* Decode paymaster and data from UserOperation
|
|
1675
|
+
*
|
|
1676
|
+
* @param paymasterAndData - Encoded paymasterAndData hex string
|
|
1677
|
+
* @returns Decoded PaymasterData or null if invalid/empty
|
|
1433
1678
|
*/
|
|
1434
1679
|
declare function decodePaymasterAndData(paymasterAndData: Hex): PaymasterData | null;
|
|
1435
1680
|
|
|
@@ -1483,6 +1728,11 @@ declare class GaslessT402Client {
|
|
|
1483
1728
|
private readonly paymaster?;
|
|
1484
1729
|
private readonly chainId;
|
|
1485
1730
|
private readonly publicClient;
|
|
1731
|
+
/**
|
|
1732
|
+
* Creates a new GaslessT402Client instance
|
|
1733
|
+
*
|
|
1734
|
+
* @param config - Configuration including signer, bundler, paymaster, and chain settings
|
|
1735
|
+
*/
|
|
1486
1736
|
constructor(config: GaslessClientConfig);
|
|
1487
1737
|
/**
|
|
1488
1738
|
* Execute a T402 payment via ERC-4337
|
|
@@ -1490,48 +1740,79 @@ declare class GaslessT402Client {
|
|
|
1490
1740
|
* This submits the payment as a UserOperation which can be:
|
|
1491
1741
|
* - Sponsored by a paymaster (truly gasless)
|
|
1492
1742
|
* - Paid from the smart account's balance
|
|
1743
|
+
*
|
|
1744
|
+
* @param params - Payment parameters including token, recipient, and amount
|
|
1745
|
+
* @returns Result containing the user operation hash and wait function
|
|
1493
1746
|
*/
|
|
1494
1747
|
executePayment(params: GaslessPaymentParams): Promise<UserOperationResult>;
|
|
1495
1748
|
/**
|
|
1496
1749
|
* Execute multiple T402 payments in a single UserOperation
|
|
1750
|
+
*
|
|
1751
|
+
* @param payments - Array of payment parameters to batch together
|
|
1752
|
+
* @returns Result containing the user operation hash and wait function
|
|
1497
1753
|
*/
|
|
1498
1754
|
executeBatchPayments(payments: GaslessPaymentParams[]): Promise<UserOperationResult>;
|
|
1499
1755
|
/**
|
|
1500
1756
|
* Check if a payment can be sponsored (gasless)
|
|
1757
|
+
*
|
|
1758
|
+
* @param params - Payment parameters to check for sponsorship eligibility
|
|
1759
|
+
* @returns True if the payment can be sponsored by the paymaster
|
|
1501
1760
|
*/
|
|
1502
1761
|
canSponsor(params: GaslessPaymentParams): Promise<boolean>;
|
|
1503
1762
|
/**
|
|
1504
1763
|
* Get the smart account address
|
|
1764
|
+
*
|
|
1765
|
+
* @returns The address of the smart account
|
|
1505
1766
|
*/
|
|
1506
1767
|
getAccountAddress(): Promise<Address>;
|
|
1507
1768
|
/**
|
|
1508
1769
|
* Check if the smart account is deployed
|
|
1770
|
+
*
|
|
1771
|
+
* @returns True if the smart account contract is deployed on-chain
|
|
1509
1772
|
*/
|
|
1510
1773
|
isAccountDeployed(): Promise<boolean>;
|
|
1511
1774
|
/**
|
|
1512
1775
|
* Build call data for a simple ERC20 transfer
|
|
1776
|
+
*
|
|
1777
|
+
* @param params - Payment parameters including recipient and amount
|
|
1778
|
+
* @returns Encoded call data for ERC20 transfer function
|
|
1513
1779
|
*/
|
|
1514
1780
|
private buildTransferCallData;
|
|
1515
1781
|
/**
|
|
1516
1782
|
* Build call data for an authorized transfer (EIP-3009)
|
|
1783
|
+
*
|
|
1784
|
+
* @param params - Payment parameters including authorization signature
|
|
1785
|
+
* @returns Encoded call data for transferWithAuthorization function
|
|
1517
1786
|
*/
|
|
1518
1787
|
private buildAuthorizedTransferCallData;
|
|
1519
1788
|
/**
|
|
1520
1789
|
* Estimate gas for a single transaction
|
|
1790
|
+
*
|
|
1791
|
+
* @param intent - Transaction intent with target, value, and data
|
|
1792
|
+
* @returns Gas estimates for the UserOperation
|
|
1521
1793
|
*/
|
|
1522
1794
|
private estimateGas;
|
|
1523
1795
|
/**
|
|
1524
1796
|
* Estimate gas for a batch transaction
|
|
1797
|
+
*
|
|
1798
|
+
* @param intents - Array of transaction intents to batch
|
|
1799
|
+
* @returns Gas estimates for the batched UserOperation
|
|
1525
1800
|
*/
|
|
1526
1801
|
private estimateBatchGas;
|
|
1527
1802
|
/**
|
|
1528
1803
|
* Get paymaster data if configured
|
|
1804
|
+
*
|
|
1805
|
+
* @param _ - Gas estimates (unused but kept for potential future use)
|
|
1806
|
+
* @returns Paymaster data or undefined if no paymaster configured
|
|
1529
1807
|
*/
|
|
1530
1808
|
private getPaymasterData;
|
|
1531
1809
|
}
|
|
1532
1810
|
/**
|
|
1533
1811
|
* Create a GaslessT402Client instance
|
|
1812
|
+
*
|
|
1813
|
+
* @param config - Configuration including signer, bundler, paymaster, and chain settings
|
|
1814
|
+
* @returns A new GaslessT402Client instance
|
|
1534
1815
|
*/
|
|
1535
1816
|
declare function createGaslessT402Client(config: GaslessClientConfig): GaslessT402Client;
|
|
1536
1817
|
|
|
1537
|
-
export { ACCOUNT_ABI, BUNDLER_METHODS, type BridgeExecuteParams, type BridgeQuote, type BridgeQuoteParams, type BridgeResult, type BridgeSigner, type BridgeStatus, type BridgeTransaction, BundlerClient, type BundlerConfig, BundlerError,
|
|
1818
|
+
export { ACCOUNT_ABI, BUNDLER_METHODS, type BridgeExecuteParams, type BridgeQuote, type BridgeQuoteParams, type BridgeResult, type BridgeSigner, type BridgeStatus, type BridgeTransaction, BundlerClient, type BundlerConfig, BundlerError, type CrossChainPaymentParams, type CrossChainPaymentResult, CrossChainPaymentRouter, DEFAULT_GAS_LIMITS, ENTRYPOINT_V06_ADDRESS, ENTRYPOINT_V07_ABI, ENTRYPOINT_V07_ADDRESS, ExactLegacyEvmScheme$2 as ExactLegacyEvmClientScheme, ExactLegacyEvmScheme as ExactLegacyEvmFacilitatorScheme, type ExactLegacyEvmSchemeConfig as ExactLegacyEvmFacilitatorSchemeConfig, ExactLegacyEvmScheme$1 as ExactLegacyEvmServerScheme, type ExactLegacyEvmSchemeConfig$1 as ExactLegacyEvmServerSchemeConfig, type GasEstimate, type GaslessClientConfig, type GaslessPaymentParams, GaslessT402Client, LAYERZERO_ENDPOINT_IDS, LAYERZERO_ENDPOINT_V2, LAYERZERO_SCAN_BASE_URL, type LayerZeroMessage, type LayerZeroMessageStatus, LayerZeroScanClient, type PackedUserOperation, PaymasterClient, type PaymasterConfig, type PaymasterData, type PaymasterResponse, PaymasterType, type SmartAccountSigner, type SponsorRequest, type TransactionIntent, type TransactionLog, type TransactionReceipt, USDT0_OFT_ADDRESSES, Usdt0Bridge, UserOpBuilder, type UserOpBuilderConfig, type UserOpBuilderOptions, type UserOperation, type UserOperationReceipt, type UserOperationResult, type WaitForDeliveryOptions, addressToBytes32, bytes32ToAddress, createBundlerClient, createCrossChainPaymentRouter, createGaslessT402Client, createLayerZeroScanClient, createPaymasterClient, createUsdt0Bridge, createUserOpBuilder, decodePaymasterAndData, encodePaymasterAndData, getBridgeableChains, getEndpointId, getUsdt0OftAddress, packAccountGasLimits, packGasFees, supportsBridging, unpackAccountGasLimits, unpackGasFees };
|