@trustware/sdk-staging 1.1.11-staging.1 → 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.
Files changed (44) hide show
  1. package/README.md +54 -21
  2. package/dist/{blockchain-BxAFzp0s.d.cts → blockchain-DmCPxnxr.d.cts} +25 -1
  3. package/dist/{blockchain-BxAFzp0s.d.ts → blockchain-DmCPxnxr.d.ts} +25 -1
  4. package/dist/constants.cjs +1 -1
  5. package/dist/constants.mjs +1 -1
  6. package/dist/{core-BgYLe9Q7.d.ts → core-B4YDGtJT.d.ts} +3 -3
  7. package/dist/{core-fLSt4qD2.d.cts → core-Ck7dinYj.d.cts} +3 -3
  8. package/dist/core.cjs +141 -52
  9. package/dist/core.cjs.map +1 -1
  10. package/dist/core.d.cts +4 -4
  11. package/dist/core.d.ts +4 -4
  12. package/dist/core.mjs +139 -51
  13. package/dist/core.mjs.map +1 -1
  14. package/dist/index.cjs +166 -75
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +14 -8
  17. package/dist/index.d.ts +14 -8
  18. package/dist/index.mjs +164 -75
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/{manager-DT8enQbE.d.cts → manager-BZ8gyHGT.d.cts} +90 -23
  21. package/dist/{manager-BY3NHAks.d.ts → manager-D8nQsod2.d.ts} +90 -23
  22. package/dist/{metadata-DyxUcKHk.d.cts → metadata-B23D0oO9.d.cts} +1 -1
  23. package/dist/{metadata-BPvFYMlc.d.ts → metadata-BOjEF7oo.d.ts} +1 -1
  24. package/dist/smart-account.cjs +62 -47
  25. package/dist/smart-account.cjs.map +1 -1
  26. package/dist/smart-account.d.cts +6 -0
  27. package/dist/smart-account.d.ts +6 -0
  28. package/dist/smart-account.mjs +62 -47
  29. package/dist/smart-account.mjs.map +1 -1
  30. package/dist/{types-BJY9r-mz.d.ts → types-CMmx0S4U.d.ts} +1 -1
  31. package/dist/{types-DX3HtFcn.d.cts → types-DEUb5IZA.d.cts} +1 -1
  32. package/dist/wallet.cjs +51 -40
  33. package/dist/wallet.cjs.map +1 -1
  34. package/dist/wallet.d.cts +4 -4
  35. package/dist/wallet.d.ts +4 -4
  36. package/dist/wallet.mjs +51 -40
  37. package/dist/wallet.mjs.map +1 -1
  38. package/dist/widget.cjs +160 -75
  39. package/dist/widget.cjs.map +1 -1
  40. package/dist/widget.d.cts +2 -2
  41. package/dist/widget.d.ts +2 -2
  42. package/dist/widget.mjs +160 -75
  43. package/dist/widget.mjs.map +1 -1
  44. package/package.json +74 -5
package/dist/index.cjs CHANGED
@@ -47,21 +47,29 @@ var init_defaults = __esm({
47
47
  });
48
48
 
49
49
  // src/types/config.ts
