@sodax/sdk 1.0.0-rc.8 → 1.0.1-beta-rc2
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.cjs +5450 -5166
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1961 -1777
- package/dist/index.d.ts +1961 -1777
- package/dist/index.mjs +7692 -7440
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconAddress, IInjectiveWalletProvider, InjectiveExecuteResponse, SolanaChainConfig, SolanaBase58PublicKey, SolanaRpcResponseAndContext, SolanaTokenAmount, SolanaRawTransactionInstruction, WalletAddressProvider, SolanaSerializedTransaction, ISolanaWalletProvider, StellarSpokeChainConfig, StellarRpcConfig, IStellarWalletProvider, SuiSpokeChainConfig, SuiPaginatedCoins, SuiExecutionResult, ISuiWalletProvider, Address, Erc20Token, HttpUrl, SpokeChainId, Token, GetMoneyMarketTokensApiResponse, IconSpokeChainConfig, IIconWalletProvider, EvmHubChainConfig, EvmSpokeChainConfig, IEvmWalletProvider, SpokeChainConfig, SonicSpokeChainConfig, EvmChainId, InjectiveSpokeChainConfig, JsonObject, InjectiveRawTransaction, AssetInfo, Hex as Hex$1, TokenInfo, HubAddress, EvmRawTransaction, SolverConfig, Hash as Hash$1, IntentRelayChainId, StellarRawTransaction, MoneyMarketConfig, spokeChainConfig, ICON_MAINNET_CHAIN_ID, ChainType, BaseSpokeChainConfig, IConfigApi, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, GetSwapTokensByChainIdApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetHubAssetsApiResponse, GetHubAssetsByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, OriginalAssetAddress, HubAssetInfo, HubChainId, XToken, EvmRawTransactionReceipt, IconEoaAddress, HubChainConfig } from '@sodax/types';
|
|
2
2
|
export * from '@sodax/types';
|
|
3
3
|
import * as viem from 'viem';
|
|
4
4
|
import { Hex, PublicClient, HttpTransport, Address as Address$1, WalletClient, CustomTransport, Chain, Account as Account$1, Hash, GetLogsReturnType, TransactionReceipt } from 'viem';
|
|
5
5
|
import { IconService } from 'icon-sdk-js';
|
|
6
|
-
import {
|
|
6
|
+
import { Connection, TransactionInstruction, PublicKey, Finality } from '@solana/web3.js';
|
|
7
7
|
import { SuiClient } from '@mysten/sui/client';
|
|
8
8
|
import { Transaction as Transaction$1, TransactionResult } from '@mysten/sui/transactions';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { SorobanRpc, rpc, Transaction, Memo, MemoType, Operation, FeeBumpTransaction, Horizon, Contract, Account, xdr } from '@stellar/stellar-sdk';
|
|
10
|
+
import { ChainGrpcWasmApi, TxGrpcApi } from '@injectivelabs/sdk-ts';
|
|
11
|
+
import { NetworkEndpoints } from '@injectivelabs/networks';
|
|
11
12
|
import BigNumber$1 from 'bignumber.js';
|
|
12
13
|
|
|
13
14
|
declare const assetManagerAbi: readonly [{
|
|
@@ -5363,15 +5364,6 @@ declare const stakingRouterAbi: readonly [{
|
|
|
5363
5364
|
readonly type: "function";
|
|
5364
5365
|
}];
|
|
5365
5366
|
|
|
5366
|
-
declare class IconSpokeProvider {
|
|
5367
|
-
readonly walletProvider: IIconWalletProvider;
|
|
5368
|
-
readonly chainConfig: IconSpokeChainConfig;
|
|
5369
|
-
readonly iconService: IconService;
|
|
5370
|
-
readonly debugRpcUrl: HttpUrl;
|
|
5371
|
-
constructor(walletProvider: IIconWalletProvider, chainConfig: IconSpokeChainConfig, rpcUrl?: HttpUrl, // default to mainnet
|
|
5372
|
-
debugRpcUrl?: HttpUrl);
|
|
5373
|
-
}
|
|
5374
|
-
|
|
5375
5367
|
declare function getIconAddressBytes(address: string): Hex;
|
|
5376
5368
|
|
|
5377
5369
|
type IconJsonRpcVersion = '2.0';
|
|
@@ -5448,7 +5440,44 @@ declare class Injective20Token {
|
|
|
5448
5440
|
transferFrom(senderAddress: string, ownerAddress: string, recipientAddress: string, amount: string): Promise<InjectiveExecuteResponse>;
|
|
5449
5441
|
}
|
|
5450
5442
|
|
|
5443
|
+
declare class SolanaBaseSpokeProvider {
|
|
5444
|
+
readonly chainConfig: SolanaChainConfig;
|
|
5445
|
+
constructor(chainConfig: SolanaChainConfig);
|
|
5446
|
+
static getBalance(connection: Connection, publicKey: SolanaBase58PublicKey): Promise<number>;
|
|
5447
|
+
static getTokenAccountBalance(connection: Connection, publicKey: SolanaBase58PublicKey): Promise<SolanaRpcResponseAndContext<SolanaTokenAmount>>;
|
|
5448
|
+
static getAssociatedTokenAddress(mint: SolanaBase58PublicKey, walletAddress: SolanaBase58PublicKey): Promise<SolanaBase58PublicKey>;
|
|
5449
|
+
static buildTransactionInstruction(rawInstructions: SolanaRawTransactionInstruction[]): TransactionInstruction[];
|
|
5450
|
+
}
|
|
5451
|
+
declare class SolanaSpokeProvider extends SolanaBaseSpokeProvider implements ISpokeProvider {
|
|
5452
|
+
readonly walletProvider: ISolanaWalletProvider;
|
|
5453
|
+
constructor(walletProvider: ISolanaWalletProvider, chainConfig: SolanaChainConfig);
|
|
5454
|
+
}
|
|
5455
|
+
type SolanaRawSpokeProviderConfig = {
|
|
5456
|
+
connection: {
|
|
5457
|
+
connection: Connection;
|
|
5458
|
+
} | {
|
|
5459
|
+
rpcUrl: string;
|
|
5460
|
+
};
|
|
5461
|
+
walletAddress: SolanaBase58PublicKey;
|
|
5462
|
+
chainConfig: SolanaChainConfig;
|
|
5463
|
+
};
|
|
5464
|
+
declare class SolanaRawSpokeProvider extends SolanaBaseSpokeProvider implements IRawSpokeProvider {
|
|
5465
|
+
readonly walletProvider: WalletAddressProvider & {
|
|
5466
|
+
buildV0Txn: (instructions: SolanaRawTransactionInstruction[]) => Promise<SolanaSerializedTransaction>;
|
|
5467
|
+
getBalance: (publicKey: SolanaBase58PublicKey) => Promise<number>;
|
|
5468
|
+
getTokenAccountBalance: (publicKey: SolanaBase58PublicKey) => Promise<SolanaRpcResponseAndContext<SolanaTokenAmount>>;
|
|
5469
|
+
getAssociatedTokenAddress: (mint: SolanaBase58PublicKey) => Promise<SolanaBase58PublicKey>;
|
|
5470
|
+
};
|
|
5471
|
+
readonly raw = true;
|
|
5472
|
+
readonly connection: Connection;
|
|
5473
|
+
constructor({ connection, walletAddress, chainConfig }: SolanaRawSpokeProviderConfig);
|
|
5474
|
+
buildV0Txn(rawInstructions: SolanaRawTransactionInstruction[]): Promise<SolanaSerializedTransaction>;
|
|
5475
|
+
}
|
|
5476
|
+
|
|
5451
5477
|
declare function getSolanaAddressBytes(address: PublicKey): Hex;
|
|
5478
|
+
declare function hexToSolanaAddress(hex: Hex): PublicKey;
|
|
5479
|
+
declare function isSolanaNativeToken(address: PublicKey): boolean;
|
|
5480
|
+
declare function convertTransactionInstructionToRaw(instruction: TransactionInstruction): SolanaRawTransactionInstruction;
|
|
5452
5481
|
|
|
5453
5482
|
declare class CustomSorobanServer extends SorobanRpc.Server {
|
|
5454
5483
|
private customHeaders;
|
|
@@ -5475,24 +5504,32 @@ declare class CustomStellarAccount {
|
|
|
5475
5504
|
decrementSequenceNumber(): void;
|
|
5476
5505
|
resetSequenceNumber(): void;
|
|
5477
5506
|
}
|
|
5478
|
-
declare class
|
|
5507
|
+
declare class StellarBaseSpokeProvider {
|
|
5479
5508
|
readonly server: Horizon.Server;
|
|
5480
5509
|
readonly sorobanServer: CustomSorobanServer;
|
|
5481
|
-
|
|
5510
|
+
readonly contract: Contract;
|
|
5482
5511
|
readonly chainConfig: StellarSpokeChainConfig;
|
|
5512
|
+
constructor(config: StellarSpokeChainConfig, rpcConfig?: StellarRpcConfig);
|
|
5513
|
+
static getBalance(tokenAddress: string, provider: StellarSpokeProviderType): Promise<number>;
|
|
5514
|
+
static buildPriorityStellarTransaction(account: CustomStellarAccount, network: rpc.Api.GetNetworkResponse, operation: xdr.Operation<Operation.InvokeHostFunction>, provider: StellarSpokeProviderType): Promise<[Transaction, rpc.Api.SimulateTransactionResponse]>;
|
|
5515
|
+
static deposit<S extends StellarSpokeProviderType, R extends boolean = false>(token: string, amount: string, recipient: Uint8Array, data: Uint8Array, provider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
5516
|
+
static buildDepositCall(walletAddress: string, token: string, amount: string, recipient: Uint8Array, data: Uint8Array, provider: StellarSpokeProviderType): xdr.Operation<Operation.InvokeHostFunction>;
|
|
5517
|
+
static sendMessage<S extends StellarSpokeProviderType, R extends boolean = false>(dst_chain_id: string, dst_address: Uint8Array, payload: Uint8Array, provider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
5518
|
+
static buildSendMessageCall(walletAddress: string, dst_chain_id: string, dst_address: Uint8Array, payload: Uint8Array, provider: StellarSpokeProviderType): xdr.Operation<Operation.InvokeHostFunction>;
|
|
5519
|
+
}
|
|
5520
|
+
declare class StellarRawSpokeProvider extends StellarBaseSpokeProvider implements IRawSpokeProvider {
|
|
5521
|
+
readonly walletProvider: WalletAddressProvider;
|
|
5522
|
+
readonly raw = true;
|
|
5523
|
+
constructor(walletAddress: string, chainConfig: StellarSpokeChainConfig, rpcConfig?: StellarRpcConfig);
|
|
5524
|
+
}
|
|
5525
|
+
declare class StellarSpokeProvider extends StellarBaseSpokeProvider implements ISpokeProvider {
|
|
5483
5526
|
readonly walletProvider: IStellarWalletProvider;
|
|
5484
5527
|
constructor(walletProvider: IStellarWalletProvider, config: StellarSpokeChainConfig, rpcConfig?: StellarRpcConfig);
|
|
5485
|
-
getBalance(tokenAddress: string): Promise<number>;
|
|
5486
|
-
buildPriorityStellarTransaction(account: CustomStellarAccount, network: rpc.Api.GetNetworkResponse, operation: xdr.Operation<Operation.InvokeHostFunction>): Promise<[Transaction, rpc.Api.SimulateTransactionResponse]>;
|
|
5487
5528
|
private handleSendTransactionError;
|
|
5488
5529
|
signAndSendTransaction(tx: Transaction | FeeBumpTransaction, waitForTransaction?: boolean): Promise<string>;
|
|
5489
5530
|
private waitForTransaction;
|
|
5490
5531
|
submitOrRestoreAndRetry(account: CustomStellarAccount, network: rpc.Api.GetNetworkResponse, tx: Transaction, operation: xdr.Operation<Operation.InvokeHostFunction>, simulation?: rpc.Api.SimulateTransactionResponse): Promise<string>;
|
|
5491
5532
|
private handleSimulationRestore;
|
|
5492
|
-
deposit<R extends boolean = false>(token: string, amount: string, recipient: Uint8Array, data: Uint8Array, raw?: R): PromiseStellarTxReturnType<R>;
|
|
5493
|
-
sendMessage<R extends boolean = false>(dst_chain_id: string, dst_address: Uint8Array, payload: Uint8Array, raw?: R): PromiseStellarTxReturnType<R>;
|
|
5494
|
-
private buildDepositCall;
|
|
5495
|
-
private buildSendMessageCall;
|
|
5496
5533
|
static getAddressBCSBytes(stellaraddress: string): Hex;
|
|
5497
5534
|
static getTsWalletBytes(stellaraddress: string): Hex;
|
|
5498
5535
|
}
|
|
@@ -5506,26 +5543,36 @@ type SuiTxObject = {
|
|
|
5506
5543
|
Input: number;
|
|
5507
5544
|
type?: 'object' | undefined;
|
|
5508
5545
|
};
|
|
5509
|
-
declare class
|
|
5510
|
-
readonly walletProvider: ISuiWalletProvider;
|
|
5546
|
+
declare class SuiBaseSpokeProvider {
|
|
5511
5547
|
chainConfig: SuiSpokeChainConfig;
|
|
5512
5548
|
readonly publicClient: SuiClient;
|
|
5513
|
-
|
|
5514
|
-
constructor(config: SuiSpokeChainConfig
|
|
5515
|
-
|
|
5516
|
-
transfer<R extends boolean = false>(token: string, amount: bigint, to: Uint8Array, data: Uint8Array, raw?: R): PromiseSuiTxReturnType<R>;
|
|
5517
|
-
getNativeCoin(tx: Transaction$1, amount: bigint): Promise<SuiNativeCoinResult>;
|
|
5549
|
+
assetManagerAddress: string | undefined;
|
|
5550
|
+
constructor(config: SuiSpokeChainConfig);
|
|
5551
|
+
getCoins(address: string, token: string): Promise<SuiPaginatedCoins>;
|
|
5518
5552
|
getCoin(tx: Transaction$1, coin: string, amount: bigint, address: string): Promise<TransactionResult | SuiTxObject>;
|
|
5519
5553
|
splitAddress(address: string): {
|
|
5520
5554
|
packageId: string;
|
|
5521
5555
|
moduleId: string;
|
|
5522
5556
|
stateId: string;
|
|
5523
5557
|
};
|
|
5524
|
-
|
|
5525
|
-
configureAssetManagerHub(hubNetworkId: number, hubAssetManager: Uint8Array): Promise<string>;
|
|
5526
|
-
getWalletAddress(): Promise<string>;
|
|
5558
|
+
getNativeCoin(tx: Transaction$1, amount: bigint): Promise<SuiNativeCoinResult>;
|
|
5527
5559
|
static getAddressBCSBytes(suiaddress: string): Hex;
|
|
5528
5560
|
getAssetManagerAddress(): Promise<string>;
|
|
5561
|
+
viewContract(tx: Transaction$1, packageId: string, module: string, functionName: string, args: unknown[], typeArgs: string[] | undefined, sender: string): Promise<SuiExecutionResult>;
|
|
5562
|
+
getBalance(walletAddress: string, token: string): Promise<bigint>;
|
|
5563
|
+
transfer<S extends SuiSpokeProviderType, R extends boolean = false>(token: string, amount: bigint, to: Uint8Array, data: Uint8Array, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
5564
|
+
sendMessage<S extends SuiSpokeProviderType, R extends boolean = false>(dst_chain_id: bigint, dst_address: Uint8Array, data: Uint8Array, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
5565
|
+
}
|
|
5566
|
+
declare class SuiRawSpokeProvider extends SuiBaseSpokeProvider implements IRawSpokeProvider {
|
|
5567
|
+
readonly walletProvider: WalletAddressProvider;
|
|
5568
|
+
readonly raw = true;
|
|
5569
|
+
constructor(chainConfig: SuiSpokeChainConfig, walletAddress: string);
|
|
5570
|
+
}
|
|
5571
|
+
declare class SuiSpokeProvider extends SuiBaseSpokeProvider implements ISpokeProvider {
|
|
5572
|
+
readonly walletProvider: ISuiWalletProvider;
|
|
5573
|
+
constructor(config: SuiSpokeChainConfig, wallet_provider: ISuiWalletProvider);
|
|
5574
|
+
configureAssetManagerHub(hubNetworkId: number, hubAssetManager: Uint8Array): Promise<string>;
|
|
5575
|
+
getWalletAddress(): Promise<string>;
|
|
5529
5576
|
}
|
|
5530
5577
|
|
|
5531
5578
|
type PoolBaseCurrencyHumanized = {
|
|
@@ -6324,25 +6371,77 @@ type MoneyMarketEncodeRepayWithATokensParams = {
|
|
|
6324
6371
|
interestRateMode: bigint;
|
|
6325
6372
|
};
|
|
6326
6373
|
type MoneyMarketAction = 'supply' | 'borrow' | 'withdraw' | 'repay';
|
|
6374
|
+
/**
|
|
6375
|
+
* Parameters for a Money Market supply operation.
|
|
6376
|
+
*
|
|
6377
|
+
* @property token - The source chain token address to supply.
|
|
6378
|
+
* @property amount - The amount of the asset to supply.
|
|
6379
|
+
* @property action - The action type ('supply').
|
|
6380
|
+
* @property toChainId - (Optional) Target spoke chain ID to receive the supplied assets.
|
|
6381
|
+
* Note: If omitted, assets are supplied to the sender's default spoke account.
|
|
6382
|
+
* @property toAddress - (Optional) The address on the target chain that will receive the supplied assets.
|
|
6383
|
+
* Note: If omitted, assets are supplied to the sender's default spoke account.
|
|
6384
|
+
*/
|
|
6327
6385
|
type MoneyMarketSupplyParams = {
|
|
6328
6386
|
token: string;
|
|
6329
6387
|
amount: bigint;
|
|
6330
6388
|
action: 'supply';
|
|
6389
|
+
toChainId?: SpokeChainId;
|
|
6390
|
+
toAddress?: Address;
|
|
6331
6391
|
};
|
|
6392
|
+
/**
|
|
6393
|
+
* Parameters for a Money Market borrow operation.
|
|
6394
|
+
*
|
|
6395
|
+
* @property token - The target chain token address to borrow.
|
|
6396
|
+
* @property amount - The amount of the asset to borrow.
|
|
6397
|
+
* @property action - Action type ('borrow').
|
|
6398
|
+
* @property toChainId - (Optional) Target chain ID to receive the borrowed assets.
|
|
6399
|
+
* Note: If omitted, borrowed assets are sent to the sender's default spoke account.
|
|
6400
|
+
* @property toAddress - (Optional) Target address on the taret chain to receive the borrowed assets.
|
|
6401
|
+
* Note: If omitted, borrowed assets are sent to the sender's default spoke account.
|
|
6402
|
+
*/
|
|
6332
6403
|
type MoneyMarketBorrowParams = {
|
|
6333
6404
|
token: string;
|
|
6334
6405
|
amount: bigint;
|
|
6335
6406
|
action: 'borrow';
|
|
6407
|
+
toChainId?: SpokeChainId;
|
|
6408
|
+
toAddress?: Address;
|
|
6336
6409
|
};
|
|
6410
|
+
/**
|
|
6411
|
+
* Parameters for a Money Market withdraw operation.
|
|
6412
|
+
*
|
|
6413
|
+
* @property token - The target chain token address to withdraw.
|
|
6414
|
+
* @property amount - The amount of the asset to withdraw.
|
|
6415
|
+
* @property action - The action type ('withdraw').
|
|
6416
|
+
* @property toChainId - (Optional) Target spoke chain ID to receive the withdrawn assets.
|
|
6417
|
+
* Note: If omitted, assets are sent to the sender's default spoke account.
|
|
6418
|
+
* @property toAddress - (Optional) Target address on the spoke chain to receive the withdrawn assets.
|
|
6419
|
+
* Note:If omitted, assets are sent to the sender's default spoke account.
|
|
6420
|
+
*/
|
|
6337
6421
|
type MoneyMarketWithdrawParams = {
|
|
6338
6422
|
token: string;
|
|
6339
6423
|
amount: bigint;
|
|
6340
6424
|
action: 'withdraw';
|
|
6425
|
+
toChainId?: SpokeChainId;
|
|
6426
|
+
toAddress?: Address;
|
|
6341
6427
|
};
|
|
6428
|
+
/**
|
|
6429
|
+
* Parameters for a Money Market repay operation.
|
|
6430
|
+
*
|
|
6431
|
+
* @property token - The source chain token address to repay.
|
|
6432
|
+
* @property amount - The amount of the asset to repay.
|
|
6433
|
+
* @property action - The action type ('repay').
|
|
6434
|
+
* @property toChainId - (Optional) Target spoke chain ID to receive the repaid assets.
|
|
6435
|
+
* Note: If omitted, assets are repaid to the sender's default spoke account.
|
|
6436
|
+
* @property toAddress - (Optional) Target address on the spoke chain to receive the repaid assets.
|
|
6437
|
+
* Note: If omitted, assets are repaid to the sender's default spoke account.
|
|
6438
|
+
*/
|
|
6342
6439
|
type MoneyMarketRepayParams = {
|
|
6343
6440
|
token: string;
|
|
6344
6441
|
amount: bigint;
|
|
6345
6442
|
action: 'repay';
|
|
6443
|
+
toChainId?: SpokeChainId;
|
|
6444
|
+
toAddress?: Address;
|
|
6346
6445
|
};
|
|
6347
6446
|
type MoneyMarketParams = MoneyMarketSupplyParams | MoneyMarketBorrowParams | MoneyMarketWithdrawParams | MoneyMarketRepayParams;
|
|
6348
6447
|
type MoneyMarketUnknownErrorCode = 'SUPPLY_UNKNOWN_ERROR' | 'BORROW_UNKNOWN_ERROR' | 'WITHDRAW_UNKNOWN_ERROR' | 'REPAY_UNKNOWN_ERROR';
|
|
@@ -6709,42 +6808,42 @@ declare class MoneyMarketService {
|
|
|
6709
6808
|
createRepayIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketRepayParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketError<'CREATE_REPAY_INTENT_FAILED'>> & MoneyMarketOptionalExtraData>;
|
|
6710
6809
|
/**
|
|
6711
6810
|
* Build transaction data for supplying to the money market pool
|
|
6712
|
-
* @param
|
|
6713
|
-
* @param
|
|
6811
|
+
* @param fromChainId - The chain ID of the source chain
|
|
6812
|
+
* @param fromToken - The address of the token on source chain
|
|
6714
6813
|
* @param amount - The amount to deposit
|
|
6715
|
-
* @param
|
|
6814
|
+
* @param toHubAddress - The user wallet address on the hub chain
|
|
6716
6815
|
* @returns {Hex} The transaction data.
|
|
6717
6816
|
*/
|
|
6718
|
-
buildSupplyData(
|
|
6817
|
+
buildSupplyData(fromChainId: SpokeChainId, fromToken: string, amount: bigint, toHubAddress: Address): Hex;
|
|
6719
6818
|
/**
|
|
6720
6819
|
* Build transaction data for borrowing from the money market pool
|
|
6721
|
-
* @param
|
|
6722
|
-
* @param
|
|
6723
|
-
* @param
|
|
6820
|
+
* @param fromHubAddress - The hub address of the user to borrow from
|
|
6821
|
+
* @param toAddress - The user wallet address on the target chain
|
|
6822
|
+
* @param toToken - The address of the token on the target chain
|
|
6724
6823
|
* @param amount - The amount to borrow in hub chain decimals
|
|
6725
|
-
* @param
|
|
6824
|
+
* @param toChainId - The chain ID of the target chain
|
|
6726
6825
|
* @returns {Hex} The transaction data.
|
|
6727
6826
|
*/
|
|
6728
|
-
buildBorrowData(
|
|
6827
|
+
buildBorrowData(fromHubAddress: Address, toAddress: Address, toToken: string, amount: bigint, toChainId: SpokeChainId): Hex;
|
|
6729
6828
|
/**
|
|
6730
6829
|
* Build transaction data for withdrawing from the money market pool
|
|
6731
|
-
* @param
|
|
6732
|
-
* @param
|
|
6733
|
-
* @param
|
|
6734
|
-
* @param amount - The amount to
|
|
6735
|
-
* @param
|
|
6830
|
+
* @param fromHubAddress - The hub address of the user to withdraw from
|
|
6831
|
+
* @param toAddress - The user wallet address on the target chain
|
|
6832
|
+
* @param toToken - The address of the token on the target chain
|
|
6833
|
+
* @param amount - The amount to withdraw in hub chain decimals
|
|
6834
|
+
* @param toChainId - The chain ID of the target chain
|
|
6736
6835
|
* @returns {Hex} The transaction data.
|
|
6737
6836
|
*/
|
|
6738
|
-
buildWithdrawData(
|
|
6837
|
+
buildWithdrawData(fromHubAddress: Address, toAddress: Address, toToken: string, amount: bigint, toChainId: SpokeChainId): Hex;
|
|
6739
6838
|
/**
|
|
6740
6839
|
* Build transaction data for repaying to the money market pool
|
|
6741
|
-
* @param
|
|
6742
|
-
* @param
|
|
6840
|
+
* @param fromChainId - The chain ID of the source chain
|
|
6841
|
+
* @param fromToken - The address of the token on the source chain
|
|
6743
6842
|
* @param amount - The amount to repay
|
|
6744
|
-
* @param
|
|
6843
|
+
* @param toHubAddress - The hub address of the user to repay to
|
|
6745
6844
|
* @returns {Hex} The transaction data.
|
|
6746
6845
|
*/
|
|
6747
|
-
buildRepayData(
|
|
6846
|
+
buildRepayData(fromChainId: SpokeChainId, fromToken: string, amount: bigint, toHubAddress: Address): Hex;
|
|
6748
6847
|
/**
|
|
6749
6848
|
* Calculate aToken amount from actual amount using liquidityIndex
|
|
6750
6849
|
* @param amount - The actual amount
|
|
@@ -6822,7 +6921,7 @@ declare class MoneyMarketService {
|
|
|
6822
6921
|
}
|
|
6823
6922
|
|
|
6824
6923
|
type SodaxConfig = {
|
|
6825
|
-
|
|
6924
|
+
swaps?: SolverConfigParams;
|
|
6826
6925
|
moneyMarket?: MoneyMarketConfigParams;
|
|
6827
6926
|
migration?: MigrationServiceConfig;
|
|
6828
6927
|
bridge?: BridgeServiceConfig;
|
|
@@ -6837,7 +6936,7 @@ type SodaxConfig = {
|
|
|
6837
6936
|
*/
|
|
6838
6937
|
declare class Sodax {
|
|
6839
6938
|
readonly instanceConfig?: SodaxConfig;
|
|
6840
|
-
readonly
|
|
6939
|
+
readonly swaps: SwapService;
|
|
6841
6940
|
readonly moneyMarket: MoneyMarketService;
|
|
6842
6941
|
readonly migration: MigrationService;
|
|
6843
6942
|
readonly backendApi: BackendApiService;
|
|
@@ -6856,10 +6955,22 @@ declare class Sodax {
|
|
|
6856
6955
|
initialize(): Promise<Result<void>>;
|
|
6857
6956
|
}
|
|
6858
6957
|
|
|
6859
|
-
declare class
|
|
6860
|
-
readonly
|
|
6861
|
-
readonly
|
|
6862
|
-
|
|
6958
|
+
declare class IconBaseSpokeProvider {
|
|
6959
|
+
readonly chainConfig: IconSpokeChainConfig;
|
|
6960
|
+
readonly iconService: IconService;
|
|
6961
|
+
readonly debugRpcUrl: HttpUrl;
|
|
6962
|
+
constructor(chainConfig: IconSpokeChainConfig, rpcUrl?: HttpUrl, // default to mainnet
|
|
6963
|
+
debugRpcUrl?: HttpUrl);
|
|
6964
|
+
}
|
|
6965
|
+
declare class IconSpokeProvider extends IconBaseSpokeProvider implements ISpokeProvider {
|
|
6966
|
+
readonly walletProvider: IIconWalletProvider;
|
|
6967
|
+
constructor(walletProvider: IIconWalletProvider, chainConfig: IconSpokeChainConfig, rpcUrl?: HttpUrl, // default to mainnet
|
|
6968
|
+
debugRpcUrl?: HttpUrl);
|
|
6969
|
+
}
|
|
6970
|
+
declare class IconRawSpokeProvider extends IconBaseSpokeProvider implements IRawSpokeProvider {
|
|
6971
|
+
readonly walletProvider: WalletAddressProvider;
|
|
6972
|
+
readonly raw = true;
|
|
6973
|
+
constructor(chainConfig: IconSpokeChainConfig, walletAddress: string);
|
|
6863
6974
|
}
|
|
6864
6975
|
|
|
6865
6976
|
type CustomProvider = {
|
|
@@ -6869,6 +6980,11 @@ interface ISpokeProvider {
|
|
|
6869
6980
|
readonly walletProvider: IWalletProvider;
|
|
6870
6981
|
readonly chainConfig: SpokeChainConfig;
|
|
6871
6982
|
}
|
|
6983
|
+
interface IRawSpokeProvider {
|
|
6984
|
+
readonly walletProvider: WalletAddressProvider;
|
|
6985
|
+
readonly chainConfig: SpokeChainConfig;
|
|
6986
|
+
readonly raw: true;
|
|
6987
|
+
}
|
|
6872
6988
|
type EvmUninitializedBrowserConfig = {
|
|
6873
6989
|
userAddress: Address$1;
|
|
6874
6990
|
chain: EvmChainId;
|
|
@@ -6898,21 +7014,38 @@ declare class EvmHubProvider {
|
|
|
6898
7014
|
readonly configService: ConfigService;
|
|
6899
7015
|
constructor({ config, configService }: EvmHubProviderConstructorParams);
|
|
6900
7016
|
}
|
|
6901
|
-
declare class
|
|
6902
|
-
readonly walletProvider: IEvmWalletProvider;
|
|
6903
|
-
readonly chainConfig: SonicSpokeChainConfig;
|
|
7017
|
+
declare class SonicBaseSpokeProvider {
|
|
6904
7018
|
readonly publicClient: PublicClient<HttpTransport>;
|
|
6905
|
-
|
|
7019
|
+
readonly chainConfig: SonicSpokeChainConfig;
|
|
7020
|
+
constructor(chainConfig: SonicSpokeChainConfig, rpcUrl?: string);
|
|
6906
7021
|
}
|
|
6907
|
-
declare class
|
|
7022
|
+
declare class SonicSpokeProvider extends SonicBaseSpokeProvider implements ISpokeProvider {
|
|
6908
7023
|
readonly walletProvider: IEvmWalletProvider;
|
|
6909
|
-
|
|
7024
|
+
constructor(walletProvider: IEvmWalletProvider, chainConfig: SonicSpokeChainConfig, rpcUrl?: string);
|
|
7025
|
+
}
|
|
7026
|
+
declare class SonicRawSpokeProvider extends SonicBaseSpokeProvider implements IRawSpokeProvider {
|
|
7027
|
+
readonly walletProvider: WalletAddressProvider;
|
|
7028
|
+
readonly raw = true;
|
|
7029
|
+
constructor(walletAddress: Address$1, chainConfig: SonicSpokeChainConfig, rpcUrl?: string);
|
|
7030
|
+
}
|
|
7031
|
+
declare class EvmBaseSpokeProvider {
|
|
6910
7032
|
readonly publicClient: PublicClient<HttpTransport>;
|
|
7033
|
+
readonly chainConfig: EvmSpokeChainConfig;
|
|
7034
|
+
constructor(chainConfig: EvmSpokeChainConfig, rpcUrl?: string);
|
|
7035
|
+
}
|
|
7036
|
+
declare class EvmSpokeProvider extends EvmBaseSpokeProvider implements ISpokeProvider {
|
|
7037
|
+
readonly walletProvider: IEvmWalletProvider;
|
|
6911
7038
|
constructor(walletProvider: IEvmWalletProvider, chainConfig: EvmSpokeChainConfig, rpcUrl?: string);
|
|
6912
7039
|
}
|
|
6913
|
-
|
|
7040
|
+
declare class EvmRawSpokeProvider extends EvmBaseSpokeProvider implements IRawSpokeProvider {
|
|
7041
|
+
readonly walletProvider: WalletAddressProvider;
|
|
7042
|
+
readonly raw = true;
|
|
7043
|
+
constructor(walletAddress: Address$1, chainConfig: EvmSpokeChainConfig, rpcUrl?: string);
|
|
7044
|
+
}
|
|
6914
7045
|
type IWalletProvider = IEvmWalletProvider | IInjectiveWalletProvider | IStellarWalletProvider | ISuiWalletProvider | IIconWalletProvider | IInjectiveWalletProvider | ISolanaWalletProvider;
|
|
6915
7046
|
type SpokeProvider = (EvmSpokeProvider | InjectiveSpokeProvider | IconSpokeProvider | SuiSpokeProvider | StellarSpokeProvider | SolanaSpokeProvider | SonicSpokeProvider) & ISpokeProvider;
|
|
7047
|
+
type RawSpokeProvider = (EvmRawSpokeProvider | InjectiveRawSpokeProvider | IconRawSpokeProvider | SuiRawSpokeProvider | StellarRawSpokeProvider | SolanaRawSpokeProvider | SonicRawSpokeProvider) & IRawSpokeProvider;
|
|
7048
|
+
type SpokeProviderType = SpokeProvider | RawSpokeProvider;
|
|
6916
7049
|
|
|
6917
7050
|
interface InstantiateMsg {
|
|
6918
7051
|
connection: string;
|
|
@@ -6961,28 +7094,204 @@ interface State {
|
|
|
6961
7094
|
hub_chain_id: string;
|
|
6962
7095
|
owner: string;
|
|
6963
7096
|
}
|
|
6964
|
-
declare class
|
|
6965
|
-
readonly walletProvider: IInjectiveWalletProvider;
|
|
7097
|
+
declare class InjectiveBaseSpokeProvider {
|
|
6966
7098
|
readonly chainConfig: InjectiveSpokeChainConfig;
|
|
6967
|
-
|
|
7099
|
+
readonly chainGrpcWasmApi: ChainGrpcWasmApi;
|
|
6968
7100
|
readonly txClient: TxGrpcApi;
|
|
6969
|
-
|
|
7101
|
+
readonly endpoints: NetworkEndpoints;
|
|
7102
|
+
constructor(chainConfig: InjectiveSpokeChainConfig);
|
|
6970
7103
|
getState(): Promise<State>;
|
|
6971
7104
|
getBalance(token: String): Promise<number>;
|
|
7105
|
+
getRawTransaction(chainId: string, _: string, senderAddress: string, contractAddress: string, msg: JsonObject, memo?: string): Promise<InjectiveRawTransaction>;
|
|
7106
|
+
send_message<S extends InjectiveSpokeProviderType, R extends boolean = false>(sender: string, dst_chain_id: string, dst_address: Hex, payload: Hex, spokeProvider: S, raw?: R): Promise<TxReturnType<InjectiveSpokeProviderType, R>>;
|
|
7107
|
+
}
|
|
7108
|
+
declare class InjectiveRawSpokeProvider extends InjectiveBaseSpokeProvider implements IRawSpokeProvider {
|
|
7109
|
+
readonly walletProvider: WalletAddressProvider;
|
|
7110
|
+
readonly raw = true;
|
|
7111
|
+
constructor(chainConfig: InjectiveSpokeChainConfig, walletAddress: string);
|
|
7112
|
+
}
|
|
7113
|
+
declare class InjectiveSpokeProvider extends InjectiveBaseSpokeProvider implements ISpokeProvider {
|
|
7114
|
+
readonly walletProvider: IInjectiveWalletProvider;
|
|
7115
|
+
constructor(conf: InjectiveSpokeChainConfig, walletProvider: IInjectiveWalletProvider);
|
|
6972
7116
|
/**
|
|
6973
7117
|
* Deposit tokens including native token to Injective Asset Manager.
|
|
6974
7118
|
**/
|
|
6975
|
-
static deposit<R extends boolean = false>(sender: string, token_address: string, to: Address$1, amount: string, data: Hex | undefined, spokeProvider:
|
|
7119
|
+
static deposit<S extends InjectiveSpokeProviderType, R extends boolean = false>(sender: string, token_address: string, to: Address$1, amount: string, data: Hex | undefined, spokeProvider: S, raw?: R): Promise<TxReturnType<InjectiveSpokeProviderType, R>>;
|
|
6976
7120
|
receiveMessage(senderAddress: string, srcChainId: string, srcAddress: Uint8Array, connSn: string, payload: Uint8Array, signatures: Uint8Array[]): Promise<InjectiveExecuteResponse>;
|
|
6977
7121
|
setRateLimit(senderAddress: string, rateLimit: string): Promise<InjectiveExecuteResponse>;
|
|
6978
7122
|
setConnection(senderAddress: string, connection: string): Promise<InjectiveExecuteResponse>;
|
|
6979
7123
|
setOwner(senderAddress: string, owner: string): Promise<InjectiveExecuteResponse>;
|
|
6980
|
-
send_message<R extends boolean = false>(sender: string, dst_chain_id: string, dst_address: Hex, payload: Hex, raw?: R): PromiseInjectiveTxReturnType<R>;
|
|
6981
7124
|
static stringToUint8Array(str: string): Uint8Array;
|
|
6982
7125
|
static uint8ArrayToString(arr: Uint8Array): string;
|
|
6983
7126
|
static toBigIntString(num: number | bigint): string;
|
|
6984
7127
|
}
|
|
6985
7128
|
|
|
7129
|
+
declare const DEFAULT_MAX_RETRY = 3;
|
|
7130
|
+
declare const DEFAULT_RELAY_TX_TIMEOUT = 120000;
|
|
7131
|
+
declare const DEFAULT_RETRY_DELAY_MS = 2000;
|
|
7132
|
+
declare const ICON_TX_RESULT_WAIT_MAX_RETRY = 10;
|
|
7133
|
+
declare const MAX_UINT256: bigint;
|
|
7134
|
+
declare const FEE_PERCENTAGE_SCALE = 10000n;
|
|
7135
|
+
declare const STELLAR_PRIORITY_FEE = "10000";
|
|
7136
|
+
declare const STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = 100;
|
|
7137
|
+
declare const DEFAULT_DEADLINE_OFFSET = 300n;
|
|
7138
|
+
declare const DEFAULT_BACKEND_API_ENDPOINT = "https://api.sodax.com/v1/be";
|
|
7139
|
+
declare const DEFAULT_BACKEND_API_TIMEOUT = 30000;
|
|
7140
|
+
declare const DEFAULT_BACKEND_API_HEADERS: {
|
|
7141
|
+
'Content-Type': string;
|
|
7142
|
+
Accept: string;
|
|
7143
|
+
};
|
|
7144
|
+
declare const DEFAULT_RELAYER_API_ENDPOINT = "https://xcall-relay.nw.iconblockchain.xyz";
|
|
7145
|
+
declare const VAULT_TOKEN_DECIMALS = 18;
|
|
7146
|
+
declare const hyper: {
|
|
7147
|
+
blockExplorers: {
|
|
7148
|
+
readonly default: {
|
|
7149
|
+
readonly name: "HyperEVMScan";
|
|
7150
|
+
readonly url: "https://hyperevmscan.io/";
|
|
7151
|
+
};
|
|
7152
|
+
};
|
|
7153
|
+
contracts: {
|
|
7154
|
+
readonly multicall3: {
|
|
7155
|
+
readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
7156
|
+
readonly blockCreated: 13051;
|
|
7157
|
+
};
|
|
7158
|
+
};
|
|
7159
|
+
ensTlds?: readonly string[] | undefined;
|
|
7160
|
+
id: 999;
|
|
7161
|
+
name: "HyperEVM";
|
|
7162
|
+
nativeCurrency: {
|
|
7163
|
+
readonly decimals: 18;
|
|
7164
|
+
readonly name: "HYPE";
|
|
7165
|
+
readonly symbol: "HYPE";
|
|
7166
|
+
};
|
|
7167
|
+
rpcUrls: {
|
|
7168
|
+
readonly default: {
|
|
7169
|
+
readonly http: readonly ["https://rpc.hyperliquid.xyz/evm"];
|
|
7170
|
+
};
|
|
7171
|
+
};
|
|
7172
|
+
sourceId?: number | undefined;
|
|
7173
|
+
testnet?: boolean | undefined;
|
|
7174
|
+
custom?: Record<string, unknown> | undefined;
|
|
7175
|
+
fees?: viem.ChainFees<undefined> | undefined;
|
|
7176
|
+
formatters?: undefined;
|
|
7177
|
+
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
7178
|
+
};
|
|
7179
|
+
declare function getEvmViemChain(id: EvmChainId): Chain;
|
|
7180
|
+
declare const bnUSDLegacySpokeChainIds: readonly ["0x1.icon", "sui", "stellar"];
|
|
7181
|
+
declare const newbnUSDSpokeChainIds: ("0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "sonic" | "0xa.optimism" | "0x89.polygon" | "hyper" | "lightlink" | "ethereum" | "sui" | "stellar" | "injective-1" | "solana")[];
|
|
7182
|
+
declare const bnUSDLegacyTokens: readonly [{
|
|
7183
|
+
readonly symbol: "bnUSD (legacy)";
|
|
7184
|
+
readonly name: "bnUSD";
|
|
7185
|
+
readonly decimals: 18;
|
|
7186
|
+
readonly address: "cx88fd7df7ddff82f7cc735c871dc519838cb235bb";
|
|
7187
|
+
readonly xChainId: "0x1.icon";
|
|
7188
|
+
}, {
|
|
7189
|
+
readonly symbol: "bnUSD (legacy)";
|
|
7190
|
+
readonly name: "legacybnUSD";
|
|
7191
|
+
readonly decimals: 9;
|
|
7192
|
+
readonly address: "0x03917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR";
|
|
7193
|
+
readonly xChainId: "sui";
|
|
7194
|
+
}, {
|
|
7195
|
+
readonly symbol: "bnUSD (legacy)";
|
|
7196
|
+
readonly name: "legacybnUSD";
|
|
7197
|
+
readonly decimals: 18;
|
|
7198
|
+
readonly address: "CCT4ZYIYZ3TUO2AWQFEOFGBZ6HQP3GW5TA37CK7CRZVFRDXYTHTYX7KP";
|
|
7199
|
+
readonly xChainId: "stellar";
|
|
7200
|
+
}];
|
|
7201
|
+
declare const bnUSDNewTokens: ({
|
|
7202
|
+
readonly symbol: "bnUSD";
|
|
7203
|
+
readonly name: "bnUSD";
|
|
7204
|
+
readonly decimals: 9;
|
|
7205
|
+
readonly address: "0xff4de2b2b57dd7611d2812d231a467d007b702a101fd5c7ad3b278257cddb507::bnusd::BNUSD";
|
|
7206
|
+
readonly xChainId: "sui";
|
|
7207
|
+
} | {
|
|
7208
|
+
readonly symbol: "bnUSD";
|
|
7209
|
+
readonly name: "bnUSD";
|
|
7210
|
+
readonly decimals: 7;
|
|
7211
|
+
readonly address: "CD6YBFFWMU2UJHX2NGRJ7RN76IJVTCC7MRA46DUBXNB7E6W7H7JRJ2CX";
|
|
7212
|
+
readonly xChainId: "stellar";
|
|
7213
|
+
} | {
|
|
7214
|
+
readonly symbol: "bnUSD";
|
|
7215
|
+
readonly name: "bnUSD";
|
|
7216
|
+
readonly decimals: 18;
|
|
7217
|
+
readonly address: "0x6958a4CBFe11406E2a1c1d3a71A1971aD8B3b92F";
|
|
7218
|
+
readonly xChainId: "0xa86a.avax";
|
|
7219
|
+
} | {
|
|
7220
|
+
readonly symbol: "bnUSD";
|
|
7221
|
+
readonly name: "bnUSD";
|
|
7222
|
+
readonly decimals: 18;
|
|
7223
|
+
readonly address: "0xA256dd181C3f6E5eC68C6869f5D50a712d47212e";
|
|
7224
|
+
readonly xChainId: "0xa4b1.arbitrum";
|
|
7225
|
+
} | {
|
|
7226
|
+
readonly symbol: "bnUSD";
|
|
7227
|
+
readonly name: "bnUSD";
|
|
7228
|
+
readonly decimals: 18;
|
|
7229
|
+
readonly address: "0xAcfab3F31C0a18559D78556BBf297EC29c6cf8aa";
|
|
7230
|
+
readonly xChainId: "0x2105.base";
|
|
7231
|
+
} | {
|
|
7232
|
+
readonly symbol: "bnUSD";
|
|
7233
|
+
readonly name: "bnUSD";
|
|
7234
|
+
readonly decimals: 18;
|
|
7235
|
+
readonly address: "0x8428FedC020737a5A2291F46cB1B80613eD71638";
|
|
7236
|
+
readonly xChainId: "0x38.bsc";
|
|
7237
|
+
} | {
|
|
7238
|
+
readonly symbol: "bnUSD";
|
|
7239
|
+
readonly name: "Balanced Dollar";
|
|
7240
|
+
readonly decimals: 18;
|
|
7241
|
+
readonly address: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131";
|
|
7242
|
+
readonly xChainId: "sonic";
|
|
7243
|
+
} | {
|
|
7244
|
+
readonly symbol: "bnUSD";
|
|
7245
|
+
readonly name: "bnUSD";
|
|
7246
|
+
readonly decimals: 18;
|
|
7247
|
+
readonly address: "0xF4f7dC27c17470a26d0de9039Cf0EA5045F100E8";
|
|
7248
|
+
readonly xChainId: "0xa.optimism";
|
|
7249
|
+
} | {
|
|
7250
|
+
readonly symbol: "bnUSD";
|
|
7251
|
+
readonly name: "bnUSD";
|
|
7252
|
+
readonly decimals: 18;
|
|
7253
|
+
readonly address: "0x39E77f86C1B1f3fbAb362A82b49D2E86C09659B4";
|
|
7254
|
+
readonly xChainId: "0x89.polygon";
|
|
7255
|
+
} | {
|
|
7256
|
+
readonly symbol: "bnUSD";
|
|
7257
|
+
readonly name: "bnUSD";
|
|
7258
|
+
readonly decimals: 18;
|
|
7259
|
+
readonly address: "0x506Ba7C8d91dAdf7a91eE677a205D9687b751579";
|
|
7260
|
+
readonly xChainId: "hyper";
|
|
7261
|
+
} | {
|
|
7262
|
+
readonly symbol: "bnUSD";
|
|
7263
|
+
readonly name: "bnUSD";
|
|
7264
|
+
readonly decimals: 18;
|
|
7265
|
+
readonly address: "0x36134A03dcD03Bbe858B8F7ED28a71AAC608F9E7";
|
|
7266
|
+
readonly xChainId: "lightlink";
|
|
7267
|
+
} | {
|
|
7268
|
+
readonly symbol: "bnUSD";
|
|
7269
|
+
readonly name: "bnUSD";
|
|
7270
|
+
readonly decimals: 18;
|
|
7271
|
+
readonly address: "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13";
|
|
7272
|
+
readonly xChainId: "ethereum";
|
|
7273
|
+
} | {
|
|
7274
|
+
readonly symbol: "bnUSD";
|
|
7275
|
+
readonly name: "bnUSD";
|
|
7276
|
+
readonly decimals: 18;
|
|
7277
|
+
readonly address: "factory/inj1d036ftaatxpkqsu9hja8r24rv3v33chz3appxp/bnUSD";
|
|
7278
|
+
readonly xChainId: "injective-1";
|
|
7279
|
+
} | {
|
|
7280
|
+
readonly symbol: "bnUSD";
|
|
7281
|
+
readonly name: "bnUSD";
|
|
7282
|
+
readonly decimals: 9;
|
|
7283
|
+
readonly address: "3rSPCLNEF7Quw4wX8S1NyKivELoyij8eYA2gJwBgt4V5";
|
|
7284
|
+
readonly xChainId: "solana";
|
|
7285
|
+
})[];
|
|
7286
|
+
declare const isLegacybnUSDChainId: (chainId: SpokeChainId) => boolean;
|
|
7287
|
+
declare const isNewbnUSDChainId: (chainId: SpokeChainId) => boolean;
|
|
7288
|
+
declare const isLegacybnUSDToken: (token: Token | string) => boolean;
|
|
7289
|
+
declare const isNewbnUSDToken: (token: Token | string) => boolean;
|
|
7290
|
+
declare const getAllLegacybnUSDTokens: () => {
|
|
7291
|
+
token: LegacybnUSDToken;
|
|
7292
|
+
chainId: LegacybnUSDChainId;
|
|
7293
|
+
}[];
|
|
7294
|
+
|
|
6986
7295
|
type EvmDepositToDataParams = {
|
|
6987
7296
|
token: Hex | string;
|
|
6988
7297
|
to: Address$1;
|
|
@@ -7141,7 +7450,7 @@ declare class WalletAbstractionService {
|
|
|
7141
7450
|
* @param hubProvider - The provider for interacting with the hub chain
|
|
7142
7451
|
* @returns The user's hub wallet address
|
|
7143
7452
|
*/
|
|
7144
|
-
static getUserAbstractedWalletAddress(address: string, spokeProvider:
|
|
7453
|
+
static getUserAbstractedWalletAddress(address: string, spokeProvider: SpokeProviderType, hubProvider: EvmHubProvider): Promise<Address>;
|
|
7145
7454
|
}
|
|
7146
7455
|
|
|
7147
7456
|
type EvmSpokeDepositParams = {
|
|
@@ -7160,7 +7469,7 @@ declare class EvmSpokeService {
|
|
|
7160
7469
|
* - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
|
|
7161
7470
|
*
|
|
7162
7471
|
* @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
|
|
7163
|
-
* @param {
|
|
7472
|
+
* @param {EvmSpokeProviderType} spokeProvider - The EVM spoke provider.
|
|
7164
7473
|
* @returns {Promise<bigint>} Estimated gas for the transaction.
|
|
7165
7474
|
*
|
|
7166
7475
|
* @example
|
|
@@ -7176,40 +7485,40 @@ declare class EvmSpokeService {
|
|
|
7176
7485
|
* const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
|
|
7177
7486
|
* console.log(`Estimated gas: ${estimatedGas}`);
|
|
7178
7487
|
*/
|
|
7179
|
-
static estimateGas(rawTx: EvmRawTransaction, spokeProvider:
|
|
7488
|
+
static estimateGas(rawTx: EvmRawTransaction, spokeProvider: EvmSpokeProviderType): Promise<bigint>;
|
|
7180
7489
|
/**
|
|
7181
7490
|
* Deposit tokens to the spoke chain.
|
|
7182
7491
|
* @param {EvmSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
7183
|
-
* @param {
|
|
7492
|
+
* @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7184
7493
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
7185
|
-
* @returns {
|
|
7494
|
+
* @returns {Promise<TxReturnType<EvmSpokeProviderType, R>>} A promise that resolves to the transaction hash.
|
|
7186
7495
|
*/
|
|
7187
|
-
static deposit<R extends boolean = false>(params: EvmSpokeDepositParams, spokeProvider:
|
|
7496
|
+
static deposit<R extends boolean = false>(params: EvmSpokeDepositParams, spokeProvider: EvmSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<EvmSpokeProviderType, R>>;
|
|
7188
7497
|
/**
|
|
7189
7498
|
* Get the balance of the token in the spoke chain.
|
|
7190
7499
|
* @param {Address} token - The address of the token to get the balance of.
|
|
7191
|
-
* @param {
|
|
7500
|
+
* @param {EvmSpokeProviderType} spokeProvider - The spoke provider.
|
|
7192
7501
|
* @returns {Promise<bigint>} The balance of the token.
|
|
7193
7502
|
*/
|
|
7194
|
-
static getDeposit(token: Address$1, spokeProvider:
|
|
7503
|
+
static getDeposit(token: Address$1, spokeProvider: EvmSpokeProviderType): Promise<bigint>;
|
|
7195
7504
|
/**
|
|
7196
7505
|
* Generate simulation parameters for deposit from EvmSpokeDepositParams.
|
|
7197
7506
|
* @param {EvmSpokeDepositParams} params - The deposit parameters.
|
|
7198
|
-
* @param {
|
|
7507
|
+
* @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7199
7508
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
7200
7509
|
* @returns {Promise<DepositSimulationParams>} The simulation parameters.
|
|
7201
7510
|
*/
|
|
7202
|
-
static getSimulateDepositParams(params: EvmSpokeDepositParams, spokeProvider:
|
|
7511
|
+
static getSimulateDepositParams(params: EvmSpokeDepositParams, spokeProvider: EvmSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
|
|
7203
7512
|
/**
|
|
7204
7513
|
* Calls a contract on the spoke chain using the user's wallet.
|
|
7205
7514
|
* @param {HubAddress} from - The address of the user on the hub chain.
|
|
7206
7515
|
* @param {Hex} payload - The payload to send to the contract.
|
|
7207
|
-
* @param {
|
|
7516
|
+
* @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7208
7517
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
7209
7518
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
7210
|
-
* @returns {
|
|
7519
|
+
* @returns {Promise<TxReturnType<EvmSpokeProviderType, R>>} A promise that resolves to the transaction hash.
|
|
7211
7520
|
*/
|
|
7212
|
-
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider:
|
|
7521
|
+
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider: EvmSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<EvmSpokeProviderType, R>>;
|
|
7213
7522
|
/**
|
|
7214
7523
|
* Transfers tokens to the hub chain.
|
|
7215
7524
|
* @param {EvmTransferToHubParams} params - The parameters for the transfer, including:
|
|
@@ -7217,9 +7526,9 @@ declare class EvmSpokeService {
|
|
|
7217
7526
|
* - {Address} recipient: The recipient address on the hub chain.
|
|
7218
7527
|
* - {bigint} amount: The amount to transfer.
|
|
7219
7528
|
* - {Hex} [data="0x"]: Additional data for the transfer.
|
|
7220
|
-
* @param {
|
|
7529
|
+
* @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7221
7530
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
7222
|
-
* @returns {
|
|
7531
|
+
* @returns {Promise<TxReturnType<EvmSpokeProviderType, R>>} A promise that resolves to the transaction hash.
|
|
7223
7532
|
*/
|
|
7224
7533
|
private static transfer;
|
|
7225
7534
|
/**
|
|
@@ -7227,9 +7536,9 @@ declare class EvmSpokeService {
|
|
|
7227
7536
|
* @param {bigint} dstChainId - The chain ID of the hub chain.
|
|
7228
7537
|
* @param {Address} dstAddress - The address on the hub chain.
|
|
7229
7538
|
* @param {Hex} payload - The payload to send.
|
|
7230
|
-
* @param {
|
|
7539
|
+
* @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7231
7540
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
7232
|
-
* @returns {
|
|
7541
|
+
* @returns {Promise<TxReturnType<EvmSpokeProviderType, R>>} A promise that resolves to the transaction hash.
|
|
7233
7542
|
*/
|
|
7234
7543
|
private static call;
|
|
7235
7544
|
}
|
|
@@ -7246,7 +7555,7 @@ declare class SpokeService {
|
|
|
7246
7555
|
* @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
7247
7556
|
* @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
|
|
7248
7557
|
*/
|
|
7249
|
-
static estimateGas<T extends
|
|
7558
|
+
static estimateGas<T extends SpokeProviderType>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
|
|
7250
7559
|
/**
|
|
7251
7560
|
|
|
7252
7561
|
* Encodes transfer data using RLP encoding to match Solidity Transfer struct.
|
|
@@ -7282,28 +7591,28 @@ declare class SpokeService {
|
|
|
7282
7591
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
7283
7592
|
* @param {boolean} raw - Whether to return raw transaction data.
|
|
7284
7593
|
* @param {boolean} skipSimulation - Whether to skip deposit simulation (optional, defaults to false).
|
|
7285
|
-
* @returns {Promise<
|
|
7594
|
+
* @returns {Promise<TxReturnType<T, R>>} A promise that resolves to the transaction hash.
|
|
7286
7595
|
*/
|
|
7287
|
-
static deposit<
|
|
7288
|
-
static getSimulateDepositParams<S extends
|
|
7289
|
-
static verifyDepositSimulation<S extends
|
|
7596
|
+
static deposit<S extends SpokeProviderType, R extends boolean = false>(params: GetSpokeDepositParamsType<S>, spokeProvider: S, hubProvider: EvmHubProvider, raw?: R, skipSimulation?: boolean): Promise<TxReturnType<S, R>>;
|
|
7597
|
+
static getSimulateDepositParams<S extends SpokeProviderType>(params: GetSpokeDepositParamsType<S>, spokeProvider: S, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
|
|
7598
|
+
static verifyDepositSimulation<S extends SpokeProviderType>(params: GetSpokeDepositParamsType<S>, spokeProvider: S, hubProvider: EvmHubProvider, skipSimulation: boolean): Promise<void>;
|
|
7290
7599
|
/**
|
|
7291
7600
|
* Get the balance of the token in the spoke chain.
|
|
7292
7601
|
* @param {Address} token - The address of the token to get the balance of.
|
|
7293
|
-
* @param {
|
|
7602
|
+
* @param {SpokeProviderType} spokeProvider - The spoke provider.
|
|
7294
7603
|
* @returns {Promise<bigint>} The balance of the token.
|
|
7295
7604
|
*/
|
|
7296
|
-
static getDeposit(token: Address, spokeProvider:
|
|
7605
|
+
static getDeposit(token: Address, spokeProvider: SpokeProviderType): Promise<bigint>;
|
|
7297
7606
|
/**
|
|
7298
|
-
* Calls
|
|
7607
|
+
* Calls the connection contract on the spoke chain to send a message to the hub wallet, which then executes the message's payload.
|
|
7299
7608
|
* @param {HubAddress} from - The address of the user on the hub chain.
|
|
7300
7609
|
* @param {Hex} payload - The payload to send to the contract.
|
|
7301
|
-
* @param {
|
|
7610
|
+
* @param {SpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7302
7611
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
7303
7612
|
* @returns {Promise<Hash>} A promise that resolves to the transaction hash.
|
|
7304
7613
|
*/
|
|
7305
|
-
static callWallet<T extends
|
|
7306
|
-
static verifySimulation(from: HubAddress, payload: Hex$1, spokeProvider:
|
|
7614
|
+
static callWallet<T extends SpokeProviderType, R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider: T, hubProvider: EvmHubProvider, raw?: R, skipSimulation?: boolean): Promise<TxReturnType<T, R>>;
|
|
7615
|
+
static verifySimulation(from: HubAddress, payload: Hex$1, spokeProvider: SpokeProviderType, hubProvider: EvmHubProvider, skipSimulation: boolean): Promise<void>;
|
|
7307
7616
|
/**
|
|
7308
7617
|
* Verifies the transaction hash for the spoke chain to exist on chain.
|
|
7309
7618
|
* Only stellar and solana need to be verified. For other chains, we assume the transaction exists on chain.
|
|
@@ -7329,41 +7638,41 @@ type IconTransferToHubParams = {
|
|
|
7329
7638
|
};
|
|
7330
7639
|
declare class IconSpokeService {
|
|
7331
7640
|
private constructor();
|
|
7332
|
-
static estimateGas(rawTx: IconRawTransaction, spokeProvider:
|
|
7641
|
+
static estimateGas(rawTx: IconRawTransaction, spokeProvider: IconSpokeProviderType): Promise<IconGasEstimate>;
|
|
7333
7642
|
/**
|
|
7334
7643
|
* Deposit tokens to the spoke chain.
|
|
7335
7644
|
* @param {IconSpokeDepositParams} params - The parameters for the deposit
|
|
7336
|
-
* @param {
|
|
7645
|
+
* @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain
|
|
7337
7646
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain
|
|
7338
7647
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
7339
7648
|
* @returns {Promise<Result<string>>} A promise that resolves to the transaction hash
|
|
7340
7649
|
*/
|
|
7341
|
-
static deposit<R extends boolean = false>(params: IconSpokeDepositParams, spokeProvider:
|
|
7650
|
+
static deposit<R extends boolean = false>(params: IconSpokeDepositParams, spokeProvider: IconSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<IconSpokeProviderType, R>>;
|
|
7342
7651
|
/**
|
|
7343
7652
|
* Get the balance of the token in the spoke chain.
|
|
7344
7653
|
* @param {string} token - The address of the token to get the balance of
|
|
7345
|
-
* @param {
|
|
7654
|
+
* @param {IconSpokeProviderType} spokeProvider - The spoke provider
|
|
7346
7655
|
* @returns {Promise<bigint>} The balance of the token
|
|
7347
7656
|
*/
|
|
7348
|
-
static getDeposit(token: string, spokeProvider:
|
|
7657
|
+
static getDeposit(token: string, spokeProvider: IconSpokeProviderType): Promise<bigint>;
|
|
7349
7658
|
/**
|
|
7350
7659
|
* Calls a contract on the spoke chain using the user's wallet.
|
|
7351
7660
|
* @param {HubAddress} from - The address of the user on the hub chain
|
|
7352
7661
|
* @param {Hex} payload - The payload to send to the contract
|
|
7353
|
-
* @param {
|
|
7662
|
+
* @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain
|
|
7354
7663
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain
|
|
7355
7664
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
7356
7665
|
* @returns {Promise<Result<string>>} A promise that resolves to the transaction hash
|
|
7357
7666
|
*/
|
|
7358
|
-
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider:
|
|
7667
|
+
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: IconSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<IconSpokeProviderType, R>>;
|
|
7359
7668
|
/**
|
|
7360
7669
|
* Generate simulation parameters for deposit from IconSpokeDepositParams.
|
|
7361
7670
|
* @param {IconSpokeDepositParams} params - The deposit parameters.
|
|
7362
|
-
* @param {
|
|
7671
|
+
* @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7363
7672
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
7364
7673
|
* @returns {Promise<DepositSimulationParams>} The simulation parameters.
|
|
7365
7674
|
*/
|
|
7366
|
-
static getSimulateDepositParams(params: IconSpokeDepositParams, spokeProvider:
|
|
7675
|
+
static getSimulateDepositParams(params: IconSpokeDepositParams, spokeProvider: IconSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
|
|
7367
7676
|
/**
|
|
7368
7677
|
* Transfers tokens to the hub chain.
|
|
7369
7678
|
*/
|
|
@@ -7400,43 +7709,43 @@ declare class InjectiveSpokeService {
|
|
|
7400
7709
|
/**
|
|
7401
7710
|
* Estimate the gas for a transaction.
|
|
7402
7711
|
* @param {InjectiveRawTransaction} rawTx - The raw transaction to estimate the gas for.
|
|
7403
|
-
* @param {
|
|
7712
|
+
* @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7404
7713
|
* @returns {Promise<InjectiveGasEstimate>} The estimated gas for the transaction.
|
|
7405
7714
|
*/
|
|
7406
|
-
static estimateGas(rawTx: InjectiveRawTransaction, spokeProvider:
|
|
7715
|
+
static estimateGas(rawTx: InjectiveRawTransaction, spokeProvider: InjectiveSpokeProviderType): Promise<InjectiveGasEstimate>;
|
|
7407
7716
|
/**
|
|
7408
7717
|
* Deposit tokens to the spoke chain.
|
|
7409
7718
|
* @param {InjectiveSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
7410
|
-
* @param {
|
|
7719
|
+
* @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7411
7720
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
7412
7721
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
7413
|
-
* @returns {
|
|
7722
|
+
* @returns {Promise<TxReturnType<InjectiveSpokeProviderType, R>>} A promise that resolves to the transaction hash.
|
|
7414
7723
|
*/
|
|
7415
|
-
static deposit<R extends boolean = false>(params: InjectiveSpokeDepositParams, spokeProvider:
|
|
7724
|
+
static deposit<R extends boolean = false>(params: InjectiveSpokeDepositParams, spokeProvider: InjectiveSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<InjectiveSpokeProviderType, R>>;
|
|
7416
7725
|
/**
|
|
7417
7726
|
* Generate simulation parameters for deposit from InjectiveSpokeDepositParams.
|
|
7418
7727
|
* @param {InjectiveSpokeDepositParams} params - The deposit parameters.
|
|
7419
|
-
* @param {
|
|
7728
|
+
* @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7420
7729
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
7421
7730
|
* @returns {Promise<DepositSimulationParams>} The simulation parameters.
|
|
7422
7731
|
*/
|
|
7423
|
-
static getSimulateDepositParams(params: InjectiveSpokeDepositParams, spokeProvider:
|
|
7732
|
+
static getSimulateDepositParams(params: InjectiveSpokeDepositParams, spokeProvider: InjectiveSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
|
|
7424
7733
|
/**
|
|
7425
7734
|
* Get the balance of the token that deposited in the spoke chain Asset Manager.
|
|
7426
7735
|
* @param {Address} token - The address of the token to get the balance of.
|
|
7427
|
-
* @param {
|
|
7736
|
+
* @param {InjectiveSpokeProviderType} spokeProvider - The spoke provider.
|
|
7428
7737
|
* @returns {Promise<bigint>} The balance of the token.
|
|
7429
7738
|
*/
|
|
7430
|
-
static getDeposit(token: String, spokeProvider:
|
|
7739
|
+
static getDeposit(token: String, spokeProvider: InjectiveSpokeProviderType): Promise<bigint>;
|
|
7431
7740
|
/**
|
|
7432
7741
|
* Calls a contract on the spoke chain using the user's wallet.
|
|
7433
7742
|
* @param {HubAddress} from - The address of the user on the hub chain.
|
|
7434
7743
|
* @param {Hex} payload - The payload to send to the contract.
|
|
7435
|
-
* @param {
|
|
7744
|
+
* @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7436
7745
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
7437
|
-
* @returns {
|
|
7746
|
+
* @returns {Promise<TxReturnType<InjectiveSpokeProviderType, R>>} A promise that resolves to the transaction hash.
|
|
7438
7747
|
*/
|
|
7439
|
-
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider:
|
|
7748
|
+
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: InjectiveSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<InjectiveSpokeProviderType, R>>;
|
|
7440
7749
|
/**
|
|
7441
7750
|
* Transfers tokens to the hub chain.
|
|
7442
7751
|
* @param {InjectiveTransferToHubParams} params - The parameters for the transfer, including:
|
|
@@ -7444,9 +7753,9 @@ declare class InjectiveSpokeService {
|
|
|
7444
7753
|
* - {Uint8Array} recipient: The recipient address on the hub chain.
|
|
7445
7754
|
* - {string} amount: The amount to transfer.
|
|
7446
7755
|
* - {Uint8Array} [data=new Uint8Array([])]: Additional data for the transfer.
|
|
7447
|
-
* @param {
|
|
7756
|
+
* @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7448
7757
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
7449
|
-
* @returns {
|
|
7758
|
+
* @returns {Promise<TxReturnType<InjectiveSpokeProviderType, R>>} A promise that resolves to the transaction hash.
|
|
7450
7759
|
*/
|
|
7451
7760
|
private static transfer;
|
|
7452
7761
|
/**
|
|
@@ -7454,8 +7763,8 @@ declare class InjectiveSpokeService {
|
|
|
7454
7763
|
* @param {bigint} dstChainId - The chain ID of the hub chain.
|
|
7455
7764
|
* @param {Address} dstAddress - The address on the hub chain.
|
|
7456
7765
|
* @param {Hex} payload - The payload to send.
|
|
7457
|
-
* @param {
|
|
7458
|
-
* @returns {
|
|
7766
|
+
* @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7767
|
+
* @returns {Promise<TxReturnType<InjectiveSpokeProviderType, R>>} A promise that resolves to the transaction hash.
|
|
7459
7768
|
*/
|
|
7460
7769
|
private static call;
|
|
7461
7770
|
}
|
|
@@ -7478,12 +7787,12 @@ declare class SolanaSpokeService {
|
|
|
7478
7787
|
/**
|
|
7479
7788
|
* Estimate the gas for a transaction.
|
|
7480
7789
|
* @param {SolanaRawTransaction} rawTx - The raw transaction to estimate the gas for.
|
|
7481
|
-
* @param {
|
|
7790
|
+
* @param {SolanaSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7482
7791
|
* @returns {Promise<number | undefined>} The units consumed for the transaction.
|
|
7483
7792
|
*/
|
|
7484
|
-
static estimateGas(rawTx: SolanaRawTransaction, spokeProvider:
|
|
7485
|
-
static deposit<R extends boolean = false>(params: SolanaSpokeDepositParams, spokeProvider:
|
|
7486
|
-
static getDeposit(token: string, spokeProvider:
|
|
7793
|
+
static estimateGas(rawTx: SolanaRawTransaction, spokeProvider: SolanaSpokeProviderType): Promise<SolanaGasEstimate>;
|
|
7794
|
+
static deposit<R extends boolean = false>(params: SolanaSpokeDepositParams, spokeProvider: SolanaSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<SolanaSpokeProviderType, R>>;
|
|
7795
|
+
static getDeposit(token: string, spokeProvider: SolanaSpokeProviderType): Promise<bigint>;
|
|
7487
7796
|
/**
|
|
7488
7797
|
* Calls a contract on the spoke chain using the user's wallet.
|
|
7489
7798
|
* @param from - The address of the user on the hub chain.
|
|
@@ -7493,15 +7802,15 @@ declare class SolanaSpokeService {
|
|
|
7493
7802
|
* @param raw - Whether to return the raw transaction data.
|
|
7494
7803
|
* @returns The transaction result.
|
|
7495
7804
|
*/
|
|
7496
|
-
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider:
|
|
7805
|
+
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: SolanaSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<SolanaSpokeProviderType, R>>;
|
|
7497
7806
|
/**
|
|
7498
7807
|
* Generate simulation parameters for deposit from SolanaSpokeDepositParams.
|
|
7499
7808
|
* @param {SolanaSpokeDepositParams} params - The deposit parameters.
|
|
7500
|
-
* @param {
|
|
7809
|
+
* @param {SolanaSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
7501
7810
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
7502
7811
|
* @returns {Promise<DepositSimulationParams>} The simulation parameters.
|
|
7503
7812
|
*/
|
|
7504
|
-
static getSimulateDepositParams(params: SolanaSpokeDepositParams, spokeProvider:
|
|
7813
|
+
static getSimulateDepositParams(params: SolanaSpokeDepositParams, spokeProvider: SolanaSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
|
|
7505
7814
|
private static transfer;
|
|
7506
7815
|
/**
|
|
7507
7816
|
* Sends a message to the hub chain.
|
|
@@ -7719,9 +8028,135 @@ declare class SolverApiService {
|
|
|
7719
8028
|
static getStatus(request: SolverIntentStatusRequest, config: SolverConfig): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
|
|
7720
8029
|
}
|
|
7721
8030
|
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
8031
|
+
/**
|
|
8032
|
+
* The action type for the intent relay service.
|
|
8033
|
+
* submit - submit a transaction to the intent relay service
|
|
8034
|
+
* get_transaction_packets - get transaction packets from the intent relay service
|
|
8035
|
+
* get_packet - get a packet from the intent relay service
|
|
8036
|
+
*/
|
|
8037
|
+
type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
|
|
8038
|
+
/**
|
|
8039
|
+
* The status of the relay transaction.
|
|
8040
|
+
* pending - no signatures
|
|
8041
|
+
* validating - not enough signatures
|
|
8042
|
+
* executing - enough signatures,no confirmed txn-hash
|
|
8043
|
+
* executed - has confirmed transaction-hash
|
|
8044
|
+
*/
|
|
8045
|
+
type RelayTxStatus = 'pending' | 'validating' | 'executing' | 'executed';
|
|
8046
|
+
type RelayErrorCode = 'SUBMIT_TX_FAILED' | 'RELAY_TIMEOUT';
|
|
8047
|
+
type RelayError = {
|
|
8048
|
+
code: RelayErrorCode;
|
|
8049
|
+
error: unknown;
|
|
8050
|
+
};
|
|
8051
|
+
type SubmitTxParams = {
|
|
8052
|
+
chain_id: string;
|
|
8053
|
+
tx_hash: string;
|
|
8054
|
+
data?: {
|
|
8055
|
+
address: Hex;
|
|
8056
|
+
payload: Hex;
|
|
8057
|
+
};
|
|
8058
|
+
};
|
|
8059
|
+
type GetTransactionPacketsParams = {
|
|
8060
|
+
chain_id: string;
|
|
8061
|
+
tx_hash: string;
|
|
8062
|
+
};
|
|
8063
|
+
type GetPacketParams = {
|
|
8064
|
+
chain_id: string;
|
|
8065
|
+
tx_hash: string;
|
|
8066
|
+
conn_sn: string;
|
|
8067
|
+
};
|
|
8068
|
+
type SubmitTxResponse = {
|
|
8069
|
+
success: boolean;
|
|
8070
|
+
message: string;
|
|
8071
|
+
};
|
|
8072
|
+
type PacketData = {
|
|
8073
|
+
src_chain_id: number;
|
|
8074
|
+
src_tx_hash: string;
|
|
8075
|
+
src_address: string;
|
|
8076
|
+
status: RelayTxStatus;
|
|
8077
|
+
dst_chain_id: number;
|
|
8078
|
+
conn_sn: number;
|
|
8079
|
+
dst_address: string;
|
|
8080
|
+
dst_tx_hash: string;
|
|
8081
|
+
signatures: string[];
|
|
8082
|
+
payload: string;
|
|
8083
|
+
};
|
|
8084
|
+
type IntentDeliveryInfo = {
|
|
8085
|
+
srcChainId: SpokeChainId;
|
|
8086
|
+
srcTxHash: string;
|
|
8087
|
+
srcAddress: string;
|
|
8088
|
+
dstChainId: SpokeChainId;
|
|
8089
|
+
dstTxHash: string;
|
|
8090
|
+
dstAddress: string;
|
|
8091
|
+
};
|
|
8092
|
+
type GetTransactionPacketsResponse = {
|
|
8093
|
+
success: boolean;
|
|
8094
|
+
data: PacketData[];
|
|
8095
|
+
};
|
|
8096
|
+
type GetPacketResponse = {
|
|
8097
|
+
success: true;
|
|
8098
|
+
data: PacketData;
|
|
8099
|
+
} | {
|
|
8100
|
+
success: false;
|
|
8101
|
+
message: string;
|
|
8102
|
+
};
|
|
8103
|
+
type GetRelayRequestParamType<T extends RelayAction> = T extends 'submit' ? SubmitTxParams : T extends 'get_transaction_packets' ? GetTransactionPacketsParams : T extends 'get_packet' ? GetPacketParams : never;
|
|
8104
|
+
type GetRelayResponse<T extends RelayAction> = T extends 'submit' ? SubmitTxResponse : T extends 'get_transaction_packets' ? GetTransactionPacketsResponse : T extends 'get_packet' ? GetPacketResponse : never;
|
|
8105
|
+
type IntentRelayRequestParams = SubmitTxParams | GetTransactionPacketsParams | GetPacketParams;
|
|
8106
|
+
type WaitUntilIntentExecutedPayload = {
|
|
8107
|
+
intentRelayChainId: string;
|
|
8108
|
+
spokeTxHash: string;
|
|
8109
|
+
timeout: number;
|
|
8110
|
+
apiUrl: HttpUrl;
|
|
8111
|
+
};
|
|
8112
|
+
/**
|
|
8113
|
+
* Represents the request payload for submitting a transaction to the intent relay service.
|
|
8114
|
+
* Contains the action type and parameters including chain ID and transaction hash.
|
|
8115
|
+
*/
|
|
8116
|
+
type IntentRelayRequest<T extends RelayAction> = {
|
|
8117
|
+
action: T;
|
|
8118
|
+
params: GetRelayRequestParamType<T>;
|
|
8119
|
+
};
|
|
8120
|
+
/**
|
|
8121
|
+
* Submits a transaction to the intent relay service.
|
|
8122
|
+
* @param payload - The request payload containing the 'submit' action type and parameters.
|
|
8123
|
+
* @param apiUrl - The URL of the intent relay service.
|
|
8124
|
+
* @returns The response from the intent relay service.
|
|
8125
|
+
*/
|
|
8126
|
+
declare function submitTransaction(payload: IntentRelayRequest<'submit'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'submit'>>;
|
|
8127
|
+
/**
|
|
8128
|
+
* Retrieves transaction packets from the intent relay service.
|
|
8129
|
+
* @param payload - The request payload containing the 'get_transaction_packets' action type and parameters.
|
|
8130
|
+
* @param apiUrl - The URL of the intent relay service.
|
|
8131
|
+
* @returns The response from the intent relay service.
|
|
8132
|
+
*/
|
|
8133
|
+
declare function getTransactionPackets(payload: IntentRelayRequest<'get_transaction_packets'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'get_transaction_packets'>>;
|
|
8134
|
+
/**
|
|
8135
|
+
* Retrieves a packet from the intent relay service.
|
|
8136
|
+
* @param payload - The request payload containing the 'get_packet' action type and parameters.
|
|
8137
|
+
* @param apiUrl - The URL of the intent relay service.
|
|
8138
|
+
* @returns The response from the intent relay service.
|
|
8139
|
+
*/
|
|
8140
|
+
declare function getPacket(payload: IntentRelayRequest<'get_packet'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'get_packet'>>;
|
|
8141
|
+
declare function waitUntilIntentExecuted(payload: WaitUntilIntentExecutedPayload): Promise<Result<PacketData, IntentError<'RELAY_TIMEOUT'>>>;
|
|
8142
|
+
/**
|
|
8143
|
+
* Submit the transaction to the Solver API and wait for it to be executed
|
|
8144
|
+
* @param spokeTxHash - The transaction hash to submit.
|
|
8145
|
+
* @param data - The additional data to submit when relaying the transaction on Solana. Due to Solana's 1232 byte transaction
|
|
8146
|
+
* size limit, Solana transactions are split: the on-chain tx contains only a verification hash, while the full
|
|
8147
|
+
* data is submitted off-chain via the relayer. Contains the to address on Hub chain and instruction data.
|
|
8148
|
+
* @param spokeProvider - The spoke provider.
|
|
8149
|
+
* @param timeout - The timeout in milliseconds for the transaction. Default is 20 seconds.
|
|
8150
|
+
* @returns The transaction hash.
|
|
8151
|
+
*/
|
|
8152
|
+
declare function relayTxAndWaitPacket<S extends SpokeProvider>(spokeTxHash: string, data: {
|
|
8153
|
+
address: Hex;
|
|
8154
|
+
payload: Hex;
|
|
8155
|
+
} | undefined, spokeProvider: S, relayerApiEndpoint: HttpUrl, timeout?: number): Promise<Result<PacketData, RelayError>>;
|
|
8156
|
+
|
|
8157
|
+
type CreateIntentParams = {
|
|
8158
|
+
inputToken: string;
|
|
8159
|
+
outputToken: string;
|
|
7725
8160
|
inputAmount: bigint;
|
|
7726
8161
|
minOutputAmount: bigint;
|
|
7727
8162
|
deadline: bigint;
|
|
@@ -7788,7 +8223,7 @@ type IntentError<T extends IntentErrorCode = IntentErrorCode> = {
|
|
|
7788
8223
|
code: T;
|
|
7789
8224
|
data: IntentErrorData<T>;
|
|
7790
8225
|
};
|
|
7791
|
-
type SwapParams<S extends
|
|
8226
|
+
type SwapParams<S extends SpokeProviderType> = Prettify<{
|
|
7792
8227
|
intentParams: CreateIntentParams;
|
|
7793
8228
|
spokeProvider: S;
|
|
7794
8229
|
skipSimulation?: boolean;
|
|
@@ -8035,7 +8470,7 @@ declare class SwapService {
|
|
|
8035
8470
|
* data: '0x', // Additional arbitrary data
|
|
8036
8471
|
* } satisfies CreateIntentParams;
|
|
8037
8472
|
*
|
|
8038
|
-
* const isAllowanceValid = await sodax.
|
|
8473
|
+
* const isAllowanceValid = await sodax.swaps.isAllowanceValid({
|
|
8039
8474
|
* intentParams: createIntentParams,
|
|
8040
8475
|
* spokeProvider: bscSpokeProvider,
|
|
8041
8476
|
* });
|
|
@@ -8048,7 +8483,7 @@ declare class SwapService {
|
|
|
8048
8483
|
* console.log('Approval required');
|
|
8049
8484
|
* }
|
|
8050
8485
|
*/
|
|
8051
|
-
isAllowanceValid<S extends
|
|
8486
|
+
isAllowanceValid<S extends SpokeProviderType>({ intentParams: params, spokeProvider, }: SwapParams<S>): Promise<Result<boolean>>;
|
|
8052
8487
|
/**
|
|
8053
8488
|
* Approve the Asset Manager contract to spend tokens on behalf of the user (required for EVM chains)
|
|
8054
8489
|
* @param {Prettify<SwapParams<S> & OptionalRaw<R>>} params - Object containing:
|
|
@@ -8073,7 +8508,7 @@ declare class SwapService {
|
|
|
8073
8508
|
* data: '0x', // Additional arbitrary data
|
|
8074
8509
|
* } satisfies CreateIntentParams;
|
|
8075
8510
|
*
|
|
8076
|
-
* const approveResult = await sodax.
|
|
8511
|
+
* const approveResult = await sodax.swaps.approve({
|
|
8077
8512
|
* intentParams: createIntentParams,
|
|
8078
8513
|
* spokeProvider: bscSpokeProvider,
|
|
8079
8514
|
* });
|
|
@@ -8087,7 +8522,7 @@ declare class SwapService {
|
|
|
8087
8522
|
* console.log('Approval transaction:', txHash);
|
|
8088
8523
|
* }
|
|
8089
8524
|
*/
|
|
8090
|
-
approve<S extends
|
|
8525
|
+
approve<S extends SpokeProviderType, R extends boolean = false>({ intentParams: params, spokeProvider, raw, }: Prettify<SwapParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>>>;
|
|
8091
8526
|
/**
|
|
8092
8527
|
* Creates an intent by handling token approval and intent creation
|
|
8093
8528
|
* NOTE: This method does not submit the intent to the Solver API
|
|
@@ -8131,15 +8566,15 @@ declare class SwapService {
|
|
|
8131
8566
|
* // handle error
|
|
8132
8567
|
* }
|
|
8133
8568
|
*/
|
|
8134
|
-
createIntent<S extends
|
|
8569
|
+
createIntent<S extends SpokeProviderType, R extends boolean = false>({ intentParams: params, spokeProvider, fee, raw, }: Prettify<SwapParams<S> & OptionalRaw<R>>): Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount, Hex$1], IntentError<'CREATION_FAILED'>>>;
|
|
8135
8570
|
/**
|
|
8136
8571
|
* Cancels an intent
|
|
8137
8572
|
* @param {Intent} intent - The intent to cancel
|
|
8138
|
-
* @param {
|
|
8573
|
+
* @param {SpokeProviderType} spokeProvider - The spoke provider
|
|
8139
8574
|
* @param {boolean} raw - Whether to return the raw transaction
|
|
8140
8575
|
* @returns {Promise<TxReturnType<S, R>>} The encoded contract call
|
|
8141
8576
|
*/
|
|
8142
|
-
cancelIntent<S extends
|
|
8577
|
+
cancelIntent<S extends SpokeProviderType, R extends boolean = false>(intent: Intent, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>>>;
|
|
8143
8578
|
/**
|
|
8144
8579
|
* Gets an intent from a transaction hash (on Hub chain)
|
|
8145
8580
|
* @param {Hash} txHash - The transaction hash on Hub chain
|
|
@@ -8152,6 +8587,19 @@ declare class SwapService {
|
|
|
8152
8587
|
* @returns {Promise<IntentState>} The intent state
|
|
8153
8588
|
*/
|
|
8154
8589
|
getFilledIntent(txHash: Hash$1): Promise<IntentState>;
|
|
8590
|
+
/**
|
|
8591
|
+
* Get the intent delivery info about solved intent from the Relayer API.
|
|
8592
|
+
* Packet data contains info about the intent execution on the destination chain.
|
|
8593
|
+
* @param {SpokeChainId} chainId - The destination spoke chain ID
|
|
8594
|
+
* @param {string} fillTxHash - The fill transaction hash (received from getStatus when status is 3 - SOLVED)
|
|
8595
|
+
* @param {number} timeout - The timeout in milliseconds (default: 120 seconds)
|
|
8596
|
+
* @returns {Promise<Result<PacketData, IntentError<'RELAY_TIMEOUT'>>>} A Result containing either the packet data or an IntentError with code 'RELAY_TIMEOUT'
|
|
8597
|
+
*/
|
|
8598
|
+
getSolvedIntentPacket({ chainId, fillTxHash, timeout, }: {
|
|
8599
|
+
chainId: SpokeChainId;
|
|
8600
|
+
fillTxHash: string;
|
|
8601
|
+
timeout?: number;
|
|
8602
|
+
}): Promise<Result<PacketData, IntentError<'RELAY_TIMEOUT'>>>;
|
|
8155
8603
|
/**
|
|
8156
8604
|
* Gets the keccak256 hash of an intent. Hash serves as the intent id on Hub chain.
|
|
8157
8605
|
* @param {Intent} intent - The intent
|
|
@@ -8204,7 +8652,7 @@ declare class SonicSpokeService {
|
|
|
8204
8652
|
* - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
|
|
8205
8653
|
*
|
|
8206
8654
|
* @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
|
|
8207
|
-
* @param {
|
|
8655
|
+
* @param {SonicSpokeProviderType} spokeProvider - The Sonic spoke provider.
|
|
8208
8656
|
* @returns {Promise<bigint>} Estimated gas for the transaction.
|
|
8209
8657
|
*
|
|
8210
8658
|
* @example
|
|
@@ -8220,46 +8668,46 @@ declare class SonicSpokeService {
|
|
|
8220
8668
|
* const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
|
|
8221
8669
|
* console.log(`Estimated gas: ${estimatedGas}`);
|
|
8222
8670
|
*/
|
|
8223
|
-
static estimateGas(rawTx: EvmRawTransaction, spokeProvider:
|
|
8671
|
+
static estimateGas(rawTx: EvmRawTransaction, spokeProvider: SonicSpokeProviderType): Promise<bigint>;
|
|
8224
8672
|
/**
|
|
8225
8673
|
* Get the derived address of a contract deployed with CREATE3.
|
|
8226
8674
|
* @param address - User's address on the specified chain as hex
|
|
8227
8675
|
* @param provider - Sonic Spoke provider
|
|
8228
8676
|
* @returns {HubAddress} The computed contract address as a EVM address (hex) string
|
|
8229
8677
|
*/
|
|
8230
|
-
static getUserRouter(address: Address$1, provider:
|
|
8678
|
+
static getUserRouter(address: Address$1, provider: SonicSpokeProviderType): Promise<HubAddress>;
|
|
8231
8679
|
/**
|
|
8232
8680
|
* Deposit tokens to the spoke chain using the Sonic wallet abstraction.
|
|
8233
8681
|
* @param {SonicSpokeDepositParams} params - The parameters for the deposit
|
|
8234
|
-
* @param {
|
|
8235
|
-
* @returns {
|
|
8682
|
+
* @param {SonicSpokeProviderType} spokeProvider - The provider for the spoke chain
|
|
8683
|
+
* @returns {Promise<TxReturnType<S, R>>} A promise that resolves to the transaction hash
|
|
8236
8684
|
*/
|
|
8237
|
-
static deposit<S extends
|
|
8238
|
-
static createSwapIntent<R extends boolean = false>(createIntentParams: CreateIntentParams, creatorHubWalletAddress: Address$1, solverConfig: SolverConfig, fee: PartnerFee | undefined, spokeProvider:
|
|
8685
|
+
static deposit<S extends SonicSpokeProviderType, R extends boolean = false>(params: SonicSpokeDepositParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
8686
|
+
static createSwapIntent<S extends SonicSpokeProviderType, R extends boolean = false>(createIntentParams: CreateIntentParams, creatorHubWalletAddress: Address$1, solverConfig: SolverConfig, fee: PartnerFee | undefined, spokeProvider: S, hubProvider: EvmHubProvider, raw?: R): Promise<[TxReturnType<S, R>, Intent, bigint, Hex$1]>;
|
|
8239
8687
|
/**
|
|
8240
8688
|
* Get the balance of the token in the spoke chain.
|
|
8241
8689
|
* @param {Address} token - The address of the token to get the balance of.
|
|
8242
|
-
* @param {
|
|
8690
|
+
* @param {SonicSpokeProviderType} spokeProvider - The spoke provider.
|
|
8243
8691
|
* @returns {Promise<bigint>} The balance of the token.
|
|
8244
8692
|
*/
|
|
8245
|
-
static getDeposit(token: Address$1, spokeProvider:
|
|
8693
|
+
static getDeposit(token: Address$1, spokeProvider: SonicSpokeProviderType): Promise<bigint>;
|
|
8246
8694
|
/**
|
|
8247
8695
|
* Execute a batch of contract calls through the Sonic wallet contract.
|
|
8248
8696
|
* @param {Hex} payload - The encoded payload containing the calls array
|
|
8249
|
-
* @param {
|
|
8250
|
-
* @returns {
|
|
8697
|
+
* @param {SonicSpokeProviderType} spokeProvider - The provider for the spoke chain
|
|
8698
|
+
* @returns {Promise<TxReturnType<S, R>>} A promise that resolves to the transaction hash
|
|
8251
8699
|
*/
|
|
8252
|
-
static callWallet<S extends
|
|
8700
|
+
static callWallet<S extends SonicSpokeProviderType, R extends boolean>(payload: Hex$1, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
8253
8701
|
/**
|
|
8254
8702
|
* Get withdraw information for a given token
|
|
8255
8703
|
* @param token - The address of the underlying token
|
|
8256
8704
|
* @param amount - The amount to withdraw
|
|
8257
|
-
* @param
|
|
8705
|
+
* @param chainId - The chain ID of the underlying token
|
|
8258
8706
|
* @param moneyMarketService - The money market service
|
|
8259
8707
|
* @param configService - The config service
|
|
8260
8708
|
* @returns {WithdrawInfo} WithdrawInfo containing aToken address, amount and vault address
|
|
8261
8709
|
*/
|
|
8262
|
-
static getWithdrawInfo(token: Address$1, amount: bigint,
|
|
8710
|
+
static getWithdrawInfo(token: Address$1, amount: bigint, chainId: SpokeChainId, dataService: MoneyMarketDataService, configService: ConfigService): Promise<WithdrawInfo>;
|
|
8263
8711
|
/**
|
|
8264
8712
|
* Get borrow information for a given token
|
|
8265
8713
|
* @param token - The address of the underlying token
|
|
@@ -8278,16 +8726,16 @@ declare class SonicSpokeService {
|
|
|
8278
8726
|
* @param spender - The address of the spender
|
|
8279
8727
|
* @returns {Promise<Result<boolean>>} A promise that resolves to the result of the approval check
|
|
8280
8728
|
*/
|
|
8281
|
-
static isWithdrawApproved(from: Address$1, withdrawInfo: WithdrawInfo, spokeProvider:
|
|
8729
|
+
static isWithdrawApproved(from: Address$1, withdrawInfo: WithdrawInfo, spokeProvider: SonicSpokeProviderType, spender?: HubAddress): Promise<Result<boolean>>;
|
|
8282
8730
|
/**
|
|
8283
8731
|
* Approve the withdrawal of tokens from the spoke chain using the Sonic wallet abstraction.
|
|
8284
8732
|
* @param from - The address of the user on the spoke chain
|
|
8285
8733
|
* @param withdrawInfo - The information about the withdrawal
|
|
8286
8734
|
* @param spokeProvider - The spoke provider
|
|
8287
8735
|
* @param raw - Whether to return the raw transaction data
|
|
8288
|
-
* @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash
|
|
8736
|
+
* @returns {PromiseEvmTxReturnType<SonicSpokeProviderType, R>} A promise that resolves to the transaction hash
|
|
8289
8737
|
*/
|
|
8290
|
-
static approveWithdraw<R extends boolean = false>(from: Address$1, withdrawInfo: WithdrawInfo, spokeProvider:
|
|
8738
|
+
static approveWithdraw<S extends SonicSpokeProviderType, R extends boolean = false>(from: Address$1, withdrawInfo: WithdrawInfo, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
8291
8739
|
/**
|
|
8292
8740
|
* Check if the user has approved the borrowing of tokens from the spoke chain using the Sonic wallet abstraction.
|
|
8293
8741
|
* @param from - The address of the user on the spoke chain
|
|
@@ -8296,9 +8744,9 @@ declare class SonicSpokeService {
|
|
|
8296
8744
|
* @param spender - The address of the spender
|
|
8297
8745
|
* @returns {Promise<Result<boolean>>} A promise that resolves to the result of the approval check
|
|
8298
8746
|
*/
|
|
8299
|
-
static isBorrowApproved(from: Address$1, borrowInfo: BorrowInfo, spokeProvider:
|
|
8300
|
-
static approveBorrow<R extends boolean = false>(from: Address$1, borrowInfo: BorrowInfo, spokeProvider:
|
|
8301
|
-
static buildWithdrawData(from: Address$1, withdrawInfo: WithdrawInfo, amount: bigint, spokeProvider:
|
|
8747
|
+
static isBorrowApproved(from: Address$1, borrowInfo: BorrowInfo, spokeProvider: SonicSpokeProviderType, spender?: HubAddress): Promise<Result<boolean>>;
|
|
8748
|
+
static approveBorrow<S extends SonicSpokeProviderType, R extends boolean = false>(from: Address$1, borrowInfo: BorrowInfo, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
8749
|
+
static buildWithdrawData(from: Address$1, withdrawInfo: WithdrawInfo, amount: bigint, toAddress: Address$1, toChainId: SpokeChainId, spokeProvider: SonicSpokeProviderType, moneyMarketService: MoneyMarketService): Promise<Hex$1>;
|
|
8302
8750
|
}
|
|
8303
8751
|
|
|
8304
8752
|
type StellarSpokeDepositParams = {
|
|
@@ -8323,7 +8771,7 @@ declare class StellarSpokeService {
|
|
|
8323
8771
|
* @param spokeProvider - The Stellar spoke provider.
|
|
8324
8772
|
* @returns True if the user has sufficent trustline established for the token, false otherwise.
|
|
8325
8773
|
*/
|
|
8326
|
-
static hasSufficientTrustline(token: string, amount: bigint, spokeProvider:
|
|
8774
|
+
static hasSufficientTrustline(token: string, amount: bigint, spokeProvider: StellarSpokeProviderType): Promise<boolean>;
|
|
8327
8775
|
/**
|
|
8328
8776
|
* Request a trustline for a given token and amount.
|
|
8329
8777
|
* @param token - The token address to request the trustline for.
|
|
@@ -8332,30 +8780,30 @@ declare class StellarSpokeService {
|
|
|
8332
8780
|
* @param raw - Whether to return the raw transaction data.
|
|
8333
8781
|
* @returns The transaction result.
|
|
8334
8782
|
*/
|
|
8335
|
-
static requestTrustline<R extends boolean = false>(token: string, amount: bigint, spokeProvider:
|
|
8783
|
+
static requestTrustline<S extends StellarSpokeProviderType, R extends boolean = false>(token: string, amount: bigint, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
8336
8784
|
/**
|
|
8337
8785
|
* Estimate the gas for a transaction.
|
|
8338
8786
|
* @param rawTx - The raw transaction to estimate the gas for.
|
|
8339
8787
|
* @param spokeProvider - The spoke provider.
|
|
8340
8788
|
* @returns The estimated gas (minResourceFee) for the transaction.
|
|
8341
8789
|
*/
|
|
8342
|
-
static estimateGas(rawTx: StellarRawTransaction, spokeProvider:
|
|
8343
|
-
static deposit<R extends boolean = false>(params: StellarSpokeDepositParams, spokeProvider:
|
|
8790
|
+
static estimateGas(rawTx: StellarRawTransaction, spokeProvider: StellarSpokeProviderType): Promise<StellarGasEstimate>;
|
|
8791
|
+
static deposit<S extends StellarSpokeProviderType, R extends boolean = false>(params: StellarSpokeDepositParams, spokeProvider: S, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<S, R>>;
|
|
8344
8792
|
/**
|
|
8345
8793
|
* Get the balance of the token in the spoke chain asset manager.
|
|
8346
8794
|
* @param token - The address of the token to get the balance of.
|
|
8347
8795
|
* @param spokeProvider - The spoke provider.
|
|
8348
8796
|
* @returns The balance of the token.
|
|
8349
8797
|
*/
|
|
8350
|
-
static getDeposit(token: string, spokeProvider:
|
|
8798
|
+
static getDeposit(token: string, spokeProvider: StellarSpokeProviderType): Promise<bigint>;
|
|
8351
8799
|
/**
|
|
8352
8800
|
* Generate simulation parameters for deposit from StellarSpokeDepositParams.
|
|
8353
8801
|
* @param {StellarSpokeDepositParams} params - The deposit parameters.
|
|
8354
|
-
* @param {
|
|
8802
|
+
* @param {StellarSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
8355
8803
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
8356
8804
|
* @returns {Promise<DepositSimulationParams>} The simulation parameters.
|
|
8357
8805
|
*/
|
|
8358
|
-
static getSimulateDepositParams(params: StellarSpokeDepositParams, spokeProvider:
|
|
8806
|
+
static getSimulateDepositParams(params: StellarSpokeDepositParams, spokeProvider: StellarSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
|
|
8359
8807
|
/**
|
|
8360
8808
|
* Calls a contract on the spoke chain using the user's wallet.
|
|
8361
8809
|
* @param from - The address of the user on the hub chain.
|
|
@@ -8365,7 +8813,7 @@ declare class StellarSpokeService {
|
|
|
8365
8813
|
* @param raw - Whether to return the raw transaction data.
|
|
8366
8814
|
* @returns The transaction result.
|
|
8367
8815
|
*/
|
|
8368
|
-
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider:
|
|
8816
|
+
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: StellarSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<StellarSpokeProviderType, R>>;
|
|
8369
8817
|
private static transfer;
|
|
8370
8818
|
private static call;
|
|
8371
8819
|
static waitForTransaction(spokeProvider: StellarSpokeProvider, txHash: string, pollingTimeout?: number, maxAttempts?: number): Promise<Result<boolean, Error>>;
|
|
@@ -8392,53 +8840,53 @@ declare class SuiSpokeService {
|
|
|
8392
8840
|
* @param {SuiSpokeProvider} spokeProvider - The spoke provider.
|
|
8393
8841
|
* @returns {Promise<bigint>} The estimated computation cost.
|
|
8394
8842
|
*/
|
|
8395
|
-
static estimateGas(rawTx: SuiRawTransaction, spokeProvider:
|
|
8843
|
+
static estimateGas(rawTx: SuiRawTransaction, spokeProvider: SuiSpokeProviderType): Promise<SuiGasEstimate>;
|
|
8396
8844
|
/**
|
|
8397
8845
|
* Deposit tokens to the spoke chain.
|
|
8398
8846
|
* @param {InjectiveSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
8399
|
-
* @param {
|
|
8847
|
+
* @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
8400
8848
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
8401
8849
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
8402
|
-
* @returns {
|
|
8850
|
+
* @returns {Promise<TxReturnType<SuiSpokeProviderType, R>>} A promise that resolves to the transaction hash or raw transaction base64 string.
|
|
8403
8851
|
*/
|
|
8404
|
-
static deposit<R extends boolean = false>(params: SuiSpokeDepositParams, spokeProvider:
|
|
8852
|
+
static deposit<R extends boolean = false>(params: SuiSpokeDepositParams, spokeProvider: SuiSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<SuiSpokeProviderType, R>>;
|
|
8405
8853
|
/**
|
|
8406
8854
|
* Get the balance of the token in the spoke chain.
|
|
8407
8855
|
* @param {Address} token - The address of the token to get the balance of.
|
|
8408
8856
|
* @param {SuiSpokeProvider} spokeProvider - The spoke provider.
|
|
8409
8857
|
* @returns {Promise<bigint>} The balance of the token.
|
|
8410
8858
|
*/
|
|
8411
|
-
static getDeposit(token: string, spokeProvider:
|
|
8859
|
+
static getDeposit(token: string, spokeProvider: SuiSpokeProviderType): Promise<bigint>;
|
|
8412
8860
|
/**
|
|
8413
8861
|
* Generate simulation parameters for deposit from SuiSpokeDepositParams.
|
|
8414
8862
|
* @param {SuiSpokeDepositParams} params - The deposit parameters.
|
|
8415
|
-
* @param {
|
|
8863
|
+
* @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
8416
8864
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
8417
8865
|
* @returns {Promise<DepositSimulationParams>} The simulation parameters.
|
|
8418
8866
|
*/
|
|
8419
|
-
static getSimulateDepositParams(params: SuiSpokeDepositParams, spokeProvider:
|
|
8867
|
+
static getSimulateDepositParams(params: SuiSpokeDepositParams, spokeProvider: SuiSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
|
|
8420
8868
|
/**
|
|
8421
8869
|
* Calls a contract on the spoke chain using the user's wallet.
|
|
8422
8870
|
* @param {HubAddress} from - The address of the user on the spoke chain.
|
|
8423
8871
|
* @param {Hex} payload - The payload to send to the contract.
|
|
8424
|
-
* @param {
|
|
8872
|
+
* @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
8425
8873
|
* @param {EvmHubProvider} hubProvider - The provider for the hub chain.
|
|
8426
8874
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
8427
|
-
* @returns {
|
|
8875
|
+
* @returns {Promise<TxReturnType<SuiSpokeProviderType, R>>} A promise that resolves to the transaction hash or raw transaction base64 string.
|
|
8428
8876
|
*/
|
|
8429
|
-
static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider:
|
|
8877
|
+
static callWallet<S extends SuiSpokeProviderType, R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: S, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<S, R>>;
|
|
8430
8878
|
/**
|
|
8431
8879
|
* Fetch the asset manager config from the spoke chain.
|
|
8432
|
-
* @param {
|
|
8880
|
+
* @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
|
|
8433
8881
|
* @returns {Promise<string>} The asset manager config.
|
|
8434
8882
|
*/
|
|
8435
|
-
static fetchAssetManagerAddress(suiSpokeProvider:
|
|
8883
|
+
static fetchAssetManagerAddress(suiSpokeProvider: SuiBaseSpokeProvider): Promise<string>;
|
|
8436
8884
|
/**
|
|
8437
8885
|
* Fetch the latest asset manager package id from the spoke chain.
|
|
8438
|
-
* @param {
|
|
8886
|
+
* @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
|
|
8439
8887
|
* @returns {Promise<string>} The latest asset manager package id.
|
|
8440
8888
|
*/
|
|
8441
|
-
static fetchLatestAssetManagerPackageId(
|
|
8889
|
+
static fetchLatestAssetManagerPackageId(provider: SuiBaseSpokeProvider): Promise<string>;
|
|
8442
8890
|
/**
|
|
8443
8891
|
* Transfers tokens to the hub chain.
|
|
8444
8892
|
* @param {SuiTransferToHubParams} params - The parameters for the transfer, including:
|
|
@@ -8446,9 +8894,9 @@ declare class SuiSpokeService {
|
|
|
8446
8894
|
* - {Uint8Array} recipient: The recipient address on the hub chain.
|
|
8447
8895
|
* - {string} amount: The amount to transfer.
|
|
8448
8896
|
* - {Uint8Array} [data=new Uint8Array([])]: Additional data for the transfer.
|
|
8449
|
-
* @param {
|
|
8897
|
+
* @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
8450
8898
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
8451
|
-
* @returns {
|
|
8899
|
+
* @returns {Promise<TxReturnType<SuiSpokeProviderType, R>>} A promise that resolves to the transaction hash or raw transaction base64 string.
|
|
8452
8900
|
*/
|
|
8453
8901
|
private static transfer;
|
|
8454
8902
|
/**
|
|
@@ -8456,217 +8904,91 @@ declare class SuiSpokeService {
|
|
|
8456
8904
|
* @param {bigint} dstChainId - The chain ID of the hub chain.
|
|
8457
8905
|
* @param {HubAddress} dstAddress - The address on the hub chain.
|
|
8458
8906
|
* @param {Hex} payload - The payload to send.
|
|
8459
|
-
* @param {
|
|
8907
|
+
* @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
|
|
8460
8908
|
* @param {boolean} raw - The return type raw or just transaction hash
|
|
8461
|
-
* @returns {
|
|
8909
|
+
* @returns {Promise<TxReturnType<SuiSpokeProviderType, R>>} A promise that resolves to the transaction hash or raw transaction base64 string.
|
|
8462
8910
|
*/
|
|
8463
8911
|
private static call;
|
|
8464
8912
|
}
|
|
8465
8913
|
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8914
|
+
declare class Erc20Service {
|
|
8915
|
+
private constructor();
|
|
8916
|
+
static getErc20Token(token: Address$1, publicClient: PublicClient): Promise<Erc20Token>;
|
|
8917
|
+
/**
|
|
8918
|
+
* Check if spender has enough ERC20 allowance for given amount
|
|
8919
|
+
* @param token - ERC20 token address
|
|
8920
|
+
* @param amount - Amount to check allowance for
|
|
8921
|
+
* @param owner - User wallet address
|
|
8922
|
+
* @param spender - Spender address
|
|
8923
|
+
* @param spokeProvider - EVM Spoke provider
|
|
8924
|
+
* @return - True if spender is allowed to spend amount on behalf of owner
|
|
8925
|
+
*/
|
|
8926
|
+
static isAllowanceValid(token: Address$1, amount: bigint, owner: Address$1, spender: Address$1, spokeProvider: EvmSpokeProviderType | SonicSpokeProviderType): Promise<Result<boolean>>;
|
|
8927
|
+
/**
|
|
8928
|
+
* Approve ERC20 amount spending
|
|
8929
|
+
* @param token - ERC20 token address
|
|
8930
|
+
* @param amount - Amount to approve
|
|
8931
|
+
* @param spender - Spender address
|
|
8932
|
+
* @param provider - EVM Provider
|
|
8933
|
+
*/
|
|
8934
|
+
static approve<R extends boolean = false>(token: Address$1, amount: bigint, spender: Address$1, spokeProvider: EvmSpokeProviderType | SonicSpokeProviderType, raw?: R): Promise<TxReturnType<EvmSpokeProviderType | SonicSpokeProviderType, R>>;
|
|
8935
|
+
/**
|
|
8936
|
+
* Encodes a transfer transaction for a token.
|
|
8937
|
+
* @param token - The address of the token.
|
|
8938
|
+
* @param to - The address to transfer the token to.
|
|
8939
|
+
* @param amount - The amount of the token to transfer.
|
|
8940
|
+
* @returns The encoded contract call.
|
|
8941
|
+
*/
|
|
8942
|
+
static encodeTransfer(token: Address$1, to: Address$1, amount: bigint): EvmContractCall;
|
|
8943
|
+
/**
|
|
8944
|
+
* Encodes a transferFrom transaction for a token.
|
|
8945
|
+
* @param token - The address of the token.
|
|
8946
|
+
* @param from - The address to transfer the token from.
|
|
8947
|
+
* @param to - The address to transfer the token to.
|
|
8948
|
+
* @param amount - The amount of the token to transfer.
|
|
8949
|
+
* @returns The encoded contract call.
|
|
8950
|
+
*/
|
|
8951
|
+
static encodeTransferFrom(token: Address$1, from: Address$1, to: Address$1, amount: bigint): EvmContractCall;
|
|
8952
|
+
/**
|
|
8953
|
+
* Encodes an approval transaction for a token.
|
|
8954
|
+
* @param token - The address of the token.
|
|
8955
|
+
* @param to - The address to approve the token to.
|
|
8956
|
+
* @param amount - The amount of the token to approve.
|
|
8957
|
+
* @returns The encoded contract call.
|
|
8958
|
+
*/
|
|
8959
|
+
static encodeApprove(token: Address$1, to: Address$1, amount: bigint): EvmContractCall;
|
|
8960
|
+
}
|
|
8961
|
+
|
|
8962
|
+
type LegacybnUSDChainId = (typeof bnUSDLegacySpokeChainIds)[number];
|
|
8963
|
+
type LegacybnUSDTokenAddress = (typeof bnUSDLegacyTokens)[number]['address'];
|
|
8964
|
+
type LegacybnUSDToken = (typeof bnUSDLegacyTokens)[number];
|
|
8965
|
+
type NewbnUSDChainId = (typeof newbnUSDSpokeChainIds)[number];
|
|
8966
|
+
type MoneyMarketServiceConfig = Prettify<MoneyMarketConfig & PartnerFeeConfig & RelayerApiConfig>;
|
|
8967
|
+
type SwapServiceConfig = Prettify<SolverConfig & PartnerFeeConfig & RelayerApiConfig>;
|
|
8968
|
+
type MigrationServiceConfig = Prettify<RelayerApiConfig>;
|
|
8969
|
+
type BridgeServiceConfig = Optional<PartnerFeeConfig, 'partnerFee'>;
|
|
8970
|
+
type BackendApiConfig = {
|
|
8971
|
+
baseURL?: HttpUrl;
|
|
8972
|
+
timeout?: number;
|
|
8973
|
+
headers?: Record<string, string>;
|
|
8493
8974
|
};
|
|
8494
|
-
type
|
|
8495
|
-
|
|
8496
|
-
|
|
8975
|
+
type MoneyMarketConfigParams = Prettify<MoneyMarketConfig & Optional<PartnerFeeConfig, 'partnerFee'>> | Optional<PartnerFeeConfig, 'partnerFee'>;
|
|
8976
|
+
type Default = {
|
|
8977
|
+
default: boolean;
|
|
8497
8978
|
};
|
|
8498
|
-
type
|
|
8499
|
-
|
|
8500
|
-
tx_hash: string;
|
|
8501
|
-
conn_sn: string;
|
|
8979
|
+
type RelayerApiConfig = {
|
|
8980
|
+
relayerApiEndpoint: HttpUrl;
|
|
8502
8981
|
};
|
|
8503
|
-
type
|
|
8504
|
-
|
|
8505
|
-
|
|
8982
|
+
type EvmContractCall = {
|
|
8983
|
+
address: Address;
|
|
8984
|
+
value: bigint;
|
|
8985
|
+
data: Hex$1;
|
|
8506
8986
|
};
|
|
8507
|
-
type
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
dst_chain_id: number;
|
|
8513
|
-
conn_sn: number;
|
|
8514
|
-
dst_address: string;
|
|
8515
|
-
dst_tx_hash: string;
|
|
8516
|
-
signatures: string[];
|
|
8517
|
-
payload: string;
|
|
8518
|
-
};
|
|
8519
|
-
type IntentDeliveryInfo = {
|
|
8520
|
-
srcChainId: SpokeChainId;
|
|
8521
|
-
srcTxHash: string;
|
|
8522
|
-
srcAddress: string;
|
|
8523
|
-
dstChainId: SpokeChainId;
|
|
8524
|
-
dstTxHash: string;
|
|
8525
|
-
dstAddress: string;
|
|
8526
|
-
};
|
|
8527
|
-
type GetTransactionPacketsResponse = {
|
|
8528
|
-
success: boolean;
|
|
8529
|
-
data: PacketData[];
|
|
8530
|
-
};
|
|
8531
|
-
type GetPacketResponse = {
|
|
8532
|
-
success: true;
|
|
8533
|
-
data: PacketData;
|
|
8534
|
-
} | {
|
|
8535
|
-
success: false;
|
|
8536
|
-
message: string;
|
|
8537
|
-
};
|
|
8538
|
-
type GetRelayRequestParamType<T extends RelayAction> = T extends 'submit' ? SubmitTxParams : T extends 'get_transaction_packets' ? GetTransactionPacketsParams : T extends 'get_packet' ? GetPacketParams : never;
|
|
8539
|
-
type GetRelayResponse<T extends RelayAction> = T extends 'submit' ? SubmitTxResponse : T extends 'get_transaction_packets' ? GetTransactionPacketsResponse : T extends 'get_packet' ? GetPacketResponse : never;
|
|
8540
|
-
type IntentRelayRequestParams = SubmitTxParams | GetTransactionPacketsParams | GetPacketParams;
|
|
8541
|
-
type WaitUntilIntentExecutedPayload = {
|
|
8542
|
-
intentRelayChainId: string;
|
|
8543
|
-
spokeTxHash: string;
|
|
8544
|
-
timeout: number;
|
|
8545
|
-
apiUrl: HttpUrl;
|
|
8546
|
-
};
|
|
8547
|
-
/**
|
|
8548
|
-
* Represents the request payload for submitting a transaction to the intent relay service.
|
|
8549
|
-
* Contains the action type and parameters including chain ID and transaction hash.
|
|
8550
|
-
*/
|
|
8551
|
-
type IntentRelayRequest<T extends RelayAction> = {
|
|
8552
|
-
action: T;
|
|
8553
|
-
params: GetRelayRequestParamType<T>;
|
|
8554
|
-
};
|
|
8555
|
-
/**
|
|
8556
|
-
* Submits a transaction to the intent relay service.
|
|
8557
|
-
* @param payload - The request payload containing the 'submit' action type and parameters.
|
|
8558
|
-
* @param apiUrl - The URL of the intent relay service.
|
|
8559
|
-
* @returns The response from the intent relay service.
|
|
8560
|
-
*/
|
|
8561
|
-
declare function submitTransaction(payload: IntentRelayRequest<'submit'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'submit'>>;
|
|
8562
|
-
/**
|
|
8563
|
-
* Retrieves transaction packets from the intent relay service.
|
|
8564
|
-
* @param payload - The request payload containing the 'get_transaction_packets' action type and parameters.
|
|
8565
|
-
* @param apiUrl - The URL of the intent relay service.
|
|
8566
|
-
* @returns The response from the intent relay service.
|
|
8567
|
-
*/
|
|
8568
|
-
declare function getTransactionPackets(payload: IntentRelayRequest<'get_transaction_packets'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'get_transaction_packets'>>;
|
|
8569
|
-
/**
|
|
8570
|
-
* Retrieves a packet from the intent relay service.
|
|
8571
|
-
* @param payload - The request payload containing the 'get_packet' action type and parameters.
|
|
8572
|
-
* @param apiUrl - The URL of the intent relay service.
|
|
8573
|
-
* @returns The response from the intent relay service.
|
|
8574
|
-
*/
|
|
8575
|
-
declare function getPacket(payload: IntentRelayRequest<'get_packet'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'get_packet'>>;
|
|
8576
|
-
declare function waitUntilIntentExecuted(payload: WaitUntilIntentExecutedPayload): Promise<Result<PacketData, IntentError<'RELAY_TIMEOUT'>>>;
|
|
8577
|
-
/**
|
|
8578
|
-
* Submit the transaction to the Solver API and wait for it to be executed
|
|
8579
|
-
* @param spokeTxHash - The transaction hash to submit.
|
|
8580
|
-
* @param data - The additional data to submit when relaying the transaction on Solana. Due to Solana's 1232 byte transaction
|
|
8581
|
-
* size limit, Solana transactions are split: the on-chain tx contains only a verification hash, while the full
|
|
8582
|
-
* data is submitted off-chain via the relayer. Contains the to address on Hub chain and instruction data.
|
|
8583
|
-
* @param spokeProvider - The spoke provider.
|
|
8584
|
-
* @param timeout - The timeout in milliseconds for the transaction. Default is 20 seconds.
|
|
8585
|
-
* @returns The transaction hash.
|
|
8586
|
-
*/
|
|
8587
|
-
declare function relayTxAndWaitPacket<S extends SpokeProvider>(spokeTxHash: string, data: {
|
|
8588
|
-
address: Hex;
|
|
8589
|
-
payload: Hex;
|
|
8590
|
-
} | undefined, spokeProvider: S, relayerApiEndpoint: HttpUrl, timeout?: number): Promise<Result<PacketData, RelayError>>;
|
|
8591
|
-
|
|
8592
|
-
declare class Erc20Service {
|
|
8593
|
-
private constructor();
|
|
8594
|
-
static getErc20Token(token: Address$1, publicClient: PublicClient): Promise<Erc20Token>;
|
|
8595
|
-
/**
|
|
8596
|
-
* Check if spender has enough ERC20 allowance for given amount
|
|
8597
|
-
* @param token - ERC20 token address
|
|
8598
|
-
* @param amount - Amount to check allowance for
|
|
8599
|
-
* @param owner - User wallet address
|
|
8600
|
-
* @param spender - Spender address
|
|
8601
|
-
* @param spokeProvider - EVM Spoke provider
|
|
8602
|
-
* @return - True if spender is allowed to spend amount on behalf of owner
|
|
8603
|
-
*/
|
|
8604
|
-
static isAllowanceValid(token: Address$1, amount: bigint, owner: Address$1, spender: Address$1, spokeProvider: EvmSpokeProvider | SonicSpokeProvider): Promise<Result<boolean>>;
|
|
8605
|
-
/**
|
|
8606
|
-
* Approve ERC20 amount spending
|
|
8607
|
-
* @param token - ERC20 token address
|
|
8608
|
-
* @param amount - Amount to approve
|
|
8609
|
-
* @param spender - Spender address
|
|
8610
|
-
* @param provider - EVM Provider
|
|
8611
|
-
*/
|
|
8612
|
-
static approve<R extends boolean = false>(token: Address$1, amount: bigint, spender: Address$1, spokeProvider: EvmSpokeProvider | SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
|
|
8613
|
-
/**
|
|
8614
|
-
* Encodes a transfer transaction for a token.
|
|
8615
|
-
* @param token - The address of the token.
|
|
8616
|
-
* @param to - The address to transfer the token to.
|
|
8617
|
-
* @param amount - The amount of the token to transfer.
|
|
8618
|
-
* @returns The encoded contract call.
|
|
8619
|
-
*/
|
|
8620
|
-
static encodeTransfer(token: Address$1, to: Address$1, amount: bigint): EvmContractCall;
|
|
8621
|
-
/**
|
|
8622
|
-
* Encodes a transferFrom transaction for a token.
|
|
8623
|
-
* @param token - The address of the token.
|
|
8624
|
-
* @param from - The address to transfer the token from.
|
|
8625
|
-
* @param to - The address to transfer the token to.
|
|
8626
|
-
* @param amount - The amount of the token to transfer.
|
|
8627
|
-
* @returns The encoded contract call.
|
|
8628
|
-
*/
|
|
8629
|
-
static encodeTransferFrom(token: Address$1, from: Address$1, to: Address$1, amount: bigint): EvmContractCall;
|
|
8630
|
-
/**
|
|
8631
|
-
* Encodes an approval transaction for a token.
|
|
8632
|
-
* @param token - The address of the token.
|
|
8633
|
-
* @param to - The address to approve the token to.
|
|
8634
|
-
* @param amount - The amount of the token to approve.
|
|
8635
|
-
* @returns The encoded contract call.
|
|
8636
|
-
*/
|
|
8637
|
-
static encodeApprove(token: Address$1, to: Address$1, amount: bigint): EvmContractCall;
|
|
8638
|
-
}
|
|
8639
|
-
|
|
8640
|
-
type LegacybnUSDChainId = (typeof bnUSDLegacySpokeChainIds)[number];
|
|
8641
|
-
type LegacybnUSDTokenAddress = (typeof bnUSDLegacyTokens)[number]['address'];
|
|
8642
|
-
type LegacybnUSDToken = (typeof bnUSDLegacyTokens)[number];
|
|
8643
|
-
type NewbnUSDChainId = (typeof newbnUSDSpokeChainIds)[number];
|
|
8644
|
-
type MoneyMarketServiceConfig = Prettify<MoneyMarketConfig & PartnerFeeConfig & RelayerApiConfig>;
|
|
8645
|
-
type SwapServiceConfig = Prettify<SolverConfig & PartnerFeeConfig & RelayerApiConfig>;
|
|
8646
|
-
type MigrationServiceConfig = Prettify<RelayerApiConfig>;
|
|
8647
|
-
type BridgeServiceConfig = Optional<PartnerFeeConfig, 'partnerFee'>;
|
|
8648
|
-
type BackendApiConfig = {
|
|
8649
|
-
baseURL?: HttpUrl;
|
|
8650
|
-
timeout?: number;
|
|
8651
|
-
headers?: Record<string, string>;
|
|
8652
|
-
};
|
|
8653
|
-
type MoneyMarketConfigParams = Prettify<MoneyMarketConfig & Optional<PartnerFeeConfig, 'partnerFee'>> | Optional<PartnerFeeConfig, 'partnerFee'>;
|
|
8654
|
-
type Default = {
|
|
8655
|
-
default: boolean;
|
|
8656
|
-
};
|
|
8657
|
-
type RelayerApiConfig = {
|
|
8658
|
-
relayerApiEndpoint: HttpUrl;
|
|
8659
|
-
};
|
|
8660
|
-
type EvmContractCall = {
|
|
8661
|
-
address: Address;
|
|
8662
|
-
value: bigint;
|
|
8663
|
-
data: Hex$1;
|
|
8664
|
-
};
|
|
8665
|
-
type EvmTransferToHubParams = {
|
|
8666
|
-
token: Address;
|
|
8667
|
-
recipient: Address;
|
|
8668
|
-
amount: bigint;
|
|
8669
|
-
data: Hex$1;
|
|
8987
|
+
type EvmTransferToHubParams = {
|
|
8988
|
+
token: Address;
|
|
8989
|
+
recipient: Address;
|
|
8990
|
+
amount: bigint;
|
|
8991
|
+
data: Hex$1;
|
|
8670
8992
|
};
|
|
8671
8993
|
type EvmTransferParams = {
|
|
8672
8994
|
fromToken: Address;
|
|
@@ -8749,8 +9071,8 @@ type Result<T, E = Error | unknown> = {
|
|
|
8749
9071
|
error: E;
|
|
8750
9072
|
};
|
|
8751
9073
|
type SpokeDepositParams = EvmSpokeDepositParams | InjectiveSpokeDepositParams | IconSpokeDepositParams;
|
|
8752
|
-
type GetSpokeDepositParamsType<T extends
|
|
8753
|
-
type GetAddressType<T extends
|
|
9074
|
+
type GetSpokeDepositParamsType<T extends SpokeProviderType> = T extends EvmSpokeProvider ? EvmSpokeDepositParams : T extends EvmRawSpokeProvider ? EvmSpokeDepositParams : T extends InjectiveSpokeProvider ? InjectiveSpokeDepositParams : T extends InjectiveRawSpokeProvider ? InjectiveSpokeDepositParams : T extends SuiSpokeProvider ? SuiSpokeDepositParams : T extends SuiRawSpokeProvider ? SuiSpokeDepositParams : T extends IconSpokeProvider ? IconSpokeDepositParams : T extends IconRawSpokeProvider ? IconSpokeDepositParams : T extends StellarSpokeProvider ? StellarSpokeDepositParams : T extends StellarRawSpokeProvider ? StellarSpokeDepositParams : T extends SolanaSpokeProvider ? SolanaSpokeDepositParams : T extends SolanaRawSpokeProvider ? SolanaSpokeDepositParams : T extends SonicSpokeProvider ? SonicSpokeDepositParams : T extends SonicRawSpokeProvider ? SonicSpokeDepositParams : never;
|
|
9075
|
+
type GetAddressType<T extends SpokeProviderType> = T extends EvmSpokeProvider ? Address : T extends EvmRawSpokeProvider ? Address : T extends InjectiveSpokeProvider ? string : T extends InjectiveRawSpokeProvider ? string : T extends StellarSpokeProvider ? Hex$1 : T extends StellarRawSpokeProvider ? Hex$1 : T extends IconSpokeProvider ? IconAddress : T extends IconRawSpokeProvider ? IconAddress : T extends SuiSpokeProvider ? Hex$1 : T extends SuiRawSpokeProvider ? Hex$1 : T extends SolanaSpokeProvider ? Hex$1 : T extends SolanaRawSpokeProvider ? Hex$1 : T extends SonicSpokeProvider ? Address : T extends SonicRawSpokeProvider ? Address : never;
|
|
8754
9076
|
type SolverConfigParams = Prettify<SolverConfig & Optional<PartnerFeeConfig, 'partnerFee'>> | Optional<PartnerFeeConfig, 'partnerFee'>;
|
|
8755
9077
|
type QuoteType = 'exact_input' | 'exact_output';
|
|
8756
9078
|
type SolverIntentQuoteRequest = {
|
|
@@ -8843,21 +9165,33 @@ type SuiRawTransaction = {
|
|
|
8843
9165
|
data: Base64String;
|
|
8844
9166
|
};
|
|
8845
9167
|
type EvmReturnType<Raw extends boolean> = Raw extends true ? EvmRawTransaction : Hex$1;
|
|
8846
|
-
type SolanaReturnType<Raw extends boolean> = Raw extends true ? SolanaRawTransaction :
|
|
9168
|
+
type SolanaReturnType<Raw extends boolean> = Raw extends true ? SolanaRawTransaction : string;
|
|
8847
9169
|
type StellarReturnType<Raw extends boolean> = Raw extends true ? StellarRawTransaction : string;
|
|
8848
9170
|
type IconReturnType<Raw extends boolean> = Raw extends true ? IconRawTransaction : Hex$1;
|
|
8849
|
-
type SuiReturnType<Raw extends boolean> = Raw extends true ? SuiRawTransaction :
|
|
8850
|
-
type InjectiveReturnType<Raw extends boolean> = Raw extends true ? InjectiveRawTransaction :
|
|
9171
|
+
type SuiReturnType<Raw extends boolean> = Raw extends true ? SuiRawTransaction : string;
|
|
9172
|
+
type InjectiveReturnType<Raw extends boolean> = Raw extends true ? InjectiveRawTransaction : string;
|
|
8851
9173
|
type HashTxReturnType = EvmReturnType<false> | SolanaReturnType<false> | IconReturnType<false> | SuiReturnType<false> | InjectiveReturnType<false> | StellarReturnType<false>;
|
|
8852
9174
|
type RawTxReturnType = EvmRawTransaction | SolanaRawTransaction | InjectiveRawTransaction | IconRawTransaction | SuiRawTransaction | StellarRawTransaction;
|
|
8853
|
-
|
|
9175
|
+
/**
|
|
9176
|
+
* Return type for a transaction based on the given SpokeProvider or RawSpokeProvider.
|
|
9177
|
+
* - If T extends RawSpokeProvider, Raw is forced to `true` (always returns raw tx type).
|
|
9178
|
+
* - Otherwise, Raw parameter determines output type.
|
|
9179
|
+
*/
|
|
9180
|
+
type TxReturnType<T extends SpokeProviderType, Raw extends boolean> = T extends RawSpokeProvider ? T['chainConfig']['chain']['type'] extends 'EVM' ? EvmReturnType<true> : T['chainConfig']['chain']['type'] extends 'SOLANA' ? SolanaReturnType<true> : T['chainConfig']['chain']['type'] extends 'STELLAR' ? StellarReturnType<true> : T['chainConfig']['chain']['type'] extends 'ICON' ? IconReturnType<true> : T['chainConfig']['chain']['type'] extends 'SUI' ? SuiReturnType<true> : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? InjectiveReturnType<true> : RawTxReturnType : T extends SpokeProvider ? T['chainConfig']['chain']['type'] extends 'EVM' ? EvmReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'SOLANA' ? SolanaReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'STELLAR' ? StellarReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'ICON' ? IconReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'SUI' ? SuiReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? InjectiveReturnType<Raw> : Raw extends true ? RawTxReturnType : HashTxReturnType : Raw extends true ? RawTxReturnType : HashTxReturnType;
|
|
8854
9181
|
type PromiseEvmTxReturnType<Raw extends boolean> = Promise<TxReturnType<EvmSpokeProvider, Raw>>;
|
|
8855
9182
|
type PromiseSolanaTxReturnType<Raw extends boolean> = Promise<TxReturnType<SolanaSpokeProvider, Raw>>;
|
|
8856
9183
|
type PromiseStellarTxReturnType<Raw extends boolean> = Promise<TxReturnType<StellarSpokeProvider, Raw>>;
|
|
8857
9184
|
type PromiseIconTxReturnType<Raw extends boolean> = Promise<TxReturnType<IconSpokeProvider, Raw>>;
|
|
8858
9185
|
type PromiseSuiTxReturnType<Raw extends boolean> = Promise<TxReturnType<SuiSpokeProvider, Raw>>;
|
|
8859
9186
|
type PromiseInjectiveTxReturnType<Raw extends boolean> = Promise<TxReturnType<InjectiveSpokeProvider, Raw>>;
|
|
8860
|
-
type PromiseTxReturnType<T extends
|
|
9187
|
+
type PromiseTxReturnType<T extends SpokeProvider, Raw extends boolean> = T['chainConfig']['chain']['type'] extends 'EVM' ? Promise<TxReturnType<EvmSpokeProviderType, Raw>> : T['chainConfig']['chain']['type'] extends 'SOLANA' ? Promise<TxReturnType<SolanaSpokeProviderType, Raw>> : T['chainConfig']['chain']['type'] extends 'STELLAR' ? Promise<TxReturnType<StellarSpokeProviderType, Raw>> : T['chainConfig']['chain']['type'] extends 'ICON' ? Promise<TxReturnType<IconSpokeProviderType, Raw>> : T['chainConfig']['chain']['type'] extends 'SUI' ? Promise<TxReturnType<SuiSpokeProviderType, Raw>> : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? Promise<TxReturnType<InjectiveSpokeProviderType, Raw>> : never;
|
|
9188
|
+
type EvmSpokeProviderType = EvmSpokeProvider | EvmRawSpokeProvider;
|
|
9189
|
+
type SolanaSpokeProviderType = SolanaSpokeProvider | SolanaRawSpokeProvider;
|
|
9190
|
+
type StellarSpokeProviderType = StellarSpokeProvider | StellarRawSpokeProvider;
|
|
9191
|
+
type IconSpokeProviderType = IconSpokeProvider | IconRawSpokeProvider;
|
|
9192
|
+
type SuiSpokeProviderType = SuiSpokeProvider | SuiRawSpokeProvider;
|
|
9193
|
+
type InjectiveSpokeProviderType = InjectiveSpokeProvider | InjectiveRawSpokeProvider;
|
|
9194
|
+
type SonicSpokeProviderType = SonicSpokeProvider | SonicRawSpokeProvider;
|
|
8861
9195
|
type Prettify<T> = {
|
|
8862
9196
|
[K in keyof T]: T[K];
|
|
8863
9197
|
} & {};
|
|
@@ -8881,7 +9215,7 @@ type InjectiveGasEstimate = {
|
|
|
8881
9215
|
gasUsed: number;
|
|
8882
9216
|
};
|
|
8883
9217
|
type GasEstimateType = EvmGasEstimate | SolanaGasEstimate | StellarGasEstimate | IconGasEstimate | SuiGasEstimate | InjectiveGasEstimate;
|
|
8884
|
-
type GetEstimateGasReturnType<T extends
|
|
9218
|
+
type GetEstimateGasReturnType<T extends SpokeProviderType> = T['chainConfig']['chain']['type'] extends 'EVM' ? EvmGasEstimate : T['chainConfig']['chain']['type'] extends 'SOLANA' ? SolanaGasEstimate : T['chainConfig']['chain']['type'] extends 'STELLAR' ? StellarGasEstimate : T['chainConfig']['chain']['type'] extends 'ICON' ? IconGasEstimate : T['chainConfig']['chain']['type'] extends 'SUI' ? SuiGasEstimate : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? InjectiveGasEstimate : GasEstimateType;
|
|
8885
9219
|
type OptionalRaw<R extends boolean = false> = {
|
|
8886
9220
|
raw?: R;
|
|
8887
9221
|
};
|
|
@@ -8895,6 +9229,7 @@ type RelayExtraData = {
|
|
|
8895
9229
|
type RelayOptionalExtraData = {
|
|
8896
9230
|
data?: RelayExtraData;
|
|
8897
9231
|
};
|
|
9232
|
+
type GetChainConfigType<T extends ChainType> = T extends 'EVM' ? EvmSpokeChainConfig : T extends 'SOLANA' ? SolanaChainConfig : T extends 'STELLAR' ? StellarSpokeChainConfig : T extends 'ICON' ? IconSpokeChainConfig : T extends 'SUI' ? SuiSpokeChainConfig : T extends 'INJECTIVE' ? InjectiveSpokeChainConfig : BaseSpokeChainConfig<T>;
|
|
8898
9233
|
|
|
8899
9234
|
/**
|
|
8900
9235
|
* BackendApiService - Proxy service for Sodax Backend API
|
|
@@ -9286,1616 +9621,1465 @@ declare function encodeAddress(spokeChainId: SpokeChainId, address: string): Hex
|
|
|
9286
9621
|
*/
|
|
9287
9622
|
declare function hexToBigInt(hex: string): bigint;
|
|
9288
9623
|
/**
|
|
9289
|
-
* Derive user hub
|
|
9290
|
-
* @param
|
|
9291
|
-
* @param
|
|
9292
|
-
* @param
|
|
9624
|
+
* Derive user hub wallet address based on the spoke chain id and address.
|
|
9625
|
+
* @param hubProvider - Hub provider instance
|
|
9626
|
+
* @param spokeChainId - Spoke chain id
|
|
9627
|
+
* @param spokeAddress - Spoke address
|
|
9293
9628
|
* @returns Abstracted user wallet address for spoke chains with different chain id than hub or original
|
|
9294
9629
|
*/
|
|
9295
|
-
declare function deriveUserWalletAddress(
|
|
9630
|
+
declare function deriveUserWalletAddress(hubProvider: EvmHubProvider, spokeChainId: SpokeChainId, spokeAddress: string): Promise<Address>;
|
|
9296
9631
|
declare function parseToStroops(amount: string): bigint;
|
|
9297
9632
|
declare function sleep(ms: number): Promise<void>;
|
|
9298
9633
|
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
declare const MAX_UINT256: bigint;
|
|
9304
|
-
declare const FEE_PERCENTAGE_SCALE = 10000n;
|
|
9305
|
-
declare const STELLAR_PRIORITY_FEE = "10000";
|
|
9306
|
-
declare const STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = 100;
|
|
9307
|
-
declare const DEFAULT_DEADLINE_OFFSET = 300n;
|
|
9308
|
-
declare const DEFAULT_BACKEND_API_ENDPOINT = "https://api.sodax.com/v1/be";
|
|
9309
|
-
declare const DEFAULT_BACKEND_API_TIMEOUT = 30000;
|
|
9310
|
-
declare const DEFAULT_BACKEND_API_HEADERS: {
|
|
9311
|
-
'Content-Type': string;
|
|
9312
|
-
Accept: string;
|
|
9634
|
+
type IcxMigrateParams = {
|
|
9635
|
+
address: IcxTokenType;
|
|
9636
|
+
amount: bigint;
|
|
9637
|
+
to: Address$1;
|
|
9313
9638
|
};
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
blockExplorers: {
|
|
9318
|
-
readonly default: {
|
|
9319
|
-
readonly name: "HyperEVMScan";
|
|
9320
|
-
readonly url: "https://hyperevmscan.io/";
|
|
9321
|
-
};
|
|
9322
|
-
};
|
|
9323
|
-
contracts: {
|
|
9324
|
-
readonly multicall3: {
|
|
9325
|
-
readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
9326
|
-
readonly blockCreated: 13051;
|
|
9327
|
-
};
|
|
9328
|
-
};
|
|
9329
|
-
ensTlds?: readonly string[] | undefined;
|
|
9330
|
-
id: 999;
|
|
9331
|
-
name: "HyperEVM";
|
|
9332
|
-
nativeCurrency: {
|
|
9333
|
-
readonly decimals: 18;
|
|
9334
|
-
readonly name: "HYPE";
|
|
9335
|
-
readonly symbol: "HYPE";
|
|
9336
|
-
};
|
|
9337
|
-
rpcUrls: {
|
|
9338
|
-
readonly default: {
|
|
9339
|
-
readonly http: readonly ["https://rpc.hyperliquid.xyz/evm"];
|
|
9340
|
-
};
|
|
9341
|
-
};
|
|
9342
|
-
sourceId?: number | undefined;
|
|
9343
|
-
testnet?: boolean | undefined;
|
|
9344
|
-
custom?: Record<string, unknown> | undefined;
|
|
9345
|
-
fees?: viem.ChainFees<undefined> | undefined;
|
|
9346
|
-
formatters?: undefined;
|
|
9347
|
-
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
9639
|
+
type IcxCreateRevertMigrationParams = {
|
|
9640
|
+
amount: bigint;
|
|
9641
|
+
to: IconEoaAddress;
|
|
9348
9642
|
};
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
declare const newbnUSDSpokeChainIds: ("0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "sonic" | "0xa.optimism" | "0x89.polygon" | "hyper" | "lightlink" | "ethereum" | "sui" | "stellar" | "injective-1" | "solana")[];
|
|
9352
|
-
declare const bnUSDLegacyTokens: readonly [{
|
|
9353
|
-
readonly symbol: "bnUSD (legacy)";
|
|
9354
|
-
readonly name: "bnUSD";
|
|
9355
|
-
readonly decimals: 18;
|
|
9356
|
-
readonly address: "cx88fd7df7ddff82f7cc735c871dc519838cb235bb";
|
|
9357
|
-
readonly xChainId: "0x1.icon";
|
|
9358
|
-
}, {
|
|
9359
|
-
readonly symbol: "bnUSD (legacy)";
|
|
9360
|
-
readonly name: "legacybnUSD";
|
|
9361
|
-
readonly decimals: 9;
|
|
9362
|
-
readonly address: "0x03917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR";
|
|
9363
|
-
readonly xChainId: "sui";
|
|
9364
|
-
}, {
|
|
9365
|
-
readonly symbol: "bnUSD (legacy)";
|
|
9366
|
-
readonly name: "legacybnUSD";
|
|
9367
|
-
readonly decimals: 18;
|
|
9368
|
-
readonly address: "CCT4ZYIYZ3TUO2AWQFEOFGBZ6HQP3GW5TA37CK7CRZVFRDXYTHTYX7KP";
|
|
9369
|
-
readonly xChainId: "stellar";
|
|
9370
|
-
}];
|
|
9371
|
-
declare const bnUSDNewTokens: ({
|
|
9372
|
-
readonly symbol: "bnUSD";
|
|
9373
|
-
readonly name: "bnUSD";
|
|
9374
|
-
readonly decimals: 9;
|
|
9375
|
-
readonly address: "0xff4de2b2b57dd7611d2812d231a467d007b702a101fd5c7ad3b278257cddb507::bnusd::BNUSD";
|
|
9376
|
-
readonly xChainId: "sui";
|
|
9377
|
-
} | {
|
|
9378
|
-
readonly symbol: "bnUSD";
|
|
9379
|
-
readonly name: "bnUSD";
|
|
9380
|
-
readonly decimals: 7;
|
|
9381
|
-
readonly address: "CD6YBFFWMU2UJHX2NGRJ7RN76IJVTCC7MRA46DUBXNB7E6W7H7JRJ2CX";
|
|
9382
|
-
readonly xChainId: "stellar";
|
|
9383
|
-
} | {
|
|
9384
|
-
readonly symbol: "bnUSD";
|
|
9385
|
-
readonly name: "bnUSD";
|
|
9386
|
-
readonly decimals: 18;
|
|
9387
|
-
readonly address: "0x6958a4CBFe11406E2a1c1d3a71A1971aD8B3b92F";
|
|
9388
|
-
readonly xChainId: "0xa86a.avax";
|
|
9389
|
-
} | {
|
|
9390
|
-
readonly symbol: "bnUSD";
|
|
9391
|
-
readonly name: "bnUSD";
|
|
9392
|
-
readonly decimals: 18;
|
|
9393
|
-
readonly address: "0xA256dd181C3f6E5eC68C6869f5D50a712d47212e";
|
|
9394
|
-
readonly xChainId: "0xa4b1.arbitrum";
|
|
9395
|
-
} | {
|
|
9396
|
-
readonly symbol: "bnUSD";
|
|
9397
|
-
readonly name: "bnUSD";
|
|
9398
|
-
readonly decimals: 18;
|
|
9399
|
-
readonly address: "0xAcfab3F31C0a18559D78556BBf297EC29c6cf8aa";
|
|
9400
|
-
readonly xChainId: "0x2105.base";
|
|
9401
|
-
} | {
|
|
9402
|
-
readonly symbol: "bnUSD";
|
|
9403
|
-
readonly name: "bnUSD";
|
|
9404
|
-
readonly decimals: 18;
|
|
9405
|
-
readonly address: "0x8428FedC020737a5A2291F46cB1B80613eD71638";
|
|
9406
|
-
readonly xChainId: "0x38.bsc";
|
|
9407
|
-
} | {
|
|
9408
|
-
readonly symbol: "bnUSD";
|
|
9409
|
-
readonly name: "Balanced Dollar";
|
|
9410
|
-
readonly decimals: 18;
|
|
9411
|
-
readonly address: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131";
|
|
9412
|
-
readonly xChainId: "sonic";
|
|
9413
|
-
} | {
|
|
9414
|
-
readonly symbol: "bnUSD";
|
|
9415
|
-
readonly name: "bnUSD";
|
|
9416
|
-
readonly decimals: 18;
|
|
9417
|
-
readonly address: "0xF4f7dC27c17470a26d0de9039Cf0EA5045F100E8";
|
|
9418
|
-
readonly xChainId: "0xa.optimism";
|
|
9419
|
-
} | {
|
|
9420
|
-
readonly symbol: "bnUSD";
|
|
9421
|
-
readonly name: "bnUSD";
|
|
9422
|
-
readonly decimals: 18;
|
|
9423
|
-
readonly address: "0x39E77f86C1B1f3fbAb362A82b49D2E86C09659B4";
|
|
9424
|
-
readonly xChainId: "0x89.polygon";
|
|
9425
|
-
} | {
|
|
9426
|
-
readonly symbol: "bnUSD";
|
|
9427
|
-
readonly name: "bnUSD";
|
|
9428
|
-
readonly decimals: 18;
|
|
9429
|
-
readonly address: "0x506Ba7C8d91dAdf7a91eE677a205D9687b751579";
|
|
9430
|
-
readonly xChainId: "hyper";
|
|
9431
|
-
} | {
|
|
9432
|
-
readonly symbol: "bnUSD";
|
|
9433
|
-
readonly name: "bnUSD";
|
|
9434
|
-
readonly decimals: 18;
|
|
9435
|
-
readonly address: "0x36134A03dcD03Bbe858B8F7ED28a71AAC608F9E7";
|
|
9436
|
-
readonly xChainId: "lightlink";
|
|
9437
|
-
} | {
|
|
9438
|
-
readonly symbol: "bnUSD";
|
|
9439
|
-
readonly name: "bnUSD";
|
|
9440
|
-
readonly decimals: 18;
|
|
9441
|
-
readonly address: "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13";
|
|
9442
|
-
readonly xChainId: "ethereum";
|
|
9443
|
-
} | {
|
|
9444
|
-
readonly symbol: "bnUSD";
|
|
9445
|
-
readonly name: "bnUSD";
|
|
9446
|
-
readonly decimals: 18;
|
|
9447
|
-
readonly address: "factory/inj1d036ftaatxpkqsu9hja8r24rv3v33chz3appxp/bnUSD";
|
|
9448
|
-
readonly xChainId: "injective-1";
|
|
9449
|
-
} | {
|
|
9450
|
-
readonly symbol: "bnUSD";
|
|
9451
|
-
readonly name: "bnUSD";
|
|
9452
|
-
readonly decimals: 9;
|
|
9453
|
-
readonly address: "3rSPCLNEF7Quw4wX8S1NyKivELoyij8eYA2gJwBgt4V5";
|
|
9454
|
-
readonly xChainId: "solana";
|
|
9455
|
-
})[];
|
|
9456
|
-
declare const isLegacybnUSDChainId: (chainId: SpokeChainId) => boolean;
|
|
9457
|
-
declare const isNewbnUSDChainId: (chainId: SpokeChainId) => boolean;
|
|
9458
|
-
declare const isLegacybnUSDToken: (token: Token | string) => boolean;
|
|
9459
|
-
declare const isNewbnUSDToken: (token: Token | string) => boolean;
|
|
9460
|
-
declare const getAllLegacybnUSDTokens: () => {
|
|
9461
|
-
token: LegacybnUSDToken;
|
|
9462
|
-
chainId: LegacybnUSDChainId;
|
|
9463
|
-
}[];
|
|
9464
|
-
|
|
9465
|
-
declare function isEvmHubChainConfig(value: HubChainConfig): value is EvmHubChainConfig;
|
|
9466
|
-
declare function isEvmSpokeChainConfig(value: SpokeChainConfig): value is EvmSpokeChainConfig;
|
|
9467
|
-
declare function isEvmUninitializedConfig(value: EvmUninitializedConfig | EvmInitializedConfig): value is EvmUninitializedConfig;
|
|
9468
|
-
declare function isEvmInitializedConfig(value: EvmUninitializedConfig | EvmInitializedConfig): value is EvmInitializedConfig;
|
|
9469
|
-
declare function isEvmUninitializedBrowserConfig(value: EvmUninitializedConfig): value is EvmUninitializedBrowserConfig;
|
|
9470
|
-
declare function isEvmUninitializedPrivateKeyConfig(value: EvmUninitializedConfig): value is EvmUninitializedPrivateKeyConfig;
|
|
9471
|
-
declare function isIconAddress(value: unknown): value is IconAddress;
|
|
9472
|
-
declare function isResponseAddressType(value: unknown): value is ResponseAddressType;
|
|
9473
|
-
declare function isResponseSigningType(value: unknown): value is ResponseSigningType;
|
|
9474
|
-
declare function isJsonRpcPayloadResponse(value: unknown): value is JsonRpcPayloadResponse;
|
|
9475
|
-
declare function isIntentRelayChainId(value: bigint): value is IntentRelayChainId;
|
|
9476
|
-
declare function isPartnerFeeAmount(value: unknown): value is PartnerFeeAmount;
|
|
9477
|
-
declare function isPartnerFeePercentage(value: unknown): value is PartnerFeePercentage;
|
|
9478
|
-
declare function isEvmSpokeProvider(value: SpokeProvider): value is EvmSpokeProvider;
|
|
9479
|
-
declare function isSonicSpokeProvider(value: SpokeProvider): value is SonicSpokeProvider;
|
|
9480
|
-
declare function isSolanaSpokeProvider(value: SpokeProvider): value is SolanaSpokeProvider;
|
|
9481
|
-
declare function isStellarSpokeProvider(value: SpokeProvider): value is StellarSpokeProvider;
|
|
9482
|
-
declare function isInjectiveSpokeProvider(value: SpokeProvider): value is InjectiveSpokeProvider;
|
|
9483
|
-
declare function isIconSpokeProvider(value: SpokeProvider): value is IconSpokeProvider;
|
|
9484
|
-
declare function isSuiSpokeProvider(value: SpokeProvider): value is SuiSpokeProvider;
|
|
9485
|
-
declare function isConfiguredSolverConfig(value: SolverConfigParams): value is Prettify<SolverConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
|
|
9486
|
-
declare function isConfiguredMoneyMarketConfig(value: MoneyMarketConfigParams): value is Prettify<MoneyMarketConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
|
|
9487
|
-
declare function isIntentCreationFailedError(error: unknown): error is IntentError<'CREATION_FAILED'>;
|
|
9488
|
-
declare function isIntentSubmitTxFailedError(error: unknown): error is IntentError<'SUBMIT_TX_FAILED'>;
|
|
9489
|
-
declare function isIntentPostExecutionFailedError(error: unknown): error is IntentError<'POST_EXECUTION_FAILED'>;
|
|
9490
|
-
declare function isWaitUntilIntentExecutedFailed(error: unknown): error is IntentError<'RELAY_TIMEOUT'>;
|
|
9491
|
-
declare function isIntentCreationUnknownError(error: unknown): error is IntentError<'UNKNOWN'>;
|
|
9492
|
-
declare function isMoneyMarketSubmitTxFailedError(error: unknown): error is MoneyMarketError<'SUBMIT_TX_FAILED'>;
|
|
9493
|
-
declare function isMoneyMarketRelayTimeoutError(error: unknown): error is MoneyMarketError<'RELAY_TIMEOUT'>;
|
|
9494
|
-
declare function isMoneyMarketCreateSupplyIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED'>;
|
|
9495
|
-
declare function isMoneyMarketCreateBorrowIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_BORROW_INTENT_FAILED'>;
|
|
9496
|
-
declare function isMoneyMarketCreateWithdrawIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED'>;
|
|
9497
|
-
declare function isMoneyMarketCreateRepayIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_REPAY_INTENT_FAILED'>;
|
|
9498
|
-
declare function isMoneyMarketSupplyUnknownError(error: unknown): error is MoneyMarketUnknownError<'SUPPLY_UNKNOWN_ERROR'>;
|
|
9499
|
-
declare function isMoneyMarketBorrowUnknownError(error: unknown): error is MoneyMarketUnknownError<'BORROW_UNKNOWN_ERROR'>;
|
|
9500
|
-
declare function isMoneyMarketWithdrawUnknownError(error: unknown): error is MoneyMarketUnknownError<'WITHDRAW_UNKNOWN_ERROR'>;
|
|
9501
|
-
declare function isMoneyMarketRepayUnknownError(error: unknown): error is MoneyMarketUnknownError<'REPAY_UNKNOWN_ERROR'>;
|
|
9502
|
-
declare function isIcxMigrateParams(value: unknown): value is IcxMigrateParams;
|
|
9503
|
-
declare function isUnifiedBnUSDMigrateParams(value: unknown): value is UnifiedBnUSDMigrateParams;
|
|
9504
|
-
declare function isBalnMigrateParams(value: unknown): value is BalnMigrateParams;
|
|
9505
|
-
declare function isIcxCreateRevertMigrationParams(value: unknown): value is IcxCreateRevertMigrationParams;
|
|
9506
|
-
|
|
9507
|
-
type CreateBridgeIntentParams = {
|
|
9508
|
-
srcChainId: SpokeChainId;
|
|
9509
|
-
srcAsset: string;
|
|
9643
|
+
type IcxRevertMigrationParams = {
|
|
9644
|
+
wICX: IconAddress;
|
|
9510
9645
|
amount: bigint;
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
recipient: string;
|
|
9514
|
-
};
|
|
9515
|
-
type BridgeParams<S extends SpokeProvider> = Prettify<{
|
|
9516
|
-
params: CreateBridgeIntentParams;
|
|
9517
|
-
spokeProvider: S;
|
|
9518
|
-
skipSimulation?: boolean;
|
|
9519
|
-
} & OptionalFee>;
|
|
9520
|
-
type BridgeErrorCode = 'ALLOWANCE_CHECK_FAILED' | 'APPROVAL_FAILED' | 'CREATE_BRIDGE_INTENT_FAILED' | 'BRIDGE_FAILED' | RelayErrorCode;
|
|
9521
|
-
type BridgeError<T extends BridgeErrorCode> = {
|
|
9522
|
-
code: T;
|
|
9523
|
-
error: unknown;
|
|
9524
|
-
};
|
|
9525
|
-
type BridgeExtraData = {
|
|
9526
|
-
address: Hex$1;
|
|
9527
|
-
payload: Hex$1;
|
|
9528
|
-
};
|
|
9529
|
-
type BridgeOptionalExtraData = {
|
|
9530
|
-
data?: BridgeExtraData;
|
|
9646
|
+
userWallet: Address$1;
|
|
9647
|
+
to: Hex;
|
|
9531
9648
|
};
|
|
9532
|
-
type
|
|
9649
|
+
type IcxMigrationServiceConstructorParams = {
|
|
9533
9650
|
hubProvider: EvmHubProvider;
|
|
9534
|
-
relayerApiEndpoint: HttpUrl;
|
|
9535
|
-
config: BridgeServiceConfig | undefined;
|
|
9536
9651
|
configService: ConfigService;
|
|
9537
9652
|
};
|
|
9538
9653
|
/**
|
|
9539
|
-
*
|
|
9540
|
-
*
|
|
9541
|
-
* By using soda tokens as src or destinatin address.
|
|
9542
|
-
* @param hubProvider - The hub provider
|
|
9543
|
-
* @param relayerApiEndpoint - The relayer API endpoint
|
|
9654
|
+
* Service for handling ICX migration operations on the hub chain.
|
|
9655
|
+
* Provides functionality to migrate wICX tokens from ICON to the hub chain.
|
|
9544
9656
|
*/
|
|
9545
|
-
declare class
|
|
9546
|
-
readonly hubProvider
|
|
9547
|
-
readonly
|
|
9548
|
-
|
|
9549
|
-
readonly configService: ConfigService;
|
|
9550
|
-
constructor({ hubProvider, relayerApiEndpoint, config, configService }: BridgeServiceConstructorParams);
|
|
9657
|
+
declare class IcxMigrationService {
|
|
9658
|
+
private readonly hubProvider;
|
|
9659
|
+
private readonly configService;
|
|
9660
|
+
constructor({ hubProvider, configService }: IcxMigrationServiceConstructorParams);
|
|
9551
9661
|
/**
|
|
9552
|
-
*
|
|
9553
|
-
*
|
|
9554
|
-
* @returns {Promise<bigint>} The fee amount (denominated in input tokens)
|
|
9662
|
+
* Retrieves the available amount of SODA tokens in the ICX migration contract.
|
|
9663
|
+
* This represents the amount of tokens available for migration.
|
|
9555
9664
|
*
|
|
9556
|
-
* @
|
|
9557
|
-
* const fee: bigint = await sodax.bridge.getFee(1000000000000000n);
|
|
9558
|
-
* console.log('Fee:', fee);
|
|
9665
|
+
* @returns The available balance of SODA tokens in the migration contract
|
|
9559
9666
|
*/
|
|
9560
|
-
|
|
9667
|
+
getAvailableAmount(): Promise<bigint>;
|
|
9561
9668
|
/**
|
|
9562
|
-
*
|
|
9563
|
-
*
|
|
9564
|
-
*
|
|
9565
|
-
*
|
|
9669
|
+
* Generates transaction data for migrating wICX tokens from ICON to the hub chain.
|
|
9670
|
+
* This method creates the necessary contract calls to:
|
|
9671
|
+
* 1. Approve the migration contract to spend the wICX tokens
|
|
9672
|
+
* 2. Execute the migration swap
|
|
9673
|
+
*
|
|
9674
|
+
* @param params - The migration parameters including token address, amount, and recipient
|
|
9675
|
+
* @returns Encoded transaction data for the migration operation
|
|
9676
|
+
* @throws Will throw an error if the hub asset configuration is not found
|
|
9566
9677
|
*/
|
|
9567
|
-
|
|
9678
|
+
migrateData(params: IcxMigrateParams): Hex;
|
|
9568
9679
|
/**
|
|
9569
|
-
*
|
|
9570
|
-
* @param params - The
|
|
9571
|
-
* @
|
|
9572
|
-
* @
|
|
9573
|
-
* @returns Promise<Result<TxReturnType<S, R>, BridgeError<'APPROVAL_FAILED'>>>
|
|
9680
|
+
* Generates transaction data for migrating back tokens to the ICON chain.
|
|
9681
|
+
* @param params - The migration parameters including token address, amount, and recipient
|
|
9682
|
+
* @returns Encoded transaction data for the migration operation
|
|
9683
|
+
* @throws Will throw an error if the hub asset configuration is not found
|
|
9574
9684
|
*/
|
|
9575
|
-
|
|
9685
|
+
revertMigration(params: IcxRevertMigrationParams): Hex;
|
|
9576
9686
|
/**
|
|
9577
|
-
*
|
|
9578
|
-
*
|
|
9579
|
-
* @param spokeProvider - The spoke provider for the source chain
|
|
9580
|
-
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
9581
|
-
* @returns {Promise<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>>} - Returns the transaction hashes for both spoke and hub chains or error
|
|
9582
|
-
*
|
|
9583
|
-
* @example
|
|
9584
|
-
* const result = await sodax.bridge.bridge(
|
|
9585
|
-
* {
|
|
9586
|
-
* srcChainId: '0x2105.base',
|
|
9587
|
-
* srcAsset: '0x...', // Address of the source token
|
|
9588
|
-
* amount: 1000n, // Amount to bridge (in token decimals)
|
|
9589
|
-
* dstChainId: '0x89.polygon',
|
|
9590
|
-
* dstAsset: '0x...', // Address of the destination token
|
|
9591
|
-
* recipient: '0x...', // Recipient address on destination chain
|
|
9592
|
-
* partnerFee: { address: '0x...', percentage: 0.1 } // Optional partner fee. Partner fees and denominated in vault token decimals (18)
|
|
9593
|
-
* },
|
|
9594
|
-
* spokeProvider,
|
|
9595
|
-
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
9596
|
-
* );
|
|
9597
|
-
*
|
|
9598
|
-
* if (!result.ok) {
|
|
9599
|
-
* // Handle error
|
|
9600
|
-
* }
|
|
9687
|
+
* Encodes a migration transaction for the ICX swap contract.
|
|
9688
|
+
* This creates the contract call data for swapping wICX tokens to SODA tokens.
|
|
9601
9689
|
*
|
|
9602
|
-
*
|
|
9603
|
-
*
|
|
9604
|
-
*
|
|
9605
|
-
* ] = result.value;
|
|
9606
|
-
* console.log('Bridge transaction hashes:', { spokeTxHash, hubTxHash });
|
|
9690
|
+
* @param amount - The amount of wICX tokens to migrate
|
|
9691
|
+
* @param to - The address that will receive the migrated SODA tokens
|
|
9692
|
+
* @returns The encoded contract call for the migration operation
|
|
9607
9693
|
*/
|
|
9608
|
-
|
|
9694
|
+
encodeMigrate(amount: bigint, to: Address$1): EvmContractCall;
|
|
9609
9695
|
/**
|
|
9610
|
-
*
|
|
9611
|
-
*
|
|
9612
|
-
* In order to successfully bridge tokens, you need to:
|
|
9613
|
-
* 1. Check if the allowance is sufficient using isAllowanceValid
|
|
9614
|
-
* 2. Approve the appropriate contract to spend the tokens using approve
|
|
9615
|
-
* 3. Create the bridge intent using this method
|
|
9616
|
-
* 4. Relay the transaction to the hub and await completion using the bridge method
|
|
9617
|
-
*
|
|
9618
|
-
* @param params - The bridge parameters including source/destination chains, assets, and recipient
|
|
9619
|
-
* @param spokeProvider - The spoke provider for the source chain
|
|
9620
|
-
* @param raw - Whether to return the raw transaction data
|
|
9621
|
-
* @returns {Promise<Result<TxReturnType<S, R>, BridgeError<BridgeErrorCode>>>} - Returns the transaction result
|
|
9622
|
-
*
|
|
9623
|
-
* @example
|
|
9624
|
-
* const bridgeService = new BridgeService(hubProvider, relayerApiEndpoint);
|
|
9625
|
-
* const result = await sodax.bridge.createBridgeIntent(
|
|
9626
|
-
* {
|
|
9627
|
-
* srcChainId: 'ethereum',
|
|
9628
|
-
* srcAsset: "0x123...", // source token address
|
|
9629
|
-
* amount: 1000000000000000000n, // 1 token in wei
|
|
9630
|
-
* dstChainId: 'polygon',
|
|
9631
|
-
* dstAsset: "0x456...", // destination token address
|
|
9632
|
-
* recipient: "0x789..." // recipient address
|
|
9633
|
-
* },
|
|
9634
|
-
* spokeProvider,
|
|
9635
|
-
* raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
|
|
9636
|
-
* );
|
|
9696
|
+
* Encodes a revert migration transaction for the ICX swap contract.
|
|
9697
|
+
* This creates the contract call data for swapping SODA tokens to wICX tokens.
|
|
9637
9698
|
*
|
|
9638
|
-
*
|
|
9639
|
-
*
|
|
9640
|
-
*
|
|
9641
|
-
* } else {
|
|
9642
|
-
* console.error('Bridge intent creation failed:', result.error);
|
|
9643
|
-
* }
|
|
9644
|
-
*/
|
|
9645
|
-
createBridgeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, fee, raw, }: Prettify<BridgeParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>, BridgeError<'CREATE_BRIDGE_INTENT_FAILED'>> & BridgeOptionalExtraData>;
|
|
9646
|
-
/**
|
|
9647
|
-
* Build the bridge transaction data for executing the bridge operation on the hub
|
|
9648
|
-
* @param params - The create bridge intent parameters
|
|
9649
|
-
* @param srcAssetInfo - The source asset information
|
|
9650
|
-
* @param dstAssetInfo - The destination asset information
|
|
9651
|
-
* @returns Hex - The encoded contract calls for the bridge operation
|
|
9699
|
+
* @param amount - The amount of wICX tokens to migrate
|
|
9700
|
+
* @param to - The address that will receive the migrated SODA tokens
|
|
9701
|
+
* @returns The encoded contract call for the migration operation
|
|
9652
9702
|
*/
|
|
9653
|
-
|
|
9703
|
+
encodeRevertMigration(amount: bigint, to: Address$1): EvmContractCall;
|
|
9704
|
+
}
|
|
9705
|
+
|
|
9706
|
+
type UnifiedBnUSDMigrateParams = {
|
|
9707
|
+
srcChainId: SpokeChainId;
|
|
9708
|
+
srcbnUSD: string;
|
|
9709
|
+
dstChainId: SpokeChainId;
|
|
9710
|
+
dstbnUSD: string;
|
|
9711
|
+
amount: bigint;
|
|
9712
|
+
to: string;
|
|
9713
|
+
};
|
|
9714
|
+
type FormattedBnUSDMigrateParams = {
|
|
9715
|
+
srcChainId: SpokeChainId;
|
|
9716
|
+
legacybnUSD: string;
|
|
9717
|
+
newbnUSD: string;
|
|
9718
|
+
amount: bigint;
|
|
9719
|
+
to: Hex;
|
|
9720
|
+
dstChainId: SpokeChainId;
|
|
9721
|
+
};
|
|
9722
|
+
type BnUSDRevertMigrationParams = {
|
|
9723
|
+
srcChainId: SpokeChainId;
|
|
9724
|
+
legacybnUSD: string;
|
|
9725
|
+
newbnUSD: string;
|
|
9726
|
+
amount: bigint;
|
|
9727
|
+
to: Hex;
|
|
9728
|
+
dstChainId: SpokeChainId;
|
|
9729
|
+
};
|
|
9730
|
+
type BnUSDMigrationServiceConstructorParams = {
|
|
9731
|
+
hubProvider: EvmHubProvider;
|
|
9732
|
+
configService: ConfigService;
|
|
9733
|
+
};
|
|
9734
|
+
/**
|
|
9735
|
+
* Service for handling bnUSD migration operations on the hub chain.
|
|
9736
|
+
* Provides functionality to migrate between legacy and new bnUSD tokens.
|
|
9737
|
+
*/
|
|
9738
|
+
declare class BnUSDMigrationService {
|
|
9739
|
+
private readonly hubProvider;
|
|
9740
|
+
private readonly configService;
|
|
9741
|
+
constructor({ hubProvider, configService }: BnUSDMigrationServiceConstructorParams);
|
|
9654
9742
|
/**
|
|
9655
|
-
*
|
|
9656
|
-
* This
|
|
9657
|
-
*
|
|
9743
|
+
* Generates transaction data for migrating legacy bnUSD tokens to new bnUSD tokens.
|
|
9744
|
+
* This method creates the necessary contract calls to:
|
|
9745
|
+
* 1. Wrap legacy bnUSD into vault tokens
|
|
9746
|
+
* 2. Migrate to new bnUSD vault
|
|
9747
|
+
* 3. Withdraw to new bnUSD tokens
|
|
9658
9748
|
*
|
|
9659
|
-
* @param
|
|
9660
|
-
* @
|
|
9661
|
-
* @
|
|
9662
|
-
*/
|
|
9663
|
-
getBridgeableAmount(from: XToken, to: XToken): Promise<Result<bigint, unknown>>;
|
|
9664
|
-
/**
|
|
9665
|
-
* Check if two assets on different chains are bridgeable
|
|
9666
|
-
* Two assets are bridgeable if they share the same vault on the hub chain
|
|
9667
|
-
* @param from - The source X token
|
|
9668
|
-
* @param to - The destination X token
|
|
9669
|
-
* @param unchecked - Whether to skip the chain ID validation
|
|
9670
|
-
* @returns boolean - true if assets are bridgeable, false otherwise
|
|
9749
|
+
* @param params - The migration parameters including token addresses, amount, and recipient
|
|
9750
|
+
* @returns Encoded transaction data for the migration operation
|
|
9751
|
+
* @throws Will throw an error if the hub asset configuration is not found
|
|
9671
9752
|
*/
|
|
9672
|
-
|
|
9673
|
-
from: XToken;
|
|
9674
|
-
to: XToken;
|
|
9675
|
-
unchecked?: boolean;
|
|
9676
|
-
}): boolean;
|
|
9753
|
+
migrateData(params: FormattedBnUSDMigrateParams): Hex;
|
|
9677
9754
|
/**
|
|
9678
|
-
*
|
|
9679
|
-
*
|
|
9680
|
-
*
|
|
9681
|
-
*
|
|
9682
|
-
*
|
|
9755
|
+
* Generates transaction data for migrating new bnUSD tokens back to legacy bnUSD tokens.
|
|
9756
|
+
* This method creates the necessary contract calls to:
|
|
9757
|
+
* 1. Wrap new bnUSD into vault tokens
|
|
9758
|
+
* 2. Migrate to legacy bnUSD vault
|
|
9759
|
+
* 3. Withdraw to legacy bnUSD tokens
|
|
9760
|
+
*
|
|
9761
|
+
* @param params - The migration parameters including token addresses, amount, and recipient
|
|
9762
|
+
* @returns Encoded transaction data for the migration operation
|
|
9763
|
+
* @throws Will throw an error if the hub asset configuration is not found
|
|
9683
9764
|
*/
|
|
9684
|
-
|
|
9685
|
-
filterTokensWithSameVault(tokens: Record<string, XToken>, to: SpokeChainId, srcAssetInfo: HubAssetInfo | undefined): XToken[];
|
|
9765
|
+
revertMigrationData(params: BnUSDRevertMigrationParams): Hex;
|
|
9686
9766
|
}
|
|
9687
9767
|
|
|
9688
|
-
|
|
9689
|
-
|
|
9768
|
+
/**
|
|
9769
|
+
* Lockup periods in seconds
|
|
9770
|
+
*/
|
|
9771
|
+
declare enum LockupPeriod {
|
|
9772
|
+
NO_LOCKUP = 0,
|
|
9773
|
+
SIX_MONTHS = 15552000,// 6 months
|
|
9774
|
+
TWELVE_MONTHS = 31104000,// 12 months
|
|
9775
|
+
EIGHTEEN_MONTHS = 46656000,// 18 months
|
|
9776
|
+
TWENTY_FOUR_MONTHS = 62208000
|
|
9777
|
+
}
|
|
9778
|
+
/**
|
|
9779
|
+
* Reward multipliers (in basis points, 10000 = 1.0)
|
|
9780
|
+
*/
|
|
9781
|
+
declare enum LockupMultiplier {
|
|
9782
|
+
NO_LOCKUP_MULTIPLIER = 5000,// 0.5x
|
|
9783
|
+
SIX_MONTHS_MULTIPLIER = 7500,// 0.75x
|
|
9784
|
+
TWELVE_MONTHS_MULTIPLIER = 10000,// 1.0x
|
|
9785
|
+
EIGHTEEN_MONTHS_MULTIPLIER = 12500,// 1.25x
|
|
9786
|
+
TWENTY_FOUR_MONTHS_MULTIPLIER = 15000
|
|
9787
|
+
}
|
|
9788
|
+
/**
|
|
9789
|
+
* Unstake request information from the staked SODA contract.
|
|
9790
|
+
*/
|
|
9791
|
+
type UnstakeRequest = {
|
|
9792
|
+
/** The amount being unstaked */
|
|
9793
|
+
amount: bigint;
|
|
9794
|
+
/** The start time of the unstake request */
|
|
9795
|
+
startTime: bigint;
|
|
9796
|
+
/** The address to receive the unstaked tokens */
|
|
9797
|
+
to: Address$1;
|
|
9798
|
+
};
|
|
9799
|
+
/**
|
|
9800
|
+
* Detailed lock information structure returned by the BALN swap contract.
|
|
9801
|
+
*/
|
|
9802
|
+
type DetailedLock = {
|
|
9803
|
+
/** The amount of BALN tokens in the lock */
|
|
9804
|
+
balnAmount: bigint;
|
|
9805
|
+
/** The amount of SODA tokens in the lock */
|
|
9806
|
+
sodaAmount: bigint;
|
|
9807
|
+
/** The unlock time for the lock */
|
|
9808
|
+
unlockTime: bigint;
|
|
9809
|
+
/** The amount of xSODA tokens in the lock */
|
|
9810
|
+
xSodaAmount: bigint;
|
|
9811
|
+
/** The unstaking ID for the lock */
|
|
9812
|
+
unstakingId: bigint;
|
|
9813
|
+
/** The unstake request information */
|
|
9814
|
+
unstakeRequest: UnstakeRequest;
|
|
9815
|
+
/** The amount of staked SODA tokens */
|
|
9816
|
+
stakedSodaAmount: bigint;
|
|
9817
|
+
};
|
|
9818
|
+
/**
|
|
9819
|
+
* Parameters for BALN swap operations.
|
|
9820
|
+
*/
|
|
9821
|
+
type BalnMigrateParams = {
|
|
9822
|
+
/** The amount of BALN tokens to swap */
|
|
9823
|
+
amount: bigint;
|
|
9824
|
+
/** The lockup period for the swap */
|
|
9825
|
+
lockupPeriod: LockupPeriod;
|
|
9826
|
+
/** The address that will receive the swapped SODA tokens */
|
|
9827
|
+
to: Address$1;
|
|
9828
|
+
/** Whether to stake the SODA tokens */
|
|
9829
|
+
stake: boolean;
|
|
9830
|
+
};
|
|
9831
|
+
/**
|
|
9832
|
+
* Parameters for BALN lock operations.
|
|
9833
|
+
*/
|
|
9834
|
+
type BalnLockParams = {
|
|
9835
|
+
/** The lock ID to operate on */
|
|
9836
|
+
lockId: bigint;
|
|
9837
|
+
};
|
|
9838
|
+
type BalnSwapServiceConstructorParams = {
|
|
9839
|
+
hubProvider: EvmHubProvider;
|
|
9840
|
+
};
|
|
9841
|
+
/**
|
|
9842
|
+
* Service for handling BALN swap operations on the hub chain.
|
|
9843
|
+
* Provides functionality to interact directly with the BALN swap contract.
|
|
9844
|
+
*/
|
|
9845
|
+
declare class BalnSwapService {
|
|
9846
|
+
private readonly hubProvider;
|
|
9847
|
+
constructor({ hubProvider }: BalnSwapServiceConstructorParams);
|
|
9690
9848
|
/**
|
|
9691
|
-
*
|
|
9692
|
-
* @param
|
|
9693
|
-
* @
|
|
9694
|
-
* @param publicClient - PublicClient<HttpTransport>
|
|
9695
|
-
* @returns Array of user unstake info for the user.
|
|
9849
|
+
* Gets the multiplier for a given lockup period.
|
|
9850
|
+
* @param lockupPeriod - The lockup period
|
|
9851
|
+
* @returns The multiplier in basis points
|
|
9696
9852
|
*/
|
|
9697
|
-
|
|
9853
|
+
getMultiplierForPeriod(lockupPeriod: LockupPeriod): bigint;
|
|
9698
9854
|
/**
|
|
9699
|
-
*
|
|
9700
|
-
* @param
|
|
9701
|
-
* @param
|
|
9702
|
-
* @
|
|
9703
|
-
* @returns The encoded contract call data.
|
|
9855
|
+
* Calculates the SODA amount for a given BALN amount and lockup period without calling the contract.
|
|
9856
|
+
* @param balnAmount - The amount of BALN tokens
|
|
9857
|
+
* @param lockupPeriod - The lockup period
|
|
9858
|
+
* @returns The calculated SODA amount
|
|
9704
9859
|
*/
|
|
9705
|
-
|
|
9860
|
+
calculateSodaAmount(balnAmount: bigint, lockupPeriod: LockupPeriod): bigint;
|
|
9706
9861
|
/**
|
|
9707
|
-
*
|
|
9708
|
-
*
|
|
9709
|
-
*
|
|
9710
|
-
*
|
|
9711
|
-
*
|
|
9862
|
+
* Generates transaction data for swapping BALN tokens to SODA tokens.
|
|
9863
|
+
* This method creates the necessary contract calls to:
|
|
9864
|
+
* 1. Approve the BALN swap contract to spend the BALN tokens
|
|
9865
|
+
* 2. Execute the BALN swap with lockup period
|
|
9866
|
+
*
|
|
9867
|
+
* @param balnToken - The address of the BALN token
|
|
9868
|
+
* @param params - The BALN swap parameters including amount, lockup period, and recipient
|
|
9869
|
+
* @param configService - The config service
|
|
9870
|
+
* @returns Encoded transaction data for the BALN swap operation
|
|
9712
9871
|
*/
|
|
9713
|
-
|
|
9872
|
+
swapData(balnToken: IconContractAddress, params: BalnMigrateParams, configService: ConfigService): Hex;
|
|
9714
9873
|
/**
|
|
9715
|
-
*
|
|
9716
|
-
* @param
|
|
9717
|
-
* @param
|
|
9718
|
-
* @param
|
|
9719
|
-
* @returns The
|
|
9874
|
+
* Executes a claim operation directly through the wallet provider.
|
|
9875
|
+
* @param params - The lock parameters including lock ID
|
|
9876
|
+
* @param spokeProvider - The Sonic spoke provider
|
|
9877
|
+
* @param raw - Whether to return raw transaction data
|
|
9878
|
+
* @returns The transaction hash or raw transaction data
|
|
9720
9879
|
*/
|
|
9721
|
-
|
|
9880
|
+
claim<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
9722
9881
|
/**
|
|
9723
|
-
*
|
|
9724
|
-
* @param
|
|
9725
|
-
* @param
|
|
9726
|
-
* @
|
|
9882
|
+
* Executes a claim unstaked operation directly through the wallet provider.
|
|
9883
|
+
* @param params - The lock parameters including lock ID
|
|
9884
|
+
* @param spokeProvider - The Sonic spoke provider
|
|
9885
|
+
* @param raw - Whether to return raw transaction data
|
|
9886
|
+
* @returns The transaction hash or raw transaction data
|
|
9727
9887
|
*/
|
|
9728
|
-
|
|
9888
|
+
claimUnstaked<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
9729
9889
|
/**
|
|
9730
|
-
*
|
|
9731
|
-
* @param
|
|
9732
|
-
* @param
|
|
9733
|
-
* @
|
|
9890
|
+
* Executes a stake operation directly through the wallet provider.
|
|
9891
|
+
* @param params - The lock parameters including lock ID
|
|
9892
|
+
* @param spokeProvider - The Sonic spoke provider
|
|
9893
|
+
* @param raw - Whether to return raw transaction data
|
|
9894
|
+
* @returns The transaction hash or raw transaction data
|
|
9734
9895
|
*/
|
|
9735
|
-
|
|
9896
|
+
stake<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
9736
9897
|
/**
|
|
9737
|
-
*
|
|
9738
|
-
* @param
|
|
9739
|
-
* @param
|
|
9740
|
-
* @
|
|
9898
|
+
* Executes an unstake operation directly through the wallet provider.
|
|
9899
|
+
* @param params - The lock parameters including lock ID
|
|
9900
|
+
* @param spokeProvider - The Sonic spoke provider
|
|
9901
|
+
* @param raw - Whether to return raw transaction data
|
|
9902
|
+
* @returns The transaction hash or raw transaction data
|
|
9741
9903
|
*/
|
|
9742
|
-
|
|
9904
|
+
unstake<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
9743
9905
|
/**
|
|
9744
|
-
*
|
|
9745
|
-
* @param
|
|
9746
|
-
* @param
|
|
9747
|
-
* @
|
|
9748
|
-
|
|
9749
|
-
static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
9750
|
-
/**
|
|
9751
|
-
* Calculates the number of xSoda shares equivalent to a given amount of SODA assets.
|
|
9752
|
-
* @param xSoda - The address of the xSoda token contract.
|
|
9753
|
-
* @param assets - The amount of SODA assets to convert.
|
|
9754
|
-
* @param publicClient - PublicClient<HttpTransport>
|
|
9755
|
-
* @returns The number of xSoda shares.
|
|
9756
|
-
*/
|
|
9757
|
-
static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
9758
|
-
/**
|
|
9759
|
-
* Calculates the amount of SODA assets corresponding to a specific number of xSoda shares.
|
|
9760
|
-
* @param xSoda - The address of the xSoda token contract.
|
|
9761
|
-
* @param shares - The number of xSoda shares to convert.
|
|
9762
|
-
* @param publicClient - PublicClient<HttpTransport>
|
|
9763
|
-
* @returns The amount of SODA assets.
|
|
9764
|
-
*/
|
|
9765
|
-
static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
9766
|
-
/**
|
|
9767
|
-
* Simulates the effects of depositing SODA into xSoda without executing it.
|
|
9768
|
-
* @param xSoda - The address of the xSoda token contract.
|
|
9769
|
-
* @param assets - The amount of SODA assets to deposit.
|
|
9770
|
-
* @param publicClient - PublicClient<HttpTransport>
|
|
9771
|
-
* @returns The number of xSoda shares that would be minted.
|
|
9772
|
-
*/
|
|
9773
|
-
static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
9774
|
-
/**
|
|
9775
|
-
* Simulates the effects of minting xSoda shares without executing it.
|
|
9776
|
-
* @param xSoda - The address of the xSoda token contract.
|
|
9777
|
-
* @param shares - The number of xSoda shares to mint.
|
|
9778
|
-
* @param publicClient - PublicClient<HttpTransport>
|
|
9779
|
-
* @returns The amount of SODA assets that would be deposited.
|
|
9780
|
-
*/
|
|
9781
|
-
static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
9782
|
-
/**
|
|
9783
|
-
* Simulates the effects of withdrawing SODA from xSoda without executing it.
|
|
9784
|
-
* @param xSoda - The address of the xSoda token contract.
|
|
9785
|
-
* @param assets - The amount of SODA assets to withdraw.
|
|
9786
|
-
* @param publicClient - PublicClient<HttpTransport>
|
|
9787
|
-
* @returns The number of xSoda shares that would be burned.
|
|
9788
|
-
*/
|
|
9789
|
-
static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
9790
|
-
/**
|
|
9791
|
-
* Simulates the effects of redeeming xSoda shares without executing it.
|
|
9792
|
-
* @param xSoda - The address of the xSoda token contract.
|
|
9793
|
-
* @param shares - The number of xSoda shares to redeem.
|
|
9794
|
-
* @param publicClient - PublicClient<HttpTransport>
|
|
9795
|
-
* @returns The amount of SODA assets that would be withdrawn.
|
|
9906
|
+
* Executes a cancel unstake operation directly through the wallet provider.
|
|
9907
|
+
* @param params - The lock parameters including lock ID
|
|
9908
|
+
* @param spokeProvider - The Sonic spoke provider
|
|
9909
|
+
* @param raw - Whether to return raw transaction data
|
|
9910
|
+
* @returns The transaction hash or raw transaction data
|
|
9796
9911
|
*/
|
|
9797
|
-
|
|
9912
|
+
cancelUnstake<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
|
|
9798
9913
|
/**
|
|
9799
|
-
*
|
|
9800
|
-
*
|
|
9801
|
-
* @param
|
|
9802
|
-
* @param
|
|
9803
|
-
* @returns
|
|
9914
|
+
* Gets detailed locks for a specific user including unstake requests and staked amounts.
|
|
9915
|
+
*
|
|
9916
|
+
* @param publicClient - The public client for reading contract state
|
|
9917
|
+
* @param user - The user address
|
|
9918
|
+
* @returns Array of detailed lock information for the user
|
|
9804
9919
|
*/
|
|
9805
|
-
|
|
9920
|
+
getDetailedUserLocks(publicClient: PublicClient<HttpTransport>, user: Address$1): Promise<readonly DetailedLock[]>;
|
|
9806
9921
|
/**
|
|
9807
|
-
* Encodes
|
|
9808
|
-
*
|
|
9809
|
-
* @param
|
|
9810
|
-
* @param
|
|
9811
|
-
* @
|
|
9922
|
+
* Encodes a swap transaction for the BALN swap contract.
|
|
9923
|
+
*
|
|
9924
|
+
* @param amount - The amount of BALN tokens to swap
|
|
9925
|
+
* @param lockupPeriod - The lockup period for the swap
|
|
9926
|
+
* @param to - The address that will receive the swapped SODA tokens
|
|
9927
|
+
* @param stake - Whether to stake the SODA tokens
|
|
9928
|
+
* @returns The encoded contract call for the swap operation
|
|
9812
9929
|
*/
|
|
9813
|
-
|
|
9930
|
+
encodeSwap(amount: bigint, lockupPeriod: LockupPeriod, to: Address$1, stake: boolean): EvmContractCall;
|
|
9814
9931
|
/**
|
|
9815
|
-
* Encodes
|
|
9816
|
-
*
|
|
9817
|
-
* @param
|
|
9818
|
-
* @
|
|
9819
|
-
* @param owner - The address of the owner.
|
|
9820
|
-
* @returns The encoded contract call data.
|
|
9932
|
+
* Encodes a claim transaction for the BALN swap contract.
|
|
9933
|
+
*
|
|
9934
|
+
* @param lockId - The lock ID to claim from
|
|
9935
|
+
* @returns The encoded contract call for the claim operation
|
|
9821
9936
|
*/
|
|
9822
|
-
|
|
9937
|
+
encodeClaim(lockId: bigint): EvmContractCall;
|
|
9823
9938
|
/**
|
|
9824
|
-
* Encodes
|
|
9825
|
-
*
|
|
9826
|
-
* @param
|
|
9827
|
-
* @
|
|
9828
|
-
* @param owner - The address of the owner.
|
|
9829
|
-
* @returns The encoded contract call data.
|
|
9939
|
+
* Encodes a claim unstaked transaction for the BALN swap contract.
|
|
9940
|
+
*
|
|
9941
|
+
* @param lockId - The lock ID to claim unstaked tokens from
|
|
9942
|
+
* @returns The encoded contract call for the claim unstaked operation
|
|
9830
9943
|
*/
|
|
9831
|
-
|
|
9944
|
+
encodeClaimUnstaked(lockId: bigint): EvmContractCall;
|
|
9832
9945
|
/**
|
|
9833
|
-
* Encodes
|
|
9834
|
-
*
|
|
9835
|
-
* @param
|
|
9836
|
-
* @
|
|
9837
|
-
* @param minReceive - The minimum amount to receive.
|
|
9838
|
-
* @returns The encoded contract call data.
|
|
9946
|
+
* Encodes a stake transaction for the BALN swap contract.
|
|
9947
|
+
*
|
|
9948
|
+
* @param lockId - The lock ID to stake
|
|
9949
|
+
* @returns The encoded contract call for the stake operation
|
|
9839
9950
|
*/
|
|
9840
|
-
|
|
9951
|
+
encodeStake(lockId: bigint): EvmContractCall;
|
|
9841
9952
|
/**
|
|
9842
|
-
* Encodes
|
|
9843
|
-
*
|
|
9844
|
-
* @param
|
|
9845
|
-
* @
|
|
9846
|
-
* @param asset - The asset address to receive.
|
|
9847
|
-
* @param chainID - The destination chain ID.
|
|
9848
|
-
* @param to - The destination address as bytes.
|
|
9849
|
-
* @returns The encoded contract call data.
|
|
9953
|
+
* Encodes an unstake transaction for the BALN swap contract.
|
|
9954
|
+
*
|
|
9955
|
+
* @param lockId - The lock ID to unstake
|
|
9956
|
+
* @returns The encoded contract call for the unstake operation
|
|
9850
9957
|
*/
|
|
9851
|
-
|
|
9958
|
+
encodeUnstake(lockId: bigint): EvmContractCall;
|
|
9852
9959
|
/**
|
|
9853
|
-
*
|
|
9854
|
-
*
|
|
9855
|
-
* @param
|
|
9856
|
-
* @
|
|
9857
|
-
* @returns Tuple containing [xSodaAmount, previewDepositAmount].
|
|
9960
|
+
* Encodes a cancel unstake transaction for the BALN swap contract.
|
|
9961
|
+
*
|
|
9962
|
+
* @param lockId - The lock ID to cancel unstake for
|
|
9963
|
+
* @returns The encoded contract call for the cancel unstake operation
|
|
9858
9964
|
*/
|
|
9859
|
-
|
|
9965
|
+
encodeCancelUnstake(lockId: bigint): EvmContractCall;
|
|
9860
9966
|
/**
|
|
9861
|
-
*
|
|
9862
|
-
* @param
|
|
9863
|
-
* @param
|
|
9864
|
-
* @param
|
|
9865
|
-
* @returns The
|
|
9967
|
+
* Executes a contract call through the Sonic wallet provider.
|
|
9968
|
+
* @param spokeProvider - The Sonic spoke provider
|
|
9969
|
+
* @param rawTx - The raw contract call to execute
|
|
9970
|
+
* @param raw - Whether to return raw transaction data
|
|
9971
|
+
* @returns The transaction hash or raw transaction data
|
|
9866
9972
|
*/
|
|
9867
|
-
|
|
9973
|
+
call<S extends SonicSpokeProviderType, R extends boolean = false>(spokeProvider: S, rawTx: EvmContractCall, raw?: R): Promise<TxReturnType<S, R>>;
|
|
9868
9974
|
}
|
|
9869
9975
|
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9976
|
+
declare function isEvmHubChainConfig(value: HubChainConfig): value is EvmHubChainConfig;
|
|
9977
|
+
declare function isEvmSpokeChainConfig(value: SpokeChainConfig): value is EvmSpokeChainConfig;
|
|
9978
|
+
declare function isEvmUninitializedConfig(value: EvmUninitializedConfig | EvmInitializedConfig): value is EvmUninitializedConfig;
|
|
9979
|
+
declare function isEvmInitializedConfig(value: EvmUninitializedConfig | EvmInitializedConfig): value is EvmInitializedConfig;
|
|
9980
|
+
declare function isEvmUninitializedBrowserConfig(value: EvmUninitializedConfig): value is EvmUninitializedBrowserConfig;
|
|
9981
|
+
declare function isEvmUninitializedPrivateKeyConfig(value: EvmUninitializedConfig): value is EvmUninitializedPrivateKeyConfig;
|
|
9982
|
+
declare function isIconAddress(value: unknown): value is IconAddress;
|
|
9983
|
+
declare function isResponseAddressType(value: unknown): value is ResponseAddressType;
|
|
9984
|
+
declare function isResponseSigningType(value: unknown): value is ResponseSigningType;
|
|
9985
|
+
declare function isJsonRpcPayloadResponse(value: unknown): value is JsonRpcPayloadResponse;
|
|
9986
|
+
declare function isIntentRelayChainId(value: bigint): value is IntentRelayChainId;
|
|
9987
|
+
declare function isPartnerFeeAmount(value: unknown): value is PartnerFeeAmount;
|
|
9988
|
+
declare function isPartnerFeePercentage(value: unknown): value is PartnerFeePercentage;
|
|
9989
|
+
declare function isEvmSpokeProviderType(value: SpokeProviderType): value is EvmSpokeProviderType;
|
|
9990
|
+
declare function isEvmSpokeProvider(value: SpokeProviderType): value is EvmSpokeProvider;
|
|
9991
|
+
declare function isSonicSpokeProviderType(value: SpokeProviderType): value is SonicSpokeProviderType;
|
|
9992
|
+
declare function isSonicSpokeProvider(value: SpokeProviderType): value is SonicSpokeProvider;
|
|
9993
|
+
declare function isSolanaSpokeProviderType(value: SpokeProviderType): value is SolanaSpokeProviderType;
|
|
9994
|
+
declare function isSolanaSpokeProvider(value: SpokeProviderType): value is SolanaSpokeProvider;
|
|
9995
|
+
declare function isStellarSpokeProviderType(value: SpokeProviderType): value is StellarSpokeProviderType;
|
|
9996
|
+
declare function isStellarSpokeProvider(value: SpokeProviderType): value is StellarSpokeProvider;
|
|
9997
|
+
declare function isInjectiveSpokeProviderType(value: SpokeProviderType): value is InjectiveSpokeProviderType;
|
|
9998
|
+
declare function isInjectiveSpokeProvider(value: SpokeProviderType): value is InjectiveSpokeProvider;
|
|
9999
|
+
declare function isIconSpokeProviderType(value: SpokeProviderType): value is IconSpokeProviderType;
|
|
10000
|
+
declare function isIconSpokeProvider(value: SpokeProviderType): value is IconSpokeProvider;
|
|
10001
|
+
declare function isSuiSpokeProviderType(value: SpokeProviderType): value is SuiSpokeProviderType;
|
|
10002
|
+
declare function isSuiSpokeProvider(value: SpokeProviderType): value is SuiSpokeProvider;
|
|
10003
|
+
declare function isConfiguredSolverConfig(value: SolverConfigParams): value is Prettify<SolverConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
|
|
10004
|
+
declare function isConfiguredMoneyMarketConfig(value: MoneyMarketConfigParams): value is Prettify<MoneyMarketConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
|
|
10005
|
+
declare function isIntentCreationFailedError(error: unknown): error is IntentError<'CREATION_FAILED'>;
|
|
10006
|
+
declare function isIntentSubmitTxFailedError(error: unknown): error is IntentError<'SUBMIT_TX_FAILED'>;
|
|
10007
|
+
declare function isIntentPostExecutionFailedError(error: unknown): error is IntentError<'POST_EXECUTION_FAILED'>;
|
|
10008
|
+
declare function isWaitUntilIntentExecutedFailed(error: unknown): error is IntentError<'RELAY_TIMEOUT'>;
|
|
10009
|
+
declare function isIntentCreationUnknownError(error: unknown): error is IntentError<'UNKNOWN'>;
|
|
10010
|
+
declare function isMoneyMarketSubmitTxFailedError(error: unknown): error is MoneyMarketError<'SUBMIT_TX_FAILED'>;
|
|
10011
|
+
declare function isMoneyMarketRelayTimeoutError(error: unknown): error is MoneyMarketError<'RELAY_TIMEOUT'>;
|
|
10012
|
+
declare function isMoneyMarketCreateSupplyIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED'>;
|
|
10013
|
+
declare function isMoneyMarketCreateBorrowIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_BORROW_INTENT_FAILED'>;
|
|
10014
|
+
declare function isMoneyMarketCreateWithdrawIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED'>;
|
|
10015
|
+
declare function isMoneyMarketCreateRepayIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_REPAY_INTENT_FAILED'>;
|
|
10016
|
+
declare function isMoneyMarketSupplyUnknownError(error: unknown): error is MoneyMarketUnknownError<'SUPPLY_UNKNOWN_ERROR'>;
|
|
10017
|
+
declare function isMoneyMarketBorrowUnknownError(error: unknown): error is MoneyMarketUnknownError<'BORROW_UNKNOWN_ERROR'>;
|
|
10018
|
+
declare function isMoneyMarketWithdrawUnknownError(error: unknown): error is MoneyMarketUnknownError<'WITHDRAW_UNKNOWN_ERROR'>;
|
|
10019
|
+
declare function isMoneyMarketRepayUnknownError(error: unknown): error is MoneyMarketUnknownError<'REPAY_UNKNOWN_ERROR'>;
|
|
10020
|
+
declare function isIcxMigrateParams(value: unknown): value is IcxMigrateParams;
|
|
10021
|
+
declare function isUnifiedBnUSDMigrateParams(value: unknown): value is UnifiedBnUSDMigrateParams;
|
|
10022
|
+
declare function isBalnMigrateParams(value: unknown): value is BalnMigrateParams;
|
|
10023
|
+
declare function isIcxCreateRevertMigrationParams(value: unknown): value is IcxCreateRevertMigrationParams;
|
|
10024
|
+
declare function isRawSpokeProvider(value: unknown): value is RawSpokeProvider;
|
|
10025
|
+
declare function isEvmRawSpokeProvider(value: unknown): value is EvmRawSpokeProvider;
|
|
10026
|
+
declare function isSolanaRawSpokeProvider(value: unknown): value is SolanaRawSpokeProvider;
|
|
10027
|
+
declare function isStellarRawSpokeProvider(value: unknown): value is StellarRawSpokeProvider;
|
|
10028
|
+
declare function isIconRawSpokeProvider(value: unknown): value is IconRawSpokeProvider;
|
|
10029
|
+
declare function isSuiRawSpokeProvider(value: unknown): value is SuiRawSpokeProvider;
|
|
10030
|
+
declare function isInjectiveRawSpokeProvider(value: unknown): value is InjectiveRawSpokeProvider;
|
|
10031
|
+
declare function isSonicRawSpokeProvider(value: unknown): value is SonicRawSpokeProvider;
|
|
10032
|
+
|
|
10033
|
+
type CreateBridgeIntentParams = {
|
|
10034
|
+
srcChainId: SpokeChainId;
|
|
10035
|
+
srcAsset: string;
|
|
9883
10036
|
amount: bigint;
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
requestId: bigint;
|
|
9888
|
-
action: 'cancelUnstake';
|
|
10037
|
+
dstChainId: SpokeChainId;
|
|
10038
|
+
dstAsset: string;
|
|
10039
|
+
recipient: string;
|
|
9889
10040
|
};
|
|
9890
|
-
type
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
10041
|
+
type BridgeParams<S extends SpokeProvider> = Prettify<{
|
|
10042
|
+
params: CreateBridgeIntentParams;
|
|
10043
|
+
spokeProvider: S;
|
|
10044
|
+
skipSimulation?: boolean;
|
|
10045
|
+
} & OptionalFee>;
|
|
10046
|
+
type BridgeErrorCode = 'ALLOWANCE_CHECK_FAILED' | 'APPROVAL_FAILED' | 'CREATE_BRIDGE_INTENT_FAILED' | 'BRIDGE_FAILED' | RelayErrorCode;
|
|
10047
|
+
type BridgeError<T extends BridgeErrorCode> = {
|
|
10048
|
+
code: T;
|
|
10049
|
+
error: unknown;
|
|
9895
10050
|
};
|
|
9896
|
-
type
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
totalStaked: bigint;
|
|
9900
|
-
totalUnderlying: bigint;
|
|
9901
|
-
userXSodaBalance: bigint;
|
|
9902
|
-
userXSodaValue: bigint;
|
|
9903
|
-
userUnderlying: bigint;
|
|
10051
|
+
type BridgeExtraData = {
|
|
10052
|
+
address: Hex$1;
|
|
10053
|
+
payload: Hex$1;
|
|
9904
10054
|
};
|
|
9905
|
-
type
|
|
9906
|
-
|
|
9907
|
-
totalUnstaking: bigint;
|
|
10055
|
+
type BridgeOptionalExtraData = {
|
|
10056
|
+
data?: BridgeExtraData;
|
|
9908
10057
|
};
|
|
9909
|
-
type
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
type StakingConfig = {
|
|
9915
|
-
unstakingPeriod: bigint;
|
|
9916
|
-
minUnstakingPeriod: bigint;
|
|
9917
|
-
maxPenalty: bigint;
|
|
9918
|
-
};
|
|
9919
|
-
type StakingErrorCode = 'STAKE_FAILED' | 'UNSTAKE_FAILED' | 'INSTANT_UNSTAKE_FAILED' | 'CLAIM_FAILED' | 'CANCEL_UNSTAKE_FAILED' | 'INFO_FETCH_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'APPROVAL_FAILED';
|
|
9920
|
-
type StakingError<T extends StakingErrorCode> = {
|
|
9921
|
-
code: T;
|
|
9922
|
-
error: unknown;
|
|
9923
|
-
};
|
|
9924
|
-
type StakingServiceConstructorParams = {
|
|
9925
|
-
hubProvider: EvmHubProvider;
|
|
9926
|
-
relayerApiEndpoint: HttpUrl;
|
|
9927
|
-
configService: ConfigService;
|
|
10058
|
+
type BridgeServiceConstructorParams = {
|
|
10059
|
+
hubProvider: EvmHubProvider;
|
|
10060
|
+
relayerApiEndpoint: HttpUrl;
|
|
10061
|
+
config: BridgeServiceConfig | undefined;
|
|
10062
|
+
configService: ConfigService;
|
|
9928
10063
|
};
|
|
9929
10064
|
/**
|
|
9930
|
-
*
|
|
9931
|
-
*
|
|
9932
|
-
*
|
|
10065
|
+
* BridgeService is a service that allows you to bridge tokens between chains
|
|
10066
|
+
* Birdge action can be between to spokes chains but can also be used to withdraw and deposit into soda tokens on the HUB.
|
|
10067
|
+
* By using soda tokens as src or destinatin address.
|
|
10068
|
+
* @param hubProvider - The hub provider
|
|
10069
|
+
* @param relayerApiEndpoint - The relayer API endpoint
|
|
9933
10070
|
*/
|
|
9934
|
-
declare class
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
10071
|
+
declare class BridgeService {
|
|
10072
|
+
readonly hubProvider: EvmHubProvider;
|
|
10073
|
+
readonly relayerApiEndpoint: HttpUrl;
|
|
10074
|
+
readonly config: BridgeServiceConfig;
|
|
10075
|
+
readonly configService: ConfigService;
|
|
10076
|
+
constructor({ hubProvider, relayerApiEndpoint, config, configService }: BridgeServiceConstructorParams);
|
|
9939
10077
|
/**
|
|
9940
|
-
*
|
|
9941
|
-
* @param
|
|
10078
|
+
* Get the fee for a given input amount
|
|
10079
|
+
* @param {bigint} inputAmount - The amount of input tokens
|
|
10080
|
+
* @returns {Promise<bigint>} The fee amount (denominated in input tokens)
|
|
10081
|
+
*
|
|
10082
|
+
* @example
|
|
10083
|
+
* const fee: bigint = await sodax.bridge.getFee(1000000000000000n);
|
|
10084
|
+
* console.log('Fee:', fee);
|
|
10085
|
+
*/
|
|
10086
|
+
getFee(inputAmount: bigint): bigint;
|
|
10087
|
+
/**
|
|
10088
|
+
* Check if allowance is valid for the bridge transaction
|
|
10089
|
+
* @param params - The bridge parameters
|
|
9942
10090
|
* @param spokeProvider - The spoke provider
|
|
9943
|
-
* @returns {Promise<Result<boolean,
|
|
10091
|
+
* @returns {Promise<Result<boolean, BridgeError<'ALLOWANCE_CHECK_FAILED'>>>}
|
|
9944
10092
|
*/
|
|
9945
|
-
isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }:
|
|
9946
|
-
params: StakingParams;
|
|
9947
|
-
spokeProvider: S;
|
|
9948
|
-
}>): Promise<Result<boolean, StakingError<'ALLOWANCE_CHECK_FAILED'>>>;
|
|
10093
|
+
isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }: BridgeParams<S>): Promise<Result<boolean, BridgeError<'ALLOWANCE_CHECK_FAILED'>>>;
|
|
9949
10094
|
/**
|
|
9950
|
-
* Approve token spending for the
|
|
9951
|
-
* @param params - The
|
|
10095
|
+
* Approve token spending for the bridge transaction
|
|
10096
|
+
* @param params - The bridge parameters
|
|
9952
10097
|
* @param spokeProvider - The spoke provider
|
|
9953
10098
|
* @param raw - Whether to return raw transaction data
|
|
9954
|
-
* @returns Promise<Result<TxReturnType<S, R>,
|
|
10099
|
+
* @returns Promise<Result<TxReturnType<S, R>, BridgeError<'APPROVAL_FAILED'>>>
|
|
9955
10100
|
*/
|
|
9956
|
-
approve<S extends SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<
|
|
9957
|
-
params: StakingParams;
|
|
9958
|
-
spokeProvider: S;
|
|
9959
|
-
raw?: R;
|
|
9960
|
-
}>): Promise<Result<TxReturnType<S, R>, StakingError<'APPROVAL_FAILED'>>>;
|
|
10101
|
+
approve<S extends SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<BridgeParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>, BridgeError<'APPROVAL_FAILED'>>>;
|
|
9961
10102
|
/**
|
|
9962
|
-
* Execute
|
|
9963
|
-
*
|
|
9964
|
-
* @param
|
|
9965
|
-
* @param
|
|
9966
|
-
* @
|
|
9967
|
-
*
|
|
10103
|
+
* Execute a bridge transaction to transfer tokens from one chain to another
|
|
10104
|
+
* @param params - The bridge parameters including source/destination chains, assets, and recipient
|
|
10105
|
+
* @param spokeProvider - The spoke provider for the source chain
|
|
10106
|
+
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
10107
|
+
* @returns {Promise<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>>} - Returns the transaction hashes for both spoke and hub chains or error
|
|
10108
|
+
*
|
|
10109
|
+
* @example
|
|
10110
|
+
* const result = await sodax.bridge.bridge(
|
|
10111
|
+
* {
|
|
10112
|
+
* srcChainId: '0x2105.base',
|
|
10113
|
+
* srcAsset: '0x...', // Address of the source token
|
|
10114
|
+
* amount: 1000n, // Amount to bridge (in token decimals)
|
|
10115
|
+
* dstChainId: '0x89.polygon',
|
|
10116
|
+
* dstAsset: '0x...', // Address of the destination token
|
|
10117
|
+
* recipient: '0x...', // Recipient address on destination chain
|
|
10118
|
+
* partnerFee: { address: '0x...', percentage: 0.1 } // Optional partner fee. Partner fees and denominated in vault token decimals (18)
|
|
10119
|
+
* },
|
|
10120
|
+
* spokeProvider,
|
|
10121
|
+
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
10122
|
+
* );
|
|
10123
|
+
*
|
|
10124
|
+
* if (!result.ok) {
|
|
10125
|
+
* // Handle error
|
|
10126
|
+
* }
|
|
10127
|
+
*
|
|
10128
|
+
* const [
|
|
10129
|
+
* spokeTxHash, // transaction hash on the source chain
|
|
10130
|
+
* hubTxHash, // transaction hash on the hub chain
|
|
10131
|
+
* ] = result.value;
|
|
10132
|
+
* console.log('Bridge transaction hashes:', { spokeTxHash, hubTxHash });
|
|
9968
10133
|
*/
|
|
9969
|
-
|
|
10134
|
+
bridge<S extends SpokeProvider>({ params, spokeProvider, fee, timeout, }: Prettify<BridgeParams<S> & OptionalTimeout>): Promise<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>>;
|
|
9970
10135
|
/**
|
|
9971
|
-
* Create
|
|
9972
|
-
* NOTE: This method only executes the transaction on the spoke chain and creates the
|
|
9973
|
-
* In order to successfully
|
|
10136
|
+
* Create bridge intent only (without relaying to hub)
|
|
10137
|
+
* NOTE: This method only executes the transaction on the spoke chain and creates the bridge intent
|
|
10138
|
+
* In order to successfully bridge tokens, you need to:
|
|
9974
10139
|
* 1. Check if the allowance is sufficient using isAllowanceValid
|
|
9975
10140
|
* 2. Approve the appropriate contract to spend the tokens using approve
|
|
9976
|
-
* 3. Create the
|
|
9977
|
-
* 4. Relay the transaction to the hub and await completion using the
|
|
10141
|
+
* 3. Create the bridge intent using this method
|
|
10142
|
+
* 4. Relay the transaction to the hub and await completion using the bridge method
|
|
9978
10143
|
*
|
|
9979
|
-
* @param params - The
|
|
10144
|
+
* @param params - The bridge parameters including source/destination chains, assets, and recipient
|
|
9980
10145
|
* @param spokeProvider - The spoke provider for the source chain
|
|
9981
|
-
* @param raw - Whether to return the raw transaction data
|
|
9982
|
-
* @returns Promise<Result<TxReturnType<S, R>,
|
|
10146
|
+
* @param raw - Whether to return the raw transaction data
|
|
10147
|
+
* @returns {Promise<Result<TxReturnType<S, R>, BridgeError<BridgeErrorCode>>>} - Returns the transaction result
|
|
10148
|
+
*
|
|
10149
|
+
* @example
|
|
10150
|
+
* const bridgeService = new BridgeService(hubProvider, relayerApiEndpoint);
|
|
10151
|
+
* const result = await sodax.bridge.createBridgeIntent(
|
|
10152
|
+
* {
|
|
10153
|
+
* srcChainId: 'ethereum',
|
|
10154
|
+
* srcAsset: "0x123...", // source token address
|
|
10155
|
+
* amount: 1000000000000000000n, // 1 token in wei
|
|
10156
|
+
* dstChainId: 'polygon',
|
|
10157
|
+
* dstAsset: "0x456...", // destination token address
|
|
10158
|
+
* recipient: "0x789..." // recipient address
|
|
10159
|
+
* },
|
|
10160
|
+
* spokeProvider,
|
|
10161
|
+
* raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
|
|
10162
|
+
* );
|
|
10163
|
+
*
|
|
10164
|
+
* if (result.ok) {
|
|
10165
|
+
* const txHash = result.value;
|
|
10166
|
+
* console.log('Bridge intent transaction hash:', txHash);
|
|
10167
|
+
* } else {
|
|
10168
|
+
* console.error('Bridge intent creation failed:', result.error);
|
|
10169
|
+
* }
|
|
9983
10170
|
*/
|
|
9984
|
-
|
|
9985
|
-
params: StakeParams;
|
|
9986
|
-
spokeProvider: S;
|
|
9987
|
-
raw?: R;
|
|
9988
|
-
}>): Promise<Result<TxReturnType<S, R>, StakingError<'STAKE_FAILED'>> & {
|
|
9989
|
-
data?: {
|
|
9990
|
-
address: string;
|
|
9991
|
-
payload: Hex;
|
|
9992
|
-
};
|
|
9993
|
-
}>;
|
|
10171
|
+
createBridgeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, fee, raw, }: Prettify<BridgeParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>, BridgeError<'CREATE_BRIDGE_INTENT_FAILED'>> & BridgeOptionalExtraData>;
|
|
9994
10172
|
/**
|
|
9995
|
-
* Build
|
|
9996
|
-
* @param
|
|
9997
|
-
* @param
|
|
9998
|
-
* @param
|
|
9999
|
-
* @returns The encoded contract
|
|
10173
|
+
* Build the bridge transaction data for executing the bridge operation on the hub
|
|
10174
|
+
* @param params - The create bridge intent parameters
|
|
10175
|
+
* @param srcAssetInfo - The source asset information
|
|
10176
|
+
* @param dstAssetInfo - The destination asset information
|
|
10177
|
+
* @returns Hex - The encoded contract calls for the bridge operation
|
|
10000
10178
|
*/
|
|
10001
|
-
|
|
10179
|
+
buildBridgeData(params: CreateBridgeIntentParams, srcAssetInfo: HubAssetInfo, dstAssetInfo: HubAssetInfo, partnerFee: PartnerFee | undefined): Hex$1;
|
|
10002
10180
|
/**
|
|
10003
|
-
*
|
|
10004
|
-
*
|
|
10005
|
-
*
|
|
10006
|
-
*
|
|
10007
|
-
* @
|
|
10181
|
+
* Retrieves the deposited token balance held by the asset manager on a spoke chain.
|
|
10182
|
+
* This balance represents the available liquidity for bridging operations and is used to verify
|
|
10183
|
+
* that the target chain has sufficient funds to complete a bridge transaction.
|
|
10184
|
+
*
|
|
10185
|
+
* @param spokeProvider - The spoke provider instance
|
|
10186
|
+
* @param token - The token address to query the balance for
|
|
10187
|
+
* @returns {Promise<bigint>} - The token balance as a bigint value
|
|
10008
10188
|
*/
|
|
10009
|
-
|
|
10189
|
+
getBridgeableAmount(from: XToken, to: XToken): Promise<Result<bigint, unknown>>;
|
|
10010
10190
|
/**
|
|
10011
|
-
*
|
|
10012
|
-
*
|
|
10013
|
-
*
|
|
10014
|
-
*
|
|
10015
|
-
*
|
|
10016
|
-
*
|
|
10017
|
-
* 4. Relay the transaction to the hub and await completion using the unstake method
|
|
10018
|
-
*
|
|
10019
|
-
* @param params - The unstake parameters including amount and account
|
|
10020
|
-
* @param spokeProvider - The spoke provider for the source chain
|
|
10021
|
-
* @param raw - Whether to return the raw transaction data (default: false)
|
|
10022
|
-
* @returns Promise<Result<TxReturnType<S, R>, StakingError<'UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
|
|
10191
|
+
* Check if two assets on different chains are bridgeable
|
|
10192
|
+
* Two assets are bridgeable if they share the same vault on the hub chain
|
|
10193
|
+
* @param from - The source X token
|
|
10194
|
+
* @param to - The destination X token
|
|
10195
|
+
* @param unchecked - Whether to skip the chain ID validation
|
|
10196
|
+
* @returns boolean - true if assets are bridgeable, false otherwise
|
|
10023
10197
|
*/
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
}
|
|
10029
|
-
data?: {
|
|
10030
|
-
address: string;
|
|
10031
|
-
payload: Hex;
|
|
10032
|
-
};
|
|
10033
|
-
}>;
|
|
10198
|
+
isBridgeable({ from, to, unchecked, }: {
|
|
10199
|
+
from: XToken;
|
|
10200
|
+
to: XToken;
|
|
10201
|
+
unchecked?: boolean;
|
|
10202
|
+
}): boolean;
|
|
10034
10203
|
/**
|
|
10035
|
-
*
|
|
10036
|
-
* @param
|
|
10037
|
-
* @param
|
|
10038
|
-
* @
|
|
10204
|
+
* Get all bridgeable tokens from a source token to a destination chain
|
|
10205
|
+
* @param from - The source chain ID
|
|
10206
|
+
* @param to - The destination chain ID
|
|
10207
|
+
* @param token - The source token address
|
|
10208
|
+
* @returns XToken[] - Array of bridgeable tokens on the destination chain
|
|
10039
10209
|
*/
|
|
10040
|
-
|
|
10210
|
+
getBridgeableTokens(from: SpokeChainId, to: SpokeChainId, token: string): Result<XToken[]>;
|
|
10211
|
+
filterTokensWithSameVault(tokens: Record<string, XToken>, to: SpokeChainId, srcAssetInfo: HubAssetInfo | undefined): XToken[];
|
|
10212
|
+
}
|
|
10213
|
+
|
|
10214
|
+
declare class StakingLogic {
|
|
10215
|
+
private constructor();
|
|
10041
10216
|
/**
|
|
10042
|
-
*
|
|
10043
|
-
* @param
|
|
10044
|
-
* @param
|
|
10045
|
-
* @param
|
|
10046
|
-
* @returns
|
|
10217
|
+
* Retrieves all unstake requests for a specific user.
|
|
10218
|
+
* @param stakedSoda - The address of the StakedSoda contract.
|
|
10219
|
+
* @param user - The address of the user.
|
|
10220
|
+
* @param publicClient - PublicClient<HttpTransport>
|
|
10221
|
+
* @returns Array of user unstake info for the user.
|
|
10047
10222
|
*/
|
|
10048
|
-
|
|
10223
|
+
static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient<HttpTransport>): Promise<readonly UserUnstakeInfo[]>;
|
|
10049
10224
|
/**
|
|
10050
|
-
*
|
|
10051
|
-
*
|
|
10052
|
-
*
|
|
10053
|
-
*
|
|
10054
|
-
*
|
|
10055
|
-
*
|
|
10056
|
-
* @param params - The instant unstake parameters including amount, minAmount and account
|
|
10057
|
-
* @param spokeProvider - The spoke provider for the source chain
|
|
10058
|
-
* @param raw - Whether to return the raw transaction data (default: false)
|
|
10059
|
-
* @returns Promise<Result<TxReturnType<S, R>, StakingError<'INSTANT_UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
|
|
10225
|
+
* Encodes the depositFor transaction data.
|
|
10226
|
+
* @param stakedSoda - The address of the StakedSoda contract.
|
|
10227
|
+
* @param account - The address of the account to deposit for.
|
|
10228
|
+
* @param amount - The amount of tokens to deposit.
|
|
10229
|
+
* @returns The encoded contract call data.
|
|
10060
10230
|
*/
|
|
10061
|
-
|
|
10062
|
-
params: InstantUnstakeParams;
|
|
10063
|
-
spokeProvider: S;
|
|
10064
|
-
raw?: R;
|
|
10065
|
-
}>): Promise<Result<TxReturnType<S, R>, StakingError<'INSTANT_UNSTAKE_FAILED'>> & {
|
|
10066
|
-
data?: {
|
|
10067
|
-
address: string;
|
|
10068
|
-
payload: Hex;
|
|
10069
|
-
};
|
|
10070
|
-
}>;
|
|
10231
|
+
static encodeDepositFor(stakedSoda: Address$1, account: Address$1, amount: bigint): EvmContractCall;
|
|
10071
10232
|
/**
|
|
10072
|
-
*
|
|
10073
|
-
* @param
|
|
10074
|
-
* @param
|
|
10075
|
-
* @param
|
|
10076
|
-
* @
|
|
10077
|
-
* @returns The encoded contract call data
|
|
10233
|
+
* Encodes the withdrawTo transaction data.
|
|
10234
|
+
* @param stakedSoda - The address of the StakedSoda contract.
|
|
10235
|
+
* @param account - The address of the account to withdraw to.
|
|
10236
|
+
* @param value - The amount of tokens to withdraw.
|
|
10237
|
+
* @returns The encoded contract call data.
|
|
10078
10238
|
*/
|
|
10079
|
-
|
|
10239
|
+
static encodeWithdrawTo(stakedSoda: Address$1, account: Address$1, value: bigint): EvmContractCall;
|
|
10080
10240
|
/**
|
|
10081
|
-
*
|
|
10082
|
-
* @param
|
|
10083
|
-
* @param
|
|
10084
|
-
* @param
|
|
10085
|
-
* @returns
|
|
10241
|
+
* Encodes the unstake transaction data.
|
|
10242
|
+
* @param stakedSoda - The address of the StakedSoda contract.
|
|
10243
|
+
* @param account - The address of the account to unstake for.
|
|
10244
|
+
* @param value - The amount of tokens to unstake.
|
|
10245
|
+
* @returns The encoded contract call data.
|
|
10086
10246
|
*/
|
|
10087
|
-
|
|
10247
|
+
static encodeUnstake(stakedSoda: Address$1, account: Address$1, value: bigint): EvmContractCall;
|
|
10088
10248
|
/**
|
|
10089
|
-
*
|
|
10090
|
-
*
|
|
10091
|
-
*
|
|
10092
|
-
*
|
|
10093
|
-
* 2. Relay the transaction to the hub and await completion using the claim method
|
|
10094
|
-
*
|
|
10095
|
-
* @param params - The claim parameters including requestId
|
|
10096
|
-
* @param spokeProvider - The spoke provider for the source chain
|
|
10097
|
-
* @param raw - Whether to return the raw transaction data (default: false)
|
|
10098
|
-
* @returns Promise<Result<TxReturnType<S, R>, StakingError<'CLAIM_FAILED'>> & { data?: { address: string; payload: Hex } }>
|
|
10249
|
+
* Encodes the cancelUnstakeSodaRequest transaction data.
|
|
10250
|
+
* @param stakedSoda - The address of the StakedSoda contract.
|
|
10251
|
+
* @param requestId - The ID of the unstake request to cancel.
|
|
10252
|
+
* @returns The encoded contract call data.
|
|
10099
10253
|
*/
|
|
10100
|
-
|
|
10101
|
-
params: ClaimParams;
|
|
10102
|
-
spokeProvider: S;
|
|
10103
|
-
raw?: R;
|
|
10104
|
-
}>): Promise<Result<TxReturnType<S, R>, StakingError<'CLAIM_FAILED'>> & {
|
|
10105
|
-
data?: {
|
|
10106
|
-
address: string;
|
|
10107
|
-
payload: Hex;
|
|
10108
|
-
};
|
|
10109
|
-
}>;
|
|
10254
|
+
static encodeCancelUnstakeSodaRequest(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
|
|
10110
10255
|
/**
|
|
10111
|
-
*
|
|
10112
|
-
* @param
|
|
10113
|
-
* @param
|
|
10114
|
-
* @
|
|
10115
|
-
* @param params - The claim parameters
|
|
10116
|
-
* @returns The encoded contract call data
|
|
10256
|
+
* Encodes the cancelUnstakeRequest transaction data (alias for encodeCancelUnstakeSodaRequest).
|
|
10257
|
+
* @param stakedSoda - The address of the StakedSoda contract.
|
|
10258
|
+
* @param requestId - The ID of the unstake request to cancel.
|
|
10259
|
+
* @returns The encoded contract call data.
|
|
10117
10260
|
*/
|
|
10118
|
-
|
|
10261
|
+
static encodeCancelUnstakeRequest(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
|
|
10119
10262
|
/**
|
|
10120
|
-
*
|
|
10121
|
-
* @param
|
|
10122
|
-
* @param
|
|
10123
|
-
* @
|
|
10124
|
-
* @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'CANCEL_UNSTAKE_FAILED'> | RelayError>>
|
|
10263
|
+
* Encodes the claim transaction data.
|
|
10264
|
+
* @param stakedSoda - The address of the StakedSoda contract.
|
|
10265
|
+
* @param requestId - The ID of the unstake request to claim.
|
|
10266
|
+
* @returns The encoded contract call data.
|
|
10125
10267
|
*/
|
|
10126
|
-
|
|
10268
|
+
static encodeClaim(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
|
|
10127
10269
|
/**
|
|
10128
|
-
*
|
|
10129
|
-
*
|
|
10130
|
-
*
|
|
10131
|
-
*
|
|
10132
|
-
* 2. Relay the transaction to the hub and await completion using the cancelUnstake method
|
|
10133
|
-
*
|
|
10134
|
-
* @param params - The cancel unstake parameters including requestId
|
|
10135
|
-
* @param spokeProvider - The spoke provider for the source chain
|
|
10136
|
-
* @param raw - Whether to return the raw transaction data (default: false)
|
|
10137
|
-
* @returns Promise<Result<TxReturnType<S, R>, StakingError<'CANCEL_UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
|
|
10270
|
+
* Returns the total amount of SODA assets held by the xSoda vault.
|
|
10271
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10272
|
+
* @param publicClient - PublicClient<HttpTransport>
|
|
10273
|
+
* @returns The total amount of SODA assets.
|
|
10138
10274
|
*/
|
|
10139
|
-
|
|
10140
|
-
params: CancelUnstakeParams;
|
|
10141
|
-
spokeProvider: S;
|
|
10142
|
-
raw?: R;
|
|
10143
|
-
}>): Promise<Result<TxReturnType<S, R>, StakingError<'CANCEL_UNSTAKE_FAILED'>> & {
|
|
10144
|
-
data?: {
|
|
10145
|
-
address: string;
|
|
10146
|
-
payload: Hex;
|
|
10147
|
-
};
|
|
10148
|
-
}>;
|
|
10275
|
+
static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
10149
10276
|
/**
|
|
10150
|
-
*
|
|
10151
|
-
* @param
|
|
10152
|
-
* @param
|
|
10153
|
-
* @
|
|
10277
|
+
* Calculates the number of xSoda shares equivalent to a given amount of SODA assets.
|
|
10278
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10279
|
+
* @param assets - The amount of SODA assets to convert.
|
|
10280
|
+
* @param publicClient - PublicClient<HttpTransport>
|
|
10281
|
+
* @returns The number of xSoda shares.
|
|
10154
10282
|
*/
|
|
10155
|
-
|
|
10283
|
+
static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
10156
10284
|
/**
|
|
10157
|
-
*
|
|
10158
|
-
* @param
|
|
10159
|
-
* @
|
|
10285
|
+
* Calculates the amount of SODA assets corresponding to a specific number of xSoda shares.
|
|
10286
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10287
|
+
* @param shares - The number of xSoda shares to convert.
|
|
10288
|
+
* @param publicClient - PublicClient<HttpTransport>
|
|
10289
|
+
* @returns The amount of SODA assets.
|
|
10160
10290
|
*/
|
|
10161
|
-
|
|
10291
|
+
static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
10162
10292
|
/**
|
|
10163
|
-
*
|
|
10164
|
-
* @param
|
|
10165
|
-
* @
|
|
10293
|
+
* Simulates the effects of depositing SODA into xSoda without executing it.
|
|
10294
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10295
|
+
* @param assets - The amount of SODA assets to deposit.
|
|
10296
|
+
* @param publicClient - PublicClient<HttpTransport>
|
|
10297
|
+
* @returns The number of xSoda shares that would be minted.
|
|
10166
10298
|
*/
|
|
10167
|
-
|
|
10299
|
+
static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
10168
10300
|
/**
|
|
10169
|
-
*
|
|
10170
|
-
* @param
|
|
10171
|
-
* @
|
|
10301
|
+
* Simulates the effects of minting xSoda shares without executing it.
|
|
10302
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10303
|
+
* @param shares - The number of xSoda shares to mint.
|
|
10304
|
+
* @param publicClient - PublicClient<HttpTransport>
|
|
10305
|
+
* @returns The amount of SODA assets that would be deposited.
|
|
10172
10306
|
*/
|
|
10173
|
-
|
|
10307
|
+
static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
10174
10308
|
/**
|
|
10175
|
-
*
|
|
10176
|
-
* @
|
|
10309
|
+
* Simulates the effects of withdrawing SODA from xSoda without executing it.
|
|
10310
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10311
|
+
* @param assets - The amount of SODA assets to withdraw.
|
|
10312
|
+
* @param publicClient - PublicClient<HttpTransport>
|
|
10313
|
+
* @returns The number of xSoda shares that would be burned.
|
|
10177
10314
|
*/
|
|
10178
|
-
|
|
10315
|
+
static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
10179
10316
|
/**
|
|
10180
|
-
*
|
|
10181
|
-
* @param
|
|
10182
|
-
* @param
|
|
10183
|
-
* @
|
|
10317
|
+
* Simulates the effects of redeeming xSoda shares without executing it.
|
|
10318
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10319
|
+
* @param shares - The number of xSoda shares to redeem.
|
|
10320
|
+
* @param publicClient - PublicClient<HttpTransport>
|
|
10321
|
+
* @returns The amount of SODA assets that would be withdrawn.
|
|
10184
10322
|
*/
|
|
10185
|
-
|
|
10323
|
+
static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
10186
10324
|
/**
|
|
10187
|
-
*
|
|
10188
|
-
* @param
|
|
10189
|
-
* @
|
|
10325
|
+
* Encodes the xSoda deposit transaction data (deposit SODA to get xSoda shares).
|
|
10326
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10327
|
+
* @param assets - The amount of SODA assets to deposit.
|
|
10328
|
+
* @param receiver - The address of the receiver.
|
|
10329
|
+
* @returns The encoded contract call data.
|
|
10190
10330
|
*/
|
|
10191
|
-
|
|
10192
|
-
requestsWithPenalty: UnstakeRequestWithPenalty[];
|
|
10193
|
-
}, StakingError<'INFO_FETCH_FAILED'>>>;
|
|
10331
|
+
static encodeXSodaDeposit(xSoda: Address$1, assets: bigint, receiver: Address$1): EvmContractCall;
|
|
10194
10332
|
/**
|
|
10195
|
-
*
|
|
10196
|
-
* @param
|
|
10197
|
-
* @
|
|
10333
|
+
* Encodes the xSoda mint transaction data (mint xSoda shares by depositing SODA).
|
|
10334
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10335
|
+
* @param shares - The number of xSoda shares to mint.
|
|
10336
|
+
* @param receiver - The address of the receiver.
|
|
10337
|
+
* @returns The encoded contract call data.
|
|
10198
10338
|
*/
|
|
10199
|
-
|
|
10339
|
+
static encodeXSodaMint(xSoda: Address$1, shares: bigint, receiver: Address$1): EvmContractCall;
|
|
10200
10340
|
/**
|
|
10201
|
-
*
|
|
10202
|
-
* @param
|
|
10203
|
-
* @
|
|
10341
|
+
* Encodes the xSoda withdraw transaction data (withdraw SODA by burning xSoda shares).
|
|
10342
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10343
|
+
* @param assets - The amount of SODA assets to withdraw.
|
|
10344
|
+
* @param receiver - The address of the receiver.
|
|
10345
|
+
* @param owner - The address of the owner.
|
|
10346
|
+
* @returns The encoded contract call data.
|
|
10204
10347
|
*/
|
|
10205
|
-
|
|
10348
|
+
static encodeXSodaWithdraw(xSoda: Address$1, assets: bigint, receiver: Address$1, owner: Address$1): EvmContractCall;
|
|
10206
10349
|
/**
|
|
10207
|
-
*
|
|
10208
|
-
* @param
|
|
10209
|
-
* @
|
|
10350
|
+
* Encodes the xSoda redeem transaction data (redeem xSoda shares to get SODA).
|
|
10351
|
+
* @param xSoda - The address of the xSoda token contract.
|
|
10352
|
+
* @param shares - The number of xSoda shares to redeem.
|
|
10353
|
+
* @param receiver - The address of the receiver.
|
|
10354
|
+
* @param owner - The address of the owner.
|
|
10355
|
+
* @returns The encoded contract call data.
|
|
10210
10356
|
*/
|
|
10211
|
-
|
|
10357
|
+
static encodeXSodaRedeem(xSoda: Address$1, shares: bigint, receiver: Address$1, owner: Address$1): EvmContractCall;
|
|
10212
10358
|
/**
|
|
10213
|
-
*
|
|
10214
|
-
* @param
|
|
10215
|
-
* @param
|
|
10216
|
-
* @
|
|
10359
|
+
* Encodes the StakingRouter stake transaction data.
|
|
10360
|
+
* @param stakingRouter - The address of the StakingRouter contract.
|
|
10361
|
+
* @param amount - The amount of SODA to stake.
|
|
10362
|
+
* @param to - The address to receive the staked tokens.
|
|
10363
|
+
* @param minReceive - The minimum amount to receive.
|
|
10364
|
+
* @returns The encoded contract call data.
|
|
10217
10365
|
*/
|
|
10218
|
-
|
|
10366
|
+
static encodeStakingRouterStake(stakingRouter: Address$1, amount: bigint, to: Address$1, minReceive: bigint): EvmContractCall;
|
|
10367
|
+
/**
|
|
10368
|
+
* Encodes the StakingRouter unstake transaction data.
|
|
10369
|
+
* @param stakingRouter - The address of the StakingRouter contract.
|
|
10370
|
+
* @param amount - The amount of xSoda to unstake.
|
|
10371
|
+
* @param minAmount - The minimum amount of SODA to receive.
|
|
10372
|
+
* @param asset - The asset address to receive.
|
|
10373
|
+
* @param chainID - The destination chain ID.
|
|
10374
|
+
* @param to - The destination address as bytes.
|
|
10375
|
+
* @returns The encoded contract call data.
|
|
10376
|
+
*/
|
|
10377
|
+
static encodeStakingRouterUnstake(stakingRouter: Address$1, amount: bigint, minAmount: bigint, asset: Address$1, chainID: bigint, to: Hex): EvmContractCall;
|
|
10378
|
+
/**
|
|
10379
|
+
* Estimates the xSoda amount and preview deposit for a given SODA amount.
|
|
10380
|
+
* @param stakingRouter - The address of the StakingRouter contract.
|
|
10381
|
+
* @param amount - The amount of SODA to estimate.
|
|
10382
|
+
* @param publicClient - PublicClient<HttpTransport>
|
|
10383
|
+
* @returns Tuple containing [xSodaAmount, previewDepositAmount].
|
|
10384
|
+
*/
|
|
10385
|
+
static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<readonly [bigint, bigint]>;
|
|
10386
|
+
/**
|
|
10387
|
+
* Estimates the instant unstake amount for a given xSoda amount.
|
|
10388
|
+
* @param stakingRouter - The address of the StakingRouter contract.
|
|
10389
|
+
* @param amount - The amount of xSoda to estimate unstake for.
|
|
10390
|
+
* @param publicClient - PublicClient<HttpTransport>
|
|
10391
|
+
* @returns The estimated SODA amount from instant unstake.
|
|
10392
|
+
*/
|
|
10393
|
+
static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
|
|
10219
10394
|
}
|
|
10220
10395
|
|
|
10221
|
-
type
|
|
10222
|
-
address: IcxTokenType;
|
|
10396
|
+
type StakeParams = {
|
|
10223
10397
|
amount: bigint;
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10398
|
+
minReceive: bigint;
|
|
10399
|
+
account: Address$1;
|
|
10400
|
+
action: 'stake';
|
|
10401
|
+
};
|
|
10402
|
+
type UnstakeParams = {
|
|
10227
10403
|
amount: bigint;
|
|
10228
|
-
|
|
10404
|
+
account: Address$1;
|
|
10405
|
+
action: 'unstake';
|
|
10229
10406
|
};
|
|
10230
|
-
type
|
|
10231
|
-
|
|
10407
|
+
type ClaimParams = {
|
|
10408
|
+
requestId: bigint;
|
|
10232
10409
|
amount: bigint;
|
|
10233
|
-
|
|
10234
|
-
to: Hex;
|
|
10410
|
+
action: 'claim';
|
|
10235
10411
|
};
|
|
10236
|
-
type
|
|
10412
|
+
type CancelUnstakeParams = {
|
|
10413
|
+
requestId: bigint;
|
|
10414
|
+
action: 'cancelUnstake';
|
|
10415
|
+
};
|
|
10416
|
+
type InstantUnstakeParams = {
|
|
10417
|
+
amount: bigint;
|
|
10418
|
+
minAmount: bigint;
|
|
10419
|
+
account: Address$1;
|
|
10420
|
+
action: 'instantUnstake';
|
|
10421
|
+
};
|
|
10422
|
+
type StakingAction = 'stake' | 'unstake' | 'claim' | 'cancelUnstake' | 'instantUnstake';
|
|
10423
|
+
type StakingParams = StakeParams | UnstakeParams | ClaimParams | CancelUnstakeParams | InstantUnstakeParams;
|
|
10424
|
+
type StakingInfo = {
|
|
10425
|
+
totalStaked: bigint;
|
|
10426
|
+
totalUnderlying: bigint;
|
|
10427
|
+
userXSodaBalance: bigint;
|
|
10428
|
+
userXSodaValue: bigint;
|
|
10429
|
+
userUnderlying: bigint;
|
|
10430
|
+
};
|
|
10431
|
+
type UnstakingInfo = {
|
|
10432
|
+
userUnstakeSodaRequests: readonly UserUnstakeInfo[];
|
|
10433
|
+
totalUnstaking: bigint;
|
|
10434
|
+
};
|
|
10435
|
+
type UnstakeRequestWithPenalty = UserUnstakeInfo & {
|
|
10436
|
+
penalty: bigint;
|
|
10437
|
+
penaltyPercentage: number;
|
|
10438
|
+
claimableAmount: bigint;
|
|
10439
|
+
};
|
|
10440
|
+
type StakingConfig = {
|
|
10441
|
+
unstakingPeriod: bigint;
|
|
10442
|
+
minUnstakingPeriod: bigint;
|
|
10443
|
+
maxPenalty: bigint;
|
|
10444
|
+
};
|
|
10445
|
+
type StakingErrorCode = 'STAKE_FAILED' | 'UNSTAKE_FAILED' | 'INSTANT_UNSTAKE_FAILED' | 'CLAIM_FAILED' | 'CANCEL_UNSTAKE_FAILED' | 'INFO_FETCH_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'APPROVAL_FAILED';
|
|
10446
|
+
type StakingError<T extends StakingErrorCode> = {
|
|
10447
|
+
code: T;
|
|
10448
|
+
error: unknown;
|
|
10449
|
+
};
|
|
10450
|
+
type StakingServiceConstructorParams = {
|
|
10237
10451
|
hubProvider: EvmHubProvider;
|
|
10452
|
+
relayerApiEndpoint: HttpUrl;
|
|
10238
10453
|
configService: ConfigService;
|
|
10239
10454
|
};
|
|
10240
10455
|
/**
|
|
10241
|
-
*
|
|
10242
|
-
*
|
|
10456
|
+
* StakingService provides a high-level interface for staking operations
|
|
10457
|
+
* including staking SODA tokens, unstaking, claiming rewards, and retrieving staking information.
|
|
10458
|
+
* All transaction methods return encoded contract calls that can be sent via a wallet provider.
|
|
10243
10459
|
*/
|
|
10244
|
-
declare class
|
|
10460
|
+
declare class StakingService {
|
|
10245
10461
|
private readonly hubProvider;
|
|
10462
|
+
private readonly relayerApiEndpoint;
|
|
10246
10463
|
private readonly configService;
|
|
10247
|
-
constructor({ hubProvider, configService }:
|
|
10464
|
+
constructor({ hubProvider, relayerApiEndpoint, configService }: StakingServiceConstructorParams);
|
|
10248
10465
|
/**
|
|
10249
|
-
*
|
|
10250
|
-
*
|
|
10251
|
-
*
|
|
10252
|
-
* @returns
|
|
10466
|
+
* Check if allowance is valid for the staking operations
|
|
10467
|
+
* @param params - The staking parameters
|
|
10468
|
+
* @param spokeProvider - The spoke provider
|
|
10469
|
+
* @returns {Promise<Result<boolean, StakingError<'ALLOWANCE_CHECK_FAILED'>>>}
|
|
10253
10470
|
*/
|
|
10254
|
-
|
|
10471
|
+
isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }: Prettify<{
|
|
10472
|
+
params: StakingParams;
|
|
10473
|
+
spokeProvider: S;
|
|
10474
|
+
}>): Promise<Result<boolean, StakingError<'ALLOWANCE_CHECK_FAILED'>>>;
|
|
10255
10475
|
/**
|
|
10256
|
-
*
|
|
10257
|
-
*
|
|
10258
|
-
*
|
|
10259
|
-
*
|
|
10260
|
-
*
|
|
10261
|
-
* @param params - The migration parameters including token address, amount, and recipient
|
|
10262
|
-
* @returns Encoded transaction data for the migration operation
|
|
10263
|
-
* @throws Will throw an error if the hub asset configuration is not found
|
|
10476
|
+
* Approve token spending for the staking operations
|
|
10477
|
+
* @param params - The staking parameters
|
|
10478
|
+
* @param spokeProvider - The spoke provider
|
|
10479
|
+
* @param raw - Whether to return raw transaction data
|
|
10480
|
+
* @returns Promise<Result<TxReturnType<S, R>, StakingError<'APPROVAL_FAILED'>>>
|
|
10264
10481
|
*/
|
|
10265
|
-
|
|
10482
|
+
approve<S extends SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
|
|
10483
|
+
params: StakingParams;
|
|
10484
|
+
spokeProvider: S;
|
|
10485
|
+
raw?: R;
|
|
10486
|
+
}>): Promise<Result<TxReturnType<S, R>, StakingError<'APPROVAL_FAILED'>>>;
|
|
10266
10487
|
/**
|
|
10267
|
-
*
|
|
10268
|
-
*
|
|
10269
|
-
* @
|
|
10270
|
-
* @
|
|
10488
|
+
* Execute stake transaction for staking SODA tokens to receive xSoda shares
|
|
10489
|
+
* NOTE: For EVM chains, you may need to approve token spending first using the approve method
|
|
10490
|
+
* @param params - The staking parameters
|
|
10491
|
+
* @param spokeProvider - The spoke provider
|
|
10492
|
+
* @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
|
|
10493
|
+
* @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'STAKE_FAILED'> | RelayError>>
|
|
10271
10494
|
*/
|
|
10272
|
-
|
|
10495
|
+
stake(params: StakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'STAKE_FAILED'> | RelayError>>;
|
|
10273
10496
|
/**
|
|
10274
|
-
*
|
|
10275
|
-
* This
|
|
10497
|
+
* Create stake intent only (without relaying to hub)
|
|
10498
|
+
* NOTE: This method only executes the transaction on the spoke chain and creates the stake intent
|
|
10499
|
+
* In order to successfully stake tokens, you need to:
|
|
10500
|
+
* 1. Check if the allowance is sufficient using isAllowanceValid
|
|
10501
|
+
* 2. Approve the appropriate contract to spend the tokens using approve
|
|
10502
|
+
* 3. Create the stake intent using this method
|
|
10503
|
+
* 4. Relay the transaction to the hub and await completion using the stake method
|
|
10276
10504
|
*
|
|
10277
|
-
* @param
|
|
10278
|
-
* @param
|
|
10279
|
-
* @
|
|
10505
|
+
* @param params - The stake parameters including amount and account
|
|
10506
|
+
* @param spokeProvider - The spoke provider for the source chain
|
|
10507
|
+
* @param raw - Whether to return the raw transaction data (default: false)
|
|
10508
|
+
* @returns Promise<Result<TxReturnType<S, R>, StakingError<'STAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
|
|
10280
10509
|
*/
|
|
10281
|
-
|
|
10510
|
+
createStakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
|
|
10511
|
+
params: StakeParams;
|
|
10512
|
+
spokeProvider: S;
|
|
10513
|
+
raw?: R;
|
|
10514
|
+
}>): Promise<Result<TxReturnType<S, R>, StakingError<'STAKE_FAILED'>> & {
|
|
10515
|
+
data?: {
|
|
10516
|
+
address: string;
|
|
10517
|
+
payload: Hex;
|
|
10518
|
+
};
|
|
10519
|
+
}>;
|
|
10282
10520
|
/**
|
|
10283
|
-
*
|
|
10284
|
-
*
|
|
10285
|
-
*
|
|
10286
|
-
* @param
|
|
10287
|
-
* @
|
|
10288
|
-
* @returns The encoded contract call for the migration operation
|
|
10521
|
+
* Build stake data using StakingRouter (simplified flow)
|
|
10522
|
+
* @param sodaAsset - The SODA asset information
|
|
10523
|
+
* @param to - The destination address
|
|
10524
|
+
* @param params - The staking parameters
|
|
10525
|
+
* @returns The encoded contract call data
|
|
10289
10526
|
*/
|
|
10290
|
-
|
|
10291
|
-
}
|
|
10292
|
-
|
|
10293
|
-
type GetMigrationFailedPayload<T extends MigrationErrorCode> = T extends 'CREATE_MIGRATION_INTENT_FAILED' ? IcxMigrateParams | UnifiedBnUSDMigrateParams | BalnMigrateParams : T extends 'CREATE_REVERT_MIGRATION_INTENT_FAILED' ? IcxCreateRevertMigrationParams : T extends 'REVERT_MIGRATION_FAILED' ? IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams : T extends 'MIGRATION_FAILED' ? IcxMigrateParams | UnifiedBnUSDMigrateParams | BalnMigrateParams : never;
|
|
10294
|
-
type MigrationFailedErrorData<T extends MigrationErrorCode> = {
|
|
10295
|
-
payload: GetMigrationFailedPayload<T>;
|
|
10296
|
-
error: unknown;
|
|
10297
|
-
};
|
|
10298
|
-
type MigrationErrorCode = 'MIGRATION_FAILED' | 'CREATE_MIGRATION_INTENT_FAILED' | 'CREATE_REVERT_MIGRATION_INTENT_FAILED' | 'REVERT_MIGRATION_FAILED';
|
|
10299
|
-
type MigrationErrorData<T extends MigrationErrorCode> = T extends 'CREATE_MIGRATION_INTENT_FAILED' ? MigrationFailedErrorData<T> : T extends 'CREATE_REVERT_MIGRATION_INTENT_FAILED' ? MigrationFailedErrorData<T> : T extends 'REVERT_MIGRATION_FAILED' ? MigrationFailedErrorData<T> : T extends 'MIGRATION_FAILED' ? MigrationFailedErrorData<T> : never;
|
|
10300
|
-
type MigrationError<T extends MigrationErrorCode> = {
|
|
10301
|
-
code: T;
|
|
10302
|
-
data: MigrationErrorData<T>;
|
|
10303
|
-
};
|
|
10304
|
-
type MigrationAction = 'migrate' | 'revert';
|
|
10305
|
-
type MigrationParams = IcxMigrateParams | UnifiedBnUSDMigrateParams | BalnMigrateParams;
|
|
10306
|
-
type MigrationRevertParams = IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams;
|
|
10307
|
-
declare const SupportedMigrationTokens: readonly ["ICX", "bnUSD", "BALN"];
|
|
10308
|
-
type MigrationTokens = (typeof SupportedMigrationTokens)[number];
|
|
10309
|
-
type MigrationServiceConstructorParams = {
|
|
10310
|
-
hubProvider: EvmHubProvider;
|
|
10311
|
-
configService: ConfigService;
|
|
10312
|
-
relayerApiEndpoint: HttpUrl;
|
|
10313
|
-
};
|
|
10314
|
-
declare class MigrationService {
|
|
10315
|
-
readonly icxMigration: IcxMigrationService;
|
|
10316
|
-
readonly bnUSDMigrationService: BnUSDMigrationService;
|
|
10317
|
-
readonly balnSwapService: BalnSwapService;
|
|
10318
|
-
readonly hubProvider: EvmHubProvider;
|
|
10319
|
-
readonly relayerApiEndpoint: HttpUrl;
|
|
10320
|
-
readonly configService: ConfigService;
|
|
10321
|
-
constructor({ relayerApiEndpoint, hubProvider, configService }: MigrationServiceConstructorParams);
|
|
10527
|
+
buildStakeData(sodaAsset: HubAssetInfo, to: Address$1, params: StakeParams): Hex;
|
|
10322
10528
|
/**
|
|
10323
|
-
*
|
|
10324
|
-
* @param params - The parameters
|
|
10325
|
-
* @param spokeProvider - The spoke provider
|
|
10326
|
-
* @
|
|
10327
|
-
*
|
|
10328
|
-
* @example
|
|
10329
|
-
* const result = await migrationService.isAllowanceValid(
|
|
10330
|
-
* {
|
|
10331
|
-
* token: 'ICX', // Token to migrate
|
|
10332
|
-
* icx: 'cx...', // Address of the ICX or wICX token to migrate
|
|
10333
|
-
* amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
|
|
10334
|
-
* to: '0x...', // Address to receive the migrated SODA tokens
|
|
10335
|
-
* },
|
|
10336
|
-
* 'migrate',
|
|
10337
|
-
* spokeProvider, // IconSpokeProvider instance
|
|
10338
|
-
* );
|
|
10339
|
-
*
|
|
10529
|
+
* Execute unstake transaction for unstaking xSoda shares
|
|
10530
|
+
* @param params - The unstaking parameters
|
|
10531
|
+
* @param spokeProvider - The spoke provider
|
|
10532
|
+
* @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
|
|
10533
|
+
* @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'UNSTAKE_FAILED'> | RelayError>>
|
|
10340
10534
|
*/
|
|
10341
|
-
|
|
10535
|
+
unstake(params: UnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'UNSTAKE_FAILED'> | RelayError>>;
|
|
10342
10536
|
/**
|
|
10343
|
-
*
|
|
10344
|
-
*
|
|
10345
|
-
*
|
|
10346
|
-
*
|
|
10347
|
-
*
|
|
10348
|
-
*
|
|
10349
|
-
*
|
|
10350
|
-
* const result = await migrationService.approve(
|
|
10351
|
-
* {
|
|
10352
|
-
* amount: 1000n, // Amount of SODA tokens to revert
|
|
10353
|
-
* to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
|
|
10354
|
-
* },
|
|
10355
|
-
* 'revert',
|
|
10356
|
-
* spokeProvider, // SonicSpokeProvider instance
|
|
10357
|
-
* true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
|
|
10358
|
-
* );
|
|
10537
|
+
* Create unstake intent only (without relaying to hub)
|
|
10538
|
+
* NOTE: This method only executes the transaction on the spoke chain and creates the unstake intent
|
|
10539
|
+
* In order to successfully unstake tokens, you need to:
|
|
10540
|
+
* 1. Check if the allowance is sufficient using isAllowanceValid
|
|
10541
|
+
* 2. Approve the appropriate contract to spend the tokens using approve
|
|
10542
|
+
* 3. Create the unstake intent using this method
|
|
10543
|
+
* 4. Relay the transaction to the hub and await completion using the unstake method
|
|
10359
10544
|
*
|
|
10545
|
+
* @param params - The unstake parameters including amount and account
|
|
10546
|
+
* @param spokeProvider - The spoke provider for the source chain
|
|
10547
|
+
* @param raw - Whether to return the raw transaction data (default: false)
|
|
10548
|
+
* @returns Promise<Result<TxReturnType<S, R>, StakingError<'UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
|
|
10360
10549
|
*/
|
|
10361
|
-
|
|
10550
|
+
createUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
|
|
10551
|
+
params: UnstakeParams;
|
|
10552
|
+
spokeProvider: S;
|
|
10553
|
+
raw?: R;
|
|
10554
|
+
}>): Promise<Result<TxReturnType<S, R>, StakingError<'UNSTAKE_FAILED'>> & {
|
|
10555
|
+
data?: {
|
|
10556
|
+
address: string;
|
|
10557
|
+
payload: Hex;
|
|
10558
|
+
};
|
|
10559
|
+
}>;
|
|
10362
10560
|
/**
|
|
10363
|
-
*
|
|
10364
|
-
*
|
|
10365
|
-
*
|
|
10366
|
-
* @
|
|
10367
|
-
* @param spokeProvider - The SpokeProvider instance for the source chain.
|
|
10368
|
-
* @param timeout - Optional timeout in milliseconds for the relay operation (default: 60 seconds).
|
|
10369
|
-
* @param unchecked - Optional flag to skip validation checks (default: false).
|
|
10370
|
-
* @returns {Promise<Result<[string, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
|
|
10371
|
-
* Result containing a tuple: [spokeTxHash, hubTxHash] if successful, or an error describing the failure.
|
|
10372
|
-
*
|
|
10373
|
-
* @example
|
|
10374
|
-
* // Migrate legacy bnUSD to new bnUSD
|
|
10375
|
-
* const result = await sodax.migration.migratebnUSD({
|
|
10376
|
-
* srcChainId: '0x1.icon', // Source chain ID (legacy)
|
|
10377
|
-
* dstChainId: 'sonic', // Destination chain ID (new)
|
|
10378
|
-
* srcbnUSD: 'cx...', // Legacy bnUSD token address
|
|
10379
|
-
* dstbnUSD: '0x...', // New bnUSD token address
|
|
10380
|
-
* amount: 1000n, // Amount to migrate
|
|
10381
|
-
* to: '0x...', // Recipient address on destination chain
|
|
10382
|
-
* }, iconSpokeProvider);
|
|
10383
|
-
*
|
|
10384
|
-
* // Reverse migration: new bnUSD to legacy bnUSD
|
|
10385
|
-
* const result = await sodax.migration.migratebnUSD({
|
|
10386
|
-
* srcChainId: 'sonic', // Source chain ID (new)
|
|
10387
|
-
* dstChainId: '0x1.icon', // Destination chain ID (legacy)
|
|
10388
|
-
* srcbnUSD: '0x...', // New bnUSD token address
|
|
10389
|
-
* dstbnUSD: 'cx...', // Legacy bnUSD token address
|
|
10390
|
-
* amount: 1000n, // Amount to migrate
|
|
10391
|
-
* to: 'hx...', // Recipient address on destination chain
|
|
10392
|
-
* }, sonicSpokeProvider);
|
|
10393
|
-
*
|
|
10394
|
-
* if (result.ok) {
|
|
10395
|
-
* // result.value is a tuple: [spokeTxHash, hubTxHash]
|
|
10396
|
-
* const [spokeTxHash, hubTxHash] = result.value;
|
|
10397
|
-
* console.log('[migrateBnUSD] hubTxHash', hubTxHash);
|
|
10398
|
-
* console.log('[migrateBnUSD] spokeTxHash', spokeTxHash);
|
|
10399
|
-
* } else {
|
|
10400
|
-
* // Handle migration error
|
|
10401
|
-
* console.error('[migrateBnUSD] error', result.error);
|
|
10402
|
-
* }
|
|
10561
|
+
* Build unstake data for unstaking xSoda shares
|
|
10562
|
+
* @param hubWallet - The hub wallet address
|
|
10563
|
+
* @param params - The unstake parameters
|
|
10564
|
+
* @returns The encoded contract call data
|
|
10403
10565
|
*/
|
|
10404
|
-
|
|
10405
|
-
string,
|
|
10406
|
-
Hex$1
|
|
10407
|
-
], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
|
|
10566
|
+
buildUnstakeData(hubWallet: Address$1, params: UnstakeParams): Hex;
|
|
10408
10567
|
/**
|
|
10409
|
-
*
|
|
10410
|
-
*
|
|
10411
|
-
*
|
|
10412
|
-
* @param
|
|
10413
|
-
* @
|
|
10414
|
-
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
10415
|
-
* @returns {Promise<Result<[Hex, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
|
|
10416
|
-
* Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
|
|
10417
|
-
* or an error describing why the migration or relay failed.
|
|
10418
|
-
*
|
|
10419
|
-
* @example
|
|
10420
|
-
* const result = await migrationService.migrateIcxToSoda(
|
|
10421
|
-
* {
|
|
10422
|
-
* address: 'cx...', // Address of the ICX or wICX token to migrate
|
|
10423
|
-
* amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
|
|
10424
|
-
* to: '0x...', // Address to receive the migrated SODA tokens (i.e. the hub chain address)
|
|
10425
|
-
* },
|
|
10426
|
-
* spokeProvider, // IconSpokeProvider instance
|
|
10427
|
-
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
10428
|
-
* );
|
|
10429
|
-
*
|
|
10430
|
-
* if (!result.ok) {
|
|
10431
|
-
* // Handle error
|
|
10432
|
-
* }
|
|
10433
|
-
*
|
|
10434
|
-
* const [
|
|
10435
|
-
* spokeTxHash, // transaction hash on the spoke chain
|
|
10436
|
-
* hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
|
|
10437
|
-
* ] = result.value;
|
|
10438
|
-
* console.log('Migration transaction hashes:', { spokeTxHash, hubTxHash });
|
|
10568
|
+
* Execute instant unstake transaction for instantly unstaking xSoda shares
|
|
10569
|
+
* @param params - The instant unstaking parameters
|
|
10570
|
+
* @param spokeProvider - The spoke provider
|
|
10571
|
+
* @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
|
|
10572
|
+
* @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'INSTANT_UNSTAKE_FAILED'> | RelayError>>
|
|
10439
10573
|
*/
|
|
10440
|
-
|
|
10441
|
-
Hex$1,
|
|
10442
|
-
Hex$1
|
|
10443
|
-
], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
|
|
10574
|
+
instantUnstake(params: InstantUnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'INSTANT_UNSTAKE_FAILED'> | RelayError>>;
|
|
10444
10575
|
/**
|
|
10445
|
-
*
|
|
10446
|
-
*
|
|
10447
|
-
*
|
|
10448
|
-
*
|
|
10449
|
-
*
|
|
10450
|
-
* @returns {Promise<Result<[Hex, Hex], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>}
|
|
10451
|
-
* Returns a Result containing a tuple of [hubTxHash, spokeTxHash] if successful,
|
|
10452
|
-
* or an error describing why the revert migration or relay failed.
|
|
10453
|
-
*
|
|
10454
|
-
*
|
|
10455
|
-
* @example
|
|
10456
|
-
* const result = await migrationService.revertMigrateSodaToIcx(
|
|
10457
|
-
* {
|
|
10458
|
-
* amount: 1000n, // Amount of SODA tokens to revert
|
|
10459
|
-
* to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
|
|
10460
|
-
* },
|
|
10461
|
-
* spokeProvider, // SonicSpokeProvider instance
|
|
10462
|
-
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
10463
|
-
* );
|
|
10464
|
-
*
|
|
10465
|
-
* if (!result.ok) {
|
|
10466
|
-
* // Handle error
|
|
10467
|
-
* }
|
|
10576
|
+
* Create instant unstake intent only (without relaying to hub)
|
|
10577
|
+
* NOTE: This method only executes the transaction on the spoke chain and creates the instant unstake intent
|
|
10578
|
+
* In order to successfully instant unstake tokens, you need to:
|
|
10579
|
+
* 1. Create the instant unstake intent using this method
|
|
10580
|
+
* 2. Relay the transaction to the hub and await completion using the instantUnstake method
|
|
10468
10581
|
*
|
|
10469
|
-
*
|
|
10470
|
-
*
|
|
10471
|
-
*
|
|
10472
|
-
*
|
|
10473
|
-
* console.log('Revert migration transaction hashes:', { hubTxHash, spokeTxHash });
|
|
10582
|
+
* @param params - The instant unstake parameters including amount, minAmount and account
|
|
10583
|
+
* @param spokeProvider - The spoke provider for the source chain
|
|
10584
|
+
* @param raw - Whether to return the raw transaction data (default: false)
|
|
10585
|
+
* @returns Promise<Result<TxReturnType<S, R>, StakingError<'INSTANT_UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
|
|
10474
10586
|
*/
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10587
|
+
createInstantUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
|
|
10588
|
+
params: InstantUnstakeParams;
|
|
10589
|
+
spokeProvider: S;
|
|
10590
|
+
raw?: R;
|
|
10591
|
+
}>): Promise<Result<TxReturnType<S, R>, StakingError<'INSTANT_UNSTAKE_FAILED'>> & {
|
|
10592
|
+
data?: {
|
|
10593
|
+
address: string;
|
|
10594
|
+
payload: Hex;
|
|
10595
|
+
};
|
|
10596
|
+
}>;
|
|
10479
10597
|
/**
|
|
10480
|
-
*
|
|
10481
|
-
*
|
|
10482
|
-
*
|
|
10483
|
-
* @param
|
|
10484
|
-
* @param
|
|
10485
|
-
* @
|
|
10486
|
-
* @returns {Promise<Result<[Hex, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
|
|
10487
|
-
* Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
|
|
10488
|
-
* or an error describing why the migration or relay failed.
|
|
10489
|
-
*
|
|
10490
|
-
* @example
|
|
10491
|
-
* const result = await migrationService.migrateBaln(
|
|
10492
|
-
* {
|
|
10493
|
-
* amount: 1000n, // The amount of BALN tokens to swap
|
|
10494
|
-
* lockupPeriod: SIX_MONTHS, // The lockup period for the swap (see LockupPeriod type)
|
|
10495
|
-
* to: '0x...', // The hub (sonic) chain address that will receive the swapped BALN tokens
|
|
10496
|
-
* stake: true, // Whether to stake the BALN tokens
|
|
10497
|
-
* },
|
|
10498
|
-
* spokeProvider, // IconSpokeProvider instance
|
|
10499
|
-
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
10500
|
-
* );
|
|
10501
|
-
*
|
|
10502
|
-
* if (!result.ok) {
|
|
10503
|
-
* // Handle error
|
|
10504
|
-
* }
|
|
10505
|
-
*
|
|
10506
|
-
* const [
|
|
10507
|
-
* spokeTxHash, // transaction hash on the spoke chain
|
|
10508
|
-
* hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
|
|
10509
|
-
* ] = result.value;
|
|
10510
|
-
* console.log('Migration transaction hashes:', { spokeTxHash, hubTxHash });
|
|
10598
|
+
* Build instant unstake data for instantly unstaking xSoda shares
|
|
10599
|
+
* @param sodaAsset - The SODA asset information
|
|
10600
|
+
* @param dstChainId - The destination chain ID
|
|
10601
|
+
* @param dstWallet - The destination wallet address
|
|
10602
|
+
* @param params - The instant unstake parameters
|
|
10603
|
+
* @returns The encoded contract call data
|
|
10511
10604
|
*/
|
|
10512
|
-
|
|
10513
|
-
Hex$1,
|
|
10514
|
-
Hex$1
|
|
10515
|
-
], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
|
|
10605
|
+
buildInstantUnstakeData(sodaAsset: HubAssetInfo, dstChainId: SpokeChainId, dstWallet: Hex, params: InstantUnstakeParams): Hex;
|
|
10516
10606
|
/**
|
|
10517
|
-
*
|
|
10518
|
-
*
|
|
10519
|
-
* @param
|
|
10520
|
-
* @param
|
|
10521
|
-
* @
|
|
10522
|
-
* @returns {Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>> } - Returns the raw transaction payload or transaction hash
|
|
10523
|
-
*
|
|
10524
|
-
* @example
|
|
10525
|
-
* const result = await migrationService.createMigrateBalnIntent(
|
|
10526
|
-
* {
|
|
10527
|
-
* amount: 1000n, // The amount of BALN tokens to swap
|
|
10528
|
-
* lockupPeriod: SIX_MONTHS, // The lockup period for the swap (see LockupPeriod type)
|
|
10529
|
-
* to: '0x...', // The hub (sonic) chain address that will receive the swapped BALN tokens
|
|
10530
|
-
* stake: true, // Whether to stake the BALN tokens
|
|
10531
|
-
* },
|
|
10532
|
-
* spokeProvider, // IconSpokeProvider instance
|
|
10533
|
-
* true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
|
|
10534
|
-
* );
|
|
10535
|
-
*
|
|
10607
|
+
* Execute claim transaction for claiming unstaked tokens after the unstaking period
|
|
10608
|
+
* @param params - The claim parameters
|
|
10609
|
+
* @param spokeProvider - The spoke provider
|
|
10610
|
+
* @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
|
|
10611
|
+
* @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'CLAIM_FAILED'> | RelayError>>
|
|
10536
10612
|
*/
|
|
10537
|
-
|
|
10613
|
+
claim(params: ClaimParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'CLAIM_FAILED'> | RelayError>>;
|
|
10538
10614
|
/**
|
|
10539
|
-
*
|
|
10540
|
-
*
|
|
10541
|
-
*
|
|
10542
|
-
*
|
|
10543
|
-
*
|
|
10544
|
-
*
|
|
10545
|
-
* @param params - The parameters for the bnUSD migration or reverse migration transaction.
|
|
10546
|
-
* @param spokeProvider - The spoke provider instance for the source chain.
|
|
10547
|
-
* @param unchecked - If true, skips input validation (use with caution).
|
|
10548
|
-
* @param raw - If true, returns the raw transaction hash instead of the transaction receipt.
|
|
10549
|
-
* @returns {Promise<Result<TxReturnType<S, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>}
|
|
10550
|
-
* Returns a Result containing the transaction payload or hash, or an error if creation failed.
|
|
10551
|
-
*
|
|
10552
|
-
* @example
|
|
10553
|
-
* // Migrate legacy bnUSD to new bnUSD
|
|
10554
|
-
* const result = await migrationService.createMigratebnUSDIntent(
|
|
10555
|
-
* {
|
|
10556
|
-
* srcChainId: '0x1.icon', // Source chain ID (legacy bnUSD chain)
|
|
10557
|
-
* dstChainId: 'sonic', // Destination chain ID (new bnUSD chain)
|
|
10558
|
-
* srcbnUSD: 'cx...', // Legacy bnUSD token address
|
|
10559
|
-
* dstbnUSD: '0x...', // New bnUSD token address
|
|
10560
|
-
* amount: 1000n, // Amount to migrate
|
|
10561
|
-
* to: '0x...', // Recipient address on destination chain
|
|
10562
|
-
* } satisfies UnifiedBnUSDMigrateParams,
|
|
10563
|
-
* spokeProvider, // SpokeProvider instance
|
|
10564
|
-
* false, // Optional unchecked flag (validation is skipped)
|
|
10565
|
-
* true // Optional raw flag
|
|
10566
|
-
* );
|
|
10615
|
+
* Create claim intent only (without relaying to hub)
|
|
10616
|
+
* NOTE: This method only executes the transaction on the spoke chain and creates the claim intent
|
|
10617
|
+
* In order to successfully claim tokens, you need to:
|
|
10618
|
+
* 1. Create the claim intent using this method
|
|
10619
|
+
* 2. Relay the transaction to the hub and await completion using the claim method
|
|
10567
10620
|
*
|
|
10568
|
-
*
|
|
10569
|
-
*
|
|
10570
|
-
*
|
|
10571
|
-
*
|
|
10572
|
-
* dstChainId: '0x1.icon', // Destination chain ID (legacy bnUSD chain)
|
|
10573
|
-
* srcbnUSD: '0x...', // New bnUSD token address
|
|
10574
|
-
* dstbnUSD: 'cx...', // Legacy bnUSD token address
|
|
10575
|
-
* amount: 1000n, // Amount to migrate
|
|
10576
|
-
* to: 'hx...', // Recipient address on destination chain
|
|
10577
|
-
* } satisfies UnifiedBnUSDMigrateParams,
|
|
10578
|
-
* spokeProvider
|
|
10579
|
-
* );
|
|
10621
|
+
* @param params - The claim parameters including requestId
|
|
10622
|
+
* @param spokeProvider - The spoke provider for the source chain
|
|
10623
|
+
* @param raw - Whether to return the raw transaction data (default: false)
|
|
10624
|
+
* @returns Promise<Result<TxReturnType<S, R>, StakingError<'CLAIM_FAILED'>> & { data?: { address: string; payload: Hex } }>
|
|
10580
10625
|
*/
|
|
10581
|
-
|
|
10626
|
+
createClaimIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
|
|
10627
|
+
params: ClaimParams;
|
|
10628
|
+
spokeProvider: S;
|
|
10629
|
+
raw?: R;
|
|
10630
|
+
}>): Promise<Result<TxReturnType<S, R>, StakingError<'CLAIM_FAILED'>> & {
|
|
10631
|
+
data?: {
|
|
10632
|
+
address: string;
|
|
10633
|
+
payload: Hex;
|
|
10634
|
+
};
|
|
10635
|
+
}>;
|
|
10582
10636
|
/**
|
|
10583
|
-
*
|
|
10584
|
-
*
|
|
10585
|
-
*
|
|
10586
|
-
*
|
|
10587
|
-
*
|
|
10637
|
+
* Build claim data for claiming unstaked tokens
|
|
10638
|
+
* @param sodaAsset - The SODA asset information
|
|
10639
|
+
* @param dstChainId - The destination chain ID
|
|
10640
|
+
* @param dstWallet - The destination wallet address
|
|
10641
|
+
* @param params - The claim parameters
|
|
10642
|
+
* @returns The encoded contract call data
|
|
10643
|
+
*/
|
|
10644
|
+
buildClaimData(sodaAsset: HubAssetInfo, dstChainId: SpokeChainId, dstWallet: Hex, params: ClaimParams): Hex;
|
|
10645
|
+
/**
|
|
10646
|
+
* Execute cancel unstake transaction for cancelling an unstake request
|
|
10647
|
+
* @param params - The cancel unstake parameters
|
|
10648
|
+
* @param spokeProvider - The spoke provider
|
|
10649
|
+
* @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
|
|
10650
|
+
* @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'CANCEL_UNSTAKE_FAILED'> | RelayError>>
|
|
10651
|
+
*/
|
|
10652
|
+
cancelUnstake(params: CancelUnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'CANCEL_UNSTAKE_FAILED'> | RelayError>>;
|
|
10653
|
+
/**
|
|
10654
|
+
* Create cancel unstake intent only (without relaying to hub)
|
|
10655
|
+
* NOTE: This method only executes the transaction on the spoke chain and creates the cancel unstake intent
|
|
10656
|
+
* In order to successfully cancel an unstake request, you need to:
|
|
10657
|
+
* 1. Create the cancel unstake intent using this method
|
|
10658
|
+
* 2. Relay the transaction to the hub and await completion using the cancelUnstake method
|
|
10588
10659
|
*
|
|
10589
|
-
* @param
|
|
10590
|
-
* @param
|
|
10591
|
-
* @param
|
|
10592
|
-
* @returns
|
|
10660
|
+
* @param params - The cancel unstake parameters including requestId
|
|
10661
|
+
* @param spokeProvider - The spoke provider for the source chain
|
|
10662
|
+
* @param raw - Whether to return the raw transaction data (default: false)
|
|
10663
|
+
* @returns Promise<Result<TxReturnType<S, R>, StakingError<'CANCEL_UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
|
|
10664
|
+
*/
|
|
10665
|
+
createCancelUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
|
|
10666
|
+
params: CancelUnstakeParams;
|
|
10667
|
+
spokeProvider: S;
|
|
10668
|
+
raw?: R;
|
|
10669
|
+
}>): Promise<Result<TxReturnType<S, R>, StakingError<'CANCEL_UNSTAKE_FAILED'>> & {
|
|
10670
|
+
data?: {
|
|
10671
|
+
address: string;
|
|
10672
|
+
payload: Hex;
|
|
10673
|
+
};
|
|
10674
|
+
}>;
|
|
10675
|
+
/**
|
|
10676
|
+
* Build cancel unstake data for cancelling an unstake request
|
|
10677
|
+
* @param params - The cancel unstake parameters
|
|
10678
|
+
* @param hubWallet - The hub wallet address
|
|
10679
|
+
* @returns Promise<Hex> - The encoded contract call data
|
|
10680
|
+
*/
|
|
10681
|
+
buildCancelUnstakeData(params: CancelUnstakeParams, hubWallet: Address$1): Promise<Hex>;
|
|
10682
|
+
/**
|
|
10683
|
+
* Get comprehensive staking information for a user using spoke provider
|
|
10684
|
+
* @param spokeProvider - The spoke provider
|
|
10685
|
+
* @returns Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>
|
|
10686
|
+
*/
|
|
10687
|
+
getStakingInfoFromSpoke(spokeProvider: SpokeProvider): Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
|
|
10688
|
+
/**
|
|
10689
|
+
* Get comprehensive staking information for a user
|
|
10690
|
+
* @param userAddress - The user's address
|
|
10691
|
+
* @returns Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>
|
|
10692
|
+
*/
|
|
10693
|
+
getStakingInfo(userAddress: Address$1): Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
|
|
10694
|
+
/**
|
|
10695
|
+
* Get unstaking information for a user
|
|
10696
|
+
* @param param - The user's address or spoke provider
|
|
10697
|
+
* @returns Promise<Result<UnstakingInfo, StakingError<'INFO_FETCH_FAILED'>>>
|
|
10698
|
+
*/
|
|
10699
|
+
getUnstakingInfo(param: SpokeProvider | Address$1): Promise<Result<UnstakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
|
|
10700
|
+
/**
|
|
10701
|
+
* Get staking configuration from the stakedSoda contract
|
|
10702
|
+
* @returns Promise<Result<StakingConfig, StakingError<'INFO_FETCH_FAILED'>>>
|
|
10703
|
+
*/
|
|
10704
|
+
getStakingConfig(): Promise<Result<StakingConfig, StakingError<'INFO_FETCH_FAILED'>>>;
|
|
10705
|
+
/**
|
|
10706
|
+
* Calculate penalty for an unstake request based on the contract logic
|
|
10707
|
+
* @param startTime - The start time of the unstake request
|
|
10708
|
+
* @param config - The staking configuration
|
|
10709
|
+
* @returns The penalty amount and percentage
|
|
10710
|
+
*/
|
|
10711
|
+
private calculatePenalty;
|
|
10712
|
+
/**
|
|
10713
|
+
* Get unstaking information with penalty calculations
|
|
10714
|
+
* @param param - The user's address or spoke provider
|
|
10715
|
+
* @returns Promise<Result<UnstakingInfo & { requestsWithPenalty: UnstakeRequestWithPenalty[] }, StakingError<'INFO_FETCH_FAILED'>>>
|
|
10716
|
+
*/
|
|
10717
|
+
getUnstakingInfoWithPenalty(param: SpokeProvider | Address$1): Promise<Result<UnstakingInfo & {
|
|
10718
|
+
requestsWithPenalty: UnstakeRequestWithPenalty[];
|
|
10719
|
+
}, StakingError<'INFO_FETCH_FAILED'>>>;
|
|
10720
|
+
/**
|
|
10721
|
+
* Get instant unstake ratio for a given amount
|
|
10722
|
+
* @param amount - The amount of xSoda to estimate instant unstake for
|
|
10723
|
+
* @returns Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>
|
|
10724
|
+
*/
|
|
10725
|
+
getInstantUnstakeRatio(amount: bigint): Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>;
|
|
10726
|
+
/**
|
|
10727
|
+
* Get converted assets amount for xSODA shares
|
|
10728
|
+
* @param amount - The amount of xSoda shares to convert
|
|
10729
|
+
* @returns Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>
|
|
10730
|
+
*/
|
|
10731
|
+
getConvertedAssets(amount: bigint): Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>;
|
|
10732
|
+
/**
|
|
10733
|
+
* Get stake ratio for a given amount (xSoda amount and preview deposit)
|
|
10734
|
+
* @param amount - The amount of SODA to estimate stake for
|
|
10735
|
+
* @returns Promise<Result<[bigint, bigint], StakingError<'INFO_FETCH_FAILED'>>>
|
|
10736
|
+
*/
|
|
10737
|
+
getStakeRatio(amount: bigint): Promise<Result<[bigint, bigint], StakingError<'INFO_FETCH_FAILED'>>>;
|
|
10738
|
+
/**
|
|
10739
|
+
* Helper method to get xSoda balance for a user
|
|
10740
|
+
* @param xSoda - The xSoda token contract address
|
|
10741
|
+
* @param userAddress - The user's address
|
|
10742
|
+
* @returns Promise<bigint>
|
|
10743
|
+
*/
|
|
10744
|
+
private getXSodaBalance;
|
|
10745
|
+
}
|
|
10746
|
+
|
|
10747
|
+
type GetMigrationFailedPayload<T extends MigrationErrorCode> = T extends 'CREATE_MIGRATION_INTENT_FAILED' ? IcxMigrateParams | UnifiedBnUSDMigrateParams | BalnMigrateParams : T extends 'CREATE_REVERT_MIGRATION_INTENT_FAILED' ? IcxCreateRevertMigrationParams : T extends 'REVERT_MIGRATION_FAILED' ? IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams : T extends 'MIGRATION_FAILED' ? IcxMigrateParams | UnifiedBnUSDMigrateParams | BalnMigrateParams : never;
|
|
10748
|
+
type MigrationFailedErrorData<T extends MigrationErrorCode> = {
|
|
10749
|
+
payload: GetMigrationFailedPayload<T>;
|
|
10750
|
+
error: unknown;
|
|
10751
|
+
};
|
|
10752
|
+
type MigrationErrorCode = 'MIGRATION_FAILED' | 'CREATE_MIGRATION_INTENT_FAILED' | 'CREATE_REVERT_MIGRATION_INTENT_FAILED' | 'REVERT_MIGRATION_FAILED';
|
|
10753
|
+
type MigrationErrorData<T extends MigrationErrorCode> = T extends 'CREATE_MIGRATION_INTENT_FAILED' ? MigrationFailedErrorData<T> : T extends 'CREATE_REVERT_MIGRATION_INTENT_FAILED' ? MigrationFailedErrorData<T> : T extends 'REVERT_MIGRATION_FAILED' ? MigrationFailedErrorData<T> : T extends 'MIGRATION_FAILED' ? MigrationFailedErrorData<T> : never;
|
|
10754
|
+
type MigrationError<T extends MigrationErrorCode> = {
|
|
10755
|
+
code: T;
|
|
10756
|
+
data: MigrationErrorData<T>;
|
|
10757
|
+
};
|
|
10758
|
+
type MigrationAction = 'migrate' | 'revert';
|
|
10759
|
+
type MigrationParams = IcxMigrateParams | UnifiedBnUSDMigrateParams | BalnMigrateParams;
|
|
10760
|
+
type MigrationRevertParams = IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams;
|
|
10761
|
+
declare const SupportedMigrationTokens: readonly ["ICX", "bnUSD", "BALN"];
|
|
10762
|
+
type MigrationTokens = (typeof SupportedMigrationTokens)[number];
|
|
10763
|
+
type MigrationServiceConstructorParams = {
|
|
10764
|
+
hubProvider: EvmHubProvider;
|
|
10765
|
+
configService: ConfigService;
|
|
10766
|
+
relayerApiEndpoint: HttpUrl;
|
|
10767
|
+
};
|
|
10768
|
+
declare class MigrationService {
|
|
10769
|
+
readonly icxMigration: IcxMigrationService;
|
|
10770
|
+
readonly bnUSDMigrationService: BnUSDMigrationService;
|
|
10771
|
+
readonly balnSwapService: BalnSwapService;
|
|
10772
|
+
readonly hubProvider: EvmHubProvider;
|
|
10773
|
+
readonly relayerApiEndpoint: HttpUrl;
|
|
10774
|
+
readonly configService: ConfigService;
|
|
10775
|
+
constructor({ relayerApiEndpoint, hubProvider, configService }: MigrationServiceConstructorParams);
|
|
10776
|
+
/**
|
|
10777
|
+
* Checks if the allowance is valid for the migration transaction.
|
|
10778
|
+
* @param params - The parameters for the migration transaction.
|
|
10779
|
+
* @param spokeProvider - The spoke provider.
|
|
10780
|
+
* @returns {Promise<Result<boolean>>} - Returns the result of the allowance check or error
|
|
10593
10781
|
*
|
|
10594
10782
|
* @example
|
|
10595
|
-
* const result = await migrationService.
|
|
10783
|
+
* const result = await migrationService.isAllowanceValid(
|
|
10596
10784
|
* {
|
|
10785
|
+
* token: 'ICX', // Token to migrate
|
|
10597
10786
|
* icx: 'cx...', // Address of the ICX or wICX token to migrate
|
|
10598
10787
|
* amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
|
|
10599
10788
|
* to: '0x...', // Address to receive the migrated SODA tokens
|
|
10600
10789
|
* },
|
|
10790
|
+
* 'migrate',
|
|
10601
10791
|
* spokeProvider, // IconSpokeProvider instance
|
|
10602
|
-
* true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
|
|
10603
10792
|
* );
|
|
10604
10793
|
*
|
|
10605
|
-
* if (!result.ok) {
|
|
10606
|
-
* // Handle error
|
|
10607
|
-
* }
|
|
10608
10794
|
*/
|
|
10609
|
-
|
|
10795
|
+
isAllowanceValid<S extends SpokeProvider>(params: MigrationParams | MigrationRevertParams, action: MigrationAction, spokeProvider: S): Promise<Result<boolean>>;
|
|
10610
10796
|
/**
|
|
10611
|
-
*
|
|
10612
|
-
*
|
|
10613
|
-
*
|
|
10614
|
-
*
|
|
10615
|
-
* @
|
|
10616
|
-
* @param {SonicSpokeProvider} spokeProvider - The spoke provider.
|
|
10617
|
-
* @param {boolean} raw - Whether to return the raw transaction hash instead of the transaction receipt
|
|
10618
|
-
* @returns {Promise<Result<TxReturnType<SonicSpokeProvider, R>, MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'>>>} - Returns the transaction hash or error
|
|
10797
|
+
* Approves the amount spending for the revert migration transaction.
|
|
10798
|
+
* @param params - The parameters for the revert migration transaction.
|
|
10799
|
+
* @param spokeProvider - The spoke provider.
|
|
10800
|
+
* @param raw - Whether to return the raw transaction hash instead of the transaction receipt
|
|
10801
|
+
* @returns {Promise<Result<TxReturnType<S, R>>>} - Returns the raw transaction payload or transaction hash
|
|
10619
10802
|
*
|
|
10620
10803
|
* @example
|
|
10621
|
-
* const result = await migrationService.
|
|
10804
|
+
* const result = await migrationService.approve(
|
|
10622
10805
|
* {
|
|
10623
10806
|
* amount: 1000n, // Amount of SODA tokens to revert
|
|
10624
10807
|
* to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
|
|
10625
|
-
* action: 'revert',
|
|
10626
10808
|
* },
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
type UnifiedBnUSDMigrateParams = {
|
|
10632
|
-
srcChainId: SpokeChainId;
|
|
10633
|
-
srcbnUSD: string;
|
|
10634
|
-
dstChainId: SpokeChainId;
|
|
10635
|
-
dstbnUSD: string;
|
|
10636
|
-
amount: bigint;
|
|
10637
|
-
to: string;
|
|
10638
|
-
};
|
|
10639
|
-
type FormattedBnUSDMigrateParams = {
|
|
10640
|
-
srcChainId: SpokeChainId;
|
|
10641
|
-
legacybnUSD: string;
|
|
10642
|
-
newbnUSD: string;
|
|
10643
|
-
amount: bigint;
|
|
10644
|
-
to: Hex;
|
|
10645
|
-
dstChainId: SpokeChainId;
|
|
10646
|
-
};
|
|
10647
|
-
type BnUSDRevertMigrationParams = {
|
|
10648
|
-
srcChainId: SpokeChainId;
|
|
10649
|
-
legacybnUSD: string;
|
|
10650
|
-
newbnUSD: string;
|
|
10651
|
-
amount: bigint;
|
|
10652
|
-
to: Hex;
|
|
10653
|
-
dstChainId: SpokeChainId;
|
|
10654
|
-
};
|
|
10655
|
-
type BnUSDMigrationServiceConstructorParams = {
|
|
10656
|
-
hubProvider: EvmHubProvider;
|
|
10657
|
-
configService: ConfigService;
|
|
10658
|
-
};
|
|
10659
|
-
/**
|
|
10660
|
-
* Service for handling bnUSD migration operations on the hub chain.
|
|
10661
|
-
* Provides functionality to migrate between legacy and new bnUSD tokens.
|
|
10662
|
-
*/
|
|
10663
|
-
declare class BnUSDMigrationService {
|
|
10664
|
-
private readonly hubProvider;
|
|
10665
|
-
private readonly configService;
|
|
10666
|
-
constructor({ hubProvider, configService }: BnUSDMigrationServiceConstructorParams);
|
|
10667
|
-
/**
|
|
10668
|
-
* Generates transaction data for migrating legacy bnUSD tokens to new bnUSD tokens.
|
|
10669
|
-
* This method creates the necessary contract calls to:
|
|
10670
|
-
* 1. Wrap legacy bnUSD into vault tokens
|
|
10671
|
-
* 2. Migrate to new bnUSD vault
|
|
10672
|
-
* 3. Withdraw to new bnUSD tokens
|
|
10809
|
+
* 'revert',
|
|
10810
|
+
* spokeProvider, // SonicSpokeProvider instance
|
|
10811
|
+
* true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
|
|
10812
|
+
* );
|
|
10673
10813
|
*
|
|
10674
|
-
* @param params - The migration parameters including token addresses, amount, and recipient
|
|
10675
|
-
* @returns Encoded transaction data for the migration operation
|
|
10676
|
-
* @throws Will throw an error if the hub asset configuration is not found
|
|
10677
10814
|
*/
|
|
10678
|
-
|
|
10815
|
+
approve<S extends SpokeProvider, R extends boolean = false>(params: IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams, action: MigrationAction, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>>>;
|
|
10679
10816
|
/**
|
|
10680
|
-
*
|
|
10681
|
-
*
|
|
10682
|
-
* 1. Wrap new bnUSD into vault tokens
|
|
10683
|
-
* 2. Migrate to legacy bnUSD vault
|
|
10684
|
-
* 3. Withdraw to legacy bnUSD tokens
|
|
10817
|
+
* Migrates bnUSD tokens between legacy and new formats across supported spoke chains via the hub chain (sonic).
|
|
10818
|
+
* Handles both legacy-to-new and new-to-legacy bnUSD migrations, enforcing validation and relaying the transaction.
|
|
10685
10819
|
*
|
|
10686
|
-
* @param params -
|
|
10687
|
-
* @
|
|
10688
|
-
* @
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
/**
|
|
10694
|
-
* Lockup periods in seconds
|
|
10695
|
-
*/
|
|
10696
|
-
declare enum LockupPeriod {
|
|
10697
|
-
NO_LOCKUP = 0,
|
|
10698
|
-
SIX_MONTHS = 15552000,// 6 months
|
|
10699
|
-
TWELVE_MONTHS = 31104000,// 12 months
|
|
10700
|
-
EIGHTEEN_MONTHS = 46656000,// 18 months
|
|
10701
|
-
TWENTY_FOUR_MONTHS = 62208000
|
|
10702
|
-
}
|
|
10703
|
-
/**
|
|
10704
|
-
* Reward multipliers (in basis points, 10000 = 1.0)
|
|
10705
|
-
*/
|
|
10706
|
-
declare enum LockupMultiplier {
|
|
10707
|
-
NO_LOCKUP_MULTIPLIER = 5000,// 0.5x
|
|
10708
|
-
SIX_MONTHS_MULTIPLIER = 7500,// 0.75x
|
|
10709
|
-
TWELVE_MONTHS_MULTIPLIER = 10000,// 1.0x
|
|
10710
|
-
EIGHTEEN_MONTHS_MULTIPLIER = 12500,// 1.25x
|
|
10711
|
-
TWENTY_FOUR_MONTHS_MULTIPLIER = 15000
|
|
10712
|
-
}
|
|
10713
|
-
/**
|
|
10714
|
-
* Unstake request information from the staked SODA contract.
|
|
10715
|
-
*/
|
|
10716
|
-
type UnstakeRequest = {
|
|
10717
|
-
/** The amount being unstaked */
|
|
10718
|
-
amount: bigint;
|
|
10719
|
-
/** The start time of the unstake request */
|
|
10720
|
-
startTime: bigint;
|
|
10721
|
-
/** The address to receive the unstaked tokens */
|
|
10722
|
-
to: Address$1;
|
|
10723
|
-
};
|
|
10724
|
-
/**
|
|
10725
|
-
* Detailed lock information structure returned by the BALN swap contract.
|
|
10726
|
-
*/
|
|
10727
|
-
type DetailedLock = {
|
|
10728
|
-
/** The amount of BALN tokens in the lock */
|
|
10729
|
-
balnAmount: bigint;
|
|
10730
|
-
/** The amount of SODA tokens in the lock */
|
|
10731
|
-
sodaAmount: bigint;
|
|
10732
|
-
/** The unlock time for the lock */
|
|
10733
|
-
unlockTime: bigint;
|
|
10734
|
-
/** The amount of xSODA tokens in the lock */
|
|
10735
|
-
xSodaAmount: bigint;
|
|
10736
|
-
/** The unstaking ID for the lock */
|
|
10737
|
-
unstakingId: bigint;
|
|
10738
|
-
/** The unstake request information */
|
|
10739
|
-
unstakeRequest: UnstakeRequest;
|
|
10740
|
-
/** The amount of staked SODA tokens */
|
|
10741
|
-
stakedSodaAmount: bigint;
|
|
10742
|
-
};
|
|
10743
|
-
/**
|
|
10744
|
-
* Parameters for BALN swap operations.
|
|
10745
|
-
*/
|
|
10746
|
-
type BalnMigrateParams = {
|
|
10747
|
-
/** The amount of BALN tokens to swap */
|
|
10748
|
-
amount: bigint;
|
|
10749
|
-
/** The lockup period for the swap */
|
|
10750
|
-
lockupPeriod: LockupPeriod;
|
|
10751
|
-
/** The address that will receive the swapped SODA tokens */
|
|
10752
|
-
to: Address$1;
|
|
10753
|
-
/** Whether to stake the SODA tokens */
|
|
10754
|
-
stake: boolean;
|
|
10755
|
-
};
|
|
10756
|
-
/**
|
|
10757
|
-
* Parameters for BALN lock operations.
|
|
10758
|
-
*/
|
|
10759
|
-
type BalnLockParams = {
|
|
10760
|
-
/** The lock ID to operate on */
|
|
10761
|
-
lockId: bigint;
|
|
10762
|
-
};
|
|
10763
|
-
type BalnSwapServiceConstructorParams = {
|
|
10764
|
-
hubProvider: EvmHubProvider;
|
|
10765
|
-
};
|
|
10766
|
-
/**
|
|
10767
|
-
* Service for handling BALN swap operations on the hub chain.
|
|
10768
|
-
* Provides functionality to interact directly with the BALN swap contract.
|
|
10769
|
-
*/
|
|
10770
|
-
declare class BalnSwapService {
|
|
10771
|
-
private readonly hubProvider;
|
|
10772
|
-
constructor({ hubProvider }: BalnSwapServiceConstructorParams);
|
|
10773
|
-
/**
|
|
10774
|
-
* Gets the multiplier for a given lockup period.
|
|
10775
|
-
* @param lockupPeriod - The lockup period
|
|
10776
|
-
* @returns The multiplier in basis points
|
|
10777
|
-
*/
|
|
10778
|
-
getMultiplierForPeriod(lockupPeriod: LockupPeriod): bigint;
|
|
10779
|
-
/**
|
|
10780
|
-
* Calculates the SODA amount for a given BALN amount and lockup period without calling the contract.
|
|
10781
|
-
* @param balnAmount - The amount of BALN tokens
|
|
10782
|
-
* @param lockupPeriod - The lockup period
|
|
10783
|
-
* @returns The calculated SODA amount
|
|
10784
|
-
*/
|
|
10785
|
-
calculateSodaAmount(balnAmount: bigint, lockupPeriod: LockupPeriod): bigint;
|
|
10786
|
-
/**
|
|
10787
|
-
* Generates transaction data for swapping BALN tokens to SODA tokens.
|
|
10788
|
-
* This method creates the necessary contract calls to:
|
|
10789
|
-
* 1. Approve the BALN swap contract to spend the BALN tokens
|
|
10790
|
-
* 2. Execute the BALN swap with lockup period
|
|
10820
|
+
* @param params - Migration parameters, including source/destination chain IDs, token addresses, amount, and recipient.
|
|
10821
|
+
* @param spokeProvider - The SpokeProvider instance for the source chain.
|
|
10822
|
+
* @param timeout - Optional timeout in milliseconds for the relay operation (default: 60 seconds).
|
|
10823
|
+
* @param unchecked - Optional flag to skip validation checks (default: false).
|
|
10824
|
+
* @returns {Promise<Result<[string, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
|
|
10825
|
+
* Result containing a tuple: [spokeTxHash, hubTxHash] if successful, or an error describing the failure.
|
|
10791
10826
|
*
|
|
10792
|
-
* @
|
|
10793
|
-
*
|
|
10794
|
-
*
|
|
10795
|
-
*
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
*
|
|
10800
|
-
*
|
|
10801
|
-
*
|
|
10802
|
-
*
|
|
10803
|
-
*
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
*
|
|
10808
|
-
*
|
|
10809
|
-
*
|
|
10810
|
-
*
|
|
10811
|
-
*
|
|
10812
|
-
*/
|
|
10813
|
-
claimUnstaked<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
|
|
10814
|
-
/**
|
|
10815
|
-
* Executes a stake operation directly through the wallet provider.
|
|
10816
|
-
* @param params - The lock parameters including lock ID
|
|
10817
|
-
* @param spokeProvider - The Sonic spoke provider
|
|
10818
|
-
* @param raw - Whether to return raw transaction data
|
|
10819
|
-
* @returns The transaction hash or raw transaction data
|
|
10820
|
-
*/
|
|
10821
|
-
stake<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
|
|
10822
|
-
/**
|
|
10823
|
-
* Executes an unstake operation directly through the wallet provider.
|
|
10824
|
-
* @param params - The lock parameters including lock ID
|
|
10825
|
-
* @param spokeProvider - The Sonic spoke provider
|
|
10826
|
-
* @param raw - Whether to return raw transaction data
|
|
10827
|
-
* @returns The transaction hash or raw transaction data
|
|
10828
|
-
*/
|
|
10829
|
-
unstake<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
|
|
10830
|
-
/**
|
|
10831
|
-
* Executes a cancel unstake operation directly through the wallet provider.
|
|
10832
|
-
* @param params - The lock parameters including lock ID
|
|
10833
|
-
* @param spokeProvider - The Sonic spoke provider
|
|
10834
|
-
* @param raw - Whether to return raw transaction data
|
|
10835
|
-
* @returns The transaction hash or raw transaction data
|
|
10836
|
-
*/
|
|
10837
|
-
cancelUnstake<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
|
|
10838
|
-
/**
|
|
10839
|
-
* Gets detailed locks for a specific user including unstake requests and staked amounts.
|
|
10827
|
+
* @example
|
|
10828
|
+
* // Migrate legacy bnUSD to new bnUSD
|
|
10829
|
+
* const result = await sodax.migration.migratebnUSD({
|
|
10830
|
+
* srcChainId: '0x1.icon', // Source chain ID (legacy)
|
|
10831
|
+
* dstChainId: 'sonic', // Destination chain ID (new)
|
|
10832
|
+
* srcbnUSD: 'cx...', // Legacy bnUSD token address
|
|
10833
|
+
* dstbnUSD: '0x...', // New bnUSD token address
|
|
10834
|
+
* amount: 1000n, // Amount to migrate
|
|
10835
|
+
* to: '0x...', // Recipient address on destination chain
|
|
10836
|
+
* }, iconSpokeProvider);
|
|
10837
|
+
*
|
|
10838
|
+
* // Reverse migration: new bnUSD to legacy bnUSD
|
|
10839
|
+
* const result = await sodax.migration.migratebnUSD({
|
|
10840
|
+
* srcChainId: 'sonic', // Source chain ID (new)
|
|
10841
|
+
* dstChainId: '0x1.icon', // Destination chain ID (legacy)
|
|
10842
|
+
* srcbnUSD: '0x...', // New bnUSD token address
|
|
10843
|
+
* dstbnUSD: 'cx...', // Legacy bnUSD token address
|
|
10844
|
+
* amount: 1000n, // Amount to migrate
|
|
10845
|
+
* to: 'hx...', // Recipient address on destination chain
|
|
10846
|
+
* }, sonicSpokeProvider);
|
|
10840
10847
|
*
|
|
10841
|
-
*
|
|
10842
|
-
*
|
|
10843
|
-
*
|
|
10848
|
+
* if (result.ok) {
|
|
10849
|
+
* // result.value is a tuple: [spokeTxHash, hubTxHash]
|
|
10850
|
+
* const [spokeTxHash, hubTxHash] = result.value;
|
|
10851
|
+
* console.log('[migrateBnUSD] hubTxHash', hubTxHash);
|
|
10852
|
+
* console.log('[migrateBnUSD] spokeTxHash', spokeTxHash);
|
|
10853
|
+
* } else {
|
|
10854
|
+
* // Handle migration error
|
|
10855
|
+
* console.error('[migrateBnUSD] error', result.error);
|
|
10856
|
+
* }
|
|
10844
10857
|
*/
|
|
10845
|
-
|
|
10858
|
+
migratebnUSD(params: UnifiedBnUSDMigrateParams, spokeProvider: SpokeProvider, timeout?: number, unchecked?: boolean): Promise<Result<[
|
|
10859
|
+
string,
|
|
10860
|
+
Hex$1
|
|
10861
|
+
], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
|
|
10846
10862
|
/**
|
|
10847
|
-
*
|
|
10863
|
+
* Migrates ICX tokens to SODA tokens on the hub chain (sonic).
|
|
10864
|
+
* This function handles the migration of ICX tokens to SODA tokens.
|
|
10848
10865
|
*
|
|
10849
|
-
* @param
|
|
10850
|
-
* @param
|
|
10851
|
-
* @param
|
|
10852
|
-
* @
|
|
10853
|
-
*
|
|
10866
|
+
* @param params - The parameters for the migration transaction.
|
|
10867
|
+
* @param spokeProvider - The spoke provider.
|
|
10868
|
+
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
10869
|
+
* @returns {Promise<Result<[Hex, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
|
|
10870
|
+
* Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
|
|
10871
|
+
* or an error describing why the migration or relay failed.
|
|
10872
|
+
*
|
|
10873
|
+
* @example
|
|
10874
|
+
* const result = await migrationService.migrateIcxToSoda(
|
|
10875
|
+
* {
|
|
10876
|
+
* address: 'cx...', // Address of the ICX or wICX token to migrate
|
|
10877
|
+
* amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
|
|
10878
|
+
* to: '0x...', // Address to receive the migrated SODA tokens (i.e. the hub chain address)
|
|
10879
|
+
* },
|
|
10880
|
+
* spokeProvider, // IconSpokeProvider instance
|
|
10881
|
+
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
10882
|
+
* );
|
|
10883
|
+
*
|
|
10884
|
+
* if (!result.ok) {
|
|
10885
|
+
* // Handle error
|
|
10886
|
+
* }
|
|
10887
|
+
*
|
|
10888
|
+
* const [
|
|
10889
|
+
* spokeTxHash, // transaction hash on the spoke chain
|
|
10890
|
+
* hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
|
|
10891
|
+
* ] = result.value;
|
|
10892
|
+
* console.log('Migration transaction hashes:', { spokeTxHash, hubTxHash });
|
|
10854
10893
|
*/
|
|
10855
|
-
|
|
10894
|
+
migrateIcxToSoda(params: IcxMigrateParams, spokeProvider: IconSpokeProvider, timeout?: number): Promise<Result<[
|
|
10895
|
+
Hex$1,
|
|
10896
|
+
Hex$1
|
|
10897
|
+
], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
|
|
10856
10898
|
/**
|
|
10857
|
-
*
|
|
10899
|
+
* Creates a revert migration (SODA to ICX) intent and submits (relays) it to the spoke chain.
|
|
10900
|
+
* @param params - The parameters for the revert migration transaction.
|
|
10901
|
+
* @param spokeProvider - The SonicSpokeProvider instance.
|
|
10902
|
+
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
10858
10903
|
*
|
|
10859
|
-
* @
|
|
10860
|
-
*
|
|
10904
|
+
* @returns {Promise<Result<[Hex, Hex], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>}
|
|
10905
|
+
* Returns a Result containing a tuple of [hubTxHash, spokeTxHash] if successful,
|
|
10906
|
+
* or an error describing why the revert migration or relay failed.
|
|
10907
|
+
*
|
|
10908
|
+
*
|
|
10909
|
+
* @example
|
|
10910
|
+
* const result = await migrationService.revertMigrateSodaToIcx(
|
|
10911
|
+
* {
|
|
10912
|
+
* amount: 1000n, // Amount of SODA tokens to revert
|
|
10913
|
+
* to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
|
|
10914
|
+
* },
|
|
10915
|
+
* spokeProvider, // SonicSpokeProvider instance
|
|
10916
|
+
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
10917
|
+
* );
|
|
10918
|
+
*
|
|
10919
|
+
* if (!result.ok) {
|
|
10920
|
+
* // Handle error
|
|
10921
|
+
* }
|
|
10922
|
+
*
|
|
10923
|
+
* const [
|
|
10924
|
+
* hubTxHash, // transaction hash on the hub chain
|
|
10925
|
+
* spokeTxHash, // transaction hash on the spoke chain (i.e. the transaction that was relayed to the spoke)
|
|
10926
|
+
* ] = result.value;
|
|
10927
|
+
* console.log('Revert migration transaction hashes:', { hubTxHash, spokeTxHash });
|
|
10861
10928
|
*/
|
|
10862
|
-
|
|
10929
|
+
revertMigrateSodaToIcx(params: Omit<IcxCreateRevertMigrationParams, 'wICX'>, spokeProvider: SonicSpokeProvider, timeout?: number): Promise<Result<[
|
|
10930
|
+
Hex$1,
|
|
10931
|
+
Hex$1
|
|
10932
|
+
], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>;
|
|
10863
10933
|
/**
|
|
10864
|
-
*
|
|
10934
|
+
* Migrates BALN tokens to SODA tokens on the hub chain (sonic).
|
|
10935
|
+
* This function handles the migration of BALN tokens to SODA tokens.
|
|
10865
10936
|
*
|
|
10866
|
-
* @param
|
|
10867
|
-
* @
|
|
10937
|
+
* @param params - The parameters for the migration transaction.
|
|
10938
|
+
* @param spokeProvider - The spoke provider.
|
|
10939
|
+
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
10940
|
+
* @returns {Promise<Result<[Hex, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
|
|
10941
|
+
* Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
|
|
10942
|
+
* or an error describing why the migration or relay failed.
|
|
10943
|
+
*
|
|
10944
|
+
* @example
|
|
10945
|
+
* const result = await migrationService.migrateBaln(
|
|
10946
|
+
* {
|
|
10947
|
+
* amount: 1000n, // The amount of BALN tokens to swap
|
|
10948
|
+
* lockupPeriod: SIX_MONTHS, // The lockup period for the swap (see LockupPeriod type)
|
|
10949
|
+
* to: '0x...', // The hub (sonic) chain address that will receive the swapped BALN tokens
|
|
10950
|
+
* stake: true, // Whether to stake the BALN tokens
|
|
10951
|
+
* },
|
|
10952
|
+
* spokeProvider, // IconSpokeProvider instance
|
|
10953
|
+
* 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
|
|
10954
|
+
* );
|
|
10955
|
+
*
|
|
10956
|
+
* if (!result.ok) {
|
|
10957
|
+
* // Handle error
|
|
10958
|
+
* }
|
|
10959
|
+
*
|
|
10960
|
+
* const [
|
|
10961
|
+
* spokeTxHash, // transaction hash on the spoke chain
|
|
10962
|
+
* hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
|
|
10963
|
+
* ] = result.value;
|
|
10964
|
+
* console.log('Migration transaction hashes:', { spokeTxHash, hubTxHash });
|
|
10868
10965
|
*/
|
|
10869
|
-
|
|
10966
|
+
migrateBaln(params: BalnMigrateParams, spokeProvider: IconSpokeProvider, timeout?: number): Promise<Result<[
|
|
10967
|
+
Hex$1,
|
|
10968
|
+
Hex$1
|
|
10969
|
+
], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
|
|
10870
10970
|
/**
|
|
10871
|
-
*
|
|
10971
|
+
* Creates a BALN migration intent on spoke chain (icon).
|
|
10972
|
+
*
|
|
10973
|
+
* @param params - The parameters for the BALN migration transaction.
|
|
10974
|
+
* @param spokeProvider - The spoke provider.
|
|
10975
|
+
* @param raw - Whether to return the raw transaction hash instead of the transaction receipt
|
|
10976
|
+
* @returns {Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>> } - Returns the raw transaction payload or transaction hash
|
|
10977
|
+
*
|
|
10978
|
+
* @example
|
|
10979
|
+
* const result = await migrationService.createMigrateBalnIntent(
|
|
10980
|
+
* {
|
|
10981
|
+
* amount: 1000n, // The amount of BALN tokens to swap
|
|
10982
|
+
* lockupPeriod: SIX_MONTHS, // The lockup period for the swap (see LockupPeriod type)
|
|
10983
|
+
* to: '0x...', // The hub (sonic) chain address that will receive the swapped BALN tokens
|
|
10984
|
+
* stake: true, // Whether to stake the BALN tokens
|
|
10985
|
+
* },
|
|
10986
|
+
* spokeProvider, // IconSpokeProvider instance
|
|
10987
|
+
* true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
|
|
10988
|
+
* );
|
|
10872
10989
|
*
|
|
10873
|
-
* @param lockId - The lock ID to stake
|
|
10874
|
-
* @returns The encoded contract call for the stake operation
|
|
10875
10990
|
*/
|
|
10876
|
-
|
|
10991
|
+
createMigrateBalnIntent<R extends boolean = false>(params: BalnMigrateParams, spokeProvider: IconSpokeProvider, raw?: R): Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>;
|
|
10877
10992
|
/**
|
|
10878
|
-
*
|
|
10993
|
+
* Creates a bnUSD migration or reverse migration (legacy bnUSD to new bnUSD or vice versa) intent on a spoke chain.
|
|
10879
10994
|
*
|
|
10880
|
-
*
|
|
10881
|
-
*
|
|
10995
|
+
* This function prepares the transaction data for migrating legacy bnUSD to new bnUSD,
|
|
10996
|
+
* or for reverting (migrating new bnUSD back to legacy bnUSD), depending on the provided parameters.
|
|
10997
|
+
* It performs validation on chain IDs and token addresses unless `unchecked` is set to true.
|
|
10998
|
+
*
|
|
10999
|
+
* @param params - The parameters for the bnUSD migration or reverse migration transaction.
|
|
11000
|
+
* @param spokeProvider - The spoke provider instance for the source chain.
|
|
11001
|
+
* @param unchecked - If true, skips input validation (use with caution).
|
|
11002
|
+
* @param raw - If true, returns the raw transaction hash instead of the transaction receipt.
|
|
11003
|
+
* @returns {Promise<Result<TxReturnType<S, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>}
|
|
11004
|
+
* Returns a Result containing the transaction payload or hash, or an error if creation failed.
|
|
11005
|
+
*
|
|
11006
|
+
* @example
|
|
11007
|
+
* // Migrate legacy bnUSD to new bnUSD
|
|
11008
|
+
* const result = await migrationService.createMigratebnUSDIntent(
|
|
11009
|
+
* {
|
|
11010
|
+
* srcChainId: '0x1.icon', // Source chain ID (legacy bnUSD chain)
|
|
11011
|
+
* dstChainId: 'sonic', // Destination chain ID (new bnUSD chain)
|
|
11012
|
+
* srcbnUSD: 'cx...', // Legacy bnUSD token address
|
|
11013
|
+
* dstbnUSD: '0x...', // New bnUSD token address
|
|
11014
|
+
* amount: 1000n, // Amount to migrate
|
|
11015
|
+
* to: '0x...', // Recipient address on destination chain
|
|
11016
|
+
* } satisfies UnifiedBnUSDMigrateParams,
|
|
11017
|
+
* spokeProvider, // SpokeProvider instance
|
|
11018
|
+
* false, // Optional unchecked flag (validation is skipped)
|
|
11019
|
+
* true // Optional raw flag
|
|
11020
|
+
* );
|
|
11021
|
+
*
|
|
11022
|
+
* // Reverse migration: new bnUSD to legacy bnUSD
|
|
11023
|
+
* const result = await migrationService.createMigratebnUSDIntent(
|
|
11024
|
+
* {
|
|
11025
|
+
* srcChainId: 'sonic', // Source chain ID (new bnUSD chain)
|
|
11026
|
+
* dstChainId: '0x1.icon', // Destination chain ID (legacy bnUSD chain)
|
|
11027
|
+
* srcbnUSD: '0x...', // New bnUSD token address
|
|
11028
|
+
* dstbnUSD: 'cx...', // Legacy bnUSD token address
|
|
11029
|
+
* amount: 1000n, // Amount to migrate
|
|
11030
|
+
* to: 'hx...', // Recipient address on destination chain
|
|
11031
|
+
* } satisfies UnifiedBnUSDMigrateParams,
|
|
11032
|
+
* spokeProvider
|
|
11033
|
+
* );
|
|
10882
11034
|
*/
|
|
10883
|
-
|
|
11035
|
+
createMigratebnUSDIntent<S extends SpokeProvider, R extends boolean = false>(params: UnifiedBnUSDMigrateParams, spokeProvider: S, unchecked?: boolean, raw?: R): Promise<Result<[TxReturnType<S, R>, RelayExtraData], MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>;
|
|
10884
11036
|
/**
|
|
10885
|
-
*
|
|
11037
|
+
* Creates a migration of ICX to SODA intent on spoke chain (icon).
|
|
11038
|
+
* This function handles the migration of ICX or wICX tokens to SODA tokens on the hub chain.
|
|
11039
|
+
* Note: This function does not relay the transaction to the spoke chain.
|
|
11040
|
+
* You should call the `isAllowanceValid` function before calling this function to check if the allowance is valid.
|
|
11041
|
+
* You should call the `relayTxAndWaitPacket` function after calling this function to relay the transaction to the spoke chain.
|
|
10886
11042
|
*
|
|
10887
|
-
* @param
|
|
10888
|
-
* @
|
|
11043
|
+
* @param {MigrationParams} params - The parameters for the migration transaction.
|
|
11044
|
+
* @param {IconSpokeProvider} spokeProvider - The spoke provider.
|
|
11045
|
+
* @param {boolean} raw - Whether to return the raw transaction hash instead of the transaction receipt
|
|
11046
|
+
* @returns {Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>} - Returns the raw transaction payload or transaction hash
|
|
11047
|
+
*
|
|
11048
|
+
* @example
|
|
11049
|
+
* const result = await migrationService.createMigrateIcxToSodaIntent(
|
|
11050
|
+
* {
|
|
11051
|
+
* icx: 'cx...', // Address of the ICX or wICX token to migrate
|
|
11052
|
+
* amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
|
|
11053
|
+
* to: '0x...', // Address to receive the migrated SODA tokens
|
|
11054
|
+
* },
|
|
11055
|
+
* spokeProvider, // IconSpokeProvider instance
|
|
11056
|
+
* true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
|
|
11057
|
+
* );
|
|
11058
|
+
*
|
|
11059
|
+
* if (!result.ok) {
|
|
11060
|
+
* // Handle error
|
|
11061
|
+
* }
|
|
10889
11062
|
*/
|
|
10890
|
-
|
|
11063
|
+
createMigrateIcxToSodaIntent<R extends boolean = false>(params: IcxMigrateParams, spokeProvider: IconSpokeProvider, raw?: R): Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>;
|
|
10891
11064
|
/**
|
|
10892
|
-
*
|
|
10893
|
-
*
|
|
10894
|
-
*
|
|
10895
|
-
*
|
|
10896
|
-
* @
|
|
11065
|
+
* Creates a revert migration intent transaction on the hub chain.
|
|
11066
|
+
* Note: This function does not relay the transaction to the spoke chain.
|
|
11067
|
+
* You should call the `isAllowanceValid` function before calling this function to check if the allowance is valid.
|
|
11068
|
+
* You should call the `relayTxAndWaitPacket` function after calling this function to relay the transaction to the spoke chain.
|
|
11069
|
+
* @param {IcxCreateRevertMigrationParams} - The parameters for the revert migration transaction.
|
|
11070
|
+
* @param {SonicSpokeProvider} spokeProvider - The spoke provider.
|
|
11071
|
+
* @param {boolean} raw - Whether to return the raw transaction hash instead of the transaction receipt
|
|
11072
|
+
* @returns {Promise<Result<TxReturnType<SonicSpokeProvider, R>, MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'>>>} - Returns the transaction hash or error
|
|
11073
|
+
*
|
|
11074
|
+
* @example
|
|
11075
|
+
* const result = await migrationService.createRevertSodaToIcxMigrationIntent(
|
|
11076
|
+
* {
|
|
11077
|
+
* amount: 1000n, // Amount of SODA tokens to revert
|
|
11078
|
+
* to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
|
|
11079
|
+
* action: 'revert',
|
|
11080
|
+
* },
|
|
10897
11081
|
*/
|
|
10898
|
-
|
|
11082
|
+
createRevertSodaToIcxMigrationIntent<R extends boolean = false>(params: Omit<IcxCreateRevertMigrationParams, 'wICX'>, spokeProvider: SonicSpokeProvider, raw?: R): Promise<Result<TxReturnType<SonicSpokeProvider, R>, MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'>>>;
|
|
10899
11083
|
}
|
|
10900
11084
|
|
|
10901
|
-
export { type AggregatedReserveData, type AllowanceResponse, type ApiResponse, type BackendApiConfig, BackendApiService, type Balance, type BalnLockParams, type BalnMigrateParams, type BalnSwapAbi, BalnSwapService, type BalnSwapServiceConstructorParams, type BaseCurrencyInfo, BigIntToHex, type BigNumberValue, BigNumberZeroDecimal, BnUSDMigrationService, type BnUSDMigrationServiceConstructorParams, type BnUSDRevertMigrationParams, type BorrowInfo, type BridgeError, type BridgeErrorCode, type BridgeExtraData, type BridgeOptionalExtraData, type BridgeParams, BridgeService, type BridgeServiceConfig, type BridgeServiceConstructorParams, type CalculateAllReserveIncentivesRequest, type CalculateAllUserIncentivesRequest, type CalculateCompoundedRateRequest, type CancelUnstakeParams, type ClaimParams, type CombinedReserveData, type ComputedUserReserve, ConfigService, type ConfigServiceConfig, type ConfigServiceConstructorParams, type ConnMsg, type CreateBridgeIntentParams, type CreateIntentParams, type CustomProvider, CustomSorobanServer, CustomStellarAccount, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, type Default, type DepositSimulationParams, type DetailedLock, type EModeCategory, type EModeCategoryHumanized, type EModeData, type EModeDataString, type EmodeDataHumanized, Erc20Service, EvmAssetManagerService, type EvmContractCall, type EvmDepositToDataParams, type EvmGasEstimate, EvmHubProvider, type EvmHubProviderConfig, type EvmHubProviderConstructorParams, type EvmInitializedConfig, type EvmReturnType, EvmSolverService, type EvmSpokeDepositParams, EvmSpokeProvider, EvmSpokeService, type EvmTransferParams, type EvmTransferToHubParams, type EvmTxReturnType, type EvmUninitializedBrowserConfig, type EvmUninitializedConfig, type EvmUninitializedPrivateKeyConfig, EvmVaultTokenService, EvmWalletAbstraction, type EvmWithdrawAssetDataParams, type ExecuteMsg, FEE_PERCENTAGE_SCALE, type FeeAmount, type FeeData, type FormatReserveRequest, type FormatReserveResponse, type FormatReserveUSDRequest, type FormatReserveUSDResponse, type FormatReservesAndIncentivesUSDRequest, type FormatReservesUSDRequest, type FormatUserSummaryAndIncentivesRequest, type FormatUserSummaryAndIncentivesResponse, type FormatUserSummaryRequest, type FormatUserSummaryResponse, type FormattedReserveEMode, type GasEstimateType, type GetAddressType, type GetEstimateGasReturnType, type GetMigrationFailedPayload, type GetMoneyMarketError, type GetMoneyMarketParams, type GetPacketParams, type GetPacketResponse, type GetRelayRequestParamType, type GetRelayResponse, type GetSpokeDepositParamsType, type GetTransactionPacketsParams, type GetTransactionPacketsResponse, HALF_RAY, HALF_WAD, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type HashTxReturnType, type HubTxHash, ICON_TX_RESULT_WAIT_MAX_RETRY, type ISpokeProvider, type IWalletProvider, type IconContractAddress, type IconGasEstimate, type IconJsonRpcVersion, type IconRawTransaction, type IconReturnType, type IconSpokeDepositParams, IconSpokeProvider, IconSpokeService, type IconTransferToHubParams, type IcxCreateRevertMigrationParams, type IcxMigrateParams, IcxMigrationService, type IcxMigrationServiceConstructorParams, type IcxRawTransaction, type IcxRevertMigrationParams, type IcxTokenType, type IncentiveDataHumanized, type InjTokenInfo, Injective20Token, type InjectiveGasEstimate, type InjectiveReturnType, type InjectiveSpokeDepositParams, InjectiveSpokeProvider, InjectiveSpokeService, type InjectiveTransferToHubParams, type InstantUnstakeParams, type InstantiateMsg, type Intent, IntentCreatedEventAbi, type IntentCreatedEventLog, type IntentCreationFailedErrorData, type IntentData, IntentDataType, type IntentDeliveryInfo, type IntentError, type IntentErrorCode, type IntentErrorData, IntentFilledEventAbi, type IntentFilledEventLog, type IntentPostExecutionFailedErrorData, type IntentRelayRequest, type IntentRelayRequestParams, type IntentResponse, type IntentState, type IntentSubmitTxFailedErrorData, type IntentWaitUntilIntentExecutedFailedErrorData, IntentsAbi, type JsonRpcPayloadResponse, LTV_PRECISION, type LegacybnUSDChainId, type LegacybnUSDToken, type LegacybnUSDTokenAddress, LendingPoolService, LockupMultiplier, LockupPeriod, MAX_UINT256, type MigrationAction, type MigrationError, type MigrationErrorCode, type MigrationErrorData, type MigrationFailedErrorData, type MigrationParams, type MigrationRevertParams, MigrationService, type MigrationServiceConfig, type MigrationServiceConstructorParams, type MigrationTokens, type MoneyMarketAction, type MoneyMarketAsset, type MoneyMarketAssetBorrowers, type MoneyMarketAssetSuppliers, type MoneyMarketBorrowFailedError, type MoneyMarketBorrowParams, type MoneyMarketBorrowers, type MoneyMarketConfigParams, MoneyMarketDataService, type MoneyMarketEncodeBorrowParams, type MoneyMarketEncodeRepayParams, type MoneyMarketEncodeRepayWithATokensParams, type MoneyMarketEncodeSupplyParams, type MoneyMarketEncodeWithdrawParams, type MoneyMarketError, type MoneyMarketErrorCode, type MoneyMarketExtraData, type MoneyMarketOptionalExtraData, type MoneyMarketParams, type MoneyMarketPosition, type MoneyMarketRepayFailedError, type MoneyMarketRepayParams, MoneyMarketService, type MoneyMarketServiceConfig, type MoneyMarketServiceConstructorParams, type MoneyMarketSubmitTxFailedError, type MoneyMarketSupplyFailedError, type MoneyMarketSupplyParams, type MoneyMarketUnknownError, type MoneyMarketUnknownErrorCode, type MoneyMarketWithdrawFailedError, type MoneyMarketWithdrawParams, type NewbnUSDChainId, type Optional, type OptionalFee, type OptionalRaw, type OptionalTimeout, type OrderbookResponse, type PacketData, type PartnerFee, type PartnerFeeAmount, type PartnerFeeConfig, type PartnerFeePercentage, type PoolBaseCurrencyHumanized, type Prettify, type PromiseEvmTxReturnType, type PromiseIconTxReturnType, type PromiseInjectiveTxReturnType, type PromiseSolanaTxReturnType, type PromiseStellarTxReturnType, type PromiseSuiTxReturnType, type PromiseTxReturnType, type QueryMsg, type QuoteType, RAY, RAY_DECIMALS, type RawTxReturnType, type RelayAction, type RelayError, type RelayErrorCode, type RelayExtraData, type RelayOptionalExtraData, type RelayRequestDetail, type RelayRequestSigning, type RelayTxStatus, type RelayerApiConfig, type RequestConfig, type ReserveCalculationData, type ReserveData, type ReserveDataHumanized, type ReserveDataLegacy, type ReserveDataWithPrice, type ReserveEMode, type ReserveIncentiveDict, type ReservesDataHumanized, type ReservesIncentiveDataHumanized, type ResponseAddressType, type ResponseSigningType, type Result, type RewardInfoHumanized, SECONDS_PER_YEAR, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, Sodax, type SodaxConfig, type SolanaGasEstimate, type SolanaRawTransaction, type SolanaReturnType, type SolanaSpokeDepositParams, SolanaSpokeProvider, SolanaSpokeService, type SolanaTransferToHubParams, SolverApiService, type SolverConfigParams, type SolverErrorResponse, type SolverExecutionRequest, type SolverExecutionResponse, SolverIntentErrorCode, type SolverIntentQuoteRequest, type SolverIntentQuoteResponse, type SolverIntentQuoteResponseRaw, SolverIntentStatusCode, type SolverIntentStatusRequest, type SolverIntentStatusResponse, type SonicSpokeDepositParams, SonicSpokeProvider, SonicSpokeService, type SpokeDepositParams, type SpokeProvider, SpokeService, type SpokeTokenSymbols, type SpokeTxHash, type StakeParams, type StakingAction, type StakingConfig, type StakingError, type StakingErrorCode, type StakingInfo, StakingLogic, type StakingParams, StakingService, type StakingServiceConstructorParams, type State, type StellarGasEstimate, type StellarReturnType, type StellarSpokeDepositParams, StellarSpokeProvider, StellarSpokeService, type StellarTransferToHubParams, type SubmitTxParams, type SubmitTxResponse, type SuiGasEstimate, type SuiRawTransaction, type SuiReturnType, type SuiSpokeDepositParams, SuiSpokeProvider, SuiSpokeService, type SuiTransferToHubParams, SupportedMigrationTokens, type SwapParams, SwapService, type SwapServiceConfig, type SwapServiceConstructorParams, type TxReturnType, USD_DECIMALS, type UiPoolDataProviderInterface, UiPoolDataProviderService, type UnifiedBnUSDMigrateParams, type UnstakeParams, type UnstakeRequest, type UnstakeRequestWithPenalty, type UnstakeSodaRequest, type UnstakingInfo, type UserIncentiveData, type UserIncentiveDataHumanized, type UserIncentiveDict, type UserReserveCalculationData, type UserReserveData, type UserReserveDataHumanized, type UserReserveDataString, type UserReservesIncentivesDataHumanized, type UserRewardInfoHumanized, type UserUnstakeInfo, VAULT_TOKEN_DECIMALS, type VaultReserves, WAD, WAD_RAY_RATIO, WEI_DECIMALS, type WaitUntilIntentExecutedPayload, WalletAbstractionService, type WalletSimulationParams, type WithdrawInfo, adjustAmountByFee, assetManagerAbi, balnSwapAbi, binomialApproximatedRayPow, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, connectionAbi, deriveUserWalletAddress, encodeAddress, encodeContractCalls, erc20Abi, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getCompoundedBalance, getEvmViemChain, getHubChainConfig, getIconAddressBytes, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getTransactionPackets, hexToBigInt, hyper, isBalnMigrateParams, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconSpokeProvider, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveSpokeProvider, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketWithdrawUnknownError, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSolanaSpokeProvider, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isUnifiedBnUSDMigrateParams, isWaitUntilIntentExecutedFailed, nativeToUSD, newbnUSDSpokeChainIds, normalize, normalizeBN, normalizedToUsd, parseToStroops, parseTokenArrayFromJson, poolAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sleep, sonicWalletFactoryAbi, spokeAssetManagerAbi, stakedSodaAbi, stakingRouterAbi, submitTransaction, uiPoolDataAbi, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, wadToRay, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|
|
11085
|
+
export { type AggregatedReserveData, type AllowanceResponse, type ApiResponse, type BackendApiConfig, BackendApiService, type Balance, type BalnLockParams, type BalnMigrateParams, type BalnSwapAbi, BalnSwapService, type BalnSwapServiceConstructorParams, type BaseCurrencyInfo, BigIntToHex, type BigNumberValue, BigNumberZeroDecimal, BnUSDMigrationService, type BnUSDMigrationServiceConstructorParams, type BnUSDRevertMigrationParams, type BorrowInfo, type BridgeError, type BridgeErrorCode, type BridgeExtraData, type BridgeOptionalExtraData, type BridgeParams, BridgeService, type BridgeServiceConfig, type BridgeServiceConstructorParams, type CalculateAllReserveIncentivesRequest, type CalculateAllUserIncentivesRequest, type CalculateCompoundedRateRequest, type CancelUnstakeParams, type ClaimParams, type CombinedReserveData, type ComputedUserReserve, ConfigService, type ConfigServiceConfig, type ConfigServiceConstructorParams, type ConnMsg, type CreateBridgeIntentParams, type CreateIntentParams, type CustomProvider, CustomSorobanServer, CustomStellarAccount, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, type Default, type DepositSimulationParams, type DetailedLock, type EModeCategory, type EModeCategoryHumanized, type EModeData, type EModeDataString, type EmodeDataHumanized, Erc20Service, EvmAssetManagerService, EvmBaseSpokeProvider, type EvmContractCall, type EvmDepositToDataParams, type EvmGasEstimate, EvmHubProvider, type EvmHubProviderConfig, type EvmHubProviderConstructorParams, type EvmInitializedConfig, EvmRawSpokeProvider, type EvmReturnType, EvmSolverService, type EvmSpokeDepositParams, EvmSpokeProvider, type EvmSpokeProviderType, EvmSpokeService, type EvmTransferParams, type EvmTransferToHubParams, type EvmTxReturnType, type EvmUninitializedBrowserConfig, type EvmUninitializedConfig, type EvmUninitializedPrivateKeyConfig, EvmVaultTokenService, EvmWalletAbstraction, type EvmWithdrawAssetDataParams, type ExecuteMsg, FEE_PERCENTAGE_SCALE, type FeeAmount, type FeeData, type FormatReserveRequest, type FormatReserveResponse, type FormatReserveUSDRequest, type FormatReserveUSDResponse, type FormatReservesAndIncentivesUSDRequest, type FormatReservesUSDRequest, type FormatUserSummaryAndIncentivesRequest, type FormatUserSummaryAndIncentivesResponse, type FormatUserSummaryRequest, type FormatUserSummaryResponse, type FormattedReserveEMode, type GasEstimateType, type GetAddressType, type GetChainConfigType, type GetEstimateGasReturnType, type GetMigrationFailedPayload, type GetMoneyMarketError, type GetMoneyMarketParams, type GetPacketParams, type GetPacketResponse, type GetRelayRequestParamType, type GetRelayResponse, type GetSpokeDepositParamsType, type GetTransactionPacketsParams, type GetTransactionPacketsResponse, HALF_RAY, HALF_WAD, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type HashTxReturnType, type HubTxHash, ICON_TX_RESULT_WAIT_MAX_RETRY, type IRawSpokeProvider, type ISpokeProvider, type IWalletProvider, IconBaseSpokeProvider, type IconContractAddress, type IconGasEstimate, type IconJsonRpcVersion, IconRawSpokeProvider, type IconRawTransaction, type IconReturnType, type IconSpokeDepositParams, IconSpokeProvider, type IconSpokeProviderType, IconSpokeService, type IconTransferToHubParams, type IcxCreateRevertMigrationParams, type IcxMigrateParams, IcxMigrationService, type IcxMigrationServiceConstructorParams, type IcxRawTransaction, type IcxRevertMigrationParams, type IcxTokenType, type IncentiveDataHumanized, type InjTokenInfo, Injective20Token, InjectiveBaseSpokeProvider, type InjectiveGasEstimate, InjectiveRawSpokeProvider, type InjectiveReturnType, type InjectiveSpokeDepositParams, InjectiveSpokeProvider, type InjectiveSpokeProviderType, InjectiveSpokeService, type InjectiveTransferToHubParams, type InstantUnstakeParams, type InstantiateMsg, type Intent, IntentCreatedEventAbi, type IntentCreatedEventLog, type IntentCreationFailedErrorData, type IntentData, IntentDataType, type IntentDeliveryInfo, type IntentError, type IntentErrorCode, type IntentErrorData, IntentFilledEventAbi, type IntentFilledEventLog, type IntentPostExecutionFailedErrorData, type IntentRelayRequest, type IntentRelayRequestParams, type IntentResponse, type IntentState, type IntentSubmitTxFailedErrorData, type IntentWaitUntilIntentExecutedFailedErrorData, IntentsAbi, type JsonRpcPayloadResponse, LTV_PRECISION, type LegacybnUSDChainId, type LegacybnUSDToken, type LegacybnUSDTokenAddress, LendingPoolService, LockupMultiplier, LockupPeriod, MAX_UINT256, type MigrationAction, type MigrationError, type MigrationErrorCode, type MigrationErrorData, type MigrationFailedErrorData, type MigrationParams, type MigrationRevertParams, MigrationService, type MigrationServiceConfig, type MigrationServiceConstructorParams, type MigrationTokens, type MoneyMarketAction, type MoneyMarketAsset, type MoneyMarketAssetBorrowers, type MoneyMarketAssetSuppliers, type MoneyMarketBorrowFailedError, type MoneyMarketBorrowParams, type MoneyMarketBorrowers, type MoneyMarketConfigParams, MoneyMarketDataService, type MoneyMarketEncodeBorrowParams, type MoneyMarketEncodeRepayParams, type MoneyMarketEncodeRepayWithATokensParams, type MoneyMarketEncodeSupplyParams, type MoneyMarketEncodeWithdrawParams, type MoneyMarketError, type MoneyMarketErrorCode, type MoneyMarketExtraData, type MoneyMarketOptionalExtraData, type MoneyMarketParams, type MoneyMarketPosition, type MoneyMarketRepayFailedError, type MoneyMarketRepayParams, MoneyMarketService, type MoneyMarketServiceConfig, type MoneyMarketServiceConstructorParams, type MoneyMarketSubmitTxFailedError, type MoneyMarketSupplyFailedError, type MoneyMarketSupplyParams, type MoneyMarketUnknownError, type MoneyMarketUnknownErrorCode, type MoneyMarketWithdrawFailedError, type MoneyMarketWithdrawParams, type NewbnUSDChainId, type Optional, type OptionalFee, type OptionalRaw, type OptionalTimeout, type OrderbookResponse, type PacketData, type PartnerFee, type PartnerFeeAmount, type PartnerFeeConfig, type PartnerFeePercentage, type PoolBaseCurrencyHumanized, type Prettify, type PromiseEvmTxReturnType, type PromiseIconTxReturnType, type PromiseInjectiveTxReturnType, type PromiseSolanaTxReturnType, type PromiseStellarTxReturnType, type PromiseSuiTxReturnType, type PromiseTxReturnType, type QueryMsg, type QuoteType, RAY, RAY_DECIMALS, type RawSpokeProvider, type RawTxReturnType, type RelayAction, type RelayError, type RelayErrorCode, type RelayExtraData, type RelayOptionalExtraData, type RelayRequestDetail, type RelayRequestSigning, type RelayTxStatus, type RelayerApiConfig, type RequestConfig, type ReserveCalculationData, type ReserveData, type ReserveDataHumanized, type ReserveDataLegacy, type ReserveDataWithPrice, type ReserveEMode, type ReserveIncentiveDict, type ReservesDataHumanized, type ReservesIncentiveDataHumanized, type ResponseAddressType, type ResponseSigningType, type Result, type RewardInfoHumanized, SECONDS_PER_YEAR, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, Sodax, type SodaxConfig, SolanaBaseSpokeProvider, type SolanaGasEstimate, SolanaRawSpokeProvider, type SolanaRawSpokeProviderConfig, type SolanaRawTransaction, type SolanaReturnType, type SolanaSpokeDepositParams, SolanaSpokeProvider, type SolanaSpokeProviderType, SolanaSpokeService, type SolanaTransferToHubParams, SolverApiService, type SolverConfigParams, type SolverErrorResponse, type SolverExecutionRequest, type SolverExecutionResponse, SolverIntentErrorCode, type SolverIntentQuoteRequest, type SolverIntentQuoteResponse, type SolverIntentQuoteResponseRaw, SolverIntentStatusCode, type SolverIntentStatusRequest, type SolverIntentStatusResponse, SonicBaseSpokeProvider, SonicRawSpokeProvider, type SonicSpokeDepositParams, SonicSpokeProvider, type SonicSpokeProviderType, SonicSpokeService, type SpokeDepositParams, type SpokeProvider, type SpokeProviderType, SpokeService, type SpokeTokenSymbols, type SpokeTxHash, type StakeParams, type StakingAction, type StakingConfig, type StakingError, type StakingErrorCode, type StakingInfo, StakingLogic, type StakingParams, StakingService, type StakingServiceConstructorParams, type State, StellarBaseSpokeProvider, type StellarGasEstimate, StellarRawSpokeProvider, type StellarReturnType, type StellarSpokeDepositParams, StellarSpokeProvider, type StellarSpokeProviderType, StellarSpokeService, type StellarTransferToHubParams, type SubmitTxParams, type SubmitTxResponse, SuiBaseSpokeProvider, type SuiGasEstimate, SuiRawSpokeProvider, type SuiRawTransaction, type SuiReturnType, type SuiSpokeDepositParams, SuiSpokeProvider, type SuiSpokeProviderType, SuiSpokeService, type SuiTransferToHubParams, SupportedMigrationTokens, type SwapParams, SwapService, type SwapServiceConfig, type SwapServiceConstructorParams, type TxReturnType, USD_DECIMALS, type UiPoolDataProviderInterface, UiPoolDataProviderService, type UnifiedBnUSDMigrateParams, type UnstakeParams, type UnstakeRequest, type UnstakeRequestWithPenalty, type UnstakeSodaRequest, type UnstakingInfo, type UserIncentiveData, type UserIncentiveDataHumanized, type UserIncentiveDict, type UserReserveCalculationData, type UserReserveData, type UserReserveDataHumanized, type UserReserveDataString, type UserReservesIncentivesDataHumanized, type UserRewardInfoHumanized, type UserUnstakeInfo, VAULT_TOKEN_DECIMALS, type VaultReserves, WAD, WAD_RAY_RATIO, WEI_DECIMALS, type WaitUntilIntentExecutedPayload, WalletAbstractionService, type WalletSimulationParams, type WithdrawInfo, adjustAmountByFee, assetManagerAbi, balnSwapAbi, binomialApproximatedRayPow, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, connectionAbi, convertTransactionInstructionToRaw, deriveUserWalletAddress, encodeAddress, encodeContractCalls, erc20Abi, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getCompoundedBalance, getEvmViemChain, getHubChainConfig, getIconAddressBytes, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getTransactionPackets, hexToBigInt, hexToSolanaAddress, hyper, isBalnMigrateParams, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmRawSpokeProvider, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmSpokeProviderType, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconRawSpokeProvider, isIconSpokeProvider, isIconSpokeProviderType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveRawSpokeProvider, isInjectiveSpokeProvider, isInjectiveSpokeProviderType, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketWithdrawUnknownError, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isRawSpokeProvider, isResponseAddressType, isResponseSigningType, isSolanaNativeToken, isSolanaRawSpokeProvider, isSolanaSpokeProvider, isSolanaSpokeProviderType, isSonicRawSpokeProvider, isSonicSpokeProvider, isSonicSpokeProviderType, isStellarRawSpokeProvider, isStellarSpokeProvider, isStellarSpokeProviderType, isSuiRawSpokeProvider, isSuiSpokeProvider, isSuiSpokeProviderType, isUnifiedBnUSDMigrateParams, isWaitUntilIntentExecutedFailed, nativeToUSD, newbnUSDSpokeChainIds, normalize, normalizeBN, normalizedToUsd, parseToStroops, parseTokenArrayFromJson, poolAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sleep, sonicWalletFactoryAbi, spokeAssetManagerAbi, stakedSodaAbi, stakingRouterAbi, submitTransaction, uiPoolDataAbi, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, wadToRay, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|