@gala-chain/gswap-sdk 1.2.0-rc.9 → 1.2.0
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 +25 -10
- package/dist/browser/classes/dex_fees.js.map +1 -1
- package/dist/browser/classes/gateway.js.map +1 -1
- package/dist/browser/classes/gdex_stream.js.map +1 -1
- package/dist/browser/classes/gswap.js.map +1 -1
- package/dist/browser/classes/gswap_sdk_error.js.map +1 -1
- package/dist/browser/classes/shadow_submit.js +1 -1
- package/dist/browser/classes/shadow_submit.js.map +1 -1
- package/dist/browser/classes/signers.js.map +1 -1
- package/dist/browser/classes/submitted_transaction.js.map +1 -1
- package/dist/browser/utils/chain_dto_signing.js.map +1 -1
- package/dist/browser/utils/classification.js.map +1 -1
- package/dist/browser/utils/dto_builders.js.map +1 -1
- package/dist/browser/utils/eip712.js.map +1 -1
- package/dist/browser/utils/transport.js +1 -1
- package/dist/browser/utils/transport.js.map +1 -1
- package/dist/browser/utils/validation.js.map +1 -1
- package/dist/browser/version.js +1 -1
- package/dist/browser/version.js.map +1 -1
- package/dist/index.cjs +102 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +132 -19
- package/dist/index.d.ts +132 -19
- package/dist/index.mjs +102 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1315,6 +1315,7 @@ var GSwapSDKError = class GSwapSDKError extends Error {
|
|
|
1315
1315
|
code;
|
|
1316
1316
|
/** The named placeholders of the error: a flat object of primitives, safe to localize with. */
|
|
1317
1317
|
params;
|
|
1318
|
+
/** The server's `Retry-After` in milliseconds (a `RATE_LIMITED` answer), when it sent one. */
|
|
1318
1319
|
retryAfterMs;
|
|
1319
1320
|
/** The HTTP status of the response that caused this error, when there was one. */
|
|
1320
1321
|
status;
|
|
@@ -1640,7 +1641,7 @@ function parseJson(text) {
|
|
|
1640
1641
|
//#endregion
|
|
1641
1642
|
//#region src/version.ts
|
|
1642
1643
|
/** Package version embedded by the bundler, with a source-test fallback. */
|
|
1643
|
-
const SDK_VERSION = "1.2.0
|
|
1644
|
+
const SDK_VERSION = "1.2.0";
|
|
1644
1645
|
|
|
1645
1646
|
//#endregion
|
|
1646
1647
|
//#region src/utils/transport.ts
|
|
@@ -1701,7 +1702,7 @@ function buildRequestHeaders(wire, parts = {}) {
|
|
|
1701
1702
|
entries.set(name.toLowerCase(), [name, value]);
|
|
1702
1703
|
}
|
|
1703
1704
|
};
|
|
1704
|
-
if ((wire === null || wire === void 0 ? void 0 : wire.userAgent) !== false) put({ "User-Agent": (wire === null || wire === void 0 ? void 0 : wire.userAgent) ?? `GalaChain-SDK/${"1.2.0
|
|
1705
|
+
if ((wire === null || wire === void 0 ? void 0 : wire.userAgent) !== false) put({ "User-Agent": (wire === null || wire === void 0 ? void 0 : wire.userAgent) ?? `GalaChain-SDK/${"1.2.0"}` });
|
|
1705
1706
|
put(parts.defaults);
|
|
1706
1707
|
put(wire === null || wire === void 0 ? void 0 : wire.headers);
|
|
1707
1708
|
if (parts.json === true && !entries.has("content-type")) put({ "Content-Type": "application/json" });
|
|
@@ -2132,6 +2133,15 @@ function tickFromPrice(price, options = {}) {
|
|
|
2132
2133
|
|
|
2133
2134
|
//#endregion
|
|
2134
2135
|
//#region src/utils/validation.ts
|
|
2136
|
+
/**
|
|
2137
|
+
* Validates a decimal amount: a string or `BigNumber`, never a JavaScript number.
|
|
2138
|
+
*
|
|
2139
|
+
* @param amount - The amount to check.
|
|
2140
|
+
* @param parameterName - The field name reported in the error's `params.field`.
|
|
2141
|
+
* @param allowZero - Accept zero (default `false`).
|
|
2142
|
+
* @throws GSwapSDKError `AMOUNT_IS_JS_NUMBER`, `AMOUNT_NOT_FINITE`, `AMOUNT_NOT_POSITIVE` (zero
|
|
2143
|
+
* when `allowZero` is false) or `AMOUNT_NEGATIVE`.
|
|
2144
|
+
*/
|
|
2135
2145
|
function validateNumericAmount(amount, parameterName, allowZero = false) {
|
|
2136
2146
|
if (typeof amount === "number") throw new GSwapSDKError("AMOUNT_IS_JS_NUMBER", { field: parameterName });
|
|
2137
2147
|
let bnAmount;
|
|
@@ -2153,6 +2163,12 @@ function validateNumericAmount(amount, parameterName, allowZero = false) {
|
|
|
2153
2163
|
value: String(amount)
|
|
2154
2164
|
});
|
|
2155
2165
|
}
|
|
2166
|
+
/**
|
|
2167
|
+
* Validates a spot price and a lower/upper price range: none a JavaScript number, all positive and
|
|
2168
|
+
* finite (a non-finite upper bound counts as an unbounded `1e18`), and `lowerPrice <= upperPrice`.
|
|
2169
|
+
*
|
|
2170
|
+
* @throws GSwapSDKError `PRICE_VALUES_IS_JS_NUMBER`, `INVALID_PRICE_VALUES` or `INVALID_PRICE_RANGE`.
|
|
2171
|
+
*/
|
|
2156
2172
|
function validatePriceValues(spotPrice, lowerPrice, upperPrice) {
|
|
2157
2173
|
if ([
|
|
2158
2174
|
spotPrice,
|
|
@@ -2180,12 +2196,24 @@ function validatePriceValues(spotPrice, lowerPrice, upperPrice) {
|
|
|
2180
2196
|
upperPrice: String(upperPrice)
|
|
2181
2197
|
});
|
|
2182
2198
|
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Validates a token's decimals: a non-negative integer.
|
|
2201
|
+
*
|
|
2202
|
+
* @throws GSwapSDKError `INVALID_TOKEN_DECIMALS` (`params.field` is `parameterName`).
|
|
2203
|
+
*/
|
|
2183
2204
|
function validateTokenDecimals(decimals, parameterName) {
|
|
2184
2205
|
if (decimals < 0 || !Number.isInteger(decimals)) throw new GSwapSDKError("INVALID_TOKEN_DECIMALS", {
|
|
2185
2206
|
field: parameterName,
|
|
2186
2207
|
value: decimals
|
|
2187
2208
|
});
|
|
2188
2209
|
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Validates a position's tick range: two integers with `tickLower < tickUpper`, both within
|
|
2212
|
+
* `GC_MIN_TICK`..`GC_MAX_TICK`. It does not check alignment to a fee tier's spacing (see
|
|
2213
|
+
* `assertTickRange`).
|
|
2214
|
+
*
|
|
2215
|
+
* @throws GSwapSDKError `TICKS_NOT_INTEGERS`, `INVALID_TICK_RANGE` or `TICKS_OUT_OF_BOUNDS`.
|
|
2216
|
+
*/
|
|
2189
2217
|
function validateTickRange(tickLower, tickUpper) {
|
|
2190
2218
|
if (!Number.isInteger(tickLower) || !Number.isInteger(tickUpper)) throw new GSwapSDKError("TICKS_NOT_INTEGERS", {
|
|
2191
2219
|
tickLower,
|
|
@@ -2202,6 +2230,11 @@ function validateTickRange(tickLower, tickUpper) {
|
|
|
2202
2230
|
maxTick: GC_MAX_TICK
|
|
2203
2231
|
});
|
|
2204
2232
|
}
|
|
2233
|
+
/**
|
|
2234
|
+
* Asserts that `fee` is one of the fee tiers in `ALL_FEE_TIERS` (`0`, `500`, `3000`, `10000`).
|
|
2235
|
+
*
|
|
2236
|
+
* @throws GSwapSDKError `INVALID_FEE` (`params.field` `'fee'`, `params.allowed` the tiers).
|
|
2237
|
+
*/
|
|
2205
2238
|
function validateFee(fee) {
|
|
2206
2239
|
if (!ALL_FEE_TIERS.some((tier) => Number(tier) === fee)) throw new GSwapSDKError("INVALID_FEE", {
|
|
2207
2240
|
field: "fee",
|
|
@@ -2209,9 +2242,20 @@ function validateFee(fee) {
|
|
|
2209
2242
|
allowed: ALLOWED_FEE_TIERS_TEXT
|
|
2210
2243
|
});
|
|
2211
2244
|
}
|
|
2245
|
+
/**
|
|
2246
|
+
* Validates a tick spacing: a positive integer.
|
|
2247
|
+
*
|
|
2248
|
+
* @throws GSwapSDKError `INVALID_TICK_SPACING`.
|
|
2249
|
+
*/
|
|
2212
2250
|
function validateTickSpacing(tickSpacing) {
|
|
2213
2251
|
if (!Number.isInteger(tickSpacing) || tickSpacing <= 0) throw new GSwapSDKError("INVALID_TICK_SPACING", { value: tickSpacing });
|
|
2214
2252
|
}
|
|
2253
|
+
/**
|
|
2254
|
+
* Asserts that a wallet address was given and is a non-blank string. It does not check the address
|
|
2255
|
+
* format.
|
|
2256
|
+
*
|
|
2257
|
+
* @throws GSwapSDKError `MISSING_WALLET_ADDRESS` (undefined) or `INVALID_WALLET_ADDRESS` (blank).
|
|
2258
|
+
*/
|
|
2215
2259
|
function validateWalletAddress(address) {
|
|
2216
2260
|
if (address === void 0) throw new GSwapSDKError("MISSING_WALLET_ADDRESS", {});
|
|
2217
2261
|
if (!address || typeof address !== "string" || address.trim().length === 0) throw new GSwapSDKError("INVALID_WALLET_ADDRESS", {
|
|
@@ -2694,9 +2738,13 @@ async function shadowFailures(run) {
|
|
|
2694
2738
|
//#region src/classes/submitted_transaction.ts
|
|
2695
2739
|
/** A submitted v2 transaction whose confirmation mode is explicit in the gateway response. */
|
|
2696
2740
|
var SubmittedTransaction = class {
|
|
2741
|
+
/** The chain method that was submitted (`RequestTrade`, `AddLiquidity`, ...). */
|
|
2697
2742
|
method;
|
|
2743
|
+
/** The write's durable correlation key: persist it, and confirm from it alone later. */
|
|
2698
2744
|
uniqueKey;
|
|
2745
|
+
/** The request transaction id the gateway reported, or `null` when it gave none. */
|
|
2699
2746
|
transactionId;
|
|
2747
|
+
/** The block of the transaction, when the answer carried one; otherwise `null`. */
|
|
2700
2748
|
blockNumber;
|
|
2701
2749
|
/** The gateway's `data.mode`: `'sync'` (executed, `result` is the chain result) or `'queued'`. */
|
|
2702
2750
|
mode;
|
|
@@ -2818,7 +2866,9 @@ var ChainGateway = class {
|
|
|
2818
2866
|
chainCallTimeoutMs;
|
|
2819
2867
|
isTransportFailure;
|
|
2820
2868
|
answerOfRejectionHook;
|
|
2869
|
+
/** The request timeout in milliseconds (`Infinity` when no timer is armed). */
|
|
2821
2870
|
requestTimeoutMs;
|
|
2871
|
+
/** The swap backend base URL every request is sent to, without a trailing slash. */
|
|
2822
2872
|
dexBackendBaseUrl;
|
|
2823
2873
|
/** Wire format shared by the read services built on this gateway. */
|
|
2824
2874
|
wire;
|
|
@@ -2892,7 +2942,7 @@ var ChainGateway = class {
|
|
|
2892
2942
|
*
|
|
2893
2943
|
* Unlike `submit`, EVERY HTTP status resolves: the result is the raw `{ httpStatus, body }`,
|
|
2894
2944
|
* because shadow failures are classified from the status together with the body's `code`
|
|
2895
|
-
* (`SHADOW_UNAVAILABLE`, `
|
|
2945
|
+
* (`SHADOW_UNAVAILABLE`, `SHADOW_UNSUPPORTED_TYPE`, `SHADOW_RELAY_REJECTED`);
|
|
2896
2946
|
* see `readShadowSubmitOutcome`. Only a failure to get an answer rejects, and it rejects with
|
|
2897
2947
|
* `SUBMISSION_OUTCOME_UNKNOWN` (`params.reason` `'timeout'` or `'transport'`): the request may
|
|
2898
2948
|
* have been accepted. Every error it throws has `error.shadow === true`, and a non-SDK object
|
|
@@ -3140,7 +3190,9 @@ function isGdexLiquidityEvent(value) {
|
|
|
3140
3190
|
}
|
|
3141
3191
|
/** A JSON-RPC error answered by the stream. */
|
|
3142
3192
|
var GdexStreamError = class extends Error {
|
|
3193
|
+
/** The JSON-RPC error code. */
|
|
3143
3194
|
code;
|
|
3195
|
+
/** The error's optional `data` member, as the server sent it. */
|
|
3144
3196
|
data;
|
|
3145
3197
|
constructor(code, message, data) {
|
|
3146
3198
|
super(message);
|
|
@@ -3218,6 +3270,7 @@ var GdexStreamService = class {
|
|
|
3218
3270
|
this.connectPromise = void 0;
|
|
3219
3271
|
socket === null || socket === void 0 || socket.close(1e3, "client disconnect");
|
|
3220
3272
|
}
|
|
3273
|
+
/** `true` while the socket is open (false while connecting, reconnecting or after `disconnect()`). */
|
|
3221
3274
|
isConnected() {
|
|
3222
3275
|
var _this$socket;
|
|
3223
3276
|
return ((_this$socket = this.socket) === null || _this$socket === void 0 ? void 0 : _this$socket.readyState) === WEBSOCKET_OPEN;
|
|
@@ -3259,30 +3312,41 @@ var GdexStreamService = class {
|
|
|
3259
3312
|
}
|
|
3260
3313
|
});
|
|
3261
3314
|
}
|
|
3315
|
+
/** `gdex_serverInfo`: the server's own description of itself, as it sends it. */
|
|
3262
3316
|
serverInfo() {
|
|
3263
3317
|
return this.request("gdex_serverInfo");
|
|
3264
3318
|
}
|
|
3319
|
+
/** `gdex_ping`: a round trip that answers `{ pong, serverTime }`. */
|
|
3265
3320
|
ping() {
|
|
3266
3321
|
return this.request("gdex_ping");
|
|
3267
3322
|
}
|
|
3323
|
+
/** `gdex_getPool`: the current state of one pool, selected by its key or hash. */
|
|
3268
3324
|
getPool(selector) {
|
|
3269
3325
|
return this.request("gdex_getPool", selector);
|
|
3270
3326
|
}
|
|
3327
|
+
/** `gdex_getBalance`: an owner's balances, or only the one of `tokenClassKey` when given. */
|
|
3271
3328
|
getBalance(owner, tokenClassKey) {
|
|
3272
3329
|
return this.request("gdex_getBalance", tokenClassKey === void 0 ? { owner } : {
|
|
3273
3330
|
owner,
|
|
3274
3331
|
tokenClassKey
|
|
3275
3332
|
});
|
|
3276
3333
|
}
|
|
3334
|
+
/**
|
|
3335
|
+
* `gdex_getPositions`: an owner's positions, optionally in one pool, a page at a time. Pass the
|
|
3336
|
+
* returned `bookmark` back in as `bookmark` for the next page.
|
|
3337
|
+
*/
|
|
3277
3338
|
getPositions(opts) {
|
|
3278
3339
|
return this.request("gdex_getPositions", opts);
|
|
3279
3340
|
}
|
|
3341
|
+
/** `gdex_getBlockHeight`: the block number the server reports, with its timestamp. */
|
|
3280
3342
|
getBlockHeight() {
|
|
3281
3343
|
return this.request("gdex_getBlockHeight");
|
|
3282
3344
|
}
|
|
3345
|
+
/** `gdex_quote`: a quote over the stream; give exactly one of `amountIn` or `amountOut`. */
|
|
3283
3346
|
quote(params) {
|
|
3284
3347
|
return this.request("gdex_quote", params);
|
|
3285
3348
|
}
|
|
3349
|
+
/** `gdex_getToken`: the server's record of one token class, as it sends it. */
|
|
3286
3350
|
getToken(tokenClassKey) {
|
|
3287
3351
|
return this.request("gdex_getToken", { tokenClassKey });
|
|
3288
3352
|
}
|
|
@@ -4348,8 +4412,9 @@ const decimalString = (amount) => new BigNumber(amount).toFixed();
|
|
|
4348
4412
|
/**
|
|
4349
4413
|
* Builds the RequestTrade DTO: `exactIn` sells that much of the input token (`sell0Qty` or
|
|
4350
4414
|
* `sell1Qty`), `exactOut` buys that much of the output token (`buy1Qty` or `buy0Qty`), plus the
|
|
4351
|
-
* side's slippage bound and an optional `priceLimit`. Key order
|
|
4352
|
-
*
|
|
4415
|
+
* side's slippage bound and an optional `priceLimit`. Key order is
|
|
4416
|
+
* `token0, token1, fee, uniqueKey`, then the one quantity, then the slippage bound, then
|
|
4417
|
+
* `priceLimit`.
|
|
4353
4418
|
*
|
|
4354
4419
|
* @example
|
|
4355
4420
|
* ```ts
|
|
@@ -5537,21 +5602,21 @@ function toDecimalString(amount) {
|
|
|
5537
5602
|
*
|
|
5538
5603
|
* - `SHADOW_UNAVAILABLE` (503): marking failed or infra not configured; retryable. Never fall back
|
|
5539
5604
|
* silently to a public swap.
|
|
5540
|
-
* - `SHADOW_DISABLED` (400): the feature is off for this environment.
|
|
5541
5605
|
* - `SHADOW_UNSUPPORTED_TYPE` (400): shadow requested on a non-swap method.
|
|
5542
5606
|
* - `SHADOW_RELAY_REJECTED`: terminal business rejection (slippage, balance, ...), not retryable;
|
|
5543
5607
|
* `message` is the gateway's verbatim string.
|
|
5544
5608
|
*/
|
|
5545
5609
|
const SHADOW_SUBMIT_CODES = [
|
|
5546
5610
|
"SHADOW_UNAVAILABLE",
|
|
5547
|
-
"SHADOW_DISABLED",
|
|
5548
5611
|
"SHADOW_UNSUPPORTED_TYPE",
|
|
5549
5612
|
"SHADOW_RELAY_REJECTED"
|
|
5550
5613
|
];
|
|
5551
5614
|
/**
|
|
5552
5615
|
* Every `kind` of a failed {@link ShadowSubmitOutcome}, for an app that maps each to its own text
|
|
5553
|
-
* (`Record<ShadowFailureKind, string>`): `unavailable` (retryable), `disabled
|
|
5554
|
-
* the
|
|
5616
|
+
* (`Record<ShadowFailureKind, string>`): `unavailable` (retryable), `disabled` (the shadow route
|
|
5617
|
+
* answered 400: the request is not a dark-swappable one, e.g. `SHADOW_UNSUPPORTED_TYPE`; Shadow
|
|
5618
|
+
* Swaps themselves are enabled in every environment), `rejected` (carries the gateway's `message`)
|
|
5619
|
+
* and `unknown`.
|
|
5555
5620
|
*/
|
|
5556
5621
|
const SHADOW_FAILURE_KINDS = [
|
|
5557
5622
|
"unavailable",
|
|
@@ -5568,12 +5633,12 @@ function classifyShadowSubmitStatus(status) {
|
|
|
5568
5633
|
/**
|
|
5569
5634
|
* Prefers the body `code` (stable across status remaps) and falls back to the HTTP status.
|
|
5570
5635
|
* `SHADOW_UNAVAILABLE` is the only retryable case; `SHADOW_RELAY_REJECTED` is a terminal gateway
|
|
5571
|
-
* rejection;
|
|
5636
|
+
* rejection; `SHADOW_UNSUPPORTED_TYPE` and any other 400 map to "disabled".
|
|
5572
5637
|
*/
|
|
5573
5638
|
function classifyShadowSubmitError(status, code) {
|
|
5574
5639
|
if (code === "SHADOW_UNAVAILABLE") return "unavailable";
|
|
5575
5640
|
if (code === "SHADOW_RELAY_REJECTED") return "rejected";
|
|
5576
|
-
if (code === "
|
|
5641
|
+
if (code === "SHADOW_UNSUPPORTED_TYPE") return "disabled";
|
|
5577
5642
|
return classifyShadowSubmitStatus(status);
|
|
5578
5643
|
}
|
|
5579
5644
|
function readShadowSubmitOutcome(method, signedBody, result) {
|
|
@@ -5815,27 +5880,43 @@ var Swaps = class {
|
|
|
5815
5880
|
|
|
5816
5881
|
//#endregion
|
|
5817
5882
|
//#region src/classes/gswap.ts
|
|
5818
|
-
/**
|
|
5883
|
+
/**
|
|
5884
|
+
* Main entry point for the current GalaChainDex SDK: one client bundling the services that read
|
|
5885
|
+
* and write through the swap backend (`quoting`, `swaps`, `pools`, `positions`, `assets`,
|
|
5886
|
+
* `symbols`, `fees`, `stream`). See {@link GSwapOptions} for configuration.
|
|
5887
|
+
*/
|
|
5819
5888
|
var GSwap = class {
|
|
5889
|
+
/** The swap backend base URL every request goes to, without a trailing slash. */
|
|
5820
5890
|
dexBackendBaseUrl;
|
|
5891
|
+
/** The request timeout in milliseconds (default 30 000; `Infinity` arms no timer). */
|
|
5821
5892
|
chainCallTimeoutMs;
|
|
5893
|
+
/** The signer given at construction, if any. */
|
|
5822
5894
|
signer;
|
|
5895
|
+
/** The account given at construction, if any. */
|
|
5823
5896
|
walletAddress;
|
|
5897
|
+
/** The chain-gateway client every other service reads and writes through. */
|
|
5824
5898
|
gateway;
|
|
5899
|
+
/** The trading-symbol registry. */
|
|
5825
5900
|
symbols;
|
|
5901
|
+
/** Read-only exact-input and exact-output quotes. */
|
|
5826
5902
|
quoting;
|
|
5903
|
+
/** Pool, slot0 and composite-pool reads. */
|
|
5827
5904
|
pools;
|
|
5905
|
+
/** Position reads, liquidity estimates and liquidity / pool-creation writes. */
|
|
5828
5906
|
positions;
|
|
5907
|
+
/** Queued swaps (`RequestTrade`), dark swaps and swap confirmation. */
|
|
5829
5908
|
swaps;
|
|
5909
|
+
/** User token balances. */
|
|
5830
5910
|
assets;
|
|
5831
5911
|
/** Network-fee quotes (DryRun) signed with this client's signer. */
|
|
5832
5912
|
fees;
|
|
5913
|
+
/** The realtime stream endpoint {@link GSwap.stream} connects to. */
|
|
5833
5914
|
dexBackendWsUrl;
|
|
5834
5915
|
webSocketImpl;
|
|
5835
5916
|
streamApiKey;
|
|
5836
5917
|
streamClient;
|
|
5837
5918
|
/**
|
|
5838
|
-
* Create an SDK client for prod or stage.
|
|
5919
|
+
* Create an SDK client for prod (the default) or stage, or for a `dexBackendBaseUrl` of your own.
|
|
5839
5920
|
*
|
|
5840
5921
|
* @example
|
|
5841
5922
|
* ```typescript
|
|
@@ -5920,10 +6001,10 @@ const DEFAULT_RETRYABLE = {
|
|
|
5920
6001
|
* object, safe to mutate or freeze.
|
|
5921
6002
|
*
|
|
5922
6003
|
* `options.retryable: false` WITHHOLDS Retry from an outcome that would otherwise allow it: the
|
|
5923
|
-
* SDK's own `not_queued` for a refusal the gateway will repeat is
|
|
5924
|
-
* { retryable: false })` (also exported, frozen, as
|
|
5925
|
-
* Retry away from an outcome but never grant it to one
|
|
5926
|
-
* accepted.
|
|
6004
|
+
* SDK's own `not_queued` for a refusal the gateway will repeat is
|
|
6005
|
+
* `classification('not_queued', { retryable: false })` (also exported, frozen, as
|
|
6006
|
+
* {@link NOT_QUEUED_FINAL}). An app may take Retry away from an outcome but never grant it to one
|
|
6007
|
+
* that cannot have it, so only `false` is accepted.
|
|
5927
6008
|
*
|
|
5928
6009
|
* @example
|
|
5929
6010
|
* ```ts
|
|
@@ -7104,7 +7185,7 @@ function createLazyPrivateKeySigner(getPrivateKey, options = {}) {
|
|
|
7104
7185
|
*
|
|
7105
7186
|
* `scheme: 'personal-sign'` calls
|
|
7106
7187
|
* `gala_signChainDto([serialize({ ...dto, prefix }), walletAddress, methodName])` and REQUIRES
|
|
7107
|
-
* a wallet build that contains wallet_extension commit
|
|
7188
|
+
* a wallet build that contains wallet_extension commit 34ca4e4 (strips the embedded `prefix`
|
|
7108
7189
|
* field and hashes `prefix` + the prefix-less canonical body, the chain's scheme). Wallets
|
|
7109
7190
|
* released before that fix hash the string with the `prefix` field still inside it and the
|
|
7110
7191
|
* signature recovers to an address nobody holds, so only opt in once the fixed wallet is
|
|
@@ -7129,7 +7210,7 @@ var GalaWalletSigner = class {
|
|
|
7129
7210
|
* to the same check); a GalaChain id is `client|` plus 24 hex digits, or the bare 24 hex digits
|
|
7130
7211
|
* frontend_v2 keeps for a direct `client|` login, and is passed through unchanged.
|
|
7131
7212
|
* @param options - Select native signing (default) or personal-sign explicitly.
|
|
7132
|
-
* `'personal-sign'` requires a Gala Wallet build with wallet_extension commit
|
|
7213
|
+
* `'personal-sign'` requires a Gala Wallet build with wallet_extension commit 34ca4e4.
|
|
7133
7214
|
* `selectAddress` is the identity (`client|...` / `eth|...`) Gala Wallet is switched to with
|
|
7134
7215
|
* `window.gala.setAddress` before every signature, when the wallet offers it.
|
|
7135
7216
|
*/
|
|
@@ -7210,6 +7291,7 @@ var BrowserWalletSigner = class {
|
|
|
7210
7291
|
this.walletAddress = normalizeEthereumAccount(walletAddress, false);
|
|
7211
7292
|
this.scheme = options.scheme ?? "personal-sign";
|
|
7212
7293
|
}
|
|
7294
|
+
/** The selected `0x` Ethereum account every signature is requested for. */
|
|
7213
7295
|
walletAddress;
|
|
7214
7296
|
scheme;
|
|
7215
7297
|
/**
|
|
@@ -7308,7 +7390,7 @@ function webStorageAdapter(area) {
|
|
|
7308
7390
|
*
|
|
7309
7391
|
* These are thin, byte-exact ports of the functions the wallet shipped in
|
|
7310
7392
|
* `wallet_extension/src/helpers/wallet/signing.ts` (including the fail-closed personal-sign
|
|
7311
|
-
* payload resolver from its commit
|
|
7393
|
+
* payload resolver from its commit 34ca4e4), re-expressed over the SDK's own primitives. Every
|
|
7312
7394
|
* function takes the key as a string (`0x`-optional hex, or base64) or as bytes, normalizes it per
|
|
7313
7395
|
* call, and zeroes the normalized copy before returning, so nothing in this module retains a key.
|
|
7314
7396
|
* A JavaScript string cannot be wiped; the caller owns the lifetime of the string it passes in.
|