@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/index.cjs
CHANGED
|
@@ -59,7 +59,17 @@ var init_config = __esm({
|
|
|
59
59
|
RATE_LIMIT_WAIT_BUDGET_MS = 1e4;
|
|
60
60
|
DEFAULT_FEATURE_FLAGS = {
|
|
61
61
|
tokensPagination: true,
|
|
62
|
-
|
|
62
|
+
// On by default: an address scan covers every configured chain and takes
|
|
63
|
+
// seconds end to end, so streaming turns one long wait into a wallet that
|
|
64
|
+
// fills in as results land — first chunk in ~200ms against a ~2.3s buffered
|
|
65
|
+
// response, measured on a live backend.
|
|
66
|
+
//
|
|
67
|
+
// Safe to default because the path degrades on its own: a backend with
|
|
68
|
+
// BALANCE_STREAM_ENABLED off refuses the stream, and the SDK falls back to
|
|
69
|
+
// the buffered endpoint (emitting balance_stream_fallback), as does any
|
|
70
|
+
// runtime whose fetch has no readable body — React Native, most notably.
|
|
71
|
+
// The cost of defaulting ahead of a backend is one refused request per scan.
|
|
72
|
+
balanceStreaming: true,
|
|
63
73
|
shouldAllowGA4: true,
|
|
64
74
|
swapMode: false,
|
|
65
75
|
swapDefaultDestToken: null,
|
|
@@ -504,7 +514,7 @@ var init_constants = __esm({
|
|
|
504
514
|
"src/constants.ts"() {
|
|
505
515
|
"use strict";
|
|
506
516
|
SDK_NAME = "@trustware/sdk";
|
|
507
|
-
SDK_VERSION = "1.1.
|
|
517
|
+
SDK_VERSION = "1.1.12-staging.1";
|
|
508
518
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
509
519
|
GTM_ID = "GTM-TZDGNCXB";
|
|
510
520
|
API_PREFIX = "/api";
|
|
@@ -552,7 +562,7 @@ function isNotFoundError(err) {
|
|
|
552
562
|
return err instanceof Error && err.message.startsWith("HTTP 404");
|
|
553
563
|
}
|
|
554
564
|
async function validateSdkAccess() {
|
|
555
|
-
const r = await fetch(`${apiBase()}/sdk/validate`, {
|
|
565
|
+
const r = await fetch(`${apiBase()}/v1/sdk/validate`, {
|
|
556
566
|
method: "GET",
|
|
557
567
|
headers: jsonHeaders()
|
|
558
568
|
});
|
|
@@ -5107,6 +5117,16 @@ function mergeBalanceWrappers(current, incoming) {
|
|
|
5107
5117
|
}
|
|
5108
5118
|
return Array.from(merged.values());
|
|
5109
5119
|
}
|
|
5120
|
+
function toSummary(frame, address) {
|
|
5121
|
+
const total = toNumberOrUndefined(frame.total) ?? 0;
|
|
5122
|
+
return {
|
|
5123
|
+
address: toStringOrUndefined(frame.address) ?? address,
|
|
5124
|
+
partial: Boolean(frame.partial),
|
|
5125
|
+
completed: toNumberOrUndefined(frame.completed) ?? 0,
|
|
5126
|
+
total,
|
|
5127
|
+
elapsedMs: toNumberOrUndefined(frame.elapsed)
|
|
5128
|
+
};
|
|
5129
|
+
}
|
|
5110
5130
|
async function parseStreamingBalances(response, address, options = {}) {
|
|
5111
5131
|
if (!response.body) {
|
|
5112
5132
|
throw new Error("balances stream: empty response body");
|
|
@@ -5127,7 +5147,12 @@ async function parseStreamingBalances(response, address, options = {}) {
|
|
|
5127
5147
|
if (!trimmed) continue;
|
|
5128
5148
|
try {
|
|
5129
5149
|
const parsed = JSON.parse(trimmed);
|
|
5130
|
-
if (!parsed.chain_id)
|
|
5150
|
+
if (!parsed.chain_id) {
|
|
5151
|
+
if (parsed.type === "summary") {
|
|
5152
|
+
options.onSummary?.(toSummary(parsed, address));
|
|
5153
|
+
}
|
|
5154
|
+
continue;
|
|
5155
|
+
}
|
|
5131
5156
|
const chunk = normalizeStreamChunk(parsed);
|
|
5132
5157
|
emitBalanceStreamChunk(address, chunk.length);
|
|
5133
5158
|
yield chunk;
|
|
@@ -5146,6 +5171,8 @@ async function parseStreamingBalances(response, address, options = {}) {
|
|
|
5146
5171
|
const chunk = normalizeStreamChunk(parsed);
|
|
5147
5172
|
emitBalanceStreamChunk(address, chunk.length);
|
|
5148
5173
|
yield chunk;
|
|
5174
|
+
} else if (parsed.type === "summary") {
|
|
5175
|
+
options.onSummary?.(toSummary(parsed, address));
|
|
5149
5176
|
}
|
|
5150
5177
|
} catch (error) {
|
|
5151
5178
|
if (options.strict) {
|
|
@@ -5200,7 +5227,7 @@ async function getBalancesByAddress(address, opts) {
|
|
|
5200
5227
|
}
|
|
5201
5228
|
return merged;
|
|
5202
5229
|
}
|
|
5203
|
-
const url = `${apiBase()}/data/balances/${address}`;
|
|
5230
|
+
const url = `${apiBase()}/v1/data/balances/${address}`;
|
|
5204
5231
|
const r = await rateLimitedFetch(url, {
|
|
5205
5232
|
method: "GET",
|
|
5206
5233
|
credentials: "omit",
|
|
@@ -5208,14 +5235,27 @@ async function getBalancesByAddress(address, opts) {
|
|
|
5208
5235
|
});
|
|
5209
5236
|
if (!r.ok) throw new Error(`balances: HTTP ${r.status}`);
|
|
5210
5237
|
const j = await r.json();
|
|
5211
|
-
|
|
5238
|
+
const results = Array.isArray(j) ? j : j.results ?? [];
|
|
5239
|
+
if (opts?.onSummary) {
|
|
5240
|
+
const completed = results.length;
|
|
5241
|
+
opts.onSummary({
|
|
5242
|
+
address,
|
|
5243
|
+
partial: Array.isArray(j) ? false : Boolean(j.partial),
|
|
5244
|
+
completed,
|
|
5245
|
+
total: completed
|
|
5246
|
+
});
|
|
5247
|
+
}
|
|
5248
|
+
return results;
|
|
5249
|
+
}
|
|
5250
|
+
function bufferedOptions(opts) {
|
|
5251
|
+
return { ...opts, stream: false };
|
|
5212
5252
|
}
|
|
5213
5253
|
async function* getBalancesByAddressStream(address, opts = {}) {
|
|
5214
5254
|
if (!TrustwareConfigStore.get().features.balanceStreaming) {
|
|
5215
|
-
yield await getBalancesByAddress(address);
|
|
5255
|
+
yield await getBalancesByAddress(address, bufferedOptions(opts));
|
|
5216
5256
|
return;
|
|
5217
5257
|
}
|
|
5218
|
-
const url = `${apiBase()}/data/balances/${address}?stream=1`;
|
|
5258
|
+
const url = `${apiBase()}/v1/data/balances/${address}?stream=1`;
|
|
5219
5259
|
try {
|
|
5220
5260
|
const response = await rateLimitedFetch(url, {
|
|
5221
5261
|
method: "GET",
|
|
@@ -5231,7 +5271,14 @@ async function* getBalancesByAddressStream(address, opts = {}) {
|
|
|
5231
5271
|
const contentType = response.headers.get("content-type") ?? "";
|
|
5232
5272
|
if (contentType.includes("application/json")) {
|
|
5233
5273
|
const payload = await response.json();
|
|
5234
|
-
|
|
5274
|
+
const results = Array.isArray(payload) ? payload : payload.results ?? [];
|
|
5275
|
+
opts.onSummary?.({
|
|
5276
|
+
address,
|
|
5277
|
+
partial: Array.isArray(payload) ? false : Boolean(payload.partial),
|
|
5278
|
+
completed: results.length,
|
|
5279
|
+
total: results.length
|
|
5280
|
+
});
|
|
5281
|
+
yield results;
|
|
5235
5282
|
return;
|
|
5236
5283
|
}
|
|
5237
5284
|
const stream = await parseStreamingBalances(response, address, opts);
|
|
@@ -5240,7 +5287,7 @@ async function* getBalancesByAddressStream(address, opts = {}) {
|
|
|
5240
5287
|
}
|
|
5241
5288
|
} catch (error) {
|
|
5242
5289
|
emitBalanceStreamFallback(address, error);
|
|
5243
|
-
yield await getBalancesByAddress(address);
|
|
5290
|
+
yield await getBalancesByAddress(address, bufferedOptions(opts));
|
|
5244
5291
|
}
|
|
5245
5292
|
}
|
|
5246
5293
|
async function ensureRegistry() {
|
|
@@ -8288,15 +8335,7 @@ function useTrustwareConfig() {
|
|
|
8288
8335
|
// Shared with the resolver rather than restated, so this placeholder
|
|
8289
8336
|
// can't drift from the real defaults.
|
|
8290
8337
|
retry: { ...DEFAULT_RETRY_CONFIG },
|
|
8291
|
-
features: {
|
|
8292
|
-
tokensPagination: true,
|
|
8293
|
-
balanceStreaming: false,
|
|
8294
|
-
shouldAllowGA4: true,
|
|
8295
|
-
swapMode: false,
|
|
8296
|
-
swapDefaultDestToken: null,
|
|
8297
|
-
swapLockDestToken: false,
|
|
8298
|
-
swapAllowedDestTokens: null
|
|
8299
|
-
}
|
|
8338
|
+
features: { ...DEFAULT_FEATURE_FLAGS }
|
|
8300
8339
|
};
|
|
8301
8340
|
}
|
|
8302
8341
|
});
|
|
@@ -20617,7 +20656,7 @@ var VERSION;
|
|
|
20617
20656
|
var init_version = __esm({
|
|
20618
20657
|
"node_modules/@aa-sdk/core/dist/esm/version.js"() {
|
|
20619
20658
|
"use strict";
|
|
20620
|
-
VERSION = "4.88.
|
|
20659
|
+
VERSION = "4.88.5";
|
|
20621
20660
|
}
|
|
20622
20661
|
});
|
|
20623
20662
|
|
|
@@ -29136,7 +29175,7 @@ var VERSION2;
|
|
|
29136
29175
|
var init_version2 = __esm({
|
|
29137
29176
|
"node_modules/@account-kit/infra/dist/esm/version.js"() {
|
|
29138
29177
|
"use strict";
|
|
29139
|
-
VERSION2 = "4.88.
|
|
29178
|
+
VERSION2 = "4.88.5";
|
|
29140
29179
|
}
|
|
29141
29180
|
});
|
|
29142
29181
|
|