@byreal-io/byreal-cli-realclaw 0.3.10 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.cjs +2737 -360
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -3029,11 +3029,11 @@ var require_commander = __commonJS({
|
|
|
3029
3029
|
});
|
|
3030
3030
|
|
|
3031
3031
|
// src/core/constants.ts
|
|
3032
|
-
var INJECTED_VERSION, VERSION, CLI_NAME, NPM_PACKAGE, API_BASE_URL, API_ENDPOINTS, SOLANA_RPC_URL, SOLANA_CLUSTER, CONFIG_DIR, CONFIG_FILE, DEFAULTS, TABLE_CHARS, LOGO, EXPERIMENTAL_WARNING, DEFAULT_CONFIG, DIR_PERMISSIONS;
|
|
3032
|
+
var INJECTED_VERSION, VERSION, CLI_NAME, NPM_PACKAGE, API_BASE_URL, API_ENDPOINTS, SOLANA_RPC_URL, SOLANA_CLUSTER, JUPITER_API_KEY, JUP_PAID_BASE, JUP_FREE_BASE, TITAN_API_URL, TITAN_AUTH_TOKEN, DFLOW_PAID_URL, DFLOW_FREE_URL, DFLOW_API_KEY, CONFIG_DIR, CONFIG_FILE, DEFAULTS, TABLE_CHARS, LOGO, EXPERIMENTAL_WARNING, DEFAULT_CONFIG, DIR_PERMISSIONS;
|
|
3033
3033
|
var init_constants = __esm({
|
|
3034
3034
|
"src/core/constants.ts"() {
|
|
3035
3035
|
"use strict";
|
|
3036
|
-
INJECTED_VERSION = true ? "0.3.
|
|
3036
|
+
INJECTED_VERSION = true ? "0.3.12" : void 0;
|
|
3037
3037
|
VERSION = INJECTED_VERSION ?? process.env.npm_package_version ?? "0.0.0";
|
|
3038
3038
|
CLI_NAME = "byreal-cli";
|
|
3039
3039
|
NPM_PACKAGE = "@byreal-io/byreal-cli-realclaw";
|
|
@@ -3067,6 +3067,14 @@ var init_constants = __esm({
|
|
|
3067
3067
|
};
|
|
3068
3068
|
SOLANA_RPC_URL = process.env.SOLANA_RPC_URL || "https://jenelle-p85r4h-fast-mainnet.helius-rpc.com";
|
|
3069
3069
|
SOLANA_CLUSTER = process.env.SOLANA_CLUSTER || "mainnet-beta";
|
|
3070
|
+
JUPITER_API_KEY = process.env.JUPITER_API_KEY || process.env.JUP_API_KEY;
|
|
3071
|
+
JUP_PAID_BASE = "https://api.jup.ag";
|
|
3072
|
+
JUP_FREE_BASE = "https://lite-api.jup.ag";
|
|
3073
|
+
TITAN_API_URL = process.env.TITAN_API_URL || "https://partners.api.titan.exchange";
|
|
3074
|
+
TITAN_AUTH_TOKEN = process.env.TITAN_AUTH_TOKEN;
|
|
3075
|
+
DFLOW_PAID_URL = "https://quote-api.dflow.net";
|
|
3076
|
+
DFLOW_FREE_URL = "https://dev-quote-api.dflow.net";
|
|
3077
|
+
DFLOW_API_KEY = process.env.DFLOW_API_KEY;
|
|
3070
3078
|
CONFIG_DIR = "~/.config/byreal";
|
|
3071
3079
|
CONFIG_FILE = "config.json";
|
|
3072
3080
|
DEFAULTS = {
|
|
@@ -15902,7 +15910,7 @@ var require_dist = __commonJS({
|
|
|
15902
15910
|
"use strict";
|
|
15903
15911
|
class StructError extends TypeError {
|
|
15904
15912
|
constructor(failure, failures) {
|
|
15905
|
-
let
|
|
15913
|
+
let cached2;
|
|
15906
15914
|
const { message, explanation, ...rest } = failure;
|
|
15907
15915
|
const { path: path3 } = failure;
|
|
15908
15916
|
const msg = path3.length === 0 ? message : `At path: ${path3.join(".")} -- ${message}`;
|
|
@@ -15912,7 +15920,7 @@ var require_dist = __commonJS({
|
|
|
15912
15920
|
Object.assign(this, rest);
|
|
15913
15921
|
this.name = this.constructor.name;
|
|
15914
15922
|
this.failures = () => {
|
|
15915
|
-
return
|
|
15923
|
+
return cached2 ?? (cached2 = [failure, ...failures()]);
|
|
15916
15924
|
};
|
|
15917
15925
|
}
|
|
15918
15926
|
}
|
|
@@ -22657,7 +22665,7 @@ var require_websocket = __commonJS({
|
|
|
22657
22665
|
var EventEmitter = require("events");
|
|
22658
22666
|
var https = require("https");
|
|
22659
22667
|
var http = require("http");
|
|
22660
|
-
var
|
|
22668
|
+
var net2 = require("net");
|
|
22661
22669
|
var tls = require("tls");
|
|
22662
22670
|
var { randomBytes, createHash } = require("crypto");
|
|
22663
22671
|
var { Duplex, Readable } = require("stream");
|
|
@@ -23391,12 +23399,12 @@ var require_websocket = __commonJS({
|
|
|
23391
23399
|
}
|
|
23392
23400
|
function netConnect(options) {
|
|
23393
23401
|
options.path = options.socketPath;
|
|
23394
|
-
return
|
|
23402
|
+
return net2.connect(options);
|
|
23395
23403
|
}
|
|
23396
23404
|
function tlsConnect(options) {
|
|
23397
23405
|
options.path = void 0;
|
|
23398
23406
|
if (!options.servername && options.servername !== "") {
|
|
23399
|
-
options.servername =
|
|
23407
|
+
options.servername = net2.isIP(options.host) ? "" : options.host;
|
|
23400
23408
|
}
|
|
23401
23409
|
return tls.connect(options);
|
|
23402
23410
|
}
|
|
@@ -26985,7 +26993,7 @@ var require_index_cjs = __commonJS({
|
|
|
26985
26993
|
return value._bn !== void 0;
|
|
26986
26994
|
}
|
|
26987
26995
|
var uniquePublicKeyCounter = 1;
|
|
26988
|
-
var
|
|
26996
|
+
var PublicKey51 = class _PublicKey2 extends Struct {
|
|
26989
26997
|
/**
|
|
26990
26998
|
* Create a new PublicKey object
|
|
26991
26999
|
* @param value ed25519 public key as buffer or base-58 encoded string
|
|
@@ -27147,9 +27155,9 @@ var require_index_cjs = __commonJS({
|
|
|
27147
27155
|
return isOnCurve(pubkey.toBytes());
|
|
27148
27156
|
}
|
|
27149
27157
|
};
|
|
27150
|
-
_PublicKey =
|
|
27151
|
-
|
|
27152
|
-
SOLANA_SCHEMA.set(
|
|
27158
|
+
_PublicKey = PublicKey51;
|
|
27159
|
+
PublicKey51.default = new _PublicKey("11111111111111111111111111111111");
|
|
27160
|
+
SOLANA_SCHEMA.set(PublicKey51, {
|
|
27153
27161
|
kind: "struct",
|
|
27154
27162
|
fields: [["_bn", "u256"]]
|
|
27155
27163
|
});
|
|
@@ -27181,7 +27189,7 @@ var require_index_cjs = __commonJS({
|
|
|
27181
27189
|
* The public key for this account
|
|
27182
27190
|
*/
|
|
27183
27191
|
get publicKey() {
|
|
27184
|
-
return new
|
|
27192
|
+
return new PublicKey51(this._publicKey);
|
|
27185
27193
|
}
|
|
27186
27194
|
/**
|
|
27187
27195
|
* The **unencrypted** secret key for this account. The first 32 bytes
|
|
@@ -27192,7 +27200,7 @@ var require_index_cjs = __commonJS({
|
|
|
27192
27200
|
return buffer.Buffer.concat([this._secretKey, this._publicKey], 64);
|
|
27193
27201
|
}
|
|
27194
27202
|
};
|
|
27195
|
-
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new
|
|
27203
|
+
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey51("BPFLoader1111111111111111111111111111111111");
|
|
27196
27204
|
var PACKET_DATA_SIZE = 1280 - 40 - 8;
|
|
27197
27205
|
var VERSION_PREFIX_MASK = 127;
|
|
27198
27206
|
var SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
@@ -27423,7 +27431,7 @@ var require_index_cjs = __commonJS({
|
|
|
27423
27431
|
const [payerAddress] = writableSigners[0];
|
|
27424
27432
|
assert(payerAddress === this.payer.toBase58(), "Expected first writable signer key to be the fee payer");
|
|
27425
27433
|
}
|
|
27426
|
-
const staticAccountKeys = [...writableSigners.map(([address]) => new
|
|
27434
|
+
const staticAccountKeys = [...writableSigners.map(([address]) => new PublicKey51(address)), ...readonlySigners.map(([address]) => new PublicKey51(address)), ...writableNonSigners.map(([address]) => new PublicKey51(address)), ...readonlyNonSigners.map(([address]) => new PublicKey51(address))];
|
|
27427
27435
|
return [header, staticAccountKeys];
|
|
27428
27436
|
}
|
|
27429
27437
|
extractTableLookup(lookupTable) {
|
|
@@ -27447,7 +27455,7 @@ var require_index_cjs = __commonJS({
|
|
|
27447
27455
|
const drainedKeys = new Array();
|
|
27448
27456
|
for (const [address, keyMeta] of this.keyMetaMap.entries()) {
|
|
27449
27457
|
if (keyMetaFilter(keyMeta)) {
|
|
27450
|
-
const key = new
|
|
27458
|
+
const key = new PublicKey51(address);
|
|
27451
27459
|
const lookupTableIndex = lookupTableEntries.findIndex((entry) => entry.equals(key));
|
|
27452
27460
|
if (lookupTableIndex >= 0) {
|
|
27453
27461
|
assert(lookupTableIndex < 256, "Max lookup table index exceeded");
|
|
@@ -27482,7 +27490,7 @@ var require_index_cjs = __commonJS({
|
|
|
27482
27490
|
this.instructions = void 0;
|
|
27483
27491
|
this.indexToProgramIds = /* @__PURE__ */ new Map();
|
|
27484
27492
|
this.header = args.header;
|
|
27485
|
-
this.accountKeys = args.accountKeys.map((account) => new
|
|
27493
|
+
this.accountKeys = args.accountKeys.map((account) => new PublicKey51(account));
|
|
27486
27494
|
this.recentBlockhash = args.recentBlockhash;
|
|
27487
27495
|
this.instructions = args.instructions;
|
|
27488
27496
|
this.instructions.forEach((ix) => this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex]));
|
|
@@ -27608,7 +27616,7 @@ var require_index_cjs = __commonJS({
|
|
|
27608
27616
|
let accountKeys = [];
|
|
27609
27617
|
for (let i = 0; i < accountCount; i++) {
|
|
27610
27618
|
const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2);
|
|
27611
|
-
accountKeys.push(new
|
|
27619
|
+
accountKeys.push(new PublicKey51(buffer.Buffer.from(account)));
|
|
27612
27620
|
}
|
|
27613
27621
|
const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2);
|
|
27614
27622
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -27832,7 +27840,7 @@ var require_index_cjs = __commonJS({
|
|
|
27832
27840
|
const staticAccountKeys = [];
|
|
27833
27841
|
const staticAccountKeysLength = decodeLength(byteArray);
|
|
27834
27842
|
for (let i = 0; i < staticAccountKeysLength; i++) {
|
|
27835
|
-
staticAccountKeys.push(new
|
|
27843
|
+
staticAccountKeys.push(new PublicKey51(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2)));
|
|
27836
27844
|
}
|
|
27837
27845
|
const recentBlockhash = bs58__default.default.encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
27838
27846
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -27852,7 +27860,7 @@ var require_index_cjs = __commonJS({
|
|
|
27852
27860
|
const addressTableLookupsCount = decodeLength(byteArray);
|
|
27853
27861
|
const addressTableLookups = [];
|
|
27854
27862
|
for (let i = 0; i < addressTableLookupsCount; i++) {
|
|
27855
|
-
const accountKey = new
|
|
27863
|
+
const accountKey = new PublicKey51(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
27856
27864
|
const writableIndexesLength = decodeLength(byteArray);
|
|
27857
27865
|
const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);
|
|
27858
27866
|
const readonlyIndexesLength = decodeLength(byteArray);
|
|
@@ -27901,7 +27909,7 @@ var require_index_cjs = __commonJS({
|
|
|
27901
27909
|
return TransactionStatus2;
|
|
27902
27910
|
}({});
|
|
27903
27911
|
var DEFAULT_SIGNATURE = buffer.Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);
|
|
27904
|
-
var
|
|
27912
|
+
var TransactionInstruction44 = class {
|
|
27905
27913
|
constructor(opts) {
|
|
27906
27914
|
this.keys = void 0;
|
|
27907
27915
|
this.programId = void 0;
|
|
@@ -28033,7 +28041,7 @@ var require_index_cjs = __commonJS({
|
|
|
28033
28041
|
} else if ("data" in item && "programId" in item && "keys" in item) {
|
|
28034
28042
|
this.instructions.push(item);
|
|
28035
28043
|
} else {
|
|
28036
|
-
this.instructions.push(new
|
|
28044
|
+
this.instructions.push(new TransactionInstruction44(item));
|
|
28037
28045
|
}
|
|
28038
28046
|
});
|
|
28039
28047
|
return this;
|
|
@@ -28092,7 +28100,7 @@ var require_index_cjs = __commonJS({
|
|
|
28092
28100
|
});
|
|
28093
28101
|
programIds.forEach((programId) => {
|
|
28094
28102
|
accountMetas.push({
|
|
28095
|
-
pubkey: new
|
|
28103
|
+
pubkey: new PublicKey51(programId),
|
|
28096
28104
|
isSigner: false,
|
|
28097
28105
|
isWritable: false
|
|
28098
28106
|
});
|
|
@@ -28526,7 +28534,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28526
28534
|
isWritable: message.isAccountWritable(account)
|
|
28527
28535
|
};
|
|
28528
28536
|
});
|
|
28529
|
-
transaction.instructions.push(new
|
|
28537
|
+
transaction.instructions.push(new TransactionInstruction44({
|
|
28530
28538
|
keys,
|
|
28531
28539
|
programId: message.accountKeys[instruction.programIdIndex],
|
|
28532
28540
|
data: bs58__default.default.decode(instruction.data)
|
|
@@ -28537,7 +28545,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28537
28545
|
return transaction;
|
|
28538
28546
|
}
|
|
28539
28547
|
};
|
|
28540
|
-
var
|
|
28548
|
+
var TransactionMessage5 = class _TransactionMessage {
|
|
28541
28549
|
constructor(args) {
|
|
28542
28550
|
this.payerKey = void 0;
|
|
28543
28551
|
this.instructions = void 0;
|
|
@@ -28594,7 +28602,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28594
28602
|
if (programId === void 0) {
|
|
28595
28603
|
throw new Error(`Failed to find program id for program id index ${compiledIx.programIdIndex}`);
|
|
28596
28604
|
}
|
|
28597
|
-
instructions.push(new
|
|
28605
|
+
instructions.push(new TransactionInstruction44({
|
|
28598
28606
|
programId,
|
|
28599
28607
|
data: toBuffer(compiledIx.data),
|
|
28600
28608
|
keys
|
|
@@ -28622,7 +28630,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28622
28630
|
});
|
|
28623
28631
|
}
|
|
28624
28632
|
};
|
|
28625
|
-
var
|
|
28633
|
+
var VersionedTransaction6 = class _VersionedTransaction {
|
|
28626
28634
|
get version() {
|
|
28627
28635
|
return this.message.version;
|
|
28628
28636
|
}
|
|
@@ -28685,15 +28693,15 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28685
28693
|
var DEFAULT_TICKS_PER_SLOT = 64;
|
|
28686
28694
|
var NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
28687
28695
|
var MS_PER_SLOT = 1e3 / NUM_SLOTS_PER_SECOND;
|
|
28688
|
-
var SYSVAR_CLOCK_PUBKEY2 = new
|
|
28689
|
-
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new
|
|
28690
|
-
var SYSVAR_INSTRUCTIONS_PUBKEY = new
|
|
28691
|
-
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new
|
|
28692
|
-
var SYSVAR_RENT_PUBKEY5 = new
|
|
28693
|
-
var SYSVAR_REWARDS_PUBKEY = new
|
|
28694
|
-
var SYSVAR_SLOT_HASHES_PUBKEY = new
|
|
28695
|
-
var SYSVAR_SLOT_HISTORY_PUBKEY = new
|
|
28696
|
-
var SYSVAR_STAKE_HISTORY_PUBKEY = new
|
|
28696
|
+
var SYSVAR_CLOCK_PUBKEY2 = new PublicKey51("SysvarC1ock11111111111111111111111111111111");
|
|
28697
|
+
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey51("SysvarEpochSchedu1e111111111111111111111111");
|
|
28698
|
+
var SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey51("Sysvar1nstructions1111111111111111111111111");
|
|
28699
|
+
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey51("SysvarRecentB1ockHashes11111111111111111111");
|
|
28700
|
+
var SYSVAR_RENT_PUBKEY5 = new PublicKey51("SysvarRent111111111111111111111111111111111");
|
|
28701
|
+
var SYSVAR_REWARDS_PUBKEY = new PublicKey51("SysvarRewards111111111111111111111111111111");
|
|
28702
|
+
var SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey51("SysvarS1otHashes111111111111111111111111111");
|
|
28703
|
+
var SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey51("SysvarS1otHistory11111111111111111111111111");
|
|
28704
|
+
var SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey51("SysvarStakeHistory1111111111111111111111111");
|
|
28697
28705
|
var SendTransactionError = class extends Error {
|
|
28698
28706
|
constructor({
|
|
28699
28707
|
action,
|
|
@@ -28884,8 +28892,8 @@ Message: ${transactionMessage}.
|
|
|
28884
28892
|
static fromAccountData(buffer2) {
|
|
28885
28893
|
const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer2), 0);
|
|
28886
28894
|
return new _NonceAccount({
|
|
28887
|
-
authorizedPubkey: new
|
|
28888
|
-
nonce: new
|
|
28895
|
+
authorizedPubkey: new PublicKey51(nonceAccount.authorizedPubkey),
|
|
28896
|
+
nonce: new PublicKey51(nonceAccount.nonce).toString(),
|
|
28889
28897
|
feeCalculator: nonceAccount.feeCalculator
|
|
28890
28898
|
});
|
|
28891
28899
|
}
|
|
@@ -28947,7 +28955,7 @@ Message: ${transactionMessage}.
|
|
|
28947
28955
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
28948
28956
|
lamports,
|
|
28949
28957
|
space,
|
|
28950
|
-
programId: new
|
|
28958
|
+
programId: new PublicKey51(programId)
|
|
28951
28959
|
};
|
|
28952
28960
|
}
|
|
28953
28961
|
/**
|
|
@@ -28982,7 +28990,7 @@ Message: ${transactionMessage}.
|
|
|
28982
28990
|
toPubkey: instruction.keys[2].pubkey,
|
|
28983
28991
|
lamports,
|
|
28984
28992
|
seed,
|
|
28985
|
-
programId: new
|
|
28993
|
+
programId: new PublicKey51(programId)
|
|
28986
28994
|
};
|
|
28987
28995
|
}
|
|
28988
28996
|
/**
|
|
@@ -29013,10 +29021,10 @@ Message: ${transactionMessage}.
|
|
|
29013
29021
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed, instruction.data);
|
|
29014
29022
|
return {
|
|
29015
29023
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29016
|
-
basePubkey: new
|
|
29024
|
+
basePubkey: new PublicKey51(base),
|
|
29017
29025
|
seed,
|
|
29018
29026
|
space,
|
|
29019
|
-
programId: new
|
|
29027
|
+
programId: new PublicKey51(programId)
|
|
29020
29028
|
};
|
|
29021
29029
|
}
|
|
29022
29030
|
/**
|
|
@@ -29030,7 +29038,7 @@ Message: ${transactionMessage}.
|
|
|
29030
29038
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign, instruction.data);
|
|
29031
29039
|
return {
|
|
29032
29040
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29033
|
-
programId: new
|
|
29041
|
+
programId: new PublicKey51(programId)
|
|
29034
29042
|
};
|
|
29035
29043
|
}
|
|
29036
29044
|
/**
|
|
@@ -29046,9 +29054,9 @@ Message: ${transactionMessage}.
|
|
|
29046
29054
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed, instruction.data);
|
|
29047
29055
|
return {
|
|
29048
29056
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29049
|
-
basePubkey: new
|
|
29057
|
+
basePubkey: new PublicKey51(base),
|
|
29050
29058
|
seed,
|
|
29051
|
-
programId: new
|
|
29059
|
+
programId: new PublicKey51(programId)
|
|
29052
29060
|
};
|
|
29053
29061
|
}
|
|
29054
29062
|
/**
|
|
@@ -29067,11 +29075,11 @@ Message: ${transactionMessage}.
|
|
|
29067
29075
|
return {
|
|
29068
29076
|
fromPubkey: instruction.keys[0].pubkey,
|
|
29069
29077
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
29070
|
-
basePubkey: new
|
|
29078
|
+
basePubkey: new PublicKey51(base),
|
|
29071
29079
|
seed,
|
|
29072
29080
|
lamports,
|
|
29073
29081
|
space,
|
|
29074
|
-
programId: new
|
|
29082
|
+
programId: new PublicKey51(programId)
|
|
29075
29083
|
};
|
|
29076
29084
|
}
|
|
29077
29085
|
/**
|
|
@@ -29085,7 +29093,7 @@ Message: ${transactionMessage}.
|
|
|
29085
29093
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount, instruction.data);
|
|
29086
29094
|
return {
|
|
29087
29095
|
noncePubkey: instruction.keys[0].pubkey,
|
|
29088
|
-
authorizedPubkey: new
|
|
29096
|
+
authorizedPubkey: new PublicKey51(authorized2)
|
|
29089
29097
|
};
|
|
29090
29098
|
}
|
|
29091
29099
|
/**
|
|
@@ -29128,7 +29136,7 @@ Message: ${transactionMessage}.
|
|
|
29128
29136
|
return {
|
|
29129
29137
|
noncePubkey: instruction.keys[0].pubkey,
|
|
29130
29138
|
authorizedPubkey: instruction.keys[1].pubkey,
|
|
29131
|
-
newAuthorizedPubkey: new
|
|
29139
|
+
newAuthorizedPubkey: new PublicKey51(authorized2)
|
|
29132
29140
|
};
|
|
29133
29141
|
}
|
|
29134
29142
|
/**
|
|
@@ -29221,7 +29229,7 @@ Message: ${transactionMessage}.
|
|
|
29221
29229
|
space: params.space,
|
|
29222
29230
|
programId: toBuffer(params.programId.toBuffer())
|
|
29223
29231
|
});
|
|
29224
|
-
return new
|
|
29232
|
+
return new TransactionInstruction44({
|
|
29225
29233
|
keys: [{
|
|
29226
29234
|
pubkey: params.fromPubkey,
|
|
29227
29235
|
isSigner: true,
|
|
@@ -29276,7 +29284,7 @@ Message: ${transactionMessage}.
|
|
|
29276
29284
|
isWritable: true
|
|
29277
29285
|
}];
|
|
29278
29286
|
}
|
|
29279
|
-
return new
|
|
29287
|
+
return new TransactionInstruction44({
|
|
29280
29288
|
keys,
|
|
29281
29289
|
programId: this.programId,
|
|
29282
29290
|
data
|
|
@@ -29315,7 +29323,7 @@ Message: ${transactionMessage}.
|
|
|
29315
29323
|
isWritable: true
|
|
29316
29324
|
}];
|
|
29317
29325
|
}
|
|
29318
|
-
return new
|
|
29326
|
+
return new TransactionInstruction44({
|
|
29319
29327
|
keys,
|
|
29320
29328
|
programId: this.programId,
|
|
29321
29329
|
data
|
|
@@ -29350,7 +29358,7 @@ Message: ${transactionMessage}.
|
|
|
29350
29358
|
isWritable: false
|
|
29351
29359
|
});
|
|
29352
29360
|
}
|
|
29353
|
-
return new
|
|
29361
|
+
return new TransactionInstruction44({
|
|
29354
29362
|
keys,
|
|
29355
29363
|
programId: this.programId,
|
|
29356
29364
|
data
|
|
@@ -29412,7 +29420,7 @@ Message: ${transactionMessage}.
|
|
|
29412
29420
|
programId: this.programId,
|
|
29413
29421
|
data
|
|
29414
29422
|
};
|
|
29415
|
-
return new
|
|
29423
|
+
return new TransactionInstruction44(instructionData);
|
|
29416
29424
|
}
|
|
29417
29425
|
/**
|
|
29418
29426
|
* Generate an instruction to advance the nonce in a Nonce account
|
|
@@ -29437,7 +29445,7 @@ Message: ${transactionMessage}.
|
|
|
29437
29445
|
programId: this.programId,
|
|
29438
29446
|
data
|
|
29439
29447
|
};
|
|
29440
|
-
return new
|
|
29448
|
+
return new TransactionInstruction44(instructionData);
|
|
29441
29449
|
}
|
|
29442
29450
|
/**
|
|
29443
29451
|
* Generate a transaction instruction that withdraws lamports from a Nonce account
|
|
@@ -29447,7 +29455,7 @@ Message: ${transactionMessage}.
|
|
|
29447
29455
|
const data = encodeData(type, {
|
|
29448
29456
|
lamports: params.lamports
|
|
29449
29457
|
});
|
|
29450
|
-
return new
|
|
29458
|
+
return new TransactionInstruction44({
|
|
29451
29459
|
keys: [{
|
|
29452
29460
|
pubkey: params.noncePubkey,
|
|
29453
29461
|
isSigner: false,
|
|
@@ -29482,7 +29490,7 @@ Message: ${transactionMessage}.
|
|
|
29482
29490
|
const data = encodeData(type, {
|
|
29483
29491
|
authorized: toBuffer(params.newAuthorizedPubkey.toBuffer())
|
|
29484
29492
|
});
|
|
29485
|
-
return new
|
|
29493
|
+
return new TransactionInstruction44({
|
|
29486
29494
|
keys: [{
|
|
29487
29495
|
pubkey: params.noncePubkey,
|
|
29488
29496
|
isSigner: false,
|
|
@@ -29530,14 +29538,14 @@ Message: ${transactionMessage}.
|
|
|
29530
29538
|
isWritable: true
|
|
29531
29539
|
}];
|
|
29532
29540
|
}
|
|
29533
|
-
return new
|
|
29541
|
+
return new TransactionInstruction44({
|
|
29534
29542
|
keys,
|
|
29535
29543
|
programId: this.programId,
|
|
29536
29544
|
data
|
|
29537
29545
|
});
|
|
29538
29546
|
}
|
|
29539
29547
|
};
|
|
29540
|
-
SystemProgram13.programId = new
|
|
29548
|
+
SystemProgram13.programId = new PublicKey51("11111111111111111111111111111111");
|
|
29541
29549
|
var CHUNK_SIZE = PACKET_DATA_SIZE - 300;
|
|
29542
29550
|
var Loader = class _Loader {
|
|
29543
29551
|
/**
|
|
@@ -29704,7 +29712,7 @@ Message: ${transactionMessage}.
|
|
|
29704
29712
|
}
|
|
29705
29713
|
};
|
|
29706
29714
|
Loader.chunkSize = CHUNK_SIZE;
|
|
29707
|
-
var BPF_LOADER_PROGRAM_ID = new
|
|
29715
|
+
var BPF_LOADER_PROGRAM_ID = new PublicKey51("BPFLoader2111111111111111111111111111111111");
|
|
29708
29716
|
var BpfLoader = class {
|
|
29709
29717
|
/**
|
|
29710
29718
|
* Minimum number of signatures required to load a program not including
|
|
@@ -30476,7 +30484,7 @@ Message: ${transactionMessage}.
|
|
|
30476
30484
|
return decoded;
|
|
30477
30485
|
}
|
|
30478
30486
|
var LOOKUP_TABLE_META_SIZE = 56;
|
|
30479
|
-
var
|
|
30487
|
+
var AddressLookupTableAccount2 = class {
|
|
30480
30488
|
constructor(args) {
|
|
30481
30489
|
this.key = void 0;
|
|
30482
30490
|
this.state = void 0;
|
|
@@ -30500,8 +30508,8 @@ Message: ${transactionMessage}.
|
|
|
30500
30508
|
deactivationSlot: meta.deactivationSlot,
|
|
30501
30509
|
lastExtendedSlot: meta.lastExtendedSlot,
|
|
30502
30510
|
lastExtendedSlotStartIndex: meta.lastExtendedStartIndex,
|
|
30503
|
-
authority: meta.authority.length !== 0 ? new
|
|
30504
|
-
addresses: addresses.map((address) => new
|
|
30511
|
+
authority: meta.authority.length !== 0 ? new PublicKey51(meta.authority[0]) : void 0,
|
|
30512
|
+
addresses: addresses.map((address) => new PublicKey51(address))
|
|
30505
30513
|
};
|
|
30506
30514
|
}
|
|
30507
30515
|
};
|
|
@@ -30543,7 +30551,7 @@ Message: ${transactionMessage}.
|
|
|
30543
30551
|
);
|
|
30544
30552
|
return `${protocol}//${hostish}${websocketPort}${rest}`;
|
|
30545
30553
|
}
|
|
30546
|
-
var PublicKeyFromString = superstruct.coerce(superstruct.instance(
|
|
30554
|
+
var PublicKeyFromString = superstruct.coerce(superstruct.instance(PublicKey51), superstruct.string(), (value) => new PublicKey51(value));
|
|
30547
30555
|
var RawAccountDataResult = superstruct.tuple([superstruct.string(), superstruct.literal("base64")]);
|
|
30548
30556
|
var BufferFromRawAccountData = superstruct.coerce(superstruct.instance(buffer.Buffer), RawAccountDataResult, (value) => buffer.Buffer.from(value[0], "base64"));
|
|
30549
30557
|
var BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1e3;
|
|
@@ -30628,7 +30636,7 @@ Message: ${transactionMessage}.
|
|
|
30628
30636
|
if (version2 === 0) {
|
|
30629
30637
|
return new MessageV0({
|
|
30630
30638
|
header: response.header,
|
|
30631
|
-
staticAccountKeys: response.accountKeys.map((accountKey) => new
|
|
30639
|
+
staticAccountKeys: response.accountKeys.map((accountKey) => new PublicKey51(accountKey)),
|
|
30632
30640
|
recentBlockhash: response.recentBlockhash,
|
|
30633
30641
|
compiledInstructions: response.instructions.map((ix) => ({
|
|
30634
30642
|
programIdIndex: ix.programIdIndex,
|
|
@@ -33025,9 +33033,9 @@ Message: ${transactionMessage}.
|
|
|
33025
33033
|
} = await this.getAccountInfoAndContext(accountKey, config3);
|
|
33026
33034
|
let value = null;
|
|
33027
33035
|
if (accountInfo !== null) {
|
|
33028
|
-
value = new
|
|
33036
|
+
value = new AddressLookupTableAccount2({
|
|
33029
33037
|
key: accountKey,
|
|
33030
|
-
state:
|
|
33038
|
+
state: AddressLookupTableAccount2.deserialize(accountInfo.data)
|
|
33031
33039
|
});
|
|
33032
33040
|
}
|
|
33033
33041
|
return {
|
|
@@ -34068,7 +34076,7 @@ Message: ${transactionMessage}.
|
|
|
34068
34076
|
* @returns {PublicKey} PublicKey
|
|
34069
34077
|
*/
|
|
34070
34078
|
get publicKey() {
|
|
34071
|
-
return new
|
|
34079
|
+
return new PublicKey51(this._keypair.publicKey);
|
|
34072
34080
|
}
|
|
34073
34081
|
/**
|
|
34074
34082
|
* The raw secret key for this keypair
|
|
@@ -34146,7 +34154,7 @@ Message: ${transactionMessage}.
|
|
|
34146
34154
|
lookupTable: instruction.keys[0].pubkey,
|
|
34147
34155
|
authority: instruction.keys[1].pubkey,
|
|
34148
34156
|
payer: instruction.keys.length > 2 ? instruction.keys[2].pubkey : void 0,
|
|
34149
|
-
addresses: addresses.map((buffer2) => new
|
|
34157
|
+
addresses: addresses.map((buffer2) => new PublicKey51(buffer2))
|
|
34150
34158
|
};
|
|
34151
34159
|
}
|
|
34152
34160
|
static decodeCloseLookupTable(instruction) {
|
|
@@ -34198,7 +34206,7 @@ Message: ${transactionMessage}.
|
|
|
34198
34206
|
constructor() {
|
|
34199
34207
|
}
|
|
34200
34208
|
static createLookupTable(params) {
|
|
34201
|
-
const [lookupTableAddress, bumpSeed] =
|
|
34209
|
+
const [lookupTableAddress, bumpSeed] = PublicKey51.findProgramAddressSync([params.authority.toBuffer(), codecsNumbers.getU64Encoder().encode(params.recentSlot)], this.programId);
|
|
34202
34210
|
const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable;
|
|
34203
34211
|
const data = encodeData(type, {
|
|
34204
34212
|
recentSlot: BigInt(params.recentSlot),
|
|
@@ -34221,7 +34229,7 @@ Message: ${transactionMessage}.
|
|
|
34221
34229
|
isSigner: false,
|
|
34222
34230
|
isWritable: false
|
|
34223
34231
|
}];
|
|
34224
|
-
return [new
|
|
34232
|
+
return [new TransactionInstruction44({
|
|
34225
34233
|
programId: this.programId,
|
|
34226
34234
|
keys,
|
|
34227
34235
|
data
|
|
@@ -34239,7 +34247,7 @@ Message: ${transactionMessage}.
|
|
|
34239
34247
|
isSigner: true,
|
|
34240
34248
|
isWritable: false
|
|
34241
34249
|
}];
|
|
34242
|
-
return new
|
|
34250
|
+
return new TransactionInstruction44({
|
|
34243
34251
|
programId: this.programId,
|
|
34244
34252
|
keys,
|
|
34245
34253
|
data
|
|
@@ -34270,7 +34278,7 @@ Message: ${transactionMessage}.
|
|
|
34270
34278
|
isWritable: false
|
|
34271
34279
|
});
|
|
34272
34280
|
}
|
|
34273
|
-
return new
|
|
34281
|
+
return new TransactionInstruction44({
|
|
34274
34282
|
programId: this.programId,
|
|
34275
34283
|
keys,
|
|
34276
34284
|
data
|
|
@@ -34288,7 +34296,7 @@ Message: ${transactionMessage}.
|
|
|
34288
34296
|
isSigner: true,
|
|
34289
34297
|
isWritable: false
|
|
34290
34298
|
}];
|
|
34291
|
-
return new
|
|
34299
|
+
return new TransactionInstruction44({
|
|
34292
34300
|
programId: this.programId,
|
|
34293
34301
|
keys,
|
|
34294
34302
|
data
|
|
@@ -34310,14 +34318,14 @@ Message: ${transactionMessage}.
|
|
|
34310
34318
|
isSigner: false,
|
|
34311
34319
|
isWritable: true
|
|
34312
34320
|
}];
|
|
34313
|
-
return new
|
|
34321
|
+
return new TransactionInstruction44({
|
|
34314
34322
|
programId: this.programId,
|
|
34315
34323
|
keys,
|
|
34316
34324
|
data
|
|
34317
34325
|
});
|
|
34318
34326
|
}
|
|
34319
34327
|
};
|
|
34320
|
-
AddressLookupTableProgram.programId = new
|
|
34328
|
+
AddressLookupTableProgram.programId = new PublicKey51("AddressLookupTab1e1111111111111111111111111");
|
|
34321
34329
|
var ComputeBudgetInstruction = class {
|
|
34322
34330
|
/**
|
|
34323
34331
|
* @internal
|
|
@@ -34397,7 +34405,7 @@ Message: ${transactionMessage}.
|
|
|
34397
34405
|
* @internal
|
|
34398
34406
|
*/
|
|
34399
34407
|
static checkProgramId(programId) {
|
|
34400
|
-
if (!programId.equals(
|
|
34408
|
+
if (!programId.equals(ComputeBudgetProgram4.programId)) {
|
|
34401
34409
|
throw new Error("invalid instruction; programId is not ComputeBudgetProgram");
|
|
34402
34410
|
}
|
|
34403
34411
|
}
|
|
@@ -34420,7 +34428,7 @@ Message: ${transactionMessage}.
|
|
|
34420
34428
|
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u8("instruction"), u643("microLamports")])
|
|
34421
34429
|
}
|
|
34422
34430
|
});
|
|
34423
|
-
var
|
|
34431
|
+
var ComputeBudgetProgram4 = class {
|
|
34424
34432
|
/**
|
|
34425
34433
|
* @internal
|
|
34426
34434
|
*/
|
|
@@ -34435,7 +34443,7 @@ Message: ${transactionMessage}.
|
|
|
34435
34443
|
static requestUnits(params) {
|
|
34436
34444
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;
|
|
34437
34445
|
const data = encodeData(type, params);
|
|
34438
|
-
return new
|
|
34446
|
+
return new TransactionInstruction44({
|
|
34439
34447
|
keys: [],
|
|
34440
34448
|
programId: this.programId,
|
|
34441
34449
|
data
|
|
@@ -34444,7 +34452,7 @@ Message: ${transactionMessage}.
|
|
|
34444
34452
|
static requestHeapFrame(params) {
|
|
34445
34453
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame;
|
|
34446
34454
|
const data = encodeData(type, params);
|
|
34447
|
-
return new
|
|
34455
|
+
return new TransactionInstruction44({
|
|
34448
34456
|
keys: [],
|
|
34449
34457
|
programId: this.programId,
|
|
34450
34458
|
data
|
|
@@ -34453,7 +34461,7 @@ Message: ${transactionMessage}.
|
|
|
34453
34461
|
static setComputeUnitLimit(params) {
|
|
34454
34462
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit;
|
|
34455
34463
|
const data = encodeData(type, params);
|
|
34456
|
-
return new
|
|
34464
|
+
return new TransactionInstruction44({
|
|
34457
34465
|
keys: [],
|
|
34458
34466
|
programId: this.programId,
|
|
34459
34467
|
data
|
|
@@ -34464,14 +34472,14 @@ Message: ${transactionMessage}.
|
|
|
34464
34472
|
const data = encodeData(type, {
|
|
34465
34473
|
microLamports: BigInt(params.microLamports)
|
|
34466
34474
|
});
|
|
34467
|
-
return new
|
|
34475
|
+
return new TransactionInstruction44({
|
|
34468
34476
|
keys: [],
|
|
34469
34477
|
programId: this.programId,
|
|
34470
34478
|
data
|
|
34471
34479
|
});
|
|
34472
34480
|
}
|
|
34473
34481
|
};
|
|
34474
|
-
|
|
34482
|
+
ComputeBudgetProgram4.programId = new PublicKey51("ComputeBudget111111111111111111111111111111");
|
|
34475
34483
|
var PRIVATE_KEY_BYTES$1 = 64;
|
|
34476
34484
|
var PUBLIC_KEY_BYTES$1 = 32;
|
|
34477
34485
|
var SIGNATURE_BYTES = 64;
|
|
@@ -34519,7 +34527,7 @@ Message: ${transactionMessage}.
|
|
|
34519
34527
|
instructionData.fill(publicKey4, publicKeyOffset);
|
|
34520
34528
|
instructionData.fill(signature2, signatureOffset);
|
|
34521
34529
|
instructionData.fill(message, messageDataOffset);
|
|
34522
|
-
return new
|
|
34530
|
+
return new TransactionInstruction44({
|
|
34523
34531
|
keys: [],
|
|
34524
34532
|
programId: _Ed25519Program.programId,
|
|
34525
34533
|
data: instructionData
|
|
@@ -34551,7 +34559,7 @@ Message: ${transactionMessage}.
|
|
|
34551
34559
|
}
|
|
34552
34560
|
}
|
|
34553
34561
|
};
|
|
34554
|
-
Ed25519Program.programId = new
|
|
34562
|
+
Ed25519Program.programId = new PublicKey51("Ed25519SigVerify111111111111111111111111111");
|
|
34555
34563
|
var ecdsaSign = (msgHash, privKey) => {
|
|
34556
34564
|
const signature2 = secp256k1.secp256k1.sign(msgHash, privKey);
|
|
34557
34565
|
return [signature2.toCompactRawBytes(), signature2.recovery];
|
|
@@ -34647,7 +34655,7 @@ Message: ${transactionMessage}.
|
|
|
34647
34655
|
recoveryId
|
|
34648
34656
|
}, instructionData);
|
|
34649
34657
|
instructionData.fill(toBuffer(message), SECP256K1_INSTRUCTION_LAYOUT.span);
|
|
34650
|
-
return new
|
|
34658
|
+
return new TransactionInstruction44({
|
|
34651
34659
|
keys: [],
|
|
34652
34660
|
programId: _Secp256k1Program.programId,
|
|
34653
34661
|
data: instructionData
|
|
@@ -34685,9 +34693,9 @@ Message: ${transactionMessage}.
|
|
|
34685
34693
|
}
|
|
34686
34694
|
}
|
|
34687
34695
|
};
|
|
34688
|
-
Secp256k1Program.programId = new
|
|
34696
|
+
Secp256k1Program.programId = new PublicKey51("KeccakSecp256k11111111111111111111111111111");
|
|
34689
34697
|
var _Lockup;
|
|
34690
|
-
var STAKE_CONFIG_ID = new
|
|
34698
|
+
var STAKE_CONFIG_ID = new PublicKey51("StakeConfig11111111111111111111111111111111");
|
|
34691
34699
|
var Authorized = class {
|
|
34692
34700
|
/**
|
|
34693
34701
|
* Create a new Authorized object
|
|
@@ -34718,7 +34726,7 @@ Message: ${transactionMessage}.
|
|
|
34718
34726
|
*/
|
|
34719
34727
|
};
|
|
34720
34728
|
_Lockup = Lockup;
|
|
34721
|
-
Lockup.default = new _Lockup(0, 0,
|
|
34729
|
+
Lockup.default = new _Lockup(0, 0, PublicKey51.default);
|
|
34722
34730
|
var StakeInstruction = class {
|
|
34723
34731
|
/**
|
|
34724
34732
|
* @internal
|
|
@@ -34756,8 +34764,8 @@ Message: ${transactionMessage}.
|
|
|
34756
34764
|
} = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Initialize, instruction.data);
|
|
34757
34765
|
return {
|
|
34758
34766
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34759
|
-
authorized: new Authorized(new
|
|
34760
|
-
lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new
|
|
34767
|
+
authorized: new Authorized(new PublicKey51(authorized2.staker), new PublicKey51(authorized2.withdrawer)),
|
|
34768
|
+
lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new PublicKey51(lockup2.custodian))
|
|
34761
34769
|
};
|
|
34762
34770
|
}
|
|
34763
34771
|
/**
|
|
@@ -34786,7 +34794,7 @@ Message: ${transactionMessage}.
|
|
|
34786
34794
|
const o = {
|
|
34787
34795
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34788
34796
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
34789
|
-
newAuthorizedPubkey: new
|
|
34797
|
+
newAuthorizedPubkey: new PublicKey51(newAuthorized),
|
|
34790
34798
|
stakeAuthorizationType: {
|
|
34791
34799
|
index: stakeAuthorizationType
|
|
34792
34800
|
}
|
|
@@ -34812,8 +34820,8 @@ Message: ${transactionMessage}.
|
|
|
34812
34820
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34813
34821
|
authorityBase: instruction.keys[1].pubkey,
|
|
34814
34822
|
authoritySeed,
|
|
34815
|
-
authorityOwner: new
|
|
34816
|
-
newAuthorizedPubkey: new
|
|
34823
|
+
authorityOwner: new PublicKey51(authorityOwner),
|
|
34824
|
+
newAuthorizedPubkey: new PublicKey51(newAuthorized),
|
|
34817
34825
|
stakeAuthorizationType: {
|
|
34818
34826
|
index: stakeAuthorizationType
|
|
34819
34827
|
}
|
|
@@ -34987,7 +34995,7 @@ Message: ${transactionMessage}.
|
|
|
34987
34995
|
programId: this.programId,
|
|
34988
34996
|
data
|
|
34989
34997
|
};
|
|
34990
|
-
return new
|
|
34998
|
+
return new TransactionInstruction44(instructionData);
|
|
34991
34999
|
}
|
|
34992
35000
|
/**
|
|
34993
35001
|
* Generate a Transaction that creates a new Stake account at
|
|
@@ -35185,7 +35193,7 @@ Message: ${transactionMessage}.
|
|
|
35185
35193
|
const data = encodeData(type, {
|
|
35186
35194
|
lamports
|
|
35187
35195
|
});
|
|
35188
|
-
return new
|
|
35196
|
+
return new TransactionInstruction44({
|
|
35189
35197
|
keys: [{
|
|
35190
35198
|
pubkey: stakePubkey,
|
|
35191
35199
|
isSigner: false,
|
|
@@ -35367,7 +35375,7 @@ Message: ${transactionMessage}.
|
|
|
35367
35375
|
});
|
|
35368
35376
|
}
|
|
35369
35377
|
};
|
|
35370
|
-
StakeProgram.programId = new
|
|
35378
|
+
StakeProgram.programId = new PublicKey51("Stake11111111111111111111111111111111111111");
|
|
35371
35379
|
StakeProgram.space = 200;
|
|
35372
35380
|
var VoteInit = class {
|
|
35373
35381
|
/** [0, 100] */
|
|
@@ -35419,7 +35427,7 @@ Message: ${transactionMessage}.
|
|
|
35419
35427
|
return {
|
|
35420
35428
|
votePubkey: instruction.keys[0].pubkey,
|
|
35421
35429
|
nodePubkey: instruction.keys[3].pubkey,
|
|
35422
|
-
voteInit: new VoteInit(new
|
|
35430
|
+
voteInit: new VoteInit(new PublicKey51(voteInit2.nodePubkey), new PublicKey51(voteInit2.authorizedVoter), new PublicKey51(voteInit2.authorizedWithdrawer), voteInit2.commission)
|
|
35423
35431
|
};
|
|
35424
35432
|
}
|
|
35425
35433
|
/**
|
|
@@ -35435,7 +35443,7 @@ Message: ${transactionMessage}.
|
|
|
35435
35443
|
return {
|
|
35436
35444
|
votePubkey: instruction.keys[0].pubkey,
|
|
35437
35445
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
35438
|
-
newAuthorizedPubkey: new
|
|
35446
|
+
newAuthorizedPubkey: new PublicKey51(newAuthorized),
|
|
35439
35447
|
voteAuthorizationType: {
|
|
35440
35448
|
index: voteAuthorizationType
|
|
35441
35449
|
}
|
|
@@ -35457,9 +35465,9 @@ Message: ${transactionMessage}.
|
|
|
35457
35465
|
} = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data);
|
|
35458
35466
|
return {
|
|
35459
35467
|
currentAuthorityDerivedKeyBasePubkey: instruction.keys[2].pubkey,
|
|
35460
|
-
currentAuthorityDerivedKeyOwnerPubkey: new
|
|
35468
|
+
currentAuthorityDerivedKeyOwnerPubkey: new PublicKey51(currentAuthorityDerivedKeyOwnerPubkey),
|
|
35461
35469
|
currentAuthorityDerivedKeySeed,
|
|
35462
|
-
newAuthorizedPubkey: new
|
|
35470
|
+
newAuthorizedPubkey: new PublicKey51(newAuthorized),
|
|
35463
35471
|
voteAuthorizationType: {
|
|
35464
35472
|
index: voteAuthorizationType
|
|
35465
35473
|
},
|
|
@@ -35577,7 +35585,7 @@ Message: ${transactionMessage}.
|
|
|
35577
35585
|
programId: this.programId,
|
|
35578
35586
|
data
|
|
35579
35587
|
};
|
|
35580
|
-
return new
|
|
35588
|
+
return new TransactionInstruction44(instructionData);
|
|
35581
35589
|
}
|
|
35582
35590
|
/**
|
|
35583
35591
|
* Generate a transaction that creates a new Vote account.
|
|
@@ -35750,9 +35758,9 @@ Message: ${transactionMessage}.
|
|
|
35750
35758
|
});
|
|
35751
35759
|
}
|
|
35752
35760
|
};
|
|
35753
|
-
VoteProgram.programId = new
|
|
35761
|
+
VoteProgram.programId = new PublicKey51("Vote111111111111111111111111111111111111111");
|
|
35754
35762
|
VoteProgram.space = 3762;
|
|
35755
|
-
var VALIDATOR_INFO_KEY = new
|
|
35763
|
+
var VALIDATOR_INFO_KEY = new PublicKey51("Va1idator1nfo111111111111111111111111111111");
|
|
35756
35764
|
var InfoString = superstruct.type({
|
|
35757
35765
|
name: superstruct.string(),
|
|
35758
35766
|
website: superstruct.optional(superstruct.string()),
|
|
@@ -35786,7 +35794,7 @@ Message: ${transactionMessage}.
|
|
|
35786
35794
|
if (configKeyCount !== 2) return null;
|
|
35787
35795
|
const configKeys = [];
|
|
35788
35796
|
for (let i = 0; i < 2; i++) {
|
|
35789
|
-
const publicKey4 = new
|
|
35797
|
+
const publicKey4 = new PublicKey51(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
35790
35798
|
const isSigner = guardedShift(byteArray) === 1;
|
|
35791
35799
|
configKeys.push({
|
|
35792
35800
|
publicKey: publicKey4,
|
|
@@ -35804,7 +35812,7 @@ Message: ${transactionMessage}.
|
|
|
35804
35812
|
return null;
|
|
35805
35813
|
}
|
|
35806
35814
|
};
|
|
35807
|
-
var VOTE_PROGRAM_ID = new
|
|
35815
|
+
var VOTE_PROGRAM_ID = new PublicKey51("Vote111111111111111111111111111111111111111");
|
|
35808
35816
|
var VoteAccountLayout = BufferLayout__namespace.struct([
|
|
35809
35817
|
publicKey3("nodePubkey"),
|
|
35810
35818
|
publicKey3("authorizedWithdrawer"),
|
|
@@ -35861,8 +35869,8 @@ Message: ${transactionMessage}.
|
|
|
35861
35869
|
rootSlot = null;
|
|
35862
35870
|
}
|
|
35863
35871
|
return new _VoteAccount({
|
|
35864
|
-
nodePubkey: new
|
|
35865
|
-
authorizedWithdrawer: new
|
|
35872
|
+
nodePubkey: new PublicKey51(va.nodePubkey),
|
|
35873
|
+
authorizedWithdrawer: new PublicKey51(va.authorizedWithdrawer),
|
|
35866
35874
|
commission: va.commission,
|
|
35867
35875
|
votes: va.votes,
|
|
35868
35876
|
rootSlot,
|
|
@@ -35879,7 +35887,7 @@ Message: ${transactionMessage}.
|
|
|
35879
35887
|
}) {
|
|
35880
35888
|
return {
|
|
35881
35889
|
epoch,
|
|
35882
|
-
authorizedVoter: new
|
|
35890
|
+
authorizedVoter: new PublicKey51(authorizedVoter)
|
|
35883
35891
|
};
|
|
35884
35892
|
}
|
|
35885
35893
|
function parsePriorVoters({
|
|
@@ -35888,7 +35896,7 @@ Message: ${transactionMessage}.
|
|
|
35888
35896
|
targetEpoch
|
|
35889
35897
|
}) {
|
|
35890
35898
|
return {
|
|
35891
|
-
authorizedPubkey: new
|
|
35899
|
+
authorizedPubkey: new PublicKey51(authorizedPubkey),
|
|
35892
35900
|
epochOfLastAuthorizedSwitch,
|
|
35893
35901
|
targetEpoch
|
|
35894
35902
|
};
|
|
@@ -35961,7 +35969,7 @@ Message: ${transactionMessage}.
|
|
|
35961
35969
|
}
|
|
35962
35970
|
var LAMPORTS_PER_SOL4 = 1e9;
|
|
35963
35971
|
exports2.Account = Account;
|
|
35964
|
-
exports2.AddressLookupTableAccount =
|
|
35972
|
+
exports2.AddressLookupTableAccount = AddressLookupTableAccount2;
|
|
35965
35973
|
exports2.AddressLookupTableInstruction = AddressLookupTableInstruction;
|
|
35966
35974
|
exports2.AddressLookupTableProgram = AddressLookupTableProgram;
|
|
35967
35975
|
exports2.Authorized = Authorized;
|
|
@@ -35971,7 +35979,7 @@ Message: ${transactionMessage}.
|
|
|
35971
35979
|
exports2.BpfLoader = BpfLoader;
|
|
35972
35980
|
exports2.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS;
|
|
35973
35981
|
exports2.ComputeBudgetInstruction = ComputeBudgetInstruction;
|
|
35974
|
-
exports2.ComputeBudgetProgram =
|
|
35982
|
+
exports2.ComputeBudgetProgram = ComputeBudgetProgram4;
|
|
35975
35983
|
exports2.Connection = Connection5;
|
|
35976
35984
|
exports2.Ed25519Program = Ed25519Program;
|
|
35977
35985
|
exports2.Enum = Enum;
|
|
@@ -35990,7 +35998,7 @@ Message: ${transactionMessage}.
|
|
|
35990
35998
|
exports2.NonceAccount = NonceAccount;
|
|
35991
35999
|
exports2.PACKET_DATA_SIZE = PACKET_DATA_SIZE;
|
|
35992
36000
|
exports2.PUBLIC_KEY_LENGTH = PUBLIC_KEY_LENGTH2;
|
|
35993
|
-
exports2.PublicKey =
|
|
36001
|
+
exports2.PublicKey = PublicKey51;
|
|
35994
36002
|
exports2.SIGNATURE_LENGTH_IN_BYTES = SIGNATURE_LENGTH_IN_BYTES;
|
|
35995
36003
|
exports2.SOLANA_SCHEMA = SOLANA_SCHEMA;
|
|
35996
36004
|
exports2.STAKE_CONFIG_ID = STAKE_CONFIG_ID;
|
|
@@ -36019,15 +36027,15 @@ Message: ${transactionMessage}.
|
|
|
36019
36027
|
exports2.TransactionExpiredBlockheightExceededError = TransactionExpiredBlockheightExceededError;
|
|
36020
36028
|
exports2.TransactionExpiredNonceInvalidError = TransactionExpiredNonceInvalidError;
|
|
36021
36029
|
exports2.TransactionExpiredTimeoutError = TransactionExpiredTimeoutError;
|
|
36022
|
-
exports2.TransactionInstruction =
|
|
36023
|
-
exports2.TransactionMessage =
|
|
36030
|
+
exports2.TransactionInstruction = TransactionInstruction44;
|
|
36031
|
+
exports2.TransactionMessage = TransactionMessage5;
|
|
36024
36032
|
exports2.TransactionStatus = TransactionStatus;
|
|
36025
36033
|
exports2.VALIDATOR_INFO_KEY = VALIDATOR_INFO_KEY;
|
|
36026
36034
|
exports2.VERSION_PREFIX_MASK = VERSION_PREFIX_MASK;
|
|
36027
36035
|
exports2.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;
|
|
36028
36036
|
exports2.ValidatorInfo = ValidatorInfo;
|
|
36029
36037
|
exports2.VersionedMessage = VersionedMessage;
|
|
36030
|
-
exports2.VersionedTransaction =
|
|
36038
|
+
exports2.VersionedTransaction = VersionedTransaction6;
|
|
36031
36039
|
exports2.VoteAccount = VoteAccount;
|
|
36032
36040
|
exports2.VoteAuthorizationLayout = VoteAuthorizationLayout;
|
|
36033
36041
|
exports2.VoteInit = VoteInit;
|
|
@@ -39769,7 +39777,7 @@ var require_table = __commonJS({
|
|
|
39769
39777
|
var debug = require_debug();
|
|
39770
39778
|
var utils = require_utils4();
|
|
39771
39779
|
var tableLayout = require_layout_manager();
|
|
39772
|
-
var
|
|
39780
|
+
var Table9 = class extends Array {
|
|
39773
39781
|
constructor(opts) {
|
|
39774
39782
|
super();
|
|
39775
39783
|
const options = utils.mergeOptions(opts);
|
|
@@ -39844,7 +39852,7 @@ var require_table = __commonJS({
|
|
|
39844
39852
|
return str[0].length;
|
|
39845
39853
|
}
|
|
39846
39854
|
};
|
|
39847
|
-
|
|
39855
|
+
Table9.reset = () => debug.reset();
|
|
39848
39856
|
function doDraw(row, lineNum, result) {
|
|
39849
39857
|
let line = [];
|
|
39850
39858
|
row.forEach(function(cell) {
|
|
@@ -39853,7 +39861,7 @@ var require_table = __commonJS({
|
|
|
39853
39861
|
let str = line.join("");
|
|
39854
39862
|
if (str.length) result.push(str);
|
|
39855
39863
|
}
|
|
39856
|
-
module2.exports =
|
|
39864
|
+
module2.exports = Table9;
|
|
39857
39865
|
}
|
|
39858
39866
|
});
|
|
39859
39867
|
|
|
@@ -48380,7 +48388,7 @@ var require_lib4 = __commonJS({
|
|
|
48380
48388
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
48381
48389
|
var StructError = class extends TypeError {
|
|
48382
48390
|
constructor(failure, failures) {
|
|
48383
|
-
let
|
|
48391
|
+
let cached2;
|
|
48384
48392
|
const {
|
|
48385
48393
|
message,
|
|
48386
48394
|
...rest
|
|
@@ -48401,7 +48409,7 @@ var require_lib4 = __commonJS({
|
|
|
48401
48409
|
this.name = this.constructor.name;
|
|
48402
48410
|
this.failures = () => {
|
|
48403
48411
|
var _cached;
|
|
48404
|
-
return (_cached =
|
|
48412
|
+
return (_cached = cached2) != null ? _cached : cached2 = [failure, ...failures()];
|
|
48405
48413
|
};
|
|
48406
48414
|
}
|
|
48407
48415
|
};
|
|
@@ -58807,10 +58815,10 @@ var require_parser = __commonJS({
|
|
|
58807
58815
|
}
|
|
58808
58816
|
function peg$parsestart() {
|
|
58809
58817
|
var s0, s1, s2;
|
|
58810
|
-
var key = peg$currPos * 49 + 0,
|
|
58811
|
-
if (
|
|
58812
|
-
peg$currPos =
|
|
58813
|
-
return
|
|
58818
|
+
var key = peg$currPos * 49 + 0, cached2 = peg$cache[key];
|
|
58819
|
+
if (cached2) {
|
|
58820
|
+
peg$currPos = cached2.nextPos;
|
|
58821
|
+
return cached2.result;
|
|
58814
58822
|
}
|
|
58815
58823
|
s0 = peg$currPos;
|
|
58816
58824
|
s1 = [];
|
|
@@ -58829,10 +58837,10 @@ var require_parser = __commonJS({
|
|
|
58829
58837
|
}
|
|
58830
58838
|
function peg$parseline() {
|
|
58831
58839
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
58832
|
-
var key = peg$currPos * 49 + 1,
|
|
58833
|
-
if (
|
|
58834
|
-
peg$currPos =
|
|
58835
|
-
return
|
|
58840
|
+
var key = peg$currPos * 49 + 1, cached2 = peg$cache[key];
|
|
58841
|
+
if (cached2) {
|
|
58842
|
+
peg$currPos = cached2.nextPos;
|
|
58843
|
+
return cached2.result;
|
|
58836
58844
|
}
|
|
58837
58845
|
s0 = peg$currPos;
|
|
58838
58846
|
s1 = [];
|
|
@@ -58940,10 +58948,10 @@ var require_parser = __commonJS({
|
|
|
58940
58948
|
}
|
|
58941
58949
|
function peg$parseexpression() {
|
|
58942
58950
|
var s0;
|
|
58943
|
-
var key = peg$currPos * 49 + 2,
|
|
58944
|
-
if (
|
|
58945
|
-
peg$currPos =
|
|
58946
|
-
return
|
|
58951
|
+
var key = peg$currPos * 49 + 2, cached2 = peg$cache[key];
|
|
58952
|
+
if (cached2) {
|
|
58953
|
+
peg$currPos = cached2.nextPos;
|
|
58954
|
+
return cached2.result;
|
|
58947
58955
|
}
|
|
58948
58956
|
s0 = peg$parsecomment();
|
|
58949
58957
|
if (s0 === peg$FAILED) {
|
|
@@ -58960,10 +58968,10 @@ var require_parser = __commonJS({
|
|
|
58960
58968
|
}
|
|
58961
58969
|
function peg$parsecomment() {
|
|
58962
58970
|
var s0, s1, s2, s3, s4, s5;
|
|
58963
|
-
var key = peg$currPos * 49 + 3,
|
|
58964
|
-
if (
|
|
58965
|
-
peg$currPos =
|
|
58966
|
-
return
|
|
58971
|
+
var key = peg$currPos * 49 + 3, cached2 = peg$cache[key];
|
|
58972
|
+
if (cached2) {
|
|
58973
|
+
peg$currPos = cached2.nextPos;
|
|
58974
|
+
return cached2.result;
|
|
58967
58975
|
}
|
|
58968
58976
|
s0 = peg$currPos;
|
|
58969
58977
|
if (input.charCodeAt(peg$currPos) === 35) {
|
|
@@ -59066,10 +59074,10 @@ var require_parser = __commonJS({
|
|
|
59066
59074
|
}
|
|
59067
59075
|
function peg$parsepath() {
|
|
59068
59076
|
var s0, s1, s2, s3, s4, s5;
|
|
59069
|
-
var key = peg$currPos * 49 + 4,
|
|
59070
|
-
if (
|
|
59071
|
-
peg$currPos =
|
|
59072
|
-
return
|
|
59077
|
+
var key = peg$currPos * 49 + 4, cached2 = peg$cache[key];
|
|
59078
|
+
if (cached2) {
|
|
59079
|
+
peg$currPos = cached2.nextPos;
|
|
59080
|
+
return cached2.result;
|
|
59073
59081
|
}
|
|
59074
59082
|
s0 = peg$currPos;
|
|
59075
59083
|
if (input.charCodeAt(peg$currPos) === 91) {
|
|
@@ -59136,10 +59144,10 @@ var require_parser = __commonJS({
|
|
|
59136
59144
|
}
|
|
59137
59145
|
function peg$parsetablearray() {
|
|
59138
59146
|
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
59139
|
-
var key = peg$currPos * 49 + 5,
|
|
59140
|
-
if (
|
|
59141
|
-
peg$currPos =
|
|
59142
|
-
return
|
|
59147
|
+
var key = peg$currPos * 49 + 5, cached2 = peg$cache[key];
|
|
59148
|
+
if (cached2) {
|
|
59149
|
+
peg$currPos = cached2.nextPos;
|
|
59150
|
+
return cached2.result;
|
|
59143
59151
|
}
|
|
59144
59152
|
s0 = peg$currPos;
|
|
59145
59153
|
if (input.charCodeAt(peg$currPos) === 91) {
|
|
@@ -59234,10 +59242,10 @@ var require_parser = __commonJS({
|
|
|
59234
59242
|
}
|
|
59235
59243
|
function peg$parsetable_key() {
|
|
59236
59244
|
var s0, s1, s2;
|
|
59237
|
-
var key = peg$currPos * 49 + 6,
|
|
59238
|
-
if (
|
|
59239
|
-
peg$currPos =
|
|
59240
|
-
return
|
|
59245
|
+
var key = peg$currPos * 49 + 6, cached2 = peg$cache[key];
|
|
59246
|
+
if (cached2) {
|
|
59247
|
+
peg$currPos = cached2.nextPos;
|
|
59248
|
+
return cached2.result;
|
|
59241
59249
|
}
|
|
59242
59250
|
s0 = peg$currPos;
|
|
59243
59251
|
s1 = [];
|
|
@@ -59278,10 +59286,10 @@ var require_parser = __commonJS({
|
|
|
59278
59286
|
}
|
|
59279
59287
|
function peg$parsetable_key_part() {
|
|
59280
59288
|
var s0, s1, s2, s3, s4;
|
|
59281
|
-
var key = peg$currPos * 49 + 7,
|
|
59282
|
-
if (
|
|
59283
|
-
peg$currPos =
|
|
59284
|
-
return
|
|
59289
|
+
var key = peg$currPos * 49 + 7, cached2 = peg$cache[key];
|
|
59290
|
+
if (cached2) {
|
|
59291
|
+
peg$currPos = cached2.nextPos;
|
|
59292
|
+
return cached2.result;
|
|
59285
59293
|
}
|
|
59286
59294
|
s0 = peg$currPos;
|
|
59287
59295
|
s1 = [];
|
|
@@ -59354,10 +59362,10 @@ var require_parser = __commonJS({
|
|
|
59354
59362
|
}
|
|
59355
59363
|
function peg$parsedot_ended_table_key_part() {
|
|
59356
59364
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
59357
|
-
var key = peg$currPos * 49 + 8,
|
|
59358
|
-
if (
|
|
59359
|
-
peg$currPos =
|
|
59360
|
-
return
|
|
59365
|
+
var key = peg$currPos * 49 + 8, cached2 = peg$cache[key];
|
|
59366
|
+
if (cached2) {
|
|
59367
|
+
peg$currPos = cached2.nextPos;
|
|
59368
|
+
return cached2.result;
|
|
59361
59369
|
}
|
|
59362
59370
|
s0 = peg$currPos;
|
|
59363
59371
|
s1 = [];
|
|
@@ -59480,10 +59488,10 @@ var require_parser = __commonJS({
|
|
|
59480
59488
|
}
|
|
59481
59489
|
function peg$parseassignment() {
|
|
59482
59490
|
var s0, s1, s2, s3, s4, s5;
|
|
59483
|
-
var key = peg$currPos * 49 + 9,
|
|
59484
|
-
if (
|
|
59485
|
-
peg$currPos =
|
|
59486
|
-
return
|
|
59491
|
+
var key = peg$currPos * 49 + 9, cached2 = peg$cache[key];
|
|
59492
|
+
if (cached2) {
|
|
59493
|
+
peg$currPos = cached2.nextPos;
|
|
59494
|
+
return cached2.result;
|
|
59487
59495
|
}
|
|
59488
59496
|
s0 = peg$currPos;
|
|
59489
59497
|
s1 = peg$parsekey();
|
|
@@ -59596,10 +59604,10 @@ var require_parser = __commonJS({
|
|
|
59596
59604
|
}
|
|
59597
59605
|
function peg$parsekey() {
|
|
59598
59606
|
var s0, s1, s2;
|
|
59599
|
-
var key = peg$currPos * 49 + 10,
|
|
59600
|
-
if (
|
|
59601
|
-
peg$currPos =
|
|
59602
|
-
return
|
|
59607
|
+
var key = peg$currPos * 49 + 10, cached2 = peg$cache[key];
|
|
59608
|
+
if (cached2) {
|
|
59609
|
+
peg$currPos = cached2.nextPos;
|
|
59610
|
+
return cached2.result;
|
|
59603
59611
|
}
|
|
59604
59612
|
s0 = peg$currPos;
|
|
59605
59613
|
s1 = [];
|
|
@@ -59622,10 +59630,10 @@ var require_parser = __commonJS({
|
|
|
59622
59630
|
}
|
|
59623
59631
|
function peg$parsequoted_key() {
|
|
59624
59632
|
var s0, s1;
|
|
59625
|
-
var key = peg$currPos * 49 + 11,
|
|
59626
|
-
if (
|
|
59627
|
-
peg$currPos =
|
|
59628
|
-
return
|
|
59633
|
+
var key = peg$currPos * 49 + 11, cached2 = peg$cache[key];
|
|
59634
|
+
if (cached2) {
|
|
59635
|
+
peg$currPos = cached2.nextPos;
|
|
59636
|
+
return cached2.result;
|
|
59629
59637
|
}
|
|
59630
59638
|
s0 = peg$currPos;
|
|
59631
59639
|
s1 = peg$parsedouble_quoted_single_line_string();
|
|
@@ -59648,10 +59656,10 @@ var require_parser = __commonJS({
|
|
|
59648
59656
|
}
|
|
59649
59657
|
function peg$parsevalue() {
|
|
59650
59658
|
var s0;
|
|
59651
|
-
var key = peg$currPos * 49 + 12,
|
|
59652
|
-
if (
|
|
59653
|
-
peg$currPos =
|
|
59654
|
-
return
|
|
59659
|
+
var key = peg$currPos * 49 + 12, cached2 = peg$cache[key];
|
|
59660
|
+
if (cached2) {
|
|
59661
|
+
peg$currPos = cached2.nextPos;
|
|
59662
|
+
return cached2.result;
|
|
59655
59663
|
}
|
|
59656
59664
|
s0 = peg$parsestring();
|
|
59657
59665
|
if (s0 === peg$FAILED) {
|
|
@@ -59677,10 +59685,10 @@ var require_parser = __commonJS({
|
|
|
59677
59685
|
}
|
|
59678
59686
|
function peg$parsestring() {
|
|
59679
59687
|
var s0;
|
|
59680
|
-
var key = peg$currPos * 49 + 13,
|
|
59681
|
-
if (
|
|
59682
|
-
peg$currPos =
|
|
59683
|
-
return
|
|
59688
|
+
var key = peg$currPos * 49 + 13, cached2 = peg$cache[key];
|
|
59689
|
+
if (cached2) {
|
|
59690
|
+
peg$currPos = cached2.nextPos;
|
|
59691
|
+
return cached2.result;
|
|
59684
59692
|
}
|
|
59685
59693
|
s0 = peg$parsedouble_quoted_multiline_string();
|
|
59686
59694
|
if (s0 === peg$FAILED) {
|
|
@@ -59697,10 +59705,10 @@ var require_parser = __commonJS({
|
|
|
59697
59705
|
}
|
|
59698
59706
|
function peg$parsedouble_quoted_multiline_string() {
|
|
59699
59707
|
var s0, s1, s2, s3, s4;
|
|
59700
|
-
var key = peg$currPos * 49 + 14,
|
|
59701
|
-
if (
|
|
59702
|
-
peg$currPos =
|
|
59703
|
-
return
|
|
59708
|
+
var key = peg$currPos * 49 + 14, cached2 = peg$cache[key];
|
|
59709
|
+
if (cached2) {
|
|
59710
|
+
peg$currPos = cached2.nextPos;
|
|
59711
|
+
return cached2.result;
|
|
59704
59712
|
}
|
|
59705
59713
|
s0 = peg$currPos;
|
|
59706
59714
|
if (input.substr(peg$currPos, 3) === peg$c23) {
|
|
@@ -59759,10 +59767,10 @@ var require_parser = __commonJS({
|
|
|
59759
59767
|
}
|
|
59760
59768
|
function peg$parsedouble_quoted_single_line_string() {
|
|
59761
59769
|
var s0, s1, s2, s3;
|
|
59762
|
-
var key = peg$currPos * 49 + 15,
|
|
59763
|
-
if (
|
|
59764
|
-
peg$currPos =
|
|
59765
|
-
return
|
|
59770
|
+
var key = peg$currPos * 49 + 15, cached2 = peg$cache[key];
|
|
59771
|
+
if (cached2) {
|
|
59772
|
+
peg$currPos = cached2.nextPos;
|
|
59773
|
+
return cached2.result;
|
|
59766
59774
|
}
|
|
59767
59775
|
s0 = peg$currPos;
|
|
59768
59776
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
@@ -59812,10 +59820,10 @@ var require_parser = __commonJS({
|
|
|
59812
59820
|
}
|
|
59813
59821
|
function peg$parsesingle_quoted_multiline_string() {
|
|
59814
59822
|
var s0, s1, s2, s3, s4;
|
|
59815
|
-
var key = peg$currPos * 49 + 16,
|
|
59816
|
-
if (
|
|
59817
|
-
peg$currPos =
|
|
59818
|
-
return
|
|
59823
|
+
var key = peg$currPos * 49 + 16, cached2 = peg$cache[key];
|
|
59824
|
+
if (cached2) {
|
|
59825
|
+
peg$currPos = cached2.nextPos;
|
|
59826
|
+
return cached2.result;
|
|
59819
59827
|
}
|
|
59820
59828
|
s0 = peg$currPos;
|
|
59821
59829
|
if (input.substr(peg$currPos, 3) === peg$c29) {
|
|
@@ -59874,10 +59882,10 @@ var require_parser = __commonJS({
|
|
|
59874
59882
|
}
|
|
59875
59883
|
function peg$parsesingle_quoted_single_line_string() {
|
|
59876
59884
|
var s0, s1, s2, s3;
|
|
59877
|
-
var key = peg$currPos * 49 + 17,
|
|
59878
|
-
if (
|
|
59879
|
-
peg$currPos =
|
|
59880
|
-
return
|
|
59885
|
+
var key = peg$currPos * 49 + 17, cached2 = peg$cache[key];
|
|
59886
|
+
if (cached2) {
|
|
59887
|
+
peg$currPos = cached2.nextPos;
|
|
59888
|
+
return cached2.result;
|
|
59881
59889
|
}
|
|
59882
59890
|
s0 = peg$currPos;
|
|
59883
59891
|
if (input.charCodeAt(peg$currPos) === 39) {
|
|
@@ -59927,10 +59935,10 @@ var require_parser = __commonJS({
|
|
|
59927
59935
|
}
|
|
59928
59936
|
function peg$parsestring_char() {
|
|
59929
59937
|
var s0, s1, s2;
|
|
59930
|
-
var key = peg$currPos * 49 + 18,
|
|
59931
|
-
if (
|
|
59932
|
-
peg$currPos =
|
|
59933
|
-
return
|
|
59938
|
+
var key = peg$currPos * 49 + 18, cached2 = peg$cache[key];
|
|
59939
|
+
if (cached2) {
|
|
59940
|
+
peg$currPos = cached2.nextPos;
|
|
59941
|
+
return cached2.result;
|
|
59934
59942
|
}
|
|
59935
59943
|
s0 = peg$parseESCAPED();
|
|
59936
59944
|
if (s0 === peg$FAILED) {
|
|
@@ -59981,10 +59989,10 @@ var require_parser = __commonJS({
|
|
|
59981
59989
|
}
|
|
59982
59990
|
function peg$parseliteral_char() {
|
|
59983
59991
|
var s0, s1, s2;
|
|
59984
|
-
var key = peg$currPos * 49 + 19,
|
|
59985
|
-
if (
|
|
59986
|
-
peg$currPos =
|
|
59987
|
-
return
|
|
59992
|
+
var key = peg$currPos * 49 + 19, cached2 = peg$cache[key];
|
|
59993
|
+
if (cached2) {
|
|
59994
|
+
peg$currPos = cached2.nextPos;
|
|
59995
|
+
return cached2.result;
|
|
59988
59996
|
}
|
|
59989
59997
|
s0 = peg$currPos;
|
|
59990
59998
|
s1 = peg$currPos;
|
|
@@ -60032,10 +60040,10 @@ var require_parser = __commonJS({
|
|
|
60032
60040
|
}
|
|
60033
60041
|
function peg$parsemultiline_string_char() {
|
|
60034
60042
|
var s0, s1, s2;
|
|
60035
|
-
var key = peg$currPos * 49 + 20,
|
|
60036
|
-
if (
|
|
60037
|
-
peg$currPos =
|
|
60038
|
-
return
|
|
60043
|
+
var key = peg$currPos * 49 + 20, cached2 = peg$cache[key];
|
|
60044
|
+
if (cached2) {
|
|
60045
|
+
peg$currPos = cached2.nextPos;
|
|
60046
|
+
return cached2.result;
|
|
60039
60047
|
}
|
|
60040
60048
|
s0 = peg$parseESCAPED();
|
|
60041
60049
|
if (s0 === peg$FAILED) {
|
|
@@ -60089,10 +60097,10 @@ var require_parser = __commonJS({
|
|
|
60089
60097
|
}
|
|
60090
60098
|
function peg$parsemultiline_string_delim() {
|
|
60091
60099
|
var s0, s1, s2, s3, s4;
|
|
60092
|
-
var key = peg$currPos * 49 + 21,
|
|
60093
|
-
if (
|
|
60094
|
-
peg$currPos =
|
|
60095
|
-
return
|
|
60100
|
+
var key = peg$currPos * 49 + 21, cached2 = peg$cache[key];
|
|
60101
|
+
if (cached2) {
|
|
60102
|
+
peg$currPos = cached2.nextPos;
|
|
60103
|
+
return cached2.result;
|
|
60096
60104
|
}
|
|
60097
60105
|
s0 = peg$currPos;
|
|
60098
60106
|
if (input.charCodeAt(peg$currPos) === 92) {
|
|
@@ -60134,10 +60142,10 @@ var require_parser = __commonJS({
|
|
|
60134
60142
|
}
|
|
60135
60143
|
function peg$parsemultiline_literal_char() {
|
|
60136
60144
|
var s0, s1, s2;
|
|
60137
|
-
var key = peg$currPos * 49 + 22,
|
|
60138
|
-
if (
|
|
60139
|
-
peg$currPos =
|
|
60140
|
-
return
|
|
60145
|
+
var key = peg$currPos * 49 + 22, cached2 = peg$cache[key];
|
|
60146
|
+
if (cached2) {
|
|
60147
|
+
peg$currPos = cached2.nextPos;
|
|
60148
|
+
return cached2.result;
|
|
60141
60149
|
}
|
|
60142
60150
|
s0 = peg$currPos;
|
|
60143
60151
|
s1 = peg$currPos;
|
|
@@ -60185,10 +60193,10 @@ var require_parser = __commonJS({
|
|
|
60185
60193
|
}
|
|
60186
60194
|
function peg$parsefloat() {
|
|
60187
60195
|
var s0, s1, s2, s3;
|
|
60188
|
-
var key = peg$currPos * 49 + 23,
|
|
60189
|
-
if (
|
|
60190
|
-
peg$currPos =
|
|
60191
|
-
return
|
|
60196
|
+
var key = peg$currPos * 49 + 23, cached2 = peg$cache[key];
|
|
60197
|
+
if (cached2) {
|
|
60198
|
+
peg$currPos = cached2.nextPos;
|
|
60199
|
+
return cached2.result;
|
|
60192
60200
|
}
|
|
60193
60201
|
s0 = peg$currPos;
|
|
60194
60202
|
s1 = peg$parsefloat_text();
|
|
@@ -60248,10 +60256,10 @@ var require_parser = __commonJS({
|
|
|
60248
60256
|
}
|
|
60249
60257
|
function peg$parsefloat_text() {
|
|
60250
60258
|
var s0, s1, s2, s3, s4, s5;
|
|
60251
|
-
var key = peg$currPos * 49 + 24,
|
|
60252
|
-
if (
|
|
60253
|
-
peg$currPos =
|
|
60254
|
-
return
|
|
60259
|
+
var key = peg$currPos * 49 + 24, cached2 = peg$cache[key];
|
|
60260
|
+
if (cached2) {
|
|
60261
|
+
peg$currPos = cached2.nextPos;
|
|
60262
|
+
return cached2.result;
|
|
60255
60263
|
}
|
|
60256
60264
|
s0 = peg$currPos;
|
|
60257
60265
|
if (input.charCodeAt(peg$currPos) === 43) {
|
|
@@ -60367,10 +60375,10 @@ var require_parser = __commonJS({
|
|
|
60367
60375
|
}
|
|
60368
60376
|
function peg$parseinteger() {
|
|
60369
60377
|
var s0, s1;
|
|
60370
|
-
var key = peg$currPos * 49 + 25,
|
|
60371
|
-
if (
|
|
60372
|
-
peg$currPos =
|
|
60373
|
-
return
|
|
60378
|
+
var key = peg$currPos * 49 + 25, cached2 = peg$cache[key];
|
|
60379
|
+
if (cached2) {
|
|
60380
|
+
peg$currPos = cached2.nextPos;
|
|
60381
|
+
return cached2.result;
|
|
60374
60382
|
}
|
|
60375
60383
|
s0 = peg$currPos;
|
|
60376
60384
|
s1 = peg$parseinteger_text();
|
|
@@ -60384,10 +60392,10 @@ var require_parser = __commonJS({
|
|
|
60384
60392
|
}
|
|
60385
60393
|
function peg$parseinteger_text() {
|
|
60386
60394
|
var s0, s1, s2, s3, s4;
|
|
60387
|
-
var key = peg$currPos * 49 + 26,
|
|
60388
|
-
if (
|
|
60389
|
-
peg$currPos =
|
|
60390
|
-
return
|
|
60395
|
+
var key = peg$currPos * 49 + 26, cached2 = peg$cache[key];
|
|
60396
|
+
if (cached2) {
|
|
60397
|
+
peg$currPos = cached2.nextPos;
|
|
60398
|
+
return cached2.result;
|
|
60391
60399
|
}
|
|
60392
60400
|
s0 = peg$currPos;
|
|
60393
60401
|
if (input.charCodeAt(peg$currPos) === 43) {
|
|
@@ -60511,10 +60519,10 @@ var require_parser = __commonJS({
|
|
|
60511
60519
|
}
|
|
60512
60520
|
function peg$parseboolean() {
|
|
60513
60521
|
var s0, s1;
|
|
60514
|
-
var key = peg$currPos * 49 + 27,
|
|
60515
|
-
if (
|
|
60516
|
-
peg$currPos =
|
|
60517
|
-
return
|
|
60522
|
+
var key = peg$currPos * 49 + 27, cached2 = peg$cache[key];
|
|
60523
|
+
if (cached2) {
|
|
60524
|
+
peg$currPos = cached2.nextPos;
|
|
60525
|
+
return cached2.result;
|
|
60518
60526
|
}
|
|
60519
60527
|
s0 = peg$currPos;
|
|
60520
60528
|
if (input.substr(peg$currPos, 4) === peg$c51) {
|
|
@@ -60553,10 +60561,10 @@ var require_parser = __commonJS({
|
|
|
60553
60561
|
}
|
|
60554
60562
|
function peg$parsearray() {
|
|
60555
60563
|
var s0, s1, s2, s3, s4;
|
|
60556
|
-
var key = peg$currPos * 49 + 28,
|
|
60557
|
-
if (
|
|
60558
|
-
peg$currPos =
|
|
60559
|
-
return
|
|
60564
|
+
var key = peg$currPos * 49 + 28, cached2 = peg$cache[key];
|
|
60565
|
+
if (cached2) {
|
|
60566
|
+
peg$currPos = cached2.nextPos;
|
|
60567
|
+
return cached2.result;
|
|
60560
60568
|
}
|
|
60561
60569
|
s0 = peg$currPos;
|
|
60562
60570
|
if (input.charCodeAt(peg$currPos) === 91) {
|
|
@@ -60753,10 +60761,10 @@ var require_parser = __commonJS({
|
|
|
60753
60761
|
}
|
|
60754
60762
|
function peg$parsearray_value() {
|
|
60755
60763
|
var s0, s1, s2, s3, s4;
|
|
60756
|
-
var key = peg$currPos * 49 + 29,
|
|
60757
|
-
if (
|
|
60758
|
-
peg$currPos =
|
|
60759
|
-
return
|
|
60764
|
+
var key = peg$currPos * 49 + 29, cached2 = peg$cache[key];
|
|
60765
|
+
if (cached2) {
|
|
60766
|
+
peg$currPos = cached2.nextPos;
|
|
60767
|
+
return cached2.result;
|
|
60760
60768
|
}
|
|
60761
60769
|
s0 = peg$currPos;
|
|
60762
60770
|
s1 = [];
|
|
@@ -60795,10 +60803,10 @@ var require_parser = __commonJS({
|
|
|
60795
60803
|
}
|
|
60796
60804
|
function peg$parsearray_value_list() {
|
|
60797
60805
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
60798
|
-
var key = peg$currPos * 49 + 30,
|
|
60799
|
-
if (
|
|
60800
|
-
peg$currPos =
|
|
60801
|
-
return
|
|
60806
|
+
var key = peg$currPos * 49 + 30, cached2 = peg$cache[key];
|
|
60807
|
+
if (cached2) {
|
|
60808
|
+
peg$currPos = cached2.nextPos;
|
|
60809
|
+
return cached2.result;
|
|
60802
60810
|
}
|
|
60803
60811
|
s0 = peg$currPos;
|
|
60804
60812
|
s1 = [];
|
|
@@ -60862,10 +60870,10 @@ var require_parser = __commonJS({
|
|
|
60862
60870
|
}
|
|
60863
60871
|
function peg$parsearray_sep() {
|
|
60864
60872
|
var s0;
|
|
60865
|
-
var key = peg$currPos * 49 + 31,
|
|
60866
|
-
if (
|
|
60867
|
-
peg$currPos =
|
|
60868
|
-
return
|
|
60873
|
+
var key = peg$currPos * 49 + 31, cached2 = peg$cache[key];
|
|
60874
|
+
if (cached2) {
|
|
60875
|
+
peg$currPos = cached2.nextPos;
|
|
60876
|
+
return cached2.result;
|
|
60869
60877
|
}
|
|
60870
60878
|
s0 = peg$parseS();
|
|
60871
60879
|
if (s0 === peg$FAILED) {
|
|
@@ -60879,10 +60887,10 @@ var require_parser = __commonJS({
|
|
|
60879
60887
|
}
|
|
60880
60888
|
function peg$parseinline_table() {
|
|
60881
60889
|
var s0, s1, s2, s3, s4, s5;
|
|
60882
|
-
var key = peg$currPos * 49 + 32,
|
|
60883
|
-
if (
|
|
60884
|
-
peg$currPos =
|
|
60885
|
-
return
|
|
60890
|
+
var key = peg$currPos * 49 + 32, cached2 = peg$cache[key];
|
|
60891
|
+
if (cached2) {
|
|
60892
|
+
peg$currPos = cached2.nextPos;
|
|
60893
|
+
return cached2.result;
|
|
60886
60894
|
}
|
|
60887
60895
|
s0 = peg$currPos;
|
|
60888
60896
|
if (input.charCodeAt(peg$currPos) === 123) {
|
|
@@ -60954,10 +60962,10 @@ var require_parser = __commonJS({
|
|
|
60954
60962
|
}
|
|
60955
60963
|
function peg$parseinline_table_assignment() {
|
|
60956
60964
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
60957
|
-
var key = peg$currPos * 49 + 33,
|
|
60958
|
-
if (
|
|
60959
|
-
peg$currPos =
|
|
60960
|
-
return
|
|
60965
|
+
var key = peg$currPos * 49 + 33, cached2 = peg$cache[key];
|
|
60966
|
+
if (cached2) {
|
|
60967
|
+
peg$currPos = cached2.nextPos;
|
|
60968
|
+
return cached2.result;
|
|
60961
60969
|
}
|
|
60962
60970
|
s0 = peg$currPos;
|
|
60963
60971
|
s1 = [];
|
|
@@ -61128,10 +61136,10 @@ var require_parser = __commonJS({
|
|
|
61128
61136
|
}
|
|
61129
61137
|
function peg$parsesecfragment() {
|
|
61130
61138
|
var s0, s1, s2;
|
|
61131
|
-
var key = peg$currPos * 49 + 34,
|
|
61132
|
-
if (
|
|
61133
|
-
peg$currPos =
|
|
61134
|
-
return
|
|
61139
|
+
var key = peg$currPos * 49 + 34, cached2 = peg$cache[key];
|
|
61140
|
+
if (cached2) {
|
|
61141
|
+
peg$currPos = cached2.nextPos;
|
|
61142
|
+
return cached2.result;
|
|
61135
61143
|
}
|
|
61136
61144
|
s0 = peg$currPos;
|
|
61137
61145
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
@@ -61162,10 +61170,10 @@ var require_parser = __commonJS({
|
|
|
61162
61170
|
}
|
|
61163
61171
|
function peg$parsedate() {
|
|
61164
61172
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
|
|
61165
|
-
var key = peg$currPos * 49 + 35,
|
|
61166
|
-
if (
|
|
61167
|
-
peg$currPos =
|
|
61168
|
-
return
|
|
61173
|
+
var key = peg$currPos * 49 + 35, cached2 = peg$cache[key];
|
|
61174
|
+
if (cached2) {
|
|
61175
|
+
peg$currPos = cached2.nextPos;
|
|
61176
|
+
return cached2.result;
|
|
61169
61177
|
}
|
|
61170
61178
|
s0 = peg$currPos;
|
|
61171
61179
|
s1 = peg$currPos;
|
|
@@ -61257,10 +61265,10 @@ var require_parser = __commonJS({
|
|
|
61257
61265
|
}
|
|
61258
61266
|
function peg$parsetime() {
|
|
61259
61267
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
61260
|
-
var key = peg$currPos * 49 + 36,
|
|
61261
|
-
if (
|
|
61262
|
-
peg$currPos =
|
|
61263
|
-
return
|
|
61268
|
+
var key = peg$currPos * 49 + 36, cached2 = peg$cache[key];
|
|
61269
|
+
if (cached2) {
|
|
61270
|
+
peg$currPos = cached2.nextPos;
|
|
61271
|
+
return cached2.result;
|
|
61264
61272
|
}
|
|
61265
61273
|
s0 = peg$currPos;
|
|
61266
61274
|
s1 = peg$currPos;
|
|
@@ -61349,10 +61357,10 @@ var require_parser = __commonJS({
|
|
|
61349
61357
|
}
|
|
61350
61358
|
function peg$parsetime_with_offset() {
|
|
61351
61359
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s163;
|
|
61352
|
-
var key = peg$currPos * 49 + 37,
|
|
61353
|
-
if (
|
|
61354
|
-
peg$currPos =
|
|
61355
|
-
return
|
|
61360
|
+
var key = peg$currPos * 49 + 37, cached2 = peg$cache[key];
|
|
61361
|
+
if (cached2) {
|
|
61362
|
+
peg$currPos = cached2.nextPos;
|
|
61363
|
+
return cached2.result;
|
|
61356
61364
|
}
|
|
61357
61365
|
s0 = peg$currPos;
|
|
61358
61366
|
s1 = peg$currPos;
|
|
@@ -61504,10 +61512,10 @@ var require_parser = __commonJS({
|
|
|
61504
61512
|
}
|
|
61505
61513
|
function peg$parsedatetime() {
|
|
61506
61514
|
var s0, s1, s2, s3, s4;
|
|
61507
|
-
var key = peg$currPos * 49 + 38,
|
|
61508
|
-
if (
|
|
61509
|
-
peg$currPos =
|
|
61510
|
-
return
|
|
61515
|
+
var key = peg$currPos * 49 + 38, cached2 = peg$cache[key];
|
|
61516
|
+
if (cached2) {
|
|
61517
|
+
peg$currPos = cached2.nextPos;
|
|
61518
|
+
return cached2.result;
|
|
61511
61519
|
}
|
|
61512
61520
|
s0 = peg$currPos;
|
|
61513
61521
|
s1 = peg$parsedate();
|
|
@@ -61590,10 +61598,10 @@ var require_parser = __commonJS({
|
|
|
61590
61598
|
}
|
|
61591
61599
|
function peg$parseS() {
|
|
61592
61600
|
var s0;
|
|
61593
|
-
var key = peg$currPos * 49 + 39,
|
|
61594
|
-
if (
|
|
61595
|
-
peg$currPos =
|
|
61596
|
-
return
|
|
61601
|
+
var key = peg$currPos * 49 + 39, cached2 = peg$cache[key];
|
|
61602
|
+
if (cached2) {
|
|
61603
|
+
peg$currPos = cached2.nextPos;
|
|
61604
|
+
return cached2.result;
|
|
61597
61605
|
}
|
|
61598
61606
|
if (peg$c81.test(input.charAt(peg$currPos))) {
|
|
61599
61607
|
s0 = input.charAt(peg$currPos);
|
|
@@ -61609,10 +61617,10 @@ var require_parser = __commonJS({
|
|
|
61609
61617
|
}
|
|
61610
61618
|
function peg$parseNL() {
|
|
61611
61619
|
var s0, s1, s2;
|
|
61612
|
-
var key = peg$currPos * 49 + 40,
|
|
61613
|
-
if (
|
|
61614
|
-
peg$currPos =
|
|
61615
|
-
return
|
|
61620
|
+
var key = peg$currPos * 49 + 40, cached2 = peg$cache[key];
|
|
61621
|
+
if (cached2) {
|
|
61622
|
+
peg$currPos = cached2.nextPos;
|
|
61623
|
+
return cached2.result;
|
|
61616
61624
|
}
|
|
61617
61625
|
if (input.charCodeAt(peg$currPos) === 10) {
|
|
61618
61626
|
s0 = peg$c83;
|
|
@@ -61661,10 +61669,10 @@ var require_parser = __commonJS({
|
|
|
61661
61669
|
}
|
|
61662
61670
|
function peg$parseNLS() {
|
|
61663
61671
|
var s0;
|
|
61664
|
-
var key = peg$currPos * 49 + 41,
|
|
61665
|
-
if (
|
|
61666
|
-
peg$currPos =
|
|
61667
|
-
return
|
|
61672
|
+
var key = peg$currPos * 49 + 41, cached2 = peg$cache[key];
|
|
61673
|
+
if (cached2) {
|
|
61674
|
+
peg$currPos = cached2.nextPos;
|
|
61675
|
+
return cached2.result;
|
|
61668
61676
|
}
|
|
61669
61677
|
s0 = peg$parseNL();
|
|
61670
61678
|
if (s0 === peg$FAILED) {
|
|
@@ -61675,10 +61683,10 @@ var require_parser = __commonJS({
|
|
|
61675
61683
|
}
|
|
61676
61684
|
function peg$parseEOF() {
|
|
61677
61685
|
var s0, s1;
|
|
61678
|
-
var key = peg$currPos * 49 + 42,
|
|
61679
|
-
if (
|
|
61680
|
-
peg$currPos =
|
|
61681
|
-
return
|
|
61686
|
+
var key = peg$currPos * 49 + 42, cached2 = peg$cache[key];
|
|
61687
|
+
if (cached2) {
|
|
61688
|
+
peg$currPos = cached2.nextPos;
|
|
61689
|
+
return cached2.result;
|
|
61682
61690
|
}
|
|
61683
61691
|
s0 = peg$currPos;
|
|
61684
61692
|
peg$silentFails++;
|
|
@@ -61703,10 +61711,10 @@ var require_parser = __commonJS({
|
|
|
61703
61711
|
}
|
|
61704
61712
|
function peg$parseHEX() {
|
|
61705
61713
|
var s0;
|
|
61706
|
-
var key = peg$currPos * 49 + 43,
|
|
61707
|
-
if (
|
|
61708
|
-
peg$currPos =
|
|
61709
|
-
return
|
|
61714
|
+
var key = peg$currPos * 49 + 43, cached2 = peg$cache[key];
|
|
61715
|
+
if (cached2) {
|
|
61716
|
+
peg$currPos = cached2.nextPos;
|
|
61717
|
+
return cached2.result;
|
|
61710
61718
|
}
|
|
61711
61719
|
if (peg$c87.test(input.charAt(peg$currPos))) {
|
|
61712
61720
|
s0 = input.charAt(peg$currPos);
|
|
@@ -61722,10 +61730,10 @@ var require_parser = __commonJS({
|
|
|
61722
61730
|
}
|
|
61723
61731
|
function peg$parseDIGIT_OR_UNDER() {
|
|
61724
61732
|
var s0, s1;
|
|
61725
|
-
var key = peg$currPos * 49 + 44,
|
|
61726
|
-
if (
|
|
61727
|
-
peg$currPos =
|
|
61728
|
-
return
|
|
61733
|
+
var key = peg$currPos * 49 + 44, cached2 = peg$cache[key];
|
|
61734
|
+
if (cached2) {
|
|
61735
|
+
peg$currPos = cached2.nextPos;
|
|
61736
|
+
return cached2.result;
|
|
61729
61737
|
}
|
|
61730
61738
|
if (peg$c89.test(input.charAt(peg$currPos))) {
|
|
61731
61739
|
s0 = input.charAt(peg$currPos);
|
|
@@ -61758,10 +61766,10 @@ var require_parser = __commonJS({
|
|
|
61758
61766
|
}
|
|
61759
61767
|
function peg$parseASCII_BASIC() {
|
|
61760
61768
|
var s0;
|
|
61761
|
-
var key = peg$currPos * 49 + 45,
|
|
61762
|
-
if (
|
|
61763
|
-
peg$currPos =
|
|
61764
|
-
return
|
|
61769
|
+
var key = peg$currPos * 49 + 45, cached2 = peg$cache[key];
|
|
61770
|
+
if (cached2) {
|
|
61771
|
+
peg$currPos = cached2.nextPos;
|
|
61772
|
+
return cached2.result;
|
|
61765
61773
|
}
|
|
61766
61774
|
if (peg$c94.test(input.charAt(peg$currPos))) {
|
|
61767
61775
|
s0 = input.charAt(peg$currPos);
|
|
@@ -61777,10 +61785,10 @@ var require_parser = __commonJS({
|
|
|
61777
61785
|
}
|
|
61778
61786
|
function peg$parseDIGITS() {
|
|
61779
61787
|
var s0, s1, s2;
|
|
61780
|
-
var key = peg$currPos * 49 + 46,
|
|
61781
|
-
if (
|
|
61782
|
-
peg$currPos =
|
|
61783
|
-
return
|
|
61788
|
+
var key = peg$currPos * 49 + 46, cached2 = peg$cache[key];
|
|
61789
|
+
if (cached2) {
|
|
61790
|
+
peg$currPos = cached2.nextPos;
|
|
61791
|
+
return cached2.result;
|
|
61784
61792
|
}
|
|
61785
61793
|
s0 = peg$currPos;
|
|
61786
61794
|
s1 = [];
|
|
@@ -61803,10 +61811,10 @@ var require_parser = __commonJS({
|
|
|
61803
61811
|
}
|
|
61804
61812
|
function peg$parseESCAPED() {
|
|
61805
61813
|
var s0, s1;
|
|
61806
|
-
var key = peg$currPos * 49 + 47,
|
|
61807
|
-
if (
|
|
61808
|
-
peg$currPos =
|
|
61809
|
-
return
|
|
61814
|
+
var key = peg$currPos * 49 + 47, cached2 = peg$cache[key];
|
|
61815
|
+
if (cached2) {
|
|
61816
|
+
peg$currPos = cached2.nextPos;
|
|
61817
|
+
return cached2.result;
|
|
61810
61818
|
}
|
|
61811
61819
|
s0 = peg$currPos;
|
|
61812
61820
|
if (input.substr(peg$currPos, 2) === peg$c97) {
|
|
@@ -61933,10 +61941,10 @@ var require_parser = __commonJS({
|
|
|
61933
61941
|
}
|
|
61934
61942
|
function peg$parseESCAPED_UNICODE() {
|
|
61935
61943
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
61936
|
-
var key = peg$currPos * 49 + 48,
|
|
61937
|
-
if (
|
|
61938
|
-
peg$currPos =
|
|
61939
|
-
return
|
|
61944
|
+
var key = peg$currPos * 49 + 48, cached2 = peg$cache[key];
|
|
61945
|
+
if (cached2) {
|
|
61946
|
+
peg$currPos = cached2.nextPos;
|
|
61947
|
+
return cached2.result;
|
|
61940
61948
|
}
|
|
61941
61949
|
s0 = peg$currPos;
|
|
61942
61950
|
if (input.substr(peg$currPos, 2) === peg$c118) {
|
|
@@ -80826,6 +80834,1715 @@ var init_init = __esm({
|
|
|
80826
80834
|
}
|
|
80827
80835
|
});
|
|
80828
80836
|
|
|
80837
|
+
// node_modules/@msgpack/msgpack/dist.cjs/utils/utf8.cjs
|
|
80838
|
+
var require_utf82 = __commonJS({
|
|
80839
|
+
"node_modules/@msgpack/msgpack/dist.cjs/utils/utf8.cjs"(exports2) {
|
|
80840
|
+
"use strict";
|
|
80841
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
80842
|
+
exports2.utf8Count = utf8Count;
|
|
80843
|
+
exports2.utf8EncodeJs = utf8EncodeJs;
|
|
80844
|
+
exports2.utf8EncodeTE = utf8EncodeTE;
|
|
80845
|
+
exports2.utf8Encode = utf8Encode;
|
|
80846
|
+
exports2.utf8DecodeJs = utf8DecodeJs;
|
|
80847
|
+
exports2.utf8DecodeTD = utf8DecodeTD;
|
|
80848
|
+
exports2.utf8Decode = utf8Decode;
|
|
80849
|
+
function utf8Count(str) {
|
|
80850
|
+
const strLength = str.length;
|
|
80851
|
+
let byteLength = 0;
|
|
80852
|
+
let pos = 0;
|
|
80853
|
+
while (pos < strLength) {
|
|
80854
|
+
let value = str.charCodeAt(pos++);
|
|
80855
|
+
if ((value & 4294967168) === 0) {
|
|
80856
|
+
byteLength++;
|
|
80857
|
+
continue;
|
|
80858
|
+
} else if ((value & 4294965248) === 0) {
|
|
80859
|
+
byteLength += 2;
|
|
80860
|
+
} else {
|
|
80861
|
+
if (value >= 55296 && value <= 56319) {
|
|
80862
|
+
if (pos < strLength) {
|
|
80863
|
+
const extra = str.charCodeAt(pos);
|
|
80864
|
+
if ((extra & 64512) === 56320) {
|
|
80865
|
+
++pos;
|
|
80866
|
+
value = ((value & 1023) << 10) + (extra & 1023) + 65536;
|
|
80867
|
+
}
|
|
80868
|
+
}
|
|
80869
|
+
}
|
|
80870
|
+
if ((value & 4294901760) === 0) {
|
|
80871
|
+
byteLength += 3;
|
|
80872
|
+
} else {
|
|
80873
|
+
byteLength += 4;
|
|
80874
|
+
}
|
|
80875
|
+
}
|
|
80876
|
+
}
|
|
80877
|
+
return byteLength;
|
|
80878
|
+
}
|
|
80879
|
+
function utf8EncodeJs(str, output2, outputOffset) {
|
|
80880
|
+
const strLength = str.length;
|
|
80881
|
+
let offset2 = outputOffset;
|
|
80882
|
+
let pos = 0;
|
|
80883
|
+
while (pos < strLength) {
|
|
80884
|
+
let value = str.charCodeAt(pos++);
|
|
80885
|
+
if ((value & 4294967168) === 0) {
|
|
80886
|
+
output2[offset2++] = value;
|
|
80887
|
+
continue;
|
|
80888
|
+
} else if ((value & 4294965248) === 0) {
|
|
80889
|
+
output2[offset2++] = value >> 6 & 31 | 192;
|
|
80890
|
+
} else {
|
|
80891
|
+
if (value >= 55296 && value <= 56319) {
|
|
80892
|
+
if (pos < strLength) {
|
|
80893
|
+
const extra = str.charCodeAt(pos);
|
|
80894
|
+
if ((extra & 64512) === 56320) {
|
|
80895
|
+
++pos;
|
|
80896
|
+
value = ((value & 1023) << 10) + (extra & 1023) + 65536;
|
|
80897
|
+
}
|
|
80898
|
+
}
|
|
80899
|
+
}
|
|
80900
|
+
if ((value & 4294901760) === 0) {
|
|
80901
|
+
output2[offset2++] = value >> 12 & 15 | 224;
|
|
80902
|
+
output2[offset2++] = value >> 6 & 63 | 128;
|
|
80903
|
+
} else {
|
|
80904
|
+
output2[offset2++] = value >> 18 & 7 | 240;
|
|
80905
|
+
output2[offset2++] = value >> 12 & 63 | 128;
|
|
80906
|
+
output2[offset2++] = value >> 6 & 63 | 128;
|
|
80907
|
+
}
|
|
80908
|
+
}
|
|
80909
|
+
output2[offset2++] = value & 63 | 128;
|
|
80910
|
+
}
|
|
80911
|
+
}
|
|
80912
|
+
var sharedTextEncoder = new TextEncoder();
|
|
80913
|
+
var TEXT_ENCODER_THRESHOLD = 50;
|
|
80914
|
+
function utf8EncodeTE(str, output2, outputOffset) {
|
|
80915
|
+
sharedTextEncoder.encodeInto(str, output2.subarray(outputOffset));
|
|
80916
|
+
}
|
|
80917
|
+
function utf8Encode(str, output2, outputOffset) {
|
|
80918
|
+
if (str.length > TEXT_ENCODER_THRESHOLD) {
|
|
80919
|
+
utf8EncodeTE(str, output2, outputOffset);
|
|
80920
|
+
} else {
|
|
80921
|
+
utf8EncodeJs(str, output2, outputOffset);
|
|
80922
|
+
}
|
|
80923
|
+
}
|
|
80924
|
+
var CHUNK_SIZE = 4096;
|
|
80925
|
+
function utf8DecodeJs(bytes, inputOffset, byteLength) {
|
|
80926
|
+
let offset2 = inputOffset;
|
|
80927
|
+
const end = offset2 + byteLength;
|
|
80928
|
+
const units = [];
|
|
80929
|
+
let result = "";
|
|
80930
|
+
while (offset2 < end) {
|
|
80931
|
+
const byte1 = bytes[offset2++];
|
|
80932
|
+
if ((byte1 & 128) === 0) {
|
|
80933
|
+
units.push(byte1);
|
|
80934
|
+
} else if ((byte1 & 224) === 192) {
|
|
80935
|
+
const byte2 = bytes[offset2++] & 63;
|
|
80936
|
+
units.push((byte1 & 31) << 6 | byte2);
|
|
80937
|
+
} else if ((byte1 & 240) === 224) {
|
|
80938
|
+
const byte2 = bytes[offset2++] & 63;
|
|
80939
|
+
const byte3 = bytes[offset2++] & 63;
|
|
80940
|
+
units.push((byte1 & 31) << 12 | byte2 << 6 | byte3);
|
|
80941
|
+
} else if ((byte1 & 248) === 240) {
|
|
80942
|
+
const byte2 = bytes[offset2++] & 63;
|
|
80943
|
+
const byte3 = bytes[offset2++] & 63;
|
|
80944
|
+
const byte4 = bytes[offset2++] & 63;
|
|
80945
|
+
let unit = (byte1 & 7) << 18 | byte2 << 12 | byte3 << 6 | byte4;
|
|
80946
|
+
if (unit > 65535) {
|
|
80947
|
+
unit -= 65536;
|
|
80948
|
+
units.push(unit >>> 10 & 1023 | 55296);
|
|
80949
|
+
unit = 56320 | unit & 1023;
|
|
80950
|
+
}
|
|
80951
|
+
units.push(unit);
|
|
80952
|
+
} else {
|
|
80953
|
+
units.push(byte1);
|
|
80954
|
+
}
|
|
80955
|
+
if (units.length >= CHUNK_SIZE) {
|
|
80956
|
+
result += String.fromCharCode(...units);
|
|
80957
|
+
units.length = 0;
|
|
80958
|
+
}
|
|
80959
|
+
}
|
|
80960
|
+
if (units.length > 0) {
|
|
80961
|
+
result += String.fromCharCode(...units);
|
|
80962
|
+
}
|
|
80963
|
+
return result;
|
|
80964
|
+
}
|
|
80965
|
+
var sharedTextDecoder = new TextDecoder();
|
|
80966
|
+
var TEXT_DECODER_THRESHOLD = 200;
|
|
80967
|
+
function utf8DecodeTD(bytes, inputOffset, byteLength) {
|
|
80968
|
+
const stringBytes = bytes.subarray(inputOffset, inputOffset + byteLength);
|
|
80969
|
+
return sharedTextDecoder.decode(stringBytes);
|
|
80970
|
+
}
|
|
80971
|
+
function utf8Decode(bytes, inputOffset, byteLength) {
|
|
80972
|
+
if (byteLength > TEXT_DECODER_THRESHOLD) {
|
|
80973
|
+
return utf8DecodeTD(bytes, inputOffset, byteLength);
|
|
80974
|
+
} else {
|
|
80975
|
+
return utf8DecodeJs(bytes, inputOffset, byteLength);
|
|
80976
|
+
}
|
|
80977
|
+
}
|
|
80978
|
+
}
|
|
80979
|
+
});
|
|
80980
|
+
|
|
80981
|
+
// node_modules/@msgpack/msgpack/dist.cjs/ExtData.cjs
|
|
80982
|
+
var require_ExtData = __commonJS({
|
|
80983
|
+
"node_modules/@msgpack/msgpack/dist.cjs/ExtData.cjs"(exports2) {
|
|
80984
|
+
"use strict";
|
|
80985
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
80986
|
+
exports2.ExtData = void 0;
|
|
80987
|
+
var ExtData = class {
|
|
80988
|
+
type;
|
|
80989
|
+
data;
|
|
80990
|
+
constructor(type, data) {
|
|
80991
|
+
this.type = type;
|
|
80992
|
+
this.data = data;
|
|
80993
|
+
}
|
|
80994
|
+
};
|
|
80995
|
+
exports2.ExtData = ExtData;
|
|
80996
|
+
}
|
|
80997
|
+
});
|
|
80998
|
+
|
|
80999
|
+
// node_modules/@msgpack/msgpack/dist.cjs/DecodeError.cjs
|
|
81000
|
+
var require_DecodeError = __commonJS({
|
|
81001
|
+
"node_modules/@msgpack/msgpack/dist.cjs/DecodeError.cjs"(exports2) {
|
|
81002
|
+
"use strict";
|
|
81003
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81004
|
+
exports2.DecodeError = void 0;
|
|
81005
|
+
var DecodeError = class _DecodeError extends Error {
|
|
81006
|
+
constructor(message) {
|
|
81007
|
+
super(message);
|
|
81008
|
+
const proto2 = Object.create(_DecodeError.prototype);
|
|
81009
|
+
Object.setPrototypeOf(this, proto2);
|
|
81010
|
+
Object.defineProperty(this, "name", {
|
|
81011
|
+
configurable: true,
|
|
81012
|
+
enumerable: false,
|
|
81013
|
+
value: _DecodeError.name
|
|
81014
|
+
});
|
|
81015
|
+
}
|
|
81016
|
+
};
|
|
81017
|
+
exports2.DecodeError = DecodeError;
|
|
81018
|
+
}
|
|
81019
|
+
});
|
|
81020
|
+
|
|
81021
|
+
// node_modules/@msgpack/msgpack/dist.cjs/utils/int.cjs
|
|
81022
|
+
var require_int = __commonJS({
|
|
81023
|
+
"node_modules/@msgpack/msgpack/dist.cjs/utils/int.cjs"(exports2) {
|
|
81024
|
+
"use strict";
|
|
81025
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81026
|
+
exports2.UINT32_MAX = void 0;
|
|
81027
|
+
exports2.setUint64 = setUint64;
|
|
81028
|
+
exports2.setInt64 = setInt64;
|
|
81029
|
+
exports2.getInt64 = getInt64;
|
|
81030
|
+
exports2.getUint64 = getUint64;
|
|
81031
|
+
exports2.UINT32_MAX = 4294967295;
|
|
81032
|
+
function setUint64(view, offset2, value) {
|
|
81033
|
+
const high = value / 4294967296;
|
|
81034
|
+
const low = value;
|
|
81035
|
+
view.setUint32(offset2, high);
|
|
81036
|
+
view.setUint32(offset2 + 4, low);
|
|
81037
|
+
}
|
|
81038
|
+
function setInt64(view, offset2, value) {
|
|
81039
|
+
const high = Math.floor(value / 4294967296);
|
|
81040
|
+
const low = value;
|
|
81041
|
+
view.setUint32(offset2, high);
|
|
81042
|
+
view.setUint32(offset2 + 4, low);
|
|
81043
|
+
}
|
|
81044
|
+
function getInt64(view, offset2) {
|
|
81045
|
+
const high = view.getInt32(offset2);
|
|
81046
|
+
const low = view.getUint32(offset2 + 4);
|
|
81047
|
+
return high * 4294967296 + low;
|
|
81048
|
+
}
|
|
81049
|
+
function getUint64(view, offset2) {
|
|
81050
|
+
const high = view.getUint32(offset2);
|
|
81051
|
+
const low = view.getUint32(offset2 + 4);
|
|
81052
|
+
return high * 4294967296 + low;
|
|
81053
|
+
}
|
|
81054
|
+
}
|
|
81055
|
+
});
|
|
81056
|
+
|
|
81057
|
+
// node_modules/@msgpack/msgpack/dist.cjs/timestamp.cjs
|
|
81058
|
+
var require_timestamp = __commonJS({
|
|
81059
|
+
"node_modules/@msgpack/msgpack/dist.cjs/timestamp.cjs"(exports2) {
|
|
81060
|
+
"use strict";
|
|
81061
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81062
|
+
exports2.timestampExtension = exports2.EXT_TIMESTAMP = void 0;
|
|
81063
|
+
exports2.encodeTimeSpecToTimestamp = encodeTimeSpecToTimestamp;
|
|
81064
|
+
exports2.encodeDateToTimeSpec = encodeDateToTimeSpec;
|
|
81065
|
+
exports2.encodeTimestampExtension = encodeTimestampExtension;
|
|
81066
|
+
exports2.decodeTimestampToTimeSpec = decodeTimestampToTimeSpec;
|
|
81067
|
+
exports2.decodeTimestampExtension = decodeTimestampExtension;
|
|
81068
|
+
var DecodeError_ts_1 = require_DecodeError();
|
|
81069
|
+
var int_ts_1 = require_int();
|
|
81070
|
+
exports2.EXT_TIMESTAMP = -1;
|
|
81071
|
+
var TIMESTAMP32_MAX_SEC = 4294967296 - 1;
|
|
81072
|
+
var TIMESTAMP64_MAX_SEC = 17179869184 - 1;
|
|
81073
|
+
function encodeTimeSpecToTimestamp({ sec, nsec }) {
|
|
81074
|
+
if (sec >= 0 && nsec >= 0 && sec <= TIMESTAMP64_MAX_SEC) {
|
|
81075
|
+
if (nsec === 0 && sec <= TIMESTAMP32_MAX_SEC) {
|
|
81076
|
+
const rv = new Uint8Array(4);
|
|
81077
|
+
const view = new DataView(rv.buffer);
|
|
81078
|
+
view.setUint32(0, sec);
|
|
81079
|
+
return rv;
|
|
81080
|
+
} else {
|
|
81081
|
+
const secHigh = sec / 4294967296;
|
|
81082
|
+
const secLow = sec & 4294967295;
|
|
81083
|
+
const rv = new Uint8Array(8);
|
|
81084
|
+
const view = new DataView(rv.buffer);
|
|
81085
|
+
view.setUint32(0, nsec << 2 | secHigh & 3);
|
|
81086
|
+
view.setUint32(4, secLow);
|
|
81087
|
+
return rv;
|
|
81088
|
+
}
|
|
81089
|
+
} else {
|
|
81090
|
+
const rv = new Uint8Array(12);
|
|
81091
|
+
const view = new DataView(rv.buffer);
|
|
81092
|
+
view.setUint32(0, nsec);
|
|
81093
|
+
(0, int_ts_1.setInt64)(view, 4, sec);
|
|
81094
|
+
return rv;
|
|
81095
|
+
}
|
|
81096
|
+
}
|
|
81097
|
+
function encodeDateToTimeSpec(date) {
|
|
81098
|
+
const msec = date.getTime();
|
|
81099
|
+
const sec = Math.floor(msec / 1e3);
|
|
81100
|
+
const nsec = (msec - sec * 1e3) * 1e6;
|
|
81101
|
+
const nsecInSec = Math.floor(nsec / 1e9);
|
|
81102
|
+
return {
|
|
81103
|
+
sec: sec + nsecInSec,
|
|
81104
|
+
nsec: nsec - nsecInSec * 1e9
|
|
81105
|
+
};
|
|
81106
|
+
}
|
|
81107
|
+
function encodeTimestampExtension(object) {
|
|
81108
|
+
if (object instanceof Date) {
|
|
81109
|
+
const timeSpec = encodeDateToTimeSpec(object);
|
|
81110
|
+
return encodeTimeSpecToTimestamp(timeSpec);
|
|
81111
|
+
} else {
|
|
81112
|
+
return null;
|
|
81113
|
+
}
|
|
81114
|
+
}
|
|
81115
|
+
function decodeTimestampToTimeSpec(data) {
|
|
81116
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
81117
|
+
switch (data.byteLength) {
|
|
81118
|
+
case 4: {
|
|
81119
|
+
const sec = view.getUint32(0);
|
|
81120
|
+
const nsec = 0;
|
|
81121
|
+
return { sec, nsec };
|
|
81122
|
+
}
|
|
81123
|
+
case 8: {
|
|
81124
|
+
const nsec30AndSecHigh2 = view.getUint32(0);
|
|
81125
|
+
const secLow32 = view.getUint32(4);
|
|
81126
|
+
const sec = (nsec30AndSecHigh2 & 3) * 4294967296 + secLow32;
|
|
81127
|
+
const nsec = nsec30AndSecHigh2 >>> 2;
|
|
81128
|
+
return { sec, nsec };
|
|
81129
|
+
}
|
|
81130
|
+
case 12: {
|
|
81131
|
+
const sec = (0, int_ts_1.getInt64)(view, 4);
|
|
81132
|
+
const nsec = view.getUint32(0);
|
|
81133
|
+
return { sec, nsec };
|
|
81134
|
+
}
|
|
81135
|
+
default:
|
|
81136
|
+
throw new DecodeError_ts_1.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${data.length}`);
|
|
81137
|
+
}
|
|
81138
|
+
}
|
|
81139
|
+
function decodeTimestampExtension(data) {
|
|
81140
|
+
const timeSpec = decodeTimestampToTimeSpec(data);
|
|
81141
|
+
return new Date(timeSpec.sec * 1e3 + timeSpec.nsec / 1e6);
|
|
81142
|
+
}
|
|
81143
|
+
exports2.timestampExtension = {
|
|
81144
|
+
type: exports2.EXT_TIMESTAMP,
|
|
81145
|
+
encode: encodeTimestampExtension,
|
|
81146
|
+
decode: decodeTimestampExtension
|
|
81147
|
+
};
|
|
81148
|
+
}
|
|
81149
|
+
});
|
|
81150
|
+
|
|
81151
|
+
// node_modules/@msgpack/msgpack/dist.cjs/ExtensionCodec.cjs
|
|
81152
|
+
var require_ExtensionCodec = __commonJS({
|
|
81153
|
+
"node_modules/@msgpack/msgpack/dist.cjs/ExtensionCodec.cjs"(exports2) {
|
|
81154
|
+
"use strict";
|
|
81155
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81156
|
+
exports2.ExtensionCodec = void 0;
|
|
81157
|
+
var ExtData_ts_1 = require_ExtData();
|
|
81158
|
+
var timestamp_ts_1 = require_timestamp();
|
|
81159
|
+
var ExtensionCodec = class _ExtensionCodec {
|
|
81160
|
+
static defaultCodec = new _ExtensionCodec();
|
|
81161
|
+
// ensures ExtensionCodecType<X> matches ExtensionCodec<X>
|
|
81162
|
+
// this will make type errors a lot more clear
|
|
81163
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
81164
|
+
__brand;
|
|
81165
|
+
// built-in extensions
|
|
81166
|
+
builtInEncoders = [];
|
|
81167
|
+
builtInDecoders = [];
|
|
81168
|
+
// custom extensions
|
|
81169
|
+
encoders = [];
|
|
81170
|
+
decoders = [];
|
|
81171
|
+
constructor() {
|
|
81172
|
+
this.register(timestamp_ts_1.timestampExtension);
|
|
81173
|
+
}
|
|
81174
|
+
register({ type, encode, decode }) {
|
|
81175
|
+
if (type >= 0) {
|
|
81176
|
+
this.encoders[type] = encode;
|
|
81177
|
+
this.decoders[type] = decode;
|
|
81178
|
+
} else {
|
|
81179
|
+
const index = -1 - type;
|
|
81180
|
+
this.builtInEncoders[index] = encode;
|
|
81181
|
+
this.builtInDecoders[index] = decode;
|
|
81182
|
+
}
|
|
81183
|
+
}
|
|
81184
|
+
tryToEncode(object, context) {
|
|
81185
|
+
for (let i = 0; i < this.builtInEncoders.length; i++) {
|
|
81186
|
+
const encodeExt = this.builtInEncoders[i];
|
|
81187
|
+
if (encodeExt != null) {
|
|
81188
|
+
const data = encodeExt(object, context);
|
|
81189
|
+
if (data != null) {
|
|
81190
|
+
const type = -1 - i;
|
|
81191
|
+
return new ExtData_ts_1.ExtData(type, data);
|
|
81192
|
+
}
|
|
81193
|
+
}
|
|
81194
|
+
}
|
|
81195
|
+
for (let i = 0; i < this.encoders.length; i++) {
|
|
81196
|
+
const encodeExt = this.encoders[i];
|
|
81197
|
+
if (encodeExt != null) {
|
|
81198
|
+
const data = encodeExt(object, context);
|
|
81199
|
+
if (data != null) {
|
|
81200
|
+
const type = i;
|
|
81201
|
+
return new ExtData_ts_1.ExtData(type, data);
|
|
81202
|
+
}
|
|
81203
|
+
}
|
|
81204
|
+
}
|
|
81205
|
+
if (object instanceof ExtData_ts_1.ExtData) {
|
|
81206
|
+
return object;
|
|
81207
|
+
}
|
|
81208
|
+
return null;
|
|
81209
|
+
}
|
|
81210
|
+
decode(data, type, context) {
|
|
81211
|
+
const decodeExt = type < 0 ? this.builtInDecoders[-1 - type] : this.decoders[type];
|
|
81212
|
+
if (decodeExt) {
|
|
81213
|
+
return decodeExt(data, type, context);
|
|
81214
|
+
} else {
|
|
81215
|
+
return new ExtData_ts_1.ExtData(type, data);
|
|
81216
|
+
}
|
|
81217
|
+
}
|
|
81218
|
+
};
|
|
81219
|
+
exports2.ExtensionCodec = ExtensionCodec;
|
|
81220
|
+
}
|
|
81221
|
+
});
|
|
81222
|
+
|
|
81223
|
+
// node_modules/@msgpack/msgpack/dist.cjs/utils/typedArrays.cjs
|
|
81224
|
+
var require_typedArrays = __commonJS({
|
|
81225
|
+
"node_modules/@msgpack/msgpack/dist.cjs/utils/typedArrays.cjs"(exports2) {
|
|
81226
|
+
"use strict";
|
|
81227
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81228
|
+
exports2.ensureUint8Array = ensureUint8Array;
|
|
81229
|
+
function isArrayBufferLike(buffer) {
|
|
81230
|
+
return buffer instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
|
|
81231
|
+
}
|
|
81232
|
+
function ensureUint8Array(buffer) {
|
|
81233
|
+
if (buffer instanceof Uint8Array) {
|
|
81234
|
+
return buffer;
|
|
81235
|
+
} else if (ArrayBuffer.isView(buffer)) {
|
|
81236
|
+
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
81237
|
+
} else if (isArrayBufferLike(buffer)) {
|
|
81238
|
+
return new Uint8Array(buffer);
|
|
81239
|
+
} else {
|
|
81240
|
+
return Uint8Array.from(buffer);
|
|
81241
|
+
}
|
|
81242
|
+
}
|
|
81243
|
+
}
|
|
81244
|
+
});
|
|
81245
|
+
|
|
81246
|
+
// node_modules/@msgpack/msgpack/dist.cjs/Encoder.cjs
|
|
81247
|
+
var require_Encoder = __commonJS({
|
|
81248
|
+
"node_modules/@msgpack/msgpack/dist.cjs/Encoder.cjs"(exports2) {
|
|
81249
|
+
"use strict";
|
|
81250
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81251
|
+
exports2.Encoder = exports2.DEFAULT_INITIAL_BUFFER_SIZE = exports2.DEFAULT_MAX_DEPTH = void 0;
|
|
81252
|
+
var utf8_ts_1 = require_utf82();
|
|
81253
|
+
var ExtensionCodec_ts_1 = require_ExtensionCodec();
|
|
81254
|
+
var int_ts_1 = require_int();
|
|
81255
|
+
var typedArrays_ts_1 = require_typedArrays();
|
|
81256
|
+
exports2.DEFAULT_MAX_DEPTH = 100;
|
|
81257
|
+
exports2.DEFAULT_INITIAL_BUFFER_SIZE = 2048;
|
|
81258
|
+
var Encoder = class _Encoder {
|
|
81259
|
+
extensionCodec;
|
|
81260
|
+
context;
|
|
81261
|
+
useBigInt64;
|
|
81262
|
+
maxDepth;
|
|
81263
|
+
initialBufferSize;
|
|
81264
|
+
sortKeys;
|
|
81265
|
+
forceFloat32;
|
|
81266
|
+
ignoreUndefined;
|
|
81267
|
+
forceIntegerToFloat;
|
|
81268
|
+
pos;
|
|
81269
|
+
view;
|
|
81270
|
+
bytes;
|
|
81271
|
+
entered = false;
|
|
81272
|
+
constructor(options) {
|
|
81273
|
+
this.extensionCodec = options?.extensionCodec ?? ExtensionCodec_ts_1.ExtensionCodec.defaultCodec;
|
|
81274
|
+
this.context = options?.context;
|
|
81275
|
+
this.useBigInt64 = options?.useBigInt64 ?? false;
|
|
81276
|
+
this.maxDepth = options?.maxDepth ?? exports2.DEFAULT_MAX_DEPTH;
|
|
81277
|
+
this.initialBufferSize = options?.initialBufferSize ?? exports2.DEFAULT_INITIAL_BUFFER_SIZE;
|
|
81278
|
+
this.sortKeys = options?.sortKeys ?? false;
|
|
81279
|
+
this.forceFloat32 = options?.forceFloat32 ?? false;
|
|
81280
|
+
this.ignoreUndefined = options?.ignoreUndefined ?? false;
|
|
81281
|
+
this.forceIntegerToFloat = options?.forceIntegerToFloat ?? false;
|
|
81282
|
+
this.pos = 0;
|
|
81283
|
+
this.view = new DataView(new ArrayBuffer(this.initialBufferSize));
|
|
81284
|
+
this.bytes = new Uint8Array(this.view.buffer);
|
|
81285
|
+
}
|
|
81286
|
+
clone() {
|
|
81287
|
+
return new _Encoder({
|
|
81288
|
+
extensionCodec: this.extensionCodec,
|
|
81289
|
+
context: this.context,
|
|
81290
|
+
useBigInt64: this.useBigInt64,
|
|
81291
|
+
maxDepth: this.maxDepth,
|
|
81292
|
+
initialBufferSize: this.initialBufferSize,
|
|
81293
|
+
sortKeys: this.sortKeys,
|
|
81294
|
+
forceFloat32: this.forceFloat32,
|
|
81295
|
+
ignoreUndefined: this.ignoreUndefined,
|
|
81296
|
+
forceIntegerToFloat: this.forceIntegerToFloat
|
|
81297
|
+
});
|
|
81298
|
+
}
|
|
81299
|
+
reinitializeState() {
|
|
81300
|
+
this.pos = 0;
|
|
81301
|
+
}
|
|
81302
|
+
/**
|
|
81303
|
+
* This is almost equivalent to {@link Encoder#encode}, but it returns an reference of the encoder's internal buffer and thus much faster than {@link Encoder#encode}.
|
|
81304
|
+
*
|
|
81305
|
+
* @returns Encodes the object and returns a shared reference the encoder's internal buffer.
|
|
81306
|
+
*/
|
|
81307
|
+
encodeSharedRef(object) {
|
|
81308
|
+
if (this.entered) {
|
|
81309
|
+
const instance = this.clone();
|
|
81310
|
+
return instance.encodeSharedRef(object);
|
|
81311
|
+
}
|
|
81312
|
+
try {
|
|
81313
|
+
this.entered = true;
|
|
81314
|
+
this.reinitializeState();
|
|
81315
|
+
this.doEncode(object, 1);
|
|
81316
|
+
return this.bytes.subarray(0, this.pos);
|
|
81317
|
+
} finally {
|
|
81318
|
+
this.entered = false;
|
|
81319
|
+
}
|
|
81320
|
+
}
|
|
81321
|
+
/**
|
|
81322
|
+
* @returns Encodes the object and returns a copy of the encoder's internal buffer.
|
|
81323
|
+
*/
|
|
81324
|
+
encode(object) {
|
|
81325
|
+
if (this.entered) {
|
|
81326
|
+
const instance = this.clone();
|
|
81327
|
+
return instance.encode(object);
|
|
81328
|
+
}
|
|
81329
|
+
try {
|
|
81330
|
+
this.entered = true;
|
|
81331
|
+
this.reinitializeState();
|
|
81332
|
+
this.doEncode(object, 1);
|
|
81333
|
+
return this.bytes.slice(0, this.pos);
|
|
81334
|
+
} finally {
|
|
81335
|
+
this.entered = false;
|
|
81336
|
+
}
|
|
81337
|
+
}
|
|
81338
|
+
doEncode(object, depth) {
|
|
81339
|
+
if (depth > this.maxDepth) {
|
|
81340
|
+
throw new Error(`Too deep objects in depth ${depth}`);
|
|
81341
|
+
}
|
|
81342
|
+
if (object == null) {
|
|
81343
|
+
this.encodeNil();
|
|
81344
|
+
} else if (typeof object === "boolean") {
|
|
81345
|
+
this.encodeBoolean(object);
|
|
81346
|
+
} else if (typeof object === "number") {
|
|
81347
|
+
if (!this.forceIntegerToFloat) {
|
|
81348
|
+
this.encodeNumber(object);
|
|
81349
|
+
} else {
|
|
81350
|
+
this.encodeNumberAsFloat(object);
|
|
81351
|
+
}
|
|
81352
|
+
} else if (typeof object === "string") {
|
|
81353
|
+
this.encodeString(object);
|
|
81354
|
+
} else if (this.useBigInt64 && typeof object === "bigint") {
|
|
81355
|
+
this.encodeBigInt64(object);
|
|
81356
|
+
} else {
|
|
81357
|
+
this.encodeObject(object, depth);
|
|
81358
|
+
}
|
|
81359
|
+
}
|
|
81360
|
+
ensureBufferSizeToWrite(sizeToWrite) {
|
|
81361
|
+
const requiredSize = this.pos + sizeToWrite;
|
|
81362
|
+
if (this.view.byteLength < requiredSize) {
|
|
81363
|
+
this.resizeBuffer(requiredSize * 2);
|
|
81364
|
+
}
|
|
81365
|
+
}
|
|
81366
|
+
resizeBuffer(newSize) {
|
|
81367
|
+
const newBuffer = new ArrayBuffer(newSize);
|
|
81368
|
+
const newBytes = new Uint8Array(newBuffer);
|
|
81369
|
+
const newView = new DataView(newBuffer);
|
|
81370
|
+
newBytes.set(this.bytes);
|
|
81371
|
+
this.view = newView;
|
|
81372
|
+
this.bytes = newBytes;
|
|
81373
|
+
}
|
|
81374
|
+
encodeNil() {
|
|
81375
|
+
this.writeU8(192);
|
|
81376
|
+
}
|
|
81377
|
+
encodeBoolean(object) {
|
|
81378
|
+
if (object === false) {
|
|
81379
|
+
this.writeU8(194);
|
|
81380
|
+
} else {
|
|
81381
|
+
this.writeU8(195);
|
|
81382
|
+
}
|
|
81383
|
+
}
|
|
81384
|
+
encodeNumber(object) {
|
|
81385
|
+
if (!this.forceIntegerToFloat && Number.isSafeInteger(object)) {
|
|
81386
|
+
if (object >= 0) {
|
|
81387
|
+
if (object < 128) {
|
|
81388
|
+
this.writeU8(object);
|
|
81389
|
+
} else if (object < 256) {
|
|
81390
|
+
this.writeU8(204);
|
|
81391
|
+
this.writeU8(object);
|
|
81392
|
+
} else if (object < 65536) {
|
|
81393
|
+
this.writeU8(205);
|
|
81394
|
+
this.writeU16(object);
|
|
81395
|
+
} else if (object < 4294967296) {
|
|
81396
|
+
this.writeU8(206);
|
|
81397
|
+
this.writeU32(object);
|
|
81398
|
+
} else if (!this.useBigInt64) {
|
|
81399
|
+
this.writeU8(207);
|
|
81400
|
+
this.writeU64(object);
|
|
81401
|
+
} else {
|
|
81402
|
+
this.encodeNumberAsFloat(object);
|
|
81403
|
+
}
|
|
81404
|
+
} else {
|
|
81405
|
+
if (object >= -32) {
|
|
81406
|
+
this.writeU8(224 | object + 32);
|
|
81407
|
+
} else if (object >= -128) {
|
|
81408
|
+
this.writeU8(208);
|
|
81409
|
+
this.writeI8(object);
|
|
81410
|
+
} else if (object >= -32768) {
|
|
81411
|
+
this.writeU8(209);
|
|
81412
|
+
this.writeI16(object);
|
|
81413
|
+
} else if (object >= -2147483648) {
|
|
81414
|
+
this.writeU8(210);
|
|
81415
|
+
this.writeI32(object);
|
|
81416
|
+
} else if (!this.useBigInt64) {
|
|
81417
|
+
this.writeU8(211);
|
|
81418
|
+
this.writeI64(object);
|
|
81419
|
+
} else {
|
|
81420
|
+
this.encodeNumberAsFloat(object);
|
|
81421
|
+
}
|
|
81422
|
+
}
|
|
81423
|
+
} else {
|
|
81424
|
+
this.encodeNumberAsFloat(object);
|
|
81425
|
+
}
|
|
81426
|
+
}
|
|
81427
|
+
encodeNumberAsFloat(object) {
|
|
81428
|
+
if (this.forceFloat32) {
|
|
81429
|
+
this.writeU8(202);
|
|
81430
|
+
this.writeF32(object);
|
|
81431
|
+
} else {
|
|
81432
|
+
this.writeU8(203);
|
|
81433
|
+
this.writeF64(object);
|
|
81434
|
+
}
|
|
81435
|
+
}
|
|
81436
|
+
encodeBigInt64(object) {
|
|
81437
|
+
if (object >= BigInt(0)) {
|
|
81438
|
+
this.writeU8(207);
|
|
81439
|
+
this.writeBigUint64(object);
|
|
81440
|
+
} else {
|
|
81441
|
+
this.writeU8(211);
|
|
81442
|
+
this.writeBigInt64(object);
|
|
81443
|
+
}
|
|
81444
|
+
}
|
|
81445
|
+
writeStringHeader(byteLength) {
|
|
81446
|
+
if (byteLength < 32) {
|
|
81447
|
+
this.writeU8(160 + byteLength);
|
|
81448
|
+
} else if (byteLength < 256) {
|
|
81449
|
+
this.writeU8(217);
|
|
81450
|
+
this.writeU8(byteLength);
|
|
81451
|
+
} else if (byteLength < 65536) {
|
|
81452
|
+
this.writeU8(218);
|
|
81453
|
+
this.writeU16(byteLength);
|
|
81454
|
+
} else if (byteLength < 4294967296) {
|
|
81455
|
+
this.writeU8(219);
|
|
81456
|
+
this.writeU32(byteLength);
|
|
81457
|
+
} else {
|
|
81458
|
+
throw new Error(`Too long string: ${byteLength} bytes in UTF-8`);
|
|
81459
|
+
}
|
|
81460
|
+
}
|
|
81461
|
+
encodeString(object) {
|
|
81462
|
+
const maxHeaderSize = 1 + 4;
|
|
81463
|
+
const byteLength = (0, utf8_ts_1.utf8Count)(object);
|
|
81464
|
+
this.ensureBufferSizeToWrite(maxHeaderSize + byteLength);
|
|
81465
|
+
this.writeStringHeader(byteLength);
|
|
81466
|
+
(0, utf8_ts_1.utf8Encode)(object, this.bytes, this.pos);
|
|
81467
|
+
this.pos += byteLength;
|
|
81468
|
+
}
|
|
81469
|
+
encodeObject(object, depth) {
|
|
81470
|
+
const ext = this.extensionCodec.tryToEncode(object, this.context);
|
|
81471
|
+
if (ext != null) {
|
|
81472
|
+
this.encodeExtension(ext);
|
|
81473
|
+
} else if (Array.isArray(object)) {
|
|
81474
|
+
this.encodeArray(object, depth);
|
|
81475
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
81476
|
+
this.encodeBinary(object);
|
|
81477
|
+
} else if (typeof object === "object") {
|
|
81478
|
+
this.encodeMap(object, depth);
|
|
81479
|
+
} else {
|
|
81480
|
+
throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(object)}`);
|
|
81481
|
+
}
|
|
81482
|
+
}
|
|
81483
|
+
encodeBinary(object) {
|
|
81484
|
+
const size = object.byteLength;
|
|
81485
|
+
if (size < 256) {
|
|
81486
|
+
this.writeU8(196);
|
|
81487
|
+
this.writeU8(size);
|
|
81488
|
+
} else if (size < 65536) {
|
|
81489
|
+
this.writeU8(197);
|
|
81490
|
+
this.writeU16(size);
|
|
81491
|
+
} else if (size < 4294967296) {
|
|
81492
|
+
this.writeU8(198);
|
|
81493
|
+
this.writeU32(size);
|
|
81494
|
+
} else {
|
|
81495
|
+
throw new Error(`Too large binary: ${size}`);
|
|
81496
|
+
}
|
|
81497
|
+
const bytes = (0, typedArrays_ts_1.ensureUint8Array)(object);
|
|
81498
|
+
this.writeU8a(bytes);
|
|
81499
|
+
}
|
|
81500
|
+
encodeArray(object, depth) {
|
|
81501
|
+
const size = object.length;
|
|
81502
|
+
if (size < 16) {
|
|
81503
|
+
this.writeU8(144 + size);
|
|
81504
|
+
} else if (size < 65536) {
|
|
81505
|
+
this.writeU8(220);
|
|
81506
|
+
this.writeU16(size);
|
|
81507
|
+
} else if (size < 4294967296) {
|
|
81508
|
+
this.writeU8(221);
|
|
81509
|
+
this.writeU32(size);
|
|
81510
|
+
} else {
|
|
81511
|
+
throw new Error(`Too large array: ${size}`);
|
|
81512
|
+
}
|
|
81513
|
+
for (const item of object) {
|
|
81514
|
+
this.doEncode(item, depth + 1);
|
|
81515
|
+
}
|
|
81516
|
+
}
|
|
81517
|
+
countWithoutUndefined(object, keys) {
|
|
81518
|
+
let count = 0;
|
|
81519
|
+
for (const key of keys) {
|
|
81520
|
+
if (object[key] !== void 0) {
|
|
81521
|
+
count++;
|
|
81522
|
+
}
|
|
81523
|
+
}
|
|
81524
|
+
return count;
|
|
81525
|
+
}
|
|
81526
|
+
encodeMap(object, depth) {
|
|
81527
|
+
const keys = Object.keys(object);
|
|
81528
|
+
if (this.sortKeys) {
|
|
81529
|
+
keys.sort();
|
|
81530
|
+
}
|
|
81531
|
+
const size = this.ignoreUndefined ? this.countWithoutUndefined(object, keys) : keys.length;
|
|
81532
|
+
if (size < 16) {
|
|
81533
|
+
this.writeU8(128 + size);
|
|
81534
|
+
} else if (size < 65536) {
|
|
81535
|
+
this.writeU8(222);
|
|
81536
|
+
this.writeU16(size);
|
|
81537
|
+
} else if (size < 4294967296) {
|
|
81538
|
+
this.writeU8(223);
|
|
81539
|
+
this.writeU32(size);
|
|
81540
|
+
} else {
|
|
81541
|
+
throw new Error(`Too large map object: ${size}`);
|
|
81542
|
+
}
|
|
81543
|
+
for (const key of keys) {
|
|
81544
|
+
const value = object[key];
|
|
81545
|
+
if (!(this.ignoreUndefined && value === void 0)) {
|
|
81546
|
+
this.encodeString(key);
|
|
81547
|
+
this.doEncode(value, depth + 1);
|
|
81548
|
+
}
|
|
81549
|
+
}
|
|
81550
|
+
}
|
|
81551
|
+
encodeExtension(ext) {
|
|
81552
|
+
if (typeof ext.data === "function") {
|
|
81553
|
+
const data = ext.data(this.pos + 6);
|
|
81554
|
+
const size2 = data.length;
|
|
81555
|
+
if (size2 >= 4294967296) {
|
|
81556
|
+
throw new Error(`Too large extension object: ${size2}`);
|
|
81557
|
+
}
|
|
81558
|
+
this.writeU8(201);
|
|
81559
|
+
this.writeU32(size2);
|
|
81560
|
+
this.writeI8(ext.type);
|
|
81561
|
+
this.writeU8a(data);
|
|
81562
|
+
return;
|
|
81563
|
+
}
|
|
81564
|
+
const size = ext.data.length;
|
|
81565
|
+
if (size === 1) {
|
|
81566
|
+
this.writeU8(212);
|
|
81567
|
+
} else if (size === 2) {
|
|
81568
|
+
this.writeU8(213);
|
|
81569
|
+
} else if (size === 4) {
|
|
81570
|
+
this.writeU8(214);
|
|
81571
|
+
} else if (size === 8) {
|
|
81572
|
+
this.writeU8(215);
|
|
81573
|
+
} else if (size === 16) {
|
|
81574
|
+
this.writeU8(216);
|
|
81575
|
+
} else if (size < 256) {
|
|
81576
|
+
this.writeU8(199);
|
|
81577
|
+
this.writeU8(size);
|
|
81578
|
+
} else if (size < 65536) {
|
|
81579
|
+
this.writeU8(200);
|
|
81580
|
+
this.writeU16(size);
|
|
81581
|
+
} else if (size < 4294967296) {
|
|
81582
|
+
this.writeU8(201);
|
|
81583
|
+
this.writeU32(size);
|
|
81584
|
+
} else {
|
|
81585
|
+
throw new Error(`Too large extension object: ${size}`);
|
|
81586
|
+
}
|
|
81587
|
+
this.writeI8(ext.type);
|
|
81588
|
+
this.writeU8a(ext.data);
|
|
81589
|
+
}
|
|
81590
|
+
writeU8(value) {
|
|
81591
|
+
this.ensureBufferSizeToWrite(1);
|
|
81592
|
+
this.view.setUint8(this.pos, value);
|
|
81593
|
+
this.pos++;
|
|
81594
|
+
}
|
|
81595
|
+
writeU8a(values) {
|
|
81596
|
+
const size = values.length;
|
|
81597
|
+
this.ensureBufferSizeToWrite(size);
|
|
81598
|
+
this.bytes.set(values, this.pos);
|
|
81599
|
+
this.pos += size;
|
|
81600
|
+
}
|
|
81601
|
+
writeI8(value) {
|
|
81602
|
+
this.ensureBufferSizeToWrite(1);
|
|
81603
|
+
this.view.setInt8(this.pos, value);
|
|
81604
|
+
this.pos++;
|
|
81605
|
+
}
|
|
81606
|
+
writeU16(value) {
|
|
81607
|
+
this.ensureBufferSizeToWrite(2);
|
|
81608
|
+
this.view.setUint16(this.pos, value);
|
|
81609
|
+
this.pos += 2;
|
|
81610
|
+
}
|
|
81611
|
+
writeI16(value) {
|
|
81612
|
+
this.ensureBufferSizeToWrite(2);
|
|
81613
|
+
this.view.setInt16(this.pos, value);
|
|
81614
|
+
this.pos += 2;
|
|
81615
|
+
}
|
|
81616
|
+
writeU32(value) {
|
|
81617
|
+
this.ensureBufferSizeToWrite(4);
|
|
81618
|
+
this.view.setUint32(this.pos, value);
|
|
81619
|
+
this.pos += 4;
|
|
81620
|
+
}
|
|
81621
|
+
writeI32(value) {
|
|
81622
|
+
this.ensureBufferSizeToWrite(4);
|
|
81623
|
+
this.view.setInt32(this.pos, value);
|
|
81624
|
+
this.pos += 4;
|
|
81625
|
+
}
|
|
81626
|
+
writeF32(value) {
|
|
81627
|
+
this.ensureBufferSizeToWrite(4);
|
|
81628
|
+
this.view.setFloat32(this.pos, value);
|
|
81629
|
+
this.pos += 4;
|
|
81630
|
+
}
|
|
81631
|
+
writeF64(value) {
|
|
81632
|
+
this.ensureBufferSizeToWrite(8);
|
|
81633
|
+
this.view.setFloat64(this.pos, value);
|
|
81634
|
+
this.pos += 8;
|
|
81635
|
+
}
|
|
81636
|
+
writeU64(value) {
|
|
81637
|
+
this.ensureBufferSizeToWrite(8);
|
|
81638
|
+
(0, int_ts_1.setUint64)(this.view, this.pos, value);
|
|
81639
|
+
this.pos += 8;
|
|
81640
|
+
}
|
|
81641
|
+
writeI64(value) {
|
|
81642
|
+
this.ensureBufferSizeToWrite(8);
|
|
81643
|
+
(0, int_ts_1.setInt64)(this.view, this.pos, value);
|
|
81644
|
+
this.pos += 8;
|
|
81645
|
+
}
|
|
81646
|
+
writeBigUint64(value) {
|
|
81647
|
+
this.ensureBufferSizeToWrite(8);
|
|
81648
|
+
this.view.setBigUint64(this.pos, value);
|
|
81649
|
+
this.pos += 8;
|
|
81650
|
+
}
|
|
81651
|
+
writeBigInt64(value) {
|
|
81652
|
+
this.ensureBufferSizeToWrite(8);
|
|
81653
|
+
this.view.setBigInt64(this.pos, value);
|
|
81654
|
+
this.pos += 8;
|
|
81655
|
+
}
|
|
81656
|
+
};
|
|
81657
|
+
exports2.Encoder = Encoder;
|
|
81658
|
+
}
|
|
81659
|
+
});
|
|
81660
|
+
|
|
81661
|
+
// node_modules/@msgpack/msgpack/dist.cjs/encode.cjs
|
|
81662
|
+
var require_encode = __commonJS({
|
|
81663
|
+
"node_modules/@msgpack/msgpack/dist.cjs/encode.cjs"(exports2) {
|
|
81664
|
+
"use strict";
|
|
81665
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81666
|
+
exports2.encode = encode;
|
|
81667
|
+
var Encoder_ts_1 = require_Encoder();
|
|
81668
|
+
function encode(value, options) {
|
|
81669
|
+
const encoder = new Encoder_ts_1.Encoder(options);
|
|
81670
|
+
return encoder.encodeSharedRef(value);
|
|
81671
|
+
}
|
|
81672
|
+
}
|
|
81673
|
+
});
|
|
81674
|
+
|
|
81675
|
+
// node_modules/@msgpack/msgpack/dist.cjs/utils/prettyByte.cjs
|
|
81676
|
+
var require_prettyByte = __commonJS({
|
|
81677
|
+
"node_modules/@msgpack/msgpack/dist.cjs/utils/prettyByte.cjs"(exports2) {
|
|
81678
|
+
"use strict";
|
|
81679
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81680
|
+
exports2.prettyByte = prettyByte;
|
|
81681
|
+
function prettyByte(byte) {
|
|
81682
|
+
return `${byte < 0 ? "-" : ""}0x${Math.abs(byte).toString(16).padStart(2, "0")}`;
|
|
81683
|
+
}
|
|
81684
|
+
}
|
|
81685
|
+
});
|
|
81686
|
+
|
|
81687
|
+
// node_modules/@msgpack/msgpack/dist.cjs/CachedKeyDecoder.cjs
|
|
81688
|
+
var require_CachedKeyDecoder = __commonJS({
|
|
81689
|
+
"node_modules/@msgpack/msgpack/dist.cjs/CachedKeyDecoder.cjs"(exports2) {
|
|
81690
|
+
"use strict";
|
|
81691
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81692
|
+
exports2.CachedKeyDecoder = void 0;
|
|
81693
|
+
var utf8_ts_1 = require_utf82();
|
|
81694
|
+
var DEFAULT_MAX_KEY_LENGTH = 16;
|
|
81695
|
+
var DEFAULT_MAX_LENGTH_PER_KEY = 16;
|
|
81696
|
+
var CachedKeyDecoder = class {
|
|
81697
|
+
hit = 0;
|
|
81698
|
+
miss = 0;
|
|
81699
|
+
caches;
|
|
81700
|
+
maxKeyLength;
|
|
81701
|
+
maxLengthPerKey;
|
|
81702
|
+
constructor(maxKeyLength = DEFAULT_MAX_KEY_LENGTH, maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY) {
|
|
81703
|
+
this.maxKeyLength = maxKeyLength;
|
|
81704
|
+
this.maxLengthPerKey = maxLengthPerKey;
|
|
81705
|
+
this.caches = [];
|
|
81706
|
+
for (let i = 0; i < this.maxKeyLength; i++) {
|
|
81707
|
+
this.caches.push([]);
|
|
81708
|
+
}
|
|
81709
|
+
}
|
|
81710
|
+
canBeCached(byteLength) {
|
|
81711
|
+
return byteLength > 0 && byteLength <= this.maxKeyLength;
|
|
81712
|
+
}
|
|
81713
|
+
find(bytes, inputOffset, byteLength) {
|
|
81714
|
+
const records = this.caches[byteLength - 1];
|
|
81715
|
+
FIND_CHUNK: for (const record of records) {
|
|
81716
|
+
const recordBytes = record.bytes;
|
|
81717
|
+
for (let j = 0; j < byteLength; j++) {
|
|
81718
|
+
if (recordBytes[j] !== bytes[inputOffset + j]) {
|
|
81719
|
+
continue FIND_CHUNK;
|
|
81720
|
+
}
|
|
81721
|
+
}
|
|
81722
|
+
return record.str;
|
|
81723
|
+
}
|
|
81724
|
+
return null;
|
|
81725
|
+
}
|
|
81726
|
+
store(bytes, value) {
|
|
81727
|
+
const records = this.caches[bytes.length - 1];
|
|
81728
|
+
const record = { bytes, str: value };
|
|
81729
|
+
if (records.length >= this.maxLengthPerKey) {
|
|
81730
|
+
records[Math.random() * records.length | 0] = record;
|
|
81731
|
+
} else {
|
|
81732
|
+
records.push(record);
|
|
81733
|
+
}
|
|
81734
|
+
}
|
|
81735
|
+
decode(bytes, inputOffset, byteLength) {
|
|
81736
|
+
const cachedValue = this.find(bytes, inputOffset, byteLength);
|
|
81737
|
+
if (cachedValue != null) {
|
|
81738
|
+
this.hit++;
|
|
81739
|
+
return cachedValue;
|
|
81740
|
+
}
|
|
81741
|
+
this.miss++;
|
|
81742
|
+
const str = (0, utf8_ts_1.utf8DecodeJs)(bytes, inputOffset, byteLength);
|
|
81743
|
+
const slicedCopyOfBytes = Uint8Array.prototype.slice.call(bytes, inputOffset, inputOffset + byteLength);
|
|
81744
|
+
this.store(slicedCopyOfBytes, str);
|
|
81745
|
+
return str;
|
|
81746
|
+
}
|
|
81747
|
+
};
|
|
81748
|
+
exports2.CachedKeyDecoder = CachedKeyDecoder;
|
|
81749
|
+
}
|
|
81750
|
+
});
|
|
81751
|
+
|
|
81752
|
+
// node_modules/@msgpack/msgpack/dist.cjs/Decoder.cjs
|
|
81753
|
+
var require_Decoder = __commonJS({
|
|
81754
|
+
"node_modules/@msgpack/msgpack/dist.cjs/Decoder.cjs"(exports2) {
|
|
81755
|
+
"use strict";
|
|
81756
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
81757
|
+
exports2.Decoder = void 0;
|
|
81758
|
+
var prettyByte_ts_1 = require_prettyByte();
|
|
81759
|
+
var ExtensionCodec_ts_1 = require_ExtensionCodec();
|
|
81760
|
+
var int_ts_1 = require_int();
|
|
81761
|
+
var utf8_ts_1 = require_utf82();
|
|
81762
|
+
var typedArrays_ts_1 = require_typedArrays();
|
|
81763
|
+
var CachedKeyDecoder_ts_1 = require_CachedKeyDecoder();
|
|
81764
|
+
var DecodeError_ts_1 = require_DecodeError();
|
|
81765
|
+
var STATE_ARRAY = "array";
|
|
81766
|
+
var STATE_MAP_KEY = "map_key";
|
|
81767
|
+
var STATE_MAP_VALUE = "map_value";
|
|
81768
|
+
var mapKeyConverter = (key) => {
|
|
81769
|
+
if (typeof key === "string" || typeof key === "number") {
|
|
81770
|
+
return key;
|
|
81771
|
+
}
|
|
81772
|
+
throw new DecodeError_ts_1.DecodeError("The type of key must be string or number but " + typeof key);
|
|
81773
|
+
};
|
|
81774
|
+
var StackPool = class {
|
|
81775
|
+
stack = [];
|
|
81776
|
+
stackHeadPosition = -1;
|
|
81777
|
+
get length() {
|
|
81778
|
+
return this.stackHeadPosition + 1;
|
|
81779
|
+
}
|
|
81780
|
+
top() {
|
|
81781
|
+
return this.stack[this.stackHeadPosition];
|
|
81782
|
+
}
|
|
81783
|
+
pushArrayState(size) {
|
|
81784
|
+
const state = this.getUninitializedStateFromPool();
|
|
81785
|
+
state.type = STATE_ARRAY;
|
|
81786
|
+
state.position = 0;
|
|
81787
|
+
state.size = size;
|
|
81788
|
+
state.array = new Array(size);
|
|
81789
|
+
}
|
|
81790
|
+
pushMapState(size) {
|
|
81791
|
+
const state = this.getUninitializedStateFromPool();
|
|
81792
|
+
state.type = STATE_MAP_KEY;
|
|
81793
|
+
state.readCount = 0;
|
|
81794
|
+
state.size = size;
|
|
81795
|
+
state.map = {};
|
|
81796
|
+
}
|
|
81797
|
+
getUninitializedStateFromPool() {
|
|
81798
|
+
this.stackHeadPosition++;
|
|
81799
|
+
if (this.stackHeadPosition === this.stack.length) {
|
|
81800
|
+
const partialState = {
|
|
81801
|
+
type: void 0,
|
|
81802
|
+
size: 0,
|
|
81803
|
+
array: void 0,
|
|
81804
|
+
position: 0,
|
|
81805
|
+
readCount: 0,
|
|
81806
|
+
map: void 0,
|
|
81807
|
+
key: null
|
|
81808
|
+
};
|
|
81809
|
+
this.stack.push(partialState);
|
|
81810
|
+
}
|
|
81811
|
+
return this.stack[this.stackHeadPosition];
|
|
81812
|
+
}
|
|
81813
|
+
release(state) {
|
|
81814
|
+
const topStackState = this.stack[this.stackHeadPosition];
|
|
81815
|
+
if (topStackState !== state) {
|
|
81816
|
+
throw new Error("Invalid stack state. Released state is not on top of the stack.");
|
|
81817
|
+
}
|
|
81818
|
+
if (state.type === STATE_ARRAY) {
|
|
81819
|
+
const partialState = state;
|
|
81820
|
+
partialState.size = 0;
|
|
81821
|
+
partialState.array = void 0;
|
|
81822
|
+
partialState.position = 0;
|
|
81823
|
+
partialState.type = void 0;
|
|
81824
|
+
}
|
|
81825
|
+
if (state.type === STATE_MAP_KEY || state.type === STATE_MAP_VALUE) {
|
|
81826
|
+
const partialState = state;
|
|
81827
|
+
partialState.size = 0;
|
|
81828
|
+
partialState.map = void 0;
|
|
81829
|
+
partialState.readCount = 0;
|
|
81830
|
+
partialState.type = void 0;
|
|
81831
|
+
}
|
|
81832
|
+
this.stackHeadPosition--;
|
|
81833
|
+
}
|
|
81834
|
+
reset() {
|
|
81835
|
+
this.stack.length = 0;
|
|
81836
|
+
this.stackHeadPosition = -1;
|
|
81837
|
+
}
|
|
81838
|
+
};
|
|
81839
|
+
var HEAD_BYTE_REQUIRED = -1;
|
|
81840
|
+
var EMPTY_VIEW = new DataView(new ArrayBuffer(0));
|
|
81841
|
+
var EMPTY_BYTES = new Uint8Array(EMPTY_VIEW.buffer);
|
|
81842
|
+
try {
|
|
81843
|
+
EMPTY_VIEW.getInt8(0);
|
|
81844
|
+
} catch (e) {
|
|
81845
|
+
if (!(e instanceof RangeError)) {
|
|
81846
|
+
throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access");
|
|
81847
|
+
}
|
|
81848
|
+
}
|
|
81849
|
+
var MORE_DATA = new RangeError("Insufficient data");
|
|
81850
|
+
var sharedCachedKeyDecoder = new CachedKeyDecoder_ts_1.CachedKeyDecoder();
|
|
81851
|
+
var Decoder = class _Decoder {
|
|
81852
|
+
extensionCodec;
|
|
81853
|
+
context;
|
|
81854
|
+
useBigInt64;
|
|
81855
|
+
rawStrings;
|
|
81856
|
+
maxStrLength;
|
|
81857
|
+
maxBinLength;
|
|
81858
|
+
maxArrayLength;
|
|
81859
|
+
maxMapLength;
|
|
81860
|
+
maxExtLength;
|
|
81861
|
+
keyDecoder;
|
|
81862
|
+
mapKeyConverter;
|
|
81863
|
+
totalPos = 0;
|
|
81864
|
+
pos = 0;
|
|
81865
|
+
view = EMPTY_VIEW;
|
|
81866
|
+
bytes = EMPTY_BYTES;
|
|
81867
|
+
headByte = HEAD_BYTE_REQUIRED;
|
|
81868
|
+
stack = new StackPool();
|
|
81869
|
+
entered = false;
|
|
81870
|
+
constructor(options) {
|
|
81871
|
+
this.extensionCodec = options?.extensionCodec ?? ExtensionCodec_ts_1.ExtensionCodec.defaultCodec;
|
|
81872
|
+
this.context = options?.context;
|
|
81873
|
+
this.useBigInt64 = options?.useBigInt64 ?? false;
|
|
81874
|
+
this.rawStrings = options?.rawStrings ?? false;
|
|
81875
|
+
this.maxStrLength = options?.maxStrLength ?? int_ts_1.UINT32_MAX;
|
|
81876
|
+
this.maxBinLength = options?.maxBinLength ?? int_ts_1.UINT32_MAX;
|
|
81877
|
+
this.maxArrayLength = options?.maxArrayLength ?? int_ts_1.UINT32_MAX;
|
|
81878
|
+
this.maxMapLength = options?.maxMapLength ?? int_ts_1.UINT32_MAX;
|
|
81879
|
+
this.maxExtLength = options?.maxExtLength ?? int_ts_1.UINT32_MAX;
|
|
81880
|
+
this.keyDecoder = options?.keyDecoder !== void 0 ? options.keyDecoder : sharedCachedKeyDecoder;
|
|
81881
|
+
this.mapKeyConverter = options?.mapKeyConverter ?? mapKeyConverter;
|
|
81882
|
+
}
|
|
81883
|
+
clone() {
|
|
81884
|
+
return new _Decoder({
|
|
81885
|
+
extensionCodec: this.extensionCodec,
|
|
81886
|
+
context: this.context,
|
|
81887
|
+
useBigInt64: this.useBigInt64,
|
|
81888
|
+
rawStrings: this.rawStrings,
|
|
81889
|
+
maxStrLength: this.maxStrLength,
|
|
81890
|
+
maxBinLength: this.maxBinLength,
|
|
81891
|
+
maxArrayLength: this.maxArrayLength,
|
|
81892
|
+
maxMapLength: this.maxMapLength,
|
|
81893
|
+
maxExtLength: this.maxExtLength,
|
|
81894
|
+
keyDecoder: this.keyDecoder
|
|
81895
|
+
});
|
|
81896
|
+
}
|
|
81897
|
+
reinitializeState() {
|
|
81898
|
+
this.totalPos = 0;
|
|
81899
|
+
this.headByte = HEAD_BYTE_REQUIRED;
|
|
81900
|
+
this.stack.reset();
|
|
81901
|
+
}
|
|
81902
|
+
setBuffer(buffer) {
|
|
81903
|
+
const bytes = (0, typedArrays_ts_1.ensureUint8Array)(buffer);
|
|
81904
|
+
this.bytes = bytes;
|
|
81905
|
+
this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
81906
|
+
this.pos = 0;
|
|
81907
|
+
}
|
|
81908
|
+
appendBuffer(buffer) {
|
|
81909
|
+
if (this.headByte === HEAD_BYTE_REQUIRED && !this.hasRemaining(1)) {
|
|
81910
|
+
this.setBuffer(buffer);
|
|
81911
|
+
} else {
|
|
81912
|
+
const remainingData = this.bytes.subarray(this.pos);
|
|
81913
|
+
const newData = (0, typedArrays_ts_1.ensureUint8Array)(buffer);
|
|
81914
|
+
const newBuffer = new Uint8Array(remainingData.length + newData.length);
|
|
81915
|
+
newBuffer.set(remainingData);
|
|
81916
|
+
newBuffer.set(newData, remainingData.length);
|
|
81917
|
+
this.setBuffer(newBuffer);
|
|
81918
|
+
}
|
|
81919
|
+
}
|
|
81920
|
+
hasRemaining(size) {
|
|
81921
|
+
return this.view.byteLength - this.pos >= size;
|
|
81922
|
+
}
|
|
81923
|
+
createExtraByteError(posToShow) {
|
|
81924
|
+
const { view, pos } = this;
|
|
81925
|
+
return new RangeError(`Extra ${view.byteLength - pos} of ${view.byteLength} byte(s) found at buffer[${posToShow}]`);
|
|
81926
|
+
}
|
|
81927
|
+
/**
|
|
81928
|
+
* @throws {@link DecodeError}
|
|
81929
|
+
* @throws {@link RangeError}
|
|
81930
|
+
*/
|
|
81931
|
+
decode(buffer) {
|
|
81932
|
+
if (this.entered) {
|
|
81933
|
+
const instance = this.clone();
|
|
81934
|
+
return instance.decode(buffer);
|
|
81935
|
+
}
|
|
81936
|
+
try {
|
|
81937
|
+
this.entered = true;
|
|
81938
|
+
this.reinitializeState();
|
|
81939
|
+
this.setBuffer(buffer);
|
|
81940
|
+
const object = this.doDecodeSync();
|
|
81941
|
+
if (this.hasRemaining(1)) {
|
|
81942
|
+
throw this.createExtraByteError(this.pos);
|
|
81943
|
+
}
|
|
81944
|
+
return object;
|
|
81945
|
+
} finally {
|
|
81946
|
+
this.entered = false;
|
|
81947
|
+
}
|
|
81948
|
+
}
|
|
81949
|
+
*decodeMulti(buffer) {
|
|
81950
|
+
if (this.entered) {
|
|
81951
|
+
const instance = this.clone();
|
|
81952
|
+
yield* instance.decodeMulti(buffer);
|
|
81953
|
+
return;
|
|
81954
|
+
}
|
|
81955
|
+
try {
|
|
81956
|
+
this.entered = true;
|
|
81957
|
+
this.reinitializeState();
|
|
81958
|
+
this.setBuffer(buffer);
|
|
81959
|
+
while (this.hasRemaining(1)) {
|
|
81960
|
+
yield this.doDecodeSync();
|
|
81961
|
+
}
|
|
81962
|
+
} finally {
|
|
81963
|
+
this.entered = false;
|
|
81964
|
+
}
|
|
81965
|
+
}
|
|
81966
|
+
async decodeAsync(stream) {
|
|
81967
|
+
if (this.entered) {
|
|
81968
|
+
const instance = this.clone();
|
|
81969
|
+
return instance.decodeAsync(stream);
|
|
81970
|
+
}
|
|
81971
|
+
try {
|
|
81972
|
+
this.entered = true;
|
|
81973
|
+
let decoded = false;
|
|
81974
|
+
let object;
|
|
81975
|
+
for await (const buffer of stream) {
|
|
81976
|
+
if (decoded) {
|
|
81977
|
+
this.entered = false;
|
|
81978
|
+
throw this.createExtraByteError(this.totalPos);
|
|
81979
|
+
}
|
|
81980
|
+
this.appendBuffer(buffer);
|
|
81981
|
+
try {
|
|
81982
|
+
object = this.doDecodeSync();
|
|
81983
|
+
decoded = true;
|
|
81984
|
+
} catch (e) {
|
|
81985
|
+
if (!(e instanceof RangeError)) {
|
|
81986
|
+
throw e;
|
|
81987
|
+
}
|
|
81988
|
+
}
|
|
81989
|
+
this.totalPos += this.pos;
|
|
81990
|
+
}
|
|
81991
|
+
if (decoded) {
|
|
81992
|
+
if (this.hasRemaining(1)) {
|
|
81993
|
+
throw this.createExtraByteError(this.totalPos);
|
|
81994
|
+
}
|
|
81995
|
+
return object;
|
|
81996
|
+
}
|
|
81997
|
+
const { headByte, pos, totalPos } = this;
|
|
81998
|
+
throw new RangeError(`Insufficient data in parsing ${(0, prettyByte_ts_1.prettyByte)(headByte)} at ${totalPos} (${pos} in the current buffer)`);
|
|
81999
|
+
} finally {
|
|
82000
|
+
this.entered = false;
|
|
82001
|
+
}
|
|
82002
|
+
}
|
|
82003
|
+
decodeArrayStream(stream) {
|
|
82004
|
+
return this.decodeMultiAsync(stream, true);
|
|
82005
|
+
}
|
|
82006
|
+
decodeStream(stream) {
|
|
82007
|
+
return this.decodeMultiAsync(stream, false);
|
|
82008
|
+
}
|
|
82009
|
+
async *decodeMultiAsync(stream, isArray) {
|
|
82010
|
+
if (this.entered) {
|
|
82011
|
+
const instance = this.clone();
|
|
82012
|
+
yield* instance.decodeMultiAsync(stream, isArray);
|
|
82013
|
+
return;
|
|
82014
|
+
}
|
|
82015
|
+
try {
|
|
82016
|
+
this.entered = true;
|
|
82017
|
+
let isArrayHeaderRequired = isArray;
|
|
82018
|
+
let arrayItemsLeft = -1;
|
|
82019
|
+
for await (const buffer of stream) {
|
|
82020
|
+
if (isArray && arrayItemsLeft === 0) {
|
|
82021
|
+
throw this.createExtraByteError(this.totalPos);
|
|
82022
|
+
}
|
|
82023
|
+
this.appendBuffer(buffer);
|
|
82024
|
+
if (isArrayHeaderRequired) {
|
|
82025
|
+
arrayItemsLeft = this.readArraySize();
|
|
82026
|
+
isArrayHeaderRequired = false;
|
|
82027
|
+
this.complete();
|
|
82028
|
+
}
|
|
82029
|
+
try {
|
|
82030
|
+
while (true) {
|
|
82031
|
+
yield this.doDecodeSync();
|
|
82032
|
+
if (--arrayItemsLeft === 0) {
|
|
82033
|
+
break;
|
|
82034
|
+
}
|
|
82035
|
+
}
|
|
82036
|
+
} catch (e) {
|
|
82037
|
+
if (!(e instanceof RangeError)) {
|
|
82038
|
+
throw e;
|
|
82039
|
+
}
|
|
82040
|
+
}
|
|
82041
|
+
this.totalPos += this.pos;
|
|
82042
|
+
}
|
|
82043
|
+
} finally {
|
|
82044
|
+
this.entered = false;
|
|
82045
|
+
}
|
|
82046
|
+
}
|
|
82047
|
+
doDecodeSync() {
|
|
82048
|
+
DECODE: while (true) {
|
|
82049
|
+
const headByte = this.readHeadByte();
|
|
82050
|
+
let object;
|
|
82051
|
+
if (headByte >= 224) {
|
|
82052
|
+
object = headByte - 256;
|
|
82053
|
+
} else if (headByte < 192) {
|
|
82054
|
+
if (headByte < 128) {
|
|
82055
|
+
object = headByte;
|
|
82056
|
+
} else if (headByte < 144) {
|
|
82057
|
+
const size = headByte - 128;
|
|
82058
|
+
if (size !== 0) {
|
|
82059
|
+
this.pushMapState(size);
|
|
82060
|
+
this.complete();
|
|
82061
|
+
continue DECODE;
|
|
82062
|
+
} else {
|
|
82063
|
+
object = {};
|
|
82064
|
+
}
|
|
82065
|
+
} else if (headByte < 160) {
|
|
82066
|
+
const size = headByte - 144;
|
|
82067
|
+
if (size !== 0) {
|
|
82068
|
+
this.pushArrayState(size);
|
|
82069
|
+
this.complete();
|
|
82070
|
+
continue DECODE;
|
|
82071
|
+
} else {
|
|
82072
|
+
object = [];
|
|
82073
|
+
}
|
|
82074
|
+
} else {
|
|
82075
|
+
const byteLength = headByte - 160;
|
|
82076
|
+
object = this.decodeString(byteLength, 0);
|
|
82077
|
+
}
|
|
82078
|
+
} else if (headByte === 192) {
|
|
82079
|
+
object = null;
|
|
82080
|
+
} else if (headByte === 194) {
|
|
82081
|
+
object = false;
|
|
82082
|
+
} else if (headByte === 195) {
|
|
82083
|
+
object = true;
|
|
82084
|
+
} else if (headByte === 202) {
|
|
82085
|
+
object = this.readF32();
|
|
82086
|
+
} else if (headByte === 203) {
|
|
82087
|
+
object = this.readF64();
|
|
82088
|
+
} else if (headByte === 204) {
|
|
82089
|
+
object = this.readU8();
|
|
82090
|
+
} else if (headByte === 205) {
|
|
82091
|
+
object = this.readU16();
|
|
82092
|
+
} else if (headByte === 206) {
|
|
82093
|
+
object = this.readU32();
|
|
82094
|
+
} else if (headByte === 207) {
|
|
82095
|
+
if (this.useBigInt64) {
|
|
82096
|
+
object = this.readU64AsBigInt();
|
|
82097
|
+
} else {
|
|
82098
|
+
object = this.readU64();
|
|
82099
|
+
}
|
|
82100
|
+
} else if (headByte === 208) {
|
|
82101
|
+
object = this.readI8();
|
|
82102
|
+
} else if (headByte === 209) {
|
|
82103
|
+
object = this.readI16();
|
|
82104
|
+
} else if (headByte === 210) {
|
|
82105
|
+
object = this.readI32();
|
|
82106
|
+
} else if (headByte === 211) {
|
|
82107
|
+
if (this.useBigInt64) {
|
|
82108
|
+
object = this.readI64AsBigInt();
|
|
82109
|
+
} else {
|
|
82110
|
+
object = this.readI64();
|
|
82111
|
+
}
|
|
82112
|
+
} else if (headByte === 217) {
|
|
82113
|
+
const byteLength = this.lookU8();
|
|
82114
|
+
object = this.decodeString(byteLength, 1);
|
|
82115
|
+
} else if (headByte === 218) {
|
|
82116
|
+
const byteLength = this.lookU16();
|
|
82117
|
+
object = this.decodeString(byteLength, 2);
|
|
82118
|
+
} else if (headByte === 219) {
|
|
82119
|
+
const byteLength = this.lookU32();
|
|
82120
|
+
object = this.decodeString(byteLength, 4);
|
|
82121
|
+
} else if (headByte === 220) {
|
|
82122
|
+
const size = this.readU16();
|
|
82123
|
+
if (size !== 0) {
|
|
82124
|
+
this.pushArrayState(size);
|
|
82125
|
+
this.complete();
|
|
82126
|
+
continue DECODE;
|
|
82127
|
+
} else {
|
|
82128
|
+
object = [];
|
|
82129
|
+
}
|
|
82130
|
+
} else if (headByte === 221) {
|
|
82131
|
+
const size = this.readU32();
|
|
82132
|
+
if (size !== 0) {
|
|
82133
|
+
this.pushArrayState(size);
|
|
82134
|
+
this.complete();
|
|
82135
|
+
continue DECODE;
|
|
82136
|
+
} else {
|
|
82137
|
+
object = [];
|
|
82138
|
+
}
|
|
82139
|
+
} else if (headByte === 222) {
|
|
82140
|
+
const size = this.readU16();
|
|
82141
|
+
if (size !== 0) {
|
|
82142
|
+
this.pushMapState(size);
|
|
82143
|
+
this.complete();
|
|
82144
|
+
continue DECODE;
|
|
82145
|
+
} else {
|
|
82146
|
+
object = {};
|
|
82147
|
+
}
|
|
82148
|
+
} else if (headByte === 223) {
|
|
82149
|
+
const size = this.readU32();
|
|
82150
|
+
if (size !== 0) {
|
|
82151
|
+
this.pushMapState(size);
|
|
82152
|
+
this.complete();
|
|
82153
|
+
continue DECODE;
|
|
82154
|
+
} else {
|
|
82155
|
+
object = {};
|
|
82156
|
+
}
|
|
82157
|
+
} else if (headByte === 196) {
|
|
82158
|
+
const size = this.lookU8();
|
|
82159
|
+
object = this.decodeBinary(size, 1);
|
|
82160
|
+
} else if (headByte === 197) {
|
|
82161
|
+
const size = this.lookU16();
|
|
82162
|
+
object = this.decodeBinary(size, 2);
|
|
82163
|
+
} else if (headByte === 198) {
|
|
82164
|
+
const size = this.lookU32();
|
|
82165
|
+
object = this.decodeBinary(size, 4);
|
|
82166
|
+
} else if (headByte === 212) {
|
|
82167
|
+
object = this.decodeExtension(1, 0);
|
|
82168
|
+
} else if (headByte === 213) {
|
|
82169
|
+
object = this.decodeExtension(2, 0);
|
|
82170
|
+
} else if (headByte === 214) {
|
|
82171
|
+
object = this.decodeExtension(4, 0);
|
|
82172
|
+
} else if (headByte === 215) {
|
|
82173
|
+
object = this.decodeExtension(8, 0);
|
|
82174
|
+
} else if (headByte === 216) {
|
|
82175
|
+
object = this.decodeExtension(16, 0);
|
|
82176
|
+
} else if (headByte === 199) {
|
|
82177
|
+
const size = this.lookU8();
|
|
82178
|
+
object = this.decodeExtension(size, 1);
|
|
82179
|
+
} else if (headByte === 200) {
|
|
82180
|
+
const size = this.lookU16();
|
|
82181
|
+
object = this.decodeExtension(size, 2);
|
|
82182
|
+
} else if (headByte === 201) {
|
|
82183
|
+
const size = this.lookU32();
|
|
82184
|
+
object = this.decodeExtension(size, 4);
|
|
82185
|
+
} else {
|
|
82186
|
+
throw new DecodeError_ts_1.DecodeError(`Unrecognized type byte: ${(0, prettyByte_ts_1.prettyByte)(headByte)}`);
|
|
82187
|
+
}
|
|
82188
|
+
this.complete();
|
|
82189
|
+
const stack = this.stack;
|
|
82190
|
+
while (stack.length > 0) {
|
|
82191
|
+
const state = stack.top();
|
|
82192
|
+
if (state.type === STATE_ARRAY) {
|
|
82193
|
+
state.array[state.position] = object;
|
|
82194
|
+
state.position++;
|
|
82195
|
+
if (state.position === state.size) {
|
|
82196
|
+
object = state.array;
|
|
82197
|
+
stack.release(state);
|
|
82198
|
+
} else {
|
|
82199
|
+
continue DECODE;
|
|
82200
|
+
}
|
|
82201
|
+
} else if (state.type === STATE_MAP_KEY) {
|
|
82202
|
+
if (object === "__proto__") {
|
|
82203
|
+
throw new DecodeError_ts_1.DecodeError("The key __proto__ is not allowed");
|
|
82204
|
+
}
|
|
82205
|
+
state.key = this.mapKeyConverter(object);
|
|
82206
|
+
state.type = STATE_MAP_VALUE;
|
|
82207
|
+
continue DECODE;
|
|
82208
|
+
} else {
|
|
82209
|
+
state.map[state.key] = object;
|
|
82210
|
+
state.readCount++;
|
|
82211
|
+
if (state.readCount === state.size) {
|
|
82212
|
+
object = state.map;
|
|
82213
|
+
stack.release(state);
|
|
82214
|
+
} else {
|
|
82215
|
+
state.key = null;
|
|
82216
|
+
state.type = STATE_MAP_KEY;
|
|
82217
|
+
continue DECODE;
|
|
82218
|
+
}
|
|
82219
|
+
}
|
|
82220
|
+
}
|
|
82221
|
+
return object;
|
|
82222
|
+
}
|
|
82223
|
+
}
|
|
82224
|
+
readHeadByte() {
|
|
82225
|
+
if (this.headByte === HEAD_BYTE_REQUIRED) {
|
|
82226
|
+
this.headByte = this.readU8();
|
|
82227
|
+
}
|
|
82228
|
+
return this.headByte;
|
|
82229
|
+
}
|
|
82230
|
+
complete() {
|
|
82231
|
+
this.headByte = HEAD_BYTE_REQUIRED;
|
|
82232
|
+
}
|
|
82233
|
+
readArraySize() {
|
|
82234
|
+
const headByte = this.readHeadByte();
|
|
82235
|
+
switch (headByte) {
|
|
82236
|
+
case 220:
|
|
82237
|
+
return this.readU16();
|
|
82238
|
+
case 221:
|
|
82239
|
+
return this.readU32();
|
|
82240
|
+
default: {
|
|
82241
|
+
if (headByte < 160) {
|
|
82242
|
+
return headByte - 144;
|
|
82243
|
+
} else {
|
|
82244
|
+
throw new DecodeError_ts_1.DecodeError(`Unrecognized array type byte: ${(0, prettyByte_ts_1.prettyByte)(headByte)}`);
|
|
82245
|
+
}
|
|
82246
|
+
}
|
|
82247
|
+
}
|
|
82248
|
+
}
|
|
82249
|
+
pushMapState(size) {
|
|
82250
|
+
if (size > this.maxMapLength) {
|
|
82251
|
+
throw new DecodeError_ts_1.DecodeError(`Max length exceeded: map length (${size}) > maxMapLengthLength (${this.maxMapLength})`);
|
|
82252
|
+
}
|
|
82253
|
+
this.stack.pushMapState(size);
|
|
82254
|
+
}
|
|
82255
|
+
pushArrayState(size) {
|
|
82256
|
+
if (size > this.maxArrayLength) {
|
|
82257
|
+
throw new DecodeError_ts_1.DecodeError(`Max length exceeded: array length (${size}) > maxArrayLength (${this.maxArrayLength})`);
|
|
82258
|
+
}
|
|
82259
|
+
this.stack.pushArrayState(size);
|
|
82260
|
+
}
|
|
82261
|
+
decodeString(byteLength, headerOffset) {
|
|
82262
|
+
if (!this.rawStrings || this.stateIsMapKey()) {
|
|
82263
|
+
return this.decodeUtf8String(byteLength, headerOffset);
|
|
82264
|
+
}
|
|
82265
|
+
return this.decodeBinary(byteLength, headerOffset);
|
|
82266
|
+
}
|
|
82267
|
+
/**
|
|
82268
|
+
* @throws {@link RangeError}
|
|
82269
|
+
*/
|
|
82270
|
+
decodeUtf8String(byteLength, headerOffset) {
|
|
82271
|
+
if (byteLength > this.maxStrLength) {
|
|
82272
|
+
throw new DecodeError_ts_1.DecodeError(`Max length exceeded: UTF-8 byte length (${byteLength}) > maxStrLength (${this.maxStrLength})`);
|
|
82273
|
+
}
|
|
82274
|
+
if (this.bytes.byteLength < this.pos + headerOffset + byteLength) {
|
|
82275
|
+
throw MORE_DATA;
|
|
82276
|
+
}
|
|
82277
|
+
const offset2 = this.pos + headerOffset;
|
|
82278
|
+
let object;
|
|
82279
|
+
if (this.stateIsMapKey() && this.keyDecoder?.canBeCached(byteLength)) {
|
|
82280
|
+
object = this.keyDecoder.decode(this.bytes, offset2, byteLength);
|
|
82281
|
+
} else {
|
|
82282
|
+
object = (0, utf8_ts_1.utf8Decode)(this.bytes, offset2, byteLength);
|
|
82283
|
+
}
|
|
82284
|
+
this.pos += headerOffset + byteLength;
|
|
82285
|
+
return object;
|
|
82286
|
+
}
|
|
82287
|
+
stateIsMapKey() {
|
|
82288
|
+
if (this.stack.length > 0) {
|
|
82289
|
+
const state = this.stack.top();
|
|
82290
|
+
return state.type === STATE_MAP_KEY;
|
|
82291
|
+
}
|
|
82292
|
+
return false;
|
|
82293
|
+
}
|
|
82294
|
+
/**
|
|
82295
|
+
* @throws {@link RangeError}
|
|
82296
|
+
*/
|
|
82297
|
+
decodeBinary(byteLength, headOffset) {
|
|
82298
|
+
if (byteLength > this.maxBinLength) {
|
|
82299
|
+
throw new DecodeError_ts_1.DecodeError(`Max length exceeded: bin length (${byteLength}) > maxBinLength (${this.maxBinLength})`);
|
|
82300
|
+
}
|
|
82301
|
+
if (!this.hasRemaining(byteLength + headOffset)) {
|
|
82302
|
+
throw MORE_DATA;
|
|
82303
|
+
}
|
|
82304
|
+
const offset2 = this.pos + headOffset;
|
|
82305
|
+
const object = this.bytes.subarray(offset2, offset2 + byteLength);
|
|
82306
|
+
this.pos += headOffset + byteLength;
|
|
82307
|
+
return object;
|
|
82308
|
+
}
|
|
82309
|
+
decodeExtension(size, headOffset) {
|
|
82310
|
+
if (size > this.maxExtLength) {
|
|
82311
|
+
throw new DecodeError_ts_1.DecodeError(`Max length exceeded: ext length (${size}) > maxExtLength (${this.maxExtLength})`);
|
|
82312
|
+
}
|
|
82313
|
+
const extType = this.view.getInt8(this.pos + headOffset);
|
|
82314
|
+
const data = this.decodeBinary(
|
|
82315
|
+
size,
|
|
82316
|
+
headOffset + 1
|
|
82317
|
+
/* extType */
|
|
82318
|
+
);
|
|
82319
|
+
return this.extensionCodec.decode(data, extType, this.context);
|
|
82320
|
+
}
|
|
82321
|
+
lookU8() {
|
|
82322
|
+
return this.view.getUint8(this.pos);
|
|
82323
|
+
}
|
|
82324
|
+
lookU16() {
|
|
82325
|
+
return this.view.getUint16(this.pos);
|
|
82326
|
+
}
|
|
82327
|
+
lookU32() {
|
|
82328
|
+
return this.view.getUint32(this.pos);
|
|
82329
|
+
}
|
|
82330
|
+
readU8() {
|
|
82331
|
+
const value = this.view.getUint8(this.pos);
|
|
82332
|
+
this.pos++;
|
|
82333
|
+
return value;
|
|
82334
|
+
}
|
|
82335
|
+
readI8() {
|
|
82336
|
+
const value = this.view.getInt8(this.pos);
|
|
82337
|
+
this.pos++;
|
|
82338
|
+
return value;
|
|
82339
|
+
}
|
|
82340
|
+
readU16() {
|
|
82341
|
+
const value = this.view.getUint16(this.pos);
|
|
82342
|
+
this.pos += 2;
|
|
82343
|
+
return value;
|
|
82344
|
+
}
|
|
82345
|
+
readI16() {
|
|
82346
|
+
const value = this.view.getInt16(this.pos);
|
|
82347
|
+
this.pos += 2;
|
|
82348
|
+
return value;
|
|
82349
|
+
}
|
|
82350
|
+
readU32() {
|
|
82351
|
+
const value = this.view.getUint32(this.pos);
|
|
82352
|
+
this.pos += 4;
|
|
82353
|
+
return value;
|
|
82354
|
+
}
|
|
82355
|
+
readI32() {
|
|
82356
|
+
const value = this.view.getInt32(this.pos);
|
|
82357
|
+
this.pos += 4;
|
|
82358
|
+
return value;
|
|
82359
|
+
}
|
|
82360
|
+
readU64() {
|
|
82361
|
+
const value = (0, int_ts_1.getUint64)(this.view, this.pos);
|
|
82362
|
+
this.pos += 8;
|
|
82363
|
+
return value;
|
|
82364
|
+
}
|
|
82365
|
+
readI64() {
|
|
82366
|
+
const value = (0, int_ts_1.getInt64)(this.view, this.pos);
|
|
82367
|
+
this.pos += 8;
|
|
82368
|
+
return value;
|
|
82369
|
+
}
|
|
82370
|
+
readU64AsBigInt() {
|
|
82371
|
+
const value = this.view.getBigUint64(this.pos);
|
|
82372
|
+
this.pos += 8;
|
|
82373
|
+
return value;
|
|
82374
|
+
}
|
|
82375
|
+
readI64AsBigInt() {
|
|
82376
|
+
const value = this.view.getBigInt64(this.pos);
|
|
82377
|
+
this.pos += 8;
|
|
82378
|
+
return value;
|
|
82379
|
+
}
|
|
82380
|
+
readF32() {
|
|
82381
|
+
const value = this.view.getFloat32(this.pos);
|
|
82382
|
+
this.pos += 4;
|
|
82383
|
+
return value;
|
|
82384
|
+
}
|
|
82385
|
+
readF64() {
|
|
82386
|
+
const value = this.view.getFloat64(this.pos);
|
|
82387
|
+
this.pos += 8;
|
|
82388
|
+
return value;
|
|
82389
|
+
}
|
|
82390
|
+
};
|
|
82391
|
+
exports2.Decoder = Decoder;
|
|
82392
|
+
}
|
|
82393
|
+
});
|
|
82394
|
+
|
|
82395
|
+
// node_modules/@msgpack/msgpack/dist.cjs/decode.cjs
|
|
82396
|
+
var require_decode = __commonJS({
|
|
82397
|
+
"node_modules/@msgpack/msgpack/dist.cjs/decode.cjs"(exports2) {
|
|
82398
|
+
"use strict";
|
|
82399
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
82400
|
+
exports2.decode = decode;
|
|
82401
|
+
exports2.decodeMulti = decodeMulti;
|
|
82402
|
+
var Decoder_ts_1 = require_Decoder();
|
|
82403
|
+
function decode(buffer, options) {
|
|
82404
|
+
const decoder = new Decoder_ts_1.Decoder(options);
|
|
82405
|
+
return decoder.decode(buffer);
|
|
82406
|
+
}
|
|
82407
|
+
function decodeMulti(buffer, options) {
|
|
82408
|
+
const decoder = new Decoder_ts_1.Decoder(options);
|
|
82409
|
+
return decoder.decodeMulti(buffer);
|
|
82410
|
+
}
|
|
82411
|
+
}
|
|
82412
|
+
});
|
|
82413
|
+
|
|
82414
|
+
// node_modules/@msgpack/msgpack/dist.cjs/utils/stream.cjs
|
|
82415
|
+
var require_stream2 = __commonJS({
|
|
82416
|
+
"node_modules/@msgpack/msgpack/dist.cjs/utils/stream.cjs"(exports2) {
|
|
82417
|
+
"use strict";
|
|
82418
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
82419
|
+
exports2.isAsyncIterable = isAsyncIterable;
|
|
82420
|
+
exports2.asyncIterableFromStream = asyncIterableFromStream;
|
|
82421
|
+
exports2.ensureAsyncIterable = ensureAsyncIterable;
|
|
82422
|
+
function isAsyncIterable(object) {
|
|
82423
|
+
return object[Symbol.asyncIterator] != null;
|
|
82424
|
+
}
|
|
82425
|
+
async function* asyncIterableFromStream(stream) {
|
|
82426
|
+
const reader = stream.getReader();
|
|
82427
|
+
try {
|
|
82428
|
+
while (true) {
|
|
82429
|
+
const { done, value } = await reader.read();
|
|
82430
|
+
if (done) {
|
|
82431
|
+
return;
|
|
82432
|
+
}
|
|
82433
|
+
yield value;
|
|
82434
|
+
}
|
|
82435
|
+
} finally {
|
|
82436
|
+
reader.releaseLock();
|
|
82437
|
+
}
|
|
82438
|
+
}
|
|
82439
|
+
function ensureAsyncIterable(streamLike) {
|
|
82440
|
+
if (isAsyncIterable(streamLike)) {
|
|
82441
|
+
return streamLike;
|
|
82442
|
+
} else {
|
|
82443
|
+
return asyncIterableFromStream(streamLike);
|
|
82444
|
+
}
|
|
82445
|
+
}
|
|
82446
|
+
}
|
|
82447
|
+
});
|
|
82448
|
+
|
|
82449
|
+
// node_modules/@msgpack/msgpack/dist.cjs/decodeAsync.cjs
|
|
82450
|
+
var require_decodeAsync = __commonJS({
|
|
82451
|
+
"node_modules/@msgpack/msgpack/dist.cjs/decodeAsync.cjs"(exports2) {
|
|
82452
|
+
"use strict";
|
|
82453
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
82454
|
+
exports2.decodeAsync = decodeAsync;
|
|
82455
|
+
exports2.decodeArrayStream = decodeArrayStream;
|
|
82456
|
+
exports2.decodeMultiStream = decodeMultiStream;
|
|
82457
|
+
var Decoder_ts_1 = require_Decoder();
|
|
82458
|
+
var stream_ts_1 = require_stream2();
|
|
82459
|
+
async function decodeAsync(streamLike, options) {
|
|
82460
|
+
const stream = (0, stream_ts_1.ensureAsyncIterable)(streamLike);
|
|
82461
|
+
const decoder = new Decoder_ts_1.Decoder(options);
|
|
82462
|
+
return decoder.decodeAsync(stream);
|
|
82463
|
+
}
|
|
82464
|
+
function decodeArrayStream(streamLike, options) {
|
|
82465
|
+
const stream = (0, stream_ts_1.ensureAsyncIterable)(streamLike);
|
|
82466
|
+
const decoder = new Decoder_ts_1.Decoder(options);
|
|
82467
|
+
return decoder.decodeArrayStream(stream);
|
|
82468
|
+
}
|
|
82469
|
+
function decodeMultiStream(streamLike, options) {
|
|
82470
|
+
const stream = (0, stream_ts_1.ensureAsyncIterable)(streamLike);
|
|
82471
|
+
const decoder = new Decoder_ts_1.Decoder(options);
|
|
82472
|
+
return decoder.decodeStream(stream);
|
|
82473
|
+
}
|
|
82474
|
+
}
|
|
82475
|
+
});
|
|
82476
|
+
|
|
82477
|
+
// node_modules/@msgpack/msgpack/dist.cjs/index.cjs
|
|
82478
|
+
var require_dist5 = __commonJS({
|
|
82479
|
+
"node_modules/@msgpack/msgpack/dist.cjs/index.cjs"(exports2) {
|
|
82480
|
+
"use strict";
|
|
82481
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
82482
|
+
exports2.decodeTimestampExtension = exports2.encodeTimestampExtension = exports2.decodeTimestampToTimeSpec = exports2.encodeTimeSpecToTimestamp = exports2.encodeDateToTimeSpec = exports2.EXT_TIMESTAMP = exports2.ExtData = exports2.ExtensionCodec = exports2.Encoder = exports2.DecodeError = exports2.Decoder = exports2.decodeMultiStream = exports2.decodeArrayStream = exports2.decodeAsync = exports2.decodeMulti = exports2.decode = exports2.encode = void 0;
|
|
82483
|
+
var encode_ts_1 = require_encode();
|
|
82484
|
+
Object.defineProperty(exports2, "encode", { enumerable: true, get: function() {
|
|
82485
|
+
return encode_ts_1.encode;
|
|
82486
|
+
} });
|
|
82487
|
+
var decode_ts_1 = require_decode();
|
|
82488
|
+
Object.defineProperty(exports2, "decode", { enumerable: true, get: function() {
|
|
82489
|
+
return decode_ts_1.decode;
|
|
82490
|
+
} });
|
|
82491
|
+
Object.defineProperty(exports2, "decodeMulti", { enumerable: true, get: function() {
|
|
82492
|
+
return decode_ts_1.decodeMulti;
|
|
82493
|
+
} });
|
|
82494
|
+
var decodeAsync_ts_1 = require_decodeAsync();
|
|
82495
|
+
Object.defineProperty(exports2, "decodeAsync", { enumerable: true, get: function() {
|
|
82496
|
+
return decodeAsync_ts_1.decodeAsync;
|
|
82497
|
+
} });
|
|
82498
|
+
Object.defineProperty(exports2, "decodeArrayStream", { enumerable: true, get: function() {
|
|
82499
|
+
return decodeAsync_ts_1.decodeArrayStream;
|
|
82500
|
+
} });
|
|
82501
|
+
Object.defineProperty(exports2, "decodeMultiStream", { enumerable: true, get: function() {
|
|
82502
|
+
return decodeAsync_ts_1.decodeMultiStream;
|
|
82503
|
+
} });
|
|
82504
|
+
var Decoder_ts_1 = require_Decoder();
|
|
82505
|
+
Object.defineProperty(exports2, "Decoder", { enumerable: true, get: function() {
|
|
82506
|
+
return Decoder_ts_1.Decoder;
|
|
82507
|
+
} });
|
|
82508
|
+
var DecodeError_ts_1 = require_DecodeError();
|
|
82509
|
+
Object.defineProperty(exports2, "DecodeError", { enumerable: true, get: function() {
|
|
82510
|
+
return DecodeError_ts_1.DecodeError;
|
|
82511
|
+
} });
|
|
82512
|
+
var Encoder_ts_1 = require_Encoder();
|
|
82513
|
+
Object.defineProperty(exports2, "Encoder", { enumerable: true, get: function() {
|
|
82514
|
+
return Encoder_ts_1.Encoder;
|
|
82515
|
+
} });
|
|
82516
|
+
var ExtensionCodec_ts_1 = require_ExtensionCodec();
|
|
82517
|
+
Object.defineProperty(exports2, "ExtensionCodec", { enumerable: true, get: function() {
|
|
82518
|
+
return ExtensionCodec_ts_1.ExtensionCodec;
|
|
82519
|
+
} });
|
|
82520
|
+
var ExtData_ts_1 = require_ExtData();
|
|
82521
|
+
Object.defineProperty(exports2, "ExtData", { enumerable: true, get: function() {
|
|
82522
|
+
return ExtData_ts_1.ExtData;
|
|
82523
|
+
} });
|
|
82524
|
+
var timestamp_ts_1 = require_timestamp();
|
|
82525
|
+
Object.defineProperty(exports2, "EXT_TIMESTAMP", { enumerable: true, get: function() {
|
|
82526
|
+
return timestamp_ts_1.EXT_TIMESTAMP;
|
|
82527
|
+
} });
|
|
82528
|
+
Object.defineProperty(exports2, "encodeDateToTimeSpec", { enumerable: true, get: function() {
|
|
82529
|
+
return timestamp_ts_1.encodeDateToTimeSpec;
|
|
82530
|
+
} });
|
|
82531
|
+
Object.defineProperty(exports2, "encodeTimeSpecToTimestamp", { enumerable: true, get: function() {
|
|
82532
|
+
return timestamp_ts_1.encodeTimeSpecToTimestamp;
|
|
82533
|
+
} });
|
|
82534
|
+
Object.defineProperty(exports2, "decodeTimestampToTimeSpec", { enumerable: true, get: function() {
|
|
82535
|
+
return timestamp_ts_1.decodeTimestampToTimeSpec;
|
|
82536
|
+
} });
|
|
82537
|
+
Object.defineProperty(exports2, "encodeTimestampExtension", { enumerable: true, get: function() {
|
|
82538
|
+
return timestamp_ts_1.encodeTimestampExtension;
|
|
82539
|
+
} });
|
|
82540
|
+
Object.defineProperty(exports2, "decodeTimestampExtension", { enumerable: true, get: function() {
|
|
82541
|
+
return timestamp_ts_1.decodeTimestampExtension;
|
|
82542
|
+
} });
|
|
82543
|
+
}
|
|
82544
|
+
});
|
|
82545
|
+
|
|
80829
82546
|
// src/sdk/calculate.ts
|
|
80830
82547
|
var calculate_exports = {};
|
|
80831
82548
|
__export(calculate_exports, {
|
|
@@ -84356,6 +86073,7 @@ byreal-cli catalog show dex.pool.list
|
|
|
84356
86073
|
| defi.kamino.status | View Kamino positions and APY |
|
|
84357
86074
|
| defi.rent.reclaim | Close empty accounts to reclaim SOL rent |
|
|
84358
86075
|
| defi.sweep.execute | Consolidate dust tokens into USDC |
|
|
86076
|
+
| defi.dflow.swap | Swap tokens via DFlow order-flow aggregator |
|
|
84359
86077
|
|
|
84360
86078
|
## Global Options
|
|
84361
86079
|
|
|
@@ -84432,6 +86150,8 @@ Present on-chain data first, then external context, then synthesize how external
|
|
|
84432
86150
|
| Kamino status | \`byreal-cli kamino status --wallet-address <addr>\` |
|
|
84433
86151
|
| Rent reclaim scan | \`byreal-cli rent reclaim --dry-run --wallet-address <addr>\` |
|
|
84434
86152
|
| Rent reclaim execute | \`byreal-cli rent reclaim --wallet-address <addr>\` |
|
|
86153
|
+
| DFlow swap preview | \`byreal-cli dflow swap --input-mint <mint> --output-mint <mint> --amount <amt> --dry-run --wallet-address <addr>\` |
|
|
86154
|
+
| DFlow swap execute | \`byreal-cli dflow swap --input-mint <mint> --output-mint <mint> --amount <amt> --wallet-address <addr>\` |
|
|
84435
86155
|
| Sweep dust preview | \`byreal-cli sweep execute --dry-run --wallet-address <addr>\` |
|
|
84436
86156
|
| Sweep dust execute | \`byreal-cli sweep execute --wallet-address <addr>\` |
|
|
84437
86157
|
|
|
@@ -84547,14 +86267,18 @@ When user asks vague questions like "\u6709\u4EC0\u4E48\u4ED3\u4F4D\u53EF\u4EE5
|
|
|
84547
86267
|
- If all positions in a pool are out-of-range, skip that pool and explain why
|
|
84548
86268
|
- To inspect a specific LP's full portfolio: \`byreal-cli positions list --user <wallet-address> -o json\`
|
|
84549
86269
|
|
|
84550
|
-
##
|
|
86270
|
+
## Swap Routing Priority
|
|
84551
86271
|
|
|
84552
|
-
|
|
84553
|
-
1. **Preview**: \`byreal-cli jup swap --input-mint <mint> --output-mint <mint> --amount <amt> --dry-run --wallet-address <addr>\`
|
|
84554
|
-
2. **Execute**: Remove \`--dry-run\` to generate the unsigned transaction
|
|
84555
|
-
3. Output: \`{ unsignedTransactions: [base64] }\`
|
|
86272
|
+
Default to \`byreal-cli swap execute\`. Fall back to \`jup swap\` / \`dflow swap\` only if Byreal returns no route, or the user names an aggregator explicitly.
|
|
84556
86273
|
|
|
84557
|
-
|
|
86274
|
+
## Workflow: Jupiter / DFlow Swap
|
|
86275
|
+
|
|
86276
|
+
\`\`\`
|
|
86277
|
+
byreal-cli jup swap --input-mint <mint> --output-mint <mint> --amount <amt> [--dry-run] --wallet-address <addr>
|
|
86278
|
+
byreal-cli dflow swap --input-mint <mint> --output-mint <mint> --amount <amt> [--dry-run] --wallet-address <addr>
|
|
86279
|
+
\`\`\`
|
|
86280
|
+
|
|
86281
|
+
Output: \`{ unsignedTransactions: [base64] }\`. DFlow optionally reads \`DFLOW_API_KEY\`.
|
|
84558
86282
|
|
|
84559
86283
|
## Workflow: Idle Yield with Kamino
|
|
84560
86284
|
|
|
@@ -84613,7 +86337,7 @@ function createSkillCommand() {
|
|
|
84613
86337
|
}
|
|
84614
86338
|
|
|
84615
86339
|
// src/cli/commands/catalog.ts
|
|
84616
|
-
var
|
|
86340
|
+
var import_cli_table38 = __toESM(require_cli_table3(), 1);
|
|
84617
86341
|
init_constants();
|
|
84618
86342
|
|
|
84619
86343
|
// src/plugins/jupiter/commands.ts
|
|
@@ -84683,8 +86407,80 @@ init_constants();
|
|
|
84683
86407
|
// src/plugins/jupiter/api.ts
|
|
84684
86408
|
init_types();
|
|
84685
86409
|
init_errors();
|
|
84686
|
-
|
|
84687
|
-
|
|
86410
|
+
init_constants();
|
|
86411
|
+
|
|
86412
|
+
// src/core/proxy.ts
|
|
86413
|
+
var import_node_net = __toESM(require("node:net"), 1);
|
|
86414
|
+
var PROXY_URL = process.env.BYREAL_PROXY_URL ?? "http://api-proxy:8080";
|
|
86415
|
+
var PROBE_TIMEOUT_MS = 500;
|
|
86416
|
+
var cached = null;
|
|
86417
|
+
var inFlight = null;
|
|
86418
|
+
async function isProxyAvailable() {
|
|
86419
|
+
if (cached !== null) return cached;
|
|
86420
|
+
if (inFlight) return inFlight;
|
|
86421
|
+
inFlight = probe().then((ok2) => {
|
|
86422
|
+
cached = ok2;
|
|
86423
|
+
inFlight = null;
|
|
86424
|
+
return ok2;
|
|
86425
|
+
});
|
|
86426
|
+
return inFlight;
|
|
86427
|
+
}
|
|
86428
|
+
async function probe() {
|
|
86429
|
+
if (!PROXY_URL) return false;
|
|
86430
|
+
let host;
|
|
86431
|
+
let port;
|
|
86432
|
+
try {
|
|
86433
|
+
const u = new URL(PROXY_URL);
|
|
86434
|
+
host = u.hostname;
|
|
86435
|
+
port = Number(u.port) || (u.protocol === "https:" ? 443 : 80);
|
|
86436
|
+
} catch {
|
|
86437
|
+
return false;
|
|
86438
|
+
}
|
|
86439
|
+
return new Promise((resolve) => {
|
|
86440
|
+
const socket = new import_node_net.default.Socket();
|
|
86441
|
+
let settled = false;
|
|
86442
|
+
const settle = (ok2) => {
|
|
86443
|
+
if (settled) return;
|
|
86444
|
+
settled = true;
|
|
86445
|
+
socket.destroy();
|
|
86446
|
+
resolve(ok2);
|
|
86447
|
+
};
|
|
86448
|
+
socket.setTimeout(PROBE_TIMEOUT_MS);
|
|
86449
|
+
socket.once("error", () => settle(false));
|
|
86450
|
+
socket.once("timeout", () => settle(false));
|
|
86451
|
+
socket.connect(port, host, () => settle(true));
|
|
86452
|
+
});
|
|
86453
|
+
}
|
|
86454
|
+
|
|
86455
|
+
// src/plugins/jupiter/api.ts
|
|
86456
|
+
var lastRoute = null;
|
|
86457
|
+
function getLastRoute() {
|
|
86458
|
+
return lastRoute;
|
|
86459
|
+
}
|
|
86460
|
+
async function resolveRoute(subPath) {
|
|
86461
|
+
if (await isProxyAvailable()) {
|
|
86462
|
+
lastRoute = "proxy";
|
|
86463
|
+
return {
|
|
86464
|
+
url: `${PROXY_URL.replace(/\/$/, "")}/jup${subPath}`,
|
|
86465
|
+
headers: {},
|
|
86466
|
+
route: "proxy"
|
|
86467
|
+
};
|
|
86468
|
+
}
|
|
86469
|
+
if (JUPITER_API_KEY) {
|
|
86470
|
+
lastRoute = "direct-paid";
|
|
86471
|
+
return {
|
|
86472
|
+
url: `${JUP_PAID_BASE}${subPath}`,
|
|
86473
|
+
headers: { "x-api-key": JUPITER_API_KEY },
|
|
86474
|
+
route: "direct-paid"
|
|
86475
|
+
};
|
|
86476
|
+
}
|
|
86477
|
+
lastRoute = "direct-free";
|
|
86478
|
+
return {
|
|
86479
|
+
url: `${JUP_FREE_BASE}${subPath}`,
|
|
86480
|
+
headers: {},
|
|
86481
|
+
route: "direct-free"
|
|
86482
|
+
};
|
|
86483
|
+
}
|
|
84688
86484
|
async function getQuote(params) {
|
|
84689
86485
|
try {
|
|
84690
86486
|
const searchParams = new URLSearchParams({
|
|
@@ -84698,7 +86494,8 @@ async function getQuote(params) {
|
|
|
84698
86494
|
if (params.slippageBps !== void 0) {
|
|
84699
86495
|
searchParams.set("slippageBps", String(params.slippageBps));
|
|
84700
86496
|
}
|
|
84701
|
-
const
|
|
86497
|
+
const { url, headers } = await resolveRoute("/swap/v1/quote");
|
|
86498
|
+
const response = await fetch(`${url}?${searchParams}`, { headers });
|
|
84702
86499
|
if (!response.ok) {
|
|
84703
86500
|
const text = await response.text();
|
|
84704
86501
|
return err(apiError(`Jupiter quote failed: ${text}`, response.status));
|
|
@@ -84711,9 +86508,10 @@ async function getQuote(params) {
|
|
|
84711
86508
|
}
|
|
84712
86509
|
async function getSwapTransaction(params) {
|
|
84713
86510
|
try {
|
|
84714
|
-
const
|
|
86511
|
+
const { url, headers } = await resolveRoute("/swap/v1/swap");
|
|
86512
|
+
const response = await fetch(url, {
|
|
84715
86513
|
method: "POST",
|
|
84716
|
-
headers: { "Content-Type": "application/json" },
|
|
86514
|
+
headers: { "Content-Type": "application/json", ...headers },
|
|
84717
86515
|
body: JSON.stringify({
|
|
84718
86516
|
quoteResponse: params.quoteResponse,
|
|
84719
86517
|
userPublicKey: params.userPublicKey,
|
|
@@ -84741,7 +86539,8 @@ async function getSwapTransaction(params) {
|
|
|
84741
86539
|
}
|
|
84742
86540
|
async function getPrice(mints) {
|
|
84743
86541
|
try {
|
|
84744
|
-
const
|
|
86542
|
+
const { url, headers } = await resolveRoute("/price/v3");
|
|
86543
|
+
const response = await fetch(`${url}?ids=${mints.join(",")}`, { headers });
|
|
84745
86544
|
if (!response.ok) {
|
|
84746
86545
|
const text = await response.text();
|
|
84747
86546
|
return err(apiError(`Jupiter price failed: ${text}`, response.status));
|
|
@@ -84754,6 +86553,11 @@ async function getPrice(mints) {
|
|
|
84754
86553
|
}
|
|
84755
86554
|
|
|
84756
86555
|
// src/plugins/jupiter/commands.ts
|
|
86556
|
+
function fallbackHint(route) {
|
|
86557
|
+
if (route === "direct-paid") return "byreal proxy unreachable \u2014 using api.jup.ag with JUPITER_API_KEY";
|
|
86558
|
+
if (route === "direct-free") return "byreal proxy unreachable \u2014 using lite-api.jup.ag (no key, rate-limited)";
|
|
86559
|
+
return null;
|
|
86560
|
+
}
|
|
84757
86561
|
function createJupSwapCommand() {
|
|
84758
86562
|
return new Command("swap").description("Swap tokens via Jupiter aggregator").requiredOption("--input-mint <address>", "Input token mint address").requiredOption("--output-mint <address>", "Output token mint address").requiredOption("--amount <amount>", "Amount to swap (UI amount, decimals auto-resolved)").option("--slippage <bps>", "Slippage tolerance in basis points").option("--raw", "Amount is already in raw (smallest unit) format").option("--dry-run", "Preview the swap without generating a transaction").action(async (options, cmdObj) => {
|
|
84759
86563
|
const globalOptions = cmdObj.optsWithGlobals();
|
|
@@ -84819,6 +86623,8 @@ Error: ${msg}`));
|
|
|
84819
86623
|
);
|
|
84820
86624
|
console.log(source_default.cyan.bold("\n Jupiter Swap Preview\n"));
|
|
84821
86625
|
console.log(table.toString());
|
|
86626
|
+
const hint = fallbackHint(getLastRoute());
|
|
86627
|
+
if (hint) console.error(source_default.gray(`[byreal] ${hint}`));
|
|
84822
86628
|
console.log(source_default.yellow("\n Remove --dry-run to generate the unsigned transaction"));
|
|
84823
86629
|
}
|
|
84824
86630
|
return;
|
|
@@ -84871,6 +86677,8 @@ function createJupPriceCommand() {
|
|
|
84871
86677
|
}
|
|
84872
86678
|
console.log(source_default.cyan.bold("\n Jupiter Price\n"));
|
|
84873
86679
|
console.log(table.toString());
|
|
86680
|
+
const hint = fallbackHint(getLastRoute());
|
|
86681
|
+
if (hint) console.error(source_default.gray(`[byreal] ${hint}`));
|
|
84874
86682
|
}
|
|
84875
86683
|
});
|
|
84876
86684
|
}
|
|
@@ -85989,12 +87797,581 @@ var consolidatePlugin = {
|
|
|
85989
87797
|
capabilities: capabilities4
|
|
85990
87798
|
};
|
|
85991
87799
|
|
|
87800
|
+
// src/plugins/titan/commands.ts
|
|
87801
|
+
var import_cli_table36 = __toESM(require_cli_table3(), 1);
|
|
87802
|
+
var import_web3120 = __toESM(require_index_cjs(), 1);
|
|
87803
|
+
init_solana();
|
|
87804
|
+
init_errors();
|
|
87805
|
+
init_constants();
|
|
87806
|
+
|
|
87807
|
+
// src/plugins/titan/api.ts
|
|
87808
|
+
var import_web3119 = __toESM(require_index_cjs(), 1);
|
|
87809
|
+
var import_msgpack = __toESM(require_dist5(), 1);
|
|
87810
|
+
init_errors();
|
|
87811
|
+
init_constants();
|
|
87812
|
+
init_solana();
|
|
87813
|
+
var TITAN_TIMEOUT_MS = 15e3;
|
|
87814
|
+
var lastRoute2 = null;
|
|
87815
|
+
function getLastRoute2() {
|
|
87816
|
+
return lastRoute2;
|
|
87817
|
+
}
|
|
87818
|
+
async function getSwapQuote2(params) {
|
|
87819
|
+
let url;
|
|
87820
|
+
const headers = { Accept: "application/vnd.msgpack" };
|
|
87821
|
+
if (await isProxyAvailable()) {
|
|
87822
|
+
lastRoute2 = "proxy";
|
|
87823
|
+
const base = PROXY_URL.replace(/\/$/, "");
|
|
87824
|
+
url = `${base}/titan/api/v1/quote/swap`;
|
|
87825
|
+
} else if (TITAN_AUTH_TOKEN) {
|
|
87826
|
+
lastRoute2 = "direct";
|
|
87827
|
+
url = `${TITAN_API_URL}/api/v1/quote/swap`;
|
|
87828
|
+
headers.Authorization = `Bearer ${TITAN_AUTH_TOKEN}`;
|
|
87829
|
+
} else {
|
|
87830
|
+
return {
|
|
87831
|
+
ok: false,
|
|
87832
|
+
error: new ByrealError({
|
|
87833
|
+
code: ErrorCodes.MISSING_REQUIRED,
|
|
87834
|
+
type: "VALIDATION",
|
|
87835
|
+
message: "Titan is only available via the Byreal proxy. The proxy is currently unreachable \u2014 please contact the Byreal team.",
|
|
87836
|
+
retryable: false
|
|
87837
|
+
})
|
|
87838
|
+
};
|
|
87839
|
+
}
|
|
87840
|
+
const query = new URLSearchParams({
|
|
87841
|
+
inputMint: params.inputMint,
|
|
87842
|
+
outputMint: params.outputMint,
|
|
87843
|
+
amount: params.amount,
|
|
87844
|
+
userPublicKey: params.userPublicKey,
|
|
87845
|
+
slippageBps: String(params.slippageBps),
|
|
87846
|
+
swapMode: params.swapMode
|
|
87847
|
+
});
|
|
87848
|
+
url = `${url}?${query.toString()}`;
|
|
87849
|
+
const controller = new AbortController();
|
|
87850
|
+
const timer = setTimeout(() => controller.abort(), TITAN_TIMEOUT_MS);
|
|
87851
|
+
let response;
|
|
87852
|
+
try {
|
|
87853
|
+
response = await fetch(url, {
|
|
87854
|
+
method: "GET",
|
|
87855
|
+
headers,
|
|
87856
|
+
signal: controller.signal
|
|
87857
|
+
});
|
|
87858
|
+
} catch (e) {
|
|
87859
|
+
clearTimeout(timer);
|
|
87860
|
+
const aborted = e.name === "AbortError";
|
|
87861
|
+
return {
|
|
87862
|
+
ok: false,
|
|
87863
|
+
error: new ByrealError({
|
|
87864
|
+
code: ErrorCodes.NETWORK_ERROR,
|
|
87865
|
+
type: "NETWORK",
|
|
87866
|
+
message: aborted ? `Titan request timed out after ${TITAN_TIMEOUT_MS}ms` : `Titan request failed: ${e.message}`,
|
|
87867
|
+
retryable: true
|
|
87868
|
+
})
|
|
87869
|
+
};
|
|
87870
|
+
}
|
|
87871
|
+
clearTimeout(timer);
|
|
87872
|
+
if (!response.ok) {
|
|
87873
|
+
const bodyText = await response.text().catch(() => "");
|
|
87874
|
+
return {
|
|
87875
|
+
ok: false,
|
|
87876
|
+
error: new ByrealError({
|
|
87877
|
+
code: ErrorCodes.API_ERROR,
|
|
87878
|
+
type: "NETWORK",
|
|
87879
|
+
message: `Titan API error ${response.status}: ${bodyText.slice(0, 200) || response.statusText}`,
|
|
87880
|
+
retryable: response.status >= 500 || response.status === 429
|
|
87881
|
+
})
|
|
87882
|
+
};
|
|
87883
|
+
}
|
|
87884
|
+
let decoded;
|
|
87885
|
+
try {
|
|
87886
|
+
const buf = new Uint8Array(await response.arrayBuffer());
|
|
87887
|
+
decoded = (0, import_msgpack.decode)(buf);
|
|
87888
|
+
} catch (e) {
|
|
87889
|
+
return {
|
|
87890
|
+
ok: false,
|
|
87891
|
+
error: new ByrealError({
|
|
87892
|
+
code: ErrorCodes.API_ERROR,
|
|
87893
|
+
type: "NETWORK",
|
|
87894
|
+
message: `Failed to decode Titan msgpack response: ${e.message}`,
|
|
87895
|
+
retryable: true
|
|
87896
|
+
})
|
|
87897
|
+
};
|
|
87898
|
+
}
|
|
87899
|
+
const bestRoute = pickBestRoute(decoded.quotes ?? {}, params.swapMode);
|
|
87900
|
+
if (!bestRoute || !bestRoute.instructions?.length) {
|
|
87901
|
+
return {
|
|
87902
|
+
ok: false,
|
|
87903
|
+
error: new ByrealError({
|
|
87904
|
+
code: ErrorCodes.API_ERROR,
|
|
87905
|
+
type: "NETWORK",
|
|
87906
|
+
message: "No swap route returned from Titan.",
|
|
87907
|
+
retryable: true
|
|
87908
|
+
})
|
|
87909
|
+
};
|
|
87910
|
+
}
|
|
87911
|
+
try {
|
|
87912
|
+
const transaction = await buildTransaction(
|
|
87913
|
+
bestRoute.instructions,
|
|
87914
|
+
bestRoute.addressLookupTables,
|
|
87915
|
+
params.userPublicKey,
|
|
87916
|
+
bestRoute.computeUnitsSafe ?? bestRoute.computeUnits
|
|
87917
|
+
);
|
|
87918
|
+
return {
|
|
87919
|
+
ok: true,
|
|
87920
|
+
value: {
|
|
87921
|
+
inAmount: String(bestRoute.inAmount),
|
|
87922
|
+
outAmount: String(bestRoute.outAmount),
|
|
87923
|
+
inputMint: params.inputMint,
|
|
87924
|
+
outputMint: params.outputMint,
|
|
87925
|
+
transaction
|
|
87926
|
+
}
|
|
87927
|
+
};
|
|
87928
|
+
} catch (e) {
|
|
87929
|
+
return {
|
|
87930
|
+
ok: false,
|
|
87931
|
+
error: new ByrealError({
|
|
87932
|
+
code: ErrorCodes.NETWORK_ERROR,
|
|
87933
|
+
type: "NETWORK",
|
|
87934
|
+
message: `Failed to build Titan transaction: ${e.message}`,
|
|
87935
|
+
retryable: true
|
|
87936
|
+
})
|
|
87937
|
+
};
|
|
87938
|
+
}
|
|
87939
|
+
}
|
|
87940
|
+
function pickBestRoute(quotes, swapMode) {
|
|
87941
|
+
let best = null;
|
|
87942
|
+
for (const route of Object.values(quotes)) {
|
|
87943
|
+
if (!route?.instructions?.length) continue;
|
|
87944
|
+
if (!best) {
|
|
87945
|
+
best = route;
|
|
87946
|
+
continue;
|
|
87947
|
+
}
|
|
87948
|
+
if (swapMode === "ExactIn") {
|
|
87949
|
+
if (BigInt(route.outAmount) > BigInt(best.outAmount)) best = route;
|
|
87950
|
+
} else {
|
|
87951
|
+
if (BigInt(route.inAmount) < BigInt(best.inAmount)) best = route;
|
|
87952
|
+
}
|
|
87953
|
+
}
|
|
87954
|
+
return best;
|
|
87955
|
+
}
|
|
87956
|
+
async function buildTransaction(instructions, altAddresses, userPublicKey, computeUnits) {
|
|
87957
|
+
const connection = getConnection();
|
|
87958
|
+
const payer = new import_web3119.PublicKey(userPublicKey);
|
|
87959
|
+
const budgetInstructions = [];
|
|
87960
|
+
if (computeUnits && computeUnits > 2e5) {
|
|
87961
|
+
budgetInstructions.push(
|
|
87962
|
+
import_web3119.ComputeBudgetProgram.setComputeUnitLimit({ units: computeUnits })
|
|
87963
|
+
);
|
|
87964
|
+
}
|
|
87965
|
+
budgetInstructions.push(
|
|
87966
|
+
import_web3119.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: DEFAULTS.PRIORITY_FEE_MICRO_LAMPORTS })
|
|
87967
|
+
);
|
|
87968
|
+
const txInstructions = instructions.map((ix) => {
|
|
87969
|
+
const accounts = (ix.a || []).map((acc) => ({
|
|
87970
|
+
pubkey: new import_web3119.PublicKey(acc.p),
|
|
87971
|
+
isSigner: acc.s ?? false,
|
|
87972
|
+
isWritable: acc.w ?? false
|
|
87973
|
+
}));
|
|
87974
|
+
return new import_web3119.TransactionInstruction({
|
|
87975
|
+
programId: new import_web3119.PublicKey(ix.p),
|
|
87976
|
+
keys: accounts,
|
|
87977
|
+
data: Buffer.from(ix.d)
|
|
87978
|
+
});
|
|
87979
|
+
});
|
|
87980
|
+
let lookupTableAccounts = [];
|
|
87981
|
+
if (altAddresses?.length) {
|
|
87982
|
+
const fetched = await Promise.all(
|
|
87983
|
+
altAddresses.map(async (addr) => {
|
|
87984
|
+
try {
|
|
87985
|
+
const result = await connection.getAddressLookupTable(new import_web3119.PublicKey(addr));
|
|
87986
|
+
return result.value;
|
|
87987
|
+
} catch {
|
|
87988
|
+
return null;
|
|
87989
|
+
}
|
|
87990
|
+
})
|
|
87991
|
+
);
|
|
87992
|
+
lookupTableAccounts = fetched.filter(
|
|
87993
|
+
(t) => t !== null
|
|
87994
|
+
);
|
|
87995
|
+
}
|
|
87996
|
+
const { blockhash } = await connection.getLatestBlockhash("confirmed");
|
|
87997
|
+
const messageV0 = new import_web3119.TransactionMessage({
|
|
87998
|
+
payerKey: payer,
|
|
87999
|
+
recentBlockhash: blockhash,
|
|
88000
|
+
instructions: [...budgetInstructions, ...txInstructions]
|
|
88001
|
+
}).compileToV0Message(lookupTableAccounts);
|
|
88002
|
+
const tx = new import_web3119.VersionedTransaction(messageV0);
|
|
88003
|
+
return Buffer.from(tx.serialize()).toString("base64");
|
|
88004
|
+
}
|
|
88005
|
+
|
|
88006
|
+
// src/plugins/titan/commands.ts
|
|
88007
|
+
function fallbackHint2(route) {
|
|
88008
|
+
if (route === "direct") return "byreal proxy unreachable \u2014 using direct Titan Gateway with TITAN_AUTH_TOKEN";
|
|
88009
|
+
return null;
|
|
88010
|
+
}
|
|
88011
|
+
function createTitanSwapCommand() {
|
|
88012
|
+
return new Command("swap").description("Swap tokens via Titan Exchange aggregator").requiredOption("--input-mint <address>", "Input token mint address").requiredOption("--output-mint <address>", "Output token mint address").requiredOption("--amount <amount>", "Amount to swap (UI amount, decimals auto-resolved)").option("--swap-mode <mode>", "Swap mode: ExactIn or ExactOut", "ExactIn").option("--slippage <bps>", "Slippage tolerance in basis points").option("--raw", "Amount is already in raw (smallest unit) format").option("--dry-run", "Preview the swap without generating a transaction").action(async (options, cmdObj) => {
|
|
88013
|
+
const globalOptions = cmdObj.optsWithGlobals();
|
|
88014
|
+
const format = globalOptions.output;
|
|
88015
|
+
const startTime = Date.now();
|
|
88016
|
+
const mode = resolveExecutionMode(options);
|
|
88017
|
+
const walletAddress = globalOptions.walletAddress;
|
|
88018
|
+
if (!walletAddress) {
|
|
88019
|
+
const e = missingWalletAddressError();
|
|
88020
|
+
format === "json" ? outputErrorJson(e.toJSON()) : outputErrorTable(e.toJSON());
|
|
88021
|
+
process.exit(1);
|
|
88022
|
+
}
|
|
88023
|
+
try {
|
|
88024
|
+
new import_web3120.PublicKey(walletAddress);
|
|
88025
|
+
} catch {
|
|
88026
|
+
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
88027
|
+
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
88028
|
+
Error: ${msg}`));
|
|
88029
|
+
process.exit(1);
|
|
88030
|
+
}
|
|
88031
|
+
try {
|
|
88032
|
+
const swapMode = options.swapMode;
|
|
88033
|
+
const targetMint = swapMode === "ExactIn" ? options.inputMint : options.outputMint;
|
|
88034
|
+
const targetDecimals = await resolveDecimals(targetMint);
|
|
88035
|
+
const rawAmount = options.raw ? options.amount : uiToRaw(options.amount, targetDecimals);
|
|
88036
|
+
const slippageBps = options.slippage ? parseInt(options.slippage, 10) : getSlippageBps();
|
|
88037
|
+
const quoteResult = await getSwapQuote2({
|
|
88038
|
+
inputMint: options.inputMint,
|
|
88039
|
+
outputMint: options.outputMint,
|
|
88040
|
+
amount: rawAmount,
|
|
88041
|
+
swapMode,
|
|
88042
|
+
slippageBps,
|
|
88043
|
+
userPublicKey: walletAddress
|
|
88044
|
+
});
|
|
88045
|
+
if (!quoteResult.ok) {
|
|
88046
|
+
format === "json" ? outputErrorJson(quoteResult.error) : outputErrorTable(quoteResult.error);
|
|
88047
|
+
process.exit(1);
|
|
88048
|
+
}
|
|
88049
|
+
const quote = quoteResult.value;
|
|
88050
|
+
const inputDecimals = await resolveDecimals(options.inputMint);
|
|
88051
|
+
const outputDecimals = await resolveDecimals(options.outputMint);
|
|
88052
|
+
const uiInAmount = rawToUi(quote.inAmount, inputDecimals);
|
|
88053
|
+
const uiOutAmount = rawToUi(quote.outAmount, outputDecimals);
|
|
88054
|
+
if (mode === "dry-run") {
|
|
88055
|
+
printDryRunBanner();
|
|
88056
|
+
if (format === "json") {
|
|
88057
|
+
outputJson({
|
|
88058
|
+
mode: "dry-run",
|
|
88059
|
+
source: "titan",
|
|
88060
|
+
inputMint: quote.inputMint,
|
|
88061
|
+
outputMint: quote.outputMint,
|
|
88062
|
+
inAmount: quote.inAmount,
|
|
88063
|
+
outAmount: quote.outAmount,
|
|
88064
|
+
uiInAmount,
|
|
88065
|
+
uiOutAmount,
|
|
88066
|
+
swapMode,
|
|
88067
|
+
slippageBps
|
|
88068
|
+
}, startTime);
|
|
88069
|
+
} else {
|
|
88070
|
+
const table = new import_cli_table36.default({ chars: TABLE_CHARS });
|
|
88071
|
+
table.push(
|
|
88072
|
+
[source_default.gray("Source"), "Titan Exchange"],
|
|
88073
|
+
[source_default.gray("Input"), `${uiInAmount} (${options.inputMint})`],
|
|
88074
|
+
[source_default.gray("Output"), `${uiOutAmount} (${options.outputMint})`],
|
|
88075
|
+
[source_default.gray("Swap Mode"), swapMode],
|
|
88076
|
+
[source_default.gray("Slippage"), `${slippageBps} bps`]
|
|
88077
|
+
);
|
|
88078
|
+
console.log(source_default.cyan.bold("\n Titan Swap Preview\n"));
|
|
88079
|
+
console.log(table.toString());
|
|
88080
|
+
const hint = fallbackHint2(getLastRoute2());
|
|
88081
|
+
if (hint) console.error(source_default.gray(`[byreal] ${hint}`));
|
|
88082
|
+
console.log(source_default.yellow("\n Remove --dry-run to generate the unsigned transaction"));
|
|
88083
|
+
}
|
|
88084
|
+
return;
|
|
88085
|
+
}
|
|
88086
|
+
console.log(JSON.stringify({ unsignedTransactions: [quote.transaction] }));
|
|
88087
|
+
} catch (e) {
|
|
88088
|
+
const message = e.message || "Titan swap failed";
|
|
88089
|
+
format === "json" ? outputErrorJson({ code: "API_ERROR", type: "NETWORK", message, retryable: true }) : console.error(source_default.red(`
|
|
88090
|
+
Error: ${message}`));
|
|
88091
|
+
process.exit(1);
|
|
88092
|
+
}
|
|
88093
|
+
});
|
|
88094
|
+
}
|
|
88095
|
+
|
|
88096
|
+
// src/plugins/titan/index.ts
|
|
88097
|
+
var capabilities5 = [
|
|
88098
|
+
{
|
|
88099
|
+
id: "defi.titan.swap",
|
|
88100
|
+
name: "Titan Swap",
|
|
88101
|
+
description: "Swap tokens via Titan Exchange aggregator with WebSocket-based quote streaming",
|
|
88102
|
+
category: "execute",
|
|
88103
|
+
auth_required: true,
|
|
88104
|
+
command: "byreal-cli titan swap --wallet-address <address>",
|
|
88105
|
+
params: [
|
|
88106
|
+
{ name: "input-mint", type: "string", required: true, description: "Input token mint address" },
|
|
88107
|
+
{ name: "output-mint", type: "string", required: true, description: "Output token mint address" },
|
|
88108
|
+
{ name: "amount", type: "string", required: true, description: "Amount to swap (UI format)" },
|
|
88109
|
+
{ name: "swap-mode", type: "string", required: false, description: "Swap mode", default: "ExactIn", enum: ["ExactIn", "ExactOut"] },
|
|
88110
|
+
{ name: "slippage", type: "integer", required: false, description: "Slippage tolerance in basis points" },
|
|
88111
|
+
{ name: "raw", type: "boolean", required: false, description: "Amount is already in raw format" },
|
|
88112
|
+
{ name: "dry-run", type: "boolean", required: false, description: "Preview without generating transaction" }
|
|
88113
|
+
]
|
|
88114
|
+
}
|
|
88115
|
+
];
|
|
88116
|
+
var titanPlugin = {
|
|
88117
|
+
id: "titan",
|
|
88118
|
+
name: "Titan Exchange",
|
|
88119
|
+
createCommand() {
|
|
88120
|
+
const cmd = new Command("titan").description("Titan Exchange \u2014 swap");
|
|
88121
|
+
cmd.addCommand(createTitanSwapCommand());
|
|
88122
|
+
return cmd;
|
|
88123
|
+
},
|
|
88124
|
+
capabilities: capabilities5
|
|
88125
|
+
};
|
|
88126
|
+
|
|
88127
|
+
// src/plugins/dflow/commands.ts
|
|
88128
|
+
var import_cli_table37 = __toESM(require_cli_table3(), 1);
|
|
88129
|
+
var import_web3121 = __toESM(require_index_cjs(), 1);
|
|
88130
|
+
init_solana();
|
|
88131
|
+
init_errors();
|
|
88132
|
+
init_constants();
|
|
88133
|
+
|
|
88134
|
+
// src/plugins/dflow/api.ts
|
|
88135
|
+
init_errors();
|
|
88136
|
+
init_constants();
|
|
88137
|
+
var lastRoute3 = null;
|
|
88138
|
+
function getLastRoute3() {
|
|
88139
|
+
return lastRoute3;
|
|
88140
|
+
}
|
|
88141
|
+
async function resolveOrderUrl() {
|
|
88142
|
+
if (await isProxyAvailable()) {
|
|
88143
|
+
lastRoute3 = "proxy";
|
|
88144
|
+
return {
|
|
88145
|
+
base: `${PROXY_URL.replace(/\/$/, "")}/dflow`,
|
|
88146
|
+
headers: {},
|
|
88147
|
+
route: "proxy"
|
|
88148
|
+
};
|
|
88149
|
+
}
|
|
88150
|
+
if (DFLOW_API_KEY) {
|
|
88151
|
+
lastRoute3 = "direct-paid";
|
|
88152
|
+
return {
|
|
88153
|
+
base: DFLOW_PAID_URL,
|
|
88154
|
+
headers: { "x-api-key": DFLOW_API_KEY },
|
|
88155
|
+
route: "direct-paid"
|
|
88156
|
+
};
|
|
88157
|
+
}
|
|
88158
|
+
lastRoute3 = "direct-free";
|
|
88159
|
+
return { base: DFLOW_FREE_URL, headers: {}, route: "direct-free" };
|
|
88160
|
+
}
|
|
88161
|
+
async function getSwapQuote3(params) {
|
|
88162
|
+
const slippageValue = params.slippageBps > 0 ? String(params.slippageBps) : "auto";
|
|
88163
|
+
const query = new URLSearchParams({
|
|
88164
|
+
userPublicKey: params.userPublicKey,
|
|
88165
|
+
inputMint: params.inputMint,
|
|
88166
|
+
outputMint: params.outputMint,
|
|
88167
|
+
amount: params.amount,
|
|
88168
|
+
slippageBps: slippageValue
|
|
88169
|
+
});
|
|
88170
|
+
const { base, headers } = await resolveOrderUrl();
|
|
88171
|
+
const url = `${base}/order?${query.toString()}`;
|
|
88172
|
+
if (process.env.DEBUG) {
|
|
88173
|
+
console.error(`[DEBUG] DFlow GET ${url}`);
|
|
88174
|
+
}
|
|
88175
|
+
const controller = new AbortController();
|
|
88176
|
+
const timer = setTimeout(() => controller.abort(), DEFAULTS.REQUEST_TIMEOUT_MS);
|
|
88177
|
+
let response;
|
|
88178
|
+
try {
|
|
88179
|
+
response = await fetch(url, {
|
|
88180
|
+
method: "GET",
|
|
88181
|
+
headers: { "User-Agent": "byreal-cli", ...headers },
|
|
88182
|
+
signal: controller.signal
|
|
88183
|
+
});
|
|
88184
|
+
} catch (e) {
|
|
88185
|
+
clearTimeout(timer);
|
|
88186
|
+
const aborted = e.name === "AbortError";
|
|
88187
|
+
return {
|
|
88188
|
+
ok: false,
|
|
88189
|
+
error: new ByrealError({
|
|
88190
|
+
code: aborted ? ErrorCodes.TIMEOUT : ErrorCodes.NETWORK_ERROR,
|
|
88191
|
+
type: "NETWORK",
|
|
88192
|
+
message: aborted ? "DFlow request timed out." : `DFlow swap failed: ${e.message}`,
|
|
88193
|
+
retryable: true
|
|
88194
|
+
})
|
|
88195
|
+
};
|
|
88196
|
+
}
|
|
88197
|
+
clearTimeout(timer);
|
|
88198
|
+
if (!response.ok) {
|
|
88199
|
+
if (response.status === 429) {
|
|
88200
|
+
return {
|
|
88201
|
+
ok: false,
|
|
88202
|
+
error: new ByrealError({
|
|
88203
|
+
code: ErrorCodes.NETWORK_ERROR,
|
|
88204
|
+
type: "NETWORK",
|
|
88205
|
+
message: "DFlow rate limit exceeded.",
|
|
88206
|
+
retryable: true
|
|
88207
|
+
})
|
|
88208
|
+
};
|
|
88209
|
+
}
|
|
88210
|
+
return {
|
|
88211
|
+
ok: false,
|
|
88212
|
+
error: new ByrealError({
|
|
88213
|
+
code: ErrorCodes.API_ERROR,
|
|
88214
|
+
type: "NETWORK",
|
|
88215
|
+
message: `DFlow API error: ${response.status} ${response.statusText}`,
|
|
88216
|
+
details: { status_code: response.status },
|
|
88217
|
+
retryable: response.status >= 500
|
|
88218
|
+
})
|
|
88219
|
+
};
|
|
88220
|
+
}
|
|
88221
|
+
const data = await response.json();
|
|
88222
|
+
if (!data.transaction) {
|
|
88223
|
+
return {
|
|
88224
|
+
ok: false,
|
|
88225
|
+
error: new ByrealError({
|
|
88226
|
+
code: ErrorCodes.API_ERROR,
|
|
88227
|
+
type: "NETWORK",
|
|
88228
|
+
message: "No transaction returned from DFlow /order endpoint.",
|
|
88229
|
+
retryable: true
|
|
88230
|
+
})
|
|
88231
|
+
};
|
|
88232
|
+
}
|
|
88233
|
+
return {
|
|
88234
|
+
ok: true,
|
|
88235
|
+
value: {
|
|
88236
|
+
inAmount: data.inAmount || params.amount,
|
|
88237
|
+
outAmount: data.outAmount || "0",
|
|
88238
|
+
inputMint: data.inputMint || params.inputMint,
|
|
88239
|
+
outputMint: data.outputMint || params.outputMint,
|
|
88240
|
+
transaction: data.transaction,
|
|
88241
|
+
priceImpactPct: data.priceImpactPct
|
|
88242
|
+
}
|
|
88243
|
+
};
|
|
88244
|
+
}
|
|
88245
|
+
|
|
88246
|
+
// src/plugins/dflow/commands.ts
|
|
88247
|
+
function fallbackHint3(route) {
|
|
88248
|
+
if (route === "direct-paid") return "byreal proxy unreachable \u2014 using quote-api.dflow.net with DFLOW_API_KEY";
|
|
88249
|
+
if (route === "direct-free") return "byreal proxy unreachable \u2014 using dev-quote-api.dflow.net (no key, rate-limited)";
|
|
88250
|
+
return null;
|
|
88251
|
+
}
|
|
88252
|
+
function createDFlowSwapCommand() {
|
|
88253
|
+
return new Command("swap").description("Swap tokens via DFlow order-flow aggregator").requiredOption("--input-mint <address>", "Input token mint address").requiredOption("--output-mint <address>", "Output token mint address").requiredOption("--amount <amount>", "Amount to swap (UI amount, decimals auto-resolved)").option("--slippage <bps>", "Slippage tolerance in basis points").option("--raw", "Amount is already in raw (smallest unit) format").option("--dry-run", "Preview the swap without generating a transaction").action(async (options, cmdObj) => {
|
|
88254
|
+
const globalOptions = cmdObj.optsWithGlobals();
|
|
88255
|
+
const format = globalOptions.output;
|
|
88256
|
+
const startTime = Date.now();
|
|
88257
|
+
const mode = resolveExecutionMode(options);
|
|
88258
|
+
const walletAddress = globalOptions.walletAddress;
|
|
88259
|
+
if (!walletAddress) {
|
|
88260
|
+
const e = missingWalletAddressError();
|
|
88261
|
+
format === "json" ? outputErrorJson(e.toJSON()) : outputErrorTable(e.toJSON());
|
|
88262
|
+
process.exit(1);
|
|
88263
|
+
}
|
|
88264
|
+
try {
|
|
88265
|
+
new import_web3121.PublicKey(walletAddress);
|
|
88266
|
+
} catch {
|
|
88267
|
+
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
88268
|
+
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
88269
|
+
Error: ${msg}`));
|
|
88270
|
+
process.exit(1);
|
|
88271
|
+
}
|
|
88272
|
+
try {
|
|
88273
|
+
const inputDecimals = await resolveDecimals(options.inputMint);
|
|
88274
|
+
const rawAmount = options.raw ? options.amount : uiToRaw(options.amount, inputDecimals);
|
|
88275
|
+
const slippageBps = options.slippage ? parseInt(options.slippage, 10) : getSlippageBps();
|
|
88276
|
+
const quoteResult = await getSwapQuote3({
|
|
88277
|
+
inputMint: options.inputMint,
|
|
88278
|
+
outputMint: options.outputMint,
|
|
88279
|
+
amount: rawAmount,
|
|
88280
|
+
slippageBps,
|
|
88281
|
+
userPublicKey: walletAddress
|
|
88282
|
+
});
|
|
88283
|
+
if (!quoteResult.ok) {
|
|
88284
|
+
format === "json" ? outputErrorJson(quoteResult.error) : outputErrorTable(quoteResult.error);
|
|
88285
|
+
process.exit(1);
|
|
88286
|
+
}
|
|
88287
|
+
const quote = quoteResult.value;
|
|
88288
|
+
const outputDecimals = await resolveDecimals(options.outputMint);
|
|
88289
|
+
const uiInAmount = rawToUi(quote.inAmount, inputDecimals);
|
|
88290
|
+
const uiOutAmount = rawToUi(quote.outAmount, outputDecimals);
|
|
88291
|
+
if (mode === "dry-run") {
|
|
88292
|
+
printDryRunBanner();
|
|
88293
|
+
if (format === "json") {
|
|
88294
|
+
outputJson({
|
|
88295
|
+
mode: "dry-run",
|
|
88296
|
+
source: "dflow",
|
|
88297
|
+
inputMint: quote.inputMint,
|
|
88298
|
+
outputMint: quote.outputMint,
|
|
88299
|
+
inAmount: quote.inAmount,
|
|
88300
|
+
outAmount: quote.outAmount,
|
|
88301
|
+
uiInAmount,
|
|
88302
|
+
uiOutAmount,
|
|
88303
|
+
priceImpactPct: quote.priceImpactPct,
|
|
88304
|
+
slippageBps
|
|
88305
|
+
}, startTime);
|
|
88306
|
+
} else {
|
|
88307
|
+
const table = new import_cli_table37.default({ chars: TABLE_CHARS });
|
|
88308
|
+
table.push(
|
|
88309
|
+
[source_default.gray("Source"), "DFlow"],
|
|
88310
|
+
[source_default.gray("Input"), `${uiInAmount} (${options.inputMint})`],
|
|
88311
|
+
[source_default.gray("Output"), `${uiOutAmount} (${options.outputMint})`],
|
|
88312
|
+
[source_default.gray("Slippage"), `${slippageBps} bps`]
|
|
88313
|
+
);
|
|
88314
|
+
if (quote.priceImpactPct) {
|
|
88315
|
+
const impact = parseFloat(quote.priceImpactPct);
|
|
88316
|
+
const color = impact > 1 ? source_default.red : impact > 0.5 ? source_default.yellow : source_default.green;
|
|
88317
|
+
table.push([source_default.gray("Price Impact"), color(`${impact.toFixed(4)}%`)]);
|
|
88318
|
+
}
|
|
88319
|
+
console.log(source_default.cyan.bold("\n DFlow Swap Preview\n"));
|
|
88320
|
+
console.log(table.toString());
|
|
88321
|
+
const hint = fallbackHint3(getLastRoute3());
|
|
88322
|
+
if (hint) console.error(source_default.gray(`[byreal] ${hint}`));
|
|
88323
|
+
console.log(source_default.yellow("\n Remove --dry-run to generate the unsigned transaction"));
|
|
88324
|
+
}
|
|
88325
|
+
return;
|
|
88326
|
+
}
|
|
88327
|
+
console.log(JSON.stringify({ unsignedTransactions: [quote.transaction] }));
|
|
88328
|
+
} catch (e) {
|
|
88329
|
+
const message = e.message || "DFlow swap failed";
|
|
88330
|
+
format === "json" ? outputErrorJson({ code: "API_ERROR", type: "NETWORK", message, retryable: true }) : console.error(source_default.red(`
|
|
88331
|
+
Error: ${message}`));
|
|
88332
|
+
process.exit(1);
|
|
88333
|
+
}
|
|
88334
|
+
});
|
|
88335
|
+
}
|
|
88336
|
+
|
|
88337
|
+
// src/plugins/dflow/index.ts
|
|
88338
|
+
var capabilities6 = [
|
|
88339
|
+
{
|
|
88340
|
+
id: "defi.dflow.swap",
|
|
88341
|
+
name: "DFlow Swap",
|
|
88342
|
+
description: "Swap tokens via DFlow order-flow aggregator with MEV protection",
|
|
88343
|
+
category: "execute",
|
|
88344
|
+
auth_required: true,
|
|
88345
|
+
command: "byreal-cli dflow swap --wallet-address <address>",
|
|
88346
|
+
params: [
|
|
88347
|
+
{ name: "input-mint", type: "string", required: true, description: "Input token mint address" },
|
|
88348
|
+
{ name: "output-mint", type: "string", required: true, description: "Output token mint address" },
|
|
88349
|
+
{ name: "amount", type: "string", required: true, description: "Amount to swap (UI format)" },
|
|
88350
|
+
{ name: "slippage", type: "integer", required: false, description: "Slippage tolerance in basis points" },
|
|
88351
|
+
{ name: "raw", type: "boolean", required: false, description: "Amount is already in raw format" },
|
|
88352
|
+
{ name: "dry-run", type: "boolean", required: false, description: "Preview without generating transaction" }
|
|
88353
|
+
]
|
|
88354
|
+
}
|
|
88355
|
+
];
|
|
88356
|
+
var dflowPlugin = {
|
|
88357
|
+
id: "dflow",
|
|
88358
|
+
name: "DFlow",
|
|
88359
|
+
createCommand() {
|
|
88360
|
+
const cmd = new Command("dflow").description("DFlow \u2014 order-flow swap");
|
|
88361
|
+
cmd.addCommand(createDFlowSwapCommand());
|
|
88362
|
+
return cmd;
|
|
88363
|
+
},
|
|
88364
|
+
capabilities: capabilities6
|
|
88365
|
+
};
|
|
88366
|
+
|
|
85992
88367
|
// src/plugins/index.ts
|
|
85993
88368
|
var plugins = [
|
|
85994
88369
|
jupiterPlugin,
|
|
85995
88370
|
kaminoPlugin,
|
|
85996
88371
|
rentPlugin,
|
|
85997
|
-
consolidatePlugin
|
|
88372
|
+
consolidatePlugin,
|
|
88373
|
+
titanPlugin,
|
|
88374
|
+
dflowPlugin
|
|
85998
88375
|
];
|
|
85999
88376
|
|
|
86000
88377
|
// src/cli/commands/catalog.ts
|
|
@@ -86342,12 +88719,12 @@ function searchCapabilities(keyword) {
|
|
|
86342
88719
|
(cap) => cap.id.toLowerCase().includes(lowerKeyword) || cap.name.toLowerCase().includes(lowerKeyword) || cap.description.toLowerCase().includes(lowerKeyword)
|
|
86343
88720
|
);
|
|
86344
88721
|
}
|
|
86345
|
-
function outputCapabilitiesTable(
|
|
86346
|
-
const table = new
|
|
88722
|
+
function outputCapabilitiesTable(capabilities7) {
|
|
88723
|
+
const table = new import_cli_table38.default({
|
|
86347
88724
|
head: [source_default.cyan.bold("ID"), source_default.cyan.bold("Name"), source_default.cyan.bold("Category"), source_default.cyan.bold("Auth")],
|
|
86348
88725
|
chars: TABLE_CHARS
|
|
86349
88726
|
});
|
|
86350
|
-
for (const cap of
|
|
88727
|
+
for (const cap of capabilities7) {
|
|
86351
88728
|
table.push([
|
|
86352
88729
|
source_default.white(cap.id),
|
|
86353
88730
|
cap.name,
|
|
@@ -86370,7 +88747,7 @@ ${cap.name}`));
|
|
|
86370
88747
|
Command: ${source_default.green(cap.command)}`));
|
|
86371
88748
|
if (cap.params.length > 0) {
|
|
86372
88749
|
console.log(source_default.cyan("\nParameters:"));
|
|
86373
|
-
const table = new
|
|
88750
|
+
const table = new import_cli_table38.default({
|
|
86374
88751
|
head: [source_default.cyan("Name"), source_default.cyan("Type"), source_default.cyan("Required"), source_default.cyan("Default"), source_default.cyan("Description")],
|
|
86375
88752
|
chars: TABLE_CHARS
|
|
86376
88753
|
});
|
|
@@ -86473,7 +88850,7 @@ Available Capabilities (${all.length}):
|
|
|
86473
88850
|
}
|
|
86474
88851
|
|
|
86475
88852
|
// src/cli/commands/wallet.ts
|
|
86476
|
-
var
|
|
88853
|
+
var import_web3122 = __toESM(require_index_cjs(), 1);
|
|
86477
88854
|
init_constants();
|
|
86478
88855
|
init_errors();
|
|
86479
88856
|
|
|
@@ -86510,7 +88887,7 @@ function createWalletCommand() {
|
|
|
86510
88887
|
}
|
|
86511
88888
|
let publicKey3;
|
|
86512
88889
|
try {
|
|
86513
|
-
publicKey3 = new
|
|
88890
|
+
publicKey3 = new import_web3122.PublicKey(walletAddress);
|
|
86514
88891
|
} catch {
|
|
86515
88892
|
outputError({
|
|
86516
88893
|
code: "INVALID_PARAMETER",
|
|
@@ -86523,9 +88900,9 @@ function createWalletCommand() {
|
|
|
86523
88900
|
try {
|
|
86524
88901
|
const configResult = loadConfig();
|
|
86525
88902
|
const rpcUrl = configResult.ok ? configResult.value.rpc_url : SOLANA_RPC_URL;
|
|
86526
|
-
const connection = new
|
|
88903
|
+
const connection = new import_web3122.Connection(rpcUrl);
|
|
86527
88904
|
const lamports = await connection.getBalance(publicKey3);
|
|
86528
|
-
const solBalance = lamports /
|
|
88905
|
+
const solBalance = lamports / import_web3122.LAMPORTS_PER_SOL;
|
|
86529
88906
|
const rawAccounts = [];
|
|
86530
88907
|
const [splResult, t22Result] = await Promise.allSettled([
|
|
86531
88908
|
connection.getTokenAccountsByOwner(publicKey3, { programId: TOKEN_PROGRAM_ID }),
|
|
@@ -86538,7 +88915,7 @@ function createWalletCommand() {
|
|
|
86538
88915
|
if (result.status !== "fulfilled") continue;
|
|
86539
88916
|
for (const { account } of result.value.value) {
|
|
86540
88917
|
const data = account.data;
|
|
86541
|
-
const mint = new
|
|
88918
|
+
const mint = new import_web3122.PublicKey(data.subarray(0, 32)).toBase58();
|
|
86542
88919
|
const amount = data.subarray(64, 72).readBigUInt64LE();
|
|
86543
88920
|
if (amount === 0n) continue;
|
|
86544
88921
|
rawAccounts.push({ mint, amount, isToken2022: isToken20222 });
|
|
@@ -86549,7 +88926,7 @@ function createWalletCommand() {
|
|
|
86549
88926
|
if (uniqueMints.length > 0) {
|
|
86550
88927
|
for (let i = 0; i < uniqueMints.length; i += 100) {
|
|
86551
88928
|
const batch = uniqueMints.slice(i, i + 100);
|
|
86552
|
-
const mintPubkeys = batch.map((m) => new
|
|
88929
|
+
const mintPubkeys = batch.map((m) => new import_web3122.PublicKey(m));
|
|
86553
88930
|
const mintInfos = await connection.getMultipleAccountsInfo(mintPubkeys);
|
|
86554
88931
|
for (let j = 0; j < batch.length; j++) {
|
|
86555
88932
|
const info = mintInfos[j];
|
|
@@ -86699,7 +89076,7 @@ Configuration updated: ${key} = ${value}`);
|
|
|
86699
89076
|
}
|
|
86700
89077
|
|
|
86701
89078
|
// src/cli/commands/swap.ts
|
|
86702
|
-
var
|
|
89079
|
+
var import_web3123 = __toESM(require_index_cjs(), 1);
|
|
86703
89080
|
init_solana();
|
|
86704
89081
|
init_errors();
|
|
86705
89082
|
async function resolveRawAmount(amount, swapMode, inputMint, outputMint, isRaw) {
|
|
@@ -86733,7 +89110,7 @@ function createSwapExecuteCommand() {
|
|
|
86733
89110
|
process.exit(1);
|
|
86734
89111
|
}
|
|
86735
89112
|
try {
|
|
86736
|
-
new
|
|
89113
|
+
new import_web3123.PublicKey(userPublicKey);
|
|
86737
89114
|
} catch {
|
|
86738
89115
|
if (format === "json") {
|
|
86739
89116
|
outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: `Invalid wallet address: ${userPublicKey}`, retryable: false });
|
|
@@ -86824,11 +89201,11 @@ function createSwapCommand() {
|
|
|
86824
89201
|
|
|
86825
89202
|
// src/cli/commands/positions.ts
|
|
86826
89203
|
var import_bn19 = __toESM(require_bn(), 1);
|
|
86827
|
-
var
|
|
89204
|
+
var import_web3125 = __toESM(require_index_cjs(), 1);
|
|
86828
89205
|
init_solana();
|
|
86829
89206
|
|
|
86830
89207
|
// src/core/transaction.ts
|
|
86831
|
-
var
|
|
89208
|
+
var import_web3124 = __toESM(require_index_cjs(), 1);
|
|
86832
89209
|
init_types();
|
|
86833
89210
|
init_errors();
|
|
86834
89211
|
function serializeTransaction(tx) {
|
|
@@ -86911,7 +89288,7 @@ var KNOWN_SYMBOLS = {
|
|
|
86911
89288
|
async function fetchWalletBalanceSummary(owner) {
|
|
86912
89289
|
const connection = getConnection();
|
|
86913
89290
|
const lamports = await connection.getBalance(owner);
|
|
86914
|
-
const solUi = (lamports /
|
|
89291
|
+
const solUi = (lamports / import_web3125.LAMPORTS_PER_SOL).toString();
|
|
86915
89292
|
const rawAccounts = [];
|
|
86916
89293
|
const [splResult, t22Result] = await Promise.allSettled([
|
|
86917
89294
|
connection.getTokenAccountsByOwner(owner, { programId: TOKEN_PROGRAM_ID }),
|
|
@@ -86923,7 +89300,7 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
86923
89300
|
if (result.status !== "fulfilled") continue;
|
|
86924
89301
|
for (const { account } of result.value.value) {
|
|
86925
89302
|
const data = account.data;
|
|
86926
|
-
const mint = new
|
|
89303
|
+
const mint = new import_web3125.PublicKey(data.subarray(0, 32)).toBase58();
|
|
86927
89304
|
const amount = data.subarray(64, 72).readBigUInt64LE();
|
|
86928
89305
|
if (amount === 0n) continue;
|
|
86929
89306
|
rawAccounts.push({ mint, amount });
|
|
@@ -86934,7 +89311,7 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
86934
89311
|
if (uniqueMints.length > 0) {
|
|
86935
89312
|
for (let i = 0; i < uniqueMints.length; i += 100) {
|
|
86936
89313
|
const batch = uniqueMints.slice(i, i + 100);
|
|
86937
|
-
const mintPubkeys = batch.map((m) => new
|
|
89314
|
+
const mintPubkeys = batch.map((m) => new import_web3125.PublicKey(m));
|
|
86938
89315
|
const mintInfos = await connection.getMultipleAccountsInfo(mintPubkeys);
|
|
86939
89316
|
for (let j = 0; j < batch.length; j++) {
|
|
86940
89317
|
const info = mintInfos[j];
|
|
@@ -86955,11 +89332,11 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
86955
89332
|
}
|
|
86956
89333
|
return { sol: solUi, tokens };
|
|
86957
89334
|
}
|
|
86958
|
-
var ASSOCIATED_TOKEN_PROGRAM = new
|
|
89335
|
+
var ASSOCIATED_TOKEN_PROGRAM = new import_web3125.PublicKey(
|
|
86959
89336
|
"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
86960
89337
|
);
|
|
86961
89338
|
function getAtaAddress(owner, mint, tokenProgramId) {
|
|
86962
|
-
const [address] =
|
|
89339
|
+
const [address] = import_web3125.PublicKey.findProgramAddressSync(
|
|
86963
89340
|
[owner.toBuffer(), tokenProgramId.toBuffer(), mint.toBuffer()],
|
|
86964
89341
|
ASSOCIATED_TOKEN_PROGRAM
|
|
86965
89342
|
);
|
|
@@ -86971,7 +89348,7 @@ async function getTokenBalance(owner, mint) {
|
|
|
86971
89348
|
const lamports = await connection.getBalance(owner);
|
|
86972
89349
|
return new import_bn19.default(lamports.toString());
|
|
86973
89350
|
}
|
|
86974
|
-
const mintPk = new
|
|
89351
|
+
const mintPk = new import_web3125.PublicKey(mint);
|
|
86975
89352
|
const ataSpl = getAtaAddress(owner, mintPk, TOKEN_PROGRAM_ID);
|
|
86976
89353
|
const ataT22 = getAtaAddress(owner, mintPk, TOKEN_2022_PROGRAM_ID);
|
|
86977
89354
|
const [splInfo, t22Info] = await Promise.allSettled([
|
|
@@ -87043,7 +89420,7 @@ function createPositionsOpenCommand() {
|
|
|
87043
89420
|
}
|
|
87044
89421
|
process.exit(1);
|
|
87045
89422
|
}
|
|
87046
|
-
const publicKey3 = new
|
|
89423
|
+
const publicKey3 = new import_web3125.PublicKey(walletAddress);
|
|
87047
89424
|
const useAmountUsd = !!options.amountUsd;
|
|
87048
89425
|
const useTokenAmount = !!options.amount;
|
|
87049
89426
|
if (useAmountUsd && useTokenAmount) {
|
|
@@ -87338,7 +89715,7 @@ function createPositionsIncreaseCommand() {
|
|
|
87338
89715
|
}
|
|
87339
89716
|
process.exit(1);
|
|
87340
89717
|
}
|
|
87341
|
-
const publicKey3 = new
|
|
89718
|
+
const publicKey3 = new import_web3125.PublicKey(walletAddress);
|
|
87342
89719
|
const useAmountUsd = !!options.amountUsd;
|
|
87343
89720
|
const useTokenAmount = !!options.amount;
|
|
87344
89721
|
if (useAmountUsd && useTokenAmount) {
|
|
@@ -87391,7 +89768,7 @@ function createPositionsIncreaseCommand() {
|
|
|
87391
89768
|
getAmountAFromAmountB: getAmountAFromAmountB2
|
|
87392
89769
|
} = await Promise.resolve().then(() => (init_esm4(), esm_exports));
|
|
87393
89770
|
const chain = getChain2();
|
|
87394
|
-
const nftMint = new
|
|
89771
|
+
const nftMint = new import_web3125.PublicKey(options.nftMint);
|
|
87395
89772
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
87396
89773
|
if (!positionInfo) {
|
|
87397
89774
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -87675,11 +90052,11 @@ function createPositionsDecreaseCommand() {
|
|
|
87675
90052
|
}
|
|
87676
90053
|
process.exit(1);
|
|
87677
90054
|
}
|
|
87678
|
-
const publicKey3 = new
|
|
90055
|
+
const publicKey3 = new import_web3125.PublicKey(walletAddress);
|
|
87679
90056
|
try {
|
|
87680
90057
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
87681
90058
|
const chain = getChain2();
|
|
87682
|
-
const nftMint = new
|
|
90059
|
+
const nftMint = new import_web3125.PublicKey(options.nftMint);
|
|
87683
90060
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
87684
90061
|
if (!positionInfo) {
|
|
87685
90062
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -87862,11 +90239,11 @@ function createPositionsCloseCommand() {
|
|
|
87862
90239
|
}
|
|
87863
90240
|
process.exit(1);
|
|
87864
90241
|
}
|
|
87865
|
-
const publicKey3 = new
|
|
90242
|
+
const publicKey3 = new import_web3125.PublicKey(walletAddress);
|
|
87866
90243
|
try {
|
|
87867
90244
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
87868
90245
|
const chain = getChain2();
|
|
87869
|
-
const nftMint = new
|
|
90246
|
+
const nftMint = new import_web3125.PublicKey(options.nftMint);
|
|
87870
90247
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
87871
90248
|
if (!positionInfo) {
|
|
87872
90249
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -88398,7 +90775,7 @@ Error: ${errMsg}`));
|
|
|
88398
90775
|
const pool = poolResult.value;
|
|
88399
90776
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
88400
90777
|
const chain = getChain2();
|
|
88401
|
-
const nftMint = new
|
|
90778
|
+
const nftMint = new import_web3125.PublicKey(nftMintStr);
|
|
88402
90779
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
88403
90780
|
if (!positionInfo) {
|
|
88404
90781
|
const errMsg = `Position not found on-chain for NFT mint: ${nftMintStr}`;
|
|
@@ -88596,9 +90973,9 @@ function createCopyPositionCommand() {
|
|
|
88596
90973
|
}
|
|
88597
90974
|
process.exit(1);
|
|
88598
90975
|
}
|
|
88599
|
-
const publicKey3 = new
|
|
90976
|
+
const publicKey3 = new import_web3125.PublicKey(walletAddress);
|
|
88600
90977
|
try {
|
|
88601
|
-
const positionAddress = new
|
|
90978
|
+
const positionAddress = new import_web3125.PublicKey(options.position);
|
|
88602
90979
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
88603
90980
|
const { calculateTokenAmountsFromUsd: calculateTokenAmountsFromUsd2, getRawPositionInfoByAddress: getRawPositionInfoByAddress2 } = await Promise.resolve().then(() => (init_calculate(), calculate_exports));
|
|
88604
90981
|
const chain = getChain2();
|