@trustware/sdk-staging 1.1.8-staging.8 → 1.1.9-staging.1
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 +0 -2
- package/dist/{blockchain-BONedEsU.d.cts → blockchain-BxAFzp0s.d.cts} +5 -1
- package/dist/{blockchain-BONedEsU.d.ts → blockchain-BxAFzp0s.d.ts} +5 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/{core-BjQwlpoI.d.cts → core-D_jx805U.d.cts} +32 -4
- package/dist/{core-BQ0mFnLc.d.ts → core-p_5BLdbE.d.ts} +32 -4
- package/dist/core.cjs +69 -32
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +4 -4
- package/dist/core.d.ts +4 -4
- package/dist/core.mjs +69 -32
- package/dist/core.mjs.map +1 -1
- package/dist/{detect-DlbgTrkm.d.cts → detect--pmNlAHv.d.cts} +1 -1
- package/dist/{detect-MWKHLhn9.d.ts → detect-qAX6I4JI.d.ts} +1 -1
- package/dist/index.cjs +108 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.mjs +108 -66
- package/dist/index.mjs.map +1 -1
- package/dist/{manager-aOd3vkF9.d.ts → manager-DFQkemW0.d.ts} +1 -3
- package/dist/{manager-DKVW7zeh.d.cts → manager-aMi4_Ss6.d.cts} +1 -3
- package/dist/smart-account.cjs +1 -2
- package/dist/smart-account.cjs.map +1 -1
- package/dist/smart-account.mjs +1 -2
- package/dist/smart-account.mjs.map +1 -1
- package/dist/{types-MtdjJgwT.d.ts → types-BJY9r-mz.d.ts} +1 -1
- package/dist/{types-B3nKHW6H.d.cts → types-DX3HtFcn.d.cts} +1 -1
- package/dist/wallet.cjs +22 -7
- package/dist/wallet.cjs.map +1 -1
- package/dist/wallet.d.cts +4 -4
- package/dist/wallet.d.ts +4 -4
- package/dist/wallet.mjs +22 -7
- package/dist/wallet.mjs.map +1 -1
- package/dist/widget.cjs +81 -39
- package/dist/widget.cjs.map +1 -1
- package/dist/widget.d.cts +2 -2
- package/dist/widget.d.ts +2 -2
- package/dist/widget.mjs +81 -39
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,7 +105,6 @@ type TrustwareConfigOptions = {
|
|
|
105
105
|
fromAddress?: string;
|
|
106
106
|
toAddress?: string;
|
|
107
107
|
defaultSlippage?: number;
|
|
108
|
-
routeType?: string;
|
|
109
108
|
options?: {
|
|
110
109
|
routeRefreshMs?: number;
|
|
111
110
|
fixedFromAmount?: string | number;
|
|
@@ -132,7 +131,6 @@ type TrustwareConfigOptions = {
|
|
|
132
131
|
- `routes.fromAddress`: optional source wallet override.
|
|
133
132
|
- `routes.toAddress`: optional destination address override.
|
|
134
133
|
- `routes.defaultSlippage`: optional slippage percentage. Defaults to `1`.
|
|
135
|
-
- `routes.routeType`: optional route flavor. Defaults to `"swap"`.
|
|
136
134
|
|
|
137
135
|
### Route Options
|
|
138
136
|
|
|
@@ -52,6 +52,10 @@ type BalanceStreamOptions = {
|
|
|
52
52
|
signal?: AbortSignal;
|
|
53
53
|
strict?: boolean;
|
|
54
54
|
};
|
|
55
|
+
type GetBalancesOptions = {
|
|
56
|
+
/** Bypass the in-memory balance cache and re-fetch fresh data from the network. */
|
|
57
|
+
forceRefresh?: boolean;
|
|
58
|
+
};
|
|
55
59
|
type ChainType = "evm" | "cosmos" | "solana" | "btc" | string;
|
|
56
60
|
interface NativeCurrency {
|
|
57
61
|
symbol: string;
|
|
@@ -107,4 +111,4 @@ type TokenWithBalance = TokenDef & {
|
|
|
107
111
|
balance?: bigint;
|
|
108
112
|
};
|
|
109
113
|
|
|
110
|
-
export type { BalanceRow as B, ChainDef as C, NativeCurrency as N, TokenDef as T, WalletAddressBalanceWrapper as W, BalanceStreamOptions as a, ChainMeta as b, ChainType as c, TokenMeta as d, TokenPageInfo as e, TokenPageOptions as f, TokenPageResult as g, TokenType as h, TokenWithBalance as i };
|
|
114
|
+
export type { BalanceRow as B, ChainDef as C, GetBalancesOptions as G, NativeCurrency as N, TokenDef as T, WalletAddressBalanceWrapper as W, BalanceStreamOptions as a, ChainMeta as b, ChainType as c, TokenMeta as d, TokenPageInfo as e, TokenPageOptions as f, TokenPageResult as g, TokenType as h, TokenWithBalance as i };
|
|
@@ -52,6 +52,10 @@ type BalanceStreamOptions = {
|
|
|
52
52
|
signal?: AbortSignal;
|
|
53
53
|
strict?: boolean;
|
|
54
54
|
};
|
|
55
|
+
type GetBalancesOptions = {
|
|
56
|
+
/** Bypass the in-memory balance cache and re-fetch fresh data from the network. */
|
|
57
|
+
forceRefresh?: boolean;
|
|
58
|
+
};
|
|
55
59
|
type ChainType = "evm" | "cosmos" | "solana" | "btc" | string;
|
|
56
60
|
interface NativeCurrency {
|
|
57
61
|
symbol: string;
|
|
@@ -107,4 +111,4 @@ type TokenWithBalance = TokenDef & {
|
|
|
107
111
|
balance?: bigint;
|
|
108
112
|
};
|
|
109
113
|
|
|
110
|
-
export type { BalanceRow as B, ChainDef as C, NativeCurrency as N, TokenDef as T, WalletAddressBalanceWrapper as W, BalanceStreamOptions as a, ChainMeta as b, ChainType as c, TokenMeta as d, TokenPageInfo as e, TokenPageOptions as f, TokenPageResult as g, TokenType as h, TokenWithBalance as i };
|
|
114
|
+
export type { BalanceRow as B, ChainDef as C, GetBalancesOptions as G, NativeCurrency as N, TokenDef as T, WalletAddressBalanceWrapper as W, BalanceStreamOptions as a, ChainMeta as b, ChainType as c, TokenMeta as d, TokenPageInfo as e, TokenPageOptions as f, TokenPageResult as g, TokenType as h, TokenWithBalance as i };
|
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.
|
|
33
|
+
var SDK_VERSION = "1.1.9-staging.1";
|
|
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,6 +1,6 @@
|
|
|
1
|
-
import { B as BuildRouteResult, T as Transaction, v as TrustwareConfigOptions, P as WalletInterFaceAPI, j as ResolvedTrustwareConfig, M as WalletIdentity, a7 as walletManager, C as WalletAddressResolution, X as buildRoute, V as buildDepositAddress, a1 as submitReceipt, _ as getStatus, $ as pollStatus } from './manager-
|
|
2
|
-
import { C as ChainDef, c as ChainType, B as BalanceRow, a as BalanceStreamOptions, W as WalletAddressBalanceWrapper } from './blockchain-
|
|
3
|
-
import { T as Token } from './types-
|
|
1
|
+
import { B as BuildRouteResult, T as Transaction, v as TrustwareConfigOptions, P as WalletInterFaceAPI, j as ResolvedTrustwareConfig, y as TrustwareTheme, M as WalletIdentity, a7 as walletManager, C as WalletAddressResolution, X as buildRoute, V as buildDepositAddress, a1 as submitReceipt, _ as getStatus, $ as pollStatus } from './manager-aMi4_Ss6.cjs';
|
|
2
|
+
import { C as ChainDef, c as ChainType, G as GetBalancesOptions, B as BalanceRow, a as BalanceStreamOptions, W as WalletAddressBalanceWrapper } from './blockchain-BxAFzp0s.cjs';
|
|
3
|
+
import { T as Token } from './types-DX3HtFcn.cjs';
|
|
4
4
|
|
|
5
5
|
type AddressValidationResult = {
|
|
6
6
|
isValid: boolean;
|
|
@@ -21,7 +21,7 @@ declare function validateRouteAddresses(params: {
|
|
|
21
21
|
}): AddressValidationResult;
|
|
22
22
|
|
|
23
23
|
/** Map chain reference -> backend chain_key and return enriched balances */
|
|
24
|
-
declare function getBalances(chainRef: string | number, address: string): Promise<BalanceRow[]>;
|
|
24
|
+
declare function getBalances(chainRef: string | number, address: string, opts?: GetBalancesOptions): Promise<BalanceRow[]>;
|
|
25
25
|
declare function getBalancesByAddress(address: string, opts?: BalanceStreamOptions): Promise<WalletAddressBalanceWrapper[]>;
|
|
26
26
|
declare function getBalancesByAddressStream(address: string, opts?: BalanceStreamOptions): AsyncGenerator<WalletAddressBalanceWrapper[], void, void>;
|
|
27
27
|
|
|
@@ -85,6 +85,34 @@ declare const Trustware: {
|
|
|
85
85
|
autoDetect(_timeoutMs?: number): Promise<boolean>;
|
|
86
86
|
/** Read resolved config */
|
|
87
87
|
getConfig(): ResolvedTrustwareConfig;
|
|
88
|
+
/**
|
|
89
|
+
* Read the SDK's currently configured theme mode.
|
|
90
|
+
*
|
|
91
|
+
* Returns the raw setting — `"light" | "dark" | "system"` — i.e. whatever
|
|
92
|
+
* was last passed to `init()` or `setTheme()`. When the mode is `"system"`,
|
|
93
|
+
* the widget resolves the actual light/dark appearance itself (from the OS
|
|
94
|
+
* `prefers-color-scheme`, or a saved preference if the user has used the
|
|
95
|
+
* widget's built-in theme toggle), so this getter still reports `"system"`
|
|
96
|
+
* rather than the resolved value.
|
|
97
|
+
*/
|
|
98
|
+
getTheme(): TrustwareTheme;
|
|
99
|
+
/**
|
|
100
|
+
* Set the widget's theme at runtime.
|
|
101
|
+
*
|
|
102
|
+
* Call this from your own app's theme toggle to keep an embedded
|
|
103
|
+
* `TrustwareWidget` in sync with your UI — no remount required, any
|
|
104
|
+
* mounted widget picks up the change immediately.
|
|
105
|
+
*
|
|
106
|
+
* Passing `"light"` or `"dark"` pins the widget to that mode. Passing
|
|
107
|
+
* `"system"` makes it follow the OS preference again — unless the user
|
|
108
|
+
* previously used the widget's own in-widget theme toggle, in which case
|
|
109
|
+
* their saved choice takes precedence until they toggle it again.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* // In your app's own dark-mode toggle handler:
|
|
113
|
+
* Trustware.setTheme(isDark ? "dark" : "light");
|
|
114
|
+
*/
|
|
115
|
+
setTheme(theme: TrustwareTheme): /*elided*/ any;
|
|
88
116
|
setDestinationAddress(address?: string | null): /*elided*/ any;
|
|
89
117
|
setDestinationChain(chain: string): /*elided*/ any;
|
|
90
118
|
setDestinationToken(token: string): /*elided*/ any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as BuildRouteResult, T as Transaction, v as TrustwareConfigOptions, P as WalletInterFaceAPI, j as ResolvedTrustwareConfig, M as WalletIdentity, a7 as walletManager, C as WalletAddressResolution, X as buildRoute, V as buildDepositAddress, a1 as submitReceipt, _ as getStatus, $ as pollStatus } from './manager-
|
|
2
|
-
import { C as ChainDef, c as ChainType, B as BalanceRow, a as BalanceStreamOptions, W as WalletAddressBalanceWrapper } from './blockchain-
|
|
3
|
-
import { T as Token } from './types-
|
|
1
|
+
import { B as BuildRouteResult, T as Transaction, v as TrustwareConfigOptions, P as WalletInterFaceAPI, j as ResolvedTrustwareConfig, y as TrustwareTheme, M as WalletIdentity, a7 as walletManager, C as WalletAddressResolution, X as buildRoute, V as buildDepositAddress, a1 as submitReceipt, _ as getStatus, $ as pollStatus } from './manager-DFQkemW0.js';
|
|
2
|
+
import { C as ChainDef, c as ChainType, G as GetBalancesOptions, B as BalanceRow, a as BalanceStreamOptions, W as WalletAddressBalanceWrapper } from './blockchain-BxAFzp0s.js';
|
|
3
|
+
import { T as Token } from './types-BJY9r-mz.js';
|
|
4
4
|
|
|
5
5
|
type AddressValidationResult = {
|
|
6
6
|
isValid: boolean;
|
|
@@ -21,7 +21,7 @@ declare function validateRouteAddresses(params: {
|
|
|
21
21
|
}): AddressValidationResult;
|
|
22
22
|
|
|
23
23
|
/** Map chain reference -> backend chain_key and return enriched balances */
|
|
24
|
-
declare function getBalances(chainRef: string | number, address: string): Promise<BalanceRow[]>;
|
|
24
|
+
declare function getBalances(chainRef: string | number, address: string, opts?: GetBalancesOptions): Promise<BalanceRow[]>;
|
|
25
25
|
declare function getBalancesByAddress(address: string, opts?: BalanceStreamOptions): Promise<WalletAddressBalanceWrapper[]>;
|
|
26
26
|
declare function getBalancesByAddressStream(address: string, opts?: BalanceStreamOptions): AsyncGenerator<WalletAddressBalanceWrapper[], void, void>;
|
|
27
27
|
|
|
@@ -85,6 +85,34 @@ declare const Trustware: {
|
|
|
85
85
|
autoDetect(_timeoutMs?: number): Promise<boolean>;
|
|
86
86
|
/** Read resolved config */
|
|
87
87
|
getConfig(): ResolvedTrustwareConfig;
|
|
88
|
+
/**
|
|
89
|
+
* Read the SDK's currently configured theme mode.
|
|
90
|
+
*
|
|
91
|
+
* Returns the raw setting — `"light" | "dark" | "system"` — i.e. whatever
|
|
92
|
+
* was last passed to `init()` or `setTheme()`. When the mode is `"system"`,
|
|
93
|
+
* the widget resolves the actual light/dark appearance itself (from the OS
|
|
94
|
+
* `prefers-color-scheme`, or a saved preference if the user has used the
|
|
95
|
+
* widget's built-in theme toggle), so this getter still reports `"system"`
|
|
96
|
+
* rather than the resolved value.
|
|
97
|
+
*/
|
|
98
|
+
getTheme(): TrustwareTheme;
|
|
99
|
+
/**
|
|
100
|
+
* Set the widget's theme at runtime.
|
|
101
|
+
*
|
|
102
|
+
* Call this from your own app's theme toggle to keep an embedded
|
|
103
|
+
* `TrustwareWidget` in sync with your UI — no remount required, any
|
|
104
|
+
* mounted widget picks up the change immediately.
|
|
105
|
+
*
|
|
106
|
+
* Passing `"light"` or `"dark"` pins the widget to that mode. Passing
|
|
107
|
+
* `"system"` makes it follow the OS preference again — unless the user
|
|
108
|
+
* previously used the widget's own in-widget theme toggle, in which case
|
|
109
|
+
* their saved choice takes precedence until they toggle it again.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* // In your app's own dark-mode toggle handler:
|
|
113
|
+
* Trustware.setTheme(isDark ? "dark" : "light");
|
|
114
|
+
*/
|
|
115
|
+
setTheme(theme: TrustwareTheme): /*elided*/ any;
|
|
88
116
|
setDestinationAddress(address?: string | null): /*elided*/ any;
|
|
89
117
|
setDestinationChain(chain: string): /*elided*/ any;
|
|
90
118
|
setDestinationToken(token: string): /*elided*/ any;
|
package/dist/core.cjs
CHANGED
|
@@ -75,7 +75,7 @@ var init_constants = __esm({
|
|
|
75
75
|
"src/constants.ts"() {
|
|
76
76
|
"use strict";
|
|
77
77
|
SDK_NAME = "@trustware/sdk";
|
|
78
|
-
SDK_VERSION = "1.1.
|
|
78
|
+
SDK_VERSION = "1.1.9-staging.1";
|
|
79
79
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
80
80
|
API_PREFIX = "/api";
|
|
81
81
|
WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
|
|
@@ -93,16 +93,6 @@ var init_config2 = __esm({
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
// src/core/http.ts
|
|
96
|
-
var http_exports = {};
|
|
97
|
-
__export(http_exports, {
|
|
98
|
-
RateLimitError: () => RateLimitError,
|
|
99
|
-
apiBase: () => apiBase,
|
|
100
|
-
assertOK: () => assertOK,
|
|
101
|
-
jsonHeaders: () => jsonHeaders,
|
|
102
|
-
parseRateLimitHeaders: () => parseRateLimitHeaders,
|
|
103
|
-
rateLimitedFetch: () => rateLimitedFetch,
|
|
104
|
-
validateSdkAccess: () => validateSdkAccess
|
|
105
|
-
});
|
|
106
96
|
function apiBase() {
|
|
107
97
|
return `${API_ROOT}${API_PREFIX}`;
|
|
108
98
|
}
|
|
@@ -300,11 +290,6 @@ var init_chains = __esm({
|
|
|
300
290
|
});
|
|
301
291
|
|
|
302
292
|
// src/registry.ts
|
|
303
|
-
var registry_exports = {};
|
|
304
|
-
__export(registry_exports, {
|
|
305
|
-
NATIVE: () => NATIVE,
|
|
306
|
-
Registry: () => Registry
|
|
307
|
-
});
|
|
308
293
|
function getChainAliases(chain) {
|
|
309
294
|
const values = [
|
|
310
295
|
chain.chainId,
|
|
@@ -1838,7 +1823,7 @@ async function parseStreamingBalances(response, address, options = {}) {
|
|
|
1838
1823
|
}
|
|
1839
1824
|
return stream();
|
|
1840
1825
|
}
|
|
1841
|
-
async function getBalances(chainRef, address) {
|
|
1826
|
+
async function getBalances(chainRef, address, opts) {
|
|
1842
1827
|
const reg = await ensureRegistry();
|
|
1843
1828
|
const chain = reg.chain(chainRef);
|
|
1844
1829
|
if (!chain) return [];
|
|
@@ -1853,8 +1838,10 @@ async function getBalances(chainRef, address) {
|
|
|
1853
1838
|
chain.nativeCurrency?.decimals ?? "",
|
|
1854
1839
|
normalizeChainType(chain) ?? ""
|
|
1855
1840
|
].join(":");
|
|
1856
|
-
|
|
1857
|
-
|
|
1841
|
+
if (!opts?.forceRefresh) {
|
|
1842
|
+
const cached = balanceCache.get(cacheKey);
|
|
1843
|
+
if (cached) return cached;
|
|
1844
|
+
}
|
|
1858
1845
|
const url = `${apiBase()}/v1/data/wallets/${encodeURIComponent(chainKey)}/${trimmedAddress}/balances`;
|
|
1859
1846
|
const response = await fetch(url, {
|
|
1860
1847
|
method: "GET",
|
|
@@ -2167,11 +2154,27 @@ function toSolanaWalletInterface(provider) {
|
|
|
2167
2154
|
serializedTransactionBase64
|
|
2168
2155
|
);
|
|
2169
2156
|
if (provider.signAndSendTransaction) {
|
|
2170
|
-
const
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2157
|
+
const MAX_INTERNAL_ERROR_ATTEMPTS = 3;
|
|
2158
|
+
const INTERNAL_ERROR_RETRY_DELAY_MS = 500;
|
|
2159
|
+
for (let attempt = 1; attempt <= MAX_INTERNAL_ERROR_ATTEMPTS; attempt++) {
|
|
2160
|
+
try {
|
|
2161
|
+
const result = await provider.signAndSendTransaction(transaction, {
|
|
2162
|
+
skipPreflight: true
|
|
2163
|
+
});
|
|
2164
|
+
if (typeof result === "string") return result;
|
|
2165
|
+
if (result?.signature) return result.signature;
|
|
2166
|
+
break;
|
|
2167
|
+
} catch (err) {
|
|
2168
|
+
const code = err?.code;
|
|
2169
|
+
if (code === -32603 && attempt < MAX_INTERNAL_ERROR_ATTEMPTS) {
|
|
2170
|
+
await new Promise(
|
|
2171
|
+
(resolve) => setTimeout(resolve, INTERNAL_ERROR_RETRY_DELAY_MS * attempt)
|
|
2172
|
+
);
|
|
2173
|
+
continue;
|
|
2174
|
+
}
|
|
2175
|
+
throw err;
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2175
2178
|
}
|
|
2176
2179
|
if (!provider.signTransaction) {
|
|
2177
2180
|
throw new Error("Connected Solana wallet cannot sign transactions");
|
|
@@ -3901,6 +3904,10 @@ var init_routes = __esm({
|
|
|
3901
3904
|
});
|
|
3902
3905
|
|
|
3903
3906
|
// src/core/registryClient.ts
|
|
3907
|
+
var registryClient_exports = {};
|
|
3908
|
+
__export(registryClient_exports, {
|
|
3909
|
+
getSharedRegistry: () => getSharedRegistry
|
|
3910
|
+
});
|
|
3904
3911
|
function registryCacheKey() {
|
|
3905
3912
|
const base = apiBase();
|
|
3906
3913
|
const apiKey = TrustwareConfigStore.peek()?.apiKey ?? "__uninitialized__";
|
|
@@ -6068,7 +6075,6 @@ function resolveConfig(input) {
|
|
|
6068
6075
|
defaultSlippage: normalizeSlippage(
|
|
6069
6076
|
input.routes.defaultSlippage ?? DEFAULT_SLIPPAGE
|
|
6070
6077
|
),
|
|
6071
|
-
routeType: input.routes.routeType ?? "swap",
|
|
6072
6078
|
options: {
|
|
6073
6079
|
...input.routes.options
|
|
6074
6080
|
}
|
|
@@ -6268,10 +6274,9 @@ async function sendRouteTransaction(b, fallbackChainId) {
|
|
|
6268
6274
|
if (w.ecosystem !== "solana") {
|
|
6269
6275
|
throw new Error("A Solana wallet is required for this route");
|
|
6270
6276
|
}
|
|
6271
|
-
const {
|
|
6272
|
-
const
|
|
6273
|
-
|
|
6274
|
-
await registry.ensureLoaded();
|
|
6277
|
+
const { getSharedRegistry: getSharedRegistry2 } = await Promise.resolve().then(() => (init_registryClient(), registryClient_exports));
|
|
6278
|
+
const registry = getSharedRegistry2();
|
|
6279
|
+
await registry.ensureChainsLoaded();
|
|
6275
6280
|
const chain = registry.chain(
|
|
6276
6281
|
String(fallbackChainId ?? txReq.chainId ?? "")
|
|
6277
6282
|
);
|
|
@@ -6285,9 +6290,8 @@ async function sendRouteTransaction(b, fallbackChainId) {
|
|
|
6285
6290
|
async function runTopUp(params) {
|
|
6286
6291
|
const w = walletManager.wallet;
|
|
6287
6292
|
if (!w) throw new Error("Trustware.wallet not configured");
|
|
6288
|
-
const {
|
|
6289
|
-
const
|
|
6290
|
-
const reg = new Registry2(apiBase2());
|
|
6293
|
+
const { getSharedRegistry: getSharedRegistry2 } = await Promise.resolve().then(() => (init_registryClient(), registryClient_exports));
|
|
6294
|
+
const reg = getSharedRegistry2();
|
|
6291
6295
|
await reg.ensureLoaded();
|
|
6292
6296
|
const fromAddress = await w.getAddress();
|
|
6293
6297
|
const currentChainRef = w.ecosystem === "evm" ? String(await w.getChainId()) : await w.getChainKey?.() ?? "solana-mainnet-beta";
|
|
@@ -6398,6 +6402,39 @@ var init_core = __esm({
|
|
|
6398
6402
|
getConfig() {
|
|
6399
6403
|
return TrustwareConfigStore.get();
|
|
6400
6404
|
},
|
|
6405
|
+
/**
|
|
6406
|
+
* Read the SDK's currently configured theme mode.
|
|
6407
|
+
*
|
|
6408
|
+
* Returns the raw setting — `"light" | "dark" | "system"` — i.e. whatever
|
|
6409
|
+
* was last passed to `init()` or `setTheme()`. When the mode is `"system"`,
|
|
6410
|
+
* the widget resolves the actual light/dark appearance itself (from the OS
|
|
6411
|
+
* `prefers-color-scheme`, or a saved preference if the user has used the
|
|
6412
|
+
* widget's built-in theme toggle), so this getter still reports `"system"`
|
|
6413
|
+
* rather than the resolved value.
|
|
6414
|
+
*/
|
|
6415
|
+
getTheme() {
|
|
6416
|
+
return TrustwareConfigStore.get().theme;
|
|
6417
|
+
},
|
|
6418
|
+
/**
|
|
6419
|
+
* Set the widget's theme at runtime.
|
|
6420
|
+
*
|
|
6421
|
+
* Call this from your own app's theme toggle to keep an embedded
|
|
6422
|
+
* `TrustwareWidget` in sync with your UI — no remount required, any
|
|
6423
|
+
* mounted widget picks up the change immediately.
|
|
6424
|
+
*
|
|
6425
|
+
* Passing `"light"` or `"dark"` pins the widget to that mode. Passing
|
|
6426
|
+
* `"system"` makes it follow the OS preference again — unless the user
|
|
6427
|
+
* previously used the widget's own in-widget theme toggle, in which case
|
|
6428
|
+
* their saved choice takes precedence until they toggle it again.
|
|
6429
|
+
*
|
|
6430
|
+
* @example
|
|
6431
|
+
* // In your app's own dark-mode toggle handler:
|
|
6432
|
+
* Trustware.setTheme(isDark ? "dark" : "light");
|
|
6433
|
+
*/
|
|
6434
|
+
setTheme(theme) {
|
|
6435
|
+
TrustwareConfigStore.update({ theme });
|
|
6436
|
+
return Trustware;
|
|
6437
|
+
},
|
|
6401
6438
|
setDestinationAddress(address) {
|
|
6402
6439
|
const prev = TrustwareConfigStore.get();
|
|
6403
6440
|
TrustwareConfigStore.update({
|