@sodax/wallet-sdk-react 1.5.7-beta → 2.0.0-rc.10
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/README.md +107 -142
- package/dist/XConnector-12q0OVe5.d.ts +146 -0
- package/dist/chunk-7V7O3Q7Y.mjs +62 -0
- package/dist/chunk-C6M34IVL.mjs +86 -0
- package/dist/chunk-DQTYAMKF.mjs +1609 -0
- package/dist/chunk-FSOGMSJH.mjs +39 -0
- package/dist/chunk-IFXZQW4C.mjs +98 -0
- package/dist/chunk-JQ4H4GJ5.mjs +100 -0
- package/dist/chunk-LKSSME2J.mjs +31 -0
- package/dist/chunk-MWWVB7TD.mjs +123 -0
- package/dist/chunk-NAKCAL2M.mjs +32 -0
- package/dist/chunk-OPYSVPRW.mjs +144 -0
- package/dist/chunk-QMXBY3UI.mjs +1 -0
- package/dist/chunk-TACW7Z4D.mjs +31 -0
- package/dist/chunk-WPZOLGVB.mjs +148 -0
- package/dist/chunk-X7BHR7WS.mjs +200 -0
- package/dist/chunk-Z5GXDHGL.mjs +190 -0
- package/dist/config-DEsqgrG1.d.ts +151 -0
- package/dist/index.d.ts +768 -1498
- package/dist/index.mjs +453 -2005
- package/dist/xchains/bitcoin/index.d.ts +125 -0
- package/dist/xchains/bitcoin/index.mjs +14 -0
- package/dist/xchains/evm/index.d.ts +39 -0
- package/dist/xchains/evm/index.mjs +3 -0
- package/dist/xchains/icon/index.d.ts +37 -0
- package/dist/xchains/icon/index.mjs +5 -0
- package/dist/xchains/injective/index.d.ts +35 -0
- package/dist/xchains/injective/index.mjs +3 -0
- package/dist/xchains/near/index.d.ts +34 -0
- package/dist/xchains/near/index.mjs +4 -0
- package/dist/xchains/solana/index.d.ts +26 -0
- package/dist/xchains/solana/index.mjs +5 -0
- package/dist/xchains/stacks/index.d.ts +42 -0
- package/dist/xchains/stacks/index.mjs +3 -0
- package/dist/xchains/stellar/index.d.ts +44 -0
- package/dist/xchains/stellar/index.mjs +4 -0
- package/dist/xchains/sui/index.d.ts +37 -0
- package/dist/xchains/sui/index.mjs +5 -0
- package/docs/ADDING_A_NEW_CHAIN.md +440 -0
- package/docs/ARCHITECTURE.md +291 -0
- package/docs/BATCH_OPERATIONS.md +267 -0
- package/docs/CHAIN_DETECTION.md +216 -0
- package/docs/CONFIGURE_PROVIDER.md +360 -0
- package/docs/CONNECTORS.md +247 -0
- package/docs/CONNECT_FLOW.md +276 -0
- package/docs/EVM_SWITCH_CHAIN.md +161 -0
- package/docs/SIGN_MESSAGE.md +213 -0
- package/docs/SUB_PATH_EXPORTS.md +218 -0
- package/docs/WALLETCONNECT.md +154 -0
- package/docs/WALLET_MODAL.md +331 -0
- package/docs/WALLET_PROVIDER_BRIDGE.md +226 -0
- package/package.json +56 -22
- package/dist/index.cjs +0 -2147
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1579
- package/dist/index.mjs.map +0 -1
- package/src/Hydrate.ts +0 -65
- package/src/SodaxWalletProvider.tsx +0 -97
- package/src/actions/getXChainType.ts +0 -8
- package/src/actions/getXService.ts +0 -33
- package/src/actions/index.ts +0 -2
- package/src/assets/wallets/hana.svg +0 -6
- package/src/assets/wallets/havah.svg +0 -76
- package/src/assets/wallets/keplr.svg +0 -30
- package/src/assets/wallets/metamask.svg +0 -60
- package/src/assets/wallets/phantom.svg +0 -4
- package/src/assets/wallets/sui.svg +0 -20
- package/src/core/XConnector.ts +0 -54
- package/src/core/XService.ts +0 -85
- package/src/core/index.ts +0 -2
- package/src/hooks/index.ts +0 -11
- package/src/hooks/useEthereumChainId.ts +0 -44
- package/src/hooks/useEvmSwitchChain.ts +0 -91
- package/src/hooks/useWalletProvider.ts +0 -206
- package/src/hooks/useXAccount.ts +0 -51
- package/src/hooks/useXAccounts.ts +0 -56
- package/src/hooks/useXBalances.ts +0 -65
- package/src/hooks/useXConnect.ts +0 -118
- package/src/hooks/useXConnection.ts +0 -72
- package/src/hooks/useXConnectors.ts +0 -72
- package/src/hooks/useXDisconnect.ts +0 -73
- package/src/hooks/useXService.ts +0 -8
- package/src/hooks/useXSignMessage.ts +0 -82
- package/src/index.ts +0 -19
- package/src/types/index.ts +0 -22
- package/src/useXWagmiStore.ts +0 -116
- package/src/utils/index.ts +0 -21
- package/src/xchains/bitcoin/BitcoinXConnector.ts +0 -34
- package/src/xchains/bitcoin/BitcoinXService.ts +0 -40
- package/src/xchains/bitcoin/OKXXConnector.ts +0 -117
- package/src/xchains/bitcoin/UnisatXConnector.ts +0 -117
- package/src/xchains/bitcoin/XverseXConnector.ts +0 -232
- package/src/xchains/bitcoin/index.ts +0 -7
- package/src/xchains/bitcoin/useBitcoinXConnectors.ts +0 -14
- package/src/xchains/evm/EvmXConnector.ts +0 -27
- package/src/xchains/evm/EvmXService.ts +0 -211
- package/src/xchains/evm/index.ts +0 -3
- package/src/xchains/icon/IconHanaXConnector.ts +0 -39
- package/src/xchains/icon/IconXService.ts +0 -117
- package/src/xchains/icon/actions.ts +0 -28
- package/src/xchains/icon/iconex/index.tsx +0 -46
- package/src/xchains/icon/index.ts +0 -2
- package/src/xchains/injective/InjectiveXConnector.ts +0 -60
- package/src/xchains/injective/InjectiveXService.ts +0 -62
- package/src/xchains/injective/actions.ts +0 -32
- package/src/xchains/injective/index.ts +0 -2
- package/src/xchains/near/NearXConnector.ts +0 -42
- package/src/xchains/near/NearXService.ts +0 -46
- package/src/xchains/near/useNearXConnectors.ts +0 -23
- package/src/xchains/solana/SolanaXConnector.ts +0 -26
- package/src/xchains/solana/SolanaXService.ts +0 -46
- package/src/xchains/solana/index.ts +0 -2
- package/src/xchains/stacks/StacksXConnector.ts +0 -63
- package/src/xchains/stacks/StacksXService.ts +0 -59
- package/src/xchains/stacks/constants.ts +0 -42
- package/src/xchains/stacks/index.ts +0 -4
- package/src/xchains/stacks/useStacksXConnectors.ts +0 -7
- package/src/xchains/stellar/CustomSorobanServer.ts +0 -93
- package/src/xchains/stellar/StellarWalletsKitXConnector.ts +0 -53
- package/src/xchains/stellar/StellarXService.ts +0 -93
- package/src/xchains/stellar/actions.ts +0 -24
- package/src/xchains/stellar/index.tsx +0 -2
- package/src/xchains/stellar/useStellarXConnectors.ts +0 -21
- package/src/xchains/stellar/utils.ts +0 -49
- package/src/xchains/sui/SuiXConnector.ts +0 -28
- package/src/xchains/sui/SuiXService.ts +0 -66
- package/src/xchains/sui/index.ts +0 -2
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { StacksProviderConfig } from './StacksXConnector';
|
|
2
|
-
|
|
3
|
-
// Icons sourced from @stacks/connect DEFAULT_PROVIDERS
|
|
4
|
-
// https://github.com/stx-labs/connect/blob/main/packages/connect/src/providers.ts
|
|
5
|
-
const LEATHER_ICON =
|
|
6
|
-
'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYuODM4NyIgZmlsbD0iIzEyMTAwRiIvPgo8cGF0aCBkPSJNNzQuOTE3MSA1Mi43MTE0QzgyLjQ3NjYgNTEuNTQwOCA5My40MDg3IDQzLjU4MDQgOTMuNDA4NyAzNy4zNzYxQzkzLjQwODcgMzUuNTAzMSA5MS44OTY4IDM0LjIxNTQgODkuNjg3MSAzNC4yMTU0Qzg1LjUwMDQgMzQuMjE1NCA3OC40MDYxIDQwLjUzNjggNzQuOTE3MSA1Mi43MTE0Wk0zOS45MTEgODMuNDk5MUMzMC4wMjU2IDgzLjQ5OTEgMjkuMjExNSA5My4zMzI0IDM5LjA5NjkgOTMuMzMyNEM0My41MTYzIDkzLjMzMjQgNDguODY2MSA5MS41NzY0IDUxLjY1NzMgODguNDE1N0M0Ny41ODY4IDg0LjkwMzggNDQuMjE0MSA4My40OTkxIDM5LjkxMSA4My40OT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LjRaIiBmaWxsPSIjNDg2REZGIi8+CiAgPHBhdGggZD0iTTE0LjY3IDdINXY3LjY4aDMzVjdoLTkuNjd2NS43NGgtMlY3aC05LjY3djUuNzRoLTEuOTlWN1oiIGZpbGw9IiM1Q0QxRkEiLz4KPC9zdmc+Cg==';
|
|
16
|
-
|
|
17
|
-
export const STACKS_PROVIDERS: StacksProviderConfig[] = [
|
|
18
|
-
{
|
|
19
|
-
id: 'LeatherProvider',
|
|
20
|
-
name: 'Leather',
|
|
21
|
-
icon: LEATHER_ICON,
|
|
22
|
-
installUrl: 'https://chrome.google.com/webstore/detail/hiro-wallet/ldinpeekobnhjjdofggfgjlcehhmanlj',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: 'XverseProviders.BitcoinProvider',
|
|
26
|
-
name: 'Xverse Wallet',
|
|
27
|
-
icon: XVERSE_ICON,
|
|
28
|
-
installUrl: 'https://chrome.google.com/webstore/detail/xverse-wallet/idnnbdplmphpflfnlkomgpfbpcgelopg',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: 'AsignaProvider',
|
|
32
|
-
name: 'Asigna Multisig',
|
|
33
|
-
icon: ASIGNA_ICON,
|
|
34
|
-
installUrl: 'https://stx.asigna.io/',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: 'FordefiProviders.UtxoProvider',
|
|
38
|
-
name: 'Fordefi',
|
|
39
|
-
icon: FORDEFI_ICON,
|
|
40
|
-
installUrl: 'https://chromewebstore.google.com/detail/fordefi/hcmehenccjdmfbojapcbcofkgdpbnlle',
|
|
41
|
-
},
|
|
42
|
-
];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { StacksXConnector } from './StacksXConnector';
|
|
3
|
-
import { STACKS_PROVIDERS } from './constants';
|
|
4
|
-
|
|
5
|
-
export function useStacksXConnectors(): StacksXConnector[] {
|
|
6
|
-
return useMemo(() => STACKS_PROVIDERS.map(config => new StacksXConnector(config)), []);
|
|
7
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type FeeBumpTransaction,
|
|
3
|
-
type Memo,
|
|
4
|
-
type MemoType,
|
|
5
|
-
type Operation,
|
|
6
|
-
SorobanRpc,
|
|
7
|
-
type Transaction,
|
|
8
|
-
} from '@stellar/stellar-sdk';
|
|
9
|
-
|
|
10
|
-
class CustomSorobanServer extends SorobanRpc.Server {
|
|
11
|
-
private readonly customHeaders: Record<string, string>;
|
|
12
|
-
|
|
13
|
-
constructor(serverUrl: string, customHeaders: Record<string, string>) {
|
|
14
|
-
super(serverUrl, {
|
|
15
|
-
allowHttp: true,
|
|
16
|
-
});
|
|
17
|
-
this.customHeaders = customHeaders;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
async simulateTransaction(
|
|
21
|
-
tx: Transaction<Memo<MemoType>, Operation[]>,
|
|
22
|
-
): Promise<SorobanRpc.Api.SimulateTransactionResponse> {
|
|
23
|
-
const requestOptions = {
|
|
24
|
-
method: 'POST',
|
|
25
|
-
headers: {
|
|
26
|
-
'Content-Type': 'application/json',
|
|
27
|
-
...this.customHeaders,
|
|
28
|
-
},
|
|
29
|
-
body: JSON.stringify({
|
|
30
|
-
id: 1,
|
|
31
|
-
jsonrpc: '2.0',
|
|
32
|
-
method: 'simulateTransaction',
|
|
33
|
-
params: {
|
|
34
|
-
transaction: tx.toXDR(),
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const response = await fetch(`${this.serverURL}`, requestOptions);
|
|
40
|
-
if (!response.ok) {
|
|
41
|
-
throw new Error(`HTTP error simulating TX! status: ${response.status}`);
|
|
42
|
-
}
|
|
43
|
-
return response.json().then(json => json.result);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async sendTransaction(tx: Transaction | FeeBumpTransaction): Promise<SorobanRpc.Api.SendTransactionResponse> {
|
|
47
|
-
const requestOptions = {
|
|
48
|
-
method: 'POST',
|
|
49
|
-
headers: {
|
|
50
|
-
'Content-Type': 'application/json',
|
|
51
|
-
...this.customHeaders,
|
|
52
|
-
},
|
|
53
|
-
body: JSON.stringify({
|
|
54
|
-
id: 1,
|
|
55
|
-
jsonrpc: '2.0',
|
|
56
|
-
method: 'sendTransaction',
|
|
57
|
-
params: {
|
|
58
|
-
transaction: tx.toXDR(),
|
|
59
|
-
},
|
|
60
|
-
}),
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const response = await fetch(`${this.serverURL}`, requestOptions);
|
|
64
|
-
if (!response.ok) {
|
|
65
|
-
throw new Error(`HTTP error submitting TX! status: ${response.status}`);
|
|
66
|
-
}
|
|
67
|
-
return response.json().then(json => json.result);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async getTransaction(hash: string): Promise<SorobanRpc.Api.GetTransactionResponse> {
|
|
71
|
-
const requestOptions = {
|
|
72
|
-
method: 'POST',
|
|
73
|
-
headers: {
|
|
74
|
-
'Content-Type': 'application/json',
|
|
75
|
-
...this.customHeaders,
|
|
76
|
-
},
|
|
77
|
-
body: JSON.stringify({
|
|
78
|
-
id: 1,
|
|
79
|
-
jsonrpc: '2.0',
|
|
80
|
-
method: 'getTransaction',
|
|
81
|
-
params: { hash },
|
|
82
|
-
}),
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const response = await fetch(`${this.serverURL}`, requestOptions);
|
|
86
|
-
if (!response.ok) {
|
|
87
|
-
throw new Error(`HTTP error getting TX! status: ${response.status}`);
|
|
88
|
-
}
|
|
89
|
-
return response.json().then(json => json.result);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export default CustomSorobanServer;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { XAccount } from '@/types';
|
|
2
|
-
|
|
3
|
-
import { XConnector } from '@/core';
|
|
4
|
-
import { StellarXService } from './StellarXService';
|
|
5
|
-
|
|
6
|
-
export type StellarWalletType = {
|
|
7
|
-
icon: string;
|
|
8
|
-
id: string;
|
|
9
|
-
isAvailable: boolean;
|
|
10
|
-
name: string;
|
|
11
|
-
type: string;
|
|
12
|
-
url: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export class StellarWalletsKitXConnector extends XConnector {
|
|
16
|
-
_wallet: StellarWalletType;
|
|
17
|
-
|
|
18
|
-
constructor(wallet: StellarWalletType) {
|
|
19
|
-
super('STELLAR', wallet.name, wallet.id);
|
|
20
|
-
this._wallet = wallet;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getXService(): StellarXService {
|
|
24
|
-
return StellarXService.getInstance();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async connect(): Promise<XAccount | undefined> {
|
|
28
|
-
const kit = this.getXService().walletsKit;
|
|
29
|
-
|
|
30
|
-
if (!this._wallet) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (!this._wallet.isAvailable && this._wallet.url) {
|
|
35
|
-
window.open(this._wallet.url, '_blank');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
kit.setWallet(this._wallet.id);
|
|
40
|
-
const { address } = await kit.getAddress();
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
address: address,
|
|
44
|
-
xChainType: this.xChainType,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async disconnect(): Promise<void> {}
|
|
49
|
-
|
|
50
|
-
public get icon() {
|
|
51
|
-
return this._wallet.icon;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { XService } from '@/core/XService';
|
|
2
|
-
import { StellarWalletsKit, WalletNetwork, allowAllModules } from '@creit.tech/stellar-wallets-kit';
|
|
3
|
-
import * as StellarSdk from '@stellar/stellar-sdk';
|
|
4
|
-
import CustomSorobanServer from './CustomSorobanServer';
|
|
5
|
-
import { getTokenBalance } from './utils';
|
|
6
|
-
import type { XToken } from '@sodax/types';
|
|
7
|
-
|
|
8
|
-
/** Base reserve in stroops (0.5 XLM). Each subentry (trustline, signer, data entry, offer) adds one base reserve. */
|
|
9
|
-
const STELLAR_BASE_RESERVE_STROOPS = 5_000_000;
|
|
10
|
-
|
|
11
|
-
/** Horizon account fields used for minimum balance. Minimum = (2 + subentry_count + num_sponsoring - num_sponsored) * base_reserve + selling_liabilities. */
|
|
12
|
-
interface StellarAccountReserveFields {
|
|
13
|
-
subentry_count?: number;
|
|
14
|
-
num_sponsoring?: number;
|
|
15
|
-
num_sponsored?: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** Parse XLM balance string (e.g. "198.8944970") to stroops (1 XLM = 10^7 stroops). */
|
|
19
|
-
function parseXlmBalanceToStroops(balanceStr: string): bigint {
|
|
20
|
-
const parts = balanceStr.split('.');
|
|
21
|
-
const whole = parts[0] ?? '0';
|
|
22
|
-
const frac = (parts[1] ?? '').padEnd(7, '0').slice(0, 7);
|
|
23
|
-
return BigInt(whole + frac);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export class StellarXService extends XService {
|
|
27
|
-
private static instance: StellarXService;
|
|
28
|
-
|
|
29
|
-
public walletsKit: StellarWalletsKit;
|
|
30
|
-
public server: StellarSdk.Horizon.Server;
|
|
31
|
-
public sorobanServer: CustomSorobanServer;
|
|
32
|
-
|
|
33
|
-
private constructor() {
|
|
34
|
-
super('STELLAR');
|
|
35
|
-
|
|
36
|
-
this.walletsKit = new StellarWalletsKit({
|
|
37
|
-
network: WalletNetwork.PUBLIC,
|
|
38
|
-
modules: allowAllModules(),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
this.server = new StellarSdk.Horizon.Server('https://horizon.stellar.org', { allowHttp: true });
|
|
42
|
-
this.sorobanServer = new CustomSorobanServer('https://rpc.ankr.com/stellar_soroban', {});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public static getInstance(): StellarXService {
|
|
46
|
-
if (!StellarXService.instance) {
|
|
47
|
-
StellarXService.instance = new StellarXService();
|
|
48
|
-
}
|
|
49
|
-
return StellarXService.instance;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async getBalance(address: string | undefined, xToken: XToken): Promise<bigint> {
|
|
53
|
-
if (!address) return BigInt(0);
|
|
54
|
-
|
|
55
|
-
const stellarAccount = await this.server.loadAccount(address);
|
|
56
|
-
|
|
57
|
-
if (xToken.symbol === 'XLM') {
|
|
58
|
-
const xlmBalance = stellarAccount.balances.find(balance => balance.asset_type === 'native');
|
|
59
|
-
if (xlmBalance) {
|
|
60
|
-
const rawBalanceStroops = parseXlmBalanceToStroops(xlmBalance.balance);
|
|
61
|
-
const sellingLiabilitiesStroops = (xlmBalance as { selling_liabilities?: string }).selling_liabilities
|
|
62
|
-
? parseXlmBalanceToStroops((xlmBalance as { selling_liabilities: string }).selling_liabilities)
|
|
63
|
-
: BigInt(0);
|
|
64
|
-
const reserveFields = stellarAccount as unknown as StellarAccountReserveFields;
|
|
65
|
-
const subentryCount = reserveFields.subentry_count ?? 0;
|
|
66
|
-
const numSponsoring = reserveFields.num_sponsoring ?? 0;
|
|
67
|
-
const numSponsored = reserveFields.num_sponsored ?? 0;
|
|
68
|
-
// Minimum balance = (2 + subentry_count + num_sponsoring - num_sponsored) * base_reserve + selling_liabilities.
|
|
69
|
-
// When account has sponsored reserves (num_sponsored > 0), those reserves are paid by the sponsor, so we don't subtract them.
|
|
70
|
-
const reserveCount = Math.max(0, 2 + subentryCount + numSponsoring - numSponsored);
|
|
71
|
-
const minBalanceStroops =
|
|
72
|
-
BigInt(reserveCount) * BigInt(STELLAR_BASE_RESERVE_STROOPS) + sellingLiabilitiesStroops;
|
|
73
|
-
const availableStroops =
|
|
74
|
-
rawBalanceStroops > minBalanceStroops ? rawBalanceStroops - minBalanceStroops : BigInt(0);
|
|
75
|
-
return availableStroops;
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
try {
|
|
79
|
-
const txBuilder = new StellarSdk.TransactionBuilder(stellarAccount, {
|
|
80
|
-
fee: StellarSdk.BASE_FEE,
|
|
81
|
-
networkPassphrase: StellarSdk.Networks.PUBLIC,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const balance = await getTokenBalance(address, xToken.address, txBuilder, this.sorobanServer);
|
|
85
|
-
return balance;
|
|
86
|
-
} catch (e) {
|
|
87
|
-
console.error(`Error while fetching token on Stellar: ${xToken.symbol}, Error: ${e}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return BigInt(0);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useXWagmiStore } from '@/useXWagmiStore';
|
|
2
|
-
import { StellarXService } from './StellarXService';
|
|
3
|
-
|
|
4
|
-
export const reconnectStellar = async () => {
|
|
5
|
-
const stellarConnection = useXWagmiStore.getState().xConnections.STELLAR;
|
|
6
|
-
if (!stellarConnection) return;
|
|
7
|
-
|
|
8
|
-
const recentXConnectorId = stellarConnection.xConnectorId;
|
|
9
|
-
const stellarWalletKit = StellarXService.getInstance().walletsKit;
|
|
10
|
-
stellarWalletKit.setWallet(recentXConnectorId);
|
|
11
|
-
const { address } = await stellarWalletKit.getAddress();
|
|
12
|
-
useXWagmiStore.setState({
|
|
13
|
-
xConnections: {
|
|
14
|
-
...useXWagmiStore.getState().xConnections,
|
|
15
|
-
STELLAR: {
|
|
16
|
-
xAccount: {
|
|
17
|
-
address,
|
|
18
|
-
xChainType: 'STELLAR',
|
|
19
|
-
},
|
|
20
|
-
xConnectorId: recentXConnectorId,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useXService } from '@/hooks';
|
|
2
|
-
import { type UseQueryResult, useQuery } from '@tanstack/react-query';
|
|
3
|
-
|
|
4
|
-
import { StellarWalletsKitXConnector, type StellarXService } from '.';
|
|
5
|
-
|
|
6
|
-
export const useStellarXConnectors = (): UseQueryResult<StellarWalletsKitXConnector[] | undefined, Error | null> => {
|
|
7
|
-
const xService = useXService('STELLAR') as StellarXService;
|
|
8
|
-
|
|
9
|
-
return useQuery({
|
|
10
|
-
queryKey: ['stellar-wallets', xService],
|
|
11
|
-
queryFn: async () => {
|
|
12
|
-
if (!xService) {
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const wallets = await xService.walletsKit.getSupportedWallets();
|
|
17
|
-
|
|
18
|
-
return wallets.filter(wallet => wallet.isAvailable).map(wallet => new StellarWalletsKitXConnector(wallet));
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Address,
|
|
3
|
-
Contract,
|
|
4
|
-
type Memo,
|
|
5
|
-
type MemoType,
|
|
6
|
-
type Operation,
|
|
7
|
-
TimeoutInfinite,
|
|
8
|
-
type Transaction,
|
|
9
|
-
type TransactionBuilder,
|
|
10
|
-
scValToBigInt,
|
|
11
|
-
xdr,
|
|
12
|
-
} from '@stellar/stellar-sdk';
|
|
13
|
-
import type CustomSorobanServer from './CustomSorobanServer';
|
|
14
|
-
|
|
15
|
-
export const STELLAR_RLP_MSG_TYPE = { type: 'symbol' };
|
|
16
|
-
|
|
17
|
-
// Can be used whenever you need an Address argument for a contract method
|
|
18
|
-
export const accountToScVal = (account: string) => new Address(account).toScVal();
|
|
19
|
-
|
|
20
|
-
export const simulateTx = async (
|
|
21
|
-
tx: Transaction<Memo<MemoType>, Operation[]>,
|
|
22
|
-
server: CustomSorobanServer,
|
|
23
|
-
): Promise<any> => {
|
|
24
|
-
const response = await server.simulateTransaction(tx);
|
|
25
|
-
|
|
26
|
-
if (response !== undefined) {
|
|
27
|
-
return response;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
throw new Error('cannot simulate transaction');
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const getTokenBalance = async (
|
|
34
|
-
address: string,
|
|
35
|
-
tokenId: string,
|
|
36
|
-
txBuilder: TransactionBuilder,
|
|
37
|
-
server: CustomSorobanServer,
|
|
38
|
-
) => {
|
|
39
|
-
const params = [accountToScVal(address)];
|
|
40
|
-
const contract = new Contract(tokenId);
|
|
41
|
-
const tx = txBuilder
|
|
42
|
-
.addOperation(contract.call('balance', ...params))
|
|
43
|
-
.setTimeout(TimeoutInfinite)
|
|
44
|
-
.build();
|
|
45
|
-
|
|
46
|
-
const result = await simulateTx(tx, server);
|
|
47
|
-
|
|
48
|
-
return result.results ? scValToBigInt(xdr.ScVal.fromXDR(result.results[0].xdr, 'base64')) : 0n;
|
|
49
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { XAccount } from '@/types';
|
|
2
|
-
|
|
3
|
-
import { XConnector } from '@/core';
|
|
4
|
-
import { SuiXService } from './SuiXService';
|
|
5
|
-
|
|
6
|
-
export class SuiXConnector extends XConnector {
|
|
7
|
-
wallet: any;
|
|
8
|
-
|
|
9
|
-
constructor(wallet: any) {
|
|
10
|
-
// super('SUI', wallet.name, wallet.id);
|
|
11
|
-
super('SUI', wallet?.name, wallet?.name);
|
|
12
|
-
this.wallet = wallet;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
getXService(): SuiXService {
|
|
16
|
-
return SuiXService.getInstance();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async connect(): Promise<XAccount | undefined> {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async disconnect(): Promise<void> {}
|
|
24
|
-
|
|
25
|
-
public get icon() {
|
|
26
|
-
return this.wallet?.icon;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { XService } from '@/core/XService';
|
|
2
|
-
import type { XToken } from '@sodax/types';
|
|
3
|
-
import { isNativeToken } from '@/utils';
|
|
4
|
-
|
|
5
|
-
export class SuiXService extends XService {
|
|
6
|
-
private static instance: SuiXService;
|
|
7
|
-
|
|
8
|
-
public suiClient: any; // TODO: define suiClient type
|
|
9
|
-
public suiWallet: any; // TODO: define suiWallet type
|
|
10
|
-
public suiAccount: any; // TODO: define suiAccount type
|
|
11
|
-
|
|
12
|
-
private constructor() {
|
|
13
|
-
super('SUI');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public static getInstance(): SuiXService {
|
|
17
|
-
if (!SuiXService.instance) {
|
|
18
|
-
SuiXService.instance = new SuiXService();
|
|
19
|
-
}
|
|
20
|
-
return SuiXService.instance;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// getBalance is not used because getBalances uses getAllBalances which returns all balances
|
|
24
|
-
|
|
25
|
-
async getBalances(address: string | undefined, xTokens: readonly XToken[]): Promise<Record<string, bigint>> {
|
|
26
|
-
if (!address) return {};
|
|
27
|
-
try {
|
|
28
|
-
const balancePromises = xTokens.map(async xToken => {
|
|
29
|
-
let coinType = isNativeToken(xToken) ? '0x2::sui::SUI' : xToken.address;
|
|
30
|
-
|
|
31
|
-
// TODO: hard coded for getting legacy bnUSD balance
|
|
32
|
-
if (
|
|
33
|
-
coinType ===
|
|
34
|
-
'0x03917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR'
|
|
35
|
-
) {
|
|
36
|
-
coinType =
|
|
37
|
-
'0x3917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const balance = await this.suiClient.getBalance({
|
|
41
|
-
owner: address,
|
|
42
|
-
coinType: coinType,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
address: xToken.address,
|
|
47
|
-
balance: balance ? BigInt(balance.totalBalance) : undefined,
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const results = await Promise.all(balancePromises);
|
|
52
|
-
|
|
53
|
-
const tokenMap: Record<string, bigint> = {};
|
|
54
|
-
results.forEach(result => {
|
|
55
|
-
if (result.balance !== undefined) {
|
|
56
|
-
tokenMap[result.address] = result.balance;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
return tokenMap;
|
|
61
|
-
} catch (e) {
|
|
62
|
-
console.log('error', e);
|
|
63
|
-
return {};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
package/src/xchains/sui/index.ts
DELETED