lighter-ts-sdk 1.0.10 → 1.0.11
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/browser/lighter-ts-sdk.browser.js +878 -414
- package/dist/browser/lighter-ts-sdk.browser.js.map +3 -3
- package/dist/cjs/api/account-api.d.ts +1 -0
- package/dist/cjs/api/account-api.d.ts.map +1 -1
- package/dist/cjs/api/account-api.js.map +1 -1
- package/dist/cjs/api/order-api.d.ts +5 -3
- package/dist/cjs/api/order-api.d.ts.map +1 -1
- package/dist/cjs/api/order-api.js +1 -1
- package/dist/cjs/api/order-api.js.map +1 -1
- package/dist/cjs/api/ws-client.d.ts +28 -0
- package/dist/cjs/api/ws-client.d.ts.map +1 -1
- package/dist/cjs/api/ws-client.js +22 -0
- package/dist/cjs/api/ws-client.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/signer/wasm-signer-client.d.ts +77 -3
- package/dist/cjs/signer/wasm-signer-client.d.ts.map +1 -1
- package/dist/cjs/signer/wasm-signer-client.js +206 -41
- package/dist/cjs/signer/wasm-signer-client.js.map +1 -1
- package/dist/cjs/signer/wasm-signer.d.ts +58 -0
- package/dist/cjs/signer/wasm-signer.d.ts.map +1 -1
- package/dist/cjs/signer/wasm-signer.js +115 -9
- package/dist/cjs/signer/wasm-signer.js.map +1 -1
- package/dist/cjs/types/trading.d.ts +12 -0
- package/dist/cjs/types/trading.d.ts.map +1 -1
- package/dist/esm/api/account-api.d.ts +1 -0
- package/dist/esm/api/account-api.d.ts.map +1 -1
- package/dist/esm/api/account-api.js.map +1 -1
- package/dist/esm/api/order-api.d.ts +5 -3
- package/dist/esm/api/order-api.d.ts.map +1 -1
- package/dist/esm/api/order-api.js +1 -1
- package/dist/esm/api/order-api.js.map +1 -1
- package/dist/esm/api/ws-client.d.ts +28 -0
- package/dist/esm/api/ws-client.d.ts.map +1 -1
- package/dist/esm/api/ws-client.js +22 -0
- package/dist/esm/api/ws-client.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/signer/wasm-signer-client.d.ts +77 -3
- package/dist/esm/signer/wasm-signer-client.d.ts.map +1 -1
- package/dist/esm/signer/wasm-signer-client.js +206 -41
- package/dist/esm/signer/wasm-signer-client.js.map +1 -1
- package/dist/esm/signer/wasm-signer.d.ts +58 -0
- package/dist/esm/signer/wasm-signer.d.ts.map +1 -1
- package/dist/esm/signer/wasm-signer.js +115 -9
- package/dist/esm/signer/wasm-signer.js.map +1 -1
- package/dist/esm/types/trading.d.ts +12 -0
- package/dist/esm/types/trading.d.ts.map +1 -1
- package/dist/umd/lighter-signer.wasm +0 -0
- package/dist/umd/lighter-ts-sdk.js +878 -414
- package/dist/umd/lighter-ts-sdk.js.map +3 -3
- package/dist/umd/lighter-ts-sdk.min.js +11 -8
- package/dist/umd/lighter-ts-sdk.min.js.map +3 -3
- package/dist/umd/package.json +1 -1
- package/dist/umd/wasm_exec.js +575 -575
- package/docs/OrderApi.md +5 -2
- package/docs/SignerClient.md +15 -2
- package/docs/WsClient.md +29 -0
- package/examples/create_grouped_ioc_with_attached_sl_tp.ts +20 -3
- package/package.json +1 -1
- package/wasm/lighter-signer.wasm +0 -0
- package/wasm/wasm_exec.js +575 -575
|
@@ -3321,18 +3321,18 @@ var init_sha256 = __esm({
|
|
|
3321
3321
|
this.H = IV[7] | 0;
|
|
3322
3322
|
}
|
|
3323
3323
|
get() {
|
|
3324
|
-
const { A, B, C, D, E, F, G, H } = this;
|
|
3325
|
-
return [A, B, C, D, E, F,
|
|
3324
|
+
const { A, B, C, D, E, F, G: G2, H } = this;
|
|
3325
|
+
return [A, B, C, D, E, F, G2, H];
|
|
3326
3326
|
}
|
|
3327
3327
|
// prettier-ignore
|
|
3328
|
-
set(A, B, C, D, E, F,
|
|
3328
|
+
set(A, B, C, D, E, F, G2, H) {
|
|
3329
3329
|
this.A = A | 0;
|
|
3330
3330
|
this.B = B | 0;
|
|
3331
3331
|
this.C = C | 0;
|
|
3332
3332
|
this.D = D | 0;
|
|
3333
3333
|
this.E = E | 0;
|
|
3334
3334
|
this.F = F | 0;
|
|
3335
|
-
this.G =
|
|
3335
|
+
this.G = G2 | 0;
|
|
3336
3336
|
this.H = H | 0;
|
|
3337
3337
|
}
|
|
3338
3338
|
process(view, offset) {
|
|
@@ -3345,14 +3345,14 @@ var init_sha256 = __esm({
|
|
|
3345
3345
|
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
|
3346
3346
|
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
3347
3347
|
}
|
|
3348
|
-
let { A, B, C, D, E, F, G, H } = this;
|
|
3348
|
+
let { A, B, C, D, E, F, G: G2, H } = this;
|
|
3349
3349
|
for (let i = 0; i < 64; i++) {
|
|
3350
3350
|
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
3351
|
-
const T13 = H + sigma1 + Chi(E, F,
|
|
3351
|
+
const T13 = H + sigma1 + Chi(E, F, G2) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
3352
3352
|
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
3353
3353
|
const T22 = sigma0 + Maj(A, B, C) | 0;
|
|
3354
|
-
H =
|
|
3355
|
-
|
|
3354
|
+
H = G2;
|
|
3355
|
+
G2 = F;
|
|
3356
3356
|
F = E;
|
|
3357
3357
|
E = D + T13 | 0;
|
|
3358
3358
|
D = C;
|
|
@@ -3366,9 +3366,9 @@ var init_sha256 = __esm({
|
|
|
3366
3366
|
D = D + this.D | 0;
|
|
3367
3367
|
E = E + this.E | 0;
|
|
3368
3368
|
F = F + this.F | 0;
|
|
3369
|
-
|
|
3369
|
+
G2 = G2 + this.G | 0;
|
|
3370
3370
|
H = H + this.H | 0;
|
|
3371
|
-
this.set(A, B, C, D, E, F,
|
|
3371
|
+
this.set(A, B, C, D, E, F, G2, H);
|
|
3372
3372
|
}
|
|
3373
3373
|
roundClean() {
|
|
3374
3374
|
SHA256_W.fill(0);
|
|
@@ -3661,7 +3661,7 @@ var init_sha512 = __esm({
|
|
|
3661
3661
|
});
|
|
3662
3662
|
|
|
3663
3663
|
// node_modules/ethers/lib.esm/crypto/crypto-browser.js
|
|
3664
|
-
function
|
|
3664
|
+
function getGlobal2() {
|
|
3665
3665
|
if (typeof self !== "undefined") {
|
|
3666
3666
|
return self;
|
|
3667
3667
|
}
|
|
@@ -3709,7 +3709,7 @@ var init_crypto_browser = __esm({
|
|
|
3709
3709
|
init_sha256();
|
|
3710
3710
|
init_sha512();
|
|
3711
3711
|
init_utils();
|
|
3712
|
-
anyGlobal =
|
|
3712
|
+
anyGlobal = getGlobal2();
|
|
3713
3713
|
crypto3 = anyGlobal.crypto || anyGlobal.msCrypto;
|
|
3714
3714
|
}
|
|
3715
3715
|
});
|
|
@@ -5410,8 +5410,8 @@ function weierstrassPoints(opts) {
|
|
|
5410
5410
|
* @returns non-zero affine point
|
|
5411
5411
|
*/
|
|
5412
5412
|
multiplyAndAddUnsafe(Q, a, b2) {
|
|
5413
|
-
const
|
|
5414
|
-
const mul = (P, a2) => a2 === _0n5 || a2 === _1n5 || !P.equals(
|
|
5413
|
+
const G2 = Point2.BASE;
|
|
5414
|
+
const mul = (P, a2) => a2 === _0n5 || a2 === _1n5 || !P.equals(G2) ? P.multiplyUnsafe(a2) : P.multiply(a2);
|
|
5415
5415
|
const sum = mul(this, a).add(mul(Q, b2));
|
|
5416
5416
|
return sum.is0() ? void 0 : sum;
|
|
5417
5417
|
}
|
|
@@ -9605,7 +9605,7 @@ function init() {
|
|
|
9605
9605
|
let recs = [];
|
|
9606
9606
|
for (let cp of V) {
|
|
9607
9607
|
let gs = GROUPS.filter((g) => group_has_cp(g, cp));
|
|
9608
|
-
let rec = recs.find(({ G }) => gs.some((g) =>
|
|
9608
|
+
let rec = recs.find(({ G: G2 }) => gs.some((g) => G2.has(g)));
|
|
9609
9609
|
if (!rec) {
|
|
9610
9610
|
rec = { G: /* @__PURE__ */ new Set(), V: [] };
|
|
9611
9611
|
recs.push(rec);
|
|
@@ -9614,8 +9614,8 @@ function init() {
|
|
|
9614
9614
|
set_add_many(rec.G, gs);
|
|
9615
9615
|
}
|
|
9616
9616
|
let union = recs.flatMap((x) => Array_from(x.G));
|
|
9617
|
-
for (let { G, V: V2 } of recs) {
|
|
9618
|
-
let complement = new Set(union.filter((g) => !
|
|
9617
|
+
for (let { G: G2, V: V2 } of recs) {
|
|
9618
|
+
let complement = new Set(union.filter((g) => !G2.has(g)));
|
|
9619
9619
|
for (let cp of V2) {
|
|
9620
9620
|
M.set(cp, complement);
|
|
9621
9621
|
}
|
|
@@ -20573,7 +20573,7 @@ var init_provider_etherscan = __esm({
|
|
|
20573
20573
|
});
|
|
20574
20574
|
|
|
20575
20575
|
// node_modules/ethers/lib.esm/providers/ws-browser.js
|
|
20576
|
-
function
|
|
20576
|
+
function getGlobal3() {
|
|
20577
20577
|
if (typeof self !== "undefined") {
|
|
20578
20578
|
return self;
|
|
20579
20579
|
}
|
|
@@ -20588,7 +20588,7 @@ function getGlobal2() {
|
|
|
20588
20588
|
var _WebSocket;
|
|
20589
20589
|
var init_ws_browser = __esm({
|
|
20590
20590
|
"node_modules/ethers/lib.esm/providers/ws-browser.js"() {
|
|
20591
|
-
_WebSocket =
|
|
20591
|
+
_WebSocket = getGlobal3().WebSocket;
|
|
20592
20592
|
}
|
|
20593
20593
|
});
|
|
20594
20594
|
|
|
@@ -25161,8 +25161,8 @@ var isPlainObject = (val) => {
|
|
|
25161
25161
|
if (kindOf(val) !== "object") {
|
|
25162
25162
|
return false;
|
|
25163
25163
|
}
|
|
25164
|
-
const
|
|
25165
|
-
return (
|
|
25164
|
+
const prototype2 = getPrototypeOf(val);
|
|
25165
|
+
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
|
|
25166
25166
|
};
|
|
25167
25167
|
var isEmptyObject = (val) => {
|
|
25168
25168
|
if (!isObject(val) || isBuffer(val)) {
|
|
@@ -25176,17 +25176,37 @@ var isEmptyObject = (val) => {
|
|
|
25176
25176
|
};
|
|
25177
25177
|
var isDate = kindOfTest("Date");
|
|
25178
25178
|
var isFile = kindOfTest("File");
|
|
25179
|
+
var isReactNativeBlob = (value) => {
|
|
25180
|
+
return !!(value && typeof value.uri !== "undefined");
|
|
25181
|
+
};
|
|
25182
|
+
var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
|
|
25179
25183
|
var isBlob = kindOfTest("Blob");
|
|
25180
25184
|
var isFileList = kindOfTest("FileList");
|
|
25181
25185
|
var isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
25186
|
+
function getGlobal() {
|
|
25187
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
25188
|
+
if (typeof self !== "undefined") return self;
|
|
25189
|
+
if (typeof window !== "undefined") return window;
|
|
25190
|
+
if (typeof global !== "undefined") return global;
|
|
25191
|
+
return {};
|
|
25192
|
+
}
|
|
25193
|
+
var G = getGlobal();
|
|
25194
|
+
var FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
|
|
25182
25195
|
var isFormData = (thing) => {
|
|
25183
25196
|
let kind;
|
|
25184
|
-
return thing && (
|
|
25197
|
+
return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
25185
25198
|
kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
|
|
25186
25199
|
};
|
|
25187
25200
|
var isURLSearchParams = kindOfTest("URLSearchParams");
|
|
25188
|
-
var [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
25189
|
-
|
|
25201
|
+
var [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
25202
|
+
"ReadableStream",
|
|
25203
|
+
"Request",
|
|
25204
|
+
"Response",
|
|
25205
|
+
"Headers"
|
|
25206
|
+
].map(kindOfTest);
|
|
25207
|
+
var trim = (str) => {
|
|
25208
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
25209
|
+
};
|
|
25190
25210
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
25191
25211
|
if (obj === null || typeof obj === "undefined") {
|
|
25192
25212
|
return;
|
|
@@ -25238,6 +25258,9 @@ function merge() {
|
|
|
25238
25258
|
const { caseless, skipUndefined } = isContextDefined(this) && this || {};
|
|
25239
25259
|
const result = {};
|
|
25240
25260
|
const assignValue = (val, key) => {
|
|
25261
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
25262
|
+
return;
|
|
25263
|
+
}
|
|
25241
25264
|
const targetKey = caseless && findKey(result, key) || key;
|
|
25242
25265
|
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
25243
25266
|
result[targetKey] = merge(result[targetKey], val);
|
|
@@ -25255,13 +25278,27 @@ function merge() {
|
|
|
25255
25278
|
return result;
|
|
25256
25279
|
}
|
|
25257
25280
|
var extend = (a, b2, thisArg, { allOwnKeys } = {}) => {
|
|
25258
|
-
forEach(
|
|
25259
|
-
|
|
25260
|
-
|
|
25261
|
-
|
|
25262
|
-
|
|
25263
|
-
|
|
25264
|
-
|
|
25281
|
+
forEach(
|
|
25282
|
+
b2,
|
|
25283
|
+
(val, key) => {
|
|
25284
|
+
if (thisArg && isFunction(val)) {
|
|
25285
|
+
Object.defineProperty(a, key, {
|
|
25286
|
+
value: bind(val, thisArg),
|
|
25287
|
+
writable: true,
|
|
25288
|
+
enumerable: true,
|
|
25289
|
+
configurable: true
|
|
25290
|
+
});
|
|
25291
|
+
} else {
|
|
25292
|
+
Object.defineProperty(a, key, {
|
|
25293
|
+
value: val,
|
|
25294
|
+
writable: true,
|
|
25295
|
+
enumerable: true,
|
|
25296
|
+
configurable: true
|
|
25297
|
+
});
|
|
25298
|
+
}
|
|
25299
|
+
},
|
|
25300
|
+
{ allOwnKeys }
|
|
25301
|
+
);
|
|
25265
25302
|
return a;
|
|
25266
25303
|
};
|
|
25267
25304
|
var stripBOM = (content) => {
|
|
@@ -25270,9 +25307,14 @@ var stripBOM = (content) => {
|
|
|
25270
25307
|
}
|
|
25271
25308
|
return content;
|
|
25272
25309
|
};
|
|
25273
|
-
var inherits = (constructor, superConstructor, props,
|
|
25274
|
-
constructor.prototype = Object.create(superConstructor.prototype,
|
|
25275
|
-
constructor.prototype
|
|
25310
|
+
var inherits = (constructor, superConstructor, props, descriptors) => {
|
|
25311
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
25312
|
+
Object.defineProperty(constructor.prototype, "constructor", {
|
|
25313
|
+
value: constructor,
|
|
25314
|
+
writable: true,
|
|
25315
|
+
enumerable: false,
|
|
25316
|
+
configurable: true
|
|
25317
|
+
});
|
|
25276
25318
|
Object.defineProperty(constructor, "super", {
|
|
25277
25319
|
value: superConstructor.prototype
|
|
25278
25320
|
});
|
|
@@ -25343,19 +25385,16 @@ var matchAll = (regExp, str) => {
|
|
|
25343
25385
|
};
|
|
25344
25386
|
var isHTMLForm = kindOfTest("HTMLFormElement");
|
|
25345
25387
|
var toCamelCase = (str) => {
|
|
25346
|
-
return str.toLowerCase().replace(
|
|
25347
|
-
|
|
25348
|
-
|
|
25349
|
-
return p1.toUpperCase() + p2;
|
|
25350
|
-
}
|
|
25351
|
-
);
|
|
25388
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
25389
|
+
return p1.toUpperCase() + p2;
|
|
25390
|
+
});
|
|
25352
25391
|
};
|
|
25353
25392
|
var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
25354
25393
|
var isRegExp = kindOfTest("RegExp");
|
|
25355
25394
|
var reduceDescriptors = (obj, reducer) => {
|
|
25356
|
-
const
|
|
25395
|
+
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
25357
25396
|
const reducedDescriptors = {};
|
|
25358
|
-
forEach(
|
|
25397
|
+
forEach(descriptors, (descriptor, name) => {
|
|
25359
25398
|
let ret;
|
|
25360
25399
|
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
25361
25400
|
reducedDescriptors[name] = ret || descriptor;
|
|
@@ -25432,20 +25471,21 @@ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
25432
25471
|
return setImmediate;
|
|
25433
25472
|
}
|
|
25434
25473
|
return postMessageSupported ? ((token, callbacks) => {
|
|
25435
|
-
_global.addEventListener(
|
|
25436
|
-
|
|
25437
|
-
|
|
25438
|
-
|
|
25439
|
-
|
|
25474
|
+
_global.addEventListener(
|
|
25475
|
+
"message",
|
|
25476
|
+
({ source, data }) => {
|
|
25477
|
+
if (source === _global && data === token) {
|
|
25478
|
+
callbacks.length && callbacks.shift()();
|
|
25479
|
+
}
|
|
25480
|
+
},
|
|
25481
|
+
false
|
|
25482
|
+
);
|
|
25440
25483
|
return (cb) => {
|
|
25441
25484
|
callbacks.push(cb);
|
|
25442
25485
|
_global.postMessage(token, "*");
|
|
25443
25486
|
};
|
|
25444
25487
|
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
25445
|
-
})(
|
|
25446
|
-
typeof setImmediate === "function",
|
|
25447
|
-
isFunction(_global.postMessage)
|
|
25448
|
-
);
|
|
25488
|
+
})(typeof setImmediate === "function", isFunction(_global.postMessage));
|
|
25449
25489
|
var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
25450
25490
|
var isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
25451
25491
|
var utils_default = {
|
|
@@ -25467,6 +25507,8 @@ var utils_default = {
|
|
|
25467
25507
|
isUndefined,
|
|
25468
25508
|
isDate,
|
|
25469
25509
|
isFile,
|
|
25510
|
+
isReactNativeBlob,
|
|
25511
|
+
isReactNative,
|
|
25470
25512
|
isBlob,
|
|
25471
25513
|
isRegExp,
|
|
25472
25514
|
isFunction,
|
|
@@ -25510,25 +25552,47 @@ var utils_default = {
|
|
|
25510
25552
|
};
|
|
25511
25553
|
|
|
25512
25554
|
// node_modules/axios/lib/core/AxiosError.js
|
|
25513
|
-
|
|
25514
|
-
|
|
25515
|
-
|
|
25516
|
-
|
|
25517
|
-
|
|
25518
|
-
|
|
25555
|
+
var AxiosError = class _AxiosError extends Error {
|
|
25556
|
+
static from(error, code, config, request, response, customProps) {
|
|
25557
|
+
const axiosError = new _AxiosError(error.message, code || error.code, config, request, response);
|
|
25558
|
+
axiosError.cause = error;
|
|
25559
|
+
axiosError.name = error.name;
|
|
25560
|
+
if (error.status != null && axiosError.status == null) {
|
|
25561
|
+
axiosError.status = error.status;
|
|
25562
|
+
}
|
|
25563
|
+
customProps && Object.assign(axiosError, customProps);
|
|
25564
|
+
return axiosError;
|
|
25519
25565
|
}
|
|
25520
|
-
|
|
25521
|
-
|
|
25522
|
-
|
|
25523
|
-
|
|
25524
|
-
|
|
25525
|
-
|
|
25526
|
-
|
|
25527
|
-
|
|
25566
|
+
/**
|
|
25567
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
25568
|
+
*
|
|
25569
|
+
* @param {string} message The error message.
|
|
25570
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
25571
|
+
* @param {Object} [config] The config.
|
|
25572
|
+
* @param {Object} [request] The request.
|
|
25573
|
+
* @param {Object} [response] The response.
|
|
25574
|
+
*
|
|
25575
|
+
* @returns {Error} The created error.
|
|
25576
|
+
*/
|
|
25577
|
+
constructor(message, code, config, request, response) {
|
|
25578
|
+
super(message);
|
|
25579
|
+
Object.defineProperty(this, "message", {
|
|
25580
|
+
value: message,
|
|
25581
|
+
enumerable: true,
|
|
25582
|
+
writable: true,
|
|
25583
|
+
configurable: true
|
|
25584
|
+
});
|
|
25585
|
+
this.name = "AxiosError";
|
|
25586
|
+
this.isAxiosError = true;
|
|
25587
|
+
code && (this.code = code);
|
|
25588
|
+
config && (this.config = config);
|
|
25589
|
+
request && (this.request = request);
|
|
25590
|
+
if (response) {
|
|
25591
|
+
this.response = response;
|
|
25592
|
+
this.status = response.status;
|
|
25593
|
+
}
|
|
25528
25594
|
}
|
|
25529
|
-
|
|
25530
|
-
utils_default.inherits(AxiosError, Error, {
|
|
25531
|
-
toJSON: function toJSON() {
|
|
25595
|
+
toJSON() {
|
|
25532
25596
|
return {
|
|
25533
25597
|
// Standard
|
|
25534
25598
|
message: this.message,
|
|
@@ -25547,45 +25611,19 @@ utils_default.inherits(AxiosError, Error, {
|
|
|
25547
25611
|
status: this.status
|
|
25548
25612
|
};
|
|
25549
25613
|
}
|
|
25550
|
-
});
|
|
25551
|
-
var prototype = AxiosError.prototype;
|
|
25552
|
-
var descriptors = {};
|
|
25553
|
-
[
|
|
25554
|
-
"ERR_BAD_OPTION_VALUE",
|
|
25555
|
-
"ERR_BAD_OPTION",
|
|
25556
|
-
"ECONNABORTED",
|
|
25557
|
-
"ETIMEDOUT",
|
|
25558
|
-
"ERR_NETWORK",
|
|
25559
|
-
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
25560
|
-
"ERR_DEPRECATED",
|
|
25561
|
-
"ERR_BAD_RESPONSE",
|
|
25562
|
-
"ERR_BAD_REQUEST",
|
|
25563
|
-
"ERR_CANCELED",
|
|
25564
|
-
"ERR_NOT_SUPPORT",
|
|
25565
|
-
"ERR_INVALID_URL"
|
|
25566
|
-
// eslint-disable-next-line func-names
|
|
25567
|
-
].forEach((code) => {
|
|
25568
|
-
descriptors[code] = { value: code };
|
|
25569
|
-
});
|
|
25570
|
-
Object.defineProperties(AxiosError, descriptors);
|
|
25571
|
-
Object.defineProperty(prototype, "isAxiosError", { value: true });
|
|
25572
|
-
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
25573
|
-
const axiosError = Object.create(prototype);
|
|
25574
|
-
utils_default.toFlatObject(error, axiosError, function filter2(obj) {
|
|
25575
|
-
return obj !== Error.prototype;
|
|
25576
|
-
}, (prop) => {
|
|
25577
|
-
return prop !== "isAxiosError";
|
|
25578
|
-
});
|
|
25579
|
-
const msg = error && error.message ? error.message : "Error";
|
|
25580
|
-
const errCode = code == null && error ? error.code : code;
|
|
25581
|
-
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
25582
|
-
if (error && axiosError.cause == null) {
|
|
25583
|
-
Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
|
|
25584
|
-
}
|
|
25585
|
-
axiosError.name = error && error.name || "Error";
|
|
25586
|
-
customProps && Object.assign(axiosError, customProps);
|
|
25587
|
-
return axiosError;
|
|
25588
25614
|
};
|
|
25615
|
+
AxiosError.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
|
|
25616
|
+
AxiosError.ERR_BAD_OPTION = "ERR_BAD_OPTION";
|
|
25617
|
+
AxiosError.ECONNABORTED = "ECONNABORTED";
|
|
25618
|
+
AxiosError.ETIMEDOUT = "ETIMEDOUT";
|
|
25619
|
+
AxiosError.ERR_NETWORK = "ERR_NETWORK";
|
|
25620
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
|
|
25621
|
+
AxiosError.ERR_DEPRECATED = "ERR_DEPRECATED";
|
|
25622
|
+
AxiosError.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
|
|
25623
|
+
AxiosError.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
|
25624
|
+
AxiosError.ERR_CANCELED = "ERR_CANCELED";
|
|
25625
|
+
AxiosError.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
|
25626
|
+
AxiosError.ERR_INVALID_URL = "ERR_INVALID_URL";
|
|
25589
25627
|
var AxiosError_default = AxiosError;
|
|
25590
25628
|
|
|
25591
25629
|
// node_modules/axios/lib/helpers/null.js
|
|
@@ -25616,13 +25654,18 @@ function toFormData(obj, formData, options) {
|
|
|
25616
25654
|
throw new TypeError("target must be an object");
|
|
25617
25655
|
}
|
|
25618
25656
|
formData = formData || new (null_default || FormData)();
|
|
25619
|
-
options = utils_default.toFlatObject(
|
|
25620
|
-
|
|
25621
|
-
|
|
25622
|
-
|
|
25623
|
-
|
|
25624
|
-
|
|
25625
|
-
|
|
25657
|
+
options = utils_default.toFlatObject(
|
|
25658
|
+
options,
|
|
25659
|
+
{
|
|
25660
|
+
metaTokens: true,
|
|
25661
|
+
dots: false,
|
|
25662
|
+
indexes: false
|
|
25663
|
+
},
|
|
25664
|
+
false,
|
|
25665
|
+
function defined(option, source) {
|
|
25666
|
+
return !utils_default.isUndefined(source[option]);
|
|
25667
|
+
}
|
|
25668
|
+
);
|
|
25626
25669
|
const metaTokens = options.metaTokens;
|
|
25627
25670
|
const visitor = options.visitor || defaultVisitor;
|
|
25628
25671
|
const dots = options.dots;
|
|
@@ -25650,6 +25693,10 @@ function toFormData(obj, formData, options) {
|
|
|
25650
25693
|
}
|
|
25651
25694
|
function defaultVisitor(value, key, path2) {
|
|
25652
25695
|
let arr = value;
|
|
25696
|
+
if (utils_default.isReactNative(formData) && utils_default.isReactNativeBlob(value)) {
|
|
25697
|
+
formData.append(renderKey(path2, key, dots), convertValue(value));
|
|
25698
|
+
return false;
|
|
25699
|
+
}
|
|
25653
25700
|
if (value && !path2 && typeof value === "object") {
|
|
25654
25701
|
if (utils_default.endsWith(key, "{}")) {
|
|
25655
25702
|
key = metaTokens ? key : key.slice(0, -2);
|
|
@@ -25685,13 +25732,7 @@ function toFormData(obj, formData, options) {
|
|
|
25685
25732
|
}
|
|
25686
25733
|
stack.push(value);
|
|
25687
25734
|
utils_default.forEach(value, function each(el, key) {
|
|
25688
|
-
const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(
|
|
25689
|
-
formData,
|
|
25690
|
-
el,
|
|
25691
|
-
utils_default.isString(key) ? key.trim() : key,
|
|
25692
|
-
path2,
|
|
25693
|
-
exposedHelpers
|
|
25694
|
-
);
|
|
25735
|
+
const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path2, exposedHelpers);
|
|
25695
25736
|
if (result === true) {
|
|
25696
25737
|
build(el, path2 ? path2.concat(key) : [key]);
|
|
25697
25738
|
}
|
|
@@ -25725,11 +25766,11 @@ function AxiosURLSearchParams(params, options) {
|
|
|
25725
25766
|
this._pairs = [];
|
|
25726
25767
|
params && toFormData_default(params, this, options);
|
|
25727
25768
|
}
|
|
25728
|
-
var
|
|
25729
|
-
|
|
25769
|
+
var prototype = AxiosURLSearchParams.prototype;
|
|
25770
|
+
prototype.append = function append(name, value) {
|
|
25730
25771
|
this._pairs.push([name, value]);
|
|
25731
25772
|
};
|
|
25732
|
-
|
|
25773
|
+
prototype.toString = function toString2(encoder) {
|
|
25733
25774
|
const _encode2 = encoder ? function(value) {
|
|
25734
25775
|
return encoder.call(this, value, encode);
|
|
25735
25776
|
} : encode;
|
|
@@ -25748,17 +25789,15 @@ function buildURL(url, params, options) {
|
|
|
25748
25789
|
return url;
|
|
25749
25790
|
}
|
|
25750
25791
|
const _encode2 = options && options.encode || encode2;
|
|
25751
|
-
|
|
25752
|
-
options
|
|
25753
|
-
|
|
25754
|
-
|
|
25755
|
-
}
|
|
25756
|
-
const serializeFn = options && options.serialize;
|
|
25792
|
+
const _options4 = utils_default.isFunction(options) ? {
|
|
25793
|
+
serialize: options
|
|
25794
|
+
} : options;
|
|
25795
|
+
const serializeFn = _options4 && _options4.serialize;
|
|
25757
25796
|
let serializedParams;
|
|
25758
25797
|
if (serializeFn) {
|
|
25759
|
-
serializedParams = serializeFn(params,
|
|
25798
|
+
serializedParams = serializeFn(params, _options4);
|
|
25760
25799
|
} else {
|
|
25761
|
-
serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params,
|
|
25800
|
+
serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, _options4).toString(_encode2);
|
|
25762
25801
|
}
|
|
25763
25802
|
if (serializedParams) {
|
|
25764
25803
|
const hashmarkIndex = url.indexOf("#");
|
|
@@ -25780,6 +25819,7 @@ var InterceptorManager = class {
|
|
|
25780
25819
|
*
|
|
25781
25820
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
25782
25821
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
25822
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
25783
25823
|
*
|
|
25784
25824
|
* @return {Number} An ID used to remove interceptor later
|
|
25785
25825
|
*/
|
|
@@ -25797,7 +25837,7 @@ var InterceptorManager = class {
|
|
|
25797
25837
|
*
|
|
25798
25838
|
* @param {Number} id The ID that was returned by `use`
|
|
25799
25839
|
*
|
|
25800
|
-
* @returns {
|
|
25840
|
+
* @returns {void}
|
|
25801
25841
|
*/
|
|
25802
25842
|
eject(id2) {
|
|
25803
25843
|
if (this.handlers[id2]) {
|
|
@@ -25838,7 +25878,8 @@ var InterceptorManager_default = InterceptorManager;
|
|
|
25838
25878
|
var transitional_default = {
|
|
25839
25879
|
silentJSONParsing: true,
|
|
25840
25880
|
forcedJSONParsing: true,
|
|
25841
|
-
clarifyTimeoutError: false
|
|
25881
|
+
clarifyTimeoutError: false,
|
|
25882
|
+
legacyInterceptorReqResOrdering: true
|
|
25842
25883
|
};
|
|
25843
25884
|
|
|
25844
25885
|
// node_modules/axios/lib/platform/browser/classes/URLSearchParams.js
|
|
@@ -25969,70 +26010,74 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
25969
26010
|
var defaults = {
|
|
25970
26011
|
transitional: transitional_default,
|
|
25971
26012
|
adapter: ["xhr", "http", "fetch"],
|
|
25972
|
-
transformRequest: [
|
|
25973
|
-
|
|
25974
|
-
|
|
25975
|
-
|
|
25976
|
-
|
|
25977
|
-
|
|
25978
|
-
|
|
25979
|
-
|
|
25980
|
-
|
|
25981
|
-
|
|
25982
|
-
|
|
25983
|
-
|
|
25984
|
-
|
|
25985
|
-
|
|
25986
|
-
if (utils_default.isArrayBufferView(data)) {
|
|
25987
|
-
return data.buffer;
|
|
25988
|
-
}
|
|
25989
|
-
if (utils_default.isURLSearchParams(data)) {
|
|
25990
|
-
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
25991
|
-
return data.toString();
|
|
25992
|
-
}
|
|
25993
|
-
let isFileList2;
|
|
25994
|
-
if (isObjectPayload) {
|
|
25995
|
-
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
25996
|
-
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
26013
|
+
transformRequest: [
|
|
26014
|
+
function transformRequest(data, headers) {
|
|
26015
|
+
const contentType = headers.getContentType() || "";
|
|
26016
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
26017
|
+
const isObjectPayload = utils_default.isObject(data);
|
|
26018
|
+
if (isObjectPayload && utils_default.isHTMLForm(data)) {
|
|
26019
|
+
data = new FormData(data);
|
|
26020
|
+
}
|
|
26021
|
+
const isFormData2 = utils_default.isFormData(data);
|
|
26022
|
+
if (isFormData2) {
|
|
26023
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
|
|
26024
|
+
}
|
|
26025
|
+
if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
|
|
26026
|
+
return data;
|
|
25997
26027
|
}
|
|
25998
|
-
if (
|
|
25999
|
-
|
|
26000
|
-
|
|
26001
|
-
|
|
26002
|
-
|
|
26003
|
-
|
|
26004
|
-
|
|
26028
|
+
if (utils_default.isArrayBufferView(data)) {
|
|
26029
|
+
return data.buffer;
|
|
26030
|
+
}
|
|
26031
|
+
if (utils_default.isURLSearchParams(data)) {
|
|
26032
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
26033
|
+
return data.toString();
|
|
26034
|
+
}
|
|
26035
|
+
let isFileList2;
|
|
26036
|
+
if (isObjectPayload) {
|
|
26037
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
26038
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
26039
|
+
}
|
|
26040
|
+
if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
26041
|
+
const _FormData = this.env && this.env.FormData;
|
|
26042
|
+
return toFormData_default(
|
|
26043
|
+
isFileList2 ? { "files[]": data } : data,
|
|
26044
|
+
_FormData && new _FormData(),
|
|
26045
|
+
this.formSerializer
|
|
26046
|
+
);
|
|
26047
|
+
}
|
|
26048
|
+
}
|
|
26049
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
26050
|
+
headers.setContentType("application/json", false);
|
|
26051
|
+
return stringifySafely(data);
|
|
26005
26052
|
}
|
|
26006
|
-
}
|
|
26007
|
-
if (isObjectPayload || hasJSONContentType) {
|
|
26008
|
-
headers.setContentType("application/json", false);
|
|
26009
|
-
return stringifySafely(data);
|
|
26010
|
-
}
|
|
26011
|
-
return data;
|
|
26012
|
-
}],
|
|
26013
|
-
transformResponse: [function transformResponse(data) {
|
|
26014
|
-
const transitional2 = this.transitional || defaults.transitional;
|
|
26015
|
-
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
26016
|
-
const JSONRequested = this.responseType === "json";
|
|
26017
|
-
if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
|
|
26018
26053
|
return data;
|
|
26019
26054
|
}
|
|
26020
|
-
|
|
26021
|
-
|
|
26022
|
-
|
|
26023
|
-
|
|
26024
|
-
|
|
26025
|
-
|
|
26026
|
-
|
|
26027
|
-
|
|
26028
|
-
|
|
26055
|
+
],
|
|
26056
|
+
transformResponse: [
|
|
26057
|
+
function transformResponse(data) {
|
|
26058
|
+
const transitional2 = this.transitional || defaults.transitional;
|
|
26059
|
+
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
26060
|
+
const JSONRequested = this.responseType === "json";
|
|
26061
|
+
if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
|
|
26062
|
+
return data;
|
|
26063
|
+
}
|
|
26064
|
+
if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
26065
|
+
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
26066
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
26067
|
+
try {
|
|
26068
|
+
return JSON.parse(data, this.parseReviver);
|
|
26069
|
+
} catch (e) {
|
|
26070
|
+
if (strictJSONParsing) {
|
|
26071
|
+
if (e.name === "SyntaxError") {
|
|
26072
|
+
throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
|
|
26073
|
+
}
|
|
26074
|
+
throw e;
|
|
26029
26075
|
}
|
|
26030
|
-
throw e;
|
|
26031
26076
|
}
|
|
26032
26077
|
}
|
|
26078
|
+
return data;
|
|
26033
26079
|
}
|
|
26034
|
-
|
|
26035
|
-
}],
|
|
26080
|
+
],
|
|
26036
26081
|
/**
|
|
26037
26082
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
26038
26083
|
* timeout is not created.
|
|
@@ -26051,7 +26096,7 @@ var defaults = {
|
|
|
26051
26096
|
},
|
|
26052
26097
|
headers: {
|
|
26053
26098
|
common: {
|
|
26054
|
-
|
|
26099
|
+
Accept: "application/json, text/plain, */*",
|
|
26055
26100
|
"Content-Type": void 0
|
|
26056
26101
|
}
|
|
26057
26102
|
}
|
|
@@ -26108,14 +26153,38 @@ var parseHeaders_default = (rawHeaders) => {
|
|
|
26108
26153
|
|
|
26109
26154
|
// node_modules/axios/lib/core/AxiosHeaders.js
|
|
26110
26155
|
var $internals = /* @__PURE__ */ Symbol("internals");
|
|
26156
|
+
var isValidHeaderValue = (value) => !/[\r\n]/.test(value);
|
|
26157
|
+
function assertValidHeaderValue(value, header) {
|
|
26158
|
+
if (value === false || value == null) {
|
|
26159
|
+
return;
|
|
26160
|
+
}
|
|
26161
|
+
if (utils_default.isArray(value)) {
|
|
26162
|
+
value.forEach((v) => assertValidHeaderValue(v, header));
|
|
26163
|
+
return;
|
|
26164
|
+
}
|
|
26165
|
+
if (!isValidHeaderValue(String(value))) {
|
|
26166
|
+
throw new Error(`Invalid character in header content ["${header}"]`);
|
|
26167
|
+
}
|
|
26168
|
+
}
|
|
26111
26169
|
function normalizeHeader(header) {
|
|
26112
26170
|
return header && String(header).trim().toLowerCase();
|
|
26113
26171
|
}
|
|
26172
|
+
function stripTrailingCRLF(str) {
|
|
26173
|
+
let end = str.length;
|
|
26174
|
+
while (end > 0) {
|
|
26175
|
+
const charCode = str.charCodeAt(end - 1);
|
|
26176
|
+
if (charCode !== 10 && charCode !== 13) {
|
|
26177
|
+
break;
|
|
26178
|
+
}
|
|
26179
|
+
end -= 1;
|
|
26180
|
+
}
|
|
26181
|
+
return end === str.length ? str : str.slice(0, end);
|
|
26182
|
+
}
|
|
26114
26183
|
function normalizeValue(value) {
|
|
26115
26184
|
if (value === false || value == null) {
|
|
26116
26185
|
return value;
|
|
26117
26186
|
}
|
|
26118
|
-
return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
26187
|
+
return utils_default.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
|
|
26119
26188
|
}
|
|
26120
26189
|
function parseTokens(str) {
|
|
26121
26190
|
const tokens = /* @__PURE__ */ Object.create(null);
|
|
@@ -26171,6 +26240,7 @@ var AxiosHeaders = class {
|
|
|
26171
26240
|
}
|
|
26172
26241
|
const key = utils_default.findKey(self2, lHeader);
|
|
26173
26242
|
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
|
26243
|
+
assertValidHeaderValue(_value2, _header);
|
|
26174
26244
|
self2[key || _header] = normalizeValue(_value2);
|
|
26175
26245
|
}
|
|
26176
26246
|
}
|
|
@@ -26310,11 +26380,11 @@ var AxiosHeaders = class {
|
|
|
26310
26380
|
accessors: {}
|
|
26311
26381
|
};
|
|
26312
26382
|
const accessors = internals.accessors;
|
|
26313
|
-
const
|
|
26383
|
+
const prototype2 = this.prototype;
|
|
26314
26384
|
function defineAccessor(_header) {
|
|
26315
26385
|
const lHeader = normalizeHeader(_header);
|
|
26316
26386
|
if (!accessors[lHeader]) {
|
|
26317
|
-
buildAccessors(
|
|
26387
|
+
buildAccessors(prototype2, _header);
|
|
26318
26388
|
accessors[lHeader] = true;
|
|
26319
26389
|
}
|
|
26320
26390
|
}
|
|
@@ -26322,7 +26392,14 @@ var AxiosHeaders = class {
|
|
|
26322
26392
|
return this;
|
|
26323
26393
|
}
|
|
26324
26394
|
};
|
|
26325
|
-
AxiosHeaders.accessor([
|
|
26395
|
+
AxiosHeaders.accessor([
|
|
26396
|
+
"Content-Type",
|
|
26397
|
+
"Content-Length",
|
|
26398
|
+
"Accept",
|
|
26399
|
+
"Accept-Encoding",
|
|
26400
|
+
"User-Agent",
|
|
26401
|
+
"Authorization"
|
|
26402
|
+
]);
|
|
26326
26403
|
utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
26327
26404
|
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
26328
26405
|
return {
|
|
@@ -26354,13 +26431,22 @@ function isCancel(value) {
|
|
|
26354
26431
|
}
|
|
26355
26432
|
|
|
26356
26433
|
// node_modules/axios/lib/cancel/CanceledError.js
|
|
26357
|
-
|
|
26358
|
-
|
|
26359
|
-
|
|
26360
|
-
|
|
26361
|
-
|
|
26362
|
-
|
|
26363
|
-
}
|
|
26434
|
+
var CanceledError = class extends AxiosError_default {
|
|
26435
|
+
/**
|
|
26436
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
26437
|
+
*
|
|
26438
|
+
* @param {string=} message The message.
|
|
26439
|
+
* @param {Object=} config The config.
|
|
26440
|
+
* @param {Object=} request The request.
|
|
26441
|
+
*
|
|
26442
|
+
* @returns {CanceledError} The created error.
|
|
26443
|
+
*/
|
|
26444
|
+
constructor(message, config, request) {
|
|
26445
|
+
super(message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
|
|
26446
|
+
this.name = "CanceledError";
|
|
26447
|
+
this.__CANCEL__ = true;
|
|
26448
|
+
}
|
|
26449
|
+
};
|
|
26364
26450
|
var CanceledError_default = CanceledError;
|
|
26365
26451
|
|
|
26366
26452
|
// node_modules/axios/lib/core/settle.js
|
|
@@ -26369,13 +26455,15 @@ function settle(resolve, reject, response) {
|
|
|
26369
26455
|
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
26370
26456
|
resolve(response);
|
|
26371
26457
|
} else {
|
|
26372
|
-
reject(
|
|
26373
|
-
|
|
26374
|
-
|
|
26375
|
-
|
|
26376
|
-
|
|
26377
|
-
|
|
26378
|
-
|
|
26458
|
+
reject(
|
|
26459
|
+
new AxiosError_default(
|
|
26460
|
+
"Request failed with status code " + response.status,
|
|
26461
|
+
[AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
26462
|
+
response.config,
|
|
26463
|
+
response.request,
|
|
26464
|
+
response
|
|
26465
|
+
)
|
|
26466
|
+
);
|
|
26379
26467
|
}
|
|
26380
26468
|
}
|
|
26381
26469
|
|
|
@@ -26483,11 +26571,14 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
26483
26571
|
};
|
|
26484
26572
|
var progressEventDecorator = (total, throttled) => {
|
|
26485
26573
|
const lengthComputable = total != null;
|
|
26486
|
-
return [
|
|
26487
|
-
|
|
26488
|
-
|
|
26489
|
-
|
|
26490
|
-
|
|
26574
|
+
return [
|
|
26575
|
+
(loaded) => throttled[0]({
|
|
26576
|
+
lengthComputable,
|
|
26577
|
+
total,
|
|
26578
|
+
loaded
|
|
26579
|
+
}),
|
|
26580
|
+
throttled[1]
|
|
26581
|
+
];
|
|
26491
26582
|
};
|
|
26492
26583
|
var asyncDecorator = (fn) => (...args) => utils_default.asap(() => fn(...args));
|
|
26493
26584
|
|
|
@@ -26504,20 +26595,33 @@ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PUR
|
|
|
26504
26595
|
var cookies_default = platform_default.hasStandardBrowserEnv ? (
|
|
26505
26596
|
// Standard browser envs support document.cookie
|
|
26506
26597
|
{
|
|
26507
|
-
write(name, value, expires, path2, domain, secure) {
|
|
26508
|
-
|
|
26509
|
-
|
|
26510
|
-
utils_default.
|
|
26511
|
-
|
|
26512
|
-
|
|
26598
|
+
write(name, value, expires, path2, domain, secure, sameSite) {
|
|
26599
|
+
if (typeof document === "undefined") return;
|
|
26600
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
26601
|
+
if (utils_default.isNumber(expires)) {
|
|
26602
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
26603
|
+
}
|
|
26604
|
+
if (utils_default.isString(path2)) {
|
|
26605
|
+
cookie.push(`path=${path2}`);
|
|
26606
|
+
}
|
|
26607
|
+
if (utils_default.isString(domain)) {
|
|
26608
|
+
cookie.push(`domain=${domain}`);
|
|
26609
|
+
}
|
|
26610
|
+
if (secure === true) {
|
|
26611
|
+
cookie.push("secure");
|
|
26612
|
+
}
|
|
26613
|
+
if (utils_default.isString(sameSite)) {
|
|
26614
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
26615
|
+
}
|
|
26513
26616
|
document.cookie = cookie.join("; ");
|
|
26514
26617
|
},
|
|
26515
26618
|
read(name) {
|
|
26516
|
-
|
|
26517
|
-
|
|
26619
|
+
if (typeof document === "undefined") return null;
|
|
26620
|
+
const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
|
|
26621
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
26518
26622
|
},
|
|
26519
26623
|
remove(name) {
|
|
26520
|
-
this.write(name, "", Date.now() - 864e5);
|
|
26624
|
+
this.write(name, "", Date.now() - 864e5, "/");
|
|
26521
26625
|
}
|
|
26522
26626
|
}
|
|
26523
26627
|
) : (
|
|
@@ -26535,6 +26639,9 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
|
|
|
26535
26639
|
|
|
26536
26640
|
// node_modules/axios/lib/helpers/isAbsoluteURL.js
|
|
26537
26641
|
function isAbsoluteURL(url) {
|
|
26642
|
+
if (typeof url !== "string") {
|
|
26643
|
+
return false;
|
|
26644
|
+
}
|
|
26538
26645
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
26539
26646
|
}
|
|
26540
26647
|
|
|
@@ -26625,7 +26732,8 @@ function mergeConfig(config1, config2) {
|
|
|
26625
26732
|
headers: (a, b2, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b2), prop, true)
|
|
26626
26733
|
};
|
|
26627
26734
|
utils_default.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
26628
|
-
|
|
26735
|
+
if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
|
|
26736
|
+
const merge2 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
26629
26737
|
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
26630
26738
|
utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
26631
26739
|
});
|
|
@@ -26637,11 +26745,17 @@ var resolveConfig_default = (config) => {
|
|
|
26637
26745
|
const newConfig = mergeConfig({}, config);
|
|
26638
26746
|
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
26639
26747
|
newConfig.headers = headers = AxiosHeaders_default.from(headers);
|
|
26640
|
-
newConfig.url = buildURL(
|
|
26748
|
+
newConfig.url = buildURL(
|
|
26749
|
+
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
26750
|
+
config.params,
|
|
26751
|
+
config.paramsSerializer
|
|
26752
|
+
);
|
|
26641
26753
|
if (auth) {
|
|
26642
26754
|
headers.set(
|
|
26643
26755
|
"Authorization",
|
|
26644
|
-
"Basic " + btoa(
|
|
26756
|
+
"Basic " + btoa(
|
|
26757
|
+
(auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")
|
|
26758
|
+
)
|
|
26645
26759
|
);
|
|
26646
26760
|
}
|
|
26647
26761
|
if (utils_default.isFormData(data)) {
|
|
@@ -26705,13 +26819,17 @@ var xhr_default = isXHRAdapterSupported && function(config) {
|
|
|
26705
26819
|
config,
|
|
26706
26820
|
request
|
|
26707
26821
|
};
|
|
26708
|
-
settle(
|
|
26709
|
-
|
|
26710
|
-
|
|
26711
|
-
|
|
26712
|
-
|
|
26713
|
-
|
|
26714
|
-
|
|
26822
|
+
settle(
|
|
26823
|
+
function _resolve(value) {
|
|
26824
|
+
resolve(value);
|
|
26825
|
+
done();
|
|
26826
|
+
},
|
|
26827
|
+
function _reject(err) {
|
|
26828
|
+
reject(err);
|
|
26829
|
+
done();
|
|
26830
|
+
},
|
|
26831
|
+
response
|
|
26832
|
+
);
|
|
26715
26833
|
request = null;
|
|
26716
26834
|
}
|
|
26717
26835
|
if ("onloadend" in request) {
|
|
@@ -26747,12 +26865,14 @@ var xhr_default = isXHRAdapterSupported && function(config) {
|
|
|
26747
26865
|
if (_config.timeoutErrorMessage) {
|
|
26748
26866
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
26749
26867
|
}
|
|
26750
|
-
reject(
|
|
26751
|
-
|
|
26752
|
-
|
|
26753
|
-
|
|
26754
|
-
|
|
26755
|
-
|
|
26868
|
+
reject(
|
|
26869
|
+
new AxiosError_default(
|
|
26870
|
+
timeoutErrorMessage,
|
|
26871
|
+
transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
|
|
26872
|
+
config,
|
|
26873
|
+
request
|
|
26874
|
+
)
|
|
26875
|
+
);
|
|
26756
26876
|
request = null;
|
|
26757
26877
|
};
|
|
26758
26878
|
requestData === void 0 && requestHeaders.setContentType(null);
|
|
@@ -26792,7 +26912,13 @@ var xhr_default = isXHRAdapterSupported && function(config) {
|
|
|
26792
26912
|
}
|
|
26793
26913
|
const protocol = parseProtocol(_config.url);
|
|
26794
26914
|
if (protocol && platform_default.protocols.indexOf(protocol) === -1) {
|
|
26795
|
-
reject(
|
|
26915
|
+
reject(
|
|
26916
|
+
new AxiosError_default(
|
|
26917
|
+
"Unsupported protocol " + protocol + ":",
|
|
26918
|
+
AxiosError_default.ERR_BAD_REQUEST,
|
|
26919
|
+
config
|
|
26920
|
+
)
|
|
26921
|
+
);
|
|
26796
26922
|
return;
|
|
26797
26923
|
}
|
|
26798
26924
|
request.send(requestData || null);
|
|
@@ -26810,12 +26936,14 @@ var composeSignals = (signals, timeout) => {
|
|
|
26810
26936
|
aborted = true;
|
|
26811
26937
|
unsubscribe();
|
|
26812
26938
|
const err = reason instanceof Error ? reason : this.reason;
|
|
26813
|
-
controller.abort(
|
|
26939
|
+
controller.abort(
|
|
26940
|
+
err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err)
|
|
26941
|
+
);
|
|
26814
26942
|
}
|
|
26815
26943
|
};
|
|
26816
26944
|
let timer = timeout && setTimeout(() => {
|
|
26817
26945
|
timer = null;
|
|
26818
|
-
onabort(new AxiosError_default(`timeout ${timeout}
|
|
26946
|
+
onabort(new AxiosError_default(`timeout of ${timeout}ms exceeded`, AxiosError_default.ETIMEDOUT));
|
|
26819
26947
|
}, timeout);
|
|
26820
26948
|
const unsubscribe = () => {
|
|
26821
26949
|
if (signals) {
|
|
@@ -26883,33 +27011,36 @@ var trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
26883
27011
|
onFinish && onFinish(e);
|
|
26884
27012
|
}
|
|
26885
27013
|
};
|
|
26886
|
-
return new ReadableStream(
|
|
26887
|
-
|
|
26888
|
-
|
|
26889
|
-
|
|
26890
|
-
|
|
26891
|
-
|
|
26892
|
-
|
|
26893
|
-
|
|
26894
|
-
|
|
26895
|
-
|
|
26896
|
-
|
|
26897
|
-
|
|
26898
|
-
|
|
27014
|
+
return new ReadableStream(
|
|
27015
|
+
{
|
|
27016
|
+
async pull(controller) {
|
|
27017
|
+
try {
|
|
27018
|
+
const { done: done2, value } = await iterator2.next();
|
|
27019
|
+
if (done2) {
|
|
27020
|
+
_onFinish();
|
|
27021
|
+
controller.close();
|
|
27022
|
+
return;
|
|
27023
|
+
}
|
|
27024
|
+
let len = value.byteLength;
|
|
27025
|
+
if (onProgress) {
|
|
27026
|
+
let loadedBytes = bytes2 += len;
|
|
27027
|
+
onProgress(loadedBytes);
|
|
27028
|
+
}
|
|
27029
|
+
controller.enqueue(new Uint8Array(value));
|
|
27030
|
+
} catch (err) {
|
|
27031
|
+
_onFinish(err);
|
|
27032
|
+
throw err;
|
|
26899
27033
|
}
|
|
26900
|
-
|
|
26901
|
-
|
|
26902
|
-
_onFinish(
|
|
26903
|
-
|
|
27034
|
+
},
|
|
27035
|
+
cancel(reason) {
|
|
27036
|
+
_onFinish(reason);
|
|
27037
|
+
return iterator2.return();
|
|
26904
27038
|
}
|
|
26905
27039
|
},
|
|
26906
|
-
|
|
26907
|
-
|
|
26908
|
-
return iterator2.return();
|
|
27040
|
+
{
|
|
27041
|
+
highWaterMark: 2
|
|
26909
27042
|
}
|
|
26910
|
-
|
|
26911
|
-
highWaterMark: 2
|
|
26912
|
-
});
|
|
27043
|
+
);
|
|
26913
27044
|
};
|
|
26914
27045
|
|
|
26915
27046
|
// node_modules/axios/lib/adapters/fetch.js
|
|
@@ -26919,10 +27050,7 @@ var globalFetchAPI = (({ Request, Response }) => ({
|
|
|
26919
27050
|
Request,
|
|
26920
27051
|
Response
|
|
26921
27052
|
}))(utils_default.global);
|
|
26922
|
-
var {
|
|
26923
|
-
ReadableStream: ReadableStream2,
|
|
26924
|
-
TextEncoder: TextEncoder2
|
|
26925
|
-
} = utils_default.global;
|
|
27053
|
+
var { ReadableStream: ReadableStream2, TextEncoder: TextEncoder2 } = utils_default.global;
|
|
26926
27054
|
var test = (fn, ...args) => {
|
|
26927
27055
|
try {
|
|
26928
27056
|
return !!fn(...args);
|
|
@@ -26931,9 +27059,13 @@ var test = (fn, ...args) => {
|
|
|
26931
27059
|
}
|
|
26932
27060
|
};
|
|
26933
27061
|
var factory = (env) => {
|
|
26934
|
-
env = utils_default.merge.call(
|
|
26935
|
-
|
|
26936
|
-
|
|
27062
|
+
env = utils_default.merge.call(
|
|
27063
|
+
{
|
|
27064
|
+
skipUndefined: true
|
|
27065
|
+
},
|
|
27066
|
+
globalFetchAPI,
|
|
27067
|
+
env
|
|
27068
|
+
);
|
|
26937
27069
|
const { fetch: envFetch, Request, Response } = env;
|
|
26938
27070
|
const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
|
|
26939
27071
|
const isRequestSupported = isFunction2(Request);
|
|
@@ -26945,14 +27077,16 @@ var factory = (env) => {
|
|
|
26945
27077
|
const encodeText = isFetchSupported && (typeof TextEncoder2 === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder2()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
26946
27078
|
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
26947
27079
|
let duplexAccessed = false;
|
|
27080
|
+
const body = new ReadableStream2();
|
|
26948
27081
|
const hasContentType = new Request(platform_default.origin, {
|
|
26949
|
-
body
|
|
27082
|
+
body,
|
|
26950
27083
|
method: "POST",
|
|
26951
27084
|
get duplex() {
|
|
26952
27085
|
duplexAccessed = true;
|
|
26953
27086
|
return "half";
|
|
26954
27087
|
}
|
|
26955
27088
|
}).headers.has("Content-Type");
|
|
27089
|
+
body.cancel();
|
|
26956
27090
|
return duplexAccessed && !hasContentType;
|
|
26957
27091
|
});
|
|
26958
27092
|
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
|
|
@@ -26966,7 +27100,11 @@ var factory = (env) => {
|
|
|
26966
27100
|
if (method) {
|
|
26967
27101
|
return method.call(res);
|
|
26968
27102
|
}
|
|
26969
|
-
throw new AxiosError_default(
|
|
27103
|
+
throw new AxiosError_default(
|
|
27104
|
+
`Response type '${type}' is not supported`,
|
|
27105
|
+
AxiosError_default.ERR_NOT_SUPPORT,
|
|
27106
|
+
config
|
|
27107
|
+
);
|
|
26970
27108
|
});
|
|
26971
27109
|
});
|
|
26972
27110
|
})();
|
|
@@ -27015,7 +27153,10 @@ var factory = (env) => {
|
|
|
27015
27153
|
} = resolveConfig_default(config);
|
|
27016
27154
|
let _fetch = envFetch || fetch;
|
|
27017
27155
|
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
27018
|
-
let composedSignal = composeSignals_default(
|
|
27156
|
+
let composedSignal = composeSignals_default(
|
|
27157
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
27158
|
+
timeout
|
|
27159
|
+
);
|
|
27019
27160
|
let request = null;
|
|
27020
27161
|
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
27021
27162
|
composedSignal.unsubscribe();
|
|
@@ -27075,7 +27216,10 @@ var factory = (env) => {
|
|
|
27075
27216
|
);
|
|
27076
27217
|
}
|
|
27077
27218
|
responseType = responseType || "text";
|
|
27078
|
-
let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](
|
|
27219
|
+
let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](
|
|
27220
|
+
response,
|
|
27221
|
+
config
|
|
27222
|
+
);
|
|
27079
27223
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
27080
27224
|
return await new Promise((resolve, reject) => {
|
|
27081
27225
|
settle(resolve, reject, {
|
|
@@ -27091,25 +27235,27 @@ var factory = (env) => {
|
|
|
27091
27235
|
unsubscribe && unsubscribe();
|
|
27092
27236
|
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
27093
27237
|
throw Object.assign(
|
|
27094
|
-
new AxiosError_default(
|
|
27238
|
+
new AxiosError_default(
|
|
27239
|
+
"Network Error",
|
|
27240
|
+
AxiosError_default.ERR_NETWORK,
|
|
27241
|
+
config,
|
|
27242
|
+
request,
|
|
27243
|
+
err && err.response
|
|
27244
|
+
),
|
|
27095
27245
|
{
|
|
27096
27246
|
cause: err.cause || err
|
|
27097
27247
|
}
|
|
27098
27248
|
);
|
|
27099
27249
|
}
|
|
27100
|
-
throw AxiosError_default.from(err, err && err.code, config, request);
|
|
27250
|
+
throw AxiosError_default.from(err, err && err.code, config, request, err && err.response);
|
|
27101
27251
|
}
|
|
27102
27252
|
};
|
|
27103
27253
|
};
|
|
27104
27254
|
var seedCache = /* @__PURE__ */ new Map();
|
|
27105
27255
|
var getFetch = (config) => {
|
|
27106
|
-
let env = config
|
|
27256
|
+
let env = config && config.env || {};
|
|
27107
27257
|
const { fetch: fetch2, Request, Response } = env;
|
|
27108
|
-
const seeds = [
|
|
27109
|
-
Request,
|
|
27110
|
-
Response,
|
|
27111
|
-
fetch2
|
|
27112
|
-
];
|
|
27258
|
+
const seeds = [Request, Response, fetch2];
|
|
27113
27259
|
let len = seeds.length, i = len, seed, target, map = seedCache;
|
|
27114
27260
|
while (i--) {
|
|
27115
27261
|
seed = seeds[i];
|
|
@@ -27140,40 +27286,49 @@ utils_default.forEach(knownAdapters, (fn, value) => {
|
|
|
27140
27286
|
});
|
|
27141
27287
|
var renderReason = (reason) => `- ${reason}`;
|
|
27142
27288
|
var isResolvedHandle = (adapter2) => utils_default.isFunction(adapter2) || adapter2 === null || adapter2 === false;
|
|
27143
|
-
|
|
27144
|
-
|
|
27145
|
-
|
|
27146
|
-
|
|
27147
|
-
|
|
27148
|
-
|
|
27149
|
-
|
|
27150
|
-
|
|
27151
|
-
|
|
27152
|
-
|
|
27153
|
-
|
|
27154
|
-
|
|
27155
|
-
|
|
27156
|
-
|
|
27157
|
-
throw new AxiosError_default(`Unknown adapter '${id2}'`);
|
|
27158
|
-
}
|
|
27159
|
-
}
|
|
27160
|
-
if (adapter2 && (utils_default.isFunction(adapter2) || (adapter2 = adapter2.get(config)))) {
|
|
27161
|
-
break;
|
|
27289
|
+
function getAdapter(adapters, config) {
|
|
27290
|
+
adapters = utils_default.isArray(adapters) ? adapters : [adapters];
|
|
27291
|
+
const { length } = adapters;
|
|
27292
|
+
let nameOrAdapter;
|
|
27293
|
+
let adapter2;
|
|
27294
|
+
const rejectedReasons = {};
|
|
27295
|
+
for (let i = 0; i < length; i++) {
|
|
27296
|
+
nameOrAdapter = adapters[i];
|
|
27297
|
+
let id2;
|
|
27298
|
+
adapter2 = nameOrAdapter;
|
|
27299
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
27300
|
+
adapter2 = knownAdapters[(id2 = String(nameOrAdapter)).toLowerCase()];
|
|
27301
|
+
if (adapter2 === void 0) {
|
|
27302
|
+
throw new AxiosError_default(`Unknown adapter '${id2}'`);
|
|
27162
27303
|
}
|
|
27163
|
-
rejectedReasons[id2 || "#" + i] = adapter2;
|
|
27164
27304
|
}
|
|
27165
|
-
if (
|
|
27166
|
-
|
|
27167
|
-
([id2, state]) => `adapter ${id2} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
27168
|
-
);
|
|
27169
|
-
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
27170
|
-
throw new AxiosError_default(
|
|
27171
|
-
`There is no suitable adapter to dispatch the request ` + s,
|
|
27172
|
-
"ERR_NOT_SUPPORT"
|
|
27173
|
-
);
|
|
27305
|
+
if (adapter2 && (utils_default.isFunction(adapter2) || (adapter2 = adapter2.get(config)))) {
|
|
27306
|
+
break;
|
|
27174
27307
|
}
|
|
27175
|
-
|
|
27176
|
-
}
|
|
27308
|
+
rejectedReasons[id2 || "#" + i] = adapter2;
|
|
27309
|
+
}
|
|
27310
|
+
if (!adapter2) {
|
|
27311
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
27312
|
+
([id2, state]) => `adapter ${id2} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
27313
|
+
);
|
|
27314
|
+
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
27315
|
+
throw new AxiosError_default(
|
|
27316
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
27317
|
+
"ERR_NOT_SUPPORT"
|
|
27318
|
+
);
|
|
27319
|
+
}
|
|
27320
|
+
return adapter2;
|
|
27321
|
+
}
|
|
27322
|
+
var adapters_default = {
|
|
27323
|
+
/**
|
|
27324
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
27325
|
+
* @type {Function}
|
|
27326
|
+
*/
|
|
27327
|
+
getAdapter,
|
|
27328
|
+
/**
|
|
27329
|
+
* Exposes all known adapters
|
|
27330
|
+
* @type {Object<string, Function|Object>}
|
|
27331
|
+
*/
|
|
27177
27332
|
adapters: knownAdapters
|
|
27178
27333
|
};
|
|
27179
27334
|
|
|
@@ -27189,41 +27344,37 @@ function throwIfCancellationRequested(config) {
|
|
|
27189
27344
|
function dispatchRequest(config) {
|
|
27190
27345
|
throwIfCancellationRequested(config);
|
|
27191
27346
|
config.headers = AxiosHeaders_default.from(config.headers);
|
|
27192
|
-
config.data = transformData.call(
|
|
27193
|
-
config,
|
|
27194
|
-
config.transformRequest
|
|
27195
|
-
);
|
|
27347
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
27196
27348
|
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
27197
27349
|
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
27198
27350
|
}
|
|
27199
27351
|
const adapter2 = adapters_default.getAdapter(config.adapter || defaults_default.adapter, config);
|
|
27200
|
-
return adapter2(config).then(
|
|
27201
|
-
|
|
27202
|
-
response.data = transformData.call(
|
|
27203
|
-
config,
|
|
27204
|
-
config.transformResponse,
|
|
27205
|
-
response
|
|
27206
|
-
);
|
|
27207
|
-
response.headers = AxiosHeaders_default.from(response.headers);
|
|
27208
|
-
return response;
|
|
27209
|
-
}, function onAdapterRejection(reason) {
|
|
27210
|
-
if (!isCancel(reason)) {
|
|
27352
|
+
return adapter2(config).then(
|
|
27353
|
+
function onAdapterResolution(response) {
|
|
27211
27354
|
throwIfCancellationRequested(config);
|
|
27212
|
-
|
|
27213
|
-
|
|
27214
|
-
|
|
27215
|
-
|
|
27216
|
-
|
|
27217
|
-
|
|
27218
|
-
|
|
27355
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
27356
|
+
response.headers = AxiosHeaders_default.from(response.headers);
|
|
27357
|
+
return response;
|
|
27358
|
+
},
|
|
27359
|
+
function onAdapterRejection(reason) {
|
|
27360
|
+
if (!isCancel(reason)) {
|
|
27361
|
+
throwIfCancellationRequested(config);
|
|
27362
|
+
if (reason && reason.response) {
|
|
27363
|
+
reason.response.data = transformData.call(
|
|
27364
|
+
config,
|
|
27365
|
+
config.transformResponse,
|
|
27366
|
+
reason.response
|
|
27367
|
+
);
|
|
27368
|
+
reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
|
|
27369
|
+
}
|
|
27219
27370
|
}
|
|
27371
|
+
return Promise.reject(reason);
|
|
27220
27372
|
}
|
|
27221
|
-
|
|
27222
|
-
});
|
|
27373
|
+
);
|
|
27223
27374
|
}
|
|
27224
27375
|
|
|
27225
27376
|
// node_modules/axios/lib/env/data.js
|
|
27226
|
-
var VERSION = "1.
|
|
27377
|
+
var VERSION = "1.15.0";
|
|
27227
27378
|
|
|
27228
27379
|
// node_modules/axios/lib/helpers/validator.js
|
|
27229
27380
|
var validators = {};
|
|
@@ -27275,7 +27426,10 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
27275
27426
|
const value = options[opt];
|
|
27276
27427
|
const result = value === void 0 || validator(value, opt, options);
|
|
27277
27428
|
if (result !== true) {
|
|
27278
|
-
throw new AxiosError_default(
|
|
27429
|
+
throw new AxiosError_default(
|
|
27430
|
+
"option " + opt + " must be " + result,
|
|
27431
|
+
AxiosError_default.ERR_BAD_OPTION_VALUE
|
|
27432
|
+
);
|
|
27279
27433
|
}
|
|
27280
27434
|
continue;
|
|
27281
27435
|
}
|
|
@@ -27314,12 +27468,23 @@ var Axios = class {
|
|
|
27314
27468
|
if (err instanceof Error) {
|
|
27315
27469
|
let dummy = {};
|
|
27316
27470
|
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
27317
|
-
const stack =
|
|
27471
|
+
const stack = (() => {
|
|
27472
|
+
if (!dummy.stack) {
|
|
27473
|
+
return "";
|
|
27474
|
+
}
|
|
27475
|
+
const firstNewlineIndex = dummy.stack.indexOf("\n");
|
|
27476
|
+
return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
|
|
27477
|
+
})();
|
|
27318
27478
|
try {
|
|
27319
27479
|
if (!err.stack) {
|
|
27320
27480
|
err.stack = stack;
|
|
27321
|
-
} else if (stack
|
|
27322
|
-
|
|
27481
|
+
} else if (stack) {
|
|
27482
|
+
const firstNewlineIndex = stack.indexOf("\n");
|
|
27483
|
+
const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
|
|
27484
|
+
const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
|
|
27485
|
+
if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
|
|
27486
|
+
err.stack += "\n" + stack;
|
|
27487
|
+
}
|
|
27323
27488
|
}
|
|
27324
27489
|
} catch (e) {
|
|
27325
27490
|
}
|
|
@@ -27337,11 +27502,16 @@ var Axios = class {
|
|
|
27337
27502
|
config = mergeConfig(this.defaults, config);
|
|
27338
27503
|
const { transitional: transitional2, paramsSerializer, headers } = config;
|
|
27339
27504
|
if (transitional2 !== void 0) {
|
|
27340
|
-
validator_default.assertOptions(
|
|
27341
|
-
|
|
27342
|
-
|
|
27343
|
-
|
|
27344
|
-
|
|
27505
|
+
validator_default.assertOptions(
|
|
27506
|
+
transitional2,
|
|
27507
|
+
{
|
|
27508
|
+
silentJSONParsing: validators2.transitional(validators2.boolean),
|
|
27509
|
+
forcedJSONParsing: validators2.transitional(validators2.boolean),
|
|
27510
|
+
clarifyTimeoutError: validators2.transitional(validators2.boolean),
|
|
27511
|
+
legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean)
|
|
27512
|
+
},
|
|
27513
|
+
false
|
|
27514
|
+
);
|
|
27345
27515
|
}
|
|
27346
27516
|
if (paramsSerializer != null) {
|
|
27347
27517
|
if (utils_default.isFunction(paramsSerializer)) {
|
|
@@ -27349,10 +27519,14 @@ var Axios = class {
|
|
|
27349
27519
|
serialize: paramsSerializer
|
|
27350
27520
|
};
|
|
27351
27521
|
} else {
|
|
27352
|
-
validator_default.assertOptions(
|
|
27353
|
-
|
|
27354
|
-
|
|
27355
|
-
|
|
27522
|
+
validator_default.assertOptions(
|
|
27523
|
+
paramsSerializer,
|
|
27524
|
+
{
|
|
27525
|
+
encode: validators2.function,
|
|
27526
|
+
serialize: validators2.function
|
|
27527
|
+
},
|
|
27528
|
+
true
|
|
27529
|
+
);
|
|
27356
27530
|
}
|
|
27357
27531
|
}
|
|
27358
27532
|
if (config.allowAbsoluteUrls !== void 0) {
|
|
@@ -27361,21 +27535,19 @@ var Axios = class {
|
|
|
27361
27535
|
} else {
|
|
27362
27536
|
config.allowAbsoluteUrls = true;
|
|
27363
27537
|
}
|
|
27364
|
-
validator_default.assertOptions(
|
|
27365
|
-
|
|
27366
|
-
|
|
27367
|
-
|
|
27368
|
-
|
|
27369
|
-
|
|
27370
|
-
|
|
27371
|
-
headers[config.method]
|
|
27372
|
-
);
|
|
27373
|
-
headers && utils_default.forEach(
|
|
27374
|
-
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
27375
|
-
(method) => {
|
|
27376
|
-
delete headers[method];
|
|
27377
|
-
}
|
|
27538
|
+
validator_default.assertOptions(
|
|
27539
|
+
config,
|
|
27540
|
+
{
|
|
27541
|
+
baseUrl: validators2.spelling("baseURL"),
|
|
27542
|
+
withXsrfToken: validators2.spelling("withXSRFToken")
|
|
27543
|
+
},
|
|
27544
|
+
true
|
|
27378
27545
|
);
|
|
27546
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
27547
|
+
let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
|
|
27548
|
+
headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
|
|
27549
|
+
delete headers[method];
|
|
27550
|
+
});
|
|
27379
27551
|
config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
|
|
27380
27552
|
const requestInterceptorChain = [];
|
|
27381
27553
|
let synchronousRequestInterceptors = true;
|
|
@@ -27384,7 +27556,13 @@ var Axios = class {
|
|
|
27384
27556
|
return;
|
|
27385
27557
|
}
|
|
27386
27558
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
27387
|
-
|
|
27559
|
+
const transitional3 = config.transitional || transitional_default;
|
|
27560
|
+
const legacyInterceptorReqResOrdering = transitional3 && transitional3.legacyInterceptorReqResOrdering;
|
|
27561
|
+
if (legacyInterceptorReqResOrdering) {
|
|
27562
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
27563
|
+
} else {
|
|
27564
|
+
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
27565
|
+
}
|
|
27388
27566
|
});
|
|
27389
27567
|
const responseInterceptorChain = [];
|
|
27390
27568
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
@@ -27436,24 +27614,28 @@ var Axios = class {
|
|
|
27436
27614
|
};
|
|
27437
27615
|
utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
27438
27616
|
Axios.prototype[method] = function(url, config) {
|
|
27439
|
-
return this.request(
|
|
27440
|
-
|
|
27441
|
-
|
|
27442
|
-
|
|
27443
|
-
|
|
27617
|
+
return this.request(
|
|
27618
|
+
mergeConfig(config || {}, {
|
|
27619
|
+
method,
|
|
27620
|
+
url,
|
|
27621
|
+
data: (config || {}).data
|
|
27622
|
+
})
|
|
27623
|
+
);
|
|
27444
27624
|
};
|
|
27445
27625
|
});
|
|
27446
27626
|
utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
27447
27627
|
function generateHTTPMethod(isForm) {
|
|
27448
27628
|
return function httpMethod(url, data, config) {
|
|
27449
|
-
return this.request(
|
|
27450
|
-
|
|
27451
|
-
|
|
27452
|
-
|
|
27453
|
-
|
|
27454
|
-
|
|
27455
|
-
|
|
27456
|
-
|
|
27629
|
+
return this.request(
|
|
27630
|
+
mergeConfig(config || {}, {
|
|
27631
|
+
method,
|
|
27632
|
+
headers: isForm ? {
|
|
27633
|
+
"Content-Type": "multipart/form-data"
|
|
27634
|
+
} : {},
|
|
27635
|
+
url,
|
|
27636
|
+
data
|
|
27637
|
+
})
|
|
27638
|
+
);
|
|
27457
27639
|
};
|
|
27458
27640
|
}
|
|
27459
27641
|
Axios.prototype[method] = generateHTTPMethod();
|
|
@@ -27635,7 +27817,13 @@ var HttpStatusCode = {
|
|
|
27635
27817
|
InsufficientStorage: 507,
|
|
27636
27818
|
LoopDetected: 508,
|
|
27637
27819
|
NotExtended: 510,
|
|
27638
|
-
NetworkAuthenticationRequired: 511
|
|
27820
|
+
NetworkAuthenticationRequired: 511,
|
|
27821
|
+
WebServerIsDown: 521,
|
|
27822
|
+
ConnectionTimedOut: 522,
|
|
27823
|
+
OriginIsUnreachable: 523,
|
|
27824
|
+
TimeoutOccurred: 524,
|
|
27825
|
+
SslHandshakeFailed: 525,
|
|
27826
|
+
InvalidSslCertificate: 526
|
|
27639
27827
|
};
|
|
27640
27828
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
27641
27829
|
HttpStatusCode[value] = key;
|
|
@@ -27691,7 +27879,7 @@ var {
|
|
|
27691
27879
|
AxiosHeaders: AxiosHeaders2,
|
|
27692
27880
|
HttpStatusCode: HttpStatusCode2,
|
|
27693
27881
|
formToJSON,
|
|
27694
|
-
getAdapter,
|
|
27882
|
+
getAdapter: getAdapter2,
|
|
27695
27883
|
mergeConfig: mergeConfig2
|
|
27696
27884
|
} = axios_default;
|
|
27697
27885
|
|
|
@@ -28748,7 +28936,7 @@ var OrderApi = class {
|
|
|
28748
28936
|
async getOrderBookOrders(params) {
|
|
28749
28937
|
const response = await this.client.get("/api/v1/orderBookOrders", {
|
|
28750
28938
|
market_id: params.market_id,
|
|
28751
|
-
...params.depth !== void 0 ? {
|
|
28939
|
+
...(params.limit ?? params.depth) !== void 0 ? { limit: params.limit ?? params.depth } : {}
|
|
28752
28940
|
});
|
|
28753
28941
|
return response.data;
|
|
28754
28942
|
}
|
|
@@ -29865,6 +30053,9 @@ var WasmSignerClient = class {
|
|
|
29865
30053
|
signUpdatePublicPool: global.SignUpdatePublicPool || global.signUpdatePublicPool || global.lighterWasmFunctions?.signUpdatePublicPool,
|
|
29866
30054
|
signMintShares: global.SignMintShares || global.signMintShares || global.lighterWasmFunctions?.signMintShares,
|
|
29867
30055
|
signBurnShares: global.SignBurnShares || global.signBurnShares || global.lighterWasmFunctions?.signBurnShares,
|
|
30056
|
+
signStakeAssets: global.SignStakeAssets || global.signStakeAssets || global.lighterWasmFunctions?.signStakeAssets,
|
|
30057
|
+
signUnstakeAssets: global.SignUnstakeAssets || global.signUnstakeAssets || global.lighterWasmFunctions?.signUnstakeAssets,
|
|
30058
|
+
signApproveIntegrator: global.SignApproveIntegrator || global.signApproveIntegrator || global.lighterWasmFunctions?.signApproveIntegrator,
|
|
29868
30059
|
signCreateGroupedOrders: global.SignCreateGroupedOrders || global.signCreateGroupedOrders || global.lighterWasmFunctions?.signCreateGroupedOrders,
|
|
29869
30060
|
// Note: SwitchAPIKey is not exported from lighter-go WASM - use CreateClient with different apiKeyIndex instead
|
|
29870
30061
|
switchAPIKey: global.SwitchAPIKey || global.switchAPIKey || global.lighterWasmFunctions?.switchAPIKey || void 0
|
|
@@ -29941,7 +30132,13 @@ var WasmSignerClient = class {
|
|
|
29941
30132
|
await this.ensureInitialized();
|
|
29942
30133
|
const apiKeyIndex = params.apiKeyIndex ?? 0;
|
|
29943
30134
|
const accountIndex = params.accountIndex ?? 0;
|
|
29944
|
-
|
|
30135
|
+
let result = this.wasmModule.signCreateOrder(params.marketIndex, params.clientOrderIndex, params.baseAmount, params.price, params.isAsk, params.orderType, params.timeInForce, params.reduceOnly, params.triggerPrice, params.orderExpiry, params.integratorAccountIndex ?? 0, params.integratorTakerFee ?? 0, params.integratorMakerFee ?? 0, params.skipNonce ?? 0, params.nonce, apiKeyIndex, accountIndex);
|
|
30136
|
+
if (result?.error && String(result.error).includes("expects 16 args")) {
|
|
30137
|
+
result = this.wasmModule.signCreateOrder(params.marketIndex, params.clientOrderIndex, params.baseAmount, params.price, params.isAsk, params.orderType, params.timeInForce, params.reduceOnly, params.triggerPrice, params.orderExpiry, params.integratorAccountIndex ?? 0, params.integratorTakerFee ?? 0, params.integratorMakerFee ?? 0, params.nonce, apiKeyIndex, accountIndex);
|
|
30138
|
+
}
|
|
30139
|
+
if (result?.error && String(result.error).includes("expects 13 args")) {
|
|
30140
|
+
result = this.wasmModule.signCreateOrder(params.marketIndex, params.clientOrderIndex, params.baseAmount, params.price, params.isAsk, params.orderType, params.timeInForce, params.reduceOnly, params.triggerPrice, params.orderExpiry, params.nonce, apiKeyIndex, accountIndex);
|
|
30141
|
+
}
|
|
29945
30142
|
if (result.error) {
|
|
29946
30143
|
return { txType: 0, txInfo: "", txHash: "", error: result.error };
|
|
29947
30144
|
}
|
|
@@ -29959,7 +30156,10 @@ var WasmSignerClient = class {
|
|
|
29959
30156
|
*/
|
|
29960
30157
|
async signCancelOrder(params) {
|
|
29961
30158
|
await this.ensureInitialized();
|
|
29962
|
-
|
|
30159
|
+
let result = this.wasmModule.signCancelOrder(params.marketIndex, params.orderIndex, params.skipNonce ?? 0, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30160
|
+
if (result?.error && String(result.error).includes("expects 5 args")) {
|
|
30161
|
+
result = this.wasmModule.signCancelOrder(params.marketIndex, params.orderIndex, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30162
|
+
}
|
|
29963
30163
|
if (result.error) {
|
|
29964
30164
|
return { txType: 0, txInfo: "", txHash: "", error: result.error };
|
|
29965
30165
|
}
|
|
@@ -29988,7 +30188,10 @@ var WasmSignerClient = class {
|
|
|
29988
30188
|
*/
|
|
29989
30189
|
async signCancelAllOrders(params) {
|
|
29990
30190
|
await this.ensureInitialized();
|
|
29991
|
-
|
|
30191
|
+
let result = this.wasmModule.signCancelAllOrders(params.timeInForce, params.time, params.skipNonce ?? 0, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30192
|
+
if (result?.error && String(result.error).includes("expects 5 args")) {
|
|
30193
|
+
result = this.wasmModule.signCancelAllOrders(params.timeInForce, params.time, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30194
|
+
}
|
|
29992
30195
|
if (result.error) {
|
|
29993
30196
|
return { txType: 0, txInfo: "", txHash: "", error: result.error };
|
|
29994
30197
|
}
|
|
@@ -30102,7 +30305,13 @@ var WasmSignerClient = class {
|
|
|
30102
30305
|
*/
|
|
30103
30306
|
async signModifyOrder(params) {
|
|
30104
30307
|
await this.ensureInitialized();
|
|
30105
|
-
|
|
30308
|
+
let result = this.wasmModule.signModifyOrder(params.marketIndex, params.index, params.baseAmount, params.price, params.triggerPrice, params.integratorAccountIndex ?? 0, params.integratorTakerFee ?? 0, params.integratorMakerFee ?? 0, params.skipNonce ?? 0, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30309
|
+
if (result?.error && String(result.error).includes("expects 11 args")) {
|
|
30310
|
+
result = this.wasmModule.signModifyOrder(params.marketIndex, params.index, params.baseAmount, params.price, params.triggerPrice, params.integratorAccountIndex ?? 0, params.integratorTakerFee ?? 0, params.integratorMakerFee ?? 0, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30311
|
+
}
|
|
30312
|
+
if (result?.error && String(result.error).includes("expects 8 args")) {
|
|
30313
|
+
result = this.wasmModule.signModifyOrder(params.marketIndex, params.index, params.baseAmount, params.price, params.triggerPrice, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30314
|
+
}
|
|
30106
30315
|
if (result.error) {
|
|
30107
30316
|
return { txType: 0, txInfo: "", txHash: "", error: result.error };
|
|
30108
30317
|
}
|
|
@@ -30222,6 +30431,63 @@ var WasmSignerClient = class {
|
|
|
30222
30431
|
messageToSign: result.messageToSign
|
|
30223
30432
|
};
|
|
30224
30433
|
}
|
|
30434
|
+
/**
|
|
30435
|
+
* Sign a stake assets transaction
|
|
30436
|
+
* Returns composite response with txType, txInfo, txHash
|
|
30437
|
+
*/
|
|
30438
|
+
async signStakeAssets(params) {
|
|
30439
|
+
await this.ensureInitialized();
|
|
30440
|
+
const result = this.wasmModule.signStakeAssets(params.stakingPoolIndex, params.shareAmount, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30441
|
+
if (result.error) {
|
|
30442
|
+
return { txType: 0, txInfo: "", txHash: "", error: result.error };
|
|
30443
|
+
}
|
|
30444
|
+
return {
|
|
30445
|
+
txType: result.txType ?? 35,
|
|
30446
|
+
// Default to STAKE_ASSETS
|
|
30447
|
+
txInfo: result.txInfo ?? "",
|
|
30448
|
+
txHash: result.txHash ?? "",
|
|
30449
|
+
messageToSign: result.messageToSign
|
|
30450
|
+
};
|
|
30451
|
+
}
|
|
30452
|
+
/**
|
|
30453
|
+
* Sign an unstake assets transaction
|
|
30454
|
+
* Returns composite response with txType, txInfo, txHash
|
|
30455
|
+
*/
|
|
30456
|
+
async signUnstakeAssets(params) {
|
|
30457
|
+
await this.ensureInitialized();
|
|
30458
|
+
const result = this.wasmModule.signUnstakeAssets(params.stakingPoolIndex, params.shareAmount, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30459
|
+
if (result.error) {
|
|
30460
|
+
return { txType: 0, txInfo: "", txHash: "", error: result.error };
|
|
30461
|
+
}
|
|
30462
|
+
return {
|
|
30463
|
+
txType: result.txType ?? 36,
|
|
30464
|
+
// Default to UNSTAKE_ASSETS
|
|
30465
|
+
txInfo: result.txInfo ?? "",
|
|
30466
|
+
txHash: result.txHash ?? "",
|
|
30467
|
+
messageToSign: result.messageToSign
|
|
30468
|
+
};
|
|
30469
|
+
}
|
|
30470
|
+
/**
|
|
30471
|
+
* Sign an approve integrator transaction
|
|
30472
|
+
* Returns composite response with txType, txInfo, txHash, messageToSign
|
|
30473
|
+
*/
|
|
30474
|
+
async signApproveIntegrator(params) {
|
|
30475
|
+
await this.ensureInitialized();
|
|
30476
|
+
let result = this.wasmModule.signApproveIntegrator(params.integratorIndex, params.maxPerpsTakerFee, params.maxPerpsMakerFee, params.maxSpotTakerFee, params.maxSpotMakerFee, params.approvalExpiry, params.skipNonce ?? 0, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30477
|
+
if (result?.error && String(result.error).includes("expects 9 args")) {
|
|
30478
|
+
result = this.wasmModule.signApproveIntegrator(params.integratorIndex, params.maxPerpsTakerFee, params.maxPerpsMakerFee, params.maxSpotTakerFee, params.maxSpotMakerFee, params.approvalExpiry, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30479
|
+
}
|
|
30480
|
+
if (result.error) {
|
|
30481
|
+
return { txType: 0, txInfo: "", txHash: "", error: result.error };
|
|
30482
|
+
}
|
|
30483
|
+
return {
|
|
30484
|
+
txType: result.txType ?? 45,
|
|
30485
|
+
// Default to APPROVE_INTEGRATOR
|
|
30486
|
+
txInfo: result.txInfo ?? "",
|
|
30487
|
+
txHash: result.txHash ?? "",
|
|
30488
|
+
messageToSign: result.messageToSign
|
|
30489
|
+
};
|
|
30490
|
+
}
|
|
30225
30491
|
/**
|
|
30226
30492
|
* Switch active API key
|
|
30227
30493
|
* Note: This function is not exported from lighter-go WASM.
|
|
@@ -30260,9 +30526,15 @@ var WasmSignerClient = class {
|
|
|
30260
30526
|
TimeInForce: order.timeInForce,
|
|
30261
30527
|
ReduceOnly: order.reduceOnly,
|
|
30262
30528
|
TriggerPrice: order.triggerPrice,
|
|
30263
|
-
OrderExpiry: order.orderExpiry
|
|
30529
|
+
OrderExpiry: order.orderExpiry,
|
|
30530
|
+
IntegratorAccountIndex: order.integratorAccountIndex ?? 0,
|
|
30531
|
+
IntegratorTakerFee: order.integratorTakerFee ?? 0,
|
|
30532
|
+
IntegratorMakerFee: order.integratorMakerFee ?? 0
|
|
30264
30533
|
}));
|
|
30265
|
-
|
|
30534
|
+
let result = this.wasmModule.signCreateGroupedOrders(params.groupingType, ordersArray, params.integratorAccountIndex ?? 0, params.integratorTakerFee ?? 0, params.integratorMakerFee ?? 0, params.skipNonce ?? 0, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30535
|
+
if (result?.error && String(result.error).includes("expects 5 args")) {
|
|
30536
|
+
result = this.wasmModule.signCreateGroupedOrders(params.groupingType, ordersArray, params.nonce, params.apiKeyIndex, params.accountIndex);
|
|
30537
|
+
}
|
|
30266
30538
|
if (result.error) {
|
|
30267
30539
|
return { txType: 0, txInfo: "", txHash: "", error: result.error };
|
|
30268
30540
|
}
|
|
@@ -30383,7 +30655,21 @@ var WasmSignerClient = class {
|
|
|
30383
30655
|
if (!path || !fs) {
|
|
30384
30656
|
return null;
|
|
30385
30657
|
}
|
|
30386
|
-
|
|
30658
|
+
const cwd = process.cwd();
|
|
30659
|
+
const localPackageJson = path.join(cwd, "package.json");
|
|
30660
|
+
const localWasmExec = path.join(cwd, "wasm", "wasm_exec.js");
|
|
30661
|
+
const localWasmBinary = path.join(cwd, "wasm", "lighter-signer.wasm");
|
|
30662
|
+
if (fs.existsSync(localPackageJson)) {
|
|
30663
|
+
try {
|
|
30664
|
+
const pkgRaw = fs.readFileSync(localPackageJson, "utf-8");
|
|
30665
|
+
const pkg = JSON.parse(pkgRaw);
|
|
30666
|
+
if (pkg.name === "lighter-ts-sdk" && (fs.existsSync(localWasmExec) || fs.existsSync(localWasmBinary))) {
|
|
30667
|
+
return cwd;
|
|
30668
|
+
}
|
|
30669
|
+
} catch {
|
|
30670
|
+
}
|
|
30671
|
+
}
|
|
30672
|
+
let currentDir = cwd;
|
|
30387
30673
|
const maxDepth = 10;
|
|
30388
30674
|
let depth = 0;
|
|
30389
30675
|
while (currentDir && depth < maxDepth) {
|
|
@@ -30394,9 +30680,6 @@ var WasmSignerClient = class {
|
|
|
30394
30680
|
currentDir = path.dirname(currentDir);
|
|
30395
30681
|
depth++;
|
|
30396
30682
|
}
|
|
30397
|
-
const cwd = process.cwd();
|
|
30398
|
-
const localWasmExec = path.join(cwd, "wasm", "wasm_exec.js");
|
|
30399
|
-
const localWasmBinary = path.join(cwd, "wasm", "lighter-signer.wasm");
|
|
30400
30683
|
if (fs.existsSync(localWasmExec) || fs.existsSync(localWasmBinary)) {
|
|
30401
30684
|
return cwd;
|
|
30402
30685
|
}
|
|
@@ -31328,6 +31611,9 @@ var TransactionType;
|
|
|
31328
31611
|
TransactionType2[TransactionType2["UPDATE_LEVERAGE"] = 20] = "UPDATE_LEVERAGE";
|
|
31329
31612
|
TransactionType2[TransactionType2["CREATE_GROUPED_ORDERS"] = 28] = "CREATE_GROUPED_ORDERS";
|
|
31330
31613
|
TransactionType2[TransactionType2["UPDATE_MARGIN"] = 29] = "UPDATE_MARGIN";
|
|
31614
|
+
TransactionType2[TransactionType2["STAKE_ASSETS"] = 35] = "STAKE_ASSETS";
|
|
31615
|
+
TransactionType2[TransactionType2["UNSTAKE_ASSETS"] = 36] = "UNSTAKE_ASSETS";
|
|
31616
|
+
TransactionType2[TransactionType2["APPROVE_INTEGRATOR"] = 45] = "APPROVE_INTEGRATOR";
|
|
31331
31617
|
})(TransactionType || (TransactionType = {}));
|
|
31332
31618
|
var SignerClient = class _SignerClient {
|
|
31333
31619
|
/**
|
|
@@ -31640,7 +31926,7 @@ var SignerClient = class _SignerClient {
|
|
|
31640
31926
|
try {
|
|
31641
31927
|
if (this.config.enableWebSocket && this.wsOrderClient?.isReady()) {
|
|
31642
31928
|
try {
|
|
31643
|
-
const nextNonce = params.nonce === void 0 || params.nonce === -1 ? await this.getNextNonce() : { nonce: params.nonce };
|
|
31929
|
+
const nextNonce = params.skipNonce || params.nonce === 0 ? { nonce: params.nonce ?? 0 } : params.nonce === void 0 || params.nonce === -1 ? await this.getNextNonce() : { nonce: params.nonce };
|
|
31644
31930
|
const nonce = nextNonce.nonce;
|
|
31645
31931
|
let orderExpiry = params.orderExpiry ?? _SignerClient.DEFAULT_28_DAY_ORDER_EXPIRY;
|
|
31646
31932
|
if (orderExpiry === void 0 || orderExpiry === -1 || orderExpiry === _SignerClient.DEFAULT_28_DAY_ORDER_EXPIRY) {
|
|
@@ -31666,6 +31952,10 @@ var SignerClient = class _SignerClient {
|
|
|
31666
31952
|
reduceOnly: params.reduceOnly ? 1 : 0,
|
|
31667
31953
|
triggerPrice: params.triggerPrice !== void 0 ? params.triggerPrice : _SignerClient.NIL_TRIGGER_PRICE,
|
|
31668
31954
|
orderExpiry: wasmOrderExpiry,
|
|
31955
|
+
integratorAccountIndex: params.integratorAccountIndex ?? 0,
|
|
31956
|
+
integratorTakerFee: params.integratorTakerFee ?? 0,
|
|
31957
|
+
integratorMakerFee: params.integratorMakerFee ?? 0,
|
|
31958
|
+
skipNonce: params.skipNonce ? 1 : 0,
|
|
31669
31959
|
nonce,
|
|
31670
31960
|
apiKeyIndex: this.config.apiKeyIndex,
|
|
31671
31961
|
accountIndex: this.config.accountIndex
|
|
@@ -31694,7 +31984,7 @@ var SignerClient = class _SignerClient {
|
|
|
31694
31984
|
});
|
|
31695
31985
|
}
|
|
31696
31986
|
async createOrderOptimized(params) {
|
|
31697
|
-
const nextNonce = params.nonce === void 0 || params.nonce === -1 ? await this.getNextNonce() : { nonce: params.nonce };
|
|
31987
|
+
const nextNonce = params.skipNonce || params.nonce === 0 ? { nonce: params.nonce ?? 0 } : params.nonce === void 0 || params.nonce === -1 ? await this.getNextNonce() : { nonce: params.nonce };
|
|
31698
31988
|
let orderExpiry = params.orderExpiry ?? _SignerClient.DEFAULT_28_DAY_ORDER_EXPIRY;
|
|
31699
31989
|
if (orderExpiry === void 0 || orderExpiry === -1 || orderExpiry === _SignerClient.DEFAULT_28_DAY_ORDER_EXPIRY) {
|
|
31700
31990
|
orderExpiry = Date.now() + 28 * 24 * 60 * 60 * 1e3;
|
|
@@ -31719,6 +32009,10 @@ var SignerClient = class _SignerClient {
|
|
|
31719
32009
|
reduceOnly: params.reduceOnly || false ? 1 : 0,
|
|
31720
32010
|
triggerPrice: params.triggerPrice !== void 0 ? params.triggerPrice : _SignerClient.NIL_TRIGGER_PRICE,
|
|
31721
32011
|
orderExpiry: wasmOrderExpiry,
|
|
32012
|
+
integratorAccountIndex: params.integratorAccountIndex ?? 0,
|
|
32013
|
+
integratorTakerFee: params.integratorTakerFee ?? 0,
|
|
32014
|
+
integratorMakerFee: params.integratorMakerFee ?? 0,
|
|
32015
|
+
skipNonce: params.skipNonce ? 1 : 0,
|
|
31722
32016
|
nonce: nextNonce.nonce,
|
|
31723
32017
|
apiKeyIndex: this.config.apiKeyIndex,
|
|
31724
32018
|
accountIndex: this.config.accountIndex
|
|
@@ -31791,7 +32085,7 @@ var SignerClient = class _SignerClient {
|
|
|
31791
32085
|
}
|
|
31792
32086
|
async createMarketOrder(params) {
|
|
31793
32087
|
try {
|
|
31794
|
-
const nextNonce = params.nonce === void 0 || params.nonce === -1 ? await this.getNextNonce() : { nonce: params.nonce };
|
|
32088
|
+
const nextNonce = params.skipNonce || params.nonce === 0 ? { nonce: params.nonce ?? 0 } : params.nonce === void 0 || params.nonce === -1 ? await this.getNextNonce() : { nonce: params.nonce };
|
|
31795
32089
|
const wasmParams = {
|
|
31796
32090
|
marketIndex: params.marketIndex,
|
|
31797
32091
|
clientOrderIndex: params.clientOrderIndex,
|
|
@@ -31804,6 +32098,10 @@ var SignerClient = class _SignerClient {
|
|
|
31804
32098
|
triggerPrice: _SignerClient.NIL_TRIGGER_PRICE,
|
|
31805
32099
|
orderExpiry: 0,
|
|
31806
32100
|
// NilOrderExpiry for market orders
|
|
32101
|
+
integratorAccountIndex: params.integratorAccountIndex ?? 0,
|
|
32102
|
+
integratorTakerFee: params.integratorTakerFee ?? 0,
|
|
32103
|
+
integratorMakerFee: params.integratorMakerFee ?? 0,
|
|
32104
|
+
skipNonce: params.skipNonce ? 1 : 0,
|
|
31807
32105
|
nonce: nextNonce.nonce,
|
|
31808
32106
|
apiKeyIndex: this.config.apiKeyIndex,
|
|
31809
32107
|
accountIndex: this.config.accountIndex
|
|
@@ -31840,7 +32138,7 @@ var SignerClient = class _SignerClient {
|
|
|
31840
32138
|
return Number.isFinite(parsed) ? Math.floor(parsed) : 0;
|
|
31841
32139
|
}
|
|
31842
32140
|
async getBestPrice(marketIndex, isAsk, obOrders) {
|
|
31843
|
-
const orderBook = obOrders || await this.orderApi.getOrderBookOrders({ market_id: marketIndex,
|
|
32141
|
+
const orderBook = obOrders || await this.orderApi.getOrderBookOrders({ market_id: marketIndex, limit: 1 });
|
|
31844
32142
|
const side = isAsk ? orderBook?.bids || [] : orderBook?.asks || [];
|
|
31845
32143
|
if (!side.length) {
|
|
31846
32144
|
throw new Error("Order book has no liquidity on required side");
|
|
@@ -31848,7 +32146,7 @@ var SignerClient = class _SignerClient {
|
|
|
31848
32146
|
return this.parseOrderBookInt(side[0]?.price);
|
|
31849
32147
|
}
|
|
31850
32148
|
async getPotentialExecutionPrice(marketIndex, amount, isAsk, isAmountBase = true, obOrders) {
|
|
31851
|
-
const orderBook = obOrders || await this.orderApi.getOrderBookOrders({ market_id: marketIndex,
|
|
32149
|
+
const orderBook = obOrders || await this.orderApi.getOrderBookOrders({ market_id: marketIndex, limit: 100 });
|
|
31852
32150
|
const side = isAsk ? orderBook?.bids || [] : orderBook?.asks || [];
|
|
31853
32151
|
let matchedUsdAmount = 0;
|
|
31854
32152
|
let matchedSize = 0;
|
|
@@ -31878,7 +32176,7 @@ var SignerClient = class _SignerClient {
|
|
|
31878
32176
|
async createMarketOrder_quoteAmount(params) {
|
|
31879
32177
|
try {
|
|
31880
32178
|
const quoteAmount = Math.floor(params.quoteAmount * 1e6);
|
|
31881
|
-
const obOrders = await this.orderApi.getOrderBookOrders({ market_id: params.marketIndex,
|
|
32179
|
+
const obOrders = await this.orderApi.getOrderBookOrders({ market_id: params.marketIndex, limit: 100 });
|
|
31882
32180
|
const idealPrice = params.idealPrice ?? await this.getBestPrice(params.marketIndex, params.isAsk, obOrders);
|
|
31883
32181
|
const acceptableExecutionPrice = Math.round(idealPrice * (1 + params.maxSlippage * (params.isAsk ? -1 : 1)));
|
|
31884
32182
|
const [potentialExecutionPrice, matchedUsdAmount] = await this.getPotentialExecutionPrice(params.marketIndex, quoteAmount, params.isAsk, false, obOrders);
|
|
@@ -31959,10 +32257,11 @@ var SignerClient = class _SignerClient {
|
|
|
31959
32257
|
async cancelOrder(params) {
|
|
31960
32258
|
return await this.processTransactionWithRetry(async () => {
|
|
31961
32259
|
try {
|
|
31962
|
-
const nextNonce = params.nonce === void 0 || params.nonce === -1 ? await this.getNextNonce() : { nonce: params.nonce };
|
|
32260
|
+
const nextNonce = params.skipNonce || params.nonce === 0 ? { nonce: params.nonce ?? 0 } : params.nonce === void 0 || params.nonce === -1 ? await this.getNextNonce() : { nonce: params.nonce };
|
|
31963
32261
|
const wasmParams = {
|
|
31964
32262
|
marketIndex: params.marketIndex,
|
|
31965
32263
|
orderIndex: params.orderIndex,
|
|
32264
|
+
skipNonce: params.skipNonce ? 1 : 0,
|
|
31966
32265
|
nonce: nextNonce.nonce,
|
|
31967
32266
|
apiKeyIndex: this.config.apiKeyIndex,
|
|
31968
32267
|
accountIndex: this.config.accountIndex
|
|
@@ -32337,16 +32636,20 @@ var SignerClient = class _SignerClient {
|
|
|
32337
32636
|
* @param nonce - Optional nonce (will be fetched automatically if not provided)
|
|
32338
32637
|
* @returns Promise resolving to [orderInfo, transactionHash, error]
|
|
32339
32638
|
*/
|
|
32340
|
-
async modifyOrder(marketIndex, orderIndex, baseAmount, price, triggerPrice, nonce = -1) {
|
|
32639
|
+
async modifyOrder(marketIndex, orderIndex, baseAmount, price, triggerPrice, nonce = -1, options) {
|
|
32341
32640
|
return await this.processTransactionWithRetry(async () => {
|
|
32342
32641
|
try {
|
|
32343
|
-
const nextNonce = nonce === -1 ? await this.getNextNonce() : { nonce };
|
|
32642
|
+
const nextNonce = options?.skipNonce || nonce === 0 ? { nonce: nonce === -1 ? 0 : nonce } : nonce === -1 ? await this.getNextNonce() : { nonce };
|
|
32344
32643
|
const wasmResponse = await this.wallet.signModifyOrder({
|
|
32345
32644
|
marketIndex,
|
|
32346
32645
|
index: orderIndex,
|
|
32347
32646
|
baseAmount,
|
|
32348
32647
|
price,
|
|
32349
32648
|
triggerPrice,
|
|
32649
|
+
integratorAccountIndex: options?.integratorAccountIndex ?? 0,
|
|
32650
|
+
integratorTakerFee: options?.integratorTakerFee ?? 0,
|
|
32651
|
+
integratorMakerFee: options?.integratorMakerFee ?? 0,
|
|
32652
|
+
skipNonce: options?.skipNonce ? 1 : 0,
|
|
32350
32653
|
nonce: nextNonce.nonce,
|
|
32351
32654
|
apiKeyIndex: this.config.apiKeyIndex,
|
|
32352
32655
|
accountIndex: this.config.accountIndex
|
|
@@ -32704,6 +33007,113 @@ var SignerClient = class _SignerClient {
|
|
|
32704
33007
|
}
|
|
32705
33008
|
});
|
|
32706
33009
|
}
|
|
33010
|
+
/**
|
|
33011
|
+
* Stake assets in a staking pool
|
|
33012
|
+
* @param stakingPoolIndex - Staking pool index
|
|
33013
|
+
* @param shareAmount - Amount of shares to stake
|
|
33014
|
+
* @param nonce - Optional nonce (will be fetched automatically if not provided)
|
|
33015
|
+
* @returns Promise resolving to [stakeInfo, transactionHash, error]
|
|
33016
|
+
*/
|
|
33017
|
+
async stakeAssets(stakingPoolIndex, shareAmount, nonce = -1) {
|
|
33018
|
+
return await this.processTransactionWithRetry(async () => {
|
|
33019
|
+
try {
|
|
33020
|
+
const nextNonce = nonce === -1 ? await this.getNextNonce() : { nonce };
|
|
33021
|
+
const wasmResponse = await this.wallet.signStakeAssets({
|
|
33022
|
+
stakingPoolIndex,
|
|
33023
|
+
shareAmount,
|
|
33024
|
+
nonce: nextNonce.nonce,
|
|
33025
|
+
apiKeyIndex: this.config.apiKeyIndex,
|
|
33026
|
+
accountIndex: this.config.accountIndex
|
|
33027
|
+
});
|
|
33028
|
+
if (wasmResponse.error) {
|
|
33029
|
+
return [null, "", wasmResponse.error];
|
|
33030
|
+
}
|
|
33031
|
+
const txHash = await this.transactionApi.sendTxWithIndices(wasmResponse.txType || _SignerClient.TX_TYPE_STAKE_ASSETS, wasmResponse.txInfo, this.config.accountIndex, this.config.apiKeyIndex);
|
|
33032
|
+
if (txHash.code && txHash.code !== 200) {
|
|
33033
|
+
this.acknowledgeFailure();
|
|
33034
|
+
return [null, "", txHash.message || "Transaction failed"];
|
|
33035
|
+
}
|
|
33036
|
+
return [JSON.parse(wasmResponse.txInfo), txHash.tx_hash || txHash.hash || wasmResponse.txHash || "", null];
|
|
33037
|
+
} catch (error) {
|
|
33038
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
33039
|
+
return [null, "", errorMessage];
|
|
33040
|
+
}
|
|
33041
|
+
});
|
|
33042
|
+
}
|
|
33043
|
+
/**
|
|
33044
|
+
* Unstake assets from a staking pool
|
|
33045
|
+
* @param stakingPoolIndex - Staking pool index
|
|
33046
|
+
* @param shareAmount - Amount of shares to unstake
|
|
33047
|
+
* @param nonce - Optional nonce (will be fetched automatically if not provided)
|
|
33048
|
+
* @returns Promise resolving to [unstakeInfo, transactionHash, error]
|
|
33049
|
+
*/
|
|
33050
|
+
async unstakeAssets(stakingPoolIndex, shareAmount, nonce = -1) {
|
|
33051
|
+
return await this.processTransactionWithRetry(async () => {
|
|
33052
|
+
try {
|
|
33053
|
+
const nextNonce = nonce === -1 ? await this.getNextNonce() : { nonce };
|
|
33054
|
+
const wasmResponse = await this.wallet.signUnstakeAssets({
|
|
33055
|
+
stakingPoolIndex,
|
|
33056
|
+
shareAmount,
|
|
33057
|
+
nonce: nextNonce.nonce,
|
|
33058
|
+
apiKeyIndex: this.config.apiKeyIndex,
|
|
33059
|
+
accountIndex: this.config.accountIndex
|
|
33060
|
+
});
|
|
33061
|
+
if (wasmResponse.error) {
|
|
33062
|
+
return [null, "", wasmResponse.error];
|
|
33063
|
+
}
|
|
33064
|
+
const txHash = await this.transactionApi.sendTxWithIndices(wasmResponse.txType || _SignerClient.TX_TYPE_UNSTAKE_ASSETS, wasmResponse.txInfo, this.config.accountIndex, this.config.apiKeyIndex);
|
|
33065
|
+
if (txHash.code && txHash.code !== 200) {
|
|
33066
|
+
this.acknowledgeFailure();
|
|
33067
|
+
return [null, "", txHash.message || "Transaction failed"];
|
|
33068
|
+
}
|
|
33069
|
+
return [JSON.parse(wasmResponse.txInfo), txHash.tx_hash || txHash.hash || wasmResponse.txHash || "", null];
|
|
33070
|
+
} catch (error) {
|
|
33071
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
33072
|
+
return [null, "", errorMessage];
|
|
33073
|
+
}
|
|
33074
|
+
});
|
|
33075
|
+
}
|
|
33076
|
+
/**
|
|
33077
|
+
* Approve an integrator with fee caps and expiry
|
|
33078
|
+
* @param integratorIndex - Integrator account index
|
|
33079
|
+
* @param maxPerpsTakerFee - Max perps taker fee
|
|
33080
|
+
* @param maxPerpsMakerFee - Max perps maker fee
|
|
33081
|
+
* @param maxSpotTakerFee - Max spot taker fee
|
|
33082
|
+
* @param maxSpotMakerFee - Max spot maker fee
|
|
33083
|
+
* @param approvalExpiry - Approval expiry timestamp
|
|
33084
|
+
* @param nonce - Optional nonce (will be fetched automatically if not provided)
|
|
33085
|
+
* @returns Promise resolving to [approveInfo, transactionHash, error]
|
|
33086
|
+
*/
|
|
33087
|
+
async approveIntegrator(integratorIndex, maxPerpsTakerFee, maxPerpsMakerFee, maxSpotTakerFee, maxSpotMakerFee, approvalExpiry, nonce = -1) {
|
|
33088
|
+
return await this.processTransactionWithRetry(async () => {
|
|
33089
|
+
try {
|
|
33090
|
+
const nextNonce = nonce === -1 ? await this.getNextNonce() : { nonce };
|
|
33091
|
+
const wasmResponse = await this.wallet.signApproveIntegrator({
|
|
33092
|
+
integratorIndex,
|
|
33093
|
+
maxPerpsTakerFee,
|
|
33094
|
+
maxPerpsMakerFee,
|
|
33095
|
+
maxSpotTakerFee,
|
|
33096
|
+
maxSpotMakerFee,
|
|
33097
|
+
approvalExpiry,
|
|
33098
|
+
nonce: nextNonce.nonce,
|
|
33099
|
+
apiKeyIndex: this.config.apiKeyIndex,
|
|
33100
|
+
accountIndex: this.config.accountIndex
|
|
33101
|
+
});
|
|
33102
|
+
if (wasmResponse.error) {
|
|
33103
|
+
return [null, "", wasmResponse.error];
|
|
33104
|
+
}
|
|
33105
|
+
const txHash = await this.transactionApi.sendTxWithIndices(wasmResponse.txType || _SignerClient.TX_TYPE_APPROVE_INTEGRATOR, wasmResponse.txInfo, this.config.accountIndex, this.config.apiKeyIndex);
|
|
33106
|
+
if (txHash.code && txHash.code !== 200) {
|
|
33107
|
+
this.acknowledgeFailure();
|
|
33108
|
+
return [null, "", txHash.message || "Transaction failed"];
|
|
33109
|
+
}
|
|
33110
|
+
return [JSON.parse(wasmResponse.txInfo), txHash.tx_hash || txHash.hash || wasmResponse.txHash || "", null];
|
|
33111
|
+
} catch (error) {
|
|
33112
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
33113
|
+
return [null, "", errorMessage];
|
|
33114
|
+
}
|
|
33115
|
+
});
|
|
33116
|
+
}
|
|
32707
33117
|
/**
|
|
32708
33118
|
* Create OCO grouped orders (One Cancels Other)
|
|
32709
33119
|
* @param params - OCO order parameters (exactly two orders)
|
|
@@ -32723,9 +33133,17 @@ var SignerClient = class _SignerClient {
|
|
|
32723
33133
|
timeInForce: order.timeInForce ?? TimeInForce.GOOD_TILL_TIME,
|
|
32724
33134
|
reduceOnly: order.reduceOnly ?? false,
|
|
32725
33135
|
triggerPrice: order.triggerPrice ?? _SignerClient.NIL_TRIGGER_PRICE,
|
|
32726
|
-
orderExpiry: order.orderExpiry ?? _SignerClient.DEFAULT_28_DAY_ORDER_EXPIRY
|
|
33136
|
+
orderExpiry: order.orderExpiry ?? _SignerClient.DEFAULT_28_DAY_ORDER_EXPIRY,
|
|
33137
|
+
integratorAccountIndex: order.integratorAccountIndex ?? params.integratorAccountIndex ?? 0,
|
|
33138
|
+
integratorTakerFee: order.integratorTakerFee ?? params.integratorTakerFee ?? 0,
|
|
33139
|
+
integratorMakerFee: order.integratorMakerFee ?? params.integratorMakerFee ?? 0
|
|
32727
33140
|
}));
|
|
32728
|
-
const [tx, hash2, error] = await this.createGroupedOrders(GroupingType.OCO, orders, params.nonce ?? -1
|
|
33141
|
+
const [tx, hash2, error] = await this.createGroupedOrders(GroupingType.OCO, orders, params.nonce ?? -1, {
|
|
33142
|
+
...params.skipNonce !== void 0 && { skipNonce: params.skipNonce },
|
|
33143
|
+
...params.integratorAccountIndex !== void 0 && { integratorAccountIndex: params.integratorAccountIndex },
|
|
33144
|
+
...params.integratorTakerFee !== void 0 && { integratorTakerFee: params.integratorTakerFee },
|
|
33145
|
+
...params.integratorMakerFee !== void 0 && { integratorMakerFee: params.integratorMakerFee }
|
|
33146
|
+
});
|
|
32729
33147
|
return { tx, hash: hash2, error };
|
|
32730
33148
|
}
|
|
32731
33149
|
/**
|
|
@@ -32771,7 +33189,10 @@ var SignerClient = class _SignerClient {
|
|
|
32771
33189
|
timeInForce: isMarketMainOrder ? _SignerClient.ORDER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL : mainOrder.timeInForce ?? _SignerClient.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME,
|
|
32772
33190
|
reduceOnly: mainOrder.reduceOnly ?? false,
|
|
32773
33191
|
triggerPrice: _SignerClient.NIL_TRIGGER_PRICE,
|
|
32774
|
-
orderExpiry: mainExpiry
|
|
33192
|
+
orderExpiry: mainExpiry,
|
|
33193
|
+
integratorAccountIndex: mainOrder.integratorAccountIndex ?? params.integratorAccountIndex ?? 0,
|
|
33194
|
+
integratorTakerFee: mainOrder.integratorTakerFee ?? params.integratorTakerFee ?? 0,
|
|
33195
|
+
integratorMakerFee: mainOrder.integratorMakerFee ?? params.integratorMakerFee ?? 0
|
|
32775
33196
|
},
|
|
32776
33197
|
{
|
|
32777
33198
|
marketIndex: mainOrder.marketIndex,
|
|
@@ -32783,7 +33204,10 @@ var SignerClient = class _SignerClient {
|
|
|
32783
33204
|
timeInForce: takeProfit.isLimit ? _SignerClient.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME : _SignerClient.ORDER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL,
|
|
32784
33205
|
reduceOnly: true,
|
|
32785
33206
|
triggerPrice: takeProfit.triggerPrice,
|
|
32786
|
-
orderExpiry: takeProfit.orderExpiry ?? protectionExpiryDefault
|
|
33207
|
+
orderExpiry: takeProfit.orderExpiry ?? protectionExpiryDefault,
|
|
33208
|
+
integratorAccountIndex: takeProfit.integratorAccountIndex ?? params.integratorAccountIndex ?? 0,
|
|
33209
|
+
integratorTakerFee: takeProfit.integratorTakerFee ?? params.integratorTakerFee ?? 0,
|
|
33210
|
+
integratorMakerFee: takeProfit.integratorMakerFee ?? params.integratorMakerFee ?? 0
|
|
32787
33211
|
},
|
|
32788
33212
|
{
|
|
32789
33213
|
marketIndex: mainOrder.marketIndex,
|
|
@@ -32795,10 +33219,18 @@ var SignerClient = class _SignerClient {
|
|
|
32795
33219
|
timeInForce: stopLoss.isLimit ? _SignerClient.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME : _SignerClient.ORDER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL,
|
|
32796
33220
|
reduceOnly: true,
|
|
32797
33221
|
triggerPrice: stopLoss.triggerPrice,
|
|
32798
|
-
orderExpiry: stopLoss.orderExpiry ?? protectionExpiryDefault
|
|
33222
|
+
orderExpiry: stopLoss.orderExpiry ?? protectionExpiryDefault,
|
|
33223
|
+
integratorAccountIndex: stopLoss.integratorAccountIndex ?? params.integratorAccountIndex ?? 0,
|
|
33224
|
+
integratorTakerFee: stopLoss.integratorTakerFee ?? params.integratorTakerFee ?? 0,
|
|
33225
|
+
integratorMakerFee: stopLoss.integratorMakerFee ?? params.integratorMakerFee ?? 0
|
|
32799
33226
|
}
|
|
32800
33227
|
];
|
|
32801
|
-
const [tx, hash2, error] = await this.createGroupedOrders(GroupingType.OTOCO, groupedOrders, params.nonce ?? -1
|
|
33228
|
+
const [tx, hash2, error] = await this.createGroupedOrders(GroupingType.OTOCO, groupedOrders, params.nonce ?? -1, {
|
|
33229
|
+
...params.skipNonce !== void 0 && { skipNonce: params.skipNonce },
|
|
33230
|
+
...params.integratorAccountIndex !== void 0 && { integratorAccountIndex: params.integratorAccountIndex },
|
|
33231
|
+
...params.integratorTakerFee !== void 0 && { integratorTakerFee: params.integratorTakerFee },
|
|
33232
|
+
...params.integratorMakerFee !== void 0 && { integratorMakerFee: params.integratorMakerFee }
|
|
33233
|
+
});
|
|
32802
33234
|
return { tx, hash: hash2, error };
|
|
32803
33235
|
}
|
|
32804
33236
|
/**
|
|
@@ -32808,10 +33240,10 @@ var SignerClient = class _SignerClient {
|
|
|
32808
33240
|
* @param nonce - Optional nonce (will be fetched automatically if not provided)
|
|
32809
33241
|
* @returns Promise resolving to [groupedOrdersInfo, transactionHash, error]
|
|
32810
33242
|
*/
|
|
32811
|
-
async createGroupedOrders(groupingType, orders, nonce = -1) {
|
|
33243
|
+
async createGroupedOrders(groupingType, orders, nonce = -1, options) {
|
|
32812
33244
|
return await this.processTransactionWithRetry(async () => {
|
|
32813
33245
|
try {
|
|
32814
|
-
const nextNonce = nonce === -1 ? await this.getNextNonce() : { nonce };
|
|
33246
|
+
const nextNonce = options?.skipNonce || nonce === 0 ? { nonce: nonce === -1 ? 0 : nonce } : nonce === -1 ? await this.getNextNonce() : { nonce };
|
|
32815
33247
|
const wasmOrders = orders.map((order) => ({
|
|
32816
33248
|
marketIndex: order.marketIndex,
|
|
32817
33249
|
clientOrderIndex: order.clientOrderIndex,
|
|
@@ -32822,11 +33254,18 @@ var SignerClient = class _SignerClient {
|
|
|
32822
33254
|
timeInForce: order.timeInForce,
|
|
32823
33255
|
reduceOnly: order.reduceOnly ?? false ? 1 : 0,
|
|
32824
33256
|
triggerPrice: order.triggerPrice || _SignerClient.NIL_TRIGGER_PRICE,
|
|
32825
|
-
orderExpiry: order.orderExpiry ?? _SignerClient.DEFAULT_28_DAY_ORDER_EXPIRY
|
|
33257
|
+
orderExpiry: order.orderExpiry ?? _SignerClient.DEFAULT_28_DAY_ORDER_EXPIRY,
|
|
33258
|
+
integratorAccountIndex: order.integratorAccountIndex ?? options?.integratorAccountIndex ?? 0,
|
|
33259
|
+
integratorTakerFee: order.integratorTakerFee ?? options?.integratorTakerFee ?? 0,
|
|
33260
|
+
integratorMakerFee: order.integratorMakerFee ?? options?.integratorMakerFee ?? 0
|
|
32826
33261
|
}));
|
|
32827
33262
|
const wasmResponse = await this.wallet.signCreateGroupedOrders({
|
|
32828
33263
|
groupingType,
|
|
32829
33264
|
orders: wasmOrders,
|
|
33265
|
+
integratorAccountIndex: options?.integratorAccountIndex ?? 0,
|
|
33266
|
+
integratorTakerFee: options?.integratorTakerFee ?? 0,
|
|
33267
|
+
integratorMakerFee: options?.integratorMakerFee ?? 0,
|
|
33268
|
+
skipNonce: options?.skipNonce ? 1 : 0,
|
|
32830
33269
|
nonce: nextNonce.nonce,
|
|
32831
33270
|
apiKeyIndex: this.config.apiKeyIndex,
|
|
32832
33271
|
accountIndex: this.config.accountIndex
|
|
@@ -33125,6 +33564,9 @@ SignerClient.TX_TYPE_BURN_SHARES = 19;
|
|
|
33125
33564
|
SignerClient.TX_TYPE_UPDATE_LEVERAGE = 20;
|
|
33126
33565
|
SignerClient.TX_TYPE_CREATE_GROUPED_ORDERS = 28;
|
|
33127
33566
|
SignerClient.TX_TYPE_UPDATE_MARGIN = 29;
|
|
33567
|
+
SignerClient.TX_TYPE_STAKE_ASSETS = 35;
|
|
33568
|
+
SignerClient.TX_TYPE_UNSTAKE_ASSETS = 36;
|
|
33569
|
+
SignerClient.TX_TYPE_APPROVE_INTEGRATOR = 45;
|
|
33128
33570
|
SignerClient.ORDER_TYPE_STOP_LOSS = 2;
|
|
33129
33571
|
SignerClient.ORDER_TYPE_STOP_LOSS_LIMIT = 3;
|
|
33130
33572
|
SignerClient.ORDER_TYPE_TAKE_PROFIT = 4;
|
|
@@ -33571,6 +34013,28 @@ var WsClient = class {
|
|
|
33571
34013
|
}
|
|
33572
34014
|
this.ws.send(JSON.stringify(message));
|
|
33573
34015
|
}
|
|
34016
|
+
/**
|
|
34017
|
+
* Subscribe to account_all updates.
|
|
34018
|
+
* This channel can include total_funding_paid_out per position.
|
|
34019
|
+
*/
|
|
34020
|
+
subscribeAccountAll(params) {
|
|
34021
|
+
const subParams = {
|
|
34022
|
+
account_index: params.accountIndex
|
|
34023
|
+
};
|
|
34024
|
+
if (params.apiKeyIndex !== void 0) {
|
|
34025
|
+
subParams.api_key_index = params.apiKeyIndex;
|
|
34026
|
+
}
|
|
34027
|
+
if (params.auth) {
|
|
34028
|
+
subParams.auth = params.auth;
|
|
34029
|
+
}
|
|
34030
|
+
this.subscribe({
|
|
34031
|
+
channel: "account_all",
|
|
34032
|
+
params: subParams
|
|
34033
|
+
});
|
|
34034
|
+
}
|
|
34035
|
+
unsubscribeAccountAll() {
|
|
34036
|
+
this.unsubscribe("account_all");
|
|
34037
|
+
}
|
|
33574
34038
|
attemptReconnect() {
|
|
33575
34039
|
if (this.reconnectAttempts >= (this.config.maxReconnectAttempts || 5)) {
|
|
33576
34040
|
return;
|
|
@@ -33642,7 +34106,7 @@ var isNextJSClient = () => {
|
|
|
33642
34106
|
var isNextJSServer = () => {
|
|
33643
34107
|
return isNextJS() && !isBrowser();
|
|
33644
34108
|
};
|
|
33645
|
-
var
|
|
34109
|
+
var isReactNative2 = () => {
|
|
33646
34110
|
try {
|
|
33647
34111
|
if (typeof globalThis !== "undefined") {
|
|
33648
34112
|
return typeof globalThis.HermesInternal !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
@@ -33672,7 +34136,7 @@ var detectEnvironment = () => {
|
|
|
33672
34136
|
return RuntimeEnvironment.NextJSServer;
|
|
33673
34137
|
if (isDeno())
|
|
33674
34138
|
return RuntimeEnvironment.Deno;
|
|
33675
|
-
if (
|
|
34139
|
+
if (isReactNative2())
|
|
33676
34140
|
return RuntimeEnvironment.ReactNative;
|
|
33677
34141
|
if (isWorker())
|
|
33678
34142
|
return RuntimeEnvironment.Worker;
|
|
@@ -33855,7 +34319,7 @@ export {
|
|
|
33855
34319
|
isNextJSClient,
|
|
33856
34320
|
isNextJSServer,
|
|
33857
34321
|
isNodeJS,
|
|
33858
|
-
isReactNative,
|
|
34322
|
+
isReactNative2 as isReactNative,
|
|
33859
34323
|
isWorker,
|
|
33860
34324
|
priceToUnits,
|
|
33861
34325
|
priceToUnitsSync,
|