50
- var DEFAULT_SLIPPAGE2, DEFAULT_AUTO_DETECT_PROVIDER2, DEFAULT_RETRY_CONFIG, DEFAULT_FEATURE_FLAGS;
50
+ var DEFAULT_SLIPPAGE2, DEFAULT_AUTO_DETECT_PROVIDER2, DEFAULT_RETRY_CONFIG, RATE_LIMIT_WAIT_BUDGET_MS, DEFAULT_FEATURE_FLAGS;
51
51
  var init_config = __esm({
52
52
  "src/types/config.ts"() {
53
53
  "use strict";
54
54
  DEFAULT_SLIPPAGE2 = 1;
55
55
  DEFAULT_AUTO_DETECT_PROVIDER2 = false;
56
56
  DEFAULT_RETRY_CONFIG = {
57
- autoRetry: true,
58
- maxRetries: 3,
59
- baseDelayMs: 1e3,
60
57
  approachingThreshold: 5
61
58
  };
59
+ RATE_LIMIT_WAIT_BUDGET_MS = 1e4;
62
60
  DEFAULT_FEATURE_FLAGS = {
63
61
  tokensPagination: true,
64
- balanceStreaming: false,
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,
65
73
  shouldAllowGA4: true,
66
74
  swapMode: false,
67
75
  swapDefaultDestToken: null,
@@ -195,9 +203,6 @@ function resolveConfig(input) {
195
203
  const theme = input.theme ?? "system";
196
204
  const messages = deepMerge(DEFAULT_MESSAGES, input.messages);
197
205
  const retry = {
198
- autoRetry: input.retry?.autoRetry ?? DEFAULT_RETRY_CONFIG.autoRetry,
199
- maxRetries: input.retry?.maxRetries ?? DEFAULT_RETRY_CONFIG.maxRetries,
200
- baseDelayMs: input.retry?.baseDelayMs ?? DEFAULT_RETRY_CONFIG.baseDelayMs,
201
206
  approachingThreshold: input.retry?.approachingThreshold ?? DEFAULT_RETRY_CONFIG.approachingThreshold,
202
207
  onRateLimitInfo: input.retry?.onRateLimitInfo,
203
208
  onRateLimited: input.retry?.onRateLimited,
@@ -509,7 +514,7 @@ var init_constants = __esm({
509
514
  "src/constants.ts"() {
510
515
  "use strict";
511
516
  SDK_NAME = "@trustware/sdk";
512
- SDK_VERSION = "1.1.11-staging.1";
517
+ SDK_VERSION = "1.1.12-staging.1";
513
518
  API_ROOT = "https://bv-staging-api.trustware.io";
514
519
  GTM_ID = "GTM-TZDGNCXB";
515
520
  API_PREFIX = "/api";
@@ -557,7 +562,7 @@ function isNotFoundError(err) {
557
562
  return err instanceof Error && err.message.startsWith("HTTP 404");
558
563
  }
559
564
  async function validateSdkAccess() {
560
- const r = await fetch(`${apiBase()}/sdk/validate`, {
565
+ const r = await fetch(`${apiBase()}/v1/sdk/validate`, {
561
566
  method: "GET",
562
567
  headers: jsonHeaders()
563
568
  });
@@ -596,50 +601,54 @@ function notifyRateLimitCallbacks(info, isRateLimited, retryCount) {
596
601
  retry.onRateLimitApproaching(info, retry.approachingThreshold);
597
602
  }
598
603
  }
599
- function calculateBackoffDelay(baseDelayMs, retryCount, retryAfter) {
600
- if (retryAfter && retryAfter > 0) {
601
- return retryAfter * 1e3;
604
+ function serverDirectedWaitMs(info) {
605
+ if (!info) return null;
606
+ if (typeof info.retryAfter === "number" && info.retryAfter > 0) {
607
+ return info.retryAfter * 1e3;
602
608
  }
603
- return baseDelayMs * Math.pow(2, retryCount);
609
+ if (typeof info.reset === "number" && info.reset > 0) {
610
+ const untilReset = info.reset * 1e3 - Date.now();
611
+ if (untilReset > 0) return untilReset;
612
+ }
613
+ return null;
604
614
  }
605
615
  function sleep(ms) {
606
616
  return new Promise((resolve) => setTimeout(resolve, ms));
607
617
  }
608
- async function rateLimitedFetch(url, options = {}) {
609
- const { skipRateLimit, ...fetchOptions } = options;
610
- const cfg = TrustwareConfigStore.get();
611
- if (!cfg.retry.autoRetry || skipRateLimit) {
612
- return fetch(url, fetchOptions);
613
- }
614
- const { maxRetries, baseDelayMs } = cfg.retry;
618
+ async function withRateLimitRetry(attempt) {
619
+ let waitedMs = 0;
615
620
  let retryCount = 0;
616
621
  while (true) {
617
- const response = await fetch(url, fetchOptions);
622
+ const response = await attempt();
618
623
  const rateLimitInfo = parseRateLimitHeaders(response);
619
- if (response.status === 429) {
624
+ if (response.status !== 429) {
620
625
  if (rateLimitInfo) {
621
- notifyRateLimitCallbacks(rateLimitInfo, true, retryCount);
626
+ notifyRateLimitCallbacks(rateLimitInfo, false, 0);
622
627
  }
623
- if (retryCount >= maxRetries) {
624
- throw new RateLimitError(
625
- rateLimitInfo || { limit: 0, remaining: 0, reset: 0 },
626
- true
627
- );
628
- }
629
- const delay = calculateBackoffDelay(
630
- baseDelayMs,
631
- retryCount,
632
- rateLimitInfo?.retryAfter
633
- );
634
- await sleep(delay);
635
- retryCount++;
636
- continue;
628
+ return response;
637
629
  }
638
630
  if (rateLimitInfo) {
639
- notifyRateLimitCallbacks(rateLimitInfo, false, 0);
631
+ notifyRateLimitCallbacks(rateLimitInfo, true, retryCount);
640
632
  }
641
- return response;
633
+ const waitMs = serverDirectedWaitMs(rateLimitInfo);
634
+ const info = rateLimitInfo || { limit: 0, remaining: 0, reset: 0 };
635
+ if (waitMs === null) {
636
+ throw new RateLimitError(info, true);
637
+ }
638
+ if (waitedMs + waitMs > RATE_LIMIT_WAIT_BUDGET_MS) {
639
+ throw new RateLimitError(info, false);
640
+ }
641
+ await sleep(waitMs);
642
+ waitedMs += waitMs;
643
+ retryCount++;
644
+ }
645
+ }
646
+ async function rateLimitedFetch(url, options = {}) {
647
+ const { skipRateLimit, ...fetchOptions } = options;
648
+ if (skipRateLimit) {
649
+ return fetch(url, fetchOptions);
642
650
  }
651
+ return withRateLimitRetry(() => fetch(url, fetchOptions));
643
652
  }
644
653
  var RateLimitError;
645
654
  var init_http = __esm({
@@ -647,9 +656,11 @@ var init_http = __esm({
647
656
  "use strict";
648
657
  init_constants();
649
658
  init_config2();
659
+ init_config();
650
660
  RateLimitError = class extends Error {
651
661
  constructor(info, retriesExhausted) {
652
- const message = retriesExhausted ? `Rate limit exceeded after max retries. Try again in ${info.retryAfter ?? Math.ceil((info.reset * 1e3 - Date.now()) / 1e3)} seconds.` : `Rate limit exceeded. Try again in ${info.retryAfter} seconds.`;
662
+ const seconds = info.retryAfter ?? (info.reset > 0 ? Math.max(0, Math.ceil((info.reset * 1e3 - Date.now()) / 1e3)) : null);
663
+ const message = seconds === null ? "Rate limit exceeded. The server did not say when to retry." : `Rate limit exceeded. Try again in ${seconds} seconds.`;
653
664
  super(message);
654
665
  this.name = "RateLimitError";
655
666
  this.rateLimitInfo = info;
@@ -4575,7 +4586,18 @@ async function getStatus(intentId) {
4575
4586
  );
4576
4587
  await assertOK(r);
4577
4588
  const j = await r.json();
4578
- return j.data;
4589
+ return normalizeStatusPayload(j.data);
4590
+ }
4591
+ function normalizeStatusPayload(raw) {
4592
+ if (!raw || typeof raw !== "object") return raw;
4593
+ const wire = raw;
4594
+ const out = { ...wire };
4595
+ for (const [snake, camel] of Object.entries(STATUS_WIRE_TO_CAMEL)) {
4596
+ if (out[camel] !== void 0) continue;
4597
+ if (!(snake in wire)) continue;
4598
+ out[camel] = wire[snake];
4599
+ }
4600
+ return out;
4579
4601
  }
4580
4602
  async function pollStatus(intentId, { intervalMs = 2e3, timeoutMs = 5 * 6e4 } = {}) {
4581
4603
  const t0 = Date.now();
@@ -4586,12 +4608,39 @@ async function pollStatus(intentId, { intervalMs = 2e3, timeoutMs = 5 * 6e4 } =
4586
4608
  await new Promise((r) => setTimeout(r, intervalMs));
4587
4609
  }
4588
4610
  }
4611
+ var STATUS_WIRE_TO_CAMEL;
4589
4612
  var init_routes = __esm({
4590
4613
  "src/core/routes.ts"() {
4591
4614
  "use strict";
4592
4615
  init_http();
4593
4616
  init_store();
4594
4617
  init_address();
4618
+ STATUS_WIRE_TO_CAMEL = {
4619
+ intent_id: "intentId",
4620
+ from_address: "fromAddress",
4621
+ to_address: "toAddress",
4622
+ from_chain_id: "fromChainId",
4623
+ to_chain_id: "toChainId",
4624
+ source_tx_hash: "sourceTxHash",
4625
+ dest_tx_hash: "destTxHash",
4626
+ request_id: "requestId",
4627
+ provider_request_id: "providerRequestId",
4628
+ transaction_request: "transactionRequest",
4629
+ status_raw: "statusRaw",
4630
+ route_path: "routePath",
4631
+ route_status: "routeStatus",
4632
+ to_amount_wei: "toAmountWei",
4633
+ from_chain_block: "fromChainBlock",
4634
+ to_chain_block: "toChainBlock",
4635
+ from_chain_tx_url: "fromChainTxUrl",
4636
+ to_chain_tx_url: "toChainTxUrl",
4637
+ gas_status: "gasStatus",
4638
+ is_gmp_transaction: "isGMPTransaction",
4639
+ axelar_transaction_url: "axelarTransactionUrl",
4640
+ create_date: "createdDate",
4641
+ update_date: "updatedDate",
4642
+ time_spent_ms: "timeSpentMs"
4643
+ };
4595
4644
  }
4596
4645
  });
4597
4646
 
@@ -5068,6 +5117,16 @@ function mergeBalanceWrappers(current, incoming) {
5068
5117
  }
5069
5118
  return Array.from(merged.values());
5070
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
+ }
5071
5130
  async function parseStreamingBalances(response, address, options = {}) {
5072
5131
  if (!response.body) {
5073
5132
  throw new Error("balances stream: empty response body");
@@ -5088,7 +5147,12 @@ async function parseStreamingBalances(response, address, options = {}) {
5088
5147
  if (!trimmed) continue;
5089
5148
  try {
5090
5149
  const parsed = JSON.parse(trimmed);
5091
- if (!parsed.chain_id) continue;
5150
+ if (!parsed.chain_id) {
5151
+ if (parsed.type === "summary") {
5152
+ options.onSummary?.(toSummary(parsed, address));
5153
+ }
5154
+ continue;
5155
+ }
5092
5156
  const chunk = normalizeStreamChunk(parsed);
5093
5157
  emitBalanceStreamChunk(address, chunk.length);
5094
5158
  yield chunk;
@@ -5107,6 +5171,8 @@ async function parseStreamingBalances(response, address, options = {}) {
5107
5171
  const chunk = normalizeStreamChunk(parsed);
5108
5172
  emitBalanceStreamChunk(address, chunk.length);
5109
5173
  yield chunk;
5174
+ } else if (parsed.type === "summary") {
5175
+ options.onSummary?.(toSummary(parsed, address));
5110
5176
  }
5111
5177
  } catch (error) {
5112
5178
  if (options.strict) {
@@ -5140,7 +5206,7 @@ async function getBalances(chainRef, address, opts) {
5140
5206
  if (cached) return cached;
5141
5207
  }
5142
5208
  const url = `${apiBase()}/v1/data/wallets/${encodeURIComponent(chainKey)}/${trimmedAddress}/balances`;
5143
- const response = await fetch(url, {
5209
+ const response = await rateLimitedFetch(url, {
5144
5210
  method: "GET",
5145
5211
  credentials: "omit",
5146
5212
  headers: jsonHeaders()
@@ -5161,7 +5227,7 @@ async function getBalancesByAddress(address, opts) {
5161
5227
  }
5162
5228
  return merged;
5163
5229
  }
5164
- const url = `${apiBase()}/data/balances/${address}`;
5230
+ const url = `${apiBase()}/v1/data/balances/${address}`;
5165
5231
  const r = await rateLimitedFetch(url, {
5166
5232
  method: "GET",
5167
5233
  credentials: "omit",
@@ -5169,14 +5235,27 @@ async function getBalancesByAddress(address, opts) {
5169
5235
  });
5170
5236
  if (!r.ok) throw new Error(`balances: HTTP ${r.status}`);
5171
5237
  const j = await r.json();
5172
- return Array.isArray(j) ? j : j.results ?? [];
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 };
5173
5252
  }
5174
5253
  async function* getBalancesByAddressStream(address, opts = {}) {
5175
5254
  if (!TrustwareConfigStore.get().features.balanceStreaming) {
5176
- yield await getBalancesByAddress(address);
5255
+ yield await getBalancesByAddress(address, bufferedOptions(opts));
5177
5256
  return;
5178
5257
  }
5179
- const url = `${apiBase()}/data/balances/${address}?stream=1`;
5258
+ const url = `${apiBase()}/v1/data/balances/${address}?stream=1`;
5180
5259
  try {
5181
5260
  const response = await rateLimitedFetch(url, {
5182
5261
  method: "GET",
@@ -5192,7 +5271,14 @@ async function* getBalancesByAddressStream(address, opts = {}) {
5192
5271
  const contentType = response.headers.get("content-type") ?? "";
5193
5272
  if (contentType.includes("application/json")) {
5194
5273
  const payload = await response.json();
5195
- yield Array.isArray(payload) ? payload : payload.results ?? [];
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;
5196
5282
  return;
5197
5283
  }
5198
5284
  const stream = await parseStreamingBalances(response, address, opts);
@@ -5201,7 +5287,7 @@ async function* getBalancesByAddressStream(address, opts = {}) {
5201
5287
  }
5202
5288
  } catch (error) {
5203
5289
  emitBalanceStreamFallback(address, error);
5204
- yield await getBalancesByAddress(address);
5290
+ yield await getBalancesByAddress(address, bufferedOptions(opts));
5205
5291
  }
5206
5292
  }
5207
5293
  async function ensureRegistry() {
@@ -7643,6 +7729,7 @@ var init_core = __esm({
7643
7729
  init_store();
7644
7730
  init_wallets();
7645
7731
  init_routes();
7732
+ init_routes();
7646
7733
  init_balances();
7647
7734
  init_tx();
7648
7735
  init_http();
@@ -8245,21 +8332,10 @@ function useTrustwareConfig() {
8245
8332
  title: "Trustware SDK",
8246
8333
  description: "Seamlessly bridge assets across chains with Trustware."
8247
8334
  },
8248
- retry: {
8249
- autoRetry: true,
8250
- maxRetries: 3,
8251
- baseDelayMs: 1e3,
8252
- approachingThreshold: 5
8253
- },
8254
- features: {
8255
- tokensPagination: true,
8256
- balanceStreaming: false,
8257
- shouldAllowGA4: true,
8258
- swapMode: false,
8259
- swapDefaultDestToken: null,
8260
- swapLockDestToken: false,
8261
- swapAllowedDestTokens: null
8262
- }
8335
+ // Shared with the resolver rather than restated, so this placeholder
8336
+ // can't drift from the real defaults.
8337
+ retry: { ...DEFAULT_RETRY_CONFIG },
8338
+ features: { ...DEFAULT_FEATURE_FLAGS }
8263
8339
  };
8264
8340
  }
8265
8341
  });
@@ -8277,6 +8353,7 @@ var init_useTrustwareConfig = __esm({
8277
8353
  "use strict";
8278
8354
  "use client";
8279
8355
  import_react10 = require("react");
8356
+ init_config();
8280
8357
  init_store();
8281
8358
  }
8282
8359
  });
@@ -20579,7 +20656,7 @@ var VERSION;
20579
20656
  var init_version = __esm({
20580
20657
  "node_modules/@aa-sdk/core/dist/esm/version.js"() {
20581
20658
  "use strict";
20582
- VERSION = "4.88.4";
20659
+ VERSION = "4.88.5";
20583
20660
  }
20584
20661
  });
20585
20662
 
@@ -29098,7 +29175,7 @@ var VERSION2;
29098
29175
  var init_version2 = __esm({
29099
29176
  "node_modules/@account-kit/infra/dist/esm/version.js"() {
29100
29177
  "use strict";
29101
- VERSION2 = "4.88.4";
29178
+ VERSION2 = "4.88.5";
29102
29179
  }
29103
29180
  });
29104
29181
 
@@ -30830,7 +30907,7 @@ var init_src = __esm({
30830
30907
  });
30831
30908
 
30832
30909
  // src/smart-account/client.ts
30833
- async function fetchWithTimeout(url, init) {
30910
+ async function fetchOnceWithTimeout(url, init) {
30834
30911
  const controller = new AbortController();
30835
30912
  const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
30836
30913
  try {
@@ -30851,6 +30928,9 @@ async function fetchWithTimeout(url, init) {
30851
30928
  clearTimeout(timer);
30852
30929
  }
30853
30930
  }
30931
+ async function fetchWithTimeout(url, init) {
30932
+ return withRateLimitRetry(() => fetchOnceWithTimeout(url, init));
30933
+ }
30854
30934
  function extractRevertHex(err) {
30855
30935
  if (typeof err.data === "string" && err.data.startsWith("0x"))
30856
30936
  return err.data;
@@ -31343,7 +31423,7 @@ async function estimateRelayFeeInToken(valueWei, fromAmountWei, fromAmountUSD, c
31343
31423
  tokenUnitsPerDollar = Number(fromAmountWei) / fromUSD;
31344
31424
  } else if (fromToken && fromDecimals !== void 0) {
31345
31425
  try {
31346
- const resp = await fetch(
31426
+ const resp = await rateLimitedFetch(
31347
31427
  `${apiBase()}/v1/price/token?chainId=${cid}&address=${fromToken}`,
31348
31428
  { headers: jsonHeaders() }
31349
31429
  );
@@ -31359,9 +31439,10 @@ async function estimateRelayFeeInToken(valueWei, fromAmountWei, fromAmountUSD, c
31359
31439
  return 0n;
31360
31440
  }
31361
31441
  try {
31362
- const resp = await fetch(`${apiBase()}/v1/price/native?chainId=${cid}`, {
31363
- headers: jsonHeaders()
31364
- });
31442
+ const resp = await rateLimitedFetch(
31443
+ `${apiBase()}/v1/price/native?chainId=${cid}`,
31444
+ { headers: jsonHeaders() }
31445
+ );
31365
31446
  if (!resp.ok) throw new Error(`native price HTTP ${resp.status}`);
31366
31447
  const json = await resp.json();
31367
31448
  const ethPriceUSD = parseFloat(json.data?.priceUSD ?? "0");
@@ -34106,9 +34187,14 @@ var init_useSwapExecution = __esm({
34106
34187
 
34107
34188
  // src/core/forex.ts
34108
34189
  async function fetchForexRates(base2 = "USD") {
34109
- const r = await fetch(`${apiBase()}/v1/forex?base=${base2}`, {
34110
- headers: jsonHeaders()
34111
- });
34190
+ let r;
34191
+ try {
34192
+ r = await rateLimitedFetch(`${apiBase()}/v1/forex?base=${base2}`, {
34193
+ headers: jsonHeaders()
34194
+ });
34195
+ } catch {
34196
+ return {};
34197
+ }
34112
34198
  if (!r.ok) return {};
34113
34199
  const j = await r.json();
34114
34200
  const rates = j?.data?.rates ?? j?.rates ?? j?.data ?? {};
@@ -40268,6 +40354,7 @@ __export(index_exports, {
40268
40354
  GTM_ID: () => GTM_ID,
40269
40355
  IdentityStore: () => IdentityStore,
40270
40356
  POPULAR_ORDER: () => POPULAR_ORDER,
40357
+ RATE_LIMIT_WAIT_BUDGET_MS: () => RATE_LIMIT_WAIT_BUDGET_MS,
40271
40358
  RateLimitError: () => RateLimitError,
40272
40359
  SDK_NAME: () => SDK_NAME,
40273
40360
  SDK_VERSION: () => SDK_VERSION,
@@ -40277,6 +40364,7 @@ __export(index_exports, {
40277
40364
  TrustwareWidget: () => TrustwareWidgetV2,
40278
40365
  WALLETCONNECT_PROJECT_ID: () => WALLETCONNECT_PROJECT_ID,
40279
40366
  WALLETS: () => WALLETS,
40367
+ assertValidPostHook: () => assertValidPostHook,
40280
40368
  buildWalletIdentityAddress: () => buildWalletIdentityAddress,
40281
40369
  connectDetectedWallet: () => connectDetectedWallet,
40282
40370
  createWalletIdentity: () => createWalletIdentity,
@@ -40305,6 +40393,7 @@ var init_index = __esm({
40305
40393
  "src/index.ts"() {
40306
40394
  init_core2();
40307
40395
  init_http();
40396
+ init_core2();
40308
40397
  init_useWalletTokenState();
40309
40398
  init_wallets();
40310
40399
  init_widget();
@@ -40330,6 +40419,7 @@ init_index();
40330
40419
  GTM_ID,
40331
40420
  IdentityStore,
40332
40421
  POPULAR_ORDER,
40422
+ RATE_LIMIT_WAIT_BUDGET_MS,
40333
40423
  RateLimitError,
40334
40424
  SDK_NAME,
40335
40425
  SDK_VERSION,
@@ -40339,6 +40429,7 @@ init_index();
40339
40429
  TrustwareWidget,
40340
40430
  WALLETCONNECT_PROJECT_ID,
40341
40431
  WALLETS,
40432
+ assertValidPostHook,
40342
40433
  buildWalletIdentityAddress,
40343
40434
  connectDetectedWallet,
40344
40435
  createWalletIdentity,