@sodax/sdk 0.0.1-rc.33 → 0.0.1-rc.35
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 +38 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +38 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9381,7 +9381,7 @@ var SuiSpokeProvider = class _SuiSpokeProvider {
|
|
|
9381
9381
|
async transfer(token, amount, to, data, raw) {
|
|
9382
9382
|
const isNative2 = token.toLowerCase() === this.chainConfig.nativeToken.toLowerCase();
|
|
9383
9383
|
const tx = new Transaction();
|
|
9384
|
-
const walletAddress = await this.walletProvider.
|
|
9384
|
+
const walletAddress = await this.walletProvider.getWalletAddress();
|
|
9385
9385
|
const coin = isNative2 ? await this.getNativeCoin(tx, amount) : await this.getCoin(tx, token, amount, walletAddress);
|
|
9386
9386
|
const connection = this.splitAddress(this.chainConfig.addresses.connection);
|
|
9387
9387
|
const assetManager = this.splitAddress(await this.getAssetManagerAddress());
|
|
@@ -10415,7 +10415,7 @@ var StellarSpokeService = class _StellarSpokeService {
|
|
|
10415
10415
|
static async deposit(params, spokeProvider, hubProvider, raw) {
|
|
10416
10416
|
const userWallet = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
10417
10417
|
spokeProvider.chainConfig.chain.id,
|
|
10418
|
-
params.from,
|
|
10418
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
10419
10419
|
hubProvider
|
|
10420
10420
|
);
|
|
10421
10421
|
return _StellarSpokeService.transfer(
|
|
@@ -10448,7 +10448,7 @@ var StellarSpokeService = class _StellarSpokeService {
|
|
|
10448
10448
|
static async getSimulateDepositParams(params, spokeProvider, hubProvider) {
|
|
10449
10449
|
const to = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
10450
10450
|
spokeProvider.chainConfig.chain.id,
|
|
10451
|
-
params.from,
|
|
10451
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
10452
10452
|
hubProvider
|
|
10453
10453
|
);
|
|
10454
10454
|
return {
|
|
@@ -11198,6 +11198,7 @@ var SpokeService = class _SpokeService {
|
|
|
11198
11198
|
);
|
|
11199
11199
|
}
|
|
11200
11200
|
if (spokeProvider instanceof SuiSpokeProvider) {
|
|
11201
|
+
await _SpokeService.verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation);
|
|
11201
11202
|
return SuiSpokeService.deposit(
|
|
11202
11203
|
params,
|
|
11203
11204
|
spokeProvider,
|
|
@@ -13219,6 +13220,23 @@ var MigrationService = class {
|
|
|
13219
13220
|
invariant12(params.amount > 0n, "Amount must be greater than 0");
|
|
13220
13221
|
invariant12(params.to.length > 0, "To address is required");
|
|
13221
13222
|
invariant12(isIcxCreateRevertMigrationParams(params) || isUnifiedBnUSDMigrateParams(params), "Invalid params");
|
|
13223
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13224
|
+
const evmSpokeProvider = spokeProvider;
|
|
13225
|
+
let spender;
|
|
13226
|
+
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13227
|
+
if (spokeProvider instanceof SonicSpokeProvider) {
|
|
13228
|
+
spender = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
13229
|
+
} else {
|
|
13230
|
+
spender = evmSpokeProvider.chainConfig.addresses.assetManager;
|
|
13231
|
+
}
|
|
13232
|
+
return await Erc20Service.isAllowanceValid(
|
|
13233
|
+
params.srcbnUSD,
|
|
13234
|
+
params.amount,
|
|
13235
|
+
wallet,
|
|
13236
|
+
spender,
|
|
13237
|
+
evmSpokeProvider
|
|
13238
|
+
);
|
|
13239
|
+
}
|
|
13222
13240
|
if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
|
|
13223
13241
|
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13224
13242
|
const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
@@ -13230,16 +13248,6 @@ var MigrationService = class {
|
|
|
13230
13248
|
spokeProvider
|
|
13231
13249
|
);
|
|
13232
13250
|
}
|
|
13233
|
-
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13234
|
-
const evmSpokeProvider = spokeProvider;
|
|
13235
|
-
return await Erc20Service.isAllowanceValid(
|
|
13236
|
-
params.srcbnUSD,
|
|
13237
|
-
params.amount,
|
|
13238
|
-
await evmSpokeProvider.walletProvider.getWalletAddress(),
|
|
13239
|
-
evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
|
|
13240
|
-
evmSpokeProvider
|
|
13241
|
-
);
|
|
13242
|
-
}
|
|
13243
13251
|
}
|
|
13244
13252
|
return {
|
|
13245
13253
|
ok: false,
|
|
@@ -13300,14 +13308,20 @@ var MigrationService = class {
|
|
|
13300
13308
|
invariant12(params.amount > 0n, "Amount must be greater than 0");
|
|
13301
13309
|
invariant12(params.to.length > 0, "To address is required");
|
|
13302
13310
|
invariant12(isIcxCreateRevertMigrationParams(params) || isUnifiedBnUSDMigrateParams(params), "Invalid params");
|
|
13303
|
-
if (
|
|
13311
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13312
|
+
const evmSpokeProvider = spokeProvider;
|
|
13313
|
+
let spender;
|
|
13304
13314
|
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13305
|
-
|
|
13315
|
+
if (spokeProvider instanceof SonicSpokeProvider) {
|
|
13316
|
+
spender = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
13317
|
+
} else {
|
|
13318
|
+
spender = evmSpokeProvider.chainConfig.addresses.assetManager;
|
|
13319
|
+
}
|
|
13306
13320
|
const result = await Erc20Service.approve(
|
|
13307
|
-
|
|
13321
|
+
params.srcbnUSD,
|
|
13308
13322
|
params.amount,
|
|
13309
|
-
|
|
13310
|
-
|
|
13323
|
+
spender,
|
|
13324
|
+
evmSpokeProvider,
|
|
13311
13325
|
raw
|
|
13312
13326
|
);
|
|
13313
13327
|
return {
|
|
@@ -13315,13 +13329,14 @@ var MigrationService = class {
|
|
|
13315
13329
|
value: result
|
|
13316
13330
|
};
|
|
13317
13331
|
}
|
|
13318
|
-
if (
|
|
13319
|
-
const
|
|
13332
|
+
if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
|
|
13333
|
+
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13334
|
+
const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
13320
13335
|
const result = await Erc20Service.approve(
|
|
13321
|
-
|
|
13336
|
+
this.hubProvider.chainConfig.addresses.sodaToken,
|
|
13322
13337
|
params.amount,
|
|
13323
|
-
|
|
13324
|
-
|
|
13338
|
+
userRouter,
|
|
13339
|
+
spokeProvider,
|
|
13325
13340
|
raw
|
|
13326
13341
|
);
|
|
13327
13342
|
return {
|