@sodax/sdk 0.0.1-rc.17 → 0.0.1-rc.18
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/README.md +6 -5
- package/dist/index.cjs +304 -224
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1632 -1582
- package/dist/index.d.ts +1632 -1582
- package/dist/index.mjs +293 -225
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -9
package/dist/index.cjs
CHANGED
|
@@ -6239,7 +6239,7 @@ var spokeChainConfig = {
|
|
|
6239
6239
|
wrappedSonic: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38"
|
|
6240
6240
|
},
|
|
6241
6241
|
nativeToken: "0x0000000000000000000000000000000000000000",
|
|
6242
|
-
bnUSD: "
|
|
6242
|
+
bnUSD: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131",
|
|
6243
6243
|
supportedTokens: {
|
|
6244
6244
|
S: {
|
|
6245
6245
|
symbol: "S",
|
|
@@ -6247,6 +6247,12 @@ var spokeChainConfig = {
|
|
|
6247
6247
|
decimals: 18,
|
|
6248
6248
|
address: "0x0000000000000000000000000000000000000000"
|
|
6249
6249
|
},
|
|
6250
|
+
bnUSD: {
|
|
6251
|
+
symbol: "bnUSD",
|
|
6252
|
+
name: "bnUSD",
|
|
6253
|
+
decimals: 18,
|
|
6254
|
+
address: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"
|
|
6255
|
+
},
|
|
6250
6256
|
WETH: {
|
|
6251
6257
|
symbol: "WETH",
|
|
6252
6258
|
name: "Wrapped Ether",
|
|
@@ -6815,6 +6821,14 @@ var spokeChainConfig = {
|
|
|
6815
6821
|
address: "cx3975b43d260fb8ec802cef6e60c2f4d07486f11d"
|
|
6816
6822
|
},
|
|
6817
6823
|
bnUSD: {
|
|
6824
|
+
// same as legacy
|
|
6825
|
+
symbol: "bnUSD",
|
|
6826
|
+
name: "bnUSD",
|
|
6827
|
+
decimals: 18,
|
|
6828
|
+
address: "cx88fd7df7ddff82f7cc735c871dc519838cb235bb"
|
|
6829
|
+
},
|
|
6830
|
+
legacybnUSD: {
|
|
6831
|
+
// duplicate of bnUSD purely for consistency with other legacy tokens chains (sui, stellar)
|
|
6818
6832
|
symbol: "bnUSD",
|
|
6819
6833
|
name: "bnUSD",
|
|
6820
6834
|
decimals: 18,
|
|
@@ -6852,6 +6866,7 @@ var HubVaultSymbols = [
|
|
|
6852
6866
|
];
|
|
6853
6867
|
var hubVaults = {
|
|
6854
6868
|
IbnUSD: {
|
|
6869
|
+
// ICON bnUSD (Migration) vault on Sonic contains legacy bnUSD tokens (stellar, sui, icon)
|
|
6855
6870
|
address: "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51",
|
|
6856
6871
|
reserves: [
|
|
6857
6872
|
// hub asset addresses contained in the vault
|
|
@@ -6882,6 +6897,7 @@ var hubVaults = {
|
|
|
6882
6897
|
]
|
|
6883
6898
|
},
|
|
6884
6899
|
bnUSD: {
|
|
6900
|
+
// new bnUSD vault on Sonic (also contains IbnUSD vault token as part of it)
|
|
6885
6901
|
address: "0xe801ca34e19abcbfea12025378d19c4fbe250131",
|
|
6886
6902
|
reserves: [
|
|
6887
6903
|
// hub asset addresses contained in the vault
|
|
@@ -7027,6 +7043,42 @@ var hubVaults = {
|
|
|
7027
7043
|
]
|
|
7028
7044
|
}
|
|
7029
7045
|
};
|
|
7046
|
+
var bnUSDLegacySpokeChainIds = [
|
|
7047
|
+
types.ICON_MAINNET_CHAIN_ID,
|
|
7048
|
+
types.SUI_MAINNET_CHAIN_ID,
|
|
7049
|
+
types.STELLAR_MAINNET_CHAIN_ID
|
|
7050
|
+
];
|
|
7051
|
+
var newbnUSDSpokeChainIds = types.SPOKE_CHAIN_IDS.filter((chainId) => chainId !== types.ICON_MAINNET_CHAIN_ID);
|
|
7052
|
+
var bnUSDLegacyTokens = [
|
|
7053
|
+
spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
7054
|
+
spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD,
|
|
7055
|
+
spokeChainConfig[types.STELLAR_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD
|
|
7056
|
+
];
|
|
7057
|
+
var bnUSDNewTokens = newbnUSDSpokeChainIds.map((chainId) => spokeChainConfig[chainId].supportedTokens.bnUSD);
|
|
7058
|
+
var isLegacybnUSDChainId = (chainId) => {
|
|
7059
|
+
return bnUSDLegacySpokeChainIds.includes(chainId);
|
|
7060
|
+
};
|
|
7061
|
+
var isNewbnUSDChainId = (chainId) => {
|
|
7062
|
+
return newbnUSDSpokeChainIds.includes(chainId);
|
|
7063
|
+
};
|
|
7064
|
+
var isLegacybnUSDToken = (token) => {
|
|
7065
|
+
if (typeof token === "string") {
|
|
7066
|
+
return bnUSDLegacyTokens.some((t) => t.address.toLowerCase() === token.toLowerCase());
|
|
7067
|
+
}
|
|
7068
|
+
return bnUSDLegacyTokens.some((t) => t.address.toLowerCase() === token.address.toLowerCase());
|
|
7069
|
+
};
|
|
7070
|
+
var isNewbnUSDToken = (token) => {
|
|
7071
|
+
if (typeof token === "string") {
|
|
7072
|
+
return newbnUSDSpokeChainIds.map((chainId) => spokeChainConfig[chainId].supportedTokens.bnUSD).some((t) => t.address.toLowerCase() === token.toLowerCase());
|
|
7073
|
+
}
|
|
7074
|
+
return newbnUSDSpokeChainIds.map((chainId) => spokeChainConfig[chainId].supportedTokens.bnUSD).some((t) => t.address.toLowerCase() === token.address.toLowerCase());
|
|
7075
|
+
};
|
|
7076
|
+
var getAllLegacybnUSDTokens = () => {
|
|
7077
|
+
return bnUSDLegacySpokeChainIds.map((chainId) => ({
|
|
7078
|
+
token: spokeChainConfig[chainId].supportedTokens.legacybnUSD,
|
|
7079
|
+
chainId
|
|
7080
|
+
}));
|
|
7081
|
+
};
|
|
7030
7082
|
var hubAssets = {
|
|
7031
7083
|
[types.SONIC_MAINNET_CHAIN_ID]: {
|
|
7032
7084
|
[spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].nativeToken]: {
|
|
@@ -7380,7 +7432,7 @@ var hubAssets = {
|
|
|
7380
7432
|
decimal: 18,
|
|
7381
7433
|
symbol: "legacybnUSD",
|
|
7382
7434
|
name: "legacybnUSD",
|
|
7383
|
-
vault:
|
|
7435
|
+
vault: hubVaults.IbnUSD.address
|
|
7384
7436
|
}
|
|
7385
7437
|
},
|
|
7386
7438
|
[types.SUI_MAINNET_CHAIN_ID]: {
|
|
@@ -7458,7 +7510,7 @@ var hubAssets = {
|
|
|
7458
7510
|
decimal: 9,
|
|
7459
7511
|
symbol: "bnUSD",
|
|
7460
7512
|
name: "legacybnUSD",
|
|
7461
|
-
vault:
|
|
7513
|
+
vault: hubVaults.IbnUSD.address
|
|
7462
7514
|
}
|
|
7463
7515
|
},
|
|
7464
7516
|
[types.SOLANA_MAINNET_CHAIN_ID]: {
|
|
@@ -7505,7 +7557,7 @@ var hubAssets = {
|
|
|
7505
7557
|
decimal: 18,
|
|
7506
7558
|
symbol: "bnUSD",
|
|
7507
7559
|
name: "bnUSD",
|
|
7508
|
-
vault: hubVaults.
|
|
7560
|
+
vault: hubVaults.IbnUSD.address
|
|
7509
7561
|
},
|
|
7510
7562
|
[spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.BALN.address]: {
|
|
7511
7563
|
asset: "0xde8e19a099fedf9d617599f62c5f7f020d92b572",
|
|
@@ -7705,28 +7757,6 @@ var moneyMarketSupportedTokens = {
|
|
|
7705
7757
|
spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wS
|
|
7706
7758
|
]
|
|
7707
7759
|
};
|
|
7708
|
-
var migrationConfig = {
|
|
7709
|
-
bnUSD: {
|
|
7710
|
-
[types.ICON_MAINNET_CHAIN_ID]: {
|
|
7711
|
-
legacybnUSD: spokeChainConfig[types.ICON_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
|
|
7712
|
-
newbnUSD: hubVaults.bnUSD.address
|
|
7713
|
-
},
|
|
7714
|
-
[types.SUI_MAINNET_CHAIN_ID]: {
|
|
7715
|
-
legacybnUSD: spokeChainConfig[types.SUI_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD,
|
|
7716
|
-
newbnUSD: hubVaults.bnUSD.address
|
|
7717
|
-
},
|
|
7718
|
-
[types.STELLAR_MAINNET_CHAIN_ID]: {
|
|
7719
|
-
legacybnUSD: spokeChainConfig[types.STELLAR_MAINNET_CHAIN_ID].supportedTokens.legacybnUSD,
|
|
7720
|
-
newbnUSD: hubVaults.bnUSD.address
|
|
7721
|
-
}
|
|
7722
|
-
},
|
|
7723
|
-
ICX: {
|
|
7724
|
-
[types.ICON_MAINNET_CHAIN_ID]: {
|
|
7725
|
-
icx: spokeChainConfig[types.ICON_MAINNET_CHAIN_ID]["nativeToken"],
|
|
7726
|
-
wICX: spokeChainConfig[types.ICON_MAINNET_CHAIN_ID]["addresses"]["wICX"]
|
|
7727
|
-
}
|
|
7728
|
-
}
|
|
7729
|
-
};
|
|
7730
7760
|
var isMoneyMarketSupportedToken = (chainId, token) => moneyMarketSupportedTokens[chainId].some((t) => t.address.toLowerCase() === token.toLowerCase());
|
|
7731
7761
|
var getSupportedMoneyMarketTokens = (chainId) => moneyMarketSupportedTokens[chainId];
|
|
7732
7762
|
var hubVaultsAddressSet = new Set(
|
|
@@ -11674,6 +11704,18 @@ function isMoneyMarketWithdrawUnknownError(error) {
|
|
|
11674
11704
|
function isMoneyMarketRepayUnknownError(error) {
|
|
11675
11705
|
return typeof error === "object" && error !== null && "code" in error && error.code === "REPAY_UNKNOWN_ERROR";
|
|
11676
11706
|
}
|
|
11707
|
+
function isIcxMigrateParams(value) {
|
|
11708
|
+
return typeof value === "object" && value !== null && "address" in value && "amount" in value && "to" in value;
|
|
11709
|
+
}
|
|
11710
|
+
function isUnifiedBnUSDMigrateParams(value) {
|
|
11711
|
+
return typeof value === "object" && value !== null && "srcChainId" in value && "srcbnUSD" in value && "dstChainId" in value && "dstbnUSD" in value && "amount" in value && "to" in value;
|
|
11712
|
+
}
|
|
11713
|
+
function isBalnMigrateParams(value) {
|
|
11714
|
+
return typeof value === "object" && value !== null && "amount" in value && "lockupPeriod" in value && "to" in value && "stake" in value;
|
|
11715
|
+
}
|
|
11716
|
+
function isIcxCreateRevertMigrationParams(value) {
|
|
11717
|
+
return typeof value === "object" && value !== null && "amount" in value && "to" in value;
|
|
11718
|
+
}
|
|
11677
11719
|
|
|
11678
11720
|
// src/services/spoke/SpokeService.ts
|
|
11679
11721
|
var SpokeService = class {
|
|
@@ -12556,8 +12598,8 @@ var SolverService = class {
|
|
|
12556
12598
|
* // handle error
|
|
12557
12599
|
* }
|
|
12558
12600
|
*/
|
|
12559
|
-
async swap(payload, spokeProvider,
|
|
12560
|
-
return this.createAndSubmitIntent(payload, spokeProvider,
|
|
12601
|
+
async swap(payload, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
12602
|
+
return this.createAndSubmitIntent(payload, spokeProvider, this.config.partnerFee, timeout);
|
|
12561
12603
|
}
|
|
12562
12604
|
/**
|
|
12563
12605
|
* Creates an intent and submits it to the Solver API and Relayer API
|
|
@@ -12593,7 +12635,7 @@ var SolverService = class {
|
|
|
12593
12635
|
* // handle error
|
|
12594
12636
|
* }
|
|
12595
12637
|
*/
|
|
12596
|
-
async createAndSubmitIntent(payload, spokeProvider, fee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
12638
|
+
async createAndSubmitIntent(payload, spokeProvider, fee = this.config.partnerFee, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
12597
12639
|
try {
|
|
12598
12640
|
const createIntentResult = await this.createIntent(payload, spokeProvider, fee, false);
|
|
12599
12641
|
if (!createIntentResult.ok) {
|
|
@@ -13501,9 +13543,25 @@ var MigrationService = class {
|
|
|
13501
13543
|
invariant2__default.default(params.amount > 0n, "Amount must be greater than 0");
|
|
13502
13544
|
invariant2__default.default(viem.isAddress(params.to) || isIconAddress(params.to), "To address is required");
|
|
13503
13545
|
invariant2__default.default(
|
|
13504
|
-
|
|
13505
|
-
"
|
|
13546
|
+
isIcxMigrateParams(params) || isBalnMigrateParams(params) || isUnifiedBnUSDMigrateParams(params),
|
|
13547
|
+
"Invalid params"
|
|
13506
13548
|
);
|
|
13549
|
+
if (spokeProvider instanceof IconSpokeProvider && (isIcxMigrateParams(params) || isBalnMigrateParams(params))) {
|
|
13550
|
+
return {
|
|
13551
|
+
ok: true,
|
|
13552
|
+
value: true
|
|
13553
|
+
};
|
|
13554
|
+
}
|
|
13555
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13556
|
+
const evmSpokeProvider = spokeProvider;
|
|
13557
|
+
return await Erc20Service.isAllowanceValid(
|
|
13558
|
+
params.srcbnUSD,
|
|
13559
|
+
params.amount,
|
|
13560
|
+
await evmSpokeProvider.walletProvider.getWalletAddress(),
|
|
13561
|
+
evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
|
|
13562
|
+
evmSpokeProvider
|
|
13563
|
+
);
|
|
13564
|
+
}
|
|
13507
13565
|
return {
|
|
13508
13566
|
ok: true,
|
|
13509
13567
|
value: true
|
|
@@ -13512,19 +13570,28 @@ var MigrationService = class {
|
|
|
13512
13570
|
if (action === "revert") {
|
|
13513
13571
|
invariant2__default.default(params.amount > 0n, "Amount must be greater than 0");
|
|
13514
13572
|
invariant2__default.default(params.to.length > 0, "To address is required");
|
|
13515
|
-
invariant2__default.default(
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
)
|
|
13573
|
+
invariant2__default.default(isIcxCreateRevertMigrationParams(params) || isUnifiedBnUSDMigrateParams(params), "Invalid params");
|
|
13574
|
+
if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
|
|
13575
|
+
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13576
|
+
const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
13577
|
+
return await Erc20Service.isAllowanceValid(
|
|
13578
|
+
this.hubProvider.chainConfig.addresses.sodaToken,
|
|
13579
|
+
params.amount,
|
|
13580
|
+
wallet,
|
|
13581
|
+
userRouter,
|
|
13582
|
+
spokeProvider
|
|
13583
|
+
);
|
|
13584
|
+
}
|
|
13585
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13586
|
+
const evmSpokeProvider = spokeProvider;
|
|
13587
|
+
return await Erc20Service.isAllowanceValid(
|
|
13588
|
+
params.srcbnUSD,
|
|
13589
|
+
params.amount,
|
|
13590
|
+
await evmSpokeProvider.walletProvider.getWalletAddress(),
|
|
13591
|
+
evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
|
|
13592
|
+
evmSpokeProvider
|
|
13593
|
+
);
|
|
13594
|
+
}
|
|
13528
13595
|
}
|
|
13529
13596
|
return {
|
|
13530
13597
|
ok: false,
|
|
@@ -13558,25 +13625,65 @@ var MigrationService = class {
|
|
|
13558
13625
|
*/
|
|
13559
13626
|
async approve(params, action, spokeProvider, raw) {
|
|
13560
13627
|
try {
|
|
13628
|
+
if (action === "migrate") {
|
|
13629
|
+
invariant2__default.default(params.amount > 0n, "Amount must be greater than 0");
|
|
13630
|
+
invariant2__default.default(params.to.length > 0, "To address is required");
|
|
13631
|
+
invariant2__default.default(isUnifiedBnUSDMigrateParams(params), "Invalid params");
|
|
13632
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13633
|
+
const evmSpokeProvider = spokeProvider;
|
|
13634
|
+
const result = await Erc20Service.approve(
|
|
13635
|
+
params.srcbnUSD,
|
|
13636
|
+
params.amount,
|
|
13637
|
+
evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
|
|
13638
|
+
evmSpokeProvider,
|
|
13639
|
+
raw
|
|
13640
|
+
);
|
|
13641
|
+
return {
|
|
13642
|
+
ok: true,
|
|
13643
|
+
value: result
|
|
13644
|
+
};
|
|
13645
|
+
}
|
|
13646
|
+
return {
|
|
13647
|
+
ok: false,
|
|
13648
|
+
error: new Error("Invalid params for migrate action")
|
|
13649
|
+
};
|
|
13650
|
+
}
|
|
13561
13651
|
if (action === "revert") {
|
|
13562
13652
|
invariant2__default.default(params.amount > 0n, "Amount must be greater than 0");
|
|
13563
13653
|
invariant2__default.default(params.to.length > 0, "To address is required");
|
|
13564
|
-
invariant2__default.default(
|
|
13565
|
-
|
|
13566
|
-
|
|
13567
|
-
|
|
13568
|
-
|
|
13569
|
-
|
|
13570
|
-
|
|
13571
|
-
|
|
13572
|
-
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13576
|
-
|
|
13654
|
+
invariant2__default.default(isIcxCreateRevertMigrationParams(params) || isUnifiedBnUSDMigrateParams(params), "Invalid params");
|
|
13655
|
+
if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
|
|
13656
|
+
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13657
|
+
const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
13658
|
+
const result = await Erc20Service.approve(
|
|
13659
|
+
this.hubProvider.chainConfig.addresses.sodaToken,
|
|
13660
|
+
params.amount,
|
|
13661
|
+
userRouter,
|
|
13662
|
+
spokeProvider,
|
|
13663
|
+
raw
|
|
13664
|
+
);
|
|
13665
|
+
return {
|
|
13666
|
+
ok: true,
|
|
13667
|
+
value: result
|
|
13668
|
+
};
|
|
13669
|
+
}
|
|
13670
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13671
|
+
const evmSpokeProvider = spokeProvider;
|
|
13672
|
+
const result = await Erc20Service.approve(
|
|
13673
|
+
params.srcbnUSD,
|
|
13674
|
+
params.amount,
|
|
13675
|
+
evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
|
|
13676
|
+
evmSpokeProvider,
|
|
13677
|
+
raw
|
|
13678
|
+
);
|
|
13679
|
+
return {
|
|
13680
|
+
ok: true,
|
|
13681
|
+
value: result
|
|
13682
|
+
};
|
|
13683
|
+
}
|
|
13577
13684
|
return {
|
|
13578
|
-
ok:
|
|
13579
|
-
|
|
13685
|
+
ok: false,
|
|
13686
|
+
error: new Error("Invalid params or chain type for revert action")
|
|
13580
13687
|
};
|
|
13581
13688
|
}
|
|
13582
13689
|
return {
|
|
@@ -13591,27 +13698,37 @@ var MigrationService = class {
|
|
|
13591
13698
|
}
|
|
13592
13699
|
}
|
|
13593
13700
|
/**
|
|
13594
|
-
* Migrates
|
|
13595
|
-
*
|
|
13701
|
+
* Migrates bnUSD tokens between legacy and new formats across supported spoke chains via the hub chain (sonic).
|
|
13702
|
+
* Handles both legacy-to-new and new-to-legacy bnUSD migrations, enforcing validation and relaying the transaction.
|
|
13596
13703
|
*
|
|
13597
|
-
* @param params -
|
|
13598
|
-
* @param spokeProvider - The
|
|
13599
|
-
* @param timeout -
|
|
13704
|
+
* @param params - Migration parameters, including source/destination chain IDs, token addresses, amount, and recipient.
|
|
13705
|
+
* @param spokeProvider - The SpokeProvider instance for the source chain.
|
|
13706
|
+
* @param timeout - Optional timeout in milliseconds for the relay operation (default: 60 seconds).
|
|
13707
|
+
* @param unchecked - Optional flag to skip validation checks (default: false).
|
|
13600
13708
|
* @returns {Promise<Result<[string, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
|
|
13601
|
-
*
|
|
13602
|
-
* or an error describing why the migration or relay failed.
|
|
13603
|
-
*
|
|
13709
|
+
* Result containing a tuple: [spokeTxHash, hubTxHash] if successful, or an error describing the failure.
|
|
13604
13710
|
*
|
|
13605
13711
|
* @example
|
|
13606
|
-
* //
|
|
13712
|
+
* // Migrate legacy bnUSD to new bnUSD
|
|
13607
13713
|
* const result = await sodax.migration.migratebnUSD({
|
|
13608
|
-
*
|
|
13609
|
-
*
|
|
13610
|
-
*
|
|
13611
|
-
*
|
|
13612
|
-
*
|
|
13714
|
+
* srcChainId: '0x1.icon', // Source chain ID (legacy)
|
|
13715
|
+
* dstChainId: 'sonic', // Destination chain ID (new)
|
|
13716
|
+
* srcbnUSD: 'cx...', // Legacy bnUSD token address
|
|
13717
|
+
* dstbnUSD: '0x...', // New bnUSD token address
|
|
13718
|
+
* amount: 1000n, // Amount to migrate
|
|
13719
|
+
* to: '0x...', // Recipient address on destination chain
|
|
13613
13720
|
* }, iconSpokeProvider);
|
|
13614
13721
|
*
|
|
13722
|
+
* // Reverse migration: new bnUSD to legacy bnUSD
|
|
13723
|
+
* const result = await sodax.migration.migratebnUSD({
|
|
13724
|
+
* srcChainId: 'sonic', // Source chain ID (new)
|
|
13725
|
+
* dstChainId: '0x1.icon', // Destination chain ID (legacy)
|
|
13726
|
+
* srcbnUSD: '0x...', // New bnUSD token address
|
|
13727
|
+
* dstbnUSD: 'cx...', // Legacy bnUSD token address
|
|
13728
|
+
* amount: 1000n, // Amount to migrate
|
|
13729
|
+
* to: 'hx...', // Recipient address on destination chain
|
|
13730
|
+
* }, sonicSpokeProvider);
|
|
13731
|
+
*
|
|
13615
13732
|
* if (result.ok) {
|
|
13616
13733
|
* // result.value is a tuple: [spokeTxHash, hubTxHash]
|
|
13617
13734
|
* const [spokeTxHash, hubTxHash] = result.value;
|
|
@@ -13622,9 +13739,9 @@ var MigrationService = class {
|
|
|
13622
13739
|
* console.error('[migrateBnUSD] error', result.error);
|
|
13623
13740
|
* }
|
|
13624
13741
|
*/
|
|
13625
|
-
async migratebnUSD(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
13742
|
+
async migratebnUSD(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT, unchecked = false) {
|
|
13626
13743
|
try {
|
|
13627
|
-
const txResult = await this.createMigratebnUSDIntent(params, spokeProvider);
|
|
13744
|
+
const txResult = await this.createMigratebnUSDIntent(params, spokeProvider, unchecked);
|
|
13628
13745
|
if (!txResult.ok) {
|
|
13629
13746
|
return {
|
|
13630
13747
|
ok: false,
|
|
@@ -13655,70 +13772,6 @@ var MigrationService = class {
|
|
|
13655
13772
|
};
|
|
13656
13773
|
}
|
|
13657
13774
|
}
|
|
13658
|
-
/**
|
|
13659
|
-
* Reverses the migration of legacy bnUSD tokens to new bnUSD tokens on the hub chain (sonic).
|
|
13660
|
-
* This function handles the reversal of the migration of legacy bnUSD tokens to new bnUSD tokens.
|
|
13661
|
-
*
|
|
13662
|
-
* @param params - The parameters for the migration transaction.
|
|
13663
|
-
* @param spokeProvider - The spoke provider.
|
|
13664
|
-
* @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
|
|
13665
|
-
* @returns {Promise<Result<[string, Hex], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>}
|
|
13666
|
-
* Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
|
|
13667
|
-
* or an error describing why the revert migration or relay failed.
|
|
13668
|
-
*
|
|
13669
|
-
*
|
|
13670
|
-
* @example
|
|
13671
|
-
* // Example: Reverse the migration of legacy bnUSD tokens to new bnUSD tokens on the hub chain (sonic)
|
|
13672
|
-
* const result = await sodax.migration.reverseMigratebnUSD({
|
|
13673
|
-
* srcChainID: 'sonic', // source chain ID (e.g., SONIC_MAINNET_CHAIN_ID)
|
|
13674
|
-
* amount: 1000000000000000000n,
|
|
13675
|
-
* to: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd', // The spoke chain address that will receive the migrated legacy bnUSD tokens
|
|
13676
|
-
* dstChainID: '0x1.icon', // destination chain ID of type bnUSDLegacySpokeChainId (e.g., ICON_MAINNET_CHAIN_ID)
|
|
13677
|
-
* }, iconSpokeProvider);
|
|
13678
|
-
*
|
|
13679
|
-
* if (result.ok) {
|
|
13680
|
-
* // result.value is a tuple: [spokeTxHash, hubTxHash]
|
|
13681
|
-
* const [spokeTxHash, hubTxHash] = result.value;
|
|
13682
|
-
* console.log('[reverseMigrateBnUSD] hubTxHash', hubTxHash);
|
|
13683
|
-
* console.log('[reverseMigrateBnUSD] spokeTxHash', spokeTxHash);
|
|
13684
|
-
* } else {
|
|
13685
|
-
* // Handle revert migration error
|
|
13686
|
-
* console.error('[reverseMigrateBnUSD] error', result.error);
|
|
13687
|
-
* }
|
|
13688
|
-
*/
|
|
13689
|
-
async reverseMigratebnUSD(params, spokeProvider, timeout = DEFAULT_RELAY_TX_TIMEOUT) {
|
|
13690
|
-
try {
|
|
13691
|
-
const txResult = await this.createRevertMigratebnUSDIntent(params, spokeProvider);
|
|
13692
|
-
if (!txResult.ok) {
|
|
13693
|
-
return {
|
|
13694
|
-
ok: false,
|
|
13695
|
-
error: txResult.error
|
|
13696
|
-
};
|
|
13697
|
-
}
|
|
13698
|
-
const packetResult = await relayTxAndWaitPacket(
|
|
13699
|
-
txResult.value,
|
|
13700
|
-
void 0,
|
|
13701
|
-
spokeProvider,
|
|
13702
|
-
this.config.relayerApiEndpoint,
|
|
13703
|
-
timeout
|
|
13704
|
-
);
|
|
13705
|
-
if (!packetResult.ok) {
|
|
13706
|
-
return packetResult;
|
|
13707
|
-
}
|
|
13708
|
-
return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
|
|
13709
|
-
} catch (error) {
|
|
13710
|
-
return {
|
|
13711
|
-
ok: false,
|
|
13712
|
-
error: {
|
|
13713
|
-
code: "REVERT_MIGRATION_FAILED",
|
|
13714
|
-
data: {
|
|
13715
|
-
payload: params,
|
|
13716
|
-
error
|
|
13717
|
-
}
|
|
13718
|
-
}
|
|
13719
|
-
};
|
|
13720
|
-
}
|
|
13721
|
-
}
|
|
13722
13775
|
/**
|
|
13723
13776
|
* Migrates ICX tokens to SODA tokens on the hub chain (sonic).
|
|
13724
13777
|
* This function handles the migration of ICX tokens to SODA tokens.
|
|
@@ -13911,62 +13964,6 @@ var MigrationService = class {
|
|
|
13911
13964
|
};
|
|
13912
13965
|
}
|
|
13913
13966
|
}
|
|
13914
|
-
/**
|
|
13915
|
-
* Creates a revert migration intent and submits (relays) it to the spoke chain.
|
|
13916
|
-
* @param params - The parameters for the revert migration transaction.
|
|
13917
|
-
* @param spokeProvider - The spoke provider.
|
|
13918
|
-
* @param raw - Whether to return the raw transaction hash instead of the transaction receipt
|
|
13919
|
-
* @returns {Promise<Result<TxReturnType<bnUSDLegacyMigrationProviders, R>>>} - Returns the raw transaction payload or transaction hash
|
|
13920
|
-
*
|
|
13921
|
-
* @example
|
|
13922
|
-
* const result = await migrationService.createRevertMigratebnUSDIntent(
|
|
13923
|
-
* {
|
|
13924
|
-
* srcChainID: 'sonic', // The source chain ID where the new bnUSD token exists (hub chain)
|
|
13925
|
-
* amount: 1000n, // The amount of new bnUSD tokens to migrate back
|
|
13926
|
-
* to: '0x...', // The spoke chain address that will receive the migrated legacy bnUSD tokens
|
|
13927
|
-
* dstChainID: '0x1.icon', // The destination chain ID for the migration (spoke chain)
|
|
13928
|
-
* },
|
|
13929
|
-
* spokeProvider, // IconSpokeProvider instance
|
|
13930
|
-
* true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
|
|
13931
|
-
* );
|
|
13932
|
-
*
|
|
13933
|
-
*/
|
|
13934
|
-
async createRevertMigratebnUSDIntent(params, spokeProvider, raw) {
|
|
13935
|
-
try {
|
|
13936
|
-
const { legacybnUSD, newbnUSD } = migrationConfig.bnUSD[params.dstChainID];
|
|
13937
|
-
const migrationData = this.bnUSDMigrationService.revertMigrationData({
|
|
13938
|
-
...params,
|
|
13939
|
-
legacybnUSD: legacybnUSD.address,
|
|
13940
|
-
newbnUSD
|
|
13941
|
-
});
|
|
13942
|
-
const txResult = await SpokeService.deposit(
|
|
13943
|
-
{
|
|
13944
|
-
from: await spokeProvider.walletProvider.getWalletAddressBytes(),
|
|
13945
|
-
token: newbnUSD,
|
|
13946
|
-
amount: params.amount,
|
|
13947
|
-
data: migrationData
|
|
13948
|
-
},
|
|
13949
|
-
spokeProvider,
|
|
13950
|
-
this.hubProvider,
|
|
13951
|
-
raw
|
|
13952
|
-
);
|
|
13953
|
-
return {
|
|
13954
|
-
ok: true,
|
|
13955
|
-
value: txResult
|
|
13956
|
-
};
|
|
13957
|
-
} catch (error) {
|
|
13958
|
-
return {
|
|
13959
|
-
ok: false,
|
|
13960
|
-
error: {
|
|
13961
|
-
code: "CREATE_REVERT_MIGRATION_INTENT_FAILED",
|
|
13962
|
-
data: {
|
|
13963
|
-
payload: params,
|
|
13964
|
-
error
|
|
13965
|
-
}
|
|
13966
|
-
}
|
|
13967
|
-
};
|
|
13968
|
-
}
|
|
13969
|
-
}
|
|
13970
13967
|
/**
|
|
13971
13968
|
* Creates a BALN migration intent on spoke chain (icon).
|
|
13972
13969
|
*
|
|
@@ -14021,39 +14018,112 @@ var MigrationService = class {
|
|
|
14021
14018
|
}
|
|
14022
14019
|
}
|
|
14023
14020
|
/**
|
|
14024
|
-
* Creates a bnUSD migration intent on spoke chain
|
|
14021
|
+
* Creates a bnUSD migration or reverse migration (legacy bnUSD to new bnUSD or vice versa) intent on a spoke chain.
|
|
14025
14022
|
*
|
|
14026
|
-
*
|
|
14027
|
-
*
|
|
14028
|
-
*
|
|
14029
|
-
*
|
|
14023
|
+
* This function prepares the transaction data for migrating legacy bnUSD to new bnUSD,
|
|
14024
|
+
* or for reverting (migrating new bnUSD back to legacy bnUSD), depending on the provided parameters.
|
|
14025
|
+
* It performs validation on chain IDs and token addresses unless `unchecked` is set to true.
|
|
14026
|
+
*
|
|
14027
|
+
* @param params - The parameters for the bnUSD migration or reverse migration transaction.
|
|
14028
|
+
* @param spokeProvider - The spoke provider instance for the source chain.
|
|
14029
|
+
* @param unchecked - If true, skips input validation (use with caution).
|
|
14030
|
+
* @param raw - If true, returns the raw transaction hash instead of the transaction receipt.
|
|
14031
|
+
* @returns {Promise<Result<TxReturnType<S, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>}
|
|
14032
|
+
* Returns a Result containing the transaction payload or hash, or an error if creation failed.
|
|
14030
14033
|
*
|
|
14031
14034
|
* @example
|
|
14035
|
+
* // Migrate legacy bnUSD to new bnUSD
|
|
14032
14036
|
* const result = await migrationService.createMigratebnUSDIntent(
|
|
14033
14037
|
* {
|
|
14034
|
-
*
|
|
14035
|
-
*
|
|
14036
|
-
*
|
|
14037
|
-
*
|
|
14038
|
-
*
|
|
14039
|
-
*
|
|
14040
|
-
*
|
|
14038
|
+
* srcChainId: '0x1.icon', // Source chain ID (legacy bnUSD chain)
|
|
14039
|
+
* dstChainId: 'sonic', // Destination chain ID (new bnUSD chain)
|
|
14040
|
+
* srcbnUSD: 'cx...', // Legacy bnUSD token address
|
|
14041
|
+
* dstbnUSD: '0x...', // New bnUSD token address
|
|
14042
|
+
* amount: 1000n, // Amount to migrate
|
|
14043
|
+
* to: '0x...', // Recipient address on destination chain
|
|
14044
|
+
* } satisfies UnifiedBnUSDMigrateParams,
|
|
14045
|
+
* spokeProvider, // SpokeProvider instance
|
|
14046
|
+
* false, // Optional unchecked flag (validation is skipped)
|
|
14047
|
+
* true // Optional raw flag
|
|
14041
14048
|
* );
|
|
14042
14049
|
*
|
|
14050
|
+
* // Reverse migration: new bnUSD to legacy bnUSD
|
|
14051
|
+
* const result = await migrationService.createMigratebnUSDIntent(
|
|
14052
|
+
* {
|
|
14053
|
+
* srcChainId: 'sonic', // Source chain ID (new bnUSD chain)
|
|
14054
|
+
* dstChainId: '0x1.icon', // Destination chain ID (legacy bnUSD chain)
|
|
14055
|
+
* srcbnUSD: '0x...', // New bnUSD token address
|
|
14056
|
+
* dstbnUSD: 'cx...', // Legacy bnUSD token address
|
|
14057
|
+
* amount: 1000n, // Amount to migrate
|
|
14058
|
+
* to: 'hx...', // Recipient address on destination chain
|
|
14059
|
+
* } satisfies UnifiedBnUSDMigrateParams,
|
|
14060
|
+
* spokeProvider
|
|
14061
|
+
* );
|
|
14043
14062
|
*/
|
|
14044
|
-
async createMigratebnUSDIntent(params, spokeProvider, raw) {
|
|
14063
|
+
async createMigratebnUSDIntent(params, spokeProvider, unchecked = false, raw) {
|
|
14045
14064
|
try {
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14065
|
+
if (!unchecked) {
|
|
14066
|
+
invariant2__default.default(isValidSpokeChainId(params.srcChainId), "Invalid spoke source chain ID");
|
|
14067
|
+
invariant2__default.default(isValidSpokeChainId(params.dstChainId), "Invalid spoke destination chain ID");
|
|
14068
|
+
invariant2__default.default(params.srcbnUSD.length > 0, "Legacy bnUSD token address is required");
|
|
14069
|
+
invariant2__default.default(params.dstbnUSD.length > 0, "New bnUSD token address is required");
|
|
14070
|
+
invariant2__default.default(params.amount > 0, "Amount must be greater than 0");
|
|
14071
|
+
invariant2__default.default(params.to.length > 0, "Recipient address is required");
|
|
14072
|
+
invariant2__default.default(
|
|
14073
|
+
!(isLegacybnUSDToken(params.srcbnUSD) && isLegacybnUSDToken(params.dstbnUSD)),
|
|
14074
|
+
"srcbnUSD and dstbnUSD cannot both be legacy bnUSD tokens"
|
|
14075
|
+
);
|
|
14076
|
+
}
|
|
14077
|
+
let migrationData;
|
|
14078
|
+
if (isLegacybnUSDToken(params.srcbnUSD)) {
|
|
14079
|
+
if (!unchecked) {
|
|
14080
|
+
invariant2__default.default(
|
|
14081
|
+
isLegacybnUSDChainId(params.srcChainId),
|
|
14082
|
+
"srcChainId must be a legacy bnUSD chain (icon, sui, stellar) if srcbnUSD is a legacy bnUSD token"
|
|
14083
|
+
);
|
|
14084
|
+
invariant2__default.default(
|
|
14085
|
+
isNewbnUSDChainId(params.dstChainId),
|
|
14086
|
+
"dstChainId must be a new bnUSD chain (all spoke chains besides Icon) if dstbnUSD is a legacy bnUSD token"
|
|
14087
|
+
);
|
|
14088
|
+
}
|
|
14089
|
+
migrationData = this.bnUSDMigrationService.migrateData({
|
|
14090
|
+
srcChainId: params.srcChainId,
|
|
14091
|
+
legacybnUSD: params.srcbnUSD,
|
|
14092
|
+
newbnUSD: params.dstbnUSD,
|
|
14093
|
+
dstChainId: params.dstChainId,
|
|
14094
|
+
amount: params.amount,
|
|
14095
|
+
to: encodeAddress(params.dstChainId, params.to)
|
|
14096
|
+
});
|
|
14097
|
+
} else if (isLegacybnUSDToken(params.dstbnUSD)) {
|
|
14098
|
+
if (!unchecked) {
|
|
14099
|
+
invariant2__default.default(
|
|
14100
|
+
isLegacybnUSDChainId(params.dstChainId),
|
|
14101
|
+
"dstChainId must be a legacy bnUSD chain (sui, stellar, icon) if dstbnUSD is a legacy bnUSD token"
|
|
14102
|
+
);
|
|
14103
|
+
invariant2__default.default(
|
|
14104
|
+
isNewbnUSDToken(params.srcbnUSD),
|
|
14105
|
+
"srcbnUSD must be a new bnUSD token if dstbnUSD is a legacy bnUSD token"
|
|
14106
|
+
);
|
|
14107
|
+
invariant2__default.default(
|
|
14108
|
+
isNewbnUSDChainId(params.srcChainId),
|
|
14109
|
+
"srcChainId must be a new bnUSD chain (all spoke chains besides Icon) if srcbnUSD is a new bnUSD token"
|
|
14110
|
+
);
|
|
14111
|
+
}
|
|
14112
|
+
migrationData = this.bnUSDMigrationService.revertMigrationData({
|
|
14113
|
+
srcChainId: params.srcChainId,
|
|
14114
|
+
legacybnUSD: params.dstbnUSD,
|
|
14115
|
+
newbnUSD: params.srcbnUSD,
|
|
14116
|
+
dstChainId: params.dstChainId,
|
|
14117
|
+
amount: params.amount,
|
|
14118
|
+
to: encodeAddress(params.dstChainId, params.to)
|
|
14119
|
+
});
|
|
14120
|
+
} else {
|
|
14121
|
+
throw new Error("srcbnUSD or dstbnUSD must be a legacy bnUSD token");
|
|
14122
|
+
}
|
|
14053
14123
|
const txResult = await SpokeService.deposit(
|
|
14054
14124
|
{
|
|
14055
14125
|
from: await spokeProvider.walletProvider.getWalletAddress(),
|
|
14056
|
-
token:
|
|
14126
|
+
token: params.srcbnUSD,
|
|
14057
14127
|
amount: params.amount,
|
|
14058
14128
|
data: migrationData
|
|
14059
14129
|
},
|
|
@@ -14224,7 +14294,7 @@ var BnUSDMigrationService = class {
|
|
|
14224
14294
|
*/
|
|
14225
14295
|
migrateData(params) {
|
|
14226
14296
|
const calls = [];
|
|
14227
|
-
const assetConfig = getHubAssetInfo(params.
|
|
14297
|
+
const assetConfig = getHubAssetInfo(params.srcChainId, params.legacybnUSD);
|
|
14228
14298
|
invariant2__default.default(assetConfig, `hub asset not found for legacy bnUSD token: ${params.legacybnUSD}`);
|
|
14229
14299
|
const bnUSDVault = getMoneyMarketConfig(types.SONIC_MAINNET_CHAIN_ID).bnUSDVault;
|
|
14230
14300
|
calls.push(Erc20Service.encodeApprove(assetConfig.asset, assetConfig.vault, params.amount));
|
|
@@ -14236,7 +14306,7 @@ var BnUSDMigrationService = class {
|
|
|
14236
14306
|
calls.push(Erc20Service.encodeTransfer(bnUSDVault, params.to, translatedAmount));
|
|
14237
14307
|
return encodeContractCalls(calls);
|
|
14238
14308
|
}
|
|
14239
|
-
const dstAssetConfig = getHubAssetInfo(
|
|
14309
|
+
const dstAssetConfig = getHubAssetInfo(params.dstChainId, params.newbnUSD);
|
|
14240
14310
|
invariant2__default.default(dstAssetConfig, `hub asset not found for new bnUSD token: ${params.newbnUSD}`);
|
|
14241
14311
|
calls.push(EvmVaultTokenService.encodeWithdraw(bnUSDVault, dstAssetConfig.asset, translatedAmount));
|
|
14242
14312
|
const translatedAmountOut = EvmVaultTokenService.translateOutgoingDecimals(
|
|
@@ -14267,19 +14337,17 @@ var BnUSDMigrationService = class {
|
|
|
14267
14337
|
revertMigrationData(params) {
|
|
14268
14338
|
const calls = [];
|
|
14269
14339
|
const bnUSDVault = getMoneyMarketConfig(types.SONIC_MAINNET_CHAIN_ID).bnUSDVault;
|
|
14270
|
-
console.log("params.newbnUSD", params.newbnUSD);
|
|
14271
|
-
console.log("bnUSDVault", bnUSDVault);
|
|
14272
14340
|
let decimals = 18;
|
|
14273
14341
|
if (params.newbnUSD.toLowerCase() !== bnUSDVault.toLowerCase()) {
|
|
14274
|
-
const assetConfig = getHubAssetInfo(params.
|
|
14342
|
+
const assetConfig = getHubAssetInfo(params.srcChainId, params.newbnUSD);
|
|
14275
14343
|
invariant2__default.default(assetConfig, `hub asset not found for new bnUSD token: ${params.newbnUSD}`);
|
|
14276
14344
|
decimals = assetConfig.decimal;
|
|
14277
14345
|
calls.push(Erc20Service.encodeApprove(assetConfig.asset, bnUSDVault, params.amount));
|
|
14278
14346
|
calls.push(EvmVaultTokenService.encodeDeposit(bnUSDVault, assetConfig.asset, params.amount));
|
|
14279
14347
|
}
|
|
14280
14348
|
const translatedAmount = EvmVaultTokenService.translateIncomingDecimals(decimals, params.amount);
|
|
14281
|
-
const dstAssetConfig = getHubAssetInfo(params.
|
|
14282
|
-
invariant2__default.default(dstAssetConfig, `hub asset not found for
|
|
14349
|
+
const dstAssetConfig = getHubAssetInfo(params.dstChainId, params.legacybnUSD);
|
|
14350
|
+
invariant2__default.default(dstAssetConfig, `hub asset not found for new bnUSD token: ${params.legacybnUSD}`);
|
|
14283
14351
|
calls.push(EvmVaultTokenService.encodeWithdraw(bnUSDVault, dstAssetConfig.vault, translatedAmount));
|
|
14284
14352
|
calls.push(EvmVaultTokenService.encodeWithdraw(dstAssetConfig.vault, dstAssetConfig.asset, translatedAmount));
|
|
14285
14353
|
const translatedAmountOut = EvmVaultTokenService.translateOutgoingDecimals(
|
|
@@ -14645,6 +14713,9 @@ exports.VAULT_TOKEN_DECIMALS = VAULT_TOKEN_DECIMALS;
|
|
|
14645
14713
|
exports.WalletAbstractionService = WalletAbstractionService;
|
|
14646
14714
|
exports.assetManagerAbi = assetManagerAbi;
|
|
14647
14715
|
exports.balnSwapAbi = balnSwapAbi;
|
|
14716
|
+
exports.bnUSDLegacySpokeChainIds = bnUSDLegacySpokeChainIds;
|
|
14717
|
+
exports.bnUSDLegacyTokens = bnUSDLegacyTokens;
|
|
14718
|
+
exports.bnUSDNewTokens = bnUSDNewTokens;
|
|
14648
14719
|
exports.calculateFeeAmount = calculateFeeAmount;
|
|
14649
14720
|
exports.calculatePercentageFeeAmount = calculatePercentageFeeAmount;
|
|
14650
14721
|
exports.chainIdToHubAssetsMap = chainIdToHubAssetsMap;
|
|
@@ -14652,6 +14723,7 @@ exports.connectionAbi = connectionAbi;
|
|
|
14652
14723
|
exports.encodeAddress = encodeAddress;
|
|
14653
14724
|
exports.encodeContractCalls = encodeContractCalls;
|
|
14654
14725
|
exports.erc20Abi = erc20Abi;
|
|
14726
|
+
exports.getAllLegacybnUSDTokens = getAllLegacybnUSDTokens;
|
|
14655
14727
|
exports.getEvmViemChain = getEvmViemChain;
|
|
14656
14728
|
exports.getHubAssetInfo = getHubAssetInfo;
|
|
14657
14729
|
exports.getHubChainConfig = getHubChainConfig;
|
|
@@ -14673,6 +14745,7 @@ exports.hubAssets = hubAssets;
|
|
|
14673
14745
|
exports.hubVaults = hubVaults;
|
|
14674
14746
|
exports.hubVaultsAddressSet = hubVaultsAddressSet;
|
|
14675
14747
|
exports.intentRelayChainIdToSpokeChainIdMap = intentRelayChainIdToSpokeChainIdMap;
|
|
14748
|
+
exports.isBalnMigrateParams = isBalnMigrateParams;
|
|
14676
14749
|
exports.isConfiguredMoneyMarketConfig = isConfiguredMoneyMarketConfig;
|
|
14677
14750
|
exports.isConfiguredSolverConfig = isConfiguredSolverConfig;
|
|
14678
14751
|
exports.isEvmHubChainConfig = isEvmHubChainConfig;
|
|
@@ -14684,6 +14757,8 @@ exports.isEvmUninitializedConfig = isEvmUninitializedConfig;
|
|
|
14684
14757
|
exports.isEvmUninitializedPrivateKeyConfig = isEvmUninitializedPrivateKeyConfig;
|
|
14685
14758
|
exports.isIconAddress = isIconAddress;
|
|
14686
14759
|
exports.isIconSpokeProvider = isIconSpokeProvider;
|
|
14760
|
+
exports.isIcxCreateRevertMigrationParams = isIcxCreateRevertMigrationParams;
|
|
14761
|
+
exports.isIcxMigrateParams = isIcxMigrateParams;
|
|
14687
14762
|
exports.isInjectiveSpokeProvider = isInjectiveSpokeProvider;
|
|
14688
14763
|
exports.isIntentCreationFailedError = isIntentCreationFailedError;
|
|
14689
14764
|
exports.isIntentCreationUnknownError = isIntentCreationUnknownError;
|
|
@@ -14691,6 +14766,8 @@ exports.isIntentPostExecutionFailedError = isIntentPostExecutionFailedError;
|
|
|
14691
14766
|
exports.isIntentRelayChainId = isIntentRelayChainId;
|
|
14692
14767
|
exports.isIntentSubmitTxFailedError = isIntentSubmitTxFailedError;
|
|
14693
14768
|
exports.isJsonRpcPayloadResponse = isJsonRpcPayloadResponse;
|
|
14769
|
+
exports.isLegacybnUSDChainId = isLegacybnUSDChainId;
|
|
14770
|
+
exports.isLegacybnUSDToken = isLegacybnUSDToken;
|
|
14694
14771
|
exports.isMoneyMarketBorrowUnknownError = isMoneyMarketBorrowUnknownError;
|
|
14695
14772
|
exports.isMoneyMarketCreateBorrowIntentFailedError = isMoneyMarketCreateBorrowIntentFailedError;
|
|
14696
14773
|
exports.isMoneyMarketCreateRepayIntentFailedError = isMoneyMarketCreateRepayIntentFailedError;
|
|
@@ -14705,6 +14782,8 @@ exports.isMoneyMarketSupplyUnknownError = isMoneyMarketSupplyUnknownError;
|
|
|
14705
14782
|
exports.isMoneyMarketSupportedToken = isMoneyMarketSupportedToken;
|
|
14706
14783
|
exports.isMoneyMarketWithdrawUnknownError = isMoneyMarketWithdrawUnknownError;
|
|
14707
14784
|
exports.isNativeToken = isNativeToken;
|
|
14785
|
+
exports.isNewbnUSDChainId = isNewbnUSDChainId;
|
|
14786
|
+
exports.isNewbnUSDToken = isNewbnUSDToken;
|
|
14708
14787
|
exports.isPartnerFeeAmount = isPartnerFeeAmount;
|
|
14709
14788
|
exports.isPartnerFeePercentage = isPartnerFeePercentage;
|
|
14710
14789
|
exports.isResponseAddressType = isResponseAddressType;
|
|
@@ -14714,16 +14793,17 @@ exports.isSolverSupportedToken = isSolverSupportedToken;
|
|
|
14714
14793
|
exports.isSonicSpokeProvider = isSonicSpokeProvider;
|
|
14715
14794
|
exports.isStellarSpokeProvider = isStellarSpokeProvider;
|
|
14716
14795
|
exports.isSuiSpokeProvider = isSuiSpokeProvider;
|
|
14796
|
+
exports.isUnifiedBnUSDMigrateParams = isUnifiedBnUSDMigrateParams;
|
|
14717
14797
|
exports.isValidChainHubAsset = isValidChainHubAsset;
|
|
14718
14798
|
exports.isValidHubAsset = isValidHubAsset;
|
|
14719
14799
|
exports.isValidIntentRelayChainId = isValidIntentRelayChainId;
|
|
14720
14800
|
exports.isValidOriginalAssetAddress = isValidOriginalAssetAddress;
|
|
14721
14801
|
exports.isValidSpokeChainId = isValidSpokeChainId;
|
|
14722
14802
|
exports.isWaitUntilIntentExecutedFailed = isWaitUntilIntentExecutedFailed;
|
|
14723
|
-
exports.migrationConfig = migrationConfig;
|
|
14724
14803
|
exports.moneyMarketReserveAssets = moneyMarketReserveAssets;
|
|
14725
14804
|
exports.moneyMarketReserveHubAssetsSet = moneyMarketReserveHubAssetsSet;
|
|
14726
14805
|
exports.moneyMarketSupportedTokens = moneyMarketSupportedTokens;
|
|
14806
|
+
exports.newbnUSDSpokeChainIds = newbnUSDSpokeChainIds;
|
|
14727
14807
|
exports.originalAssetTohubAssetMap = originalAssetTohubAssetMap;
|
|
14728
14808
|
exports.poolAbi = poolAbi;
|
|
14729
14809
|
exports.randomUint256 = randomUint256;
|