@sodax/sdk 0.0.1-rc.40 → 0.0.1-rc.41
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 +19 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +13 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var chains = require('viem/chains');
|
|
|
5
5
|
var types = require('@sodax/types');
|
|
6
6
|
var sdkTs = require('@injectivelabs/sdk-ts');
|
|
7
7
|
var networks = require('@injectivelabs/networks');
|
|
8
|
-
var
|
|
8
|
+
var IconSdkRaw = require('icon-sdk-js');
|
|
9
9
|
var stellarSdk = require('@stellar/stellar-sdk');
|
|
10
10
|
var bcs = require('@mysten/sui/bcs');
|
|
11
11
|
var client = require('@mysten/sui/client');
|
|
@@ -39,6 +39,7 @@ function _interopNamespace(e) {
|
|
|
39
39
|
return Object.freeze(n);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
var IconSdkRaw__namespace = /*#__PURE__*/_interopNamespace(IconSdkRaw);
|
|
42
43
|
var rlp__namespace = /*#__PURE__*/_interopNamespace(rlp);
|
|
43
44
|
var anchor__namespace = /*#__PURE__*/_interopNamespace(anchor);
|
|
44
45
|
var BN__default = /*#__PURE__*/_interopDefault(BN);
|
|
@@ -8740,6 +8741,7 @@ var InjectiveSpokeProvider = class {
|
|
|
8740
8741
|
return num.toString();
|
|
8741
8742
|
}
|
|
8742
8743
|
};
|
|
8744
|
+
var IconSdk = "default" in IconSdkRaw__namespace.default ? IconSdkRaw__namespace.default : IconSdkRaw__namespace;
|
|
8743
8745
|
var IconSpokeProvider = class {
|
|
8744
8746
|
walletProvider;
|
|
8745
8747
|
chainConfig;
|
|
@@ -8748,7 +8750,7 @@ var IconSpokeProvider = class {
|
|
|
8748
8750
|
constructor(walletProvider, chainConfig, rpcUrl = "https://ctz.solidwallet.io/api/v3", debugRpcUrl = "https://ctz.solidwallet.io/api/v3d") {
|
|
8749
8751
|
this.walletProvider = walletProvider;
|
|
8750
8752
|
this.chainConfig = chainConfig;
|
|
8751
|
-
this.iconService = new
|
|
8753
|
+
this.iconService = new IconSdk.IconService(new IconSdk.IconService.HttpProvider(rpcUrl));
|
|
8752
8754
|
this.debugRpcUrl = debugRpcUrl;
|
|
8753
8755
|
}
|
|
8754
8756
|
};
|
|
@@ -10343,6 +10345,8 @@ async function estimateStepCost(rawTx, debugRpcUrl) {
|
|
|
10343
10345
|
}
|
|
10344
10346
|
|
|
10345
10347
|
// src/services/spoke/IconSpokeService.ts
|
|
10348
|
+
var IconSdk2 = "default" in IconSdkRaw__namespace.default ? IconSdkRaw__namespace.default : IconSdkRaw__namespace;
|
|
10349
|
+
var { Converter, CallTransactionBuilder, CallBuilder } = IconSdk2;
|
|
10346
10350
|
var IconSpokeService = class _IconSpokeService {
|
|
10347
10351
|
constructor() {
|
|
10348
10352
|
}
|
|
@@ -10381,7 +10385,7 @@ var IconSpokeService = class _IconSpokeService {
|
|
|
10381
10385
|
* @returns {Promise<bigint>} The balance of the token
|
|
10382
10386
|
*/
|
|
10383
10387
|
static async getDeposit(token, spokeProvider) {
|
|
10384
|
-
const transaction = new
|
|
10388
|
+
const transaction = new CallBuilder().to(token).method("balanceOf").params({ _owner: spokeProvider.chainConfig.addresses.assetManager }).build();
|
|
10385
10389
|
const result = await spokeProvider.iconService.call(transaction).execute();
|
|
10386
10390
|
return BigInt(result.value);
|
|
10387
10391
|
}
|
|
@@ -10440,8 +10444,8 @@ var IconSpokeService = class _IconSpokeService {
|
|
|
10440
10444
|
const value = isNativeToken(spokeProvider.chainConfig.chain.id, token) ? BigIntToHex(amount) : "0x0";
|
|
10441
10445
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
10442
10446
|
const to = isNativeToken(spokeProvider.chainConfig.chain.id, token) ? spokeProvider.chainConfig.addresses.wICX : token;
|
|
10443
|
-
const rawTransaction =
|
|
10444
|
-
new
|
|
10447
|
+
const rawTransaction = Converter.toRawTransaction(
|
|
10448
|
+
new CallTransactionBuilder().from(walletAddress).to(to).stepLimit(Converter.toBigNumber("2000000")).nid(spokeProvider.chainConfig.nid).version("0x3").timestamp((/* @__PURE__ */ new Date()).getTime() * 1e3).value(value).method("transfer").params(params).build()
|
|
10445
10449
|
);
|
|
10446
10450
|
if (raw) {
|
|
10447
10451
|
return rawTransaction;
|
|
@@ -10465,9 +10469,9 @@ var IconSpokeService = class _IconSpokeService {
|
|
|
10465
10469
|
payload
|
|
10466
10470
|
};
|
|
10467
10471
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
10468
|
-
const transaction = new
|
|
10472
|
+
const transaction = new CallTransactionBuilder().from(walletAddress).to(spokeProvider.chainConfig.addresses.connection).stepLimit(Converter.toBigNumber("2000000")).nid(spokeProvider.chainConfig.nid).version("0x3").timestamp((/* @__PURE__ */ new Date()).getTime() * 1e3).method("sendMessage").params(params).build();
|
|
10469
10473
|
if (raw) {
|
|
10470
|
-
return
|
|
10474
|
+
return Converter.toRawTransaction(transaction);
|
|
10471
10475
|
}
|
|
10472
10476
|
return spokeProvider.walletProvider.sendTransaction({
|
|
10473
10477
|
from: walletAddress,
|
|
@@ -11802,7 +11806,7 @@ var SpokeService = class _SpokeService {
|
|
|
11802
11806
|
}
|
|
11803
11807
|
if (isEvmSpokeProvider(spokeProvider)) {
|
|
11804
11808
|
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
11805
|
-
return await EvmSpokeService.callWallet(from, payload, spokeProvider, hubProvider);
|
|
11809
|
+
return await EvmSpokeService.callWallet(from, payload, spokeProvider, hubProvider, raw);
|
|
11806
11810
|
}
|
|
11807
11811
|
if (isInjectiveSpokeProvider(spokeProvider)) {
|
|
11808
11812
|
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
@@ -11834,7 +11838,13 @@ var SpokeService = class _SpokeService {
|
|
|
11834
11838
|
}
|
|
11835
11839
|
if (isStellarSpokeProvider(spokeProvider)) {
|
|
11836
11840
|
await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
|
|
11837
|
-
return await StellarSpokeService.callWallet(
|
|
11841
|
+
return await StellarSpokeService.callWallet(
|
|
11842
|
+
from,
|
|
11843
|
+
payload,
|
|
11844
|
+
spokeProvider,
|
|
11845
|
+
hubProvider,
|
|
11846
|
+
raw
|
|
11847
|
+
);
|
|
11838
11848
|
}
|
|
11839
11849
|
throw new Error("Invalid spoke provider");
|
|
11840
11850
|
}
|