@sodax/wallet-sdk-react 0.0.1-rc.3 → 0.0.1-rc.5
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 +9 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +8 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/hooks/useWalletProvider.ts +1 -7
- package/src/hooks/useXConnect.ts +1 -1
- package/src/xchains/icon/IconXService.ts +3 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { getPublicClient, getWalletClient } from 'wagmi/actions';
|
|
|
3
3
|
import { http, createConfig, useConnections, useAccount, useConnect, useConnectors, useDisconnect, usePublicClient, useWalletClient, useSwitchChain, WagmiProvider } from 'wagmi';
|
|
4
4
|
import { mainnet, lightlinkPhoenix, nibiru as nibiru$1, polygon as polygon$1, optimism as optimism$1, sonic as sonic$1, bsc as bsc$1, base as base$1, arbitrum as arbitrum$1, avalanche as avalanche$1 } from 'wagmi/chains';
|
|
5
5
|
import { LIGHTLINK_MAINNET_CHAIN_ID, HYPEREVM_MAINNET_CHAIN_ID, NIBIRU_MAINNET_CHAIN_ID, POLYGON_MAINNET_CHAIN_ID, OPTIMISM_MAINNET_CHAIN_ID, SONIC_MAINNET_CHAIN_ID, BSC_MAINNET_CHAIN_ID, BASE_MAINNET_CHAIN_ID, ARBITRUM_MAINNET_CHAIN_ID, AVALANCHE_MAINNET_CHAIN_ID } from '@sodax/types';
|
|
6
|
-
import
|
|
6
|
+
import * as IconSdkRaw from 'icon-sdk-js';
|
|
7
7
|
import { getNetworkEndpoints, Network } from '@injectivelabs/networks';
|
|
8
8
|
import { IndexerGrpcAccountPortfolioApi, ChainGrpcWasmApi, getInjectiveAddress } from '@injectivelabs/sdk-ts';
|
|
9
9
|
import { ChainId } from '@injectivelabs/ts-types';
|
|
@@ -428,6 +428,8 @@ var EvmXConnector = class extends XConnector {
|
|
|
428
428
|
return this.connector.icon;
|
|
429
429
|
}
|
|
430
430
|
};
|
|
431
|
+
var IconSdk = "default" in IconSdkRaw.default ? IconSdkRaw.default : IconSdkRaw;
|
|
432
|
+
var { IconService: IconServiceConstructor, Builder: IconBuilder, Converter: IconConverter } = IconSdk;
|
|
431
433
|
var CHAIN_INFO = {
|
|
432
434
|
[1 /* MAINNET */]: {
|
|
433
435
|
APIEndpoint: "https://ctz.solidwallet.io/api/v3"}
|
|
@@ -435,8 +437,8 @@ var CHAIN_INFO = {
|
|
|
435
437
|
var IconXService = class _IconXService extends XService {
|
|
436
438
|
constructor() {
|
|
437
439
|
super("ICON");
|
|
438
|
-
this.iconService = new
|
|
439
|
-
new
|
|
440
|
+
this.iconService = new IconServiceConstructor(
|
|
441
|
+
new IconServiceConstructor.HttpProvider(CHAIN_INFO[1 /* MAINNET */].APIEndpoint)
|
|
440
442
|
);
|
|
441
443
|
}
|
|
442
444
|
static getInstance() {
|
|
@@ -446,7 +448,7 @@ var IconXService = class _IconXService extends XService {
|
|
|
446
448
|
return _IconXService.instance;
|
|
447
449
|
}
|
|
448
450
|
async getAggregateData(requireSuccess, calls) {
|
|
449
|
-
const rawTx = new
|
|
451
|
+
const rawTx = new IconBuilder.CallBuilder().to("cxa4aa9185e23558cff990f494c1fd2845f6cbf741").method("tryAggregate").params({ requireSuccess: IconConverter.toHex(requireSuccess ? 1 : 0), calls }).build();
|
|
450
452
|
try {
|
|
451
453
|
const result = await this.iconService.call(rawTx).execute();
|
|
452
454
|
const aggs = result["returnData"];
|
|
@@ -1155,7 +1157,7 @@ function useXConnect() {
|
|
|
1155
1157
|
break;
|
|
1156
1158
|
case "SOLANA": {
|
|
1157
1159
|
const walletName = xConnector.wallet.adapter.name;
|
|
1158
|
-
|
|
1160
|
+
select(walletName);
|
|
1159
1161
|
const adapter = xConnector.wallet.adapter;
|
|
1160
1162
|
if (!adapter) throw new Error("No adapter found for Solana wallet");
|
|
1161
1163
|
if (walletName === "MetaMask") {
|
|
@@ -1439,13 +1441,8 @@ function useWalletProvider(spokeChainId) {
|
|
|
1439
1441
|
if (!injectiveXService) {
|
|
1440
1442
|
return void 0;
|
|
1441
1443
|
}
|
|
1442
|
-
const { walletAddress, msgBroadcaster } = {
|
|
1443
|
-
walletAddress: xAccount.address,
|
|
1444
|
-
msgBroadcaster: injectiveXService.msgBroadcaster
|
|
1445
|
-
};
|
|
1446
1444
|
return new InjectiveWalletProvider({
|
|
1447
|
-
|
|
1448
|
-
msgBroadcaster
|
|
1445
|
+
msgBroadcaster: injectiveXService.msgBroadcaster
|
|
1449
1446
|
});
|
|
1450
1447
|
}
|
|
1451
1448
|
case "STELLAR": {
|