@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/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Trustware } from './core-
|
|
2
|
-
export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateCosmosAddress, d as validateEvmAddress, e as validateRouteAddresses, f as validateSeiAddress, g as validateSolanaAddress } from './core-
|
|
1
|
+
import { T as Trustware } from './core-CHXz6NrH.cjs';
|
|
2
|
+
export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateCosmosAddress, d as validateEvmAddress, e as validateRouteAddresses, f as validateSeiAddress, g as validateSolanaAddress } from './core-CHXz6NrH.cjs';
|
|
3
3
|
import { R as RateLimitInfo, T as TrustwareConfigOptions, i as WalletInterFaceAPI, j as TrustwareError, k as Transaction, l as TrustwareEvent } from './manager-BZ8gyHGT.cjs';
|
|
4
4
|
export { B as BuildRouteBody, m as BuildRouteResponse, n as BuildRouteResult, o as DEFAULT_AUTO_DETECT_PROVIDER, p as DEFAULT_FEATURE_FLAGS, q as DEFAULT_MESSAGES, r as DEFAULT_RETRY_CONFIG, s as DEFAULT_SLIPPAGE, D as DetectedWallet, E as EIP1193, t as EIP6963ProviderDetail, v as EvmWalletInterface, F as FeatureFlags, I as IdentityStore, P as PostHookRequest, x as RATE_LIMIT_WAIT_BUDGET_MS, y as ResolvedFeatureFlags, z as ResolvedRetryConfig, A as ResolvedTrustwareConfig, C as ResolvedWalletConnectConfig, G as RetryConfig, H as RouteApproval, J as RouteEstimate, K as RouteIntent, L as RouteParams, M as RoutePlan, N as RouteSponsorship, O as RoutesConfig, Q as SimpleWalletInterface, S as SolanaProviderLike, b as SolanaWalletInterface, U as SponsorshipApproval, V as SwapTokenRef, X as TrustwareTheme, Y as TrustwareWidgetMessages, c as WagmiBridge, d as WagmiConnector, Z as WalletAddressResolution, _ as WalletAddressSource, $ as WalletCategory, a0 as WalletConnectConfig, a1 as WalletEcosystem, a as WalletId, a2 as WalletIdentity, a3 as WalletIdentityAddress, a4 as WalletIdentityChainLike, W as WalletMeta, a5 as assertValidPostHook, a6 as buildWalletIdentityAddress, a7 as createWalletIdentity, a8 as resolveWalletAddressForChain, a9 as upsertWalletIdentityAddress, f as useWalletExternalDisconnect, g as useWalletInfo, h as useWireDetectionIntoManager, w as walletManager } from './manager-BZ8gyHGT.cjs';
|
|
5
5
|
import * as React from 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Trustware } from './core-
|
|
2
|
-
export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateCosmosAddress, d as validateEvmAddress, e as validateRouteAddresses, f as validateSeiAddress, g as validateSolanaAddress } from './core-
|
|
1
|
+
import { T as Trustware } from './core-_eoyfy2s.js';
|
|
2
|
+
export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateCosmosAddress, d as validateEvmAddress, e as validateRouteAddresses, f as validateSeiAddress, g as validateSolanaAddress } from './core-_eoyfy2s.js';
|
|
3
3
|
import { R as RateLimitInfo, T as TrustwareConfigOptions, i as WalletInterFaceAPI, j as TrustwareError, k as Transaction, l as TrustwareEvent } from './manager-D8nQsod2.js';
|
|
4
4
|
export { B as BuildRouteBody, m as BuildRouteResponse, n as BuildRouteResult, o as DEFAULT_AUTO_DETECT_PROVIDER, p as DEFAULT_FEATURE_FLAGS, q as DEFAULT_MESSAGES, r as DEFAULT_RETRY_CONFIG, s as DEFAULT_SLIPPAGE, D as DetectedWallet, E as EIP1193, t as EIP6963ProviderDetail, v as EvmWalletInterface, F as FeatureFlags, I as IdentityStore, P as PostHookRequest, x as RATE_LIMIT_WAIT_BUDGET_MS, y as ResolvedFeatureFlags, z as ResolvedRetryConfig, A as ResolvedTrustwareConfig, C as ResolvedWalletConnectConfig, G as RetryConfig, H as RouteApproval, J as RouteEstimate, K as RouteIntent, L as RouteParams, M as RoutePlan, N as RouteSponsorship, O as RoutesConfig, Q as SimpleWalletInterface, S as SolanaProviderLike, b as SolanaWalletInterface, U as SponsorshipApproval, V as SwapTokenRef, X as TrustwareTheme, Y as TrustwareWidgetMessages, c as WagmiBridge, d as WagmiConnector, Z as WalletAddressResolution, _ as WalletAddressSource, $ as WalletCategory, a0 as WalletConnectConfig, a1 as WalletEcosystem, a as WalletId, a2 as WalletIdentity, a3 as WalletIdentityAddress, a4 as WalletIdentityChainLike, W as WalletMeta, a5 as assertValidPostHook, a6 as buildWalletIdentityAddress, a7 as createWalletIdentity, a8 as resolveWalletAddressForChain, a9 as upsertWalletIdentityAddress, f as useWalletExternalDisconnect, g as useWalletInfo, h as useWireDetectionIntoManager, w as walletManager } from './manager-D8nQsod2.js';
|
|
5
5
|
import * as React from 'react';
|
package/dist/index.mjs
CHANGED
|
@@ -550,7 +550,7 @@ var init_constants = __esm({
|
|
|
550
550
|
"src/constants.ts"() {
|
|
551
551
|
"use strict";
|
|
552
552
|
SDK_NAME = "@trustware/sdk";
|
|
553
|
-
SDK_VERSION = "1.1.12-staging.
|
|
553
|
+
SDK_VERSION = "1.1.12-staging.8";
|
|
554
554
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
555
555
|
GTM_ID = "GTM-TZDGNCXB";
|
|
556
556
|
API_PREFIX = "/api";
|
|
@@ -9904,12 +9904,32 @@ function mapWalletTokens(balances, chains, tokens) {
|
|
|
9904
9904
|
if (!foundToken && balanceRow.category === "native") {
|
|
9905
9905
|
const nativeAddress = canonicalTokenAddressForChain(
|
|
9906
9906
|
chain,
|
|
9907
|
-
getNativeTokenAddress2(chain
|
|
9907
|
+
getNativeTokenAddress2(normalizeChainType2(chain)),
|
|
9908
9908
|
tokens
|
|
9909
9909
|
);
|
|
9910
9910
|
const nativeKey = `${normalizeChainKey2(balanceRow.chain_id)}:${nativeAddress}`;
|
|
9911
9911
|
foundToken = tokensByCanonicalKey.get(nativeKey);
|
|
9912
9912
|
}
|
|
9913
|
+
if (!foundToken && balanceRow.category === "native") {
|
|
9914
|
+
const native = chain.nativeCurrency;
|
|
9915
|
+
const symbol = native?.symbol?.trim();
|
|
9916
|
+
if (symbol) {
|
|
9917
|
+
return [
|
|
9918
|
+
{
|
|
9919
|
+
...balanceRow,
|
|
9920
|
+
symbol,
|
|
9921
|
+
decimals: native?.decimals ?? balanceRow.decimals ?? 18,
|
|
9922
|
+
name: native?.name?.trim() || symbol,
|
|
9923
|
+
iconUrl: chain.chainIconURI || "",
|
|
9924
|
+
chainId: balanceRow.chain_id,
|
|
9925
|
+
usdPrice: void 0,
|
|
9926
|
+
address: getNativeTokenAddress2(normalizeChainType2(chain)),
|
|
9927
|
+
chainIconURI: chain.chainIconURI || "",
|
|
9928
|
+
chainData: chain
|
|
9929
|
+
}
|
|
9930
|
+
];
|
|
9931
|
+
}
|
|
9932
|
+
}
|
|
9913
9933
|
if (!foundToken?.name || !foundToken.symbol || !foundToken.address) {
|
|
9914
9934
|
return [];
|
|
9915
9935
|
}
|
|
@@ -34318,6 +34338,33 @@ var init_useSwapExecution = __esm({
|
|
|
34318
34338
|
}
|
|
34319
34339
|
});
|
|
34320
34340
|
|
|
34341
|
+
// src/modes/swap/walletBalance.ts
|
|
34342
|
+
function compareKey(address, chainType) {
|
|
34343
|
+
if (chainType) return normalizeAddress2(address, chainType);
|
|
34344
|
+
return HEX_ADDRESS.test(address.trim()) ? address.toLowerCase() : address.trim();
|
|
34345
|
+
}
|
|
34346
|
+
function findWalletBalanceRow(rows, token, chainId, chainType) {
|
|
34347
|
+
const rawAddress = token?.address;
|
|
34348
|
+
if (!rawAddress || !rows?.length) return void 0;
|
|
34349
|
+
const wantAddress = compareKey(rawAddress, chainType);
|
|
34350
|
+
if (!wantAddress) return void 0;
|
|
34351
|
+
const wantChain = chainId == null ? "" : String(chainId).trim().toLowerCase();
|
|
34352
|
+
return rows.find((row) => {
|
|
34353
|
+
if (!row?.address) return false;
|
|
34354
|
+
if (compareKey(row.address, chainType) !== wantAddress) return false;
|
|
34355
|
+
if (!wantChain) return true;
|
|
34356
|
+
return String(row.chainId ?? "").trim().toLowerCase() === wantChain;
|
|
34357
|
+
});
|
|
34358
|
+
}
|
|
34359
|
+
var HEX_ADDRESS;
|
|
34360
|
+
var init_walletBalance = __esm({
|
|
34361
|
+
"src/modes/swap/walletBalance.ts"() {
|
|
34362
|
+
"use strict";
|
|
34363
|
+
init_chainHelpers();
|
|
34364
|
+
HEX_ADDRESS = /^0x[0-9a-f]+$/i;
|
|
34365
|
+
}
|
|
34366
|
+
});
|
|
34367
|
+
|
|
34321
34368
|
// src/core/forex.ts
|
|
34322
34369
|
async function fetchForexRates(base2 = "USD") {
|
|
34323
34370
|
let r;
|
|
@@ -36479,14 +36526,19 @@ function SwapMode({
|
|
|
36479
36526
|
route
|
|
36480
36527
|
]);
|
|
36481
36528
|
const fromBalance = useMemo29(() => {
|
|
36482
|
-
|
|
36483
|
-
|
|
36484
|
-
|
|
36529
|
+
if (!fromToken) return null;
|
|
36530
|
+
const row = findWalletBalanceRow(
|
|
36531
|
+
yourWalletTokens,
|
|
36532
|
+
fromToken,
|
|
36533
|
+
fromChain?.chainId,
|
|
36534
|
+
normalizeChainType2(fromChain)
|
|
36535
|
+
);
|
|
36536
|
+
const raw = row?.balance ?? fromToken.balance;
|
|
36485
36537
|
if (!raw) return null;
|
|
36486
|
-
const decimals = fromToken?.decimals ?? 18;
|
|
36538
|
+
const decimals = row?.decimals ?? fromToken?.decimals ?? 18;
|
|
36487
36539
|
const n = Number(rawToDecimal(raw, decimals));
|
|
36488
36540
|
return Number.isFinite(n) ? n : null;
|
|
36489
|
-
}, [fromToken]);
|
|
36541
|
+
}, [fromToken, fromChain, yourWalletTokens]);
|
|
36490
36542
|
const balanceUsd = fromBalance !== null && hasFromUsdPrice ? fromBalance * fromTokenPriceUSD : null;
|
|
36491
36543
|
const estimatedToAmount = useMemo29(() => {
|
|
36492
36544
|
if (tokenSellNum <= 0 || !hasFromUsdPrice || !hasToUsdPrice) return null;
|
|
@@ -40249,6 +40301,7 @@ var init_SwapMode = __esm({
|
|
|
40249
40301
|
init_useSwapRoute();
|
|
40250
40302
|
init_useSwapExecution();
|
|
40251
40303
|
init_routeValue();
|
|
40304
|
+
init_walletBalance();
|
|
40252
40305
|
init_useForex();
|
|
40253
40306
|
init_SwapTokenSelect();
|
|
40254
40307
|
init_currency();
|