@1llet.xyz/erc4337-gasless-sdk 0.4.70 → 0.4.72
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/index.d.mts +168 -87
- package/dist/index.d.ts +168 -87
- package/dist/index.js +1596 -967
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1582 -953
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Chain, Address, Hash,
|
|
2
|
-
import * as StellarSdk from 'stellar-sdk';
|
|
1
|
+
import { Chain, Address, Hex, Hash, PublicClient, WalletClient } from 'viem';
|
|
3
2
|
import { Address as Address$1 } from 'abitype';
|
|
4
3
|
import z from 'zod';
|
|
4
|
+
import * as StellarSdk from 'stellar-sdk';
|
|
5
|
+
import * as _defuse_protocol_one_click_sdk_typescript from '@defuse-protocol/one-click-sdk-typescript';
|
|
5
6
|
|
|
6
7
|
interface Token {
|
|
7
8
|
symbol: string;
|
|
@@ -69,6 +70,24 @@ interface ApprovalSupportResult {
|
|
|
69
70
|
fundedAmount?: string;
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
declare class BundlerClient {
|
|
74
|
+
private bundlerUrl;
|
|
75
|
+
private entryPointAddress;
|
|
76
|
+
constructor(config: EvmChainConfig, entryPointAddress: Address);
|
|
77
|
+
private call;
|
|
78
|
+
estimateGas(userOp: Partial<UserOperation>): Promise<GasEstimate>;
|
|
79
|
+
sendUserOperation(userOp: UserOperation): Promise<Hash>;
|
|
80
|
+
waitForUserOperation(userOpHash: Hash, timeout?: number): Promise<UserOpReceipt>;
|
|
81
|
+
requestApprovalSupport(token: Address, owner: Address, spender: Address, amount: bigint): Promise<ApprovalSupportResult>;
|
|
82
|
+
scheduleUserOp(userOp: UserOperation, condition: {
|
|
83
|
+
token: string;
|
|
84
|
+
minAmount: string;
|
|
85
|
+
}): Promise<{
|
|
86
|
+
status: string;
|
|
87
|
+
taskId: string;
|
|
88
|
+
}>;
|
|
89
|
+
}
|
|
90
|
+
|
|
72
91
|
/**
|
|
73
92
|
* ERC-4337 Account Abstraction Client
|
|
74
93
|
*/
|
|
@@ -84,6 +103,19 @@ declare class AccountAbstraction {
|
|
|
84
103
|
private entryPointAddress;
|
|
85
104
|
private factoryAddress;
|
|
86
105
|
constructor(chainConfig: EvmChainConfig);
|
|
106
|
+
getBundlerClient(): BundlerClient;
|
|
107
|
+
getChainId(): number;
|
|
108
|
+
getPublicClient(): PublicClient;
|
|
109
|
+
buildUserOperation(transaction: {
|
|
110
|
+
target: Address;
|
|
111
|
+
value: bigint;
|
|
112
|
+
data: Hex;
|
|
113
|
+
}): Promise<UserOperation>;
|
|
114
|
+
buildBatchUserOperation(transactions: {
|
|
115
|
+
target: Address;
|
|
116
|
+
value: bigint;
|
|
117
|
+
data: Hex;
|
|
118
|
+
}[]): Promise<UserOperation>;
|
|
87
119
|
connect(signer?: Hex | WalletClient): Promise<{
|
|
88
120
|
owner: Address;
|
|
89
121
|
smartAccount: Address;
|
|
@@ -159,21 +191,93 @@ declare global {
|
|
|
159
191
|
}
|
|
160
192
|
}
|
|
161
193
|
|
|
162
|
-
declare
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
194
|
+
declare const ChainKeyEnum: z.ZodEnum<{
|
|
195
|
+
Optimism: "Optimism";
|
|
196
|
+
Arbitrum: "Arbitrum";
|
|
197
|
+
Base: "Base";
|
|
198
|
+
Unichain: "Unichain";
|
|
199
|
+
Polygon: "Polygon";
|
|
200
|
+
Avalanche: "Avalanche";
|
|
201
|
+
WorldChain: "WorldChain";
|
|
202
|
+
Stellar: "Stellar";
|
|
203
|
+
Monad: "Monad";
|
|
204
|
+
BNB: "BNB";
|
|
205
|
+
GNOSIS: "GNOSIS";
|
|
206
|
+
Ethereum: "Ethereum";
|
|
207
|
+
Stacks: "Stacks";
|
|
208
|
+
}>;
|
|
209
|
+
type ChainKey = z.infer<typeof ChainKeyEnum>;
|
|
210
|
+
interface NearIntentAsset {
|
|
211
|
+
assetId: string;
|
|
212
|
+
name: string;
|
|
213
|
+
decimals: number;
|
|
214
|
+
}
|
|
215
|
+
interface NearIntentInformation {
|
|
216
|
+
support: boolean;
|
|
217
|
+
assetsId: NearIntentAsset[];
|
|
218
|
+
needMemo: boolean;
|
|
219
|
+
}
|
|
220
|
+
interface CCTPInformation {
|
|
221
|
+
supportCCTP: boolean;
|
|
222
|
+
domain: number;
|
|
223
|
+
}
|
|
224
|
+
interface CircleInformation {
|
|
225
|
+
supportCirclePaymaster: boolean;
|
|
226
|
+
cCTPInformation?: CCTPInformation;
|
|
227
|
+
aproxFromFee: number;
|
|
228
|
+
}
|
|
229
|
+
interface StargateInformation {
|
|
230
|
+
support: boolean;
|
|
231
|
+
}
|
|
232
|
+
interface CrossChainInformation {
|
|
233
|
+
circleInformation?: CircleInformation;
|
|
234
|
+
nearIntentInformation: NearIntentInformation | null;
|
|
235
|
+
stargateInformation?: StargateInformation;
|
|
236
|
+
}
|
|
237
|
+
interface EvmInformation {
|
|
238
|
+
chain: any;
|
|
239
|
+
rpcUrl: string | null;
|
|
240
|
+
supports7702: boolean;
|
|
241
|
+
erc4337: boolean;
|
|
242
|
+
bundlerUrl?: string;
|
|
243
|
+
entryPointAddress?: Address$1;
|
|
244
|
+
factoryAddress?: Address$1;
|
|
245
|
+
paymasterAddress?: Address$1;
|
|
246
|
+
}
|
|
247
|
+
interface NonEvmInformation {
|
|
248
|
+
networkPassphrase?: string;
|
|
249
|
+
serverURL?: string;
|
|
250
|
+
}
|
|
251
|
+
interface Asset {
|
|
252
|
+
name: string;
|
|
253
|
+
decimals: number;
|
|
254
|
+
address?: Address$1 | string;
|
|
255
|
+
coingeckoId?: string;
|
|
256
|
+
supportsStargate?: boolean;
|
|
257
|
+
}
|
|
258
|
+
interface ChainConfig {
|
|
259
|
+
assets: Asset[];
|
|
260
|
+
evm?: EvmInformation;
|
|
261
|
+
nonEvm?: NonEvmInformation;
|
|
262
|
+
crossChainInformation: CrossChainInformation;
|
|
171
263
|
}
|
|
172
264
|
|
|
265
|
+
declare const BASE: ChainConfig;
|
|
266
|
+
|
|
267
|
+
declare const AVALANCHE: ChainConfig;
|
|
268
|
+
|
|
269
|
+
declare const OPTIMISM: ChainConfig;
|
|
270
|
+
|
|
173
271
|
declare const BASE_MAINNET: ChainConfig$1;
|
|
174
272
|
declare const OPTIMISM_MAINNET: ChainConfig$1;
|
|
175
273
|
declare const GNOSIS_MAINNET: ChainConfig$1;
|
|
176
274
|
declare const BASE_SEPOLIA: ChainConfig$1;
|
|
275
|
+
declare const AVALANCHE_MAINNET: ChainConfig$1;
|
|
276
|
+
declare const BSC_MAINNET: ChainConfig$1;
|
|
277
|
+
declare const POLYGON_MAINNET: ChainConfig$1;
|
|
278
|
+
declare const ARBITRUM_MAINNET: ChainConfig$1;
|
|
279
|
+
declare const UNICHAIN_MAINNET: ChainConfig$1;
|
|
280
|
+
declare const MONAD_MAINNET: ChainConfig$1;
|
|
177
281
|
declare const STELLAR_MAINNET: ChainConfig$1;
|
|
178
282
|
declare const CHAIN_CONFIGS: Record<number, ChainConfig$1>;
|
|
179
283
|
|
|
@@ -333,75 +437,6 @@ declare class StellarService {
|
|
|
333
437
|
getKeypair(pk: string): StellarSdk.Keypair;
|
|
334
438
|
}
|
|
335
439
|
|
|
336
|
-
declare const ChainKeyEnum: z.ZodEnum<{
|
|
337
|
-
Optimism: "Optimism";
|
|
338
|
-
Arbitrum: "Arbitrum";
|
|
339
|
-
Base: "Base";
|
|
340
|
-
Unichain: "Unichain";
|
|
341
|
-
Polygon: "Polygon";
|
|
342
|
-
Avalanche: "Avalanche";
|
|
343
|
-
WorldChain: "WorldChain";
|
|
344
|
-
Stellar: "Stellar";
|
|
345
|
-
Monad: "Monad";
|
|
346
|
-
BNB: "BNB";
|
|
347
|
-
GNOSIS: "GNOSIS";
|
|
348
|
-
}>;
|
|
349
|
-
type ChainKey = z.infer<typeof ChainKeyEnum>;
|
|
350
|
-
interface NearIntentAsset {
|
|
351
|
-
assetId: string;
|
|
352
|
-
name: string;
|
|
353
|
-
decimals: number;
|
|
354
|
-
}
|
|
355
|
-
interface NearIntentInformation {
|
|
356
|
-
support: boolean;
|
|
357
|
-
assetsId: NearIntentAsset[];
|
|
358
|
-
needMemo: boolean;
|
|
359
|
-
}
|
|
360
|
-
interface CCTPInformation {
|
|
361
|
-
supportCCTP: boolean;
|
|
362
|
-
domain: number;
|
|
363
|
-
}
|
|
364
|
-
interface CircleInformation {
|
|
365
|
-
supportCirclePaymaster: boolean;
|
|
366
|
-
cCTPInformation?: CCTPInformation;
|
|
367
|
-
aproxFromFee: number;
|
|
368
|
-
}
|
|
369
|
-
interface StargateInformation {
|
|
370
|
-
support: boolean;
|
|
371
|
-
}
|
|
372
|
-
interface CrossChainInformation {
|
|
373
|
-
circleInformation?: CircleInformation;
|
|
374
|
-
nearIntentInformation: NearIntentInformation | null;
|
|
375
|
-
stargateInformation?: StargateInformation;
|
|
376
|
-
}
|
|
377
|
-
interface EvmInformation {
|
|
378
|
-
chain: any;
|
|
379
|
-
rpcUrl: string | null;
|
|
380
|
-
supports7702: boolean;
|
|
381
|
-
erc4337: boolean;
|
|
382
|
-
bundlerUrl?: string;
|
|
383
|
-
entryPointAddress?: Address$1;
|
|
384
|
-
factoryAddress?: Address$1;
|
|
385
|
-
paymasterAddress?: Address$1;
|
|
386
|
-
}
|
|
387
|
-
interface NonEvmInformation {
|
|
388
|
-
networkPassphrase?: string;
|
|
389
|
-
serverURL?: string;
|
|
390
|
-
}
|
|
391
|
-
interface Asset {
|
|
392
|
-
name: string;
|
|
393
|
-
decimals: number;
|
|
394
|
-
address?: Address$1 | string;
|
|
395
|
-
coingeckoId?: string;
|
|
396
|
-
supportsStargate?: boolean;
|
|
397
|
-
}
|
|
398
|
-
interface ChainConfig {
|
|
399
|
-
assets: Asset[];
|
|
400
|
-
evm?: EvmInformation;
|
|
401
|
-
nonEvm?: NonEvmInformation;
|
|
402
|
-
crossChainInformation: CrossChainInformation;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
440
|
declare const STELLAR: ChainConfig;
|
|
406
441
|
|
|
407
442
|
interface FacilitatorPaymentPayload {
|
|
@@ -430,6 +465,8 @@ interface SettleResponse {
|
|
|
430
465
|
attestation: string;
|
|
431
466
|
};
|
|
432
467
|
data?: any;
|
|
468
|
+
estimatedReceived?: string;
|
|
469
|
+
minAmount?: string;
|
|
433
470
|
}
|
|
434
471
|
interface BridgeContext {
|
|
435
472
|
paymentPayload?: FacilitatorPaymentPayload;
|
|
@@ -452,8 +489,24 @@ interface BridgeStrategy {
|
|
|
452
489
|
|
|
453
490
|
declare class TransferManager {
|
|
454
491
|
private strategies;
|
|
492
|
+
private router;
|
|
455
493
|
constructor();
|
|
456
|
-
execute(context: BridgeContext): Promise<SettleResponse>;
|
|
494
|
+
execute(context: BridgeContext, logCallback?: (msg: string) => void): Promise<SettleResponse>;
|
|
495
|
+
/**
|
|
496
|
+
* Special method to orchestrate the Base -> Optimism -> Base demo flow
|
|
497
|
+
* entirely within the SDK.
|
|
498
|
+
*/
|
|
499
|
+
executeMultiHopDemo(context: BridgeContext, sourceAA: AccountAbstraction, // We need the actual AA instance to sign
|
|
500
|
+
logCallback?: (msg: string) => void, overrides?: {
|
|
501
|
+
bundlerUrl?: string;
|
|
502
|
+
}): Promise<boolean>;
|
|
503
|
+
/**
|
|
504
|
+
* Specialized method for Unichain -> Stacks flow.
|
|
505
|
+
* 1. Unichain -> Ethereum (CCTP)
|
|
506
|
+
* 2. Ethereum -> Stacks (Stacks Bridge)
|
|
507
|
+
*/
|
|
508
|
+
executeUnichainToStacks(context: BridgeContext, sourceAA: AccountAbstraction, ethPrivateKey: string, // Needed for Stacks Bridge execution on Ethereum (Facilitator/Intermediary EOA)
|
|
509
|
+
logCallback?: (msg: string) => void): Promise<SettleResponse>;
|
|
457
510
|
}
|
|
458
511
|
|
|
459
512
|
declare class NearStrategy implements BridgeStrategy {
|
|
@@ -461,6 +514,14 @@ declare class NearStrategy implements BridgeStrategy {
|
|
|
461
514
|
canHandle(context: BridgeContext): boolean;
|
|
462
515
|
execute(context: BridgeContext): Promise<SettleResponse>;
|
|
463
516
|
}
|
|
517
|
+
declare function getNearQuote(sourceChain: ChainKey, destChain: ChainKey, amount: string, destToken?: string, sourceToken?: string, recipient?: string, senderAddress?: string, options?: {
|
|
518
|
+
dry?: boolean;
|
|
519
|
+
}): Promise<{
|
|
520
|
+
quote: _defuse_protocol_one_click_sdk_typescript.QuoteResponse;
|
|
521
|
+
depositAddress: string;
|
|
522
|
+
amountAtomicTotal: bigint;
|
|
523
|
+
amountAtomicNet: string;
|
|
524
|
+
}>;
|
|
464
525
|
declare function getNearSimulation(sourceChain: ChainKey, destChain: ChainKey, amount: string, destToken?: string, sourceToken?: string): Promise<{
|
|
465
526
|
success: boolean;
|
|
466
527
|
amountSent: number;
|
|
@@ -510,18 +571,38 @@ declare function getStargateSimulation(sourceChain: string, destChain: string, a
|
|
|
510
571
|
|
|
511
572
|
declare class UniswapService {
|
|
512
573
|
private publicClient;
|
|
513
|
-
constructor(
|
|
574
|
+
constructor();
|
|
514
575
|
/**
|
|
515
|
-
*
|
|
576
|
+
* Get amount of USDC needed to buy exact amount of ETH
|
|
577
|
+
* @param amountETHWei Amount of ETH (Wei) needed
|
|
516
578
|
*/
|
|
517
|
-
quoteUSDCForETH(
|
|
579
|
+
quoteUSDCForETH(amountETHWei: bigint): Promise<bigint>;
|
|
518
580
|
/**
|
|
519
|
-
* Build tx data for swapping USDC -> ETH
|
|
581
|
+
* Build tx data for swapping USDC -> ETH
|
|
582
|
+
* Uses SwapRouter02.exactOutputSingle + unwrapWETH9
|
|
520
583
|
*/
|
|
521
|
-
buildSwapData(recipient: Address,
|
|
584
|
+
buildSwapData(recipient: Address, amountOutETH: bigint, maxAmountInUSDC: bigint): Hex;
|
|
522
585
|
getRouterAddress(): Address;
|
|
523
586
|
getUSDCAddress(): Address;
|
|
524
587
|
}
|
|
525
588
|
declare const uniswapService: UniswapService;
|
|
526
589
|
|
|
527
|
-
|
|
590
|
+
interface MultiHopStep {
|
|
591
|
+
aa: AccountAbstraction;
|
|
592
|
+
buildUserOp: () => Promise<UserOperation>;
|
|
593
|
+
waitCondition?: () => Promise<boolean>;
|
|
594
|
+
description: string;
|
|
595
|
+
}
|
|
596
|
+
declare class RouterService {
|
|
597
|
+
/**
|
|
598
|
+
* Orchestrates a Multi-Hop transfer by signing ALL UserOps upfront (Reverse Order),
|
|
599
|
+
* and then executing them sequentially (Forward Order) with polling support.
|
|
600
|
+
*
|
|
601
|
+
* @param steps Array of MultiHopStep ordered by execution (Source -> Intermediate -> Dest)
|
|
602
|
+
* @param onLog Optional callback for logging progress
|
|
603
|
+
*/
|
|
604
|
+
executeMultiHop(steps: MultiHopStep[], onLog?: (msg: string) => void): Promise<boolean>;
|
|
605
|
+
private pollCondition;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export { ARBITRUM_MAINNET, AVALANCHE, AVALANCHE_MAINNET, AccountAbstraction, type ApprovalSupportResult, BASE, BASE_MAINNET, BASE_SEPOLIA, BSC_MAINNET, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig$1 as ChainConfig, GNOSIS_MAINNET, type GasEstimate, MONAD_MAINNET, NearStrategy, OPTIMISM, OPTIMISM_MAINNET, POLYGON_MAINNET, RouterService, STELLAR, STELLAR_MAINNET, StargateStrategy, StellarService, type Token, TransferManager, UNICHAIN_MAINNET, UniswapService, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, getNearQuote, getNearSimulation, getStargateSimulation, smartAccountAbi, uniswapService };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Chain, Address, Hash,
|
|
2
|
-
import * as StellarSdk from 'stellar-sdk';
|
|
1
|
+
import { Chain, Address, Hex, Hash, PublicClient, WalletClient } from 'viem';
|
|
3
2
|
import { Address as Address$1 } from 'abitype';
|
|
4
3
|
import z from 'zod';
|
|
4
|
+
import * as StellarSdk from 'stellar-sdk';
|
|
5
|
+
import * as _defuse_protocol_one_click_sdk_typescript from '@defuse-protocol/one-click-sdk-typescript';
|
|
5
6
|
|
|
6
7
|
interface Token {
|
|
7
8
|
symbol: string;
|
|
@@ -69,6 +70,24 @@ interface ApprovalSupportResult {
|
|
|
69
70
|
fundedAmount?: string;
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
declare class BundlerClient {
|
|
74
|
+
private bundlerUrl;
|
|
75
|
+
private entryPointAddress;
|
|
76
|
+
constructor(config: EvmChainConfig, entryPointAddress: Address);
|
|
77
|
+
private call;
|
|
78
|
+
estimateGas(userOp: Partial<UserOperation>): Promise<GasEstimate>;
|
|
79
|
+
sendUserOperation(userOp: UserOperation): Promise<Hash>;
|
|
80
|
+
waitForUserOperation(userOpHash: Hash, timeout?: number): Promise<UserOpReceipt>;
|
|
81
|
+
requestApprovalSupport(token: Address, owner: Address, spender: Address, amount: bigint): Promise<ApprovalSupportResult>;
|
|
82
|
+
scheduleUserOp(userOp: UserOperation, condition: {
|
|
83
|
+
token: string;
|
|
84
|
+
minAmount: string;
|
|
85
|
+
}): Promise<{
|
|
86
|
+
status: string;
|
|
87
|
+
taskId: string;
|
|
88
|
+
}>;
|
|
89
|
+
}
|
|
90
|
+
|
|
72
91
|
/**
|
|
73
92
|
* ERC-4337 Account Abstraction Client
|
|
74
93
|
*/
|
|
@@ -84,6 +103,19 @@ declare class AccountAbstraction {
|
|
|
84
103
|
private entryPointAddress;
|
|
85
104
|
private factoryAddress;
|
|
86
105
|
constructor(chainConfig: EvmChainConfig);
|
|
106
|
+
getBundlerClient(): BundlerClient;
|
|
107
|
+
getChainId(): number;
|
|
108
|
+
getPublicClient(): PublicClient;
|
|
109
|
+
buildUserOperation(transaction: {
|
|
110
|
+
target: Address;
|
|
111
|
+
value: bigint;
|
|
112
|
+
data: Hex;
|
|
113
|
+
}): Promise<UserOperation>;
|
|
114
|
+
buildBatchUserOperation(transactions: {
|
|
115
|
+
target: Address;
|
|
116
|
+
value: bigint;
|
|
117
|
+
data: Hex;
|
|
118
|
+
}[]): Promise<UserOperation>;
|
|
87
119
|
connect(signer?: Hex | WalletClient): Promise<{
|
|
88
120
|
owner: Address;
|
|
89
121
|
smartAccount: Address;
|
|
@@ -159,21 +191,93 @@ declare global {
|
|
|
159
191
|
}
|
|
160
192
|
}
|
|
161
193
|
|
|
162
|
-
declare
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
194
|
+
declare const ChainKeyEnum: z.ZodEnum<{
|
|
195
|
+
Optimism: "Optimism";
|
|
196
|
+
Arbitrum: "Arbitrum";
|
|
197
|
+
Base: "Base";
|
|
198
|
+
Unichain: "Unichain";
|
|
199
|
+
Polygon: "Polygon";
|
|
200
|
+
Avalanche: "Avalanche";
|
|
201
|
+
WorldChain: "WorldChain";
|
|
202
|
+
Stellar: "Stellar";
|
|
203
|
+
Monad: "Monad";
|
|
204
|
+
BNB: "BNB";
|
|
205
|
+
GNOSIS: "GNOSIS";
|
|
206
|
+
Ethereum: "Ethereum";
|
|
207
|
+
Stacks: "Stacks";
|
|
208
|
+
}>;
|
|
209
|
+
type ChainKey = z.infer<typeof ChainKeyEnum>;
|
|
210
|
+
interface NearIntentAsset {
|
|
211
|
+
assetId: string;
|
|
212
|
+
name: string;
|
|
213
|
+
decimals: number;
|
|
214
|
+
}
|
|
215
|
+
interface NearIntentInformation {
|
|
216
|
+
support: boolean;
|
|
217
|
+
assetsId: NearIntentAsset[];
|
|
218
|
+
needMemo: boolean;
|
|
219
|
+
}
|
|
220
|
+
interface CCTPInformation {
|
|
221
|
+
supportCCTP: boolean;
|
|
222
|
+
domain: number;
|
|
223
|
+
}
|
|
224
|
+
interface CircleInformation {
|
|
225
|
+
supportCirclePaymaster: boolean;
|
|
226
|
+
cCTPInformation?: CCTPInformation;
|
|
227
|
+
aproxFromFee: number;
|
|
228
|
+
}
|
|
229
|
+
interface StargateInformation {
|
|
230
|
+
support: boolean;
|
|
231
|
+
}
|
|
232
|
+
interface CrossChainInformation {
|
|
233
|
+
circleInformation?: CircleInformation;
|
|
234
|
+
nearIntentInformation: NearIntentInformation | null;
|
|
235
|
+
stargateInformation?: StargateInformation;
|
|
236
|
+
}
|
|
237
|
+
interface EvmInformation {
|
|
238
|
+
chain: any;
|
|
239
|
+
rpcUrl: string | null;
|
|
240
|
+
supports7702: boolean;
|
|
241
|
+
erc4337: boolean;
|
|
242
|
+
bundlerUrl?: string;
|
|
243
|
+
entryPointAddress?: Address$1;
|
|
244
|
+
factoryAddress?: Address$1;
|
|
245
|
+
paymasterAddress?: Address$1;
|
|
246
|
+
}
|
|
247
|
+
interface NonEvmInformation {
|
|
248
|
+
networkPassphrase?: string;
|
|
249
|
+
serverURL?: string;
|
|
250
|
+
}
|
|
251
|
+
interface Asset {
|
|
252
|
+
name: string;
|
|
253
|
+
decimals: number;
|
|
254
|
+
address?: Address$1 | string;
|
|
255
|
+
coingeckoId?: string;
|
|
256
|
+
supportsStargate?: boolean;
|
|
257
|
+
}
|
|
258
|
+
interface ChainConfig {
|
|
259
|
+
assets: Asset[];
|
|
260
|
+
evm?: EvmInformation;
|
|
261
|
+
nonEvm?: NonEvmInformation;
|
|
262
|
+
crossChainInformation: CrossChainInformation;
|
|
171
263
|
}
|
|
172
264
|
|
|
265
|
+
declare const BASE: ChainConfig;
|
|
266
|
+
|
|
267
|
+
declare const AVALANCHE: ChainConfig;
|
|
268
|
+
|
|
269
|
+
declare const OPTIMISM: ChainConfig;
|
|
270
|
+
|
|
173
271
|
declare const BASE_MAINNET: ChainConfig$1;
|
|
174
272
|
declare const OPTIMISM_MAINNET: ChainConfig$1;
|
|
175
273
|
declare const GNOSIS_MAINNET: ChainConfig$1;
|
|
176
274
|
declare const BASE_SEPOLIA: ChainConfig$1;
|
|
275
|
+
declare const AVALANCHE_MAINNET: ChainConfig$1;
|
|
276
|
+
declare const BSC_MAINNET: ChainConfig$1;
|
|
277
|
+
declare const POLYGON_MAINNET: ChainConfig$1;
|
|
278
|
+
declare const ARBITRUM_MAINNET: ChainConfig$1;
|
|
279
|
+
declare const UNICHAIN_MAINNET: ChainConfig$1;
|
|
280
|
+
declare const MONAD_MAINNET: ChainConfig$1;
|
|
177
281
|
declare const STELLAR_MAINNET: ChainConfig$1;
|
|
178
282
|
declare const CHAIN_CONFIGS: Record<number, ChainConfig$1>;
|
|
179
283
|
|
|
@@ -333,75 +437,6 @@ declare class StellarService {
|
|
|
333
437
|
getKeypair(pk: string): StellarSdk.Keypair;
|
|
334
438
|
}
|
|
335
439
|
|
|
336
|
-
declare const ChainKeyEnum: z.ZodEnum<{
|
|
337
|
-
Optimism: "Optimism";
|
|
338
|
-
Arbitrum: "Arbitrum";
|
|
339
|
-
Base: "Base";
|
|
340
|
-
Unichain: "Unichain";
|
|
341
|
-
Polygon: "Polygon";
|
|
342
|
-
Avalanche: "Avalanche";
|
|
343
|
-
WorldChain: "WorldChain";
|
|
344
|
-
Stellar: "Stellar";
|
|
345
|
-
Monad: "Monad";
|
|
346
|
-
BNB: "BNB";
|
|
347
|
-
GNOSIS: "GNOSIS";
|
|
348
|
-
}>;
|
|
349
|
-
type ChainKey = z.infer<typeof ChainKeyEnum>;
|
|
350
|
-
interface NearIntentAsset {
|
|
351
|
-
assetId: string;
|
|
352
|
-
name: string;
|
|
353
|
-
decimals: number;
|
|
354
|
-
}
|
|
355
|
-
interface NearIntentInformation {
|
|
356
|
-
support: boolean;
|
|
357
|
-
assetsId: NearIntentAsset[];
|
|
358
|
-
needMemo: boolean;
|
|
359
|
-
}
|
|
360
|
-
interface CCTPInformation {
|
|
361
|
-
supportCCTP: boolean;
|
|
362
|
-
domain: number;
|
|
363
|
-
}
|
|
364
|
-
interface CircleInformation {
|
|
365
|
-
supportCirclePaymaster: boolean;
|
|
366
|
-
cCTPInformation?: CCTPInformation;
|
|
367
|
-
aproxFromFee: number;
|
|
368
|
-
}
|
|
369
|
-
interface StargateInformation {
|
|
370
|
-
support: boolean;
|
|
371
|
-
}
|
|
372
|
-
interface CrossChainInformation {
|
|
373
|
-
circleInformation?: CircleInformation;
|
|
374
|
-
nearIntentInformation: NearIntentInformation | null;
|
|
375
|
-
stargateInformation?: StargateInformation;
|
|
376
|
-
}
|
|
377
|
-
interface EvmInformation {
|
|
378
|
-
chain: any;
|
|
379
|
-
rpcUrl: string | null;
|
|
380
|
-
supports7702: boolean;
|
|
381
|
-
erc4337: boolean;
|
|
382
|
-
bundlerUrl?: string;
|
|
383
|
-
entryPointAddress?: Address$1;
|
|
384
|
-
factoryAddress?: Address$1;
|
|
385
|
-
paymasterAddress?: Address$1;
|
|
386
|
-
}
|
|
387
|
-
interface NonEvmInformation {
|
|
388
|
-
networkPassphrase?: string;
|
|
389
|
-
serverURL?: string;
|
|
390
|
-
}
|
|
391
|
-
interface Asset {
|
|
392
|
-
name: string;
|
|
393
|
-
decimals: number;
|
|
394
|
-
address?: Address$1 | string;
|
|
395
|
-
coingeckoId?: string;
|
|
396
|
-
supportsStargate?: boolean;
|
|
397
|
-
}
|
|
398
|
-
interface ChainConfig {
|
|
399
|
-
assets: Asset[];
|
|
400
|
-
evm?: EvmInformation;
|
|
401
|
-
nonEvm?: NonEvmInformation;
|
|
402
|
-
crossChainInformation: CrossChainInformation;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
440
|
declare const STELLAR: ChainConfig;
|
|
406
441
|
|
|
407
442
|
interface FacilitatorPaymentPayload {
|
|
@@ -430,6 +465,8 @@ interface SettleResponse {
|
|
|
430
465
|
attestation: string;
|
|
431
466
|
};
|
|
432
467
|
data?: any;
|
|
468
|
+
estimatedReceived?: string;
|
|
469
|
+
minAmount?: string;
|
|
433
470
|
}
|
|
434
471
|
interface BridgeContext {
|
|
435
472
|
paymentPayload?: FacilitatorPaymentPayload;
|
|
@@ -452,8 +489,24 @@ interface BridgeStrategy {
|
|
|
452
489
|
|
|
453
490
|
declare class TransferManager {
|
|
454
491
|
private strategies;
|
|
492
|
+
private router;
|
|
455
493
|
constructor();
|
|
456
|
-
execute(context: BridgeContext): Promise<SettleResponse>;
|
|
494
|
+
execute(context: BridgeContext, logCallback?: (msg: string) => void): Promise<SettleResponse>;
|
|
495
|
+
/**
|
|
496
|
+
* Special method to orchestrate the Base -> Optimism -> Base demo flow
|
|
497
|
+
* entirely within the SDK.
|
|
498
|
+
*/
|
|
499
|
+
executeMultiHopDemo(context: BridgeContext, sourceAA: AccountAbstraction, // We need the actual AA instance to sign
|
|
500
|
+
logCallback?: (msg: string) => void, overrides?: {
|
|
501
|
+
bundlerUrl?: string;
|
|
502
|
+
}): Promise<boolean>;
|
|
503
|
+
/**
|
|
504
|
+
* Specialized method for Unichain -> Stacks flow.
|
|
505
|
+
* 1. Unichain -> Ethereum (CCTP)
|
|
506
|
+
* 2. Ethereum -> Stacks (Stacks Bridge)
|
|
507
|
+
*/
|
|
508
|
+
executeUnichainToStacks(context: BridgeContext, sourceAA: AccountAbstraction, ethPrivateKey: string, // Needed for Stacks Bridge execution on Ethereum (Facilitator/Intermediary EOA)
|
|
509
|
+
logCallback?: (msg: string) => void): Promise<SettleResponse>;
|
|
457
510
|
}
|
|
458
511
|
|
|
459
512
|
declare class NearStrategy implements BridgeStrategy {
|
|
@@ -461,6 +514,14 @@ declare class NearStrategy implements BridgeStrategy {
|
|
|
461
514
|
canHandle(context: BridgeContext): boolean;
|
|
462
515
|
execute(context: BridgeContext): Promise<SettleResponse>;
|
|
463
516
|
}
|
|
517
|
+
declare function getNearQuote(sourceChain: ChainKey, destChain: ChainKey, amount: string, destToken?: string, sourceToken?: string, recipient?: string, senderAddress?: string, options?: {
|
|
518
|
+
dry?: boolean;
|
|
519
|
+
}): Promise<{
|
|
520
|
+
quote: _defuse_protocol_one_click_sdk_typescript.QuoteResponse;
|
|
521
|
+
depositAddress: string;
|
|
522
|
+
amountAtomicTotal: bigint;
|
|
523
|
+
amountAtomicNet: string;
|
|
524
|
+
}>;
|
|
464
525
|
declare function getNearSimulation(sourceChain: ChainKey, destChain: ChainKey, amount: string, destToken?: string, sourceToken?: string): Promise<{
|
|
465
526
|
success: boolean;
|
|
466
527
|
amountSent: number;
|
|
@@ -510,18 +571,38 @@ declare function getStargateSimulation(sourceChain: string, destChain: string, a
|
|
|
510
571
|
|
|
511
572
|
declare class UniswapService {
|
|
512
573
|
private publicClient;
|
|
513
|
-
constructor(
|
|
574
|
+
constructor();
|
|
514
575
|
/**
|
|
515
|
-
*
|
|
576
|
+
* Get amount of USDC needed to buy exact amount of ETH
|
|
577
|
+
* @param amountETHWei Amount of ETH (Wei) needed
|
|
516
578
|
*/
|
|
517
|
-
quoteUSDCForETH(
|
|
579
|
+
quoteUSDCForETH(amountETHWei: bigint): Promise<bigint>;
|
|
518
580
|
/**
|
|
519
|
-
* Build tx data for swapping USDC -> ETH
|
|
581
|
+
* Build tx data for swapping USDC -> ETH
|
|
582
|
+
* Uses SwapRouter02.exactOutputSingle + unwrapWETH9
|
|
520
583
|
*/
|
|
521
|
-
buildSwapData(recipient: Address,
|
|
584
|
+
buildSwapData(recipient: Address, amountOutETH: bigint, maxAmountInUSDC: bigint): Hex;
|
|
522
585
|
getRouterAddress(): Address;
|
|
523
586
|
getUSDCAddress(): Address;
|
|
524
587
|
}
|
|
525
588
|
declare const uniswapService: UniswapService;
|
|
526
589
|
|
|
527
|
-
|
|
590
|
+
interface MultiHopStep {
|
|
591
|
+
aa: AccountAbstraction;
|
|
592
|
+
buildUserOp: () => Promise<UserOperation>;
|
|
593
|
+
waitCondition?: () => Promise<boolean>;
|
|
594
|
+
description: string;
|
|
595
|
+
}
|
|
596
|
+
declare class RouterService {
|
|
597
|
+
/**
|
|
598
|
+
* Orchestrates a Multi-Hop transfer by signing ALL UserOps upfront (Reverse Order),
|
|
599
|
+
* and then executing them sequentially (Forward Order) with polling support.
|
|
600
|
+
*
|
|
601
|
+
* @param steps Array of MultiHopStep ordered by execution (Source -> Intermediate -> Dest)
|
|
602
|
+
* @param onLog Optional callback for logging progress
|
|
603
|
+
*/
|
|
604
|
+
executeMultiHop(steps: MultiHopStep[], onLog?: (msg: string) => void): Promise<boolean>;
|
|
605
|
+
private pollCondition;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export { ARBITRUM_MAINNET, AVALANCHE, AVALANCHE_MAINNET, AccountAbstraction, type ApprovalSupportResult, BASE, BASE_MAINNET, BASE_SEPOLIA, BSC_MAINNET, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig$1 as ChainConfig, GNOSIS_MAINNET, type GasEstimate, MONAD_MAINNET, NearStrategy, OPTIMISM, OPTIMISM_MAINNET, POLYGON_MAINNET, RouterService, STELLAR, STELLAR_MAINNET, StargateStrategy, StellarService, type Token, TransferManager, UNICHAIN_MAINNET, UniswapService, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, getNearQuote, getNearSimulation, getStargateSimulation, smartAccountAbi, uniswapService };
|