@trustware/sdk-staging 1.1.11-staging.2 → 1.1.12-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/dist/{blockchain-BxAFzp0s.d.cts → blockchain-DmCPxnxr.d.cts} +25 -1
- package/dist/{blockchain-BxAFzp0s.d.ts → blockchain-DmCPxnxr.d.ts} +25 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/{core-B1WCJfDI.d.ts → core-B4YDGtJT.d.ts} +3 -3
- package/dist/{core-CeNTuqPz.d.cts → core-Ck7dinYj.d.cts} +3 -3
- package/dist/core.cjs +57 -10
- 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 +57 -10
- package/dist/core.mjs.map +1 -1
- package/dist/index.cjs +60 -21
- 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 +60 -21
- package/dist/index.mjs.map +1 -1
- package/dist/{manager-DNGk1YkR.d.cts → manager-BZ8gyHGT.d.cts} +1 -1
- package/dist/{manager-Bw8b1wSD.d.ts → manager-D8nQsod2.d.ts} +1 -1
- package/dist/{metadata-Dk4R8_-T.d.cts → metadata-B23D0oO9.d.cts} +1 -1
- package/dist/{metadata-C__KMeuz.d.ts → metadata-BOjEF7oo.d.ts} +1 -1
- package/dist/smart-account.cjs +14 -4
- package/dist/smart-account.cjs.map +1 -1
- package/dist/smart-account.d.cts +1 -0
- package/dist/smart-account.d.ts +1 -0
- package/dist/smart-account.mjs +14 -4
- package/dist/smart-account.mjs.map +1 -1
- package/dist/{types-BJY9r-mz.d.ts → types-CMmx0S4U.d.ts} +1 -1
- package/dist/{types-DX3HtFcn.d.cts → types-DEUb5IZA.d.cts} +1 -1
- package/dist/wallet.cjs +12 -2
- 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 +12 -2
- package/dist/wallet.mjs.map +1 -1
- package/dist/widget.cjs +60 -21
- 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 +60 -21
- package/dist/widget.mjs.map +1 -1
- package/package.json +2 -1
package/dist/widget.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { N as NavigationStep } from './types-
|
|
3
|
-
import './blockchain-
|
|
2
|
+
import { N as NavigationStep } from './types-DEUb5IZA.cjs';
|
|
3
|
+
import './blockchain-DmCPxnxr.cjs';
|
|
4
4
|
|
|
5
5
|
type Theme = "light" | "dark" | "system";
|
|
6
6
|
|
package/dist/widget.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { N as NavigationStep } from './types-
|
|
3
|
-
import './blockchain-
|
|
2
|
+
import { N as NavigationStep } from './types-CMmx0S4U.js';
|
|
3
|
+
import './blockchain-DmCPxnxr.js';
|
|
4
4
|
|
|
5
5
|
type Theme = "light" | "dark" | "system";
|
|
6
6
|
|
package/dist/widget.mjs
CHANGED
|
@@ -545,7 +545,17 @@ var init_config = __esm({
|
|
|
545
545
|
RATE_LIMIT_WAIT_BUDGET_MS = 1e4;
|
|
546
546
|
DEFAULT_FEATURE_FLAGS = {
|
|
547
547
|
tokensPagination: true,
|
|
548
|
-
|
|
548
|
+
// On by default: an address scan covers every configured chain and takes
|
|
549
|
+
// seconds end to end, so streaming turns one long wait into a wallet that
|
|
550
|
+
// fills in as results land — first chunk in ~200ms against a ~2.3s buffered
|
|
551
|
+
// response, measured on a live backend.
|
|
552
|
+
//
|
|
553
|
+
// Safe to default because the path degrades on its own: a backend with
|
|
554
|
+
// BALANCE_STREAM_ENABLED off refuses the stream, and the SDK falls back to
|
|
555
|
+
// the buffered endpoint (emitting balance_stream_fallback), as does any
|
|
556
|
+
// runtime whose fetch has no readable body — React Native, most notably.
|
|
557
|
+
// The cost of defaulting ahead of a backend is one refused request per scan.
|
|
558
|
+
balanceStreaming: true,
|
|
549
559
|
shouldAllowGA4: true,
|
|
550
560
|
swapMode: false,
|
|
551
561
|
swapDefaultDestToken: null,
|
|
@@ -561,7 +571,7 @@ var init_constants = __esm({
|
|
|
561
571
|
"src/constants.ts"() {
|
|
562
572
|
"use strict";
|
|
563
573
|
SDK_NAME = "@trustware/sdk";
|
|
564
|
-
SDK_VERSION = "1.1.
|
|
574
|
+
SDK_VERSION = "1.1.12-staging.1";
|
|
565
575
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
566
576
|
GTM_ID = "GTM-TZDGNCXB";
|
|
567
577
|
API_PREFIX = "/api";
|
|
@@ -609,7 +619,7 @@ function isNotFoundError(err) {
|
|
|
609
619
|
return err instanceof Error && err.message.startsWith("HTTP 404");
|
|
610
620
|
}
|
|
611
621
|
async function validateSdkAccess() {
|
|
612
|
-
const r = await fetch(`${apiBase()}/sdk/validate`, {
|
|
622
|
+
const r = await fetch(`${apiBase()}/v1/sdk/validate`, {
|
|
613
623
|
method: "GET",
|
|
614
624
|
headers: jsonHeaders()
|
|
615
625
|
});
|
|
@@ -2292,6 +2302,16 @@ function mergeBalanceWrappers(current, incoming) {
|
|
|
2292
2302
|
}
|
|
2293
2303
|
return Array.from(merged.values());
|
|
2294
2304
|
}
|
|
2305
|
+
function toSummary(frame, address) {
|
|
2306
|
+
const total = toNumberOrUndefined(frame.total) ?? 0;
|
|
2307
|
+
return {
|
|
2308
|
+
address: toStringOrUndefined(frame.address) ?? address,
|
|
2309
|
+
partial: Boolean(frame.partial),
|
|
2310
|
+
completed: toNumberOrUndefined(frame.completed) ?? 0,
|
|
2311
|
+
total,
|
|
2312
|
+
elapsedMs: toNumberOrUndefined(frame.elapsed)
|
|
2313
|
+
};
|
|
2314
|
+
}
|
|
2295
2315
|
async function parseStreamingBalances(response, address, options = {}) {
|
|
2296
2316
|
if (!response.body) {
|
|
2297
2317
|
throw new Error("balances stream: empty response body");
|
|
@@ -2312,7 +2332,12 @@ async function parseStreamingBalances(response, address, options = {}) {
|
|
|
2312
2332
|
if (!trimmed) continue;
|
|
2313
2333
|
try {
|
|
2314
2334
|
const parsed = JSON.parse(trimmed);
|
|
2315
|
-
if (!parsed.chain_id)
|
|
2335
|
+
if (!parsed.chain_id) {
|
|
2336
|
+
if (parsed.type === "summary") {
|
|
2337
|
+
options.onSummary?.(toSummary(parsed, address));
|
|
2338
|
+
}
|
|
2339
|
+
continue;
|
|
2340
|
+
}
|
|
2316
2341
|
const chunk = normalizeStreamChunk(parsed);
|
|
2317
2342
|
emitBalanceStreamChunk(address, chunk.length);
|
|
2318
2343
|
yield chunk;
|
|
@@ -2331,6 +2356,8 @@ async function parseStreamingBalances(response, address, options = {}) {
|
|
|
2331
2356
|
const chunk = normalizeStreamChunk(parsed);
|
|
2332
2357
|
emitBalanceStreamChunk(address, chunk.length);
|
|
2333
2358
|
yield chunk;
|
|
2359
|
+
} else if (parsed.type === "summary") {
|
|
2360
|
+
options.onSummary?.(toSummary(parsed, address));
|
|
2334
2361
|
}
|
|
2335
2362
|
} catch (error) {
|
|
2336
2363
|
if (options.strict) {
|
|
@@ -2385,7 +2412,7 @@ async function getBalancesByAddress(address, opts) {
|
|
|
2385
2412
|
}
|
|
2386
2413
|
return merged;
|
|
2387
2414
|
}
|
|
2388
|
-
const url = `${apiBase()}/data/balances/${address}`;
|
|
2415
|
+
const url = `${apiBase()}/v1/data/balances/${address}`;
|
|
2389
2416
|
const r = await rateLimitedFetch(url, {
|
|
2390
2417
|
method: "GET",
|
|
2391
2418
|
credentials: "omit",
|
|
@@ -2393,14 +2420,27 @@ async function getBalancesByAddress(address, opts) {
|
|
|
2393
2420
|
});
|
|
2394
2421
|
if (!r.ok) throw new Error(`balances: HTTP ${r.status}`);
|
|
2395
2422
|
const j = await r.json();
|
|
2396
|
-
|
|
2423
|
+
const results = Array.isArray(j) ? j : j.results ?? [];
|
|
2424
|
+
if (opts?.onSummary) {
|
|
2425
|
+
const completed = results.length;
|
|
2426
|
+
opts.onSummary({
|
|
2427
|
+
address,
|
|
2428
|
+
partial: Array.isArray(j) ? false : Boolean(j.partial),
|
|
2429
|
+
completed,
|
|
2430
|
+
total: completed
|
|
2431
|
+
});
|
|
2432
|
+
}
|
|
2433
|
+
return results;
|
|
2434
|
+
}
|
|
2435
|
+
function bufferedOptions(opts) {
|
|
2436
|
+
return { ...opts, stream: false };
|
|
2397
2437
|
}
|
|
2398
2438
|
async function* getBalancesByAddressStream(address, opts = {}) {
|
|
2399
2439
|
if (!TrustwareConfigStore.get().features.balanceStreaming) {
|
|
2400
|
-
yield await getBalancesByAddress(address);
|
|
2440
|
+
yield await getBalancesByAddress(address, bufferedOptions(opts));
|
|
2401
2441
|
return;
|
|
2402
2442
|
}
|
|
2403
|
-
const url = `${apiBase()}/data/balances/${address}?stream=1`;
|
|
2443
|
+
const url = `${apiBase()}/v1/data/balances/${address}?stream=1`;
|
|
2404
2444
|
try {
|
|
2405
2445
|
const response = await rateLimitedFetch(url, {
|
|
2406
2446
|
method: "GET",
|
|
@@ -2416,7 +2456,14 @@ async function* getBalancesByAddressStream(address, opts = {}) {
|
|
|
2416
2456
|
const contentType = response.headers.get("content-type") ?? "";
|
|
2417
2457
|
if (contentType.includes("application/json")) {
|
|
2418
2458
|
const payload = await response.json();
|
|
2419
|
-
|
|
2459
|
+
const results = Array.isArray(payload) ? payload : payload.results ?? [];
|
|
2460
|
+
opts.onSummary?.({
|
|
2461
|
+
address,
|
|
2462
|
+
partial: Array.isArray(payload) ? false : Boolean(payload.partial),
|
|
2463
|
+
completed: results.length,
|
|
2464
|
+
total: results.length
|
|
2465
|
+
});
|
|
2466
|
+
yield results;
|
|
2420
2467
|
return;
|
|
2421
2468
|
}
|
|
2422
2469
|
const stream = await parseStreamingBalances(response, address, opts);
|
|
@@ -2425,7 +2472,7 @@ async function* getBalancesByAddressStream(address, opts = {}) {
|
|
|
2425
2472
|
}
|
|
2426
2473
|
} catch (error) {
|
|
2427
2474
|
emitBalanceStreamFallback(address, error);
|
|
2428
|
-
yield await getBalancesByAddress(address);
|
|
2475
|
+
yield await getBalancesByAddress(address, bufferedOptions(opts));
|
|
2429
2476
|
}
|
|
2430
2477
|
}
|
|
2431
2478
|
async function ensureRegistry() {
|
|
@@ -2956,15 +3003,7 @@ function useTrustwareConfig() {
|
|
|
2956
3003
|
// Shared with the resolver rather than restated, so this placeholder
|
|
2957
3004
|
// can't drift from the real defaults.
|
|
2958
3005
|
retry: { ...DEFAULT_RETRY_CONFIG },
|
|
2959
|
-
features: {
|
|
2960
|
-
tokensPagination: true,
|
|
2961
|
-
balanceStreaming: false,
|
|
2962
|
-
shouldAllowGA4: true,
|
|
2963
|
-
swapMode: false,
|
|
2964
|
-
swapDefaultDestToken: null,
|
|
2965
|
-
swapLockDestToken: false,
|
|
2966
|
-
swapAllowedDestTokens: null
|
|
2967
|
-
}
|
|
3006
|
+
features: { ...DEFAULT_FEATURE_FLAGS }
|
|
2968
3007
|
};
|
|
2969
3008
|
}
|
|
2970
3009
|
});
|
|
@@ -20399,7 +20438,7 @@ var VERSION;
|
|
|
20399
20438
|
var init_version = __esm({
|
|
20400
20439
|
"node_modules/@aa-sdk/core/dist/esm/version.js"() {
|
|
20401
20440
|
"use strict";
|
|
20402
|
-
VERSION = "4.88.
|
|
20441
|
+
VERSION = "4.88.5";
|
|
20403
20442
|
}
|
|
20404
20443
|
});
|
|
20405
20444
|
|
|
@@ -28908,7 +28947,7 @@ var VERSION2;
|
|
|
28908
28947
|
var init_version2 = __esm({
|
|
28909
28948
|
"node_modules/@account-kit/infra/dist/esm/version.js"() {
|
|
28910
28949
|
"use strict";
|
|
28911
|
-
VERSION2 = "4.88.
|
|
28950
|
+
VERSION2 = "4.88.5";
|
|
28912
28951
|
}
|
|
28913
28952
|
});
|
|
28914
28953
|
|