@sodax/wallet-sdk-react 1.4.4-beta → 1.5.0-beta
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 +21 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -7
- package/dist/index.d.ts +22 -7
- package/dist/index.mjs +21 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/SodaxWalletProvider.tsx +43 -6
- package/src/xchains/evm/EvmXService.ts +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainId, ChainType, XToken, IBitcoinWalletProvider, BtcWalletAddressType, IEvmWalletProvider, ISuiWalletProvider, IIconWalletProvider, IInjectiveWalletProvider, IStellarWalletProvider, ISolanaWalletProvider, INearWalletProvider, IStacksWalletProvider
|
|
1
|
+
import { ChainId, ChainType, XToken, IBitcoinWalletProvider, BtcWalletAddressType, RpcConfig, IEvmWalletProvider, ISuiWalletProvider, IIconWalletProvider, IInjectiveWalletProvider, IStellarWalletProvider, ISolanaWalletProvider, INearWalletProvider, IStacksWalletProvider } from '@sodax/types';
|
|
2
2
|
export { BtcWalletAddressType } from '@sodax/types';
|
|
3
3
|
import { AddressPurpose } from 'sats-connect';
|
|
4
4
|
import { Config, Connector } from 'wagmi';
|
|
@@ -239,6 +239,26 @@ declare class OKXXConnector extends BitcoinXConnector {
|
|
|
239
239
|
*/
|
|
240
240
|
declare function useBitcoinXConnectors(): BitcoinXConnector[];
|
|
241
241
|
|
|
242
|
+
type WagmiOptions = {
|
|
243
|
+
reconnectOnMount?: boolean;
|
|
244
|
+
ssr?: boolean;
|
|
245
|
+
};
|
|
246
|
+
type SodaxWalletProviderOptions = {
|
|
247
|
+
wagmi?: WagmiOptions;
|
|
248
|
+
solana?: {
|
|
249
|
+
autoConnect?: boolean;
|
|
250
|
+
};
|
|
251
|
+
sui?: {
|
|
252
|
+
autoConnect?: boolean;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
type SodaxWalletProviderProps = {
|
|
256
|
+
children: React.ReactNode;
|
|
257
|
+
rpcConfig: RpcConfig;
|
|
258
|
+
options?: SodaxWalletProviderOptions;
|
|
259
|
+
};
|
|
260
|
+
declare const SodaxWalletProvider: ({ children, rpcConfig, options }: SodaxWalletProviderProps) => React.JSX.Element;
|
|
261
|
+
|
|
242
262
|
/**
|
|
243
263
|
* Service class for handling EVM chain interactions.
|
|
244
264
|
* Implements singleton pattern and provides methods for wallet/chain operations.
|
|
@@ -599,9 +619,4 @@ declare const useXWagmiStore: zustand.UseBoundStore<Omit<Omit<Omit<zustand.Store
|
|
|
599
619
|
} | undefined): void;
|
|
600
620
|
}>;
|
|
601
621
|
|
|
602
|
-
|
|
603
|
-
children: React.ReactNode;
|
|
604
|
-
rpcConfig: RpcConfig;
|
|
605
|
-
}) => React.JSX.Element;
|
|
606
|
-
|
|
607
|
-
export { BitcoinXConnector, BitcoinXService, type CurrencyKey, EvmXConnector, EvmXService, IconHanaXConnector, IconXService, InjectiveKelprXConnector, InjectiveMetamaskXConnector, InjectiveXService, OKXXConnector, STACKS_PROVIDERS, SodaxWalletProvider, SolanaXConnector, SolanaXService, type StacksProviderConfig, StacksXConnector, StacksXService, StellarWalletsKitXConnector, StellarXService, SuiXConnector, SuiXService, UnisatXConnector, WalletId, type XAccount, type XConnection, XConnector, XService, XverseXConnector, getWagmiChainId, getXChainType, getXService, isNativeToken, switchEthereumChain, useBitcoinXConnectors, useEvmSwitchChain, useStacksXConnectors, useWalletProvider, useXAccount, useXAccounts, useXBalances, useXConnect, useXConnection, useXConnectors, useXDisconnect, useXService, useXSignMessage, useXWagmiStore };
|
|
622
|
+
export { BitcoinXConnector, BitcoinXService, type CurrencyKey, EvmXConnector, EvmXService, IconHanaXConnector, IconXService, InjectiveKelprXConnector, InjectiveMetamaskXConnector, InjectiveXService, OKXXConnector, STACKS_PROVIDERS, SodaxWalletProvider, type SodaxWalletProviderOptions, type SodaxWalletProviderProps, SolanaXConnector, SolanaXService, type StacksProviderConfig, StacksXConnector, StacksXService, StellarWalletsKitXConnector, StellarXService, SuiXConnector, SuiXService, UnisatXConnector, type WagmiOptions, WalletId, type XAccount, type XConnection, XConnector, XService, XverseXConnector, getWagmiChainId, getXChainType, getXService, isNativeToken, switchEthereumChain, useBitcoinXConnectors, useEvmSwitchChain, useStacksXConnectors, useWalletProvider, useXAccount, useXAccounts, useXBalances, useXConnect, useXConnection, useXConnectors, useXDisconnect, useXService, useXSignMessage, useXWagmiStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainId, ChainType, XToken, IBitcoinWalletProvider, BtcWalletAddressType, IEvmWalletProvider, ISuiWalletProvider, IIconWalletProvider, IInjectiveWalletProvider, IStellarWalletProvider, ISolanaWalletProvider, INearWalletProvider, IStacksWalletProvider
|
|
1
|
+
import { ChainId, ChainType, XToken, IBitcoinWalletProvider, BtcWalletAddressType, RpcConfig, IEvmWalletProvider, ISuiWalletProvider, IIconWalletProvider, IInjectiveWalletProvider, IStellarWalletProvider, ISolanaWalletProvider, INearWalletProvider, IStacksWalletProvider } from '@sodax/types';
|
|
2
2
|
export { BtcWalletAddressType } from '@sodax/types';
|
|
3
3
|
import { AddressPurpose } from 'sats-connect';
|
|
4
4
|
import { Config, Connector } from 'wagmi';
|
|
@@ -239,6 +239,26 @@ declare class OKXXConnector extends BitcoinXConnector {
|
|
|
239
239
|
*/
|
|
240
240
|
declare function useBitcoinXConnectors(): BitcoinXConnector[];
|
|
241
241
|
|
|
242
|
+
type WagmiOptions = {
|
|
243
|
+
reconnectOnMount?: boolean;
|
|
244
|
+
ssr?: boolean;
|
|
245
|
+
};
|
|
246
|
+
type SodaxWalletProviderOptions = {
|
|
247
|
+
wagmi?: WagmiOptions;
|
|
248
|
+
solana?: {
|
|
249
|
+
autoConnect?: boolean;
|
|
250
|
+
};
|
|
251
|
+
sui?: {
|
|
252
|
+
autoConnect?: boolean;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
type SodaxWalletProviderProps = {
|
|
256
|
+
children: React.ReactNode;
|
|
257
|
+
rpcConfig: RpcConfig;
|
|
258
|
+
options?: SodaxWalletProviderOptions;
|
|
259
|
+
};
|
|
260
|
+
declare const SodaxWalletProvider: ({ children, rpcConfig, options }: SodaxWalletProviderProps) => React.JSX.Element;
|
|
261
|
+
|
|
242
262
|
/**
|
|
243
263
|
* Service class for handling EVM chain interactions.
|
|
244
264
|
* Implements singleton pattern and provides methods for wallet/chain operations.
|
|
@@ -599,9 +619,4 @@ declare const useXWagmiStore: zustand.UseBoundStore<Omit<Omit<Omit<zustand.Store
|
|
|
599
619
|
} | undefined): void;
|
|
600
620
|
}>;
|
|
601
621
|
|
|
602
|
-
|
|
603
|
-
children: React.ReactNode;
|
|
604
|
-
rpcConfig: RpcConfig;
|
|
605
|
-
}) => React.JSX.Element;
|
|
606
|
-
|
|
607
|
-
export { BitcoinXConnector, BitcoinXService, type CurrencyKey, EvmXConnector, EvmXService, IconHanaXConnector, IconXService, InjectiveKelprXConnector, InjectiveMetamaskXConnector, InjectiveXService, OKXXConnector, STACKS_PROVIDERS, SodaxWalletProvider, SolanaXConnector, SolanaXService, type StacksProviderConfig, StacksXConnector, StacksXService, StellarWalletsKitXConnector, StellarXService, SuiXConnector, SuiXService, UnisatXConnector, WalletId, type XAccount, type XConnection, XConnector, XService, XverseXConnector, getWagmiChainId, getXChainType, getXService, isNativeToken, switchEthereumChain, useBitcoinXConnectors, useEvmSwitchChain, useStacksXConnectors, useWalletProvider, useXAccount, useXAccounts, useXBalances, useXConnect, useXConnection, useXConnectors, useXDisconnect, useXService, useXSignMessage, useXWagmiStore };
|
|
622
|
+
export { BitcoinXConnector, BitcoinXService, type CurrencyKey, EvmXConnector, EvmXService, IconHanaXConnector, IconXService, InjectiveKelprXConnector, InjectiveMetamaskXConnector, InjectiveXService, OKXXConnector, STACKS_PROVIDERS, SodaxWalletProvider, type SodaxWalletProviderOptions, type SodaxWalletProviderProps, SolanaXConnector, SolanaXService, type StacksProviderConfig, StacksXConnector, StacksXService, StellarWalletsKitXConnector, StellarXService, SuiXConnector, SuiXService, UnisatXConnector, type WagmiOptions, WalletId, type XAccount, type XConnection, XConnector, XService, XverseXConnector, getWagmiChainId, getXChainType, getXService, isNativeToken, switchEthereumChain, useBitcoinXConnectors, useEvmSwitchChain, useStacksXConnectors, useWalletProvider, useXAccount, useXAccounts, useXBalances, useXConnect, useXConnection, useXConnectors, useXDisconnect, useXService, useXSignMessage, useXWagmiStore };
|
package/dist/index.mjs
CHANGED
|
@@ -591,7 +591,7 @@ var hyper = /* @__PURE__ */ defineChain({
|
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
593
|
});
|
|
594
|
-
var createWagmiConfig = (config) => {
|
|
594
|
+
var createWagmiConfig = (config, options) => {
|
|
595
595
|
return createConfig({
|
|
596
596
|
chains: [
|
|
597
597
|
mainnet,
|
|
@@ -607,7 +607,7 @@ var createWagmiConfig = (config) => {
|
|
|
607
607
|
kaia,
|
|
608
608
|
redbellyMainnet
|
|
609
609
|
],
|
|
610
|
-
ssr:
|
|
610
|
+
ssr: options?.ssr,
|
|
611
611
|
transports: {
|
|
612
612
|
[mainnet.id]: http(config[ETHEREUM_MAINNET_CHAIN_ID]),
|
|
613
613
|
[avalanche.id]: http(config[AVALANCHE_MAINNET_CHAIN_ID]),
|
|
@@ -2031,12 +2031,27 @@ var reconnectStellar = async () => {
|
|
|
2031
2031
|
});
|
|
2032
2032
|
};
|
|
2033
2033
|
var queryClient = new QueryClient();
|
|
2034
|
-
var
|
|
2034
|
+
var defaultOptions = {
|
|
2035
|
+
wagmi: {
|
|
2036
|
+
reconnectOnMount: false,
|
|
2037
|
+
ssr: true
|
|
2038
|
+
},
|
|
2039
|
+
solana: {
|
|
2040
|
+
autoConnect: true
|
|
2041
|
+
},
|
|
2042
|
+
sui: {
|
|
2043
|
+
autoConnect: true
|
|
2044
|
+
}
|
|
2045
|
+
};
|
|
2046
|
+
var SodaxWalletProvider = ({ children, rpcConfig, options }) => {
|
|
2047
|
+
const wagmi = useMemo(() => ({ ...defaultOptions.wagmi, ...options?.wagmi }), [options?.wagmi]);
|
|
2035
2048
|
const wagmiConfig = useMemo(() => {
|
|
2036
|
-
return createWagmiConfig(rpcConfig);
|
|
2037
|
-
}, [rpcConfig]);
|
|
2049
|
+
return createWagmiConfig(rpcConfig, wagmi);
|
|
2050
|
+
}, [rpcConfig, wagmi]);
|
|
2038
2051
|
const wallets = useMemo(() => [new UnsafeBurnerWalletAdapter()], []);
|
|
2039
|
-
|
|
2052
|
+
const solana = useMemo(() => ({ ...defaultOptions.solana, ...options?.solana }), [options?.solana]);
|
|
2053
|
+
const sui = useMemo(() => ({ ...defaultOptions.sui, ...options?.sui }), [options?.sui]);
|
|
2054
|
+
return /* @__PURE__ */ React2.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React2.createElement(WagmiProvider, { reconnectOnMount: wagmi.reconnectOnMount, config: wagmiConfig }, /* @__PURE__ */ React2.createElement(SuiClientProvider, { networks: { mainnet: { url: getFullnodeUrl("mainnet") } }, defaultNetwork: "mainnet" }, /* @__PURE__ */ React2.createElement(WalletProvider, { autoConnect: sui.autoConnect }, /* @__PURE__ */ React2.createElement(ConnectionProvider, { endpoint: rpcConfig["solana"] ?? "https://api.mainnet-beta.solana.com" }, /* @__PURE__ */ React2.createElement(WalletProvider$1, { wallets, autoConnect: solana.autoConnect }, /* @__PURE__ */ React2.createElement(Hydrate, { rpcConfig }), children))))));
|
|
2040
2055
|
};
|
|
2041
2056
|
reconnectIcon();
|
|
2042
2057
|
reconnectStellar();
|