@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.cjs
CHANGED
|
@@ -9409,7 +9409,7 @@ var SuiSpokeProvider = class _SuiSpokeProvider {
|
|
|
9409
9409
|
async transfer(token, amount, to, data, raw) {
|
|
9410
9410
|
const isNative2 = token.toLowerCase() === this.chainConfig.nativeToken.toLowerCase();
|
|
9411
9411
|
const tx = new transactions.Transaction();
|
|
9412
|
-
const walletAddress = await this.walletProvider.
|
|
9412
|
+
const walletAddress = await this.walletProvider.getWalletAddress();
|
|
9413
9413
|
const coin = isNative2 ? await this.getNativeCoin(tx, amount) : await this.getCoin(tx, token, amount, walletAddress);
|
|
9414
9414
|
const connection = this.splitAddress(this.chainConfig.addresses.connection);
|
|
9415
9415
|
const assetManager = this.splitAddress(await this.getAssetManagerAddress());
|
|
@@ -10443,7 +10443,7 @@ var StellarSpokeService = class _StellarSpokeService {
|
|
|
10443
10443
|
static async deposit(params, spokeProvider, hubProvider, raw) {
|
|
10444
10444
|
const userWallet = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
10445
10445
|
spokeProvider.chainConfig.chain.id,
|
|
10446
|
-
params.from,
|
|
10446
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
10447
10447
|
hubProvider
|
|
10448
10448
|
);
|
|
10449
10449
|
return _StellarSpokeService.transfer(
|
|
@@ -10476,7 +10476,7 @@ var StellarSpokeService = class _StellarSpokeService {
|
|
|
10476
10476
|
static async getSimulateDepositParams(params, spokeProvider, hubProvider) {
|
|
10477
10477
|
const to = params.to ?? await EvmWalletAbstraction.getUserHubWalletAddress(
|
|
10478
10478
|
spokeProvider.chainConfig.chain.id,
|
|
10479
|
-
params.from,
|
|
10479
|
+
encodeAddress(spokeProvider.chainConfig.chain.id, params.from),
|
|
10480
10480
|
hubProvider
|
|
10481
10481
|
);
|
|
10482
10482
|
return {
|
|
@@ -11226,6 +11226,7 @@ var SpokeService = class _SpokeService {
|
|
|
11226
11226
|
);
|
|
11227
11227
|
}
|
|
11228
11228
|
if (spokeProvider instanceof SuiSpokeProvider) {
|
|
11229
|
+
await _SpokeService.verifyDepositSimulation(params, spokeProvider, hubProvider, skipSimulation);
|
|
11229
11230
|
return SuiSpokeService.deposit(
|
|
11230
11231
|
params,
|
|
11231
11232
|
spokeProvider,
|
|
@@ -13247,6 +13248,23 @@ var MigrationService = class {
|
|
|
13247
13248
|
invariant12__default.default(params.amount > 0n, "Amount must be greater than 0");
|
|
13248
13249
|
invariant12__default.default(params.to.length > 0, "To address is required");
|
|
13249
13250
|
invariant12__default.default(isIcxCreateRevertMigrationParams(params) || isUnifiedBnUSDMigrateParams(params), "Invalid params");
|
|
13251
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13252
|
+
const evmSpokeProvider = spokeProvider;
|
|
13253
|
+
let spender;
|
|
13254
|
+
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13255
|
+
if (spokeProvider instanceof SonicSpokeProvider) {
|
|
13256
|
+
spender = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
13257
|
+
} else {
|
|
13258
|
+
spender = evmSpokeProvider.chainConfig.addresses.assetManager;
|
|
13259
|
+
}
|
|
13260
|
+
return await Erc20Service.isAllowanceValid(
|
|
13261
|
+
params.srcbnUSD,
|
|
13262
|
+
params.amount,
|
|
13263
|
+
wallet,
|
|
13264
|
+
spender,
|
|
13265
|
+
evmSpokeProvider
|
|
13266
|
+
);
|
|
13267
|
+
}
|
|
13250
13268
|
if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
|
|
13251
13269
|
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13252
13270
|
const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
@@ -13258,16 +13276,6 @@ var MigrationService = class {
|
|
|
13258
13276
|
spokeProvider
|
|
13259
13277
|
);
|
|
13260
13278
|
}
|
|
13261
|
-
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13262
|
-
const evmSpokeProvider = spokeProvider;
|
|
13263
|
-
return await Erc20Service.isAllowanceValid(
|
|
13264
|
-
params.srcbnUSD,
|
|
13265
|
-
params.amount,
|
|
13266
|
-
await evmSpokeProvider.walletProvider.getWalletAddress(),
|
|
13267
|
-
evmSpokeProvider instanceof EvmSpokeProvider ? evmSpokeProvider.chainConfig.addresses.assetManager : evmSpokeProvider.chainConfig.bnUSD,
|
|
13268
|
-
evmSpokeProvider
|
|
13269
|
-
);
|
|
13270
|
-
}
|
|
13271
13279
|
}
|
|
13272
13280
|
return {
|
|
13273
13281
|
ok: false,
|
|
@@ -13328,14 +13336,20 @@ var MigrationService = class {
|
|
|
13328
13336
|
invariant12__default.default(params.amount > 0n, "Amount must be greater than 0");
|
|
13329
13337
|
invariant12__default.default(params.to.length > 0, "To address is required");
|
|
13330
13338
|
invariant12__default.default(isIcxCreateRevertMigrationParams(params) || isUnifiedBnUSDMigrateParams(params), "Invalid params");
|
|
13331
|
-
if (
|
|
13339
|
+
if (isUnifiedBnUSDMigrateParams(params) && spokeProvider.chainConfig.chain.type === "EVM") {
|
|
13340
|
+
const evmSpokeProvider = spokeProvider;
|
|
13341
|
+
let spender;
|
|
13332
13342
|
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13333
|
-
|
|
13343
|
+
if (spokeProvider instanceof SonicSpokeProvider) {
|
|
13344
|
+
spender = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
13345
|
+
} else {
|
|
13346
|
+
spender = evmSpokeProvider.chainConfig.addresses.assetManager;
|
|
13347
|
+
}
|
|
13334
13348
|
const result = await Erc20Service.approve(
|
|
13335
|
-
|
|
13349
|
+
params.srcbnUSD,
|
|
13336
13350
|
params.amount,
|
|
13337
|
-
|
|
13338
|
-
|
|
13351
|
+
spender,
|
|
13352
|
+
evmSpokeProvider,
|
|
13339
13353
|
raw
|
|
13340
13354
|
);
|
|
13341
13355
|
return {
|
|
@@ -13343,13 +13357,14 @@ var MigrationService = class {
|
|
|
13343
13357
|
value: result
|
|
13344
13358
|
};
|
|
13345
13359
|
}
|
|
13346
|
-
if (
|
|
13347
|
-
const
|
|
13360
|
+
if (spokeProvider instanceof SonicSpokeProvider && isIcxCreateRevertMigrationParams(params)) {
|
|
13361
|
+
const wallet = await spokeProvider.walletProvider.getWalletAddress();
|
|
13362
|
+
const userRouter = await SonicSpokeService.getUserRouter(wallet, spokeProvider);
|
|
13348
13363
|
const result = await Erc20Service.approve(
|
|
13349
|
-
|
|
13364
|
+
this.hubProvider.chainConfig.addresses.sodaToken,
|
|
13350
13365
|
params.amount,
|
|
13351
|
-
|
|
13352
|
-
|
|
13366
|
+
userRouter,
|
|
13367
|
+
spokeProvider,
|
|
13353
13368
|
raw
|
|
13354
13369
|
);
|
|
13355
13370
|
return {
|