@palindromepay/sdk 1.9.7 → 1.9.9
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/PalindromePaySDK.d.ts +1214 -0
- package/dist/PalindromePaySDK.js +2700 -0
- package/dist/contract/PalindromePay.json +1 -0
- package/dist/contract/PalindromePayWallet.json +1 -0
- package/dist/contract/USDT.json +310 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/subgraph/queries.d.ts +21 -0
- package/dist/subgraph/queries.js +466 -0
- package/dist/types/escrow.d.ts +48 -0
- package/dist/types/escrow.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PALINDROME Pay SDK
|
|
3
|
+
*
|
|
4
|
+
* Key contract functions:
|
|
5
|
+
* - createEscrow(token, buyer, amount, maturityDays, arbiter, title, ipfsHash, sellerWalletSig)
|
|
6
|
+
* - createEscrowAndDeposit(token, seller, amount, maturityDays, arbiter, title, ipfsHash, buyerWalletSig)
|
|
7
|
+
* - deposit(escrowId, buyerWalletSig)
|
|
8
|
+
* - acceptEscrow(escrowId, sellerWalletSig)
|
|
9
|
+
* - confirmDelivery(escrowId, buyerWalletSig)
|
|
10
|
+
* - confirmDeliverySigned(escrowId, coordSignature, deadline, nonce, buyerWalletSig)
|
|
11
|
+
* - requestCancel(escrowId, walletSig)
|
|
12
|
+
* - cancelByTimeout(escrowId)
|
|
13
|
+
* - autoRelease(escrowId)
|
|
14
|
+
* - startDispute(escrowId)
|
|
15
|
+
* - startDisputeSigned(escrowId, signature, deadline, nonce)
|
|
16
|
+
* - submitDisputeMessage(escrowId, role, ipfsHash)
|
|
17
|
+
* - submitArbiterDecision(escrowId, resolution, ipfsHash, arbiterWalletSig)
|
|
18
|
+
* - Wallet: withdraw()
|
|
19
|
+
*/
|
|
20
|
+
import { Address, Abi, PublicClient, WalletClient, Hex, Transport, Account, Chain } from "viem";
|
|
21
|
+
import { ApolloClient } from "@apollo/client";
|
|
22
|
+
export type ViemError = {
|
|
23
|
+
message: string;
|
|
24
|
+
shortMessage?: string;
|
|
25
|
+
cause?: {
|
|
26
|
+
reason?: string;
|
|
27
|
+
message?: string;
|
|
28
|
+
};
|
|
29
|
+
code?: number;
|
|
30
|
+
stack?: string;
|
|
31
|
+
};
|
|
32
|
+
export type ContractError = ViemError & {
|
|
33
|
+
contractAddress?: Address;
|
|
34
|
+
functionName?: string;
|
|
35
|
+
args?: readonly unknown[];
|
|
36
|
+
};
|
|
37
|
+
export type RPCError = {
|
|
38
|
+
message: string;
|
|
39
|
+
code?: number;
|
|
40
|
+
data?: unknown;
|
|
41
|
+
};
|
|
42
|
+
export type UnknownError = {
|
|
43
|
+
message?: string;
|
|
44
|
+
toString(): string;
|
|
45
|
+
};
|
|
46
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';
|
|
47
|
+
export interface SDKLogger {
|
|
48
|
+
debug(message: string, context?: unknown): void;
|
|
49
|
+
info(message: string, context?: unknown): void;
|
|
50
|
+
warn(message: string, context?: unknown): void;
|
|
51
|
+
error(message: string, context?: unknown): void;
|
|
52
|
+
}
|
|
53
|
+
import { Escrow } from "./types/escrow";
|
|
54
|
+
export declare enum EscrowState {
|
|
55
|
+
AWAITING_PAYMENT = 0,
|
|
56
|
+
AWAITING_DELIVERY = 1,
|
|
57
|
+
DISPUTED = 2,
|
|
58
|
+
COMPLETE = 3,
|
|
59
|
+
REFUNDED = 4,
|
|
60
|
+
CANCELED = 5
|
|
61
|
+
}
|
|
62
|
+
export declare enum DisputeResolution {
|
|
63
|
+
Complete = 3,
|
|
64
|
+
Refunded = 4
|
|
65
|
+
}
|
|
66
|
+
export declare enum Role {
|
|
67
|
+
None = 0,
|
|
68
|
+
Buyer = 1,
|
|
69
|
+
Seller = 2,
|
|
70
|
+
Arbiter = 3
|
|
71
|
+
}
|
|
72
|
+
export declare enum SDKErrorCode {
|
|
73
|
+
WALLET_NOT_CONNECTED = "WALLET_NOT_CONNECTED",
|
|
74
|
+
WALLET_ACCOUNT_MISSING = "WALLET_ACCOUNT_MISSING",
|
|
75
|
+
NOT_BUYER = "NOT_BUYER",
|
|
76
|
+
NOT_SELLER = "NOT_SELLER",
|
|
77
|
+
NOT_ARBITER = "NOT_ARBITER",
|
|
78
|
+
INVALID_STATE = "INVALID_STATE",
|
|
79
|
+
INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
|
|
80
|
+
ALLOWANCE_FAILED = "ALLOWANCE_FAILED",
|
|
81
|
+
SIGNATURE_EXPIRED = "SIGNATURE_EXPIRED",
|
|
82
|
+
TRANSACTION_FAILED = "TRANSACTION_FAILED",
|
|
83
|
+
INVALID_ROLE = "INVALID_ROLE",
|
|
84
|
+
INVALID_TOKEN = "INVALID_TOKEN",
|
|
85
|
+
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
86
|
+
RPC_ERROR = "RPC_ERROR",
|
|
87
|
+
EVIDENCE_ALREADY_SUBMITTED = "EVIDENCE_ALREADY_SUBMITTED",
|
|
88
|
+
ESCROW_NOT_FOUND = "ESCROW_NOT_FOUND",
|
|
89
|
+
ALREADY_ACCEPTED = "ALREADY_ACCEPTED"
|
|
90
|
+
}
|
|
91
|
+
export type EscrowWalletClient = WalletClient<Transport, Chain, Account>;
|
|
92
|
+
export declare class SDKError extends Error {
|
|
93
|
+
code: SDKErrorCode;
|
|
94
|
+
details?: ViemError | RPCError | UnknownError | Record<string, unknown>;
|
|
95
|
+
constructor(message: string, code: SDKErrorCode, details?: ViemError | RPCError | UnknownError | Record<string, unknown>);
|
|
96
|
+
}
|
|
97
|
+
export interface PalindromePaySDKConfig {
|
|
98
|
+
publicClient: PublicClient;
|
|
99
|
+
contractAddress: Address;
|
|
100
|
+
walletClient?: EscrowWalletClient;
|
|
101
|
+
apolloClient?: ApolloClient;
|
|
102
|
+
chain?: Chain;
|
|
103
|
+
/** Cache TTL in milliseconds (default: 5000) */
|
|
104
|
+
cacheTTL?: number;
|
|
105
|
+
/** Maximum cache entries before LRU eviction (default: 1000) */
|
|
106
|
+
maxCacheSize?: number;
|
|
107
|
+
/** Enable automatic retry on RPC failures (default: true) */
|
|
108
|
+
enableRetry?: boolean;
|
|
109
|
+
/** Maximum retry attempts (default: 3) */
|
|
110
|
+
maxRetries?: number;
|
|
111
|
+
/** Retry delay in milliseconds (default: 1000) */
|
|
112
|
+
retryDelay?: number;
|
|
113
|
+
/** Gas buffer percentage (default: 20) */
|
|
114
|
+
gasBuffer?: number;
|
|
115
|
+
/** Transaction receipt timeout in milliseconds (default: 60000) */
|
|
116
|
+
receiptTimeout?: number;
|
|
117
|
+
subgraphUrl?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Skip eth_call simulation before sending transactions (default: false)
|
|
120
|
+
* Enable this for chains with unreliable RPC simulation (e.g., Base Sepolia)
|
|
121
|
+
* When true, transactions are sent directly without pre-flight simulation
|
|
122
|
+
*/
|
|
123
|
+
skipSimulation?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Default gas limit when simulation is skipped (default: 500000n)
|
|
126
|
+
* Only used when skipSimulation is true
|
|
127
|
+
*/
|
|
128
|
+
defaultGasLimit?: bigint;
|
|
129
|
+
/**
|
|
130
|
+
* Logger instance for SDK events and errors (default: console)
|
|
131
|
+
* Set to custom logger or use noOpLogger to disable
|
|
132
|
+
*/
|
|
133
|
+
logger?: SDKLogger;
|
|
134
|
+
/**
|
|
135
|
+
* Minimum log level to output (default: 'info')
|
|
136
|
+
* 'debug' shows all logs, 'none' disables all logging
|
|
137
|
+
*/
|
|
138
|
+
logLevel?: LogLevel;
|
|
139
|
+
}
|
|
140
|
+
export interface CreateEscrowParams {
|
|
141
|
+
token: Address;
|
|
142
|
+
buyer: Address;
|
|
143
|
+
amount: bigint;
|
|
144
|
+
maturityTimeDays?: bigint;
|
|
145
|
+
arbiter?: Address;
|
|
146
|
+
title: string;
|
|
147
|
+
ipfsHash?: string;
|
|
148
|
+
}
|
|
149
|
+
export interface CreateEscrowAndDepositParams {
|
|
150
|
+
token: Address;
|
|
151
|
+
seller: Address;
|
|
152
|
+
amount: bigint;
|
|
153
|
+
maturityTimeDays?: bigint;
|
|
154
|
+
arbiter?: Address;
|
|
155
|
+
title: string;
|
|
156
|
+
ipfsHash?: string;
|
|
157
|
+
}
|
|
158
|
+
/** Raw escrow data from contract (before type narrowing to Address/Hex) */
|
|
159
|
+
export interface RawEscrowData {
|
|
160
|
+
token: `0x${string}`;
|
|
161
|
+
buyer: `0x${string}`;
|
|
162
|
+
seller: `0x${string}`;
|
|
163
|
+
arbiter: `0x${string}`;
|
|
164
|
+
wallet: `0x${string}`;
|
|
165
|
+
amount: bigint;
|
|
166
|
+
depositTime: bigint;
|
|
167
|
+
maturityTime: bigint;
|
|
168
|
+
disputeStartTime: bigint;
|
|
169
|
+
state: number;
|
|
170
|
+
buyerCancelRequested: boolean;
|
|
171
|
+
sellerCancelRequested: boolean;
|
|
172
|
+
tokenDecimals: number;
|
|
173
|
+
sellerWalletSig: `0x${string}`;
|
|
174
|
+
buyerWalletSig: `0x${string}`;
|
|
175
|
+
arbiterWalletSig: `0x${string}`;
|
|
176
|
+
}
|
|
177
|
+
/** Parsed escrow data with proper types */
|
|
178
|
+
export interface EscrowData {
|
|
179
|
+
token: Address;
|
|
180
|
+
buyer: Address;
|
|
181
|
+
seller: Address;
|
|
182
|
+
arbiter: Address;
|
|
183
|
+
wallet: Address;
|
|
184
|
+
amount: bigint;
|
|
185
|
+
depositTime: bigint;
|
|
186
|
+
maturityTime: bigint;
|
|
187
|
+
disputeStartTime: bigint;
|
|
188
|
+
state: EscrowState;
|
|
189
|
+
buyerCancelRequested: boolean;
|
|
190
|
+
sellerCancelRequested: boolean;
|
|
191
|
+
tokenDecimals: number;
|
|
192
|
+
sellerWalletSig: Hex;
|
|
193
|
+
buyerWalletSig: Hex;
|
|
194
|
+
arbiterWalletSig: Hex;
|
|
195
|
+
}
|
|
196
|
+
export interface EscrowCreatedEvent {
|
|
197
|
+
escrowId: bigint;
|
|
198
|
+
buyer: Address;
|
|
199
|
+
seller: Address;
|
|
200
|
+
token: Address;
|
|
201
|
+
amount: bigint;
|
|
202
|
+
arbiter: Address;
|
|
203
|
+
maturityTime: bigint;
|
|
204
|
+
title: string;
|
|
205
|
+
ipfsHash: string;
|
|
206
|
+
}
|
|
207
|
+
export interface DisputeSubmissionStatus {
|
|
208
|
+
buyer: boolean;
|
|
209
|
+
seller: boolean;
|
|
210
|
+
arbiter: boolean;
|
|
211
|
+
allSubmitted: boolean;
|
|
212
|
+
}
|
|
213
|
+
export declare class PalindromePaySDK {
|
|
214
|
+
readonly contractAddress: Address;
|
|
215
|
+
readonly abiEscrow: Abi;
|
|
216
|
+
readonly abiWallet: Abi;
|
|
217
|
+
readonly abiERC20: Abi;
|
|
218
|
+
readonly publicClient: PublicClient;
|
|
219
|
+
readonly walletClient?: EscrowWalletClient;
|
|
220
|
+
readonly apollo: ApolloClient;
|
|
221
|
+
readonly chain: Chain;
|
|
222
|
+
private readonly cacheTTL;
|
|
223
|
+
private readonly maxCacheSize;
|
|
224
|
+
private readonly enableRetry;
|
|
225
|
+
private readonly maxRetries;
|
|
226
|
+
private readonly retryDelay;
|
|
227
|
+
private readonly gasBuffer;
|
|
228
|
+
private readonly receiptTimeout;
|
|
229
|
+
private readonly skipSimulation;
|
|
230
|
+
private readonly defaultGasLimit;
|
|
231
|
+
private readonly logger;
|
|
232
|
+
private readonly logLevel;
|
|
233
|
+
/** LRU cache for escrow data with automatic eviction */
|
|
234
|
+
private escrowCache;
|
|
235
|
+
/** Cache for token decimals (rarely changes, no eviction needed) */
|
|
236
|
+
private tokenDecimalsCache;
|
|
237
|
+
/** Cache for immutable contract values */
|
|
238
|
+
private feeReceiverCache;
|
|
239
|
+
/** Cached multicall support status per chain (null = not yet detected) */
|
|
240
|
+
private multicallSupported;
|
|
241
|
+
private readonly STATE_NAMES;
|
|
242
|
+
constructor(config: PalindromePaySDKConfig);
|
|
243
|
+
/**
|
|
244
|
+
* Internal logging helper that respects log level configuration
|
|
245
|
+
*/
|
|
246
|
+
private log;
|
|
247
|
+
/**
|
|
248
|
+
* Execute a contract write with resilient simulation handling.
|
|
249
|
+
*
|
|
250
|
+
* This method handles unreliable RPC simulation on certain chains (e.g., Base Sepolia)
|
|
251
|
+
* by falling back to direct transaction sending when simulation fails.
|
|
252
|
+
*
|
|
253
|
+
* @param walletClient - The wallet client to use
|
|
254
|
+
* @param params - Contract call parameters
|
|
255
|
+
* @param params.address - Contract address
|
|
256
|
+
* @param params.abi - Contract ABI
|
|
257
|
+
* @param params.functionName - Function to call
|
|
258
|
+
* @param params.args - Function arguments
|
|
259
|
+
* @returns Transaction hash
|
|
260
|
+
*/
|
|
261
|
+
private resilientWriteContract;
|
|
262
|
+
/**
|
|
263
|
+
* Wait for transaction receipt with timeout and retry logic.
|
|
264
|
+
*/
|
|
265
|
+
private waitForReceipt;
|
|
266
|
+
/**
|
|
267
|
+
* Execute an async operation with retry logic.
|
|
268
|
+
*/
|
|
269
|
+
private withRetry;
|
|
270
|
+
/**
|
|
271
|
+
* Extract error message from unknown error type.
|
|
272
|
+
*/
|
|
273
|
+
private extractErrorMessage;
|
|
274
|
+
/**
|
|
275
|
+
* Validate common escrow creation parameters.
|
|
276
|
+
*/
|
|
277
|
+
private validateCreateEscrowParams;
|
|
278
|
+
/**
|
|
279
|
+
* Verify caller is the buyer, throw if not.
|
|
280
|
+
*/
|
|
281
|
+
private verifyBuyer;
|
|
282
|
+
/**
|
|
283
|
+
* Verify caller is the seller, throw if not.
|
|
284
|
+
*/
|
|
285
|
+
private verifySeller;
|
|
286
|
+
/**
|
|
287
|
+
* Verify caller is the arbiter, throw if not.
|
|
288
|
+
*/
|
|
289
|
+
private verifyArbiter;
|
|
290
|
+
/**
|
|
291
|
+
* Verify escrow is in expected state, throw if not.
|
|
292
|
+
*/
|
|
293
|
+
private verifyState;
|
|
294
|
+
/**
|
|
295
|
+
* Send transaction directly without simulation.
|
|
296
|
+
* Encodes function data manually and sends with fixed gas limit.
|
|
297
|
+
*
|
|
298
|
+
* @param walletClient - The wallet client to send from
|
|
299
|
+
* @param params - Contract write parameters
|
|
300
|
+
* @returns Transaction hash
|
|
301
|
+
*/
|
|
302
|
+
private sendTransactionDirect;
|
|
303
|
+
/**
|
|
304
|
+
* Detect if error is a simulation failure (not user rejection or validation error).
|
|
305
|
+
*
|
|
306
|
+
* @param error - The error to check
|
|
307
|
+
* @returns True if error is from simulation failure
|
|
308
|
+
*/
|
|
309
|
+
private isSimulationErrorType;
|
|
310
|
+
/**
|
|
311
|
+
* Set a value in the LRU cache with automatic eviction.
|
|
312
|
+
*/
|
|
313
|
+
private setCacheValue;
|
|
314
|
+
/**
|
|
315
|
+
* Get a value from the LRU cache, refreshing its position.
|
|
316
|
+
*/
|
|
317
|
+
private getCacheValue;
|
|
318
|
+
/**
|
|
319
|
+
* Get the EIP-712 domain for wallet authorization signatures
|
|
320
|
+
*/
|
|
321
|
+
private getWalletDomain;
|
|
322
|
+
/**
|
|
323
|
+
* Get the EIP-712 domain for escrow contract signatures
|
|
324
|
+
*/
|
|
325
|
+
private getEscrowDomain;
|
|
326
|
+
private readonly walletAuthorizationTypes;
|
|
327
|
+
private readonly confirmDeliveryTypes;
|
|
328
|
+
private readonly startDisputeTypes;
|
|
329
|
+
/**
|
|
330
|
+
* Sign a wallet authorization for a participant
|
|
331
|
+
* Used for: deposit, confirmDelivery, requestCancel, submitArbiterDecision
|
|
332
|
+
*/
|
|
333
|
+
signWalletAuthorization(walletClient: EscrowWalletClient, walletAddress: Address, escrowId: bigint): Promise<Hex>;
|
|
334
|
+
/**
|
|
335
|
+
* Sign a confirm delivery message (for gasless meta-tx)
|
|
336
|
+
*/
|
|
337
|
+
signConfirmDelivery(walletClient: EscrowWalletClient, escrowId: bigint, deadline: bigint, nonce: bigint): Promise<Hex>;
|
|
338
|
+
/**
|
|
339
|
+
* Sign a start dispute message (for gasless meta-tx)
|
|
340
|
+
*/
|
|
341
|
+
signStartDispute(walletClient: EscrowWalletClient, escrowId: bigint, deadline: bigint, nonce: bigint): Promise<Hex>;
|
|
342
|
+
/**
|
|
343
|
+
* Create a signature deadline (timestamp + minutes)
|
|
344
|
+
*/
|
|
345
|
+
createSignatureDeadline(minutesFromNow?: number): Promise<bigint>;
|
|
346
|
+
/**
|
|
347
|
+
* Check if signature deadline has expired
|
|
348
|
+
*/
|
|
349
|
+
isSignatureDeadlineExpired(deadline: bigint, safetySeconds?: number): boolean;
|
|
350
|
+
/**
|
|
351
|
+
* Predict the wallet address for a given escrow ID (before creation)
|
|
352
|
+
*/
|
|
353
|
+
predictWalletAddress(escrowId: bigint): Promise<Address>;
|
|
354
|
+
/**
|
|
355
|
+
* Get raw escrow data from contract
|
|
356
|
+
*/
|
|
357
|
+
getEscrowById(escrowId: bigint): Promise<RawEscrowData>;
|
|
358
|
+
/**
|
|
359
|
+
* Get parsed escrow data
|
|
360
|
+
*/
|
|
361
|
+
getEscrowByIdParsed(escrowId: bigint): Promise<EscrowData>;
|
|
362
|
+
/**
|
|
363
|
+
* Get next escrow ID
|
|
364
|
+
*/
|
|
365
|
+
getNextEscrowId(): Promise<bigint>;
|
|
366
|
+
/**
|
|
367
|
+
* Get the nonce bitmap from the contract.
|
|
368
|
+
*
|
|
369
|
+
* Each bitmap word contains NONCE_BITMAP_SIZE nonce states. A set bit means the nonce is used.
|
|
370
|
+
*
|
|
371
|
+
* @param escrowId - The escrow ID
|
|
372
|
+
* @param signer - The signer's address
|
|
373
|
+
* @param wordIndex - The word index (nonce / NONCE_BITMAP_SIZE)
|
|
374
|
+
* @returns The bitmap as a bigint
|
|
375
|
+
*/
|
|
376
|
+
getNonceBitmap(escrowId: bigint, signer: Address, wordIndex?: bigint): Promise<bigint>;
|
|
377
|
+
/**
|
|
378
|
+
* Check if a specific nonce has been used.
|
|
379
|
+
*
|
|
380
|
+
* @param escrowId - The escrow ID
|
|
381
|
+
* @param signer - The signer's address
|
|
382
|
+
* @param nonce - The nonce to check
|
|
383
|
+
* @returns True if the nonce has been used
|
|
384
|
+
*/
|
|
385
|
+
isNonceUsed(escrowId: bigint, signer: Address, nonce: bigint): Promise<boolean>;
|
|
386
|
+
/**
|
|
387
|
+
* Maximum nonce word index to prevent infinite loops.
|
|
388
|
+
* 100 words = 25,600 nonces per escrow per signer.
|
|
389
|
+
*/
|
|
390
|
+
private static readonly MAX_NONCE_WORDS;
|
|
391
|
+
/**
|
|
392
|
+
* Get the next available nonce for a signer.
|
|
393
|
+
*
|
|
394
|
+
* Queries the contract's nonce bitmap and finds the first unused nonce.
|
|
395
|
+
* This is the recommended way to get a nonce for signed transactions.
|
|
396
|
+
*
|
|
397
|
+
* @param escrowId - The escrow ID
|
|
398
|
+
* @param signer - The signer's address
|
|
399
|
+
* @returns The next available nonce
|
|
400
|
+
* @throws SDKError if nonce space is exhausted (> 25,600 nonces used)
|
|
401
|
+
*/
|
|
402
|
+
getUserNonce(escrowId: bigint, signer: Address): Promise<bigint>;
|
|
403
|
+
/**
|
|
404
|
+
* Calculate estimated number of bitmap words needed for nonce count.
|
|
405
|
+
* Uses conservative estimate with buffer to minimize round trips.
|
|
406
|
+
*
|
|
407
|
+
* @param count - Number of nonces needed
|
|
408
|
+
* @returns Estimated number of bitmap words to fetch
|
|
409
|
+
*/
|
|
410
|
+
private getEstimatedWordCount;
|
|
411
|
+
/**
|
|
412
|
+
* Detect if chain supports Multicall3 and cache result.
|
|
413
|
+
* Performs a test multicall on first invocation and caches the result.
|
|
414
|
+
*
|
|
415
|
+
* @param escrowId - Escrow ID for test call
|
|
416
|
+
* @param signer - Signer address for test call
|
|
417
|
+
*/
|
|
418
|
+
private detectMulticallSupport;
|
|
419
|
+
/**
|
|
420
|
+
* Fetch nonce bitmaps using either multicall or sequential calls.
|
|
421
|
+
* Automatically uses multicall if supported, otherwise falls back to sequential.
|
|
422
|
+
*
|
|
423
|
+
* @param escrowId - The escrow ID
|
|
424
|
+
* @param signer - The signer's address
|
|
425
|
+
* @param wordCount - Number of bitmap words to fetch
|
|
426
|
+
* @returns Array of bitmap results with status
|
|
427
|
+
*/
|
|
428
|
+
private fetchNonceBitmaps;
|
|
429
|
+
/**
|
|
430
|
+
* Scan bitmap words for available (unused) nonces.
|
|
431
|
+
* Performs bit-level scanning with early exit when count is reached.
|
|
432
|
+
*
|
|
433
|
+
* @param bitmapResults - Array of bitmap words fetched from contract
|
|
434
|
+
* @param count - Maximum number of nonces to find
|
|
435
|
+
* @returns Array of available nonce values
|
|
436
|
+
*/
|
|
437
|
+
private scanBitmapsForNonces;
|
|
438
|
+
/**
|
|
439
|
+
* Get multiple available nonces at once (for batch operations).
|
|
440
|
+
*
|
|
441
|
+
* @param escrowId - The escrow ID
|
|
442
|
+
* @param signer - The signer's address
|
|
443
|
+
* @param count - Number of nonces to retrieve (max NONCE_BITMAP_SIZE)
|
|
444
|
+
* @returns Array of available nonces
|
|
445
|
+
* @throws SDKError if count exceeds limit or nonce space is exhausted
|
|
446
|
+
*/
|
|
447
|
+
getMultipleNonces(escrowId: bigint, signer: Address, count: number): Promise<bigint[]>;
|
|
448
|
+
/**
|
|
449
|
+
* @deprecated No longer needed - nonces are tracked by the contract
|
|
450
|
+
*/
|
|
451
|
+
resetNonceTracker(): void;
|
|
452
|
+
/**
|
|
453
|
+
* Get dispute submission status
|
|
454
|
+
*/
|
|
455
|
+
getDisputeSubmissionStatus(escrowId: bigint): Promise<DisputeSubmissionStatus>;
|
|
456
|
+
getTokenDecimals(tokenAddress: Address): Promise<number>;
|
|
457
|
+
getTokenBalance(account: Address, tokenAddress: Address): Promise<bigint>;
|
|
458
|
+
getTokenAllowance(owner: Address, spender: Address, tokenAddress: Address): Promise<bigint>;
|
|
459
|
+
formatTokenAmount(amount: bigint, decimals: number): string;
|
|
460
|
+
/**
|
|
461
|
+
* Approve token spending if needed
|
|
462
|
+
*/
|
|
463
|
+
approveTokenIfNeeded(walletClient: EscrowWalletClient, token: Address, spender: Address, amount: bigint): Promise<Hex | null>;
|
|
464
|
+
/**
|
|
465
|
+
* Create a new escrow as the seller
|
|
466
|
+
*
|
|
467
|
+
* This function creates a new escrow where the caller (seller) is offering goods/services
|
|
468
|
+
* to a buyer. The escrow starts in AWAITING_PAYMENT state until the buyer deposits funds.
|
|
469
|
+
*
|
|
470
|
+
* The seller's wallet authorization signature is automatically generated and attached,
|
|
471
|
+
* which will be used later for 2-of-3 multisig withdrawals from the escrow wallet.
|
|
472
|
+
*
|
|
473
|
+
* @param walletClient - The seller's wallet client (must have account connected)
|
|
474
|
+
* @param params - Escrow creation parameters
|
|
475
|
+
* @param params.token - ERC20 token address for payment
|
|
476
|
+
* @param params.buyer - Buyer's wallet address
|
|
477
|
+
* @param params.amount - Payment amount in token's smallest unit (e.g., wei for 18 decimals)
|
|
478
|
+
* @param params.maturityTimeDays - Optional days until maturity (default: 1, min: 1, max: 3650)
|
|
479
|
+
* @param params.arbiter - Optional arbiter address for dispute resolution
|
|
480
|
+
* @param params.title - Escrow title/description (1-500 characters, supports encrypted hashes)
|
|
481
|
+
* @param params.ipfsHash - Optional IPFS hash for additional details
|
|
482
|
+
* @returns Object containing escrowId, transaction hash, and wallet address
|
|
483
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
484
|
+
* @throws {SDKError} VALIDATION_ERROR - If parameters are invalid
|
|
485
|
+
* @throws {SDKError} TRANSACTION_FAILED - If the transaction fails
|
|
486
|
+
*/
|
|
487
|
+
createEscrow(walletClient: EscrowWalletClient, params: CreateEscrowParams): Promise<{
|
|
488
|
+
escrowId: bigint;
|
|
489
|
+
txHash: Hex;
|
|
490
|
+
walletAddress: Address;
|
|
491
|
+
}>;
|
|
492
|
+
/**
|
|
493
|
+
* Create a new escrow and deposit funds as the buyer (single transaction)
|
|
494
|
+
*
|
|
495
|
+
* This function creates a new escrow and immediately deposits the payment in one transaction.
|
|
496
|
+
* The escrow starts in AWAITING_DELIVERY state. The seller must call `acceptEscrow` to
|
|
497
|
+
* provide their wallet signature before funds can be released.
|
|
498
|
+
*
|
|
499
|
+
* Token approval is automatically handled if needed.
|
|
500
|
+
*
|
|
501
|
+
* @param walletClient - The buyer's wallet client (must have account connected)
|
|
502
|
+
* @param params - Escrow creation parameters
|
|
503
|
+
* @param params.token - ERC20 token address for payment
|
|
504
|
+
* @param params.seller - Seller's wallet address
|
|
505
|
+
* @param params.amount - Payment amount in token's smallest unit (e.g., wei for 18 decimals)
|
|
506
|
+
* @param params.maturityTimeDays - Optional days until maturity (default: 1, min: 1, max: 3650)
|
|
507
|
+
* @param params.arbiter - Optional arbiter address for dispute resolution
|
|
508
|
+
* @param params.title - Escrow title/description (1-500 characters, supports encrypted hashes)
|
|
509
|
+
* @param params.ipfsHash - Optional IPFS hash for additional details
|
|
510
|
+
* @returns Object containing escrowId, transaction hash, and wallet address
|
|
511
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
512
|
+
* @throws {SDKError} VALIDATION_ERROR - If parameters are invalid
|
|
513
|
+
* @throws {SDKError} INSUFFICIENT_BALANCE - If buyer has insufficient token balance
|
|
514
|
+
* @throws {SDKError} TRANSACTION_FAILED - If the transaction fails
|
|
515
|
+
*/
|
|
516
|
+
createEscrowAndDeposit(walletClient: EscrowWalletClient, params: CreateEscrowAndDepositParams): Promise<{
|
|
517
|
+
escrowId: bigint;
|
|
518
|
+
txHash: Hex;
|
|
519
|
+
walletAddress: Address;
|
|
520
|
+
}>;
|
|
521
|
+
/**
|
|
522
|
+
* Deposit funds into an existing escrow as the buyer
|
|
523
|
+
*
|
|
524
|
+
* This function is used when the seller created the escrow via `createEscrow`.
|
|
525
|
+
* The buyer deposits the required payment amount, transitioning the escrow from
|
|
526
|
+
* AWAITING_PAYMENT to AWAITING_DELIVERY state.
|
|
527
|
+
*
|
|
528
|
+
* Token approval is automatically handled if needed.
|
|
529
|
+
* The buyer's wallet authorization signature is automatically generated.
|
|
530
|
+
*
|
|
531
|
+
* @param walletClient - The buyer's wallet client (must have account connected)
|
|
532
|
+
* @param escrowId - The escrow ID to deposit into
|
|
533
|
+
* @returns Transaction hash
|
|
534
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
535
|
+
* @throws {SDKError} NOT_BUYER - If caller is not the designated buyer
|
|
536
|
+
* @throws {SDKError} INVALID_STATE - If escrow is not in AWAITING_PAYMENT state
|
|
537
|
+
* @throws {SDKError} INSUFFICIENT_BALANCE - If buyer has insufficient token balance
|
|
538
|
+
*/
|
|
539
|
+
deposit(walletClient: EscrowWalletClient, escrowId: bigint): Promise<Hex>;
|
|
540
|
+
/**
|
|
541
|
+
* Accept an escrow as the seller (for buyer-created escrows)
|
|
542
|
+
*
|
|
543
|
+
* This function is required when the buyer created the escrow via `createEscrowAndDeposit`.
|
|
544
|
+
* The seller must accept to provide their wallet authorization signature, which is
|
|
545
|
+
* required for the 2-of-3 multisig withdrawal mechanism.
|
|
546
|
+
*
|
|
547
|
+
* Without accepting, the seller cannot receive funds even if the buyer confirms delivery.
|
|
548
|
+
*
|
|
549
|
+
* @param walletClient - The seller's wallet client (must have account connected)
|
|
550
|
+
* @param escrowId - The escrow ID to accept
|
|
551
|
+
* @returns Transaction hash
|
|
552
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
553
|
+
* @throws {SDKError} NOT_SELLER - If caller is not the designated seller
|
|
554
|
+
* @throws {SDKError} INVALID_STATE - If escrow is not in AWAITING_DELIVERY state
|
|
555
|
+
* @throws {SDKError} ALREADY_ACCEPTED - If escrow was already accepted
|
|
556
|
+
*/
|
|
557
|
+
acceptEscrow(walletClient: EscrowWalletClient, escrowId: bigint): Promise<Hex>;
|
|
558
|
+
/**
|
|
559
|
+
* Confirm delivery and release funds to the seller
|
|
560
|
+
*
|
|
561
|
+
* This function is called by the buyer after receiving the goods/services.
|
|
562
|
+
* It transitions the escrow to COMPLETE state and authorizes payment release to the seller.
|
|
563
|
+
*
|
|
564
|
+
* After confirmation, anyone can call `withdraw` on the escrow wallet to execute
|
|
565
|
+
* the actual token transfer (requires 2-of-3 signatures: buyer + seller).
|
|
566
|
+
*
|
|
567
|
+
* A 1% fee is deducted from the payment amount.
|
|
568
|
+
*
|
|
569
|
+
* @param walletClient - The buyer's wallet client (must have account connected)
|
|
570
|
+
* @param escrowId - The escrow ID to confirm
|
|
571
|
+
* @returns Transaction hash
|
|
572
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
573
|
+
* @throws {SDKError} NOT_BUYER - If caller is not the designated buyer
|
|
574
|
+
* @throws {SDKError} INVALID_STATE - If escrow is not in AWAITING_DELIVERY state
|
|
575
|
+
*/
|
|
576
|
+
confirmDelivery(walletClient: EscrowWalletClient, escrowId: bigint): Promise<Hex>;
|
|
577
|
+
/**
|
|
578
|
+
* Confirm delivery via meta-transaction (gasless for buyer)
|
|
579
|
+
*
|
|
580
|
+
* This function allows a relayer to submit the confirm delivery transaction on behalf
|
|
581
|
+
* of the buyer. The buyer signs the confirmation off-chain, and the relayer pays the gas.
|
|
582
|
+
*
|
|
583
|
+
* Use `prepareConfirmDeliverySigned` to generate the required signatures.
|
|
584
|
+
*
|
|
585
|
+
* @param walletClient - The relayer's wallet client (pays gas)
|
|
586
|
+
* @param escrowId - The escrow ID to confirm
|
|
587
|
+
* @param coordSignature - Buyer's EIP-712 signature for the confirmation
|
|
588
|
+
* @param deadline - Signature expiration timestamp (must be within 24 hours)
|
|
589
|
+
* @param nonce - Buyer's nonce for replay protection
|
|
590
|
+
* @param buyerWalletSig - Buyer's wallet authorization signature
|
|
591
|
+
* @returns Transaction hash
|
|
592
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
593
|
+
* @throws {SDKError} SIGNATURE_EXPIRED - If deadline has passed
|
|
594
|
+
*/
|
|
595
|
+
confirmDeliverySigned(walletClient: EscrowWalletClient, escrowId: bigint, coordSignature: Hex, deadline: bigint, nonce: bigint, buyerWalletSig: Hex): Promise<Hex>;
|
|
596
|
+
/**
|
|
597
|
+
* Prepare signatures for gasless confirm delivery
|
|
598
|
+
*
|
|
599
|
+
* This helper function generates all the signatures needed for a gasless confirm delivery.
|
|
600
|
+
* The buyer signs off-chain, and the resulting data can be sent to a relayer who will
|
|
601
|
+
* submit the transaction and pay the gas.
|
|
602
|
+
*
|
|
603
|
+
* The deadline is set to 60 minutes from the current block timestamp.
|
|
604
|
+
*
|
|
605
|
+
* @param buyerWalletClient - The buyer's wallet client (must have account connected)
|
|
606
|
+
* @param escrowId - The escrow ID to confirm
|
|
607
|
+
* @returns Object containing coordSignature, buyerWalletSig, deadline, and nonce
|
|
608
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
609
|
+
* @throws {SDKError} NOT_BUYER - If caller is not the designated buyer
|
|
610
|
+
*/
|
|
611
|
+
prepareConfirmDeliverySigned(buyerWalletClient: EscrowWalletClient, escrowId: bigint): Promise<{
|
|
612
|
+
coordSignature: Hex;
|
|
613
|
+
buyerWalletSig: Hex;
|
|
614
|
+
deadline: bigint;
|
|
615
|
+
nonce: bigint;
|
|
616
|
+
}>;
|
|
617
|
+
/**
|
|
618
|
+
* Request cancellation of an escrow
|
|
619
|
+
*
|
|
620
|
+
* This function allows either the buyer or seller to request cancellation.
|
|
621
|
+
* Both parties must call this function for a mutual cancellation to occur.
|
|
622
|
+
*
|
|
623
|
+
* - If only one party requests: The request is recorded, awaiting the other party
|
|
624
|
+
* - If both parties request: The escrow is automatically canceled and funds returned to buyer
|
|
625
|
+
*
|
|
626
|
+
* Use `getCancelRequestStatus` to check if the other party has already requested.
|
|
627
|
+
*
|
|
628
|
+
* @param walletClient - The buyer's or seller's wallet client
|
|
629
|
+
* @param escrowId - The escrow ID to cancel
|
|
630
|
+
* @returns Transaction hash
|
|
631
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
632
|
+
* @throws {SDKError} INVALID_ROLE - If caller is not buyer or seller
|
|
633
|
+
* @throws {SDKError} INVALID_STATE - If escrow is not in AWAITING_DELIVERY state
|
|
634
|
+
*/
|
|
635
|
+
requestCancel(walletClient: EscrowWalletClient, escrowId: bigint): Promise<Hex>;
|
|
636
|
+
/**
|
|
637
|
+
* Cancel escrow by timeout (unilateral cancellation by buyer)
|
|
638
|
+
*
|
|
639
|
+
* This function allows the buyer to cancel the escrow unilaterally if:
|
|
640
|
+
* - The buyer has already requested cancellation via `requestCancel`
|
|
641
|
+
* - The maturity time has passed
|
|
642
|
+
* - The seller has not agreed to mutual cancellation
|
|
643
|
+
* - No dispute is active
|
|
644
|
+
* - An arbiter is assigned to the escrow
|
|
645
|
+
*
|
|
646
|
+
* Funds are returned to the buyer without any fee deduction.
|
|
647
|
+
*
|
|
648
|
+
* @param walletClient - The buyer's wallet client (must have account connected)
|
|
649
|
+
* @param escrowId - The escrow ID to cancel
|
|
650
|
+
* @returns Transaction hash
|
|
651
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
652
|
+
* @throws {SDKError} NOT_BUYER - If caller is not the designated buyer
|
|
653
|
+
* @throws {SDKError} INVALID_STATE - If conditions for timeout cancel are not met
|
|
654
|
+
*/
|
|
655
|
+
cancelByTimeout(walletClient: EscrowWalletClient, escrowId: bigint): Promise<Hex>;
|
|
656
|
+
/**
|
|
657
|
+
* Auto-release funds to seller after maturity time
|
|
658
|
+
*
|
|
659
|
+
* This function allows the seller to claim funds unilaterally after the maturity time
|
|
660
|
+
* has passed. This protects sellers when buyers become unresponsive after receiving
|
|
661
|
+
* goods/services.
|
|
662
|
+
*
|
|
663
|
+
* Requirements:
|
|
664
|
+
* - Escrow must be in AWAITING_DELIVERY state
|
|
665
|
+
* - No dispute has been started
|
|
666
|
+
* - Buyer has not requested cancellation
|
|
667
|
+
* - maturityTime has passed
|
|
668
|
+
* - Seller has already provided wallet signature (via createEscrow or acceptEscrow)
|
|
669
|
+
*
|
|
670
|
+
* A 1% fee is deducted from the payment amount.
|
|
671
|
+
*
|
|
672
|
+
* @param walletClient - The seller's wallet client (must have account connected)
|
|
673
|
+
* @param escrowId - The escrow ID to auto-release
|
|
674
|
+
* @returns Transaction hash
|
|
675
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
676
|
+
* @throws {SDKError} NOT_SELLER - If caller is not the designated seller
|
|
677
|
+
* @throws {SDKError} INVALID_STATE - If escrow is not in AWAITING_DELIVERY state
|
|
678
|
+
* @throws {SDKError} INVALID_STATE - If dispute is active or buyer requested cancel
|
|
679
|
+
* @throws {SDKError} VALIDATION_ERROR - If seller wallet signature is missing
|
|
680
|
+
*/
|
|
681
|
+
autoRelease(walletClient: EscrowWalletClient, escrowId: bigint): Promise<Hex>;
|
|
682
|
+
/**
|
|
683
|
+
* Start a dispute for an escrow
|
|
684
|
+
*
|
|
685
|
+
* This function initiates a dispute when there's a disagreement between buyer and seller.
|
|
686
|
+
* Once started, the escrow enters DISPUTED state and requires arbiter resolution.
|
|
687
|
+
*
|
|
688
|
+
* Either the buyer or seller can start a dispute. An arbiter must be assigned to the
|
|
689
|
+
* escrow for disputes to be possible.
|
|
690
|
+
*
|
|
691
|
+
* After starting a dispute:
|
|
692
|
+
* 1. Both parties should submit evidence via `submitDisputeMessage`
|
|
693
|
+
* 2. The arbiter reviews evidence and makes a decision via `submitArbiterDecision`
|
|
694
|
+
* 3. The arbiter can rule in favor of buyer (REFUNDED) or seller (COMPLETE)
|
|
695
|
+
*
|
|
696
|
+
* @param walletClient - The buyer's or seller's wallet client
|
|
697
|
+
* @param escrowId - The escrow ID to dispute
|
|
698
|
+
* @returns Transaction hash
|
|
699
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
700
|
+
* @throws {SDKError} INVALID_STATE - If escrow is not in AWAITING_DELIVERY state
|
|
701
|
+
*/
|
|
702
|
+
startDispute(walletClient: EscrowWalletClient, escrowId: bigint): Promise<Hex>;
|
|
703
|
+
/**
|
|
704
|
+
* Start a dispute via meta-transaction (gasless for buyer/seller)
|
|
705
|
+
*
|
|
706
|
+
* This function allows a relayer to submit the start dispute transaction on behalf
|
|
707
|
+
* of the buyer or seller. The initiator signs off-chain, and the relayer pays the gas.
|
|
708
|
+
*
|
|
709
|
+
* Use `signStartDispute` to generate the required signature.
|
|
710
|
+
*
|
|
711
|
+
* @param walletClient - The relayer's wallet client (pays gas)
|
|
712
|
+
* @param escrowId - The escrow ID to dispute
|
|
713
|
+
* @param signature - Buyer's or seller's EIP-712 signature
|
|
714
|
+
* @param deadline - Signature expiration timestamp (must be within 24 hours)
|
|
715
|
+
* @param nonce - Signer's nonce for replay protection
|
|
716
|
+
* @returns Transaction hash
|
|
717
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
718
|
+
* @throws {SDKError} SIGNATURE_EXPIRED - If deadline has passed
|
|
719
|
+
*/
|
|
720
|
+
startDisputeSigned(walletClient: EscrowWalletClient, escrowId: bigint, signature: Hex, deadline: bigint, nonce: bigint): Promise<Hex>;
|
|
721
|
+
/**
|
|
722
|
+
* Submit evidence for a dispute
|
|
723
|
+
*
|
|
724
|
+
* This function allows the buyer or seller to submit evidence supporting their case.
|
|
725
|
+
* Each party can only submit evidence once. Evidence is stored on IPFS and the hash
|
|
726
|
+
* is recorded on-chain.
|
|
727
|
+
*
|
|
728
|
+
* The arbiter will review submitted evidence before making a decision. Both parties
|
|
729
|
+
* should submit evidence for a fair resolution. After 30 days, the arbiter can make
|
|
730
|
+
* a decision even without complete evidence.
|
|
731
|
+
*
|
|
732
|
+
* @param walletClient - The buyer's or seller's wallet client
|
|
733
|
+
* @param escrowId - The escrow ID
|
|
734
|
+
* @param role - The caller's role (Role.Buyer or Role.Seller)
|
|
735
|
+
* @param ipfsHash - IPFS hash containing the evidence (max 500 characters)
|
|
736
|
+
* @returns Transaction hash
|
|
737
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
738
|
+
* @throws {SDKError} EVIDENCE_ALREADY_SUBMITTED - If caller already submitted evidence
|
|
739
|
+
* @throws {SDKError} INVALID_STATE - If escrow is not in DISPUTED state
|
|
740
|
+
*/
|
|
741
|
+
submitDisputeMessage(walletClient: EscrowWalletClient, escrowId: bigint, role: Role.Buyer | Role.Seller, ipfsHash: string): Promise<Hex>;
|
|
742
|
+
/**
|
|
743
|
+
* Submit arbiter's decision to resolve a dispute
|
|
744
|
+
*
|
|
745
|
+
* This function is called by the designated arbiter to resolve a dispute.
|
|
746
|
+
* The arbiter reviews evidence submitted by both parties and makes a final decision.
|
|
747
|
+
*
|
|
748
|
+
* The arbiter can rule:
|
|
749
|
+
* - DisputeResolution.Complete (3): Funds go to seller (with 1% fee)
|
|
750
|
+
* - DisputeResolution.Refunded (4): Funds go to buyer (no fee)
|
|
751
|
+
*
|
|
752
|
+
* Requirements:
|
|
753
|
+
* - Both parties must have submitted evidence, OR
|
|
754
|
+
* - 30 days + 1 hour timeout has passed since dispute started
|
|
755
|
+
*
|
|
756
|
+
* The arbiter's wallet signature is automatically generated for the multisig.
|
|
757
|
+
*
|
|
758
|
+
* @param walletClient - The arbiter's wallet client (must have account connected)
|
|
759
|
+
* @param escrowId - The escrow ID to resolve
|
|
760
|
+
* @param resolution - DisputeResolution.Complete or DisputeResolution.Refunded
|
|
761
|
+
* @param ipfsHash - IPFS hash containing the decision explanation
|
|
762
|
+
* @returns Transaction hash
|
|
763
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
764
|
+
* @throws {SDKError} NOT_ARBITER - If caller is not the designated arbiter
|
|
765
|
+
* @throws {SDKError} INVALID_STATE - If escrow is not in DISPUTED state
|
|
766
|
+
*/
|
|
767
|
+
submitArbiterDecision(walletClient: EscrowWalletClient, escrowId: bigint, resolution: DisputeResolution, ipfsHash: string): Promise<Hex>;
|
|
768
|
+
/**
|
|
769
|
+
* Withdraw funds from the escrow wallet
|
|
770
|
+
*
|
|
771
|
+
* This function executes the actual token transfer from the escrow wallet to the
|
|
772
|
+
* designated recipient. The wallet contract uses a 2-of-3 multisig mechanism:
|
|
773
|
+
*
|
|
774
|
+
* - COMPLETE state: Requires buyer + seller signatures → funds go to seller
|
|
775
|
+
* - REFUNDED state: Requires buyer + arbiter signatures → funds go to buyer
|
|
776
|
+
* - CANCELED state: Requires buyer + seller signatures → funds go to buyer
|
|
777
|
+
*
|
|
778
|
+
* Anyone can call this function (typically the recipient), as the signatures
|
|
779
|
+
* were already collected during the escrow lifecycle. The wallet contract
|
|
780
|
+
* automatically reads and verifies signatures from the escrow contract.
|
|
781
|
+
*
|
|
782
|
+
* @param walletClient - Any wallet client (typically the recipient)
|
|
783
|
+
* @param escrowId - The escrow ID to withdraw from
|
|
784
|
+
* @returns Transaction hash
|
|
785
|
+
* @throws {SDKError} WALLET_NOT_CONNECTED - If wallet client is not connected
|
|
786
|
+
* @throws {SDKError} INVALID_STATE - If escrow is not in a final state (COMPLETE/REFUNDED/CANCELED)
|
|
787
|
+
*/
|
|
788
|
+
withdraw(walletClient: EscrowWalletClient, escrowId: bigint): Promise<Hex>;
|
|
789
|
+
/**
|
|
790
|
+
* Get valid signature count for wallet
|
|
791
|
+
*/
|
|
792
|
+
getWalletSignatureCount(escrowId: bigint): Promise<number>;
|
|
793
|
+
/**
|
|
794
|
+
* Get wallet balance
|
|
795
|
+
*/
|
|
796
|
+
getWalletBalance(escrowId: bigint): Promise<bigint>;
|
|
797
|
+
getEscrows(): Promise<Escrow[]>;
|
|
798
|
+
getEscrowsByBuyer(buyer: string): Promise<Escrow[]>;
|
|
799
|
+
getEscrowsBySeller(seller: string): Promise<Escrow[]>;
|
|
800
|
+
getEscrowDetail(id: string): Promise<Escrow | undefined>;
|
|
801
|
+
getDisputeMessages(escrowId: string): Promise<any[]>;
|
|
802
|
+
/**
|
|
803
|
+
* Get a human-readable status label with color and description for an escrow state.
|
|
804
|
+
* This is useful for displaying escrow status in UIs.
|
|
805
|
+
*
|
|
806
|
+
* @param state - The escrow state enum value
|
|
807
|
+
* @returns An object containing:
|
|
808
|
+
* - label: Human-readable status name
|
|
809
|
+
* - color: Suggested UI color (orange, blue, red, green, gray)
|
|
810
|
+
* - description: Detailed explanation of what this state means
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* ```typescript
|
|
814
|
+
* const sdk = new PalindromePaySDK(...);
|
|
815
|
+
* const escrow = await sdk.getEscrowByIdParsed(1n);
|
|
816
|
+
* const status = sdk.getStatusLabel(escrow.state);
|
|
817
|
+
* console.log(status.label); // "Awaiting Payment"
|
|
818
|
+
* console.log(status.color); // "orange"
|
|
819
|
+
* console.log(status.description); // "Buyer needs to deposit funds"
|
|
820
|
+
* ```
|
|
821
|
+
*/
|
|
822
|
+
getStatusLabel(state: EscrowState): {
|
|
823
|
+
label: string;
|
|
824
|
+
color: string;
|
|
825
|
+
description: string;
|
|
826
|
+
};
|
|
827
|
+
/**
|
|
828
|
+
* Get user role for an escrow
|
|
829
|
+
*/
|
|
830
|
+
getUserRole(userAddress: Address, escrow: EscrowData): Role;
|
|
831
|
+
/**
|
|
832
|
+
* Simulate a transaction before executing
|
|
833
|
+
* Returns success status, gas estimate, and revert reason if failed
|
|
834
|
+
*/
|
|
835
|
+
simulateTransaction(walletClient: EscrowWalletClient, functionName: string, args: any[], contractAddress?: Address): Promise<{
|
|
836
|
+
success: boolean;
|
|
837
|
+
gasEstimate?: bigint;
|
|
838
|
+
revertReason?: string;
|
|
839
|
+
result?: any;
|
|
840
|
+
}>;
|
|
841
|
+
/**
|
|
842
|
+
* Simulate deposit before executing
|
|
843
|
+
*/
|
|
844
|
+
simulateDeposit(walletClient: EscrowWalletClient, escrowId: bigint): Promise<{
|
|
845
|
+
success: boolean;
|
|
846
|
+
gasEstimate?: bigint;
|
|
847
|
+
revertReason?: string;
|
|
848
|
+
needsApproval?: boolean;
|
|
849
|
+
approvalAmount?: bigint;
|
|
850
|
+
}>;
|
|
851
|
+
/**
|
|
852
|
+
* Simulate confirm delivery before executing
|
|
853
|
+
*/
|
|
854
|
+
simulateConfirmDelivery(walletClient: EscrowWalletClient, escrowId: bigint): Promise<{
|
|
855
|
+
success: boolean;
|
|
856
|
+
gasEstimate?: bigint;
|
|
857
|
+
revertReason?: string;
|
|
858
|
+
}>;
|
|
859
|
+
/**
|
|
860
|
+
* Simulate withdraw before executing
|
|
861
|
+
*/
|
|
862
|
+
simulateWithdraw(walletClient: EscrowWalletClient, escrowId: bigint): Promise<{
|
|
863
|
+
success: boolean;
|
|
864
|
+
gasEstimate?: bigint;
|
|
865
|
+
revertReason?: string;
|
|
866
|
+
signatureCount?: number;
|
|
867
|
+
}>;
|
|
868
|
+
/**
|
|
869
|
+
* Estimate gas for a transaction with buffer
|
|
870
|
+
*/
|
|
871
|
+
estimateGasWithBuffer(walletClient: EscrowWalletClient, functionName: string, args: any[], contractAddress?: Address): Promise<bigint>;
|
|
872
|
+
/**
|
|
873
|
+
* Health check
|
|
874
|
+
*/
|
|
875
|
+
healthCheck(): Promise<{
|
|
876
|
+
rpcConnected: boolean;
|
|
877
|
+
contractDeployed: boolean;
|
|
878
|
+
subgraphConnected: boolean;
|
|
879
|
+
errors: string[];
|
|
880
|
+
}>;
|
|
881
|
+
/**
|
|
882
|
+
* Get escrow status with optional caching
|
|
883
|
+
*/
|
|
884
|
+
getEscrowStatus(escrowId: bigint, forceRefresh?: boolean): Promise<{
|
|
885
|
+
state: EscrowState;
|
|
886
|
+
stateName: string;
|
|
887
|
+
label: string;
|
|
888
|
+
color: string;
|
|
889
|
+
description: string;
|
|
890
|
+
}>;
|
|
891
|
+
/**
|
|
892
|
+
* Get cache statistics
|
|
893
|
+
*/
|
|
894
|
+
getCacheStats(): {
|
|
895
|
+
escrowCacheSize: number;
|
|
896
|
+
tokenDecimalsCacheSize: number;
|
|
897
|
+
};
|
|
898
|
+
/**
|
|
899
|
+
* Clear all caches
|
|
900
|
+
*/
|
|
901
|
+
clearAllCaches(): void;
|
|
902
|
+
/**
|
|
903
|
+
* Clear escrow cache only
|
|
904
|
+
*/
|
|
905
|
+
clearEscrowCache(): void;
|
|
906
|
+
/**
|
|
907
|
+
* Clear multicall cache (useful when switching chains)
|
|
908
|
+
*/
|
|
909
|
+
clearMulticallCache(): void;
|
|
910
|
+
/**
|
|
911
|
+
* Watch for escrow events related to a user
|
|
912
|
+
*/
|
|
913
|
+
watchUserEscrows(userAddress: Address, callback: (escrowId: bigint, event: EscrowCreatedEvent) => void, options?: {
|
|
914
|
+
fromBlock?: bigint;
|
|
915
|
+
}): {
|
|
916
|
+
dispose: () => void;
|
|
917
|
+
};
|
|
918
|
+
/**
|
|
919
|
+
* Watch for state changes on a specific escrow
|
|
920
|
+
*/
|
|
921
|
+
watchEscrowStateChanges(escrowId: bigint, callback: (newState: EscrowState, previousState: EscrowState) => void, options?: {
|
|
922
|
+
pollingInterval?: number;
|
|
923
|
+
}): {
|
|
924
|
+
dispose: () => void;
|
|
925
|
+
};
|
|
926
|
+
/**
|
|
927
|
+
* Check if user has submitted evidence for a dispute
|
|
928
|
+
*/
|
|
929
|
+
hasSubmittedEvidence(escrowId: bigint, role: Role): Promise<boolean>;
|
|
930
|
+
/**
|
|
931
|
+
* Get cancellation request status for an escrow
|
|
932
|
+
*
|
|
933
|
+
* This helper function checks whether the buyer and/or seller have requested
|
|
934
|
+
* cancellation. Use this to determine if mutual cancellation is pending or complete.
|
|
935
|
+
*
|
|
936
|
+
* Cancellation flow:
|
|
937
|
+
* - Either party calls `requestCancel` to initiate
|
|
938
|
+
* - If only one party requested, the other must also call `requestCancel` for mutual cancel
|
|
939
|
+
* - When both request, the escrow is automatically canceled and funds return to buyer
|
|
940
|
+
* - Alternatively, buyer can use `cancelByTimeout` after maturity time (if arbiter is set)
|
|
941
|
+
*
|
|
942
|
+
* @param escrowId - The escrow ID to check
|
|
943
|
+
* @returns Object with buyer/seller cancel request status and whether mutual cancel is complete
|
|
944
|
+
*/
|
|
945
|
+
getCancelRequestStatus(escrowId: bigint): Promise<{
|
|
946
|
+
buyerRequested: boolean;
|
|
947
|
+
sellerRequested: boolean;
|
|
948
|
+
mutualCancelComplete: boolean;
|
|
949
|
+
}>;
|
|
950
|
+
/**
|
|
951
|
+
* Get user balances for multiple tokens (batched for performance).
|
|
952
|
+
* Uses Promise.all to fetch all balances and decimals in parallel.
|
|
953
|
+
*/
|
|
954
|
+
getUserBalances(userAddress: Address, tokens: Address[]): Promise<Map<Address, {
|
|
955
|
+
balance: bigint;
|
|
956
|
+
decimals: number;
|
|
957
|
+
formatted: string;
|
|
958
|
+
}>>;
|
|
959
|
+
/**
|
|
960
|
+
* Get maturity info for an escrow
|
|
961
|
+
*/
|
|
962
|
+
getMaturityInfo(depositTime: bigint, maturityDays: bigint): {
|
|
963
|
+
hasDeadline: boolean;
|
|
964
|
+
maturityDays: number;
|
|
965
|
+
maturityTimestamp: bigint;
|
|
966
|
+
isPassed: boolean;
|
|
967
|
+
remainingSeconds: number;
|
|
968
|
+
};
|
|
969
|
+
/**
|
|
970
|
+
* Get all escrows for a user (as buyer or seller)
|
|
971
|
+
*/
|
|
972
|
+
getUserEscrows(userAddress: Address): Promise<Escrow[]>;
|
|
973
|
+
/**
|
|
974
|
+
* Check if a user can deposit to an escrow.
|
|
975
|
+
* A user can deposit if:
|
|
976
|
+
* - The escrow exists and is in AWAITING_PAYMENT state
|
|
977
|
+
* - The user is either the buyer or seller
|
|
978
|
+
*
|
|
979
|
+
* @param userAddress - The address of the user to check
|
|
980
|
+
* @param escrowId - The escrow ID to check
|
|
981
|
+
* @returns True if the user can deposit, false otherwise
|
|
982
|
+
*/
|
|
983
|
+
canUserDeposit(userAddress: Address, escrowId: bigint): Promise<boolean>;
|
|
984
|
+
/**
|
|
985
|
+
* Check if a user can accept an escrow (seller accepting after buyer deposit).
|
|
986
|
+
* A user can accept if:
|
|
987
|
+
* - The escrow is in AWAITING_DELIVERY state
|
|
988
|
+
* - The user is the seller
|
|
989
|
+
*
|
|
990
|
+
* @param userAddress - The address of the user to check
|
|
991
|
+
* @param escrowId - The escrow ID to check
|
|
992
|
+
* @returns True if the user can accept, false otherwise
|
|
993
|
+
*/
|
|
994
|
+
canUserAcceptEscrow(userAddress: Address, escrowId: bigint): Promise<boolean>;
|
|
995
|
+
/**
|
|
996
|
+
* Check if a user can confirm delivery (buyer confirming receipt).
|
|
997
|
+
* A user can confirm delivery if:
|
|
998
|
+
* - The escrow is in AWAITING_DELIVERY or DISPUTED state
|
|
999
|
+
* - The user is the buyer
|
|
1000
|
+
*
|
|
1001
|
+
* @param userAddress - The address of the user to check
|
|
1002
|
+
* @param escrowId - The escrow ID to check
|
|
1003
|
+
* @returns True if the user can confirm delivery, false otherwise
|
|
1004
|
+
*/
|
|
1005
|
+
canUserConfirmDelivery(userAddress: Address, escrowId: bigint): Promise<boolean>;
|
|
1006
|
+
/**
|
|
1007
|
+
* Check if a user can start a dispute.
|
|
1008
|
+
* A user can start a dispute if:
|
|
1009
|
+
* - The escrow is in AWAITING_DELIVERY state
|
|
1010
|
+
* - The escrow has an arbiter set
|
|
1011
|
+
* - The user is either the buyer or seller
|
|
1012
|
+
*
|
|
1013
|
+
* @param userAddress - The address of the user to check
|
|
1014
|
+
* @param escrowId - The escrow ID to check
|
|
1015
|
+
* @returns True if the user can start a dispute, false otherwise
|
|
1016
|
+
*/
|
|
1017
|
+
canUserStartDispute(userAddress: Address, escrowId: bigint): Promise<boolean>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Check if an escrow can be withdrawn (auto-release check).
|
|
1020
|
+
* An escrow can be withdrawn if:
|
|
1021
|
+
* - It's in AWAITING_DELIVERY state
|
|
1022
|
+
* - The maturity time has passed (if deadline is set)
|
|
1023
|
+
*
|
|
1024
|
+
* @param escrowId - The escrow ID to check
|
|
1025
|
+
* @returns True if the escrow can be withdrawn, false otherwise
|
|
1026
|
+
*/
|
|
1027
|
+
canUserWithdraw(escrowId: bigint): Promise<boolean>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Check if a seller can perform auto-release.
|
|
1030
|
+
* A seller can auto-release if:
|
|
1031
|
+
* - The escrow is in AWAITING_DELIVERY state
|
|
1032
|
+
* - The maturity time has passed (if deadline is set)
|
|
1033
|
+
* - The user is the seller
|
|
1034
|
+
*
|
|
1035
|
+
* @param userAddress - The address of the user to check
|
|
1036
|
+
* @param escrowId - The escrow ID to check
|
|
1037
|
+
* @returns True if the seller can auto-release, false otherwise
|
|
1038
|
+
*/
|
|
1039
|
+
canSellerAutoRelease(userAddress: Address, escrowId: bigint): Promise<boolean>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Check if an address is the buyer in an escrow.
|
|
1042
|
+
*
|
|
1043
|
+
* @param userAddress - The address to check
|
|
1044
|
+
* @param escrow - The escrow data
|
|
1045
|
+
* @returns True if the address is the buyer
|
|
1046
|
+
*/
|
|
1047
|
+
isBuyer(userAddress: Address, escrow: EscrowData): boolean;
|
|
1048
|
+
/**
|
|
1049
|
+
* Check if an address is the seller in an escrow.
|
|
1050
|
+
*
|
|
1051
|
+
* @param userAddress - The address to check
|
|
1052
|
+
* @param escrow - The escrow data
|
|
1053
|
+
* @returns True if the address is the seller
|
|
1054
|
+
*/
|
|
1055
|
+
isSeller(userAddress: Address, escrow: EscrowData): boolean;
|
|
1056
|
+
/**
|
|
1057
|
+
* Check if an address is the arbiter in an escrow.
|
|
1058
|
+
*
|
|
1059
|
+
* @param userAddress - The address to check
|
|
1060
|
+
* @param escrow - The escrow data
|
|
1061
|
+
* @returns True if the address is the arbiter
|
|
1062
|
+
*/
|
|
1063
|
+
isArbiter(userAddress: Address, escrow: EscrowData): boolean;
|
|
1064
|
+
/**
|
|
1065
|
+
* Check if an escrow has an arbiter set.
|
|
1066
|
+
*
|
|
1067
|
+
* @param escrow - The escrow data
|
|
1068
|
+
* @returns True if the escrow has an arbiter (non-zero address)
|
|
1069
|
+
*/
|
|
1070
|
+
hasArbiter(escrow: EscrowData): boolean;
|
|
1071
|
+
/**
|
|
1072
|
+
* Compare two addresses for equality (case-insensitive, normalized).
|
|
1073
|
+
* This is a public utility method that can be used to compare Ethereum addresses.
|
|
1074
|
+
*
|
|
1075
|
+
* @param a - First address to compare
|
|
1076
|
+
* @param b - Second address to compare
|
|
1077
|
+
* @returns True if the addresses are equal (case-insensitive)
|
|
1078
|
+
*
|
|
1079
|
+
* @example
|
|
1080
|
+
* ```typescript
|
|
1081
|
+
* const sdk = new PalindromePaySDK(...);
|
|
1082
|
+
* const areEqual = sdk.addressEquals(
|
|
1083
|
+
* "0xabc...",
|
|
1084
|
+
* "0xABC..."
|
|
1085
|
+
* ); // true
|
|
1086
|
+
* ```
|
|
1087
|
+
*/
|
|
1088
|
+
addressEquals(a: Address | string, b: Address | string): boolean;
|
|
1089
|
+
/**
|
|
1090
|
+
* Get current gas price information from the network.
|
|
1091
|
+
* Returns standard, fast, and instant gas price estimates in gwei.
|
|
1092
|
+
*
|
|
1093
|
+
* @returns Object containing gas price estimates
|
|
1094
|
+
*
|
|
1095
|
+
* @example
|
|
1096
|
+
* ```typescript
|
|
1097
|
+
* const gasPrice = await sdk.getCurrentGasPrice();
|
|
1098
|
+
* console.log(`Standard: ${gasPrice.standard} gwei`);
|
|
1099
|
+
* console.log(`Fast: ${gasPrice.fast} gwei`);
|
|
1100
|
+
* console.log(`Instant: ${gasPrice.instant} gwei`);
|
|
1101
|
+
* ```
|
|
1102
|
+
*/
|
|
1103
|
+
getCurrentGasPrice(): Promise<{
|
|
1104
|
+
standard: bigint;
|
|
1105
|
+
fast: bigint;
|
|
1106
|
+
instant: bigint;
|
|
1107
|
+
wei: bigint;
|
|
1108
|
+
}>;
|
|
1109
|
+
/**
|
|
1110
|
+
* Estimate gas cost for creating an escrow.
|
|
1111
|
+
*
|
|
1112
|
+
* @param params - Create escrow parameters
|
|
1113
|
+
* @returns Gas estimation details
|
|
1114
|
+
*
|
|
1115
|
+
* @example
|
|
1116
|
+
* ```typescript
|
|
1117
|
+
* const estimate = await sdk.estimateGasForCreateEscrow({
|
|
1118
|
+
* token: tokenAddress,
|
|
1119
|
+
* buyer: buyerAddress,
|
|
1120
|
+
* amount: 1000000n,
|
|
1121
|
+
* maturityDays: 7n,
|
|
1122
|
+
* arbiter: zeroAddress,
|
|
1123
|
+
* title: 'Test',
|
|
1124
|
+
* ipfsHash: ''
|
|
1125
|
+
* });
|
|
1126
|
+
* console.log(`Gas limit: ${estimate.gasLimit}`);
|
|
1127
|
+
* console.log(`Cost: ${estimate.estimatedCostEth} ETH`);
|
|
1128
|
+
* ```
|
|
1129
|
+
*/
|
|
1130
|
+
estimateGasForCreateEscrow(params: {
|
|
1131
|
+
token: Address;
|
|
1132
|
+
buyer: Address;
|
|
1133
|
+
amount: bigint;
|
|
1134
|
+
maturityDays: bigint;
|
|
1135
|
+
arbiter: Address;
|
|
1136
|
+
title: string;
|
|
1137
|
+
ipfsHash: string;
|
|
1138
|
+
}): Promise<{
|
|
1139
|
+
gasLimit: bigint;
|
|
1140
|
+
estimatedCostWei: bigint;
|
|
1141
|
+
estimatedCostEth: string;
|
|
1142
|
+
}>;
|
|
1143
|
+
/**
|
|
1144
|
+
* Estimate gas cost for depositing to an escrow.
|
|
1145
|
+
*
|
|
1146
|
+
* @param escrowId - The escrow ID
|
|
1147
|
+
* @returns Gas estimation details
|
|
1148
|
+
*
|
|
1149
|
+
* @example
|
|
1150
|
+
* ```typescript
|
|
1151
|
+
* const estimate = await sdk.estimateGasForDeposit(escrowId);
|
|
1152
|
+
* console.log(`Gas limit: ${estimate.gasLimit}`);
|
|
1153
|
+
* ```
|
|
1154
|
+
*/
|
|
1155
|
+
estimateGasForDeposit(escrowId: bigint): Promise<{
|
|
1156
|
+
gasLimit: bigint;
|
|
1157
|
+
estimatedCostWei: bigint;
|
|
1158
|
+
estimatedCostEth: string;
|
|
1159
|
+
}>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Estimate gas cost for confirming delivery.
|
|
1162
|
+
*
|
|
1163
|
+
* @param escrowId - The escrow ID
|
|
1164
|
+
* @returns Gas estimation details
|
|
1165
|
+
*
|
|
1166
|
+
* @example
|
|
1167
|
+
* ```typescript
|
|
1168
|
+
* const estimate = await sdk.estimateGasForConfirmDelivery(escrowId);
|
|
1169
|
+
* console.log(`Cost: ${estimate.estimatedCostEth} ETH`);
|
|
1170
|
+
* ```
|
|
1171
|
+
*/
|
|
1172
|
+
estimateGasForConfirmDelivery(escrowId: bigint): Promise<{
|
|
1173
|
+
gasLimit: bigint;
|
|
1174
|
+
estimatedCostWei: bigint;
|
|
1175
|
+
estimatedCostEth: string;
|
|
1176
|
+
}>;
|
|
1177
|
+
/**
|
|
1178
|
+
* Estimate gas cost for withdrawing from escrow wallet.
|
|
1179
|
+
*
|
|
1180
|
+
* @returns Gas estimation details
|
|
1181
|
+
*
|
|
1182
|
+
* @example
|
|
1183
|
+
* ```typescript
|
|
1184
|
+
* const estimate = await sdk.estimateGasForWithdraw();
|
|
1185
|
+
* ```
|
|
1186
|
+
*/
|
|
1187
|
+
estimateGasForWithdraw(): Promise<{
|
|
1188
|
+
gasLimit: bigint;
|
|
1189
|
+
estimatedCostWei: bigint;
|
|
1190
|
+
estimatedCostEth: string;
|
|
1191
|
+
}>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Get fee receiver address (cached - rarely changes)
|
|
1194
|
+
* @param forceRefresh - Set to true to bypass cache and fetch fresh value
|
|
1195
|
+
*/
|
|
1196
|
+
getFeeReceiver(forceRefresh?: boolean): Promise<Address>;
|
|
1197
|
+
/** Cached fee basis points (lazily computed from contract) */
|
|
1198
|
+
private cachedFeeBps;
|
|
1199
|
+
/**
|
|
1200
|
+
* Get fee percentage in basis points.
|
|
1201
|
+
* Tries to read FEE_BPS from contract, falls back to default (100 = 1%).
|
|
1202
|
+
* Result is cached for performance.
|
|
1203
|
+
*/
|
|
1204
|
+
getFeeBps(): Promise<bigint>;
|
|
1205
|
+
/**
|
|
1206
|
+
* Calculate fee for an amount.
|
|
1207
|
+
* Uses the same logic as the contract's _computeFeeAndNet.
|
|
1208
|
+
*/
|
|
1209
|
+
calculateFee(amount: bigint, tokenDecimals?: number): Promise<{
|
|
1210
|
+
fee: bigint;
|
|
1211
|
+
net: bigint;
|
|
1212
|
+
}>;
|
|
1213
|
+
}
|
|
1214
|
+
export default PalindromePaySDK;
|