@trustware/sdk-staging 1.1.16-staging.1 → 1.1.16-staging.3
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 +40 -32
- package/dist/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/{core-BZYVv-Vo.d.ts → core-B31ElTB8.d.ts} +30 -6
- package/dist/{core-EpQvLUSx.d.cts → core-Bp73X3Mp.d.cts} +30 -6
- package/dist/core.cjs +52 -36
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.mjs +51 -36
- package/dist/core.mjs.map +1 -1
- package/dist/index.cjs +64 -37
- 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 +63 -37
- package/dist/index.mjs.map +1 -1
- package/dist/smart-account.cjs +1 -1
- package/dist/smart-account.cjs.map +1 -1
- package/dist/smart-account.mjs +1 -1
- package/dist/smart-account.mjs.map +1 -1
- package/dist/wallet.cjs +1 -1
- package/dist/wallet.cjs.map +1 -1
- package/dist/wallet.mjs +1 -1
- package/dist/wallet.mjs.map +1 -1
- package/dist/widget.cjs +62 -37
- package/dist/widget.cjs.map +1 -1
- package/dist/widget.mjs +62 -37
- 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 { R as RouteDeclineCode, a as RouteError, b as RouteErrorCode, c as RouteErrorFacts, d as RouteFailureCode, e as RouteProviderOutcome, f as
|
|
1
|
+
import { T as Trustware } from './core-Bp73X3Mp.cjs';
|
|
2
|
+
export { R as RouteDeclineCode, a as RouteError, b as RouteErrorCode, c as RouteErrorFacts, d as RouteFailureCode, e as RouteProviderOutcome, f as RouteRejectionCode, g as TrustwareCore, h as assertRouteDeliversValue, i as formatMinimum, j as isRouteError, k as isValueDestroying, p as parseRouteError, r as routeNetUsd, v as validateAddressForChain, l as validateBtcAddress, m as validateCosmosAddress, n as validateEvmAddress, o as validateRouteAddresses, q as validateSeiAddress, s as validateSolanaAddress } from './core-Bp73X3Mp.cjs';
|
|
3
3
|
import { R as RateLimitInfo, T as TrustwareConfigOptions, i as WalletInterFaceAPI, j as TrustwareError, k as Transaction, l as TrustwareEvent } from './manager-BN0KXjcN.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-BN0KXjcN.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 { R as RouteDeclineCode, a as RouteError, b as RouteErrorCode, c as RouteErrorFacts, d as RouteFailureCode, e as RouteProviderOutcome, f as
|
|
1
|
+
import { T as Trustware } from './core-B31ElTB8.js';
|
|
2
|
+
export { R as RouteDeclineCode, a as RouteError, b as RouteErrorCode, c as RouteErrorFacts, d as RouteFailureCode, e as RouteProviderOutcome, f as RouteRejectionCode, g as TrustwareCore, h as assertRouteDeliversValue, i as formatMinimum, j as isRouteError, k as isValueDestroying, p as parseRouteError, r as routeNetUsd, v as validateAddressForChain, l as validateBtcAddress, m as validateCosmosAddress, n as validateEvmAddress, o as validateRouteAddresses, q as validateSeiAddress, s as validateSolanaAddress } from './core-B31ElTB8.js';
|
|
3
3
|
import { R as RateLimitInfo, T as TrustwareConfigOptions, i as WalletInterFaceAPI, j as TrustwareError, k as Transaction, l as TrustwareEvent } from './manager-BmzflCbY.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-BmzflCbY.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.16-staging.
|
|
553
|
+
SDK_VERSION = "1.1.16-staging.3";
|
|
554
554
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
555
555
|
GTM_ID = "GTM-TZDGNCXB";
|
|
556
556
|
API_PREFIX = "/api";
|
|
@@ -4496,10 +4496,12 @@ function routeErrorFromResponse(status, body, fallbackMessage) {
|
|
|
4496
4496
|
}
|
|
4497
4497
|
function parseRouteError(raw) {
|
|
4498
4498
|
if (isRouteError(raw) && raw.providers.length > 0) {
|
|
4499
|
+
const rejected = raw.providers.some((p) => p.outcome === "rejected");
|
|
4499
4500
|
return {
|
|
4500
4501
|
codes: providerCodes(raw.providers),
|
|
4501
4502
|
providers: raw.providers,
|
|
4502
|
-
allDeclined: raw.providers.every((p) => p.outcome !== "failed"),
|
|
4503
|
+
allDeclined: !rejected && raw.providers.every((p) => p.outcome !== "failed"),
|
|
4504
|
+
rejected,
|
|
4503
4505
|
minimum: firstMinimum(raw.providers.map((p) => p.message))
|
|
4504
4506
|
};
|
|
4505
4507
|
}
|
|
@@ -4514,6 +4516,7 @@ function parseRouteError(raw) {
|
|
|
4514
4516
|
codes,
|
|
4515
4517
|
providers: [],
|
|
4516
4518
|
allDeclined: !codes.some((code) => failureCodes.includes(code)),
|
|
4519
|
+
rejected: false,
|
|
4517
4520
|
minimum: firstMinimum([text])
|
|
4518
4521
|
};
|
|
4519
4522
|
}
|
|
@@ -4563,7 +4566,7 @@ function formatMinimum(minimum) {
|
|
|
4563
4566
|
if (minimum.symbol.toUpperCase() === "USD") return `$${minimum.amount}`;
|
|
4564
4567
|
return `${minimum.amount} ${minimum.symbol}`;
|
|
4565
4568
|
}
|
|
4566
|
-
var RouteDeclineCode, RouteFailureCode, RouteErrorCode, ALL_PROVIDER_CODES, RouteError, MAX_ROUTE_ERROR_TEXT, ROUTE_SUMMARIES;
|
|
4569
|
+
var RouteDeclineCode, RouteFailureCode, RouteRejectionCode, RouteErrorCode, ALL_PROVIDER_CODES, RouteError, MAX_ROUTE_ERROR_TEXT, ROUTE_SUMMARIES;
|
|
4567
4570
|
var init_routeError = __esm({
|
|
4568
4571
|
"src/core/routeError.ts"() {
|
|
4569
4572
|
"use strict";
|
|
@@ -4585,18 +4588,25 @@ var init_routeError = __esm({
|
|
|
4585
4588
|
Timeout: "timeout",
|
|
4586
4589
|
ProviderError: "provider_error"
|
|
4587
4590
|
};
|
|
4591
|
+
RouteRejectionCode = {
|
|
4592
|
+
InvalidAddress: "invalid_address"
|
|
4593
|
+
};
|
|
4588
4594
|
RouteErrorCode = {
|
|
4589
4595
|
/** Every provider declined: a negative result, returned as 404. */
|
|
4590
4596
|
NoRouteAvailable: "no_route_available",
|
|
4591
4597
|
/** At least one provider failed, so "unroutable" cannot be claimed: 502. */
|
|
4592
4598
|
ProvidersFailed: "providers_failed",
|
|
4599
|
+
/** The caller's address cannot be valid on its chain; no provider was
|
|
4600
|
+
* asked. Returned as 400. Fix the request rather than retry it. */
|
|
4601
|
+
InvalidAddress: "invalid_address",
|
|
4593
4602
|
/** A route came back but the SDK refused it: its fees exceed its output.
|
|
4594
4603
|
* Reached client-side, so `status` is 0. */
|
|
4595
4604
|
FeesExceedOutput: "fees_exceed_output"
|
|
4596
4605
|
};
|
|
4597
4606
|
ALL_PROVIDER_CODES = [
|
|
4598
4607
|
...Object.values(RouteDeclineCode),
|
|
4599
|
-
...Object.values(RouteFailureCode)
|
|
4608
|
+
...Object.values(RouteFailureCode),
|
|
4609
|
+
...Object.values(RouteRejectionCode)
|
|
4600
4610
|
];
|
|
4601
4611
|
RouteError = class extends Error {
|
|
4602
4612
|
constructor(params) {
|
|
@@ -4610,6 +4620,10 @@ var init_routeError = __esm({
|
|
|
4610
4620
|
get isNoRouteAvailable() {
|
|
4611
4621
|
return this.code === RouteErrorCode.NoRouteAvailable || this.status === 404;
|
|
4612
4622
|
}
|
|
4623
|
+
/** True when the caller's address was rejected — nothing to retry, fix the request. */
|
|
4624
|
+
get isInvalidAddress() {
|
|
4625
|
+
return this.code === RouteErrorCode.InvalidAddress;
|
|
4626
|
+
}
|
|
4613
4627
|
/** The distinct provider codes, e.g. ["amount_too_low", "no_routes"]. */
|
|
4614
4628
|
get providerCodes() {
|
|
4615
4629
|
return providerCodes(this.providers);
|
|
@@ -6136,37 +6150,42 @@ var init_popularChains = __esm({
|
|
|
6136
6150
|
name: "Ethereum",
|
|
6137
6151
|
chainId: 1
|
|
6138
6152
|
},
|
|
6139
|
-
{
|
|
6140
|
-
name: "BSC",
|
|
6141
|
-
chainId: 56
|
|
6142
|
-
},
|
|
6143
6153
|
{
|
|
6144
6154
|
name: "Solana"
|
|
6145
6155
|
},
|
|
6146
6156
|
{
|
|
6147
|
-
name: "
|
|
6157
|
+
name: "Base",
|
|
6158
|
+
chainId: 8453
|
|
6148
6159
|
},
|
|
6149
6160
|
{
|
|
6150
|
-
name: "
|
|
6161
|
+
name: "BSC",
|
|
6162
|
+
chainId: 56
|
|
6151
6163
|
},
|
|
6152
6164
|
{
|
|
6153
|
-
name: "
|
|
6154
|
-
chainId: 8453
|
|
6165
|
+
name: "Tron"
|
|
6155
6166
|
},
|
|
6156
6167
|
{
|
|
6157
|
-
name: "
|
|
6168
|
+
name: "Bitcoin"
|
|
6158
6169
|
},
|
|
6159
6170
|
{
|
|
6160
|
-
name: "
|
|
6171
|
+
name: "Hyperliquid L1"
|
|
6161
6172
|
},
|
|
6162
6173
|
{
|
|
6163
6174
|
name: "Arbitrum",
|
|
6164
6175
|
chainId: 42161
|
|
6165
6176
|
},
|
|
6177
|
+
{
|
|
6178
|
+
name: "Monad",
|
|
6179
|
+
chainId: 143
|
|
6180
|
+
},
|
|
6166
6181
|
{
|
|
6167
6182
|
name: "Polygon",
|
|
6168
6183
|
chainId: 137
|
|
6169
6184
|
},
|
|
6185
|
+
{
|
|
6186
|
+
name: "Robinhood Chain",
|
|
6187
|
+
chainId: 4663
|
|
6188
|
+
},
|
|
6170
6189
|
{
|
|
6171
6190
|
name: "Plasma",
|
|
6172
6191
|
chainId: 9745
|
|
@@ -6178,10 +6197,6 @@ var init_popularChains = __esm({
|
|
|
6178
6197
|
{
|
|
6179
6198
|
name: "Sui"
|
|
6180
6199
|
},
|
|
6181
|
-
{
|
|
6182
|
-
name: "Monad",
|
|
6183
|
-
chainId: 143
|
|
6184
|
-
},
|
|
6185
6200
|
{
|
|
6186
6201
|
name: "OP Mainnet",
|
|
6187
6202
|
chainId: 10
|
|
@@ -6194,18 +6209,13 @@ var init_popularChains = __esm({
|
|
|
6194
6209
|
name: "Stellar"
|
|
6195
6210
|
},
|
|
6196
6211
|
{
|
|
6197
|
-
name: "
|
|
6212
|
+
name: "Anubis"
|
|
6198
6213
|
},
|
|
6199
6214
|
{
|
|
6200
|
-
name: "
|
|
6201
|
-
},
|
|
6202
|
-
{
|
|
6203
|
-
name: "Mantle",
|
|
6204
|
-
chainId: 5e3
|
|
6215
|
+
name: "Provenance"
|
|
6205
6216
|
},
|
|
6206
6217
|
{
|
|
6207
|
-
name: "
|
|
6208
|
-
chainId: 3073
|
|
6218
|
+
name: "Starknet"
|
|
6209
6219
|
},
|
|
6210
6220
|
{
|
|
6211
6221
|
name: "Ink",
|
|
@@ -6215,31 +6225,35 @@ var init_popularChains = __esm({
|
|
|
6215
6225
|
name: "Flare"
|
|
6216
6226
|
},
|
|
6217
6227
|
{
|
|
6218
|
-
name: "
|
|
6228
|
+
name: "X Layer"
|
|
6219
6229
|
},
|
|
6220
6230
|
{
|
|
6221
|
-
name: "
|
|
6222
|
-
chainId: 4326
|
|
6231
|
+
name: "Near"
|
|
6223
6232
|
},
|
|
6224
6233
|
{
|
|
6225
|
-
name: "
|
|
6226
|
-
chainId:
|
|
6234
|
+
name: "Gnosis",
|
|
6235
|
+
chainId: 100
|
|
6227
6236
|
},
|
|
6228
6237
|
{
|
|
6229
|
-
name: "
|
|
6238
|
+
name: "Mantle",
|
|
6239
|
+
chainId: 5e3
|
|
6230
6240
|
},
|
|
6231
6241
|
{
|
|
6232
|
-
name: "
|
|
6242
|
+
name: "Stacks"
|
|
6233
6243
|
},
|
|
6234
6244
|
{
|
|
6235
|
-
name: "
|
|
6245
|
+
name: "Morph"
|
|
6236
6246
|
},
|
|
6237
6247
|
{
|
|
6238
|
-
name: "
|
|
6248
|
+
name: "Rootstock",
|
|
6249
|
+
chainId: 30
|
|
6250
|
+
},
|
|
6251
|
+
{
|
|
6252
|
+
name: "Mixin"
|
|
6239
6253
|
}
|
|
6240
6254
|
],
|
|
6241
6255
|
popularLimit: 8,
|
|
6242
|
-
updatedAt: "2026-
|
|
6256
|
+
updatedAt: "2026-09-02",
|
|
6243
6257
|
source: "https://api.llama.fi/v2/chains \u2014 sorted by TVL"
|
|
6244
6258
|
};
|
|
6245
6259
|
}
|
|
@@ -8966,6 +8980,9 @@ function bodyMessage(body) {
|
|
|
8966
8980
|
}
|
|
8967
8981
|
function mapRouteFacts(facts) {
|
|
8968
8982
|
if (facts.codes.length === 0) return null;
|
|
8983
|
+
if (facts.rejected) {
|
|
8984
|
+
return INVALID_ADDRESS;
|
|
8985
|
+
}
|
|
8969
8986
|
if (!facts.allDeclined) {
|
|
8970
8987
|
return {
|
|
8971
8988
|
category: "route_error",
|
|
@@ -9098,6 +9115,9 @@ function classifyError(raw, msg) {
|
|
|
9098
9115
|
if (lower.includes("destination contract call")) {
|
|
9099
9116
|
return DESTINATION_CALL_FAILED;
|
|
9100
9117
|
}
|
|
9118
|
+
if (lower.includes("invalid address") || lower.includes("address is not valid")) {
|
|
9119
|
+
return INVALID_ADDRESS;
|
|
9120
|
+
}
|
|
9101
9121
|
if (lower.includes("did not respond") || lower.includes("routing provider")) {
|
|
9102
9122
|
return {
|
|
9103
9123
|
category: "route_error",
|
|
@@ -9176,12 +9196,17 @@ function classifyError(raw, msg) {
|
|
|
9176
9196
|
message: "An unexpected error occurred. Please try again."
|
|
9177
9197
|
};
|
|
9178
9198
|
}
|
|
9179
|
-
var SELF_MAPPED, DESTINATION_CALL_FAILED;
|
|
9199
|
+
var SELF_MAPPED, INVALID_ADDRESS, DESTINATION_CALL_FAILED;
|
|
9180
9200
|
var init_mapError = __esm({
|
|
9181
9201
|
"src/widget/lib/mapError.ts"() {
|
|
9182
9202
|
"use strict";
|
|
9183
9203
|
init_core2();
|
|
9184
9204
|
SELF_MAPPED = /* @__PURE__ */ new Map();
|
|
9205
|
+
INVALID_ADDRESS = {
|
|
9206
|
+
category: "invalid_address",
|
|
9207
|
+
title: "Invalid Address",
|
|
9208
|
+
message: "The recipient address is not valid for the selected network. Check the address and try again."
|
|
9209
|
+
};
|
|
9185
9210
|
DESTINATION_CALL_FAILED = {
|
|
9186
9211
|
category: "route_error",
|
|
9187
9212
|
title: "Destination Call Failed",
|
|
@@ -40694,6 +40719,7 @@ export {
|
|
|
40694
40719
|
RouteError,
|
|
40695
40720
|
RouteErrorCode,
|
|
40696
40721
|
RouteFailureCode,
|
|
40722
|
+
RouteRejectionCode,
|
|
40697
40723
|
SDK_NAME,
|
|
40698
40724
|
SDK_VERSION,
|
|
40699
40725
|
Trustware,
|