@trustware/sdk-staging 1.1.16-staging.2 → 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 +20 -4
- 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 +19 -4
- package/dist/core.mjs.map +1 -1
- package/dist/index.cjs +32 -5
- 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 +31 -5
- 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 +30 -5
- package/dist/widget.cjs.map +1 -1
- package/dist/widget.mjs +30 -5
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { R as RouteDeclineCode, a as RouteError, b as RouteErrorCode, c as RouteErrorFacts, d as RouteFailureCode, e as RouteProviderOutcome, T as Trustware,
|
|
1
|
+
export { R as RouteDeclineCode, a as RouteError, b as RouteErrorCode, c as RouteErrorFacts, d as RouteFailureCode, e as RouteProviderOutcome, f as RouteRejectionCode, T as Trustware, g as TrustwareCore, h as assertRouteDeliversValue, i as formatMinimum, j as isRouteError, k as isValueDestroying, p as parseRouteError, r as routeNetUsd } from './core-Bp73X3Mp.cjs';
|
|
2
2
|
export { B as BuildRouteBody, m as BuildRouteResponse, a5 as assertValidPostHook } from './manager-BN0KXjcN.cjs';
|
|
3
3
|
import './blockchain-DmCPxnxr.cjs';
|
|
4
4
|
import './types-DEUb5IZA.cjs';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { R as RouteDeclineCode, a as RouteError, b as RouteErrorCode, c as RouteErrorFacts, d as RouteFailureCode, e as RouteProviderOutcome, T as Trustware,
|
|
1
|
+
export { R as RouteDeclineCode, a as RouteError, b as RouteErrorCode, c as RouteErrorFacts, d as RouteFailureCode, e as RouteProviderOutcome, f as RouteRejectionCode, T as Trustware, g as TrustwareCore, h as assertRouteDeliversValue, i as formatMinimum, j as isRouteError, k as isValueDestroying, p as parseRouteError, r as routeNetUsd } from './core-B31ElTB8.js';
|
|
2
2
|
export { B as BuildRouteBody, m as BuildRouteResponse, a5 as assertValidPostHook } from './manager-BmzflCbY.js';
|
|
3
3
|
import './blockchain-DmCPxnxr.js';
|
|
4
4
|
import './types-CMmx0S4U.js';
|
package/dist/core.mjs
CHANGED
|
@@ -61,7 +61,7 @@ var init_constants = __esm({
|
|
|
61
61
|
"src/constants.ts"() {
|
|
62
62
|
"use strict";
|
|
63
63
|
SDK_NAME = "@trustware/sdk";
|
|
64
|
-
SDK_VERSION = "1.1.16-staging.
|
|
64
|
+
SDK_VERSION = "1.1.16-staging.3";
|
|
65
65
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
66
66
|
API_PREFIX = "/api";
|
|
67
67
|
WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
|
|
@@ -4083,10 +4083,12 @@ function routeErrorFromResponse(status, body, fallbackMessage) {
|
|
|
4083
4083
|
}
|
|
4084
4084
|
function parseRouteError(raw) {
|
|
4085
4085
|
if (isRouteError(raw) && raw.providers.length > 0) {
|
|
4086
|
+
const rejected = raw.providers.some((p) => p.outcome === "rejected");
|
|
4086
4087
|
return {
|
|
4087
4088
|
codes: providerCodes(raw.providers),
|
|
4088
4089
|
providers: raw.providers,
|
|
4089
|
-
allDeclined: raw.providers.every((p) => p.outcome !== "failed"),
|
|
4090
|
+
allDeclined: !rejected && raw.providers.every((p) => p.outcome !== "failed"),
|
|
4091
|
+
rejected,
|
|
4090
4092
|
minimum: firstMinimum(raw.providers.map((p) => p.message))
|
|
4091
4093
|
};
|
|
4092
4094
|
}
|
|
@@ -4101,6 +4103,7 @@ function parseRouteError(raw) {
|
|
|
4101
4103
|
codes,
|
|
4102
4104
|
providers: [],
|
|
4103
4105
|
allDeclined: !codes.some((code) => failureCodes.includes(code)),
|
|
4106
|
+
rejected: false,
|
|
4104
4107
|
minimum: firstMinimum([text])
|
|
4105
4108
|
};
|
|
4106
4109
|
}
|
|
@@ -4150,7 +4153,7 @@ function formatMinimum(minimum) {
|
|
|
4150
4153
|
if (minimum.symbol.toUpperCase() === "USD") return `$${minimum.amount}`;
|
|
4151
4154
|
return `${minimum.amount} ${minimum.symbol}`;
|
|
4152
4155
|
}
|
|
4153
|
-
var RouteDeclineCode, RouteFailureCode, RouteErrorCode, ALL_PROVIDER_CODES, RouteError, MAX_ROUTE_ERROR_TEXT, ROUTE_SUMMARIES;
|
|
4156
|
+
var RouteDeclineCode, RouteFailureCode, RouteRejectionCode, RouteErrorCode, ALL_PROVIDER_CODES, RouteError, MAX_ROUTE_ERROR_TEXT, ROUTE_SUMMARIES;
|
|
4154
4157
|
var init_routeError = __esm({
|
|
4155
4158
|
"src/core/routeError.ts"() {
|
|
4156
4159
|
"use strict";
|
|
@@ -4172,18 +4175,25 @@ var init_routeError = __esm({
|
|
|
4172
4175
|
Timeout: "timeout",
|
|
4173
4176
|
ProviderError: "provider_error"
|
|
4174
4177
|
};
|
|
4178
|
+
RouteRejectionCode = {
|
|
4179
|
+
InvalidAddress: "invalid_address"
|
|
4180
|
+
};
|
|
4175
4181
|
RouteErrorCode = {
|
|
4176
4182
|
/** Every provider declined: a negative result, returned as 404. */
|
|
4177
4183
|
NoRouteAvailable: "no_route_available",
|
|
4178
4184
|
/** At least one provider failed, so "unroutable" cannot be claimed: 502. */
|
|
4179
4185
|
ProvidersFailed: "providers_failed",
|
|
4186
|
+
/** The caller's address cannot be valid on its chain; no provider was
|
|
4187
|
+
* asked. Returned as 400. Fix the request rather than retry it. */
|
|
4188
|
+
InvalidAddress: "invalid_address",
|
|
4180
4189
|
/** A route came back but the SDK refused it: its fees exceed its output.
|
|
4181
4190
|
* Reached client-side, so `status` is 0. */
|
|
4182
4191
|
FeesExceedOutput: "fees_exceed_output"
|
|
4183
4192
|
};
|
|
4184
4193
|
ALL_PROVIDER_CODES = [
|
|
4185
4194
|
...Object.values(RouteDeclineCode),
|
|
4186
|
-
...Object.values(RouteFailureCode)
|
|
4195
|
+
...Object.values(RouteFailureCode),
|
|
4196
|
+
...Object.values(RouteRejectionCode)
|
|
4187
4197
|
];
|
|
4188
4198
|
RouteError = class extends Error {
|
|
4189
4199
|
constructor(params) {
|
|
@@ -4197,6 +4207,10 @@ var init_routeError = __esm({
|
|
|
4197
4207
|
get isNoRouteAvailable() {
|
|
4198
4208
|
return this.code === RouteErrorCode.NoRouteAvailable || this.status === 404;
|
|
4199
4209
|
}
|
|
4210
|
+
/** True when the caller's address was rejected — nothing to retry, fix the request. */
|
|
4211
|
+
get isInvalidAddress() {
|
|
4212
|
+
return this.code === RouteErrorCode.InvalidAddress;
|
|
4213
|
+
}
|
|
4200
4214
|
/** The distinct provider codes, e.g. ["amount_too_low", "no_routes"]. */
|
|
4201
4215
|
get providerCodes() {
|
|
4202
4216
|
return providerCodes(this.providers);
|
|
@@ -7323,6 +7337,7 @@ export {
|
|
|
7323
7337
|
RouteError,
|
|
7324
7338
|
RouteErrorCode,
|
|
7325
7339
|
RouteFailureCode,
|
|
7340
|
+
RouteRejectionCode,
|
|
7326
7341
|
Trustware,
|
|
7327
7342
|
assertRouteDeliversValue,
|
|
7328
7343
|
assertValidPostHook,
|