@trustware/sdk-staging 1.1.12-staging.7 → 1.1.12-staging.8
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/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/{core-Ck7dinYj.d.cts → core-CHXz6NrH.d.cts} +42 -42
- package/dist/{core-B4YDGtJT.d.ts → core-_eoyfy2s.d.ts} +42 -42
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.mjs +1 -1
- package/dist/index.cjs +60 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +60 -7
- package/dist/index.mjs.map +1 -1
- package/dist/smart-account.cjs +1 -1
- package/dist/smart-account.mjs +1 -1
- package/dist/wallet.cjs +1 -1
- package/dist/wallet.mjs +1 -1
- package/dist/widget.cjs +60 -7
- package/dist/widget.cjs.map +1 -1
- package/dist/widget.mjs +60 -7
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
package/dist/constants.cjs
CHANGED
|
@@ -30,7 +30,7 @@ __export(constants_exports, {
|
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(constants_exports);
|
|
32
32
|
var SDK_NAME = "@trustware/sdk";
|
|
33
|
-
var SDK_VERSION = "1.1.12-staging.
|
|
33
|
+
var SDK_VERSION = "1.1.12-staging.8";
|
|
34
34
|
var API_ROOT = "https://bv-staging-api.trustware.io";
|
|
35
35
|
var GTM_ID = "GTM-TZDGNCXB";
|
|
36
36
|
var API_PREFIX = "/api";
|
package/dist/constants.mjs
CHANGED
|
@@ -1,53 +1,12 @@
|
|
|
1
1
|
import { n as BuildRouteResult, k as Transaction, T as TrustwareConfigOptions, i as WalletInterFaceAPI, A as ResolvedTrustwareConfig, X as TrustwareTheme, a2 as WalletIdentity, w as walletManager, Z as WalletAddressResolution, aa as buildRoute, ab as buildDepositAddress, ac as submitReceipt, ad as submitStepReceipt, ae as getStatus, af as pollStatus } from './manager-BZ8gyHGT.cjs';
|
|
2
|
-
import {
|
|
2
|
+
import { G as GetBalancesOptions, B as BalanceRow, a as BalanceStreamOptions, W as WalletAddressBalanceWrapper, C as ChainDef, d as ChainType } from './blockchain-DmCPxnxr.cjs';
|
|
3
3
|
import { T as Token } from './types-DEUb5IZA.cjs';
|
|
4
4
|
|
|
5
|
-
type AddressValidationResult = {
|
|
6
|
-
isValid: boolean;
|
|
7
|
-
error?: string;
|
|
8
|
-
};
|
|
9
|
-
declare function validateEvmAddress(address: string): AddressValidationResult;
|
|
10
|
-
declare function validateSeiAddress(address: string): AddressValidationResult;
|
|
11
|
-
declare function validateCosmosAddress(address: string, chain?: ChainDef | ChainType | string | null): AddressValidationResult;
|
|
12
|
-
declare function validateSolanaAddress(address: string): AddressValidationResult;
|
|
13
|
-
declare function validateBtcAddress(address: string): AddressValidationResult;
|
|
14
|
-
declare function validateAddressForChain(address: string, chain?: ChainDef | ChainType | string | null): AddressValidationResult;
|
|
15
|
-
declare function validateRouteAddresses(params: {
|
|
16
|
-
fromChain?: ChainDef | ChainType | string | null;
|
|
17
|
-
toChain?: ChainDef | ChainType | string | null;
|
|
18
|
-
fromAddress: string;
|
|
19
|
-
toAddress: string;
|
|
20
|
-
refundAddress?: string;
|
|
21
|
-
direction?: string;
|
|
22
|
-
}): AddressValidationResult;
|
|
23
|
-
|
|
24
5
|
/** Map chain reference -> backend chain_key and return enriched balances */
|
|
25
6
|
declare function getBalances(chainRef: string | number, address: string, opts?: GetBalancesOptions): Promise<BalanceRow[]>;
|
|
26
7
|
declare function getBalancesByAddress(address: string, opts?: BalanceStreamOptions): Promise<WalletAddressBalanceWrapper[]>;
|
|
27
8
|
declare function getBalancesByAddressStream(address: string, opts?: BalanceStreamOptions): AsyncGenerator<WalletAddressBalanceWrapper[], void, void>;
|
|
28
9
|
|
|
29
|
-
type SendRouteTransactionOptions = {
|
|
30
|
-
/**
|
|
31
|
-
* The caller has already run the plan's approval flow (checked allowances,
|
|
32
|
-
* sent any approves, waited for confirmation). Skips the internal
|
|
33
|
-
* ensureApprovals pass entirely — re-reading an allowance immediately
|
|
34
|
-
* after its approve confirms can return pre-block state from a different
|
|
35
|
-
* RPC node, which made the SDK prompt for the same approval twice
|
|
36
|
-
* (BVT-330). Exactly one path must own the approval decision per
|
|
37
|
-
* execution; this flag is how a caller claims that ownership.
|
|
38
|
-
*/
|
|
39
|
-
approvalsEnsured?: boolean;
|
|
40
|
-
};
|
|
41
|
-
declare function sendRouteTransaction(b: BuildRouteResult, fallbackChainId?: number | string, options?: SendRouteTransactionOptions): Promise<string>;
|
|
42
|
-
declare function runTopUp(params: {
|
|
43
|
-
fromChain?: string;
|
|
44
|
-
toChain?: string;
|
|
45
|
-
fromToken?: string;
|
|
46
|
-
toToken?: string;
|
|
47
|
-
toAddress?: string;
|
|
48
|
-
fromAmount: string | number;
|
|
49
|
-
}): Promise<Transaction>;
|
|
50
|
-
|
|
51
10
|
interface UseChainsResult {
|
|
52
11
|
/** All available chains */
|
|
53
12
|
chains: ChainDef[];
|
|
@@ -89,6 +48,47 @@ interface UseTokensResult {
|
|
|
89
48
|
}
|
|
90
49
|
declare function useTokens(chainId: string | number | null | undefined): UseTokensResult;
|
|
91
50
|
|
|
51
|
+
type AddressValidationResult = {
|
|
52
|
+
isValid: boolean;
|
|
53
|
+
error?: string;
|
|
54
|
+
};
|
|
55
|
+
declare function validateEvmAddress(address: string): AddressValidationResult;
|
|
56
|
+
declare function validateSeiAddress(address: string): AddressValidationResult;
|
|
57
|
+
declare function validateCosmosAddress(address: string, chain?: ChainDef | ChainType | string | null): AddressValidationResult;
|
|
58
|
+
declare function validateSolanaAddress(address: string): AddressValidationResult;
|
|
59
|
+
declare function validateBtcAddress(address: string): AddressValidationResult;
|
|
60
|
+
declare function validateAddressForChain(address: string, chain?: ChainDef | ChainType | string | null): AddressValidationResult;
|
|
61
|
+
declare function validateRouteAddresses(params: {
|
|
62
|
+
fromChain?: ChainDef | ChainType | string | null;
|
|
63
|
+
toChain?: ChainDef | ChainType | string | null;
|
|
64
|
+
fromAddress: string;
|
|
65
|
+
toAddress: string;
|
|
66
|
+
refundAddress?: string;
|
|
67
|
+
direction?: string;
|
|
68
|
+
}): AddressValidationResult;
|
|
69
|
+
|
|
70
|
+
type SendRouteTransactionOptions = {
|
|
71
|
+
/**
|
|
72
|
+
* The caller has already run the plan's approval flow (checked allowances,
|
|
73
|
+
* sent any approves, waited for confirmation). Skips the internal
|
|
74
|
+
* ensureApprovals pass entirely — re-reading an allowance immediately
|
|
75
|
+
* after its approve confirms can return pre-block state from a different
|
|
76
|
+
* RPC node, which made the SDK prompt for the same approval twice
|
|
77
|
+
* (BVT-330). Exactly one path must own the approval decision per
|
|
78
|
+
* execution; this flag is how a caller claims that ownership.
|
|
79
|
+
*/
|
|
80
|
+
approvalsEnsured?: boolean;
|
|
81
|
+
};
|
|
82
|
+
declare function sendRouteTransaction(b: BuildRouteResult, fallbackChainId?: number | string, options?: SendRouteTransactionOptions): Promise<string>;
|
|
83
|
+
declare function runTopUp(params: {
|
|
84
|
+
fromChain?: string;
|
|
85
|
+
toChain?: string;
|
|
86
|
+
fromToken?: string;
|
|
87
|
+
toToken?: string;
|
|
88
|
+
toAddress?: string;
|
|
89
|
+
fromAmount: string | number;
|
|
90
|
+
}): Promise<Transaction>;
|
|
91
|
+
|
|
92
92
|
declare const Trustware: {
|
|
93
93
|
/** Initialize config */
|
|
94
94
|
init(cfg: TrustwareConfigOptions): Promise</*elided*/ any>;
|
|
@@ -1,53 +1,12 @@
|
|
|
1
1
|
import { n as BuildRouteResult, k as Transaction, T as TrustwareConfigOptions, i as WalletInterFaceAPI, A as ResolvedTrustwareConfig, X as TrustwareTheme, a2 as WalletIdentity, w as walletManager, Z as WalletAddressResolution, aa as buildRoute, ab as buildDepositAddress, ac as submitReceipt, ad as submitStepReceipt, ae as getStatus, af as pollStatus } from './manager-D8nQsod2.js';
|
|
2
|
-
import {
|
|
2
|
+
import { G as GetBalancesOptions, B as BalanceRow, a as BalanceStreamOptions, W as WalletAddressBalanceWrapper, C as ChainDef, d as ChainType } from './blockchain-DmCPxnxr.js';
|
|
3
3
|
import { T as Token } from './types-CMmx0S4U.js';
|
|
4
4
|
|
|
5
|
-
type AddressValidationResult = {
|
|
6
|
-
isValid: boolean;
|
|
7
|
-
error?: string;
|
|
8
|
-
};
|
|
9
|
-
declare function validateEvmAddress(address: string): AddressValidationResult;
|
|
10
|
-
declare function validateSeiAddress(address: string): AddressValidationResult;
|
|
11
|
-
declare function validateCosmosAddress(address: string, chain?: ChainDef | ChainType | string | null): AddressValidationResult;
|
|
12
|
-
declare function validateSolanaAddress(address: string): AddressValidationResult;
|
|
13
|
-
declare function validateBtcAddress(address: string): AddressValidationResult;
|
|
14
|
-
declare function validateAddressForChain(address: string, chain?: ChainDef | ChainType | string | null): AddressValidationResult;
|
|
15
|
-
declare function validateRouteAddresses(params: {
|
|
16
|
-
fromChain?: ChainDef | ChainType | string | null;
|
|
17
|
-
toChain?: ChainDef | ChainType | string | null;
|
|
18
|
-
fromAddress: string;
|
|
19
|
-
toAddress: string;
|
|
20
|
-
refundAddress?: string;
|
|
21
|
-
direction?: string;
|
|
22
|
-
}): AddressValidationResult;
|
|
23
|
-
|
|
24
5
|
/** Map chain reference -> backend chain_key and return enriched balances */
|
|
25
6
|
declare function getBalances(chainRef: string | number, address: string, opts?: GetBalancesOptions): Promise<BalanceRow[]>;
|
|
26
7
|
declare function getBalancesByAddress(address: string, opts?: BalanceStreamOptions): Promise<WalletAddressBalanceWrapper[]>;
|
|
27
8
|
declare function getBalancesByAddressStream(address: string, opts?: BalanceStreamOptions): AsyncGenerator<WalletAddressBalanceWrapper[], void, void>;
|
|
28
9
|
|
|
29
|
-
type SendRouteTransactionOptions = {
|
|
30
|
-
/**
|
|
31
|
-
* The caller has already run the plan's approval flow (checked allowances,
|
|
32
|
-
* sent any approves, waited for confirmation). Skips the internal
|
|
33
|
-
* ensureApprovals pass entirely — re-reading an allowance immediately
|
|
34
|
-
* after its approve confirms can return pre-block state from a different
|
|
35
|
-
* RPC node, which made the SDK prompt for the same approval twice
|
|
36
|
-
* (BVT-330). Exactly one path must own the approval decision per
|
|
37
|
-
* execution; this flag is how a caller claims that ownership.
|
|
38
|
-
*/
|
|
39
|
-
approvalsEnsured?: boolean;
|
|
40
|
-
};
|
|
41
|
-
declare function sendRouteTransaction(b: BuildRouteResult, fallbackChainId?: number | string, options?: SendRouteTransactionOptions): Promise<string>;
|
|
42
|
-
declare function runTopUp(params: {
|
|
43
|
-
fromChain?: string;
|
|
44
|
-
toChain?: string;
|
|
45
|
-
fromToken?: string;
|
|
46
|
-
toToken?: string;
|
|
47
|
-
toAddress?: string;
|
|
48
|
-
fromAmount: string | number;
|
|
49
|
-
}): Promise<Transaction>;
|
|
50
|
-
|
|
51
10
|
interface UseChainsResult {
|
|
52
11
|
/** All available chains */
|
|
53
12
|
chains: ChainDef[];
|
|
@@ -89,6 +48,47 @@ interface UseTokensResult {
|
|
|
89
48
|
}
|
|
90
49
|
declare function useTokens(chainId: string | number | null | undefined): UseTokensResult;
|
|
91
50
|
|
|
51
|
+
type AddressValidationResult = {
|
|
52
|
+
isValid: boolean;
|
|
53
|
+
error?: string;
|
|
54
|
+
};
|
|
55
|
+
declare function validateEvmAddress(address: string): AddressValidationResult;
|
|
56
|
+
declare function validateSeiAddress(address: string): AddressValidationResult;
|
|
57
|
+
declare function validateCosmosAddress(address: string, chain?: ChainDef | ChainType | string | null): AddressValidationResult;
|
|
58
|
+
declare function validateSolanaAddress(address: string): AddressValidationResult;
|
|
59
|
+
declare function validateBtcAddress(address: string): AddressValidationResult;
|
|
60
|
+
declare function validateAddressForChain(address: string, chain?: ChainDef | ChainType | string | null): AddressValidationResult;
|
|
61
|
+
declare function validateRouteAddresses(params: {
|
|
62
|
+
fromChain?: ChainDef | ChainType | string | null;
|
|
63
|
+
toChain?: ChainDef | ChainType | string | null;
|
|
64
|
+
fromAddress: string;
|
|
65
|
+
toAddress: string;
|
|
66
|
+
refundAddress?: string;
|
|
67
|
+
direction?: string;
|
|
68
|
+
}): AddressValidationResult;
|
|
69
|
+
|
|
70
|
+
type SendRouteTransactionOptions = {
|
|
71
|
+
/**
|
|
72
|
+
* The caller has already run the plan's approval flow (checked allowances,
|
|
73
|
+
* sent any approves, waited for confirmation). Skips the internal
|
|
74
|
+
* ensureApprovals pass entirely — re-reading an allowance immediately
|
|
75
|
+
* after its approve confirms can return pre-block state from a different
|
|
76
|
+
* RPC node, which made the SDK prompt for the same approval twice
|
|
77
|
+
* (BVT-330). Exactly one path must own the approval decision per
|
|
78
|
+
* execution; this flag is how a caller claims that ownership.
|
|
79
|
+
*/
|
|
80
|
+
approvalsEnsured?: boolean;
|
|
81
|
+
};
|
|
82
|
+
declare function sendRouteTransaction(b: BuildRouteResult, fallbackChainId?: number | string, options?: SendRouteTransactionOptions): Promise<string>;
|
|
83
|
+
declare function runTopUp(params: {
|
|
84
|
+
fromChain?: string;
|
|
85
|
+
toChain?: string;
|
|
86
|
+
fromToken?: string;
|
|
87
|
+
toToken?: string;
|
|
88
|
+
toAddress?: string;
|
|
89
|
+
fromAmount: string | number;
|
|
90
|
+
}): Promise<Transaction>;
|
|
91
|
+
|
|
92
92
|
declare const Trustware: {
|
|
93
93
|
/** Initialize config */
|
|
94
94
|
init(cfg: TrustwareConfigOptions): Promise</*elided*/ any>;
|
package/dist/core.cjs
CHANGED
|
@@ -83,7 +83,7 @@ var init_constants = __esm({
|
|
|
83
83
|
"src/constants.ts"() {
|
|
84
84
|
"use strict";
|
|
85
85
|
SDK_NAME = "@trustware/sdk";
|
|
86
|
-
SDK_VERSION = "1.1.12-staging.
|
|
86
|
+
SDK_VERSION = "1.1.12-staging.8";
|
|
87
87
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
88
88
|
API_PREFIX = "/api";
|
|
89
89
|
WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
|
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { T as Trustware, a as TrustwareCore } from './core-
|
|
1
|
+
export { T as Trustware, a as TrustwareCore } from './core-CHXz6NrH.cjs';
|
|
2
2
|
export { B as BuildRouteBody, m as BuildRouteResponse, a5 as assertValidPostHook } from './manager-BZ8gyHGT.cjs';
|
|
3
3
|
import './blockchain-DmCPxnxr.cjs';
|
|
4
4
|
import './types-DEUb5IZA.cjs';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { T as Trustware, a as TrustwareCore } from './core-
|
|
1
|
+
export { T as Trustware, a as TrustwareCore } from './core-_eoyfy2s.js';
|
|
2
2
|
export { B as BuildRouteBody, m as BuildRouteResponse, a5 as assertValidPostHook } from './manager-D8nQsod2.js';
|
|
3
3
|
import './blockchain-DmCPxnxr.js';
|
|
4
4
|
import './types-CMmx0S4U.js';
|
package/dist/core.mjs
CHANGED
|
@@ -61,7 +61,7 @@ var init_constants = __esm({
|
|
|
61
61
|
"src/constants.ts"() {
|
|
62
62
|
"use strict";
|
|
63
63
|
SDK_NAME = "@trustware/sdk";
|
|
64
|
-
SDK_VERSION = "1.1.12-staging.
|
|
64
|
+
SDK_VERSION = "1.1.12-staging.8";
|
|
65
65
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
66
66
|
API_PREFIX = "/api";
|
|
67
67
|
WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
|
package/dist/index.cjs
CHANGED
|
@@ -572,7 +572,7 @@ var init_constants = __esm({
|
|
|
572
572
|
"src/constants.ts"() {
|
|
573
573
|
"use strict";
|
|
574
574
|
SDK_NAME = "@trustware/sdk";
|
|
575
|
-
SDK_VERSION = "1.1.12-staging.
|
|
575
|
+
SDK_VERSION = "1.1.12-staging.8";
|
|
576
576
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
577
577
|
GTM_ID = "GTM-TZDGNCXB";
|
|
578
578
|
API_PREFIX = "/api";
|
|
@@ -9924,12 +9924,32 @@ function mapWalletTokens(balances, chains, tokens) {
|
|
|
9924
9924
|
if (!foundToken && balanceRow.category === "native") {
|
|
9925
9925
|
const nativeAddress = canonicalTokenAddressForChain(
|
|
9926
9926
|
chain,
|
|
9927
|
-
getNativeTokenAddress2(chain
|
|
9927
|
+
getNativeTokenAddress2(normalizeChainType2(chain)),
|
|
9928
9928
|
tokens
|
|
9929
9929
|
);
|
|
9930
9930
|
const nativeKey = `${normalizeChainKey2(balanceRow.chain_id)}:${nativeAddress}`;
|
|
9931
9931
|
foundToken = tokensByCanonicalKey.get(nativeKey);
|
|
9932
9932
|
}
|
|
9933
|
+
if (!foundToken && balanceRow.category === "native") {
|
|
9934
|
+
const native = chain.nativeCurrency;
|
|
9935
|
+
const symbol = native?.symbol?.trim();
|
|
9936
|
+
if (symbol) {
|
|
9937
|
+
return [
|
|
9938
|
+
{
|
|
9939
|
+
...balanceRow,
|
|
9940
|
+
symbol,
|
|
9941
|
+
decimals: native?.decimals ?? balanceRow.decimals ?? 18,
|
|
9942
|
+
name: native?.name?.trim() || symbol,
|
|
9943
|
+
iconUrl: chain.chainIconURI || "",
|
|
9944
|
+
chainId: balanceRow.chain_id,
|
|
9945
|
+
usdPrice: void 0,
|
|
9946
|
+
address: getNativeTokenAddress2(normalizeChainType2(chain)),
|
|
9947
|
+
chainIconURI: chain.chainIconURI || "",
|
|
9948
|
+
chainData: chain
|
|
9949
|
+
}
|
|
9950
|
+
];
|
|
9951
|
+
}
|
|
9952
|
+
}
|
|
9933
9953
|
if (!foundToken?.name || !foundToken.symbol || !foundToken.address) {
|
|
9934
9954
|
return [];
|
|
9935
9955
|
}
|
|
@@ -34377,6 +34397,33 @@ var init_useSwapExecution = __esm({
|
|
|
34377
34397
|
}
|
|
34378
34398
|
});
|
|
34379
34399
|
|
|
34400
|
+
// src/modes/swap/walletBalance.ts
|
|
34401
|
+
function compareKey(address, chainType) {
|
|
34402
|
+
if (chainType) return normalizeAddress2(address, chainType);
|
|
34403
|
+
return HEX_ADDRESS.test(address.trim()) ? address.toLowerCase() : address.trim();
|
|
34404
|
+
}
|
|
34405
|
+
function findWalletBalanceRow(rows, token, chainId, chainType) {
|
|
34406
|
+
const rawAddress = token?.address;
|
|
34407
|
+
if (!rawAddress || !rows?.length) return void 0;
|
|
34408
|
+
const wantAddress = compareKey(rawAddress, chainType);
|
|
34409
|
+
if (!wantAddress) return void 0;
|
|
34410
|
+
const wantChain = chainId == null ? "" : String(chainId).trim().toLowerCase();
|
|
34411
|
+
return rows.find((row) => {
|
|
34412
|
+
if (!row?.address) return false;
|
|
34413
|
+
if (compareKey(row.address, chainType) !== wantAddress) return false;
|
|
34414
|
+
if (!wantChain) return true;
|
|
34415
|
+
return String(row.chainId ?? "").trim().toLowerCase() === wantChain;
|
|
34416
|
+
});
|
|
34417
|
+
}
|
|
34418
|
+
var HEX_ADDRESS;
|
|
34419
|
+
var init_walletBalance = __esm({
|
|
34420
|
+
"src/modes/swap/walletBalance.ts"() {
|
|
34421
|
+
"use strict";
|
|
34422
|
+
init_chainHelpers();
|
|
34423
|
+
HEX_ADDRESS = /^0x[0-9a-f]+$/i;
|
|
34424
|
+
}
|
|
34425
|
+
});
|
|
34426
|
+
|
|
34380
34427
|
// src/core/forex.ts
|
|
34381
34428
|
async function fetchForexRates(base2 = "USD") {
|
|
34382
34429
|
let r;
|
|
@@ -36529,14 +36576,19 @@ function SwapMode({
|
|
|
36529
36576
|
route
|
|
36530
36577
|
]);
|
|
36531
36578
|
const fromBalance = (0, import_react50.useMemo)(() => {
|
|
36532
|
-
|
|
36533
|
-
|
|
36534
|
-
|
|
36579
|
+
if (!fromToken) return null;
|
|
36580
|
+
const row = findWalletBalanceRow(
|
|
36581
|
+
yourWalletTokens,
|
|
36582
|
+
fromToken,
|
|
36583
|
+
fromChain?.chainId,
|
|
36584
|
+
normalizeChainType2(fromChain)
|
|
36585
|
+
);
|
|
36586
|
+
const raw = row?.balance ?? fromToken.balance;
|
|
36535
36587
|
if (!raw) return null;
|
|
36536
|
-
const decimals = fromToken?.decimals ?? 18;
|
|
36588
|
+
const decimals = row?.decimals ?? fromToken?.decimals ?? 18;
|
|
36537
36589
|
const n = Number(rawToDecimal(raw, decimals));
|
|
36538
36590
|
return Number.isFinite(n) ? n : null;
|
|
36539
|
-
}, [fromToken]);
|
|
36591
|
+
}, [fromToken, fromChain, yourWalletTokens]);
|
|
36540
36592
|
const balanceUsd = fromBalance !== null && hasFromUsdPrice ? fromBalance * fromTokenPriceUSD : null;
|
|
36541
36593
|
const estimatedToAmount = (0, import_react50.useMemo)(() => {
|
|
36542
36594
|
if (tokenSellNum <= 0 || !hasFromUsdPrice || !hasToUsdPrice) return null;
|
|
@@ -40301,6 +40353,7 @@ var init_SwapMode = __esm({
|
|
|
40301
40353
|
init_useSwapRoute();
|
|
40302
40354
|
init_useSwapExecution();
|
|
40303
40355
|
init_routeValue();
|
|
40356
|
+
init_walletBalance();
|
|
40304
40357
|
init_useForex();
|
|
40305
40358
|
init_SwapTokenSelect();
|
|
40306
40359
|
init_currency();
|