@sodax/wallet-sdk-react 0.0.1-rc.2 → 0.0.1-rc.4
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 +14 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +15 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/useXWagmiStore.tsx +2 -2
- package/src/xchains/icon/IconXService.ts +3 -1
- package/src/xchains/injective/InjectiveXService.ts +11 -20
package/dist/index.d.cts
CHANGED
|
@@ -7,7 +7,8 @@ import { Connector } from 'wagmi';
|
|
|
7
7
|
import { IconService } from 'icon-sdk-js';
|
|
8
8
|
import { IndexerGrpcAccountPortfolioApi, ChainGrpcWasmApi } from '@injectivelabs/sdk-ts';
|
|
9
9
|
import * as _injectivelabs_wallet_core from '@injectivelabs/wallet-core';
|
|
10
|
-
import {
|
|
10
|
+
import { MsgBroadcaster } from '@injectivelabs/wallet-core';
|
|
11
|
+
import { WalletStrategy } from '@injectivelabs/wallet-strategy';
|
|
11
12
|
import { Connection } from '@solana/web3.js';
|
|
12
13
|
import { AnchorProvider } from '@coral-xyz/anchor';
|
|
13
14
|
import { WalletContextState } from '@solana/wallet-adapter-react';
|
|
@@ -1116,7 +1117,7 @@ declare class IconHanaXConnector extends XConnector {
|
|
|
1116
1117
|
|
|
1117
1118
|
declare class InjectiveXService extends XService {
|
|
1118
1119
|
private static instance;
|
|
1119
|
-
walletStrategy:
|
|
1120
|
+
walletStrategy: WalletStrategy;
|
|
1120
1121
|
indexerGrpcAccountPortfolioApi: IndexerGrpcAccountPortfolioApi;
|
|
1121
1122
|
chainGrpcWasmApi: ChainGrpcWasmApi;
|
|
1122
1123
|
msgBroadcaster: MsgBroadcaster;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ import { Connector } from 'wagmi';
|
|
|
7
7
|
import { IconService } from 'icon-sdk-js';
|
|
8
8
|
import { IndexerGrpcAccountPortfolioApi, ChainGrpcWasmApi } from '@injectivelabs/sdk-ts';
|
|
9
9
|
import * as _injectivelabs_wallet_core from '@injectivelabs/wallet-core';
|
|
10
|
-
import {
|
|
10
|
+
import { MsgBroadcaster } from '@injectivelabs/wallet-core';
|
|
11
|
+
import { WalletStrategy } from '@injectivelabs/wallet-strategy';
|
|
11
12
|
import { Connection } from '@solana/web3.js';
|
|
12
13
|
import { AnchorProvider } from '@coral-xyz/anchor';
|
|
13
14
|
import { WalletContextState } from '@solana/wallet-adapter-react';
|
|
@@ -1116,7 +1117,7 @@ declare class IconHanaXConnector extends XConnector {
|
|
|
1116
1117
|
|
|
1117
1118
|
declare class InjectiveXService extends XService {
|
|
1118
1119
|
private static instance;
|
|
1119
|
-
walletStrategy:
|
|
1120
|
+
walletStrategy: WalletStrategy;
|
|
1120
1121
|
indexerGrpcAccountPortfolioApi: IndexerGrpcAccountPortfolioApi;
|
|
1121
1122
|
chainGrpcWasmApi: ChainGrpcWasmApi;
|
|
1122
1123
|
msgBroadcaster: MsgBroadcaster;
|
package/dist/index.mjs
CHANGED
|
@@ -3,12 +3,12 @@ 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
|
-
import { ChainId
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { ChainId } from '@injectivelabs/ts-types';
|
|
10
|
+
import { MsgBroadcaster } from '@injectivelabs/wallet-core';
|
|
11
|
+
import { WalletStrategy } from '@injectivelabs/wallet-strategy';
|
|
12
12
|
import { Wallet, isEvmBrowserWallet } from '@injectivelabs/wallet-base';
|
|
13
13
|
import { isCosmosWalletInstalled } from '@injectivelabs/wallet-cosmos';
|
|
14
14
|
import { PublicKey } from '@solana/web3.js';
|
|
@@ -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"];
|
|
@@ -541,21 +543,12 @@ var InjectiveXService = class _InjectiveXService extends XService {
|
|
|
541
543
|
constructor() {
|
|
542
544
|
super("INJECTIVE");
|
|
543
545
|
const endpoints = getNetworkEndpoints(Network.Mainnet);
|
|
544
|
-
this.walletStrategy = new
|
|
546
|
+
this.walletStrategy = new WalletStrategy({
|
|
545
547
|
chainId: ChainId.Mainnet,
|
|
546
|
-
strategies: {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
evmOptions: {
|
|
551
|
-
evmChainId: EvmChainId.Mainnet,
|
|
552
|
-
rpcUrl: mainnet.rpcUrls.default.http[0]
|
|
553
|
-
}
|
|
554
|
-
})
|
|
555
|
-
// [Wallet.Keplr]: new CosmosWalletStrategy({
|
|
556
|
-
// chainId: InjectiveChainId.Mainnet,
|
|
557
|
-
// wallet: Wallet.Keplr,
|
|
558
|
-
// }),
|
|
548
|
+
strategies: {},
|
|
549
|
+
evmOptions: {
|
|
550
|
+
evmChainId: mainnet.id,
|
|
551
|
+
rpcUrl: mainnet.rpcUrls.default.http[0]
|
|
559
552
|
}
|
|
560
553
|
});
|
|
561
554
|
this.indexerGrpcAccountPortfolioApi = new IndexerGrpcAccountPortfolioApi(endpoints.indexer);
|
|
@@ -979,7 +972,7 @@ var initXServices = (config) => {
|
|
|
979
972
|
break;
|
|
980
973
|
case "INJECTIVE":
|
|
981
974
|
xServices[xChainType] = InjectiveXService.getInstance();
|
|
982
|
-
xServices[xChainType].setXConnectors([new InjectiveMetamaskXConnector()]);
|
|
975
|
+
xServices[xChainType].setXConnectors([new InjectiveMetamaskXConnector(), new InjectiveKelprXConnector()]);
|
|
983
976
|
break;
|
|
984
977
|
case "STELLAR":
|
|
985
978
|
xServices[xChainType] = StellarXService.getInstance();
|