@byreal-io/byreal-cli-realclaw 0.3.11 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2835 -468
- package/package.json +2 -2
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,
|
|
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.13" : 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,10 +3067,13 @@ 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
|
-
|
|
3071
|
-
|
|
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";
|
|
3072
3074
|
TITAN_AUTH_TOKEN = process.env.TITAN_AUTH_TOKEN;
|
|
3073
|
-
|
|
3075
|
+
DFLOW_PAID_URL = "https://quote-api.dflow.net";
|
|
3076
|
+
DFLOW_FREE_URL = "https://dev-quote-api.dflow.net";
|
|
3074
3077
|
DFLOW_API_KEY = process.env.DFLOW_API_KEY;
|
|
3075
3078
|
CONFIG_DIR = "~/.config/byreal";
|
|
3076
3079
|
CONFIG_FILE = "config.json";
|
|
@@ -15907,7 +15910,7 @@ var require_dist = __commonJS({
|
|
|
15907
15910
|
"use strict";
|
|
15908
15911
|
class StructError extends TypeError {
|
|
15909
15912
|
constructor(failure, failures) {
|
|
15910
|
-
let
|
|
15913
|
+
let cached2;
|
|
15911
15914
|
const { message, explanation, ...rest } = failure;
|
|
15912
15915
|
const { path: path3 } = failure;
|
|
15913
15916
|
const msg = path3.length === 0 ? message : `At path: ${path3.join(".")} -- ${message}`;
|
|
@@ -15917,7 +15920,7 @@ var require_dist = __commonJS({
|
|
|
15917
15920
|
Object.assign(this, rest);
|
|
15918
15921
|
this.name = this.constructor.name;
|
|
15919
15922
|
this.failures = () => {
|
|
15920
|
-
return
|
|
15923
|
+
return cached2 ?? (cached2 = [failure, ...failures()]);
|
|
15921
15924
|
};
|
|
15922
15925
|
}
|
|
15923
15926
|
}
|
|
@@ -22662,7 +22665,7 @@ var require_websocket = __commonJS({
|
|
|
22662
22665
|
var EventEmitter = require("events");
|
|
22663
22666
|
var https = require("https");
|
|
22664
22667
|
var http = require("http");
|
|
22665
|
-
var
|
|
22668
|
+
var net2 = require("net");
|
|
22666
22669
|
var tls = require("tls");
|
|
22667
22670
|
var { randomBytes, createHash } = require("crypto");
|
|
22668
22671
|
var { Duplex, Readable } = require("stream");
|
|
@@ -23396,12 +23399,12 @@ var require_websocket = __commonJS({
|
|
|
23396
23399
|
}
|
|
23397
23400
|
function netConnect(options) {
|
|
23398
23401
|
options.path = options.socketPath;
|
|
23399
|
-
return
|
|
23402
|
+
return net2.connect(options);
|
|
23400
23403
|
}
|
|
23401
23404
|
function tlsConnect(options) {
|
|
23402
23405
|
options.path = void 0;
|
|
23403
23406
|
if (!options.servername && options.servername !== "") {
|
|
23404
|
-
options.servername =
|
|
23407
|
+
options.servername = net2.isIP(options.host) ? "" : options.host;
|
|
23405
23408
|
}
|
|
23406
23409
|
return tls.connect(options);
|
|
23407
23410
|
}
|
|
@@ -26990,7 +26993,7 @@ var require_index_cjs = __commonJS({
|
|
|
26990
26993
|
return value._bn !== void 0;
|
|
26991
26994
|
}
|
|
26992
26995
|
var uniquePublicKeyCounter = 1;
|
|
26993
|
-
var
|
|
26996
|
+
var PublicKey52 = class _PublicKey2 extends Struct {
|
|
26994
26997
|
/**
|
|
26995
26998
|
* Create a new PublicKey object
|
|
26996
26999
|
* @param value ed25519 public key as buffer or base-58 encoded string
|
|
@@ -27152,9 +27155,9 @@ var require_index_cjs = __commonJS({
|
|
|
27152
27155
|
return isOnCurve(pubkey.toBytes());
|
|
27153
27156
|
}
|
|
27154
27157
|
};
|
|
27155
|
-
_PublicKey =
|
|
27156
|
-
|
|
27157
|
-
SOLANA_SCHEMA.set(
|
|
27158
|
+
_PublicKey = PublicKey52;
|
|
27159
|
+
PublicKey52.default = new _PublicKey("11111111111111111111111111111111");
|
|
27160
|
+
SOLANA_SCHEMA.set(PublicKey52, {
|
|
27158
27161
|
kind: "struct",
|
|
27159
27162
|
fields: [["_bn", "u256"]]
|
|
27160
27163
|
});
|
|
@@ -27186,7 +27189,7 @@ var require_index_cjs = __commonJS({
|
|
|
27186
27189
|
* The public key for this account
|
|
27187
27190
|
*/
|
|
27188
27191
|
get publicKey() {
|
|
27189
|
-
return new
|
|
27192
|
+
return new PublicKey52(this._publicKey);
|
|
27190
27193
|
}
|
|
27191
27194
|
/**
|
|
27192
27195
|
* The **unencrypted** secret key for this account. The first 32 bytes
|
|
@@ -27197,7 +27200,7 @@ var require_index_cjs = __commonJS({
|
|
|
27197
27200
|
return buffer.Buffer.concat([this._secretKey, this._publicKey], 64);
|
|
27198
27201
|
}
|
|
27199
27202
|
};
|
|
27200
|
-
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new
|
|
27203
|
+
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey52("BPFLoader1111111111111111111111111111111111");
|
|
27201
27204
|
var PACKET_DATA_SIZE = 1280 - 40 - 8;
|
|
27202
27205
|
var VERSION_PREFIX_MASK = 127;
|
|
27203
27206
|
var SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
@@ -27428,7 +27431,7 @@ var require_index_cjs = __commonJS({
|
|
|
27428
27431
|
const [payerAddress] = writableSigners[0];
|
|
27429
27432
|
assert(payerAddress === this.payer.toBase58(), "Expected first writable signer key to be the fee payer");
|
|
27430
27433
|
}
|
|
27431
|
-
const staticAccountKeys = [...writableSigners.map(([address]) => new
|
|
27434
|
+
const staticAccountKeys = [...writableSigners.map(([address]) => new PublicKey52(address)), ...readonlySigners.map(([address]) => new PublicKey52(address)), ...writableNonSigners.map(([address]) => new PublicKey52(address)), ...readonlyNonSigners.map(([address]) => new PublicKey52(address))];
|
|
27432
27435
|
return [header, staticAccountKeys];
|
|
27433
27436
|
}
|
|
27434
27437
|
extractTableLookup(lookupTable) {
|
|
@@ -27452,7 +27455,7 @@ var require_index_cjs = __commonJS({
|
|
|
27452
27455
|
const drainedKeys = new Array();
|
|
27453
27456
|
for (const [address, keyMeta] of this.keyMetaMap.entries()) {
|
|
27454
27457
|
if (keyMetaFilter(keyMeta)) {
|
|
27455
|
-
const key = new
|
|
27458
|
+
const key = new PublicKey52(address);
|
|
27456
27459
|
const lookupTableIndex = lookupTableEntries.findIndex((entry) => entry.equals(key));
|
|
27457
27460
|
if (lookupTableIndex >= 0) {
|
|
27458
27461
|
assert(lookupTableIndex < 256, "Max lookup table index exceeded");
|
|
@@ -27487,7 +27490,7 @@ var require_index_cjs = __commonJS({
|
|
|
27487
27490
|
this.instructions = void 0;
|
|
27488
27491
|
this.indexToProgramIds = /* @__PURE__ */ new Map();
|
|
27489
27492
|
this.header = args.header;
|
|
27490
|
-
this.accountKeys = args.accountKeys.map((account) => new
|
|
27493
|
+
this.accountKeys = args.accountKeys.map((account) => new PublicKey52(account));
|
|
27491
27494
|
this.recentBlockhash = args.recentBlockhash;
|
|
27492
27495
|
this.instructions = args.instructions;
|
|
27493
27496
|
this.instructions.forEach((ix) => this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex]));
|
|
@@ -27613,7 +27616,7 @@ var require_index_cjs = __commonJS({
|
|
|
27613
27616
|
let accountKeys = [];
|
|
27614
27617
|
for (let i = 0; i < accountCount; i++) {
|
|
27615
27618
|
const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2);
|
|
27616
|
-
accountKeys.push(new
|
|
27619
|
+
accountKeys.push(new PublicKey52(buffer.Buffer.from(account)));
|
|
27617
27620
|
}
|
|
27618
27621
|
const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2);
|
|
27619
27622
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -27837,7 +27840,7 @@ var require_index_cjs = __commonJS({
|
|
|
27837
27840
|
const staticAccountKeys = [];
|
|
27838
27841
|
const staticAccountKeysLength = decodeLength(byteArray);
|
|
27839
27842
|
for (let i = 0; i < staticAccountKeysLength; i++) {
|
|
27840
|
-
staticAccountKeys.push(new
|
|
27843
|
+
staticAccountKeys.push(new PublicKey52(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2)));
|
|
27841
27844
|
}
|
|
27842
27845
|
const recentBlockhash = bs58__default.default.encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
27843
27846
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -27857,7 +27860,7 @@ var require_index_cjs = __commonJS({
|
|
|
27857
27860
|
const addressTableLookupsCount = decodeLength(byteArray);
|
|
27858
27861
|
const addressTableLookups = [];
|
|
27859
27862
|
for (let i = 0; i < addressTableLookupsCount; i++) {
|
|
27860
|
-
const accountKey = new
|
|
27863
|
+
const accountKey = new PublicKey52(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
27861
27864
|
const writableIndexesLength = decodeLength(byteArray);
|
|
27862
27865
|
const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);
|
|
27863
27866
|
const readonlyIndexesLength = decodeLength(byteArray);
|
|
@@ -27906,7 +27909,7 @@ var require_index_cjs = __commonJS({
|
|
|
27906
27909
|
return TransactionStatus2;
|
|
27907
27910
|
}({});
|
|
27908
27911
|
var DEFAULT_SIGNATURE = buffer.Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);
|
|
27909
|
-
var
|
|
27912
|
+
var TransactionInstruction44 = class {
|
|
27910
27913
|
constructor(opts) {
|
|
27911
27914
|
this.keys = void 0;
|
|
27912
27915
|
this.programId = void 0;
|
|
@@ -28038,7 +28041,7 @@ var require_index_cjs = __commonJS({
|
|
|
28038
28041
|
} else if ("data" in item && "programId" in item && "keys" in item) {
|
|
28039
28042
|
this.instructions.push(item);
|
|
28040
28043
|
} else {
|
|
28041
|
-
this.instructions.push(new
|
|
28044
|
+
this.instructions.push(new TransactionInstruction44(item));
|
|
28042
28045
|
}
|
|
28043
28046
|
});
|
|
28044
28047
|
return this;
|
|
@@ -28097,7 +28100,7 @@ var require_index_cjs = __commonJS({
|
|
|
28097
28100
|
});
|
|
28098
28101
|
programIds.forEach((programId) => {
|
|
28099
28102
|
accountMetas.push({
|
|
28100
|
-
pubkey: new
|
|
28103
|
+
pubkey: new PublicKey52(programId),
|
|
28101
28104
|
isSigner: false,
|
|
28102
28105
|
isWritable: false
|
|
28103
28106
|
});
|
|
@@ -28531,7 +28534,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28531
28534
|
isWritable: message.isAccountWritable(account)
|
|
28532
28535
|
};
|
|
28533
28536
|
});
|
|
28534
|
-
transaction.instructions.push(new
|
|
28537
|
+
transaction.instructions.push(new TransactionInstruction44({
|
|
28535
28538
|
keys,
|
|
28536
28539
|
programId: message.accountKeys[instruction.programIdIndex],
|
|
28537
28540
|
data: bs58__default.default.decode(instruction.data)
|
|
@@ -28542,7 +28545,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28542
28545
|
return transaction;
|
|
28543
28546
|
}
|
|
28544
28547
|
};
|
|
28545
|
-
var
|
|
28548
|
+
var TransactionMessage5 = class _TransactionMessage {
|
|
28546
28549
|
constructor(args) {
|
|
28547
28550
|
this.payerKey = void 0;
|
|
28548
28551
|
this.instructions = void 0;
|
|
@@ -28599,7 +28602,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28599
28602
|
if (programId === void 0) {
|
|
28600
28603
|
throw new Error(`Failed to find program id for program id index ${compiledIx.programIdIndex}`);
|
|
28601
28604
|
}
|
|
28602
|
-
instructions.push(new
|
|
28605
|
+
instructions.push(new TransactionInstruction44({
|
|
28603
28606
|
programId,
|
|
28604
28607
|
data: toBuffer(compiledIx.data),
|
|
28605
28608
|
keys
|
|
@@ -28627,7 +28630,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28627
28630
|
});
|
|
28628
28631
|
}
|
|
28629
28632
|
};
|
|
28630
|
-
var
|
|
28633
|
+
var VersionedTransaction6 = class _VersionedTransaction {
|
|
28631
28634
|
get version() {
|
|
28632
28635
|
return this.message.version;
|
|
28633
28636
|
}
|
|
@@ -28690,15 +28693,15 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28690
28693
|
var DEFAULT_TICKS_PER_SLOT = 64;
|
|
28691
28694
|
var NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
28692
28695
|
var MS_PER_SLOT = 1e3 / NUM_SLOTS_PER_SECOND;
|
|
28693
|
-
var SYSVAR_CLOCK_PUBKEY2 = new
|
|
28694
|
-
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new
|
|
28695
|
-
var SYSVAR_INSTRUCTIONS_PUBKEY = new
|
|
28696
|
-
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new
|
|
28697
|
-
var SYSVAR_RENT_PUBKEY5 = new
|
|
28698
|
-
var SYSVAR_REWARDS_PUBKEY = new
|
|
28699
|
-
var SYSVAR_SLOT_HASHES_PUBKEY = new
|
|
28700
|
-
var SYSVAR_SLOT_HISTORY_PUBKEY = new
|
|
28701
|
-
var SYSVAR_STAKE_HISTORY_PUBKEY = new
|
|
28696
|
+
var SYSVAR_CLOCK_PUBKEY2 = new PublicKey52("SysvarC1ock11111111111111111111111111111111");
|
|
28697
|
+
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey52("SysvarEpochSchedu1e111111111111111111111111");
|
|
28698
|
+
var SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey52("Sysvar1nstructions1111111111111111111111111");
|
|
28699
|
+
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey52("SysvarRecentB1ockHashes11111111111111111111");
|
|
28700
|
+
var SYSVAR_RENT_PUBKEY5 = new PublicKey52("SysvarRent111111111111111111111111111111111");
|
|
28701
|
+
var SYSVAR_REWARDS_PUBKEY = new PublicKey52("SysvarRewards111111111111111111111111111111");
|
|
28702
|
+
var SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey52("SysvarS1otHashes111111111111111111111111111");
|
|
28703
|
+
var SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey52("SysvarS1otHistory11111111111111111111111111");
|
|
28704
|
+
var SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey52("SysvarStakeHistory1111111111111111111111111");
|
|
28702
28705
|
var SendTransactionError = class extends Error {
|
|
28703
28706
|
constructor({
|
|
28704
28707
|
action,
|
|
@@ -28889,8 +28892,8 @@ Message: ${transactionMessage}.
|
|
|
28889
28892
|
static fromAccountData(buffer2) {
|
|
28890
28893
|
const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer2), 0);
|
|
28891
28894
|
return new _NonceAccount({
|
|
28892
|
-
authorizedPubkey: new
|
|
28893
|
-
nonce: new
|
|
28895
|
+
authorizedPubkey: new PublicKey52(nonceAccount.authorizedPubkey),
|
|
28896
|
+
nonce: new PublicKey52(nonceAccount.nonce).toString(),
|
|
28894
28897
|
feeCalculator: nonceAccount.feeCalculator
|
|
28895
28898
|
});
|
|
28896
28899
|
}
|
|
@@ -28952,7 +28955,7 @@ Message: ${transactionMessage}.
|
|
|
28952
28955
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
28953
28956
|
lamports,
|
|
28954
28957
|
space,
|
|
28955
|
-
programId: new
|
|
28958
|
+
programId: new PublicKey52(programId)
|
|
28956
28959
|
};
|
|
28957
28960
|
}
|
|
28958
28961
|
/**
|
|
@@ -28987,7 +28990,7 @@ Message: ${transactionMessage}.
|
|
|
28987
28990
|
toPubkey: instruction.keys[2].pubkey,
|
|
28988
28991
|
lamports,
|
|
28989
28992
|
seed,
|
|
28990
|
-
programId: new
|
|
28993
|
+
programId: new PublicKey52(programId)
|
|
28991
28994
|
};
|
|
28992
28995
|
}
|
|
28993
28996
|
/**
|
|
@@ -29018,10 +29021,10 @@ Message: ${transactionMessage}.
|
|
|
29018
29021
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed, instruction.data);
|
|
29019
29022
|
return {
|
|
29020
29023
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29021
|
-
basePubkey: new
|
|
29024
|
+
basePubkey: new PublicKey52(base),
|
|
29022
29025
|
seed,
|
|
29023
29026
|
space,
|
|
29024
|
-
programId: new
|
|
29027
|
+
programId: new PublicKey52(programId)
|
|
29025
29028
|
};
|
|
29026
29029
|
}
|
|
29027
29030
|
/**
|
|
@@ -29035,7 +29038,7 @@ Message: ${transactionMessage}.
|
|
|
29035
29038
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign, instruction.data);
|
|
29036
29039
|
return {
|
|
29037
29040
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29038
|
-
programId: new
|
|
29041
|
+
programId: new PublicKey52(programId)
|
|
29039
29042
|
};
|
|
29040
29043
|
}
|
|
29041
29044
|
/**
|
|
@@ -29051,9 +29054,9 @@ Message: ${transactionMessage}.
|
|
|
29051
29054
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed, instruction.data);
|
|
29052
29055
|
return {
|
|
29053
29056
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29054
|
-
basePubkey: new
|
|
29057
|
+
basePubkey: new PublicKey52(base),
|
|
29055
29058
|
seed,
|
|
29056
|
-
programId: new
|
|
29059
|
+
programId: new PublicKey52(programId)
|
|
29057
29060
|
};
|
|
29058
29061
|
}
|
|
29059
29062
|
/**
|
|
@@ -29072,11 +29075,11 @@ Message: ${transactionMessage}.
|
|
|
29072
29075
|
return {
|
|
29073
29076
|
fromPubkey: instruction.keys[0].pubkey,
|
|
29074
29077
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
29075
|
-
basePubkey: new
|
|
29078
|
+
basePubkey: new PublicKey52(base),
|
|
29076
29079
|
seed,
|
|
29077
29080
|
lamports,
|
|
29078
29081
|
space,
|
|
29079
|
-
programId: new
|
|
29082
|
+
programId: new PublicKey52(programId)
|
|
29080
29083
|
};
|
|
29081
29084
|
}
|
|
29082
29085
|
/**
|
|
@@ -29090,7 +29093,7 @@ Message: ${transactionMessage}.
|
|
|
29090
29093
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount, instruction.data);
|
|
29091
29094
|
return {
|
|
29092
29095
|
noncePubkey: instruction.keys[0].pubkey,
|
|
29093
|
-
authorizedPubkey: new
|
|
29096
|
+
authorizedPubkey: new PublicKey52(authorized2)
|
|
29094
29097
|
};
|
|
29095
29098
|
}
|
|
29096
29099
|
/**
|
|
@@ -29133,7 +29136,7 @@ Message: ${transactionMessage}.
|
|
|
29133
29136
|
return {
|
|
29134
29137
|
noncePubkey: instruction.keys[0].pubkey,
|
|
29135
29138
|
authorizedPubkey: instruction.keys[1].pubkey,
|
|
29136
|
-
newAuthorizedPubkey: new
|
|
29139
|
+
newAuthorizedPubkey: new PublicKey52(authorized2)
|
|
29137
29140
|
};
|
|
29138
29141
|
}
|
|
29139
29142
|
/**
|
|
@@ -29226,7 +29229,7 @@ Message: ${transactionMessage}.
|
|
|
29226
29229
|
space: params.space,
|
|
29227
29230
|
programId: toBuffer(params.programId.toBuffer())
|
|
29228
29231
|
});
|
|
29229
|
-
return new
|
|
29232
|
+
return new TransactionInstruction44({
|
|
29230
29233
|
keys: [{
|
|
29231
29234
|
pubkey: params.fromPubkey,
|
|
29232
29235
|
isSigner: true,
|
|
@@ -29281,7 +29284,7 @@ Message: ${transactionMessage}.
|
|
|
29281
29284
|
isWritable: true
|
|
29282
29285
|
}];
|
|
29283
29286
|
}
|
|
29284
|
-
return new
|
|
29287
|
+
return new TransactionInstruction44({
|
|
29285
29288
|
keys,
|
|
29286
29289
|
programId: this.programId,
|
|
29287
29290
|
data
|
|
@@ -29320,7 +29323,7 @@ Message: ${transactionMessage}.
|
|
|
29320
29323
|
isWritable: true
|
|
29321
29324
|
}];
|
|
29322
29325
|
}
|
|
29323
|
-
return new
|
|
29326
|
+
return new TransactionInstruction44({
|
|
29324
29327
|
keys,
|
|
29325
29328
|
programId: this.programId,
|
|
29326
29329
|
data
|
|
@@ -29355,7 +29358,7 @@ Message: ${transactionMessage}.
|
|
|
29355
29358
|
isWritable: false
|
|
29356
29359
|
});
|
|
29357
29360
|
}
|
|
29358
|
-
return new
|
|
29361
|
+
return new TransactionInstruction44({
|
|
29359
29362
|
keys,
|
|
29360
29363
|
programId: this.programId,
|
|
29361
29364
|
data
|
|
@@ -29417,7 +29420,7 @@ Message: ${transactionMessage}.
|
|
|
29417
29420
|
programId: this.programId,
|
|
29418
29421
|
data
|
|
29419
29422
|
};
|
|
29420
|
-
return new
|
|
29423
|
+
return new TransactionInstruction44(instructionData);
|
|
29421
29424
|
}
|
|
29422
29425
|
/**
|
|
29423
29426
|
* Generate an instruction to advance the nonce in a Nonce account
|
|
@@ -29442,7 +29445,7 @@ Message: ${transactionMessage}.
|
|
|
29442
29445
|
programId: this.programId,
|
|
29443
29446
|
data
|
|
29444
29447
|
};
|
|
29445
|
-
return new
|
|
29448
|
+
return new TransactionInstruction44(instructionData);
|
|
29446
29449
|
}
|
|
29447
29450
|
/**
|
|
29448
29451
|
* Generate a transaction instruction that withdraws lamports from a Nonce account
|
|
@@ -29452,7 +29455,7 @@ Message: ${transactionMessage}.
|
|
|
29452
29455
|
const data = encodeData(type, {
|
|
29453
29456
|
lamports: params.lamports
|
|
29454
29457
|
});
|
|
29455
|
-
return new
|
|
29458
|
+
return new TransactionInstruction44({
|
|
29456
29459
|
keys: [{
|
|
29457
29460
|
pubkey: params.noncePubkey,
|
|
29458
29461
|
isSigner: false,
|
|
@@ -29487,7 +29490,7 @@ Message: ${transactionMessage}.
|
|
|
29487
29490
|
const data = encodeData(type, {
|
|
29488
29491
|
authorized: toBuffer(params.newAuthorizedPubkey.toBuffer())
|
|
29489
29492
|
});
|
|
29490
|
-
return new
|
|
29493
|
+
return new TransactionInstruction44({
|
|
29491
29494
|
keys: [{
|
|
29492
29495
|
pubkey: params.noncePubkey,
|
|
29493
29496
|
isSigner: false,
|
|
@@ -29535,14 +29538,14 @@ Message: ${transactionMessage}.
|
|
|
29535
29538
|
isWritable: true
|
|
29536
29539
|
}];
|
|
29537
29540
|
}
|
|
29538
|
-
return new
|
|
29541
|
+
return new TransactionInstruction44({
|
|
29539
29542
|
keys,
|
|
29540
29543
|
programId: this.programId,
|
|
29541
29544
|
data
|
|
29542
29545
|
});
|
|
29543
29546
|
}
|
|
29544
29547
|
};
|
|
29545
|
-
SystemProgram13.programId = new
|
|
29548
|
+
SystemProgram13.programId = new PublicKey52("11111111111111111111111111111111");
|
|
29546
29549
|
var CHUNK_SIZE = PACKET_DATA_SIZE - 300;
|
|
29547
29550
|
var Loader = class _Loader {
|
|
29548
29551
|
/**
|
|
@@ -29709,7 +29712,7 @@ Message: ${transactionMessage}.
|
|
|
29709
29712
|
}
|
|
29710
29713
|
};
|
|
29711
29714
|
Loader.chunkSize = CHUNK_SIZE;
|
|
29712
|
-
var BPF_LOADER_PROGRAM_ID = new
|
|
29715
|
+
var BPF_LOADER_PROGRAM_ID = new PublicKey52("BPFLoader2111111111111111111111111111111111");
|
|
29713
29716
|
var BpfLoader = class {
|
|
29714
29717
|
/**
|
|
29715
29718
|
* Minimum number of signatures required to load a program not including
|
|
@@ -30481,7 +30484,7 @@ Message: ${transactionMessage}.
|
|
|
30481
30484
|
return decoded;
|
|
30482
30485
|
}
|
|
30483
30486
|
var LOOKUP_TABLE_META_SIZE = 56;
|
|
30484
|
-
var
|
|
30487
|
+
var AddressLookupTableAccount2 = class {
|
|
30485
30488
|
constructor(args) {
|
|
30486
30489
|
this.key = void 0;
|
|
30487
30490
|
this.state = void 0;
|
|
@@ -30505,8 +30508,8 @@ Message: ${transactionMessage}.
|
|
|
30505
30508
|
deactivationSlot: meta.deactivationSlot,
|
|
30506
30509
|
lastExtendedSlot: meta.lastExtendedSlot,
|
|
30507
30510
|
lastExtendedSlotStartIndex: meta.lastExtendedStartIndex,
|
|
30508
|
-
authority: meta.authority.length !== 0 ? new
|
|
30509
|
-
addresses: addresses.map((address) => new
|
|
30511
|
+
authority: meta.authority.length !== 0 ? new PublicKey52(meta.authority[0]) : void 0,
|
|
30512
|
+
addresses: addresses.map((address) => new PublicKey52(address))
|
|
30510
30513
|
};
|
|
30511
30514
|
}
|
|
30512
30515
|
};
|
|
@@ -30548,7 +30551,7 @@ Message: ${transactionMessage}.
|
|
|
30548
30551
|
);
|
|
30549
30552
|
return `${protocol}//${hostish}${websocketPort}${rest}`;
|
|
30550
30553
|
}
|
|
30551
|
-
var PublicKeyFromString = superstruct.coerce(superstruct.instance(
|
|
30554
|
+
var PublicKeyFromString = superstruct.coerce(superstruct.instance(PublicKey52), superstruct.string(), (value) => new PublicKey52(value));
|
|
30552
30555
|
var RawAccountDataResult = superstruct.tuple([superstruct.string(), superstruct.literal("base64")]);
|
|
30553
30556
|
var BufferFromRawAccountData = superstruct.coerce(superstruct.instance(buffer.Buffer), RawAccountDataResult, (value) => buffer.Buffer.from(value[0], "base64"));
|
|
30554
30557
|
var BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1e3;
|
|
@@ -30633,7 +30636,7 @@ Message: ${transactionMessage}.
|
|
|
30633
30636
|
if (version2 === 0) {
|
|
30634
30637
|
return new MessageV0({
|
|
30635
30638
|
header: response.header,
|
|
30636
|
-
staticAccountKeys: response.accountKeys.map((accountKey) => new
|
|
30639
|
+
staticAccountKeys: response.accountKeys.map((accountKey) => new PublicKey52(accountKey)),
|
|
30637
30640
|
recentBlockhash: response.recentBlockhash,
|
|
30638
30641
|
compiledInstructions: response.instructions.map((ix) => ({
|
|
30639
30642
|
programIdIndex: ix.programIdIndex,
|
|
@@ -31297,7 +31300,7 @@ Message: ${transactionMessage}.
|
|
|
31297
31300
|
var COMMON_HTTP_HEADERS = {
|
|
31298
31301
|
"solana-client": `js/${"1.0.0-maintenance"}`
|
|
31299
31302
|
};
|
|
31300
|
-
var
|
|
31303
|
+
var Connection6 = class {
|
|
31301
31304
|
/**
|
|
31302
31305
|
* Establish a JSON RPC connection
|
|
31303
31306
|
*
|
|
@@ -33030,9 +33033,9 @@ Message: ${transactionMessage}.
|
|
|
33030
33033
|
} = await this.getAccountInfoAndContext(accountKey, config3);
|
|
33031
33034
|
let value = null;
|
|
33032
33035
|
if (accountInfo !== null) {
|
|
33033
|
-
value = new
|
|
33036
|
+
value = new AddressLookupTableAccount2({
|
|
33034
33037
|
key: accountKey,
|
|
33035
|
-
state:
|
|
33038
|
+
state: AddressLookupTableAccount2.deserialize(accountInfo.data)
|
|
33036
33039
|
});
|
|
33037
33040
|
}
|
|
33038
33041
|
return {
|
|
@@ -34073,7 +34076,7 @@ Message: ${transactionMessage}.
|
|
|
34073
34076
|
* @returns {PublicKey} PublicKey
|
|
34074
34077
|
*/
|
|
34075
34078
|
get publicKey() {
|
|
34076
|
-
return new
|
|
34079
|
+
return new PublicKey52(this._keypair.publicKey);
|
|
34077
34080
|
}
|
|
34078
34081
|
/**
|
|
34079
34082
|
* The raw secret key for this keypair
|
|
@@ -34151,7 +34154,7 @@ Message: ${transactionMessage}.
|
|
|
34151
34154
|
lookupTable: instruction.keys[0].pubkey,
|
|
34152
34155
|
authority: instruction.keys[1].pubkey,
|
|
34153
34156
|
payer: instruction.keys.length > 2 ? instruction.keys[2].pubkey : void 0,
|
|
34154
|
-
addresses: addresses.map((buffer2) => new
|
|
34157
|
+
addresses: addresses.map((buffer2) => new PublicKey52(buffer2))
|
|
34155
34158
|
};
|
|
34156
34159
|
}
|
|
34157
34160
|
static decodeCloseLookupTable(instruction) {
|
|
@@ -34203,7 +34206,7 @@ Message: ${transactionMessage}.
|
|
|
34203
34206
|
constructor() {
|
|
34204
34207
|
}
|
|
34205
34208
|
static createLookupTable(params) {
|
|
34206
|
-
const [lookupTableAddress, bumpSeed] =
|
|
34209
|
+
const [lookupTableAddress, bumpSeed] = PublicKey52.findProgramAddressSync([params.authority.toBuffer(), codecsNumbers.getU64Encoder().encode(params.recentSlot)], this.programId);
|
|
34207
34210
|
const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable;
|
|
34208
34211
|
const data = encodeData(type, {
|
|
34209
34212
|
recentSlot: BigInt(params.recentSlot),
|
|
@@ -34226,7 +34229,7 @@ Message: ${transactionMessage}.
|
|
|
34226
34229
|
isSigner: false,
|
|
34227
34230
|
isWritable: false
|
|
34228
34231
|
}];
|
|
34229
|
-
return [new
|
|
34232
|
+
return [new TransactionInstruction44({
|
|
34230
34233
|
programId: this.programId,
|
|
34231
34234
|
keys,
|
|
34232
34235
|
data
|
|
@@ -34244,7 +34247,7 @@ Message: ${transactionMessage}.
|
|
|
34244
34247
|
isSigner: true,
|
|
34245
34248
|
isWritable: false
|
|
34246
34249
|
}];
|
|
34247
|
-
return new
|
|
34250
|
+
return new TransactionInstruction44({
|
|
34248
34251
|
programId: this.programId,
|
|
34249
34252
|
keys,
|
|
34250
34253
|
data
|
|
@@ -34275,7 +34278,7 @@ Message: ${transactionMessage}.
|
|
|
34275
34278
|
isWritable: false
|
|
34276
34279
|
});
|
|
34277
34280
|
}
|
|
34278
|
-
return new
|
|
34281
|
+
return new TransactionInstruction44({
|
|
34279
34282
|
programId: this.programId,
|
|
34280
34283
|
keys,
|
|
34281
34284
|
data
|
|
@@ -34293,7 +34296,7 @@ Message: ${transactionMessage}.
|
|
|
34293
34296
|
isSigner: true,
|
|
34294
34297
|
isWritable: false
|
|
34295
34298
|
}];
|
|
34296
|
-
return new
|
|
34299
|
+
return new TransactionInstruction44({
|
|
34297
34300
|
programId: this.programId,
|
|
34298
34301
|
keys,
|
|
34299
34302
|
data
|
|
@@ -34315,14 +34318,14 @@ Message: ${transactionMessage}.
|
|
|
34315
34318
|
isSigner: false,
|
|
34316
34319
|
isWritable: true
|
|
34317
34320
|
}];
|
|
34318
|
-
return new
|
|
34321
|
+
return new TransactionInstruction44({
|
|
34319
34322
|
programId: this.programId,
|
|
34320
34323
|
keys,
|
|
34321
34324
|
data
|
|
34322
34325
|
});
|
|
34323
34326
|
}
|
|
34324
34327
|
};
|
|
34325
|
-
AddressLookupTableProgram.programId = new
|
|
34328
|
+
AddressLookupTableProgram.programId = new PublicKey52("AddressLookupTab1e1111111111111111111111111");
|
|
34326
34329
|
var ComputeBudgetInstruction = class {
|
|
34327
34330
|
/**
|
|
34328
34331
|
* @internal
|
|
@@ -34402,7 +34405,7 @@ Message: ${transactionMessage}.
|
|
|
34402
34405
|
* @internal
|
|
34403
34406
|
*/
|
|
34404
34407
|
static checkProgramId(programId) {
|
|
34405
|
-
if (!programId.equals(
|
|
34408
|
+
if (!programId.equals(ComputeBudgetProgram4.programId)) {
|
|
34406
34409
|
throw new Error("invalid instruction; programId is not ComputeBudgetProgram");
|
|
34407
34410
|
}
|
|
34408
34411
|
}
|
|
@@ -34425,7 +34428,7 @@ Message: ${transactionMessage}.
|
|
|
34425
34428
|
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u8("instruction"), u643("microLamports")])
|
|
34426
34429
|
}
|
|
34427
34430
|
});
|
|
34428
|
-
var
|
|
34431
|
+
var ComputeBudgetProgram4 = class {
|
|
34429
34432
|
/**
|
|
34430
34433
|
* @internal
|
|
34431
34434
|
*/
|
|
@@ -34440,7 +34443,7 @@ Message: ${transactionMessage}.
|
|
|
34440
34443
|
static requestUnits(params) {
|
|
34441
34444
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;
|
|
34442
34445
|
const data = encodeData(type, params);
|
|
34443
|
-
return new
|
|
34446
|
+
return new TransactionInstruction44({
|
|
34444
34447
|
keys: [],
|
|
34445
34448
|
programId: this.programId,
|
|
34446
34449
|
data
|
|
@@ -34449,7 +34452,7 @@ Message: ${transactionMessage}.
|
|
|
34449
34452
|
static requestHeapFrame(params) {
|
|
34450
34453
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame;
|
|
34451
34454
|
const data = encodeData(type, params);
|
|
34452
|
-
return new
|
|
34455
|
+
return new TransactionInstruction44({
|
|
34453
34456
|
keys: [],
|
|
34454
34457
|
programId: this.programId,
|
|
34455
34458
|
data
|
|
@@ -34458,7 +34461,7 @@ Message: ${transactionMessage}.
|
|
|
34458
34461
|
static setComputeUnitLimit(params) {
|
|
34459
34462
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit;
|
|
34460
34463
|
const data = encodeData(type, params);
|
|
34461
|
-
return new
|
|
34464
|
+
return new TransactionInstruction44({
|
|
34462
34465
|
keys: [],
|
|
34463
34466
|
programId: this.programId,
|
|
34464
34467
|
data
|
|
@@ -34469,14 +34472,14 @@ Message: ${transactionMessage}.
|
|
|
34469
34472
|
const data = encodeData(type, {
|
|
34470
34473
|
microLamports: BigInt(params.microLamports)
|
|
34471
34474
|
});
|
|
34472
|
-
return new
|
|
34475
|
+
return new TransactionInstruction44({
|
|
34473
34476
|
keys: [],
|
|
34474
34477
|
programId: this.programId,
|
|
34475
34478
|
data
|
|
34476
34479
|
});
|
|
34477
34480
|
}
|
|
34478
34481
|
};
|
|
34479
|
-
|
|
34482
|
+
ComputeBudgetProgram4.programId = new PublicKey52("ComputeBudget111111111111111111111111111111");
|
|
34480
34483
|
var PRIVATE_KEY_BYTES$1 = 64;
|
|
34481
34484
|
var PUBLIC_KEY_BYTES$1 = 32;
|
|
34482
34485
|
var SIGNATURE_BYTES = 64;
|
|
@@ -34524,7 +34527,7 @@ Message: ${transactionMessage}.
|
|
|
34524
34527
|
instructionData.fill(publicKey4, publicKeyOffset);
|
|
34525
34528
|
instructionData.fill(signature2, signatureOffset);
|
|
34526
34529
|
instructionData.fill(message, messageDataOffset);
|
|
34527
|
-
return new
|
|
34530
|
+
return new TransactionInstruction44({
|
|
34528
34531
|
keys: [],
|
|
34529
34532
|
programId: _Ed25519Program.programId,
|
|
34530
34533
|
data: instructionData
|
|
@@ -34556,7 +34559,7 @@ Message: ${transactionMessage}.
|
|
|
34556
34559
|
}
|
|
34557
34560
|
}
|
|
34558
34561
|
};
|
|
34559
|
-
Ed25519Program.programId = new
|
|
34562
|
+
Ed25519Program.programId = new PublicKey52("Ed25519SigVerify111111111111111111111111111");
|
|
34560
34563
|
var ecdsaSign = (msgHash, privKey) => {
|
|
34561
34564
|
const signature2 = secp256k1.secp256k1.sign(msgHash, privKey);
|
|
34562
34565
|
return [signature2.toCompactRawBytes(), signature2.recovery];
|
|
@@ -34652,7 +34655,7 @@ Message: ${transactionMessage}.
|
|
|
34652
34655
|
recoveryId
|
|
34653
34656
|
}, instructionData);
|
|
34654
34657
|
instructionData.fill(toBuffer(message), SECP256K1_INSTRUCTION_LAYOUT.span);
|
|
34655
|
-
return new
|
|
34658
|
+
return new TransactionInstruction44({
|
|
34656
34659
|
keys: [],
|
|
34657
34660
|
programId: _Secp256k1Program.programId,
|
|
34658
34661
|
data: instructionData
|
|
@@ -34690,9 +34693,9 @@ Message: ${transactionMessage}.
|
|
|
34690
34693
|
}
|
|
34691
34694
|
}
|
|
34692
34695
|
};
|
|
34693
|
-
Secp256k1Program.programId = new
|
|
34696
|
+
Secp256k1Program.programId = new PublicKey52("KeccakSecp256k11111111111111111111111111111");
|
|
34694
34697
|
var _Lockup;
|
|
34695
|
-
var STAKE_CONFIG_ID = new
|
|
34698
|
+
var STAKE_CONFIG_ID = new PublicKey52("StakeConfig11111111111111111111111111111111");
|
|
34696
34699
|
var Authorized = class {
|
|
34697
34700
|
/**
|
|
34698
34701
|
* Create a new Authorized object
|
|
@@ -34723,7 +34726,7 @@ Message: ${transactionMessage}.
|
|
|
34723
34726
|
*/
|
|
34724
34727
|
};
|
|
34725
34728
|
_Lockup = Lockup;
|
|
34726
|
-
Lockup.default = new _Lockup(0, 0,
|
|
34729
|
+
Lockup.default = new _Lockup(0, 0, PublicKey52.default);
|
|
34727
34730
|
var StakeInstruction = class {
|
|
34728
34731
|
/**
|
|
34729
34732
|
* @internal
|
|
@@ -34761,8 +34764,8 @@ Message: ${transactionMessage}.
|
|
|
34761
34764
|
} = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Initialize, instruction.data);
|
|
34762
34765
|
return {
|
|
34763
34766
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34764
|
-
authorized: new Authorized(new
|
|
34765
|
-
lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new
|
|
34767
|
+
authorized: new Authorized(new PublicKey52(authorized2.staker), new PublicKey52(authorized2.withdrawer)),
|
|
34768
|
+
lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new PublicKey52(lockup2.custodian))
|
|
34766
34769
|
};
|
|
34767
34770
|
}
|
|
34768
34771
|
/**
|
|
@@ -34791,7 +34794,7 @@ Message: ${transactionMessage}.
|
|
|
34791
34794
|
const o = {
|
|
34792
34795
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34793
34796
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
34794
|
-
newAuthorizedPubkey: new
|
|
34797
|
+
newAuthorizedPubkey: new PublicKey52(newAuthorized),
|
|
34795
34798
|
stakeAuthorizationType: {
|
|
34796
34799
|
index: stakeAuthorizationType
|
|
34797
34800
|
}
|
|
@@ -34817,8 +34820,8 @@ Message: ${transactionMessage}.
|
|
|
34817
34820
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34818
34821
|
authorityBase: instruction.keys[1].pubkey,
|
|
34819
34822
|
authoritySeed,
|
|
34820
|
-
authorityOwner: new
|
|
34821
|
-
newAuthorizedPubkey: new
|
|
34823
|
+
authorityOwner: new PublicKey52(authorityOwner),
|
|
34824
|
+
newAuthorizedPubkey: new PublicKey52(newAuthorized),
|
|
34822
34825
|
stakeAuthorizationType: {
|
|
34823
34826
|
index: stakeAuthorizationType
|
|
34824
34827
|
}
|
|
@@ -34992,7 +34995,7 @@ Message: ${transactionMessage}.
|
|
|
34992
34995
|
programId: this.programId,
|
|
34993
34996
|
data
|
|
34994
34997
|
};
|
|
34995
|
-
return new
|
|
34998
|
+
return new TransactionInstruction44(instructionData);
|
|
34996
34999
|
}
|
|
34997
35000
|
/**
|
|
34998
35001
|
* Generate a Transaction that creates a new Stake account at
|
|
@@ -35190,7 +35193,7 @@ Message: ${transactionMessage}.
|
|
|
35190
35193
|
const data = encodeData(type, {
|
|
35191
35194
|
lamports
|
|
35192
35195
|
});
|
|
35193
|
-
return new
|
|
35196
|
+
return new TransactionInstruction44({
|
|
35194
35197
|
keys: [{
|
|
35195
35198
|
pubkey: stakePubkey,
|
|
35196
35199
|
isSigner: false,
|
|
@@ -35372,7 +35375,7 @@ Message: ${transactionMessage}.
|
|
|
35372
35375
|
});
|
|
35373
35376
|
}
|
|
35374
35377
|
};
|
|
35375
|
-
StakeProgram.programId = new
|
|
35378
|
+
StakeProgram.programId = new PublicKey52("Stake11111111111111111111111111111111111111");
|
|
35376
35379
|
StakeProgram.space = 200;
|
|
35377
35380
|
var VoteInit = class {
|
|
35378
35381
|
/** [0, 100] */
|
|
@@ -35424,7 +35427,7 @@ Message: ${transactionMessage}.
|
|
|
35424
35427
|
return {
|
|
35425
35428
|
votePubkey: instruction.keys[0].pubkey,
|
|
35426
35429
|
nodePubkey: instruction.keys[3].pubkey,
|
|
35427
|
-
voteInit: new VoteInit(new
|
|
35430
|
+
voteInit: new VoteInit(new PublicKey52(voteInit2.nodePubkey), new PublicKey52(voteInit2.authorizedVoter), new PublicKey52(voteInit2.authorizedWithdrawer), voteInit2.commission)
|
|
35428
35431
|
};
|
|
35429
35432
|
}
|
|
35430
35433
|
/**
|
|
@@ -35440,7 +35443,7 @@ Message: ${transactionMessage}.
|
|
|
35440
35443
|
return {
|
|
35441
35444
|
votePubkey: instruction.keys[0].pubkey,
|
|
35442
35445
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
35443
|
-
newAuthorizedPubkey: new
|
|
35446
|
+
newAuthorizedPubkey: new PublicKey52(newAuthorized),
|
|
35444
35447
|
voteAuthorizationType: {
|
|
35445
35448
|
index: voteAuthorizationType
|
|
35446
35449
|
}
|
|
@@ -35462,9 +35465,9 @@ Message: ${transactionMessage}.
|
|
|
35462
35465
|
} = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data);
|
|
35463
35466
|
return {
|
|
35464
35467
|
currentAuthorityDerivedKeyBasePubkey: instruction.keys[2].pubkey,
|
|
35465
|
-
currentAuthorityDerivedKeyOwnerPubkey: new
|
|
35468
|
+
currentAuthorityDerivedKeyOwnerPubkey: new PublicKey52(currentAuthorityDerivedKeyOwnerPubkey),
|
|
35466
35469
|
currentAuthorityDerivedKeySeed,
|
|
35467
|
-
newAuthorizedPubkey: new
|
|
35470
|
+
newAuthorizedPubkey: new PublicKey52(newAuthorized),
|
|
35468
35471
|
voteAuthorizationType: {
|
|
35469
35472
|
index: voteAuthorizationType
|
|
35470
35473
|
},
|
|
@@ -35582,7 +35585,7 @@ Message: ${transactionMessage}.
|
|
|
35582
35585
|
programId: this.programId,
|
|
35583
35586
|
data
|
|
35584
35587
|
};
|
|
35585
|
-
return new
|
|
35588
|
+
return new TransactionInstruction44(instructionData);
|
|
35586
35589
|
}
|
|
35587
35590
|
/**
|
|
35588
35591
|
* Generate a transaction that creates a new Vote account.
|
|
@@ -35755,9 +35758,9 @@ Message: ${transactionMessage}.
|
|
|
35755
35758
|
});
|
|
35756
35759
|
}
|
|
35757
35760
|
};
|
|
35758
|
-
VoteProgram.programId = new
|
|
35761
|
+
VoteProgram.programId = new PublicKey52("Vote111111111111111111111111111111111111111");
|
|
35759
35762
|
VoteProgram.space = 3762;
|
|
35760
|
-
var VALIDATOR_INFO_KEY = new
|
|
35763
|
+
var VALIDATOR_INFO_KEY = new PublicKey52("Va1idator1nfo111111111111111111111111111111");
|
|
35761
35764
|
var InfoString = superstruct.type({
|
|
35762
35765
|
name: superstruct.string(),
|
|
35763
35766
|
website: superstruct.optional(superstruct.string()),
|
|
@@ -35791,7 +35794,7 @@ Message: ${transactionMessage}.
|
|
|
35791
35794
|
if (configKeyCount !== 2) return null;
|
|
35792
35795
|
const configKeys = [];
|
|
35793
35796
|
for (let i = 0; i < 2; i++) {
|
|
35794
|
-
const publicKey4 = new
|
|
35797
|
+
const publicKey4 = new PublicKey52(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
35795
35798
|
const isSigner = guardedShift(byteArray) === 1;
|
|
35796
35799
|
configKeys.push({
|
|
35797
35800
|
publicKey: publicKey4,
|
|
@@ -35809,7 +35812,7 @@ Message: ${transactionMessage}.
|
|
|
35809
35812
|
return null;
|
|
35810
35813
|
}
|
|
35811
35814
|
};
|
|
35812
|
-
var VOTE_PROGRAM_ID = new
|
|
35815
|
+
var VOTE_PROGRAM_ID = new PublicKey52("Vote111111111111111111111111111111111111111");
|
|
35813
35816
|
var VoteAccountLayout = BufferLayout__namespace.struct([
|
|
35814
35817
|
publicKey3("nodePubkey"),
|
|
35815
35818
|
publicKey3("authorizedWithdrawer"),
|
|
@@ -35866,8 +35869,8 @@ Message: ${transactionMessage}.
|
|
|
35866
35869
|
rootSlot = null;
|
|
35867
35870
|
}
|
|
35868
35871
|
return new _VoteAccount({
|
|
35869
|
-
nodePubkey: new
|
|
35870
|
-
authorizedWithdrawer: new
|
|
35872
|
+
nodePubkey: new PublicKey52(va.nodePubkey),
|
|
35873
|
+
authorizedWithdrawer: new PublicKey52(va.authorizedWithdrawer),
|
|
35871
35874
|
commission: va.commission,
|
|
35872
35875
|
votes: va.votes,
|
|
35873
35876
|
rootSlot,
|
|
@@ -35884,7 +35887,7 @@ Message: ${transactionMessage}.
|
|
|
35884
35887
|
}) {
|
|
35885
35888
|
return {
|
|
35886
35889
|
epoch,
|
|
35887
|
-
authorizedVoter: new
|
|
35890
|
+
authorizedVoter: new PublicKey52(authorizedVoter)
|
|
35888
35891
|
};
|
|
35889
35892
|
}
|
|
35890
35893
|
function parsePriorVoters({
|
|
@@ -35893,7 +35896,7 @@ Message: ${transactionMessage}.
|
|
|
35893
35896
|
targetEpoch
|
|
35894
35897
|
}) {
|
|
35895
35898
|
return {
|
|
35896
|
-
authorizedPubkey: new
|
|
35899
|
+
authorizedPubkey: new PublicKey52(authorizedPubkey),
|
|
35897
35900
|
epochOfLastAuthorizedSwitch,
|
|
35898
35901
|
targetEpoch
|
|
35899
35902
|
};
|
|
@@ -35966,7 +35969,7 @@ Message: ${transactionMessage}.
|
|
|
35966
35969
|
}
|
|
35967
35970
|
var LAMPORTS_PER_SOL4 = 1e9;
|
|
35968
35971
|
exports2.Account = Account;
|
|
35969
|
-
exports2.AddressLookupTableAccount =
|
|
35972
|
+
exports2.AddressLookupTableAccount = AddressLookupTableAccount2;
|
|
35970
35973
|
exports2.AddressLookupTableInstruction = AddressLookupTableInstruction;
|
|
35971
35974
|
exports2.AddressLookupTableProgram = AddressLookupTableProgram;
|
|
35972
35975
|
exports2.Authorized = Authorized;
|
|
@@ -35976,8 +35979,8 @@ Message: ${transactionMessage}.
|
|
|
35976
35979
|
exports2.BpfLoader = BpfLoader;
|
|
35977
35980
|
exports2.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS;
|
|
35978
35981
|
exports2.ComputeBudgetInstruction = ComputeBudgetInstruction;
|
|
35979
|
-
exports2.ComputeBudgetProgram =
|
|
35980
|
-
exports2.Connection =
|
|
35982
|
+
exports2.ComputeBudgetProgram = ComputeBudgetProgram4;
|
|
35983
|
+
exports2.Connection = Connection6;
|
|
35981
35984
|
exports2.Ed25519Program = Ed25519Program;
|
|
35982
35985
|
exports2.Enum = Enum;
|
|
35983
35986
|
exports2.EpochSchedule = EpochSchedule;
|
|
@@ -35995,7 +35998,7 @@ Message: ${transactionMessage}.
|
|
|
35995
35998
|
exports2.NonceAccount = NonceAccount;
|
|
35996
35999
|
exports2.PACKET_DATA_SIZE = PACKET_DATA_SIZE;
|
|
35997
36000
|
exports2.PUBLIC_KEY_LENGTH = PUBLIC_KEY_LENGTH2;
|
|
35998
|
-
exports2.PublicKey =
|
|
36001
|
+
exports2.PublicKey = PublicKey52;
|
|
35999
36002
|
exports2.SIGNATURE_LENGTH_IN_BYTES = SIGNATURE_LENGTH_IN_BYTES;
|
|
36000
36003
|
exports2.SOLANA_SCHEMA = SOLANA_SCHEMA;
|
|
36001
36004
|
exports2.STAKE_CONFIG_ID = STAKE_CONFIG_ID;
|
|
@@ -36024,15 +36027,15 @@ Message: ${transactionMessage}.
|
|
|
36024
36027
|
exports2.TransactionExpiredBlockheightExceededError = TransactionExpiredBlockheightExceededError;
|
|
36025
36028
|
exports2.TransactionExpiredNonceInvalidError = TransactionExpiredNonceInvalidError;
|
|
36026
36029
|
exports2.TransactionExpiredTimeoutError = TransactionExpiredTimeoutError;
|
|
36027
|
-
exports2.TransactionInstruction =
|
|
36028
|
-
exports2.TransactionMessage =
|
|
36030
|
+
exports2.TransactionInstruction = TransactionInstruction44;
|
|
36031
|
+
exports2.TransactionMessage = TransactionMessage5;
|
|
36029
36032
|
exports2.TransactionStatus = TransactionStatus;
|
|
36030
36033
|
exports2.VALIDATOR_INFO_KEY = VALIDATOR_INFO_KEY;
|
|
36031
36034
|
exports2.VERSION_PREFIX_MASK = VERSION_PREFIX_MASK;
|
|
36032
36035
|
exports2.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;
|
|
36033
36036
|
exports2.ValidatorInfo = ValidatorInfo;
|
|
36034
36037
|
exports2.VersionedMessage = VersionedMessage;
|
|
36035
|
-
exports2.VersionedTransaction =
|
|
36038
|
+
exports2.VersionedTransaction = VersionedTransaction6;
|
|
36036
36039
|
exports2.VoteAccount = VoteAccount;
|
|
36037
36040
|
exports2.VoteAuthorizationLayout = VoteAuthorizationLayout;
|
|
36038
36041
|
exports2.VoteInit = VoteInit;
|
|
@@ -39774,7 +39777,7 @@ var require_table = __commonJS({
|
|
|
39774
39777
|
var debug = require_debug();
|
|
39775
39778
|
var utils = require_utils4();
|
|
39776
39779
|
var tableLayout = require_layout_manager();
|
|
39777
|
-
var
|
|
39780
|
+
var Table9 = class extends Array {
|
|
39778
39781
|
constructor(opts) {
|
|
39779
39782
|
super();
|
|
39780
39783
|
const options = utils.mergeOptions(opts);
|
|
@@ -39849,7 +39852,7 @@ var require_table = __commonJS({
|
|
|
39849
39852
|
return str[0].length;
|
|
39850
39853
|
}
|
|
39851
39854
|
};
|
|
39852
|
-
|
|
39855
|
+
Table9.reset = () => debug.reset();
|
|
39853
39856
|
function doDraw(row, lineNum, result) {
|
|
39854
39857
|
let line = [];
|
|
39855
39858
|
row.forEach(function(cell) {
|
|
@@ -39858,7 +39861,7 @@ var require_table = __commonJS({
|
|
|
39858
39861
|
let str = line.join("");
|
|
39859
39862
|
if (str.length) result.push(str);
|
|
39860
39863
|
}
|
|
39861
|
-
module2.exports =
|
|
39864
|
+
module2.exports = Table9;
|
|
39862
39865
|
}
|
|
39863
39866
|
});
|
|
39864
39867
|
|
|
@@ -42373,33 +42376,33 @@ var init_constants4 = __esm({
|
|
|
42373
42376
|
});
|
|
42374
42377
|
|
|
42375
42378
|
// node_modules/@byreal-io/byreal-clmm-sdk/node_modules/@solana/spl-token/lib/esm/errors.js
|
|
42376
|
-
var
|
|
42379
|
+
var TokenError2, TokenAccountNotFoundError2, TokenInvalidAccountOwnerError2, TokenInvalidAccountSizeError2, TokenInvalidMintError2;
|
|
42377
42380
|
var init_errors2 = __esm({
|
|
42378
42381
|
"node_modules/@byreal-io/byreal-clmm-sdk/node_modules/@solana/spl-token/lib/esm/errors.js"() {
|
|
42379
|
-
|
|
42382
|
+
TokenError2 = class extends Error {
|
|
42380
42383
|
constructor(message) {
|
|
42381
42384
|
super(message);
|
|
42382
42385
|
}
|
|
42383
42386
|
};
|
|
42384
|
-
|
|
42387
|
+
TokenAccountNotFoundError2 = class extends TokenError2 {
|
|
42385
42388
|
constructor() {
|
|
42386
42389
|
super(...arguments);
|
|
42387
42390
|
this.name = "TokenAccountNotFoundError";
|
|
42388
42391
|
}
|
|
42389
42392
|
};
|
|
42390
|
-
|
|
42393
|
+
TokenInvalidAccountOwnerError2 = class extends TokenError2 {
|
|
42391
42394
|
constructor() {
|
|
42392
42395
|
super(...arguments);
|
|
42393
42396
|
this.name = "TokenInvalidAccountOwnerError";
|
|
42394
42397
|
}
|
|
42395
42398
|
};
|
|
42396
|
-
|
|
42399
|
+
TokenInvalidAccountSizeError2 = class extends TokenError2 {
|
|
42397
42400
|
constructor() {
|
|
42398
42401
|
super(...arguments);
|
|
42399
42402
|
this.name = "TokenInvalidAccountSizeError";
|
|
42400
42403
|
}
|
|
42401
42404
|
};
|
|
42402
|
-
|
|
42405
|
+
TokenInvalidMintError2 = class extends TokenError2 {
|
|
42403
42406
|
constructor() {
|
|
42404
42407
|
super(...arguments);
|
|
42405
42408
|
this.name = "TokenInvalidMintError";
|
|
@@ -43234,20 +43237,20 @@ var init_extensionType = __esm({
|
|
|
43234
43237
|
// node_modules/@byreal-io/byreal-clmm-sdk/node_modules/@solana/spl-token/lib/esm/state/mint.js
|
|
43235
43238
|
function unpackMint(address, info, programId = TOKEN_PROGRAM_ID2) {
|
|
43236
43239
|
if (!info)
|
|
43237
|
-
throw new
|
|
43240
|
+
throw new TokenAccountNotFoundError2();
|
|
43238
43241
|
if (!info.owner.equals(programId))
|
|
43239
|
-
throw new
|
|
43242
|
+
throw new TokenInvalidAccountOwnerError2();
|
|
43240
43243
|
if (info.data.length < MINT_SIZE2)
|
|
43241
|
-
throw new
|
|
43244
|
+
throw new TokenInvalidAccountSizeError2();
|
|
43242
43245
|
const rawMint = MintLayout2.decode(info.data.slice(0, MINT_SIZE2));
|
|
43243
43246
|
let tlvData = Buffer.alloc(0);
|
|
43244
43247
|
if (info.data.length > MINT_SIZE2) {
|
|
43245
43248
|
if (info.data.length <= ACCOUNT_SIZE2)
|
|
43246
|
-
throw new
|
|
43249
|
+
throw new TokenInvalidAccountSizeError2();
|
|
43247
43250
|
if (info.data.length === MULTISIG_SIZE)
|
|
43248
|
-
throw new
|
|
43251
|
+
throw new TokenInvalidAccountSizeError2();
|
|
43249
43252
|
if (info.data[ACCOUNT_SIZE2] != AccountType.Mint)
|
|
43250
|
-
throw new
|
|
43253
|
+
throw new TokenInvalidMintError2();
|
|
43251
43254
|
tlvData = info.data.slice(ACCOUNT_SIZE2 + ACCOUNT_TYPE_SIZE);
|
|
43252
43255
|
}
|
|
43253
43256
|
return {
|
|
@@ -48385,7 +48388,7 @@ var require_lib4 = __commonJS({
|
|
|
48385
48388
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
48386
48389
|
var StructError = class extends TypeError {
|
|
48387
48390
|
constructor(failure, failures) {
|
|
48388
|
-
let
|
|
48391
|
+
let cached2;
|
|
48389
48392
|
const {
|
|
48390
48393
|
message,
|
|
48391
48394
|
...rest
|
|
@@ -48406,7 +48409,7 @@ var require_lib4 = __commonJS({
|
|
|
48406
48409
|
this.name = this.constructor.name;
|
|
48407
48410
|
this.failures = () => {
|
|
48408
48411
|
var _cached;
|
|
48409
|
-
return (_cached =
|
|
48412
|
+
return (_cached = cached2) != null ? _cached : cached2 = [failure, ...failures()];
|
|
48410
48413
|
};
|
|
48411
48414
|
}
|
|
48412
48415
|
};
|
|
@@ -58812,10 +58815,10 @@ var require_parser = __commonJS({
|
|
|
58812
58815
|
}
|
|
58813
58816
|
function peg$parsestart() {
|
|
58814
58817
|
var s0, s1, s2;
|
|
58815
|
-
var key = peg$currPos * 49 + 0,
|
|
58816
|
-
if (
|
|
58817
|
-
peg$currPos =
|
|
58818
|
-
return
|
|
58818
|
+
var key = peg$currPos * 49 + 0, cached2 = peg$cache[key];
|
|
58819
|
+
if (cached2) {
|
|
58820
|
+
peg$currPos = cached2.nextPos;
|
|
58821
|
+
return cached2.result;
|
|
58819
58822
|
}
|
|
58820
58823
|
s0 = peg$currPos;
|
|
58821
58824
|
s1 = [];
|
|
@@ -58834,10 +58837,10 @@ var require_parser = __commonJS({
|
|
|
58834
58837
|
}
|
|
58835
58838
|
function peg$parseline() {
|
|
58836
58839
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
58837
|
-
var key = peg$currPos * 49 + 1,
|
|
58838
|
-
if (
|
|
58839
|
-
peg$currPos =
|
|
58840
|
-
return
|
|
58840
|
+
var key = peg$currPos * 49 + 1, cached2 = peg$cache[key];
|
|
58841
|
+
if (cached2) {
|
|
58842
|
+
peg$currPos = cached2.nextPos;
|
|
58843
|
+
return cached2.result;
|
|
58841
58844
|
}
|
|
58842
58845
|
s0 = peg$currPos;
|
|
58843
58846
|
s1 = [];
|
|
@@ -58945,10 +58948,10 @@ var require_parser = __commonJS({
|
|
|
58945
58948
|
}
|
|
58946
58949
|
function peg$parseexpression() {
|
|
58947
58950
|
var s0;
|
|
58948
|
-
var key = peg$currPos * 49 + 2,
|
|
58949
|
-
if (
|
|
58950
|
-
peg$currPos =
|
|
58951
|
-
return
|
|
58951
|
+
var key = peg$currPos * 49 + 2, cached2 = peg$cache[key];
|
|
58952
|
+
if (cached2) {
|
|
58953
|
+
peg$currPos = cached2.nextPos;
|
|
58954
|
+
return cached2.result;
|
|
58952
58955
|
}
|
|
58953
58956
|
s0 = peg$parsecomment();
|
|
58954
58957
|
if (s0 === peg$FAILED) {
|
|
@@ -58965,10 +58968,10 @@ var require_parser = __commonJS({
|
|
|
58965
58968
|
}
|
|
58966
58969
|
function peg$parsecomment() {
|
|
58967
58970
|
var s0, s1, s2, s3, s4, s5;
|
|
58968
|
-
var key = peg$currPos * 49 + 3,
|
|
58969
|
-
if (
|
|
58970
|
-
peg$currPos =
|
|
58971
|
-
return
|
|
58971
|
+
var key = peg$currPos * 49 + 3, cached2 = peg$cache[key];
|
|
58972
|
+
if (cached2) {
|
|
58973
|
+
peg$currPos = cached2.nextPos;
|
|
58974
|
+
return cached2.result;
|
|
58972
58975
|
}
|
|
58973
58976
|
s0 = peg$currPos;
|
|
58974
58977
|
if (input.charCodeAt(peg$currPos) === 35) {
|
|
@@ -59071,10 +59074,10 @@ var require_parser = __commonJS({
|
|
|
59071
59074
|
}
|
|
59072
59075
|
function peg$parsepath() {
|
|
59073
59076
|
var s0, s1, s2, s3, s4, s5;
|
|
59074
|
-
var key = peg$currPos * 49 + 4,
|
|
59075
|
-
if (
|
|
59076
|
-
peg$currPos =
|
|
59077
|
-
return
|
|
59077
|
+
var key = peg$currPos * 49 + 4, cached2 = peg$cache[key];
|
|
59078
|
+
if (cached2) {
|
|
59079
|
+
peg$currPos = cached2.nextPos;
|
|
59080
|
+
return cached2.result;
|
|
59078
59081
|
}
|
|
59079
59082
|
s0 = peg$currPos;
|
|
59080
59083
|
if (input.charCodeAt(peg$currPos) === 91) {
|
|
@@ -59141,10 +59144,10 @@ var require_parser = __commonJS({
|
|
|
59141
59144
|
}
|
|
59142
59145
|
function peg$parsetablearray() {
|
|
59143
59146
|
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
59144
|
-
var key = peg$currPos * 49 + 5,
|
|
59145
|
-
if (
|
|
59146
|
-
peg$currPos =
|
|
59147
|
-
return
|
|
59147
|
+
var key = peg$currPos * 49 + 5, cached2 = peg$cache[key];
|
|
59148
|
+
if (cached2) {
|
|
59149
|
+
peg$currPos = cached2.nextPos;
|
|
59150
|
+
return cached2.result;
|
|
59148
59151
|
}
|
|
59149
59152
|
s0 = peg$currPos;
|
|
59150
59153
|
if (input.charCodeAt(peg$currPos) === 91) {
|
|
@@ -59239,10 +59242,10 @@ var require_parser = __commonJS({
|
|
|
59239
59242
|
}
|
|
59240
59243
|
function peg$parsetable_key() {
|
|
59241
59244
|
var s0, s1, s2;
|
|
59242
|
-
var key = peg$currPos * 49 + 6,
|
|
59243
|
-
if (
|
|
59244
|
-
peg$currPos =
|
|
59245
|
-
return
|
|
59245
|
+
var key = peg$currPos * 49 + 6, cached2 = peg$cache[key];
|
|
59246
|
+
if (cached2) {
|
|
59247
|
+
peg$currPos = cached2.nextPos;
|
|
59248
|
+
return cached2.result;
|
|
59246
59249
|
}
|
|
59247
59250
|
s0 = peg$currPos;
|
|
59248
59251
|
s1 = [];
|
|
@@ -59283,10 +59286,10 @@ var require_parser = __commonJS({
|
|
|
59283
59286
|
}
|
|
59284
59287
|
function peg$parsetable_key_part() {
|
|
59285
59288
|
var s0, s1, s2, s3, s4;
|
|
59286
|
-
var key = peg$currPos * 49 + 7,
|
|
59287
|
-
if (
|
|
59288
|
-
peg$currPos =
|
|
59289
|
-
return
|
|
59289
|
+
var key = peg$currPos * 49 + 7, cached2 = peg$cache[key];
|
|
59290
|
+
if (cached2) {
|
|
59291
|
+
peg$currPos = cached2.nextPos;
|
|
59292
|
+
return cached2.result;
|
|
59290
59293
|
}
|
|
59291
59294
|
s0 = peg$currPos;
|
|
59292
59295
|
s1 = [];
|
|
@@ -59359,10 +59362,10 @@ var require_parser = __commonJS({
|
|
|
59359
59362
|
}
|
|
59360
59363
|
function peg$parsedot_ended_table_key_part() {
|
|
59361
59364
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
59362
|
-
var key = peg$currPos * 49 + 8,
|
|
59363
|
-
if (
|
|
59364
|
-
peg$currPos =
|
|
59365
|
-
return
|
|
59365
|
+
var key = peg$currPos * 49 + 8, cached2 = peg$cache[key];
|
|
59366
|
+
if (cached2) {
|
|
59367
|
+
peg$currPos = cached2.nextPos;
|
|
59368
|
+
return cached2.result;
|
|
59366
59369
|
}
|
|
59367
59370
|
s0 = peg$currPos;
|
|
59368
59371
|
s1 = [];
|
|
@@ -59485,10 +59488,10 @@ var require_parser = __commonJS({
|
|
|
59485
59488
|
}
|
|
59486
59489
|
function peg$parseassignment() {
|
|
59487
59490
|
var s0, s1, s2, s3, s4, s5;
|
|
59488
|
-
var key = peg$currPos * 49 + 9,
|
|
59489
|
-
if (
|
|
59490
|
-
peg$currPos =
|
|
59491
|
-
return
|
|
59491
|
+
var key = peg$currPos * 49 + 9, cached2 = peg$cache[key];
|
|
59492
|
+
if (cached2) {
|
|
59493
|
+
peg$currPos = cached2.nextPos;
|
|
59494
|
+
return cached2.result;
|
|
59492
59495
|
}
|
|
59493
59496
|
s0 = peg$currPos;
|
|
59494
59497
|
s1 = peg$parsekey();
|
|
@@ -59601,10 +59604,10 @@ var require_parser = __commonJS({
|
|
|
59601
59604
|
}
|
|
59602
59605
|
function peg$parsekey() {
|
|
59603
59606
|
var s0, s1, s2;
|
|
59604
|
-
var key = peg$currPos * 49 + 10,
|
|
59605
|
-
if (
|
|
59606
|
-
peg$currPos =
|
|
59607
|
-
return
|
|
59607
|
+
var key = peg$currPos * 49 + 10, cached2 = peg$cache[key];
|
|
59608
|
+
if (cached2) {
|
|
59609
|
+
peg$currPos = cached2.nextPos;
|
|
59610
|
+
return cached2.result;
|
|
59608
59611
|
}
|
|
59609
59612
|
s0 = peg$currPos;
|
|
59610
59613
|
s1 = [];
|
|
@@ -59627,10 +59630,10 @@ var require_parser = __commonJS({
|
|
|
59627
59630
|
}
|
|
59628
59631
|
function peg$parsequoted_key() {
|
|
59629
59632
|
var s0, s1;
|
|
59630
|
-
var key = peg$currPos * 49 + 11,
|
|
59631
|
-
if (
|
|
59632
|
-
peg$currPos =
|
|
59633
|
-
return
|
|
59633
|
+
var key = peg$currPos * 49 + 11, cached2 = peg$cache[key];
|
|
59634
|
+
if (cached2) {
|
|
59635
|
+
peg$currPos = cached2.nextPos;
|
|
59636
|
+
return cached2.result;
|
|
59634
59637
|
}
|
|
59635
59638
|
s0 = peg$currPos;
|
|
59636
59639
|
s1 = peg$parsedouble_quoted_single_line_string();
|
|
@@ -59653,10 +59656,10 @@ var require_parser = __commonJS({
|
|
|
59653
59656
|
}
|
|
59654
59657
|
function peg$parsevalue() {
|
|
59655
59658
|
var s0;
|
|
59656
|
-
var key = peg$currPos * 49 + 12,
|
|
59657
|
-
if (
|
|
59658
|
-
peg$currPos =
|
|
59659
|
-
return
|
|
59659
|
+
var key = peg$currPos * 49 + 12, cached2 = peg$cache[key];
|
|
59660
|
+
if (cached2) {
|
|
59661
|
+
peg$currPos = cached2.nextPos;
|
|
59662
|
+
return cached2.result;
|
|
59660
59663
|
}
|
|
59661
59664
|
s0 = peg$parsestring();
|
|
59662
59665
|
if (s0 === peg$FAILED) {
|
|
@@ -59682,10 +59685,10 @@ var require_parser = __commonJS({
|
|
|
59682
59685
|
}
|
|
59683
59686
|
function peg$parsestring() {
|
|
59684
59687
|
var s0;
|
|
59685
|
-
var key = peg$currPos * 49 + 13,
|
|
59686
|
-
if (
|
|
59687
|
-
peg$currPos =
|
|
59688
|
-
return
|
|
59688
|
+
var key = peg$currPos * 49 + 13, cached2 = peg$cache[key];
|
|
59689
|
+
if (cached2) {
|
|
59690
|
+
peg$currPos = cached2.nextPos;
|
|
59691
|
+
return cached2.result;
|
|
59689
59692
|
}
|
|
59690
59693
|
s0 = peg$parsedouble_quoted_multiline_string();
|
|
59691
59694
|
if (s0 === peg$FAILED) {
|
|
@@ -59702,10 +59705,10 @@ var require_parser = __commonJS({
|
|
|
59702
59705
|
}
|
|
59703
59706
|
function peg$parsedouble_quoted_multiline_string() {
|
|
59704
59707
|
var s0, s1, s2, s3, s4;
|
|
59705
|
-
var key = peg$currPos * 49 + 14,
|
|
59706
|
-
if (
|
|
59707
|
-
peg$currPos =
|
|
59708
|
-
return
|
|
59708
|
+
var key = peg$currPos * 49 + 14, cached2 = peg$cache[key];
|
|
59709
|
+
if (cached2) {
|
|
59710
|
+
peg$currPos = cached2.nextPos;
|
|
59711
|
+
return cached2.result;
|
|
59709
59712
|
}
|
|
59710
59713
|
s0 = peg$currPos;
|
|
59711
59714
|
if (input.substr(peg$currPos, 3) === peg$c23) {
|
|
@@ -59764,10 +59767,10 @@ var require_parser = __commonJS({
|
|
|
59764
59767
|
}
|
|
59765
59768
|
function peg$parsedouble_quoted_single_line_string() {
|
|
59766
59769
|
var s0, s1, s2, s3;
|
|
59767
|
-
var key = peg$currPos * 49 + 15,
|
|
59768
|
-
if (
|
|
59769
|
-
peg$currPos =
|
|
59770
|
-
return
|
|
59770
|
+
var key = peg$currPos * 49 + 15, cached2 = peg$cache[key];
|
|
59771
|
+
if (cached2) {
|
|
59772
|
+
peg$currPos = cached2.nextPos;
|
|
59773
|
+
return cached2.result;
|
|
59771
59774
|
}
|
|
59772
59775
|
s0 = peg$currPos;
|
|
59773
59776
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
@@ -59817,10 +59820,10 @@ var require_parser = __commonJS({
|
|
|
59817
59820
|
}
|
|
59818
59821
|
function peg$parsesingle_quoted_multiline_string() {
|
|
59819
59822
|
var s0, s1, s2, s3, s4;
|
|
59820
|
-
var key = peg$currPos * 49 + 16,
|
|
59821
|
-
if (
|
|
59822
|
-
peg$currPos =
|
|
59823
|
-
return
|
|
59823
|
+
var key = peg$currPos * 49 + 16, cached2 = peg$cache[key];
|
|
59824
|
+
if (cached2) {
|
|
59825
|
+
peg$currPos = cached2.nextPos;
|
|
59826
|
+
return cached2.result;
|
|
59824
59827
|
}
|
|
59825
59828
|
s0 = peg$currPos;
|
|
59826
59829
|
if (input.substr(peg$currPos, 3) === peg$c29) {
|
|
@@ -59879,10 +59882,10 @@ var require_parser = __commonJS({
|
|
|
59879
59882
|
}
|
|
59880
59883
|
function peg$parsesingle_quoted_single_line_string() {
|
|
59881
59884
|
var s0, s1, s2, s3;
|
|
59882
|
-
var key = peg$currPos * 49 + 17,
|
|
59883
|
-
if (
|
|
59884
|
-
peg$currPos =
|
|
59885
|
-
return
|
|
59885
|
+
var key = peg$currPos * 49 + 17, cached2 = peg$cache[key];
|
|
59886
|
+
if (cached2) {
|
|
59887
|
+
peg$currPos = cached2.nextPos;
|
|
59888
|
+
return cached2.result;
|
|
59886
59889
|
}
|
|
59887
59890
|
s0 = peg$currPos;
|
|
59888
59891
|
if (input.charCodeAt(peg$currPos) === 39) {
|
|
@@ -59932,10 +59935,10 @@ var require_parser = __commonJS({
|
|
|
59932
59935
|
}
|
|
59933
59936
|
function peg$parsestring_char() {
|
|
59934
59937
|
var s0, s1, s2;
|
|
59935
|
-
var key = peg$currPos * 49 + 18,
|
|
59936
|
-
if (
|
|
59937
|
-
peg$currPos =
|
|
59938
|
-
return
|
|
59938
|
+
var key = peg$currPos * 49 + 18, cached2 = peg$cache[key];
|
|
59939
|
+
if (cached2) {
|
|
59940
|
+
peg$currPos = cached2.nextPos;
|
|
59941
|
+
return cached2.result;
|
|
59939
59942
|
}
|
|
59940
59943
|
s0 = peg$parseESCAPED();
|
|
59941
59944
|
if (s0 === peg$FAILED) {
|
|
@@ -59986,10 +59989,10 @@ var require_parser = __commonJS({
|
|
|
59986
59989
|
}
|
|
59987
59990
|
function peg$parseliteral_char() {
|
|
59988
59991
|
var s0, s1, s2;
|
|
59989
|
-
var key = peg$currPos * 49 + 19,
|
|
59990
|
-
if (
|
|
59991
|
-
peg$currPos =
|
|
59992
|
-
return
|
|
59992
|
+
var key = peg$currPos * 49 + 19, cached2 = peg$cache[key];
|
|
59993
|
+
if (cached2) {
|
|
59994
|
+
peg$currPos = cached2.nextPos;
|
|
59995
|
+
return cached2.result;
|
|
59993
59996
|
}
|
|
59994
59997
|
s0 = peg$currPos;
|
|
59995
59998
|
s1 = peg$currPos;
|
|
@@ -60037,10 +60040,10 @@ var require_parser = __commonJS({
|
|
|
60037
60040
|
}
|
|
60038
60041
|
function peg$parsemultiline_string_char() {
|
|
60039
60042
|
var s0, s1, s2;
|
|
60040
|
-
var key = peg$currPos * 49 + 20,
|
|
60041
|
-
if (
|
|
60042
|
-
peg$currPos =
|
|
60043
|
-
return
|
|
60043
|
+
var key = peg$currPos * 49 + 20, cached2 = peg$cache[key];
|
|
60044
|
+
if (cached2) {
|
|
60045
|
+
peg$currPos = cached2.nextPos;
|
|
60046
|
+
return cached2.result;
|
|
60044
60047
|
}
|
|
60045
60048
|
s0 = peg$parseESCAPED();
|
|
60046
60049
|
if (s0 === peg$FAILED) {
|
|
@@ -60094,10 +60097,10 @@ var require_parser = __commonJS({
|
|
|
60094
60097
|
}
|
|
60095
60098
|
function peg$parsemultiline_string_delim() {
|
|
60096
60099
|
var s0, s1, s2, s3, s4;
|
|
60097
|
-
var key = peg$currPos * 49 + 21,
|
|
60098
|
-
if (
|
|
60099
|
-
peg$currPos =
|
|
60100
|
-
return
|
|
60100
|
+
var key = peg$currPos * 49 + 21, cached2 = peg$cache[key];
|
|
60101
|
+
if (cached2) {
|
|
60102
|
+
peg$currPos = cached2.nextPos;
|
|
60103
|
+
return cached2.result;
|
|
60101
60104
|
}
|
|
60102
60105
|
s0 = peg$currPos;
|
|
60103
60106
|
if (input.charCodeAt(peg$currPos) === 92) {
|
|
@@ -60139,10 +60142,10 @@ var require_parser = __commonJS({
|
|
|
60139
60142
|
}
|
|
60140
60143
|
function peg$parsemultiline_literal_char() {
|
|
60141
60144
|
var s0, s1, s2;
|
|
60142
|
-
var key = peg$currPos * 49 + 22,
|
|
60143
|
-
if (
|
|
60144
|
-
peg$currPos =
|
|
60145
|
-
return
|
|
60145
|
+
var key = peg$currPos * 49 + 22, cached2 = peg$cache[key];
|
|
60146
|
+
if (cached2) {
|
|
60147
|
+
peg$currPos = cached2.nextPos;
|
|
60148
|
+
return cached2.result;
|
|
60146
60149
|
}
|
|
60147
60150
|
s0 = peg$currPos;
|
|
60148
60151
|
s1 = peg$currPos;
|
|
@@ -60190,10 +60193,10 @@ var require_parser = __commonJS({
|
|
|
60190
60193
|
}
|
|
60191
60194
|
function peg$parsefloat() {
|
|
60192
60195
|
var s0, s1, s2, s3;
|
|
60193
|
-
var key = peg$currPos * 49 + 23,
|
|
60194
|
-
if (
|
|
60195
|
-
peg$currPos =
|
|
60196
|
-
return
|
|
60196
|
+
var key = peg$currPos * 49 + 23, cached2 = peg$cache[key];
|
|
60197
|
+
if (cached2) {
|
|
60198
|
+
peg$currPos = cached2.nextPos;
|
|
60199
|
+
return cached2.result;
|
|
60197
60200
|
}
|
|
60198
60201
|
s0 = peg$currPos;
|
|
60199
60202
|
s1 = peg$parsefloat_text();
|
|
@@ -60253,10 +60256,10 @@ var require_parser = __commonJS({
|
|
|
60253
60256
|
}
|
|
60254
60257
|
function peg$parsefloat_text() {
|
|
60255
60258
|
var s0, s1, s2, s3, s4, s5;
|
|
60256
|
-
var key = peg$currPos * 49 + 24,
|
|
60257
|
-
if (
|
|
60258
|
-
peg$currPos =
|
|
60259
|
-
return
|
|
60259
|
+
var key = peg$currPos * 49 + 24, cached2 = peg$cache[key];
|
|
60260
|
+
if (cached2) {
|
|
60261
|
+
peg$currPos = cached2.nextPos;
|
|
60262
|
+
return cached2.result;
|
|
60260
60263
|
}
|
|
60261
60264
|
s0 = peg$currPos;
|
|
60262
60265
|
if (input.charCodeAt(peg$currPos) === 43) {
|
|
@@ -60372,10 +60375,10 @@ var require_parser = __commonJS({
|
|
|
60372
60375
|
}
|
|
60373
60376
|
function peg$parseinteger() {
|
|
60374
60377
|
var s0, s1;
|
|
60375
|
-
var key = peg$currPos * 49 + 25,
|
|
60376
|
-
if (
|
|
60377
|
-
peg$currPos =
|
|
60378
|
-
return
|
|
60378
|
+
var key = peg$currPos * 49 + 25, cached2 = peg$cache[key];
|
|
60379
|
+
if (cached2) {
|
|
60380
|
+
peg$currPos = cached2.nextPos;
|
|
60381
|
+
return cached2.result;
|
|
60379
60382
|
}
|
|
60380
60383
|
s0 = peg$currPos;
|
|
60381
60384
|
s1 = peg$parseinteger_text();
|
|
@@ -60389,10 +60392,10 @@ var require_parser = __commonJS({
|
|
|
60389
60392
|
}
|
|
60390
60393
|
function peg$parseinteger_text() {
|
|
60391
60394
|
var s0, s1, s2, s3, s4;
|
|
60392
|
-
var key = peg$currPos * 49 + 26,
|
|
60393
|
-
if (
|
|
60394
|
-
peg$currPos =
|
|
60395
|
-
return
|
|
60395
|
+
var key = peg$currPos * 49 + 26, cached2 = peg$cache[key];
|
|
60396
|
+
if (cached2) {
|
|
60397
|
+
peg$currPos = cached2.nextPos;
|
|
60398
|
+
return cached2.result;
|
|
60396
60399
|
}
|
|
60397
60400
|
s0 = peg$currPos;
|
|
60398
60401
|
if (input.charCodeAt(peg$currPos) === 43) {
|
|
@@ -60516,10 +60519,10 @@ var require_parser = __commonJS({
|
|
|
60516
60519
|
}
|
|
60517
60520
|
function peg$parseboolean() {
|
|
60518
60521
|
var s0, s1;
|
|
60519
|
-
var key = peg$currPos * 49 + 27,
|
|
60520
|
-
if (
|
|
60521
|
-
peg$currPos =
|
|
60522
|
-
return
|
|
60522
|
+
var key = peg$currPos * 49 + 27, cached2 = peg$cache[key];
|
|
60523
|
+
if (cached2) {
|
|
60524
|
+
peg$currPos = cached2.nextPos;
|
|
60525
|
+
return cached2.result;
|
|
60523
60526
|
}
|
|
60524
60527
|
s0 = peg$currPos;
|
|
60525
60528
|
if (input.substr(peg$currPos, 4) === peg$c51) {
|
|
@@ -60558,10 +60561,10 @@ var require_parser = __commonJS({
|
|
|
60558
60561
|
}
|
|
60559
60562
|
function peg$parsearray() {
|
|
60560
60563
|
var s0, s1, s2, s3, s4;
|
|
60561
|
-
var key = peg$currPos * 49 + 28,
|
|
60562
|
-
if (
|
|
60563
|
-
peg$currPos =
|
|
60564
|
-
return
|
|
60564
|
+
var key = peg$currPos * 49 + 28, cached2 = peg$cache[key];
|
|
60565
|
+
if (cached2) {
|
|
60566
|
+
peg$currPos = cached2.nextPos;
|
|
60567
|
+
return cached2.result;
|
|
60565
60568
|
}
|
|
60566
60569
|
s0 = peg$currPos;
|
|
60567
60570
|
if (input.charCodeAt(peg$currPos) === 91) {
|
|
@@ -60758,10 +60761,10 @@ var require_parser = __commonJS({
|
|
|
60758
60761
|
}
|
|
60759
60762
|
function peg$parsearray_value() {
|
|
60760
60763
|
var s0, s1, s2, s3, s4;
|
|
60761
|
-
var key = peg$currPos * 49 + 29,
|
|
60762
|
-
if (
|
|
60763
|
-
peg$currPos =
|
|
60764
|
-
return
|
|
60764
|
+
var key = peg$currPos * 49 + 29, cached2 = peg$cache[key];
|
|
60765
|
+
if (cached2) {
|
|
60766
|
+
peg$currPos = cached2.nextPos;
|
|
60767
|
+
return cached2.result;
|
|
60765
60768
|
}
|
|
60766
60769
|
s0 = peg$currPos;
|
|
60767
60770
|
s1 = [];
|
|
@@ -60800,10 +60803,10 @@ var require_parser = __commonJS({
|
|
|
60800
60803
|
}
|
|
60801
60804
|
function peg$parsearray_value_list() {
|
|
60802
60805
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
60803
|
-
var key = peg$currPos * 49 + 30,
|
|
60804
|
-
if (
|
|
60805
|
-
peg$currPos =
|
|
60806
|
-
return
|
|
60806
|
+
var key = peg$currPos * 49 + 30, cached2 = peg$cache[key];
|
|
60807
|
+
if (cached2) {
|
|
60808
|
+
peg$currPos = cached2.nextPos;
|
|
60809
|
+
return cached2.result;
|
|
60807
60810
|
}
|
|
60808
60811
|
s0 = peg$currPos;
|
|
60809
60812
|
s1 = [];
|
|
@@ -60867,10 +60870,10 @@ var require_parser = __commonJS({
|
|
|
60867
60870
|
}
|
|
60868
60871
|
function peg$parsearray_sep() {
|
|
60869
60872
|
var s0;
|
|
60870
|
-
var key = peg$currPos * 49 + 31,
|
|
60871
|
-
if (
|
|
60872
|
-
peg$currPos =
|
|
60873
|
-
return
|
|
60873
|
+
var key = peg$currPos * 49 + 31, cached2 = peg$cache[key];
|
|
60874
|
+
if (cached2) {
|
|
60875
|
+
peg$currPos = cached2.nextPos;
|
|
60876
|
+
return cached2.result;
|
|
60874
60877
|
}
|
|
60875
60878
|
s0 = peg$parseS();
|
|
60876
60879
|
if (s0 === peg$FAILED) {
|
|
@@ -60884,10 +60887,10 @@ var require_parser = __commonJS({
|
|
|
60884
60887
|
}
|
|
60885
60888
|
function peg$parseinline_table() {
|
|
60886
60889
|
var s0, s1, s2, s3, s4, s5;
|
|
60887
|
-
var key = peg$currPos * 49 + 32,
|
|
60888
|
-
if (
|
|
60889
|
-
peg$currPos =
|
|
60890
|
-
return
|
|
60890
|
+
var key = peg$currPos * 49 + 32, cached2 = peg$cache[key];
|
|
60891
|
+
if (cached2) {
|
|
60892
|
+
peg$currPos = cached2.nextPos;
|
|
60893
|
+
return cached2.result;
|
|
60891
60894
|
}
|
|
60892
60895
|
s0 = peg$currPos;
|
|
60893
60896
|
if (input.charCodeAt(peg$currPos) === 123) {
|
|
@@ -60959,10 +60962,10 @@ var require_parser = __commonJS({
|
|
|
60959
60962
|
}
|
|
60960
60963
|
function peg$parseinline_table_assignment() {
|
|
60961
60964
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
60962
|
-
var key = peg$currPos * 49 + 33,
|
|
60963
|
-
if (
|
|
60964
|
-
peg$currPos =
|
|
60965
|
-
return
|
|
60965
|
+
var key = peg$currPos * 49 + 33, cached2 = peg$cache[key];
|
|
60966
|
+
if (cached2) {
|
|
60967
|
+
peg$currPos = cached2.nextPos;
|
|
60968
|
+
return cached2.result;
|
|
60966
60969
|
}
|
|
60967
60970
|
s0 = peg$currPos;
|
|
60968
60971
|
s1 = [];
|
|
@@ -61133,10 +61136,10 @@ var require_parser = __commonJS({
|
|
|
61133
61136
|
}
|
|
61134
61137
|
function peg$parsesecfragment() {
|
|
61135
61138
|
var s0, s1, s2;
|
|
61136
|
-
var key = peg$currPos * 49 + 34,
|
|
61137
|
-
if (
|
|
61138
|
-
peg$currPos =
|
|
61139
|
-
return
|
|
61139
|
+
var key = peg$currPos * 49 + 34, cached2 = peg$cache[key];
|
|
61140
|
+
if (cached2) {
|
|
61141
|
+
peg$currPos = cached2.nextPos;
|
|
61142
|
+
return cached2.result;
|
|
61140
61143
|
}
|
|
61141
61144
|
s0 = peg$currPos;
|
|
61142
61145
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
@@ -61167,10 +61170,10 @@ var require_parser = __commonJS({
|
|
|
61167
61170
|
}
|
|
61168
61171
|
function peg$parsedate() {
|
|
61169
61172
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
|
|
61170
|
-
var key = peg$currPos * 49 + 35,
|
|
61171
|
-
if (
|
|
61172
|
-
peg$currPos =
|
|
61173
|
-
return
|
|
61173
|
+
var key = peg$currPos * 49 + 35, cached2 = peg$cache[key];
|
|
61174
|
+
if (cached2) {
|
|
61175
|
+
peg$currPos = cached2.nextPos;
|
|
61176
|
+
return cached2.result;
|
|
61174
61177
|
}
|
|
61175
61178
|
s0 = peg$currPos;
|
|
61176
61179
|
s1 = peg$currPos;
|
|
@@ -61262,10 +61265,10 @@ var require_parser = __commonJS({
|
|
|
61262
61265
|
}
|
|
61263
61266
|
function peg$parsetime() {
|
|
61264
61267
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
61265
|
-
var key = peg$currPos * 49 + 36,
|
|
61266
|
-
if (
|
|
61267
|
-
peg$currPos =
|
|
61268
|
-
return
|
|
61268
|
+
var key = peg$currPos * 49 + 36, cached2 = peg$cache[key];
|
|
61269
|
+
if (cached2) {
|
|
61270
|
+
peg$currPos = cached2.nextPos;
|
|
61271
|
+
return cached2.result;
|
|
61269
61272
|
}
|
|
61270
61273
|
s0 = peg$currPos;
|
|
61271
61274
|
s1 = peg$currPos;
|
|
@@ -61354,10 +61357,10 @@ var require_parser = __commonJS({
|
|
|
61354
61357
|
}
|
|
61355
61358
|
function peg$parsetime_with_offset() {
|
|
61356
61359
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s163;
|
|
61357
|
-
var key = peg$currPos * 49 + 37,
|
|
61358
|
-
if (
|
|
61359
|
-
peg$currPos =
|
|
61360
|
-
return
|
|
61360
|
+
var key = peg$currPos * 49 + 37, cached2 = peg$cache[key];
|
|
61361
|
+
if (cached2) {
|
|
61362
|
+
peg$currPos = cached2.nextPos;
|
|
61363
|
+
return cached2.result;
|
|
61361
61364
|
}
|
|
61362
61365
|
s0 = peg$currPos;
|
|
61363
61366
|
s1 = peg$currPos;
|
|
@@ -61509,10 +61512,10 @@ var require_parser = __commonJS({
|
|
|
61509
61512
|
}
|
|
61510
61513
|
function peg$parsedatetime() {
|
|
61511
61514
|
var s0, s1, s2, s3, s4;
|
|
61512
|
-
var key = peg$currPos * 49 + 38,
|
|
61513
|
-
if (
|
|
61514
|
-
peg$currPos =
|
|
61515
|
-
return
|
|
61515
|
+
var key = peg$currPos * 49 + 38, cached2 = peg$cache[key];
|
|
61516
|
+
if (cached2) {
|
|
61517
|
+
peg$currPos = cached2.nextPos;
|
|
61518
|
+
return cached2.result;
|
|
61516
61519
|
}
|
|
61517
61520
|
s0 = peg$currPos;
|
|
61518
61521
|
s1 = peg$parsedate();
|
|
@@ -61595,10 +61598,10 @@ var require_parser = __commonJS({
|
|
|
61595
61598
|
}
|
|
61596
61599
|
function peg$parseS() {
|
|
61597
61600
|
var s0;
|
|
61598
|
-
var key = peg$currPos * 49 + 39,
|
|
61599
|
-
if (
|
|
61600
|
-
peg$currPos =
|
|
61601
|
-
return
|
|
61601
|
+
var key = peg$currPos * 49 + 39, cached2 = peg$cache[key];
|
|
61602
|
+
if (cached2) {
|
|
61603
|
+
peg$currPos = cached2.nextPos;
|
|
61604
|
+
return cached2.result;
|
|
61602
61605
|
}
|
|
61603
61606
|
if (peg$c81.test(input.charAt(peg$currPos))) {
|
|
61604
61607
|
s0 = input.charAt(peg$currPos);
|
|
@@ -61614,10 +61617,10 @@ var require_parser = __commonJS({
|
|
|
61614
61617
|
}
|
|
61615
61618
|
function peg$parseNL() {
|
|
61616
61619
|
var s0, s1, s2;
|
|
61617
|
-
var key = peg$currPos * 49 + 40,
|
|
61618
|
-
if (
|
|
61619
|
-
peg$currPos =
|
|
61620
|
-
return
|
|
61620
|
+
var key = peg$currPos * 49 + 40, cached2 = peg$cache[key];
|
|
61621
|
+
if (cached2) {
|
|
61622
|
+
peg$currPos = cached2.nextPos;
|
|
61623
|
+
return cached2.result;
|
|
61621
61624
|
}
|
|
61622
61625
|
if (input.charCodeAt(peg$currPos) === 10) {
|
|
61623
61626
|
s0 = peg$c83;
|
|
@@ -61666,10 +61669,10 @@ var require_parser = __commonJS({
|
|
|
61666
61669
|
}
|
|
61667
61670
|
function peg$parseNLS() {
|
|
61668
61671
|
var s0;
|
|
61669
|
-
var key = peg$currPos * 49 + 41,
|
|
61670
|
-
if (
|
|
61671
|
-
peg$currPos =
|
|
61672
|
-
return
|
|
61672
|
+
var key = peg$currPos * 49 + 41, cached2 = peg$cache[key];
|
|
61673
|
+
if (cached2) {
|
|
61674
|
+
peg$currPos = cached2.nextPos;
|
|
61675
|
+
return cached2.result;
|
|
61673
61676
|
}
|
|
61674
61677
|
s0 = peg$parseNL();
|
|
61675
61678
|
if (s0 === peg$FAILED) {
|
|
@@ -61680,10 +61683,10 @@ var require_parser = __commonJS({
|
|
|
61680
61683
|
}
|
|
61681
61684
|
function peg$parseEOF() {
|
|
61682
61685
|
var s0, s1;
|
|
61683
|
-
var key = peg$currPos * 49 + 42,
|
|
61684
|
-
if (
|
|
61685
|
-
peg$currPos =
|
|
61686
|
-
return
|
|
61686
|
+
var key = peg$currPos * 49 + 42, cached2 = peg$cache[key];
|
|
61687
|
+
if (cached2) {
|
|
61688
|
+
peg$currPos = cached2.nextPos;
|
|
61689
|
+
return cached2.result;
|
|
61687
61690
|
}
|
|
61688
61691
|
s0 = peg$currPos;
|
|
61689
61692
|
peg$silentFails++;
|
|
@@ -61708,10 +61711,10 @@ var require_parser = __commonJS({
|
|
|
61708
61711
|
}
|
|
61709
61712
|
function peg$parseHEX() {
|
|
61710
61713
|
var s0;
|
|
61711
|
-
var key = peg$currPos * 49 + 43,
|
|
61712
|
-
if (
|
|
61713
|
-
peg$currPos =
|
|
61714
|
-
return
|
|
61714
|
+
var key = peg$currPos * 49 + 43, cached2 = peg$cache[key];
|
|
61715
|
+
if (cached2) {
|
|
61716
|
+
peg$currPos = cached2.nextPos;
|
|
61717
|
+
return cached2.result;
|
|
61715
61718
|
}
|
|
61716
61719
|
if (peg$c87.test(input.charAt(peg$currPos))) {
|
|
61717
61720
|
s0 = input.charAt(peg$currPos);
|
|
@@ -61727,10 +61730,10 @@ var require_parser = __commonJS({
|
|
|
61727
61730
|
}
|
|
61728
61731
|
function peg$parseDIGIT_OR_UNDER() {
|
|
61729
61732
|
var s0, s1;
|
|
61730
|
-
var key = peg$currPos * 49 + 44,
|
|
61731
|
-
if (
|
|
61732
|
-
peg$currPos =
|
|
61733
|
-
return
|
|
61733
|
+
var key = peg$currPos * 49 + 44, cached2 = peg$cache[key];
|
|
61734
|
+
if (cached2) {
|
|
61735
|
+
peg$currPos = cached2.nextPos;
|
|
61736
|
+
return cached2.result;
|
|
61734
61737
|
}
|
|
61735
61738
|
if (peg$c89.test(input.charAt(peg$currPos))) {
|
|
61736
61739
|
s0 = input.charAt(peg$currPos);
|
|
@@ -61763,10 +61766,10 @@ var require_parser = __commonJS({
|
|
|
61763
61766
|
}
|
|
61764
61767
|
function peg$parseASCII_BASIC() {
|
|
61765
61768
|
var s0;
|
|
61766
|
-
var key = peg$currPos * 49 + 45,
|
|
61767
|
-
if (
|
|
61768
|
-
peg$currPos =
|
|
61769
|
-
return
|
|
61769
|
+
var key = peg$currPos * 49 + 45, cached2 = peg$cache[key];
|
|
61770
|
+
if (cached2) {
|
|
61771
|
+
peg$currPos = cached2.nextPos;
|
|
61772
|
+
return cached2.result;
|
|
61770
61773
|
}
|
|
61771
61774
|
if (peg$c94.test(input.charAt(peg$currPos))) {
|
|
61772
61775
|
s0 = input.charAt(peg$currPos);
|
|
@@ -61782,10 +61785,10 @@ var require_parser = __commonJS({
|
|
|
61782
61785
|
}
|
|
61783
61786
|
function peg$parseDIGITS() {
|
|
61784
61787
|
var s0, s1, s2;
|
|
61785
|
-
var key = peg$currPos * 49 + 46,
|
|
61786
|
-
if (
|
|
61787
|
-
peg$currPos =
|
|
61788
|
-
return
|
|
61788
|
+
var key = peg$currPos * 49 + 46, cached2 = peg$cache[key];
|
|
61789
|
+
if (cached2) {
|
|
61790
|
+
peg$currPos = cached2.nextPos;
|
|
61791
|
+
return cached2.result;
|
|
61789
61792
|
}
|
|
61790
61793
|
s0 = peg$currPos;
|
|
61791
61794
|
s1 = [];
|
|
@@ -61808,10 +61811,10 @@ var require_parser = __commonJS({
|
|
|
61808
61811
|
}
|
|
61809
61812
|
function peg$parseESCAPED() {
|
|
61810
61813
|
var s0, s1;
|
|
61811
|
-
var key = peg$currPos * 49 + 47,
|
|
61812
|
-
if (
|
|
61813
|
-
peg$currPos =
|
|
61814
|
-
return
|
|
61814
|
+
var key = peg$currPos * 49 + 47, cached2 = peg$cache[key];
|
|
61815
|
+
if (cached2) {
|
|
61816
|
+
peg$currPos = cached2.nextPos;
|
|
61817
|
+
return cached2.result;
|
|
61815
61818
|
}
|
|
61816
61819
|
s0 = peg$currPos;
|
|
61817
61820
|
if (input.substr(peg$currPos, 2) === peg$c97) {
|
|
@@ -61938,10 +61941,10 @@ var require_parser = __commonJS({
|
|
|
61938
61941
|
}
|
|
61939
61942
|
function peg$parseESCAPED_UNICODE() {
|
|
61940
61943
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
61941
|
-
var key = peg$currPos * 49 + 48,
|
|
61942
|
-
if (
|
|
61943
|
-
peg$currPos =
|
|
61944
|
-
return
|
|
61944
|
+
var key = peg$currPos * 49 + 48, cached2 = peg$cache[key];
|
|
61945
|
+
if (cached2) {
|
|
61946
|
+
peg$currPos = cached2.nextPos;
|
|
61947
|
+
return cached2.result;
|
|
61945
61948
|
}
|
|
61946
61949
|
s0 = peg$currPos;
|
|
61947
61950
|
if (input.substr(peg$currPos, 2) === peg$c118) {
|
|
@@ -80831,6 +80834,1715 @@ var init_init = __esm({
|
|
|
80831
80834
|
}
|
|
80832
80835
|
});
|
|
80833
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
|
+
|
|
80834
82546
|
// src/sdk/calculate.ts
|
|
80835
82547
|
var calculate_exports = {};
|
|
80836
82548
|
__export(calculate_exports, {
|
|
@@ -81486,6 +83198,19 @@ var ASSOCIATED_TOKEN_PROGRAM_ID = new import_web3.PublicKey("ATokenGPvbdGVxr1b2h
|
|
|
81486
83198
|
var NATIVE_MINT = new import_web3.PublicKey("So11111111111111111111111111111111111111112");
|
|
81487
83199
|
var NATIVE_MINT_2022 = new import_web3.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");
|
|
81488
83200
|
|
|
83201
|
+
// node_modules/@solana/spl-token/lib/esm/errors.js
|
|
83202
|
+
var TokenError = class extends Error {
|
|
83203
|
+
constructor(message) {
|
|
83204
|
+
super(message);
|
|
83205
|
+
}
|
|
83206
|
+
};
|
|
83207
|
+
var TokenOwnerOffCurveError = class extends TokenError {
|
|
83208
|
+
constructor() {
|
|
83209
|
+
super(...arguments);
|
|
83210
|
+
this.name = "TokenOwnerOffCurveError";
|
|
83211
|
+
}
|
|
83212
|
+
};
|
|
83213
|
+
|
|
81489
83214
|
// node_modules/@solana/spl-token/lib/esm/instructions/types.js
|
|
81490
83215
|
var TokenInstruction;
|
|
81491
83216
|
(function(TokenInstruction3) {
|
|
@@ -81591,6 +83316,12 @@ var MintLayout = (0, import_buffer_layout5.struct)([
|
|
|
81591
83316
|
publicKey("freezeAuthority")
|
|
81592
83317
|
]);
|
|
81593
83318
|
var MINT_SIZE = MintLayout.span;
|
|
83319
|
+
function getAssociatedTokenAddressSync(mint, owner, allowOwnerOffCurve = false, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
|
|
83320
|
+
if (!allowOwnerOffCurve && !import_web34.PublicKey.isOnCurve(owner.toBuffer()))
|
|
83321
|
+
throw new TokenOwnerOffCurveError();
|
|
83322
|
+
const [address] = import_web34.PublicKey.findProgramAddressSync([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId);
|
|
83323
|
+
return address;
|
|
83324
|
+
}
|
|
81594
83325
|
|
|
81595
83326
|
// node_modules/@solana/spl-token/lib/esm/instructions/closeAccount.js
|
|
81596
83327
|
var import_buffer_layout6 = __toESM(require_Layout(), 1);
|
|
@@ -84625,12 +86356,12 @@ function createSkillCommand() {
|
|
|
84625
86356
|
}
|
|
84626
86357
|
|
|
84627
86358
|
// src/cli/commands/catalog.ts
|
|
84628
|
-
var
|
|
86359
|
+
var import_cli_table38 = __toESM(require_cli_table3(), 1);
|
|
84629
86360
|
init_constants();
|
|
84630
86361
|
|
|
84631
86362
|
// src/plugins/jupiter/commands.ts
|
|
84632
86363
|
var import_cli_table32 = __toESM(require_cli_table3(), 1);
|
|
84633
|
-
var
|
|
86364
|
+
var import_web3114 = __toESM(require_index_cjs(), 1);
|
|
84634
86365
|
init_solana();
|
|
84635
86366
|
|
|
84636
86367
|
// src/core/token-registry.ts
|
|
@@ -84696,6 +86427,233 @@ init_constants();
|
|
|
84696
86427
|
init_types();
|
|
84697
86428
|
init_errors();
|
|
84698
86429
|
init_constants();
|
|
86430
|
+
|
|
86431
|
+
// src/core/proxy.ts
|
|
86432
|
+
var import_node_net = __toESM(require("node:net"), 1);
|
|
86433
|
+
var PROXY_URL = process.env.BYREAL_PROXY_URL ?? "http://api-proxy:8080";
|
|
86434
|
+
var PROBE_TIMEOUT_MS = 500;
|
|
86435
|
+
var cached = null;
|
|
86436
|
+
var inFlight = null;
|
|
86437
|
+
async function isProxyAvailable() {
|
|
86438
|
+
if (cached !== null) return cached;
|
|
86439
|
+
if (inFlight) return inFlight;
|
|
86440
|
+
inFlight = probe().then((ok2) => {
|
|
86441
|
+
cached = ok2;
|
|
86442
|
+
inFlight = null;
|
|
86443
|
+
return ok2;
|
|
86444
|
+
});
|
|
86445
|
+
return inFlight;
|
|
86446
|
+
}
|
|
86447
|
+
async function probe() {
|
|
86448
|
+
if (!PROXY_URL) return false;
|
|
86449
|
+
let host;
|
|
86450
|
+
let port;
|
|
86451
|
+
try {
|
|
86452
|
+
const u = new URL(PROXY_URL);
|
|
86453
|
+
host = u.hostname;
|
|
86454
|
+
port = Number(u.port) || (u.protocol === "https:" ? 443 : 80);
|
|
86455
|
+
} catch {
|
|
86456
|
+
return false;
|
|
86457
|
+
}
|
|
86458
|
+
return new Promise((resolve) => {
|
|
86459
|
+
const socket = new import_node_net.default.Socket();
|
|
86460
|
+
let settled = false;
|
|
86461
|
+
const settle = (ok2) => {
|
|
86462
|
+
if (settled) return;
|
|
86463
|
+
settled = true;
|
|
86464
|
+
socket.destroy();
|
|
86465
|
+
resolve(ok2);
|
|
86466
|
+
};
|
|
86467
|
+
socket.setTimeout(PROBE_TIMEOUT_MS);
|
|
86468
|
+
socket.once("error", () => settle(false));
|
|
86469
|
+
socket.once("timeout", () => settle(false));
|
|
86470
|
+
socket.connect(port, host, () => settle(true));
|
|
86471
|
+
});
|
|
86472
|
+
}
|
|
86473
|
+
|
|
86474
|
+
// src/core/fee-config.ts
|
|
86475
|
+
var import_web3113 = __toESM(require_index_cjs(), 1);
|
|
86476
|
+
var DEFAULT_FEE_RECIPIENT_WALLET = "48fcHTG4Y2xLSNUyH3CtLEL67ZseJyQes1trLgLtNNSp";
|
|
86477
|
+
var DEFAULT_FEE_BPS = 50;
|
|
86478
|
+
var MAJOR_MINTS = /* @__PURE__ */ new Set([
|
|
86479
|
+
"So11111111111111111111111111111111111111112",
|
|
86480
|
+
// Wrapped SOL
|
|
86481
|
+
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
86482
|
+
// USDC
|
|
86483
|
+
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
|
|
86484
|
+
// USDT
|
|
86485
|
+
"USD1ttGY1N17NEEHLmELoaybftRBUSErhqYiQzvEmuB"
|
|
86486
|
+
// USD1
|
|
86487
|
+
]);
|
|
86488
|
+
function pickFeeSide(inputMint, outputMint) {
|
|
86489
|
+
if (MAJOR_MINTS.has(inputMint)) return { mint: inputMint, side: "input" };
|
|
86490
|
+
if (MAJOR_MINTS.has(outputMint)) return { mint: outputMint, side: "output" };
|
|
86491
|
+
return { mint: inputMint, side: "input" };
|
|
86492
|
+
}
|
|
86493
|
+
var warnedKeys = /* @__PURE__ */ new Set();
|
|
86494
|
+
function warnOnce(key, message) {
|
|
86495
|
+
if (warnedKeys.has(key)) return;
|
|
86496
|
+
warnedKeys.add(key);
|
|
86497
|
+
if (process.env.DEBUG) {
|
|
86498
|
+
console.error(`[fee-config] ${message}`);
|
|
86499
|
+
}
|
|
86500
|
+
}
|
|
86501
|
+
var ataExistsCache = /* @__PURE__ */ new Map();
|
|
86502
|
+
var mintProgramCache = /* @__PURE__ */ new Map();
|
|
86503
|
+
async function resolveMintTokenProgram(mint, connection) {
|
|
86504
|
+
const cached2 = mintProgramCache.get(mint);
|
|
86505
|
+
if (cached2) return cached2;
|
|
86506
|
+
try {
|
|
86507
|
+
const info = await connection.getAccountInfo(
|
|
86508
|
+
new import_web3113.PublicKey(mint),
|
|
86509
|
+
"confirmed"
|
|
86510
|
+
);
|
|
86511
|
+
if (!info) {
|
|
86512
|
+
warnOnce(
|
|
86513
|
+
`mint-missing:${mint}`,
|
|
86514
|
+
`Mint ${mint} not found on-chain \u2014 assuming legacy SPL Token`
|
|
86515
|
+
);
|
|
86516
|
+
mintProgramCache.set(mint, TOKEN_PROGRAM_ID);
|
|
86517
|
+
return TOKEN_PROGRAM_ID;
|
|
86518
|
+
}
|
|
86519
|
+
const owner = info.owner;
|
|
86520
|
+
if (!owner.equals(TOKEN_PROGRAM_ID) && !owner.equals(TOKEN_2022_PROGRAM_ID)) {
|
|
86521
|
+
warnOnce(
|
|
86522
|
+
`mint-unknown-program:${mint}`,
|
|
86523
|
+
`Mint ${mint} owner ${owner.toBase58()} is not a known token program \u2014 falling back to legacy`
|
|
86524
|
+
);
|
|
86525
|
+
mintProgramCache.set(mint, TOKEN_PROGRAM_ID);
|
|
86526
|
+
return TOKEN_PROGRAM_ID;
|
|
86527
|
+
}
|
|
86528
|
+
mintProgramCache.set(mint, owner);
|
|
86529
|
+
return owner;
|
|
86530
|
+
} catch (error) {
|
|
86531
|
+
warnOnce(
|
|
86532
|
+
`mint-rpc-error:${mint}`,
|
|
86533
|
+
`Failed to query mint program for ${mint} (${error.message}) \u2014 assuming legacy SPL Token`
|
|
86534
|
+
);
|
|
86535
|
+
return TOKEN_PROGRAM_ID;
|
|
86536
|
+
}
|
|
86537
|
+
}
|
|
86538
|
+
function getFeeConfig() {
|
|
86539
|
+
const rawWallet = process.env.FEE_RECIPIENT_WALLET;
|
|
86540
|
+
const rawBps = process.env.FEE_BPS;
|
|
86541
|
+
const rawBpsTrimmed = typeof rawBps === "string" ? rawBps.trim() : "";
|
|
86542
|
+
if (rawBpsTrimmed === "0") return null;
|
|
86543
|
+
const walletStr = typeof rawWallet === "string" && rawWallet.trim().length > 0 ? rawWallet.trim() : DEFAULT_FEE_RECIPIENT_WALLET;
|
|
86544
|
+
const bpsStr = rawBpsTrimmed.length > 0 ? rawBpsTrimmed : String(DEFAULT_FEE_BPS);
|
|
86545
|
+
const bps = Number(bpsStr);
|
|
86546
|
+
if (!Number.isInteger(bps) || bps < 0) {
|
|
86547
|
+
warnOnce(
|
|
86548
|
+
`bad-bps:${bpsStr}`,
|
|
86549
|
+
`FEE_BPS must be a non-negative integer, got: ${bpsStr} \u2014 fee disabled`
|
|
86550
|
+
);
|
|
86551
|
+
return null;
|
|
86552
|
+
}
|
|
86553
|
+
if (bps > 1e4) {
|
|
86554
|
+
warnOnce(
|
|
86555
|
+
`bps-too-high:${bps}`,
|
|
86556
|
+
`FEE_BPS exceeds 10000 (100%), got: ${bps} \u2014 fee disabled`
|
|
86557
|
+
);
|
|
86558
|
+
return null;
|
|
86559
|
+
}
|
|
86560
|
+
let recipient;
|
|
86561
|
+
try {
|
|
86562
|
+
recipient = new import_web3113.PublicKey(walletStr);
|
|
86563
|
+
} catch {
|
|
86564
|
+
warnOnce(
|
|
86565
|
+
`bad-wallet:${walletStr}`,
|
|
86566
|
+
`FEE_RECIPIENT_WALLET is not a valid base58 pubkey: ${walletStr} \u2014 fee disabled`
|
|
86567
|
+
);
|
|
86568
|
+
return null;
|
|
86569
|
+
}
|
|
86570
|
+
return { recipient, bps };
|
|
86571
|
+
}
|
|
86572
|
+
function deriveFeeAccount(mint, config3, tokenProgramId) {
|
|
86573
|
+
const cfg = config3 ?? getFeeConfig();
|
|
86574
|
+
if (!cfg) {
|
|
86575
|
+
throw new Error("deriveFeeAccount called but fee is not enabled");
|
|
86576
|
+
}
|
|
86577
|
+
const mintPubkey = new import_web3113.PublicKey(mint);
|
|
86578
|
+
return getAssociatedTokenAddressSync(
|
|
86579
|
+
mintPubkey,
|
|
86580
|
+
cfg.recipient,
|
|
86581
|
+
true,
|
|
86582
|
+
tokenProgramId ?? TOKEN_PROGRAM_ID
|
|
86583
|
+
).toBase58();
|
|
86584
|
+
}
|
|
86585
|
+
async function resolveFeeAccountForSwap(mint, connection, config3) {
|
|
86586
|
+
const cfg = config3 ?? getFeeConfig();
|
|
86587
|
+
if (!cfg) return null;
|
|
86588
|
+
const tokenProgram = await resolveMintTokenProgram(mint, connection);
|
|
86589
|
+
let ata;
|
|
86590
|
+
try {
|
|
86591
|
+
ata = deriveFeeAccount(mint, cfg, tokenProgram);
|
|
86592
|
+
} catch (error) {
|
|
86593
|
+
warnOnce(
|
|
86594
|
+
`ata-derive-error:${cfg.recipient.toBase58()}:${mint}`,
|
|
86595
|
+
`Failed to derive fee ATA for mint ${mint} (${error.message}) \u2014 fee disabled for this mint`
|
|
86596
|
+
);
|
|
86597
|
+
return null;
|
|
86598
|
+
}
|
|
86599
|
+
const cacheKey = `${cfg.recipient.toBase58()}:${mint}`;
|
|
86600
|
+
const cached2 = ataExistsCache.get(cacheKey);
|
|
86601
|
+
if (cached2 === true) return ata;
|
|
86602
|
+
if (cached2 === false) return null;
|
|
86603
|
+
try {
|
|
86604
|
+
const info = await connection.getAccountInfo(
|
|
86605
|
+
new import_web3113.PublicKey(ata),
|
|
86606
|
+
"confirmed"
|
|
86607
|
+
);
|
|
86608
|
+
const exists = info !== null;
|
|
86609
|
+
ataExistsCache.set(cacheKey, exists);
|
|
86610
|
+
if (!exists) {
|
|
86611
|
+
warnOnce(
|
|
86612
|
+
`ata-missing:${cacheKey}`,
|
|
86613
|
+
`Fee treasury ATA does not exist on-chain for mint ${mint} (ata=${ata}) \u2014 fee disabled for this mint`
|
|
86614
|
+
);
|
|
86615
|
+
return null;
|
|
86616
|
+
}
|
|
86617
|
+
return ata;
|
|
86618
|
+
} catch (error) {
|
|
86619
|
+
warnOnce(
|
|
86620
|
+
`ata-rpc-error:${cacheKey}`,
|
|
86621
|
+
`Failed to verify fee ATA on-chain (${error.message}) \u2014 assuming it exists`
|
|
86622
|
+
);
|
|
86623
|
+
return ata;
|
|
86624
|
+
}
|
|
86625
|
+
}
|
|
86626
|
+
|
|
86627
|
+
// src/plugins/jupiter/api.ts
|
|
86628
|
+
init_solana();
|
|
86629
|
+
var lastRoute = null;
|
|
86630
|
+
function getLastRoute() {
|
|
86631
|
+
return lastRoute;
|
|
86632
|
+
}
|
|
86633
|
+
async function resolveRoute(subPath) {
|
|
86634
|
+
if (await isProxyAvailable()) {
|
|
86635
|
+
lastRoute = "proxy";
|
|
86636
|
+
return {
|
|
86637
|
+
url: `${PROXY_URL.replace(/\/$/, "")}/jup${subPath}`,
|
|
86638
|
+
headers: {},
|
|
86639
|
+
route: "proxy"
|
|
86640
|
+
};
|
|
86641
|
+
}
|
|
86642
|
+
if (JUPITER_API_KEY) {
|
|
86643
|
+
lastRoute = "direct-paid";
|
|
86644
|
+
return {
|
|
86645
|
+
url: `${JUP_PAID_BASE}${subPath}`,
|
|
86646
|
+
headers: { "x-api-key": JUPITER_API_KEY },
|
|
86647
|
+
route: "direct-paid"
|
|
86648
|
+
};
|
|
86649
|
+
}
|
|
86650
|
+
lastRoute = "direct-free";
|
|
86651
|
+
return {
|
|
86652
|
+
url: `${JUP_FREE_BASE}${subPath}`,
|
|
86653
|
+
headers: {},
|
|
86654
|
+
route: "direct-free"
|
|
86655
|
+
};
|
|
86656
|
+
}
|
|
84699
86657
|
async function getQuote(params) {
|
|
84700
86658
|
try {
|
|
84701
86659
|
const searchParams = new URLSearchParams({
|
|
@@ -84709,7 +86667,31 @@ async function getQuote(params) {
|
|
|
84709
86667
|
if (params.slippageBps !== void 0) {
|
|
84710
86668
|
searchParams.set("slippageBps", String(params.slippageBps));
|
|
84711
86669
|
}
|
|
84712
|
-
const
|
|
86670
|
+
const feeConfig = getFeeConfig();
|
|
86671
|
+
if (feeConfig) {
|
|
86672
|
+
const { mint: feeMint } = pickFeeSide(
|
|
86673
|
+
params.inputMint,
|
|
86674
|
+
params.outputMint
|
|
86675
|
+
);
|
|
86676
|
+
const feeAccount = await resolveFeeAccountForSwap(
|
|
86677
|
+
feeMint,
|
|
86678
|
+
getConnection(),
|
|
86679
|
+
feeConfig
|
|
86680
|
+
);
|
|
86681
|
+
if (feeAccount) {
|
|
86682
|
+
searchParams.set("platformFeeBps", String(feeConfig.bps));
|
|
86683
|
+
searchParams.set("feeAccount", feeAccount);
|
|
86684
|
+
const feeTokenProgram = await resolveMintTokenProgram(
|
|
86685
|
+
feeMint,
|
|
86686
|
+
getConnection()
|
|
86687
|
+
);
|
|
86688
|
+
if (feeTokenProgram.equals(TOKEN_2022_PROGRAM_ID)) {
|
|
86689
|
+
searchParams.set("instructionVersion", "V2");
|
|
86690
|
+
}
|
|
86691
|
+
}
|
|
86692
|
+
}
|
|
86693
|
+
const { url, headers } = await resolveRoute("/swap/v1/quote");
|
|
86694
|
+
const response = await fetch(`${url}?${searchParams}`, { headers });
|
|
84713
86695
|
if (!response.ok) {
|
|
84714
86696
|
const text = await response.text();
|
|
84715
86697
|
return err(apiError(`Jupiter quote failed: ${text}`, response.status));
|
|
@@ -84722,9 +86704,19 @@ async function getQuote(params) {
|
|
|
84722
86704
|
}
|
|
84723
86705
|
async function getSwapTransaction(params) {
|
|
84724
86706
|
try {
|
|
84725
|
-
const
|
|
86707
|
+
const feeConfig = getFeeConfig();
|
|
86708
|
+
const feeAccount = feeConfig ? await resolveFeeAccountForSwap(
|
|
86709
|
+
pickFeeSide(
|
|
86710
|
+
params.quoteResponse.inputMint,
|
|
86711
|
+
params.quoteResponse.outputMint
|
|
86712
|
+
).mint,
|
|
86713
|
+
getConnection(),
|
|
86714
|
+
feeConfig
|
|
86715
|
+
) : null;
|
|
86716
|
+
const { url, headers } = await resolveRoute("/swap/v1/swap");
|
|
86717
|
+
const response = await fetch(url, {
|
|
84726
86718
|
method: "POST",
|
|
84727
|
-
headers: { "Content-Type": "application/json" },
|
|
86719
|
+
headers: { "Content-Type": "application/json", ...headers },
|
|
84728
86720
|
body: JSON.stringify({
|
|
84729
86721
|
quoteResponse: params.quoteResponse,
|
|
84730
86722
|
userPublicKey: params.userPublicKey,
|
|
@@ -84737,7 +86729,8 @@ async function getSwapTransaction(params) {
|
|
|
84737
86729
|
global: false,
|
|
84738
86730
|
priorityLevel: "medium"
|
|
84739
86731
|
}
|
|
84740
|
-
}
|
|
86732
|
+
},
|
|
86733
|
+
...feeAccount ? { feeAccount } : {}
|
|
84741
86734
|
})
|
|
84742
86735
|
});
|
|
84743
86736
|
if (!response.ok) {
|
|
@@ -84752,7 +86745,8 @@ async function getSwapTransaction(params) {
|
|
|
84752
86745
|
}
|
|
84753
86746
|
async function getPrice(mints) {
|
|
84754
86747
|
try {
|
|
84755
|
-
const
|
|
86748
|
+
const { url, headers } = await resolveRoute("/price/v3");
|
|
86749
|
+
const response = await fetch(`${url}?ids=${mints.join(",")}`, { headers });
|
|
84756
86750
|
if (!response.ok) {
|
|
84757
86751
|
const text = await response.text();
|
|
84758
86752
|
return err(apiError(`Jupiter price failed: ${text}`, response.status));
|
|
@@ -84765,6 +86759,11 @@ async function getPrice(mints) {
|
|
|
84765
86759
|
}
|
|
84766
86760
|
|
|
84767
86761
|
// src/plugins/jupiter/commands.ts
|
|
86762
|
+
function fallbackHint(route) {
|
|
86763
|
+
if (route === "direct-paid") return "byreal proxy unreachable \u2014 using api.jup.ag with JUPITER_API_KEY";
|
|
86764
|
+
if (route === "direct-free") return "byreal proxy unreachable \u2014 using lite-api.jup.ag (no key, rate-limited)";
|
|
86765
|
+
return null;
|
|
86766
|
+
}
|
|
84768
86767
|
function createJupSwapCommand() {
|
|
84769
86768
|
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) => {
|
|
84770
86769
|
const globalOptions = cmdObj.optsWithGlobals();
|
|
@@ -84778,7 +86777,7 @@ function createJupSwapCommand() {
|
|
|
84778
86777
|
process.exit(1);
|
|
84779
86778
|
}
|
|
84780
86779
|
try {
|
|
84781
|
-
new
|
|
86780
|
+
new import_web3114.PublicKey(walletAddress);
|
|
84782
86781
|
} catch {
|
|
84783
86782
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
84784
86783
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -84830,6 +86829,8 @@ Error: ${msg}`));
|
|
|
84830
86829
|
);
|
|
84831
86830
|
console.log(source_default.cyan.bold("\n Jupiter Swap Preview\n"));
|
|
84832
86831
|
console.log(table.toString());
|
|
86832
|
+
const hint = fallbackHint(getLastRoute());
|
|
86833
|
+
if (hint) console.error(source_default.gray(`[byreal] ${hint}`));
|
|
84833
86834
|
console.log(source_default.yellow("\n Remove --dry-run to generate the unsigned transaction"));
|
|
84834
86835
|
}
|
|
84835
86836
|
return;
|
|
@@ -84882,6 +86883,8 @@ function createJupPriceCommand() {
|
|
|
84882
86883
|
}
|
|
84883
86884
|
console.log(source_default.cyan.bold("\n Jupiter Price\n"));
|
|
84884
86885
|
console.log(table.toString());
|
|
86886
|
+
const hint = fallbackHint(getLastRoute());
|
|
86887
|
+
if (hint) console.error(source_default.gray(`[byreal] ${hint}`));
|
|
84885
86888
|
}
|
|
84886
86889
|
});
|
|
84887
86890
|
}
|
|
@@ -84930,7 +86933,7 @@ var jupiterPlugin = {
|
|
|
84930
86933
|
|
|
84931
86934
|
// src/plugins/kamino/commands.ts
|
|
84932
86935
|
var import_cli_table33 = __toESM(require_cli_table3(), 1);
|
|
84933
|
-
var
|
|
86936
|
+
var import_web3115 = __toESM(require_index_cjs(), 1);
|
|
84934
86937
|
init_errors();
|
|
84935
86938
|
init_constants();
|
|
84936
86939
|
|
|
@@ -85183,7 +87186,7 @@ function validateWallet(walletAddress, format) {
|
|
|
85183
87186
|
process.exit(1);
|
|
85184
87187
|
}
|
|
85185
87188
|
try {
|
|
85186
|
-
new
|
|
87189
|
+
new import_web3115.PublicKey(walletAddress);
|
|
85187
87190
|
} catch {
|
|
85188
87191
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
85189
87192
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -85514,12 +87517,12 @@ var kaminoPlugin = {
|
|
|
85514
87517
|
|
|
85515
87518
|
// src/plugins/rent/commands.ts
|
|
85516
87519
|
var import_cli_table34 = __toESM(require_cli_table3(), 1);
|
|
85517
|
-
var
|
|
87520
|
+
var import_web3117 = __toESM(require_index_cjs(), 1);
|
|
85518
87521
|
init_errors();
|
|
85519
87522
|
init_constants();
|
|
85520
87523
|
|
|
85521
87524
|
// src/plugins/rent/accounts.ts
|
|
85522
|
-
var
|
|
87525
|
+
var import_web3116 = __toESM(require_index_cjs(), 1);
|
|
85523
87526
|
init_solana();
|
|
85524
87527
|
var ACCOUNT_EXCEPTIONS = /* @__PURE__ */ new Set([
|
|
85525
87528
|
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
@@ -85533,7 +87536,7 @@ var RENT_PER_ACCOUNT_SOL = 203928e-8;
|
|
|
85533
87536
|
var MAX_INSTRUCTIONS_PER_TX = 5;
|
|
85534
87537
|
async function scanEmptyAccounts(walletAddress, options = {}) {
|
|
85535
87538
|
const connection = getConnection();
|
|
85536
|
-
const owner = new
|
|
87539
|
+
const owner = new import_web3116.PublicKey(walletAddress);
|
|
85537
87540
|
const exceptions = /* @__PURE__ */ new Set([...ACCOUNT_EXCEPTIONS, ...options.excludeMints ?? []]);
|
|
85538
87541
|
const splAccounts = await findEmptyAccounts(connection, owner, TOKEN_PROGRAM_ID, exceptions);
|
|
85539
87542
|
let token2022Accounts = [];
|
|
@@ -85551,19 +87554,19 @@ async function scanEmptyAccounts(walletAddress, options = {}) {
|
|
|
85551
87554
|
async function buildCloseTransactions(walletAddress, emptyAccounts) {
|
|
85552
87555
|
if (emptyAccounts.length === 0) return [];
|
|
85553
87556
|
const connection = getConnection();
|
|
85554
|
-
const owner = new
|
|
87557
|
+
const owner = new import_web3116.PublicKey(walletAddress);
|
|
85555
87558
|
const { blockhash } = await connection.getLatestBlockhash();
|
|
85556
87559
|
const transactions = [];
|
|
85557
87560
|
for (let i = 0; i < emptyAccounts.length; i += MAX_INSTRUCTIONS_PER_TX) {
|
|
85558
87561
|
const batch = emptyAccounts.slice(i, i + MAX_INSTRUCTIONS_PER_TX);
|
|
85559
|
-
const tx = new
|
|
87562
|
+
const tx = new import_web3116.Transaction();
|
|
85560
87563
|
tx.recentBlockhash = blockhash;
|
|
85561
87564
|
tx.feePayer = owner;
|
|
85562
87565
|
for (const account of batch) {
|
|
85563
|
-
const programId = new
|
|
87566
|
+
const programId = new import_web3116.PublicKey(account.programId);
|
|
85564
87567
|
tx.add(
|
|
85565
87568
|
createCloseAccountInstruction(
|
|
85566
|
-
new
|
|
87569
|
+
new import_web3116.PublicKey(account.pubkey),
|
|
85567
87570
|
owner,
|
|
85568
87571
|
// destination: rent goes back to wallet
|
|
85569
87572
|
owner,
|
|
@@ -85615,7 +87618,7 @@ function createRentReclaimCommand() {
|
|
|
85615
87618
|
process.exit(1);
|
|
85616
87619
|
}
|
|
85617
87620
|
try {
|
|
85618
|
-
new
|
|
87621
|
+
new import_web3117.PublicKey(walletAddress);
|
|
85619
87622
|
} catch {
|
|
85620
87623
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
85621
87624
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -85710,7 +87713,7 @@ var rentPlugin = {
|
|
|
85710
87713
|
|
|
85711
87714
|
// src/plugins/consolidate/commands.ts
|
|
85712
87715
|
var import_cli_table35 = __toESM(require_cli_table3(), 1);
|
|
85713
|
-
var
|
|
87716
|
+
var import_web3119 = __toESM(require_index_cjs(), 1);
|
|
85714
87717
|
init_errors();
|
|
85715
87718
|
init_constants();
|
|
85716
87719
|
|
|
@@ -85718,7 +87721,7 @@ init_constants();
|
|
|
85718
87721
|
init_types();
|
|
85719
87722
|
init_errors();
|
|
85720
87723
|
init_solana();
|
|
85721
|
-
var
|
|
87724
|
+
var import_web3118 = __toESM(require_index_cjs(), 1);
|
|
85722
87725
|
var USDC_MINT2 = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
85723
87726
|
var SOL_MINT = "So11111111111111111111111111111111111111112";
|
|
85724
87727
|
async function buildSweepPlan(params) {
|
|
@@ -85732,7 +87735,7 @@ async function buildSweepPlan(params) {
|
|
|
85732
87735
|
]);
|
|
85733
87736
|
try {
|
|
85734
87737
|
const connection = getConnection();
|
|
85735
|
-
const owner = new
|
|
87738
|
+
const owner = new import_web3118.PublicKey(params.walletAddress);
|
|
85736
87739
|
const [splAccounts, token2022Accounts] = await Promise.all([
|
|
85737
87740
|
connection.getTokenAccountsByOwner(owner, { programId: TOKEN_PROGRAM_ID }, "confirmed"),
|
|
85738
87741
|
connection.getTokenAccountsByOwner(owner, { programId: TOKEN_2022_PROGRAM_ID }, "confirmed")
|
|
@@ -85752,7 +87755,7 @@ async function buildSweepPlan(params) {
|
|
|
85752
87755
|
if (tokenBalances.length === 0) {
|
|
85753
87756
|
return ok({ dustTokens: [], totalEstimatedUsd: 0, swapCount: 0, skipCount: 0 });
|
|
85754
87757
|
}
|
|
85755
|
-
const mintPubkeys = tokenBalances.map((t) => new
|
|
87758
|
+
const mintPubkeys = tokenBalances.map((t) => new import_web3118.PublicKey(t.mint));
|
|
85756
87759
|
const nftMints = /* @__PURE__ */ new Set();
|
|
85757
87760
|
for (let i = 0; i < mintPubkeys.length; i += 100) {
|
|
85758
87761
|
const batch = mintPubkeys.slice(i, i + 100);
|
|
@@ -85857,7 +87860,7 @@ function createSweepExecuteCommand() {
|
|
|
85857
87860
|
process.exit(1);
|
|
85858
87861
|
}
|
|
85859
87862
|
try {
|
|
85860
|
-
new
|
|
87863
|
+
new import_web3119.PublicKey(walletAddress);
|
|
85861
87864
|
} catch {
|
|
85862
87865
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
85863
87866
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -86000,113 +88003,475 @@ var consolidatePlugin = {
|
|
|
86000
88003
|
capabilities: capabilities4
|
|
86001
88004
|
};
|
|
86002
88005
|
|
|
86003
|
-
// src/plugins/
|
|
88006
|
+
// src/plugins/titan/commands.ts
|
|
86004
88007
|
var import_cli_table36 = __toESM(require_cli_table3(), 1);
|
|
86005
|
-
var
|
|
88008
|
+
var import_web3121 = __toESM(require_index_cjs(), 1);
|
|
86006
88009
|
init_solana();
|
|
86007
88010
|
init_errors();
|
|
86008
88011
|
init_constants();
|
|
86009
88012
|
|
|
86010
|
-
// src/plugins/
|
|
88013
|
+
// src/plugins/titan/api.ts
|
|
88014
|
+
var import_web3120 = __toESM(require_index_cjs(), 1);
|
|
88015
|
+
var import_msgpack = __toESM(require_dist5(), 1);
|
|
86011
88016
|
init_errors();
|
|
86012
88017
|
init_constants();
|
|
86013
|
-
|
|
86014
|
-
|
|
86015
|
-
|
|
86016
|
-
|
|
86017
|
-
|
|
86018
|
-
"Content-Type": "application/json",
|
|
86019
|
-
"User-Agent": "byreal-cli",
|
|
86020
|
-
...DFLOW_API_KEY ? { "x-api-key": DFLOW_API_KEY } : {}
|
|
86021
|
-
},
|
|
86022
|
-
hooks: {
|
|
86023
|
-
beforeRequest: [
|
|
86024
|
-
(request) => {
|
|
86025
|
-
if (process.env.DEBUG) {
|
|
86026
|
-
console.error(`[DEBUG] DFlow ${request.method} ${request.url}`);
|
|
86027
|
-
}
|
|
86028
|
-
}
|
|
86029
|
-
]
|
|
86030
|
-
}
|
|
86031
|
-
});
|
|
88018
|
+
init_solana();
|
|
88019
|
+
var TITAN_TIMEOUT_MS = 15e3;
|
|
88020
|
+
var lastRoute2 = null;
|
|
88021
|
+
function getLastRoute2() {
|
|
88022
|
+
return lastRoute2;
|
|
86032
88023
|
}
|
|
86033
88024
|
async function getSwapQuote2(params) {
|
|
86034
|
-
|
|
86035
|
-
const
|
|
88025
|
+
let url;
|
|
88026
|
+
const headers = { Accept: "application/vnd.msgpack" };
|
|
88027
|
+
if (await isProxyAvailable()) {
|
|
88028
|
+
lastRoute2 = "proxy";
|
|
88029
|
+
const base = PROXY_URL.replace(/\/$/, "");
|
|
88030
|
+
url = `${base}/titan/api/v1/quote/swap`;
|
|
88031
|
+
} else if (TITAN_AUTH_TOKEN) {
|
|
88032
|
+
lastRoute2 = "direct";
|
|
88033
|
+
url = `${TITAN_API_URL}/api/v1/quote/swap`;
|
|
88034
|
+
headers.Authorization = `Bearer ${TITAN_AUTH_TOKEN}`;
|
|
88035
|
+
} else {
|
|
88036
|
+
return {
|
|
88037
|
+
ok: false,
|
|
88038
|
+
error: new ByrealError({
|
|
88039
|
+
code: ErrorCodes.MISSING_REQUIRED,
|
|
88040
|
+
type: "VALIDATION",
|
|
88041
|
+
message: "Titan is only available via the Byreal proxy. The proxy is currently unreachable \u2014 please contact the Byreal team.",
|
|
88042
|
+
retryable: false
|
|
88043
|
+
})
|
|
88044
|
+
};
|
|
88045
|
+
}
|
|
88046
|
+
const query = new URLSearchParams({
|
|
88047
|
+
inputMint: params.inputMint,
|
|
88048
|
+
outputMint: params.outputMint,
|
|
88049
|
+
amount: params.amount,
|
|
88050
|
+
userPublicKey: params.userPublicKey,
|
|
88051
|
+
slippageBps: String(params.slippageBps),
|
|
88052
|
+
swapMode: params.swapMode
|
|
88053
|
+
});
|
|
88054
|
+
const feeConfig = getFeeConfig();
|
|
88055
|
+
const { mint: feeMint, side: feeSide } = pickFeeSide(params.inputMint, params.outputMint);
|
|
88056
|
+
const feeAccount = feeConfig ? await resolveFeeAccountForSwap(feeMint, getConnection(), feeConfig) : null;
|
|
88057
|
+
if (feeConfig && feeAccount) {
|
|
88058
|
+
query.set("feeAccount", feeAccount);
|
|
88059
|
+
query.set("feeBps", String(feeConfig.bps));
|
|
88060
|
+
query.set("feeFromInputMint", feeSide === "input" ? "true" : "false");
|
|
88061
|
+
}
|
|
88062
|
+
url = `${url}?${query.toString()}`;
|
|
88063
|
+
const controller = new AbortController();
|
|
88064
|
+
const timer = setTimeout(() => controller.abort(), TITAN_TIMEOUT_MS);
|
|
88065
|
+
let response;
|
|
86036
88066
|
try {
|
|
86037
|
-
|
|
86038
|
-
|
|
86039
|
-
|
|
88067
|
+
response = await fetch(url, {
|
|
88068
|
+
method: "GET",
|
|
88069
|
+
headers,
|
|
88070
|
+
signal: controller.signal
|
|
88071
|
+
});
|
|
88072
|
+
} catch (e) {
|
|
88073
|
+
clearTimeout(timer);
|
|
88074
|
+
const aborted = e.name === "AbortError";
|
|
88075
|
+
return {
|
|
88076
|
+
ok: false,
|
|
88077
|
+
error: new ByrealError({
|
|
88078
|
+
code: ErrorCodes.NETWORK_ERROR,
|
|
88079
|
+
type: "NETWORK",
|
|
88080
|
+
message: aborted ? `Titan request timed out after ${TITAN_TIMEOUT_MS}ms` : `Titan request failed: ${e.message}`,
|
|
88081
|
+
retryable: true
|
|
88082
|
+
})
|
|
88083
|
+
};
|
|
88084
|
+
}
|
|
88085
|
+
clearTimeout(timer);
|
|
88086
|
+
if (!response.ok) {
|
|
88087
|
+
const bodyText = await response.text().catch(() => "");
|
|
88088
|
+
return {
|
|
88089
|
+
ok: false,
|
|
88090
|
+
error: new ByrealError({
|
|
88091
|
+
code: ErrorCodes.API_ERROR,
|
|
88092
|
+
type: "NETWORK",
|
|
88093
|
+
message: `Titan API error ${response.status}: ${bodyText.slice(0, 200) || response.statusText}`,
|
|
88094
|
+
retryable: response.status >= 500 || response.status === 429
|
|
88095
|
+
})
|
|
88096
|
+
};
|
|
88097
|
+
}
|
|
88098
|
+
let decoded;
|
|
88099
|
+
try {
|
|
88100
|
+
const buf = new Uint8Array(await response.arrayBuffer());
|
|
88101
|
+
decoded = (0, import_msgpack.decode)(buf);
|
|
88102
|
+
} catch (e) {
|
|
88103
|
+
return {
|
|
88104
|
+
ok: false,
|
|
88105
|
+
error: new ByrealError({
|
|
88106
|
+
code: ErrorCodes.API_ERROR,
|
|
88107
|
+
type: "NETWORK",
|
|
88108
|
+
message: `Failed to decode Titan msgpack response: ${e.message}`,
|
|
88109
|
+
retryable: true
|
|
88110
|
+
})
|
|
88111
|
+
};
|
|
88112
|
+
}
|
|
88113
|
+
const bestRoute = pickBestRoute(decoded.quotes ?? {}, params.swapMode);
|
|
88114
|
+
if (!bestRoute || !bestRoute.instructions?.length) {
|
|
88115
|
+
return {
|
|
88116
|
+
ok: false,
|
|
88117
|
+
error: new ByrealError({
|
|
88118
|
+
code: ErrorCodes.API_ERROR,
|
|
88119
|
+
type: "NETWORK",
|
|
88120
|
+
message: "No swap route returned from Titan.",
|
|
88121
|
+
retryable: true
|
|
88122
|
+
})
|
|
88123
|
+
};
|
|
88124
|
+
}
|
|
88125
|
+
try {
|
|
88126
|
+
const transaction = await buildTransaction(
|
|
88127
|
+
bestRoute.instructions,
|
|
88128
|
+
bestRoute.addressLookupTables,
|
|
88129
|
+
params.userPublicKey,
|
|
88130
|
+
bestRoute.computeUnitsSafe ?? bestRoute.computeUnits
|
|
88131
|
+
);
|
|
88132
|
+
return {
|
|
88133
|
+
ok: true,
|
|
88134
|
+
value: {
|
|
88135
|
+
inAmount: String(bestRoute.inAmount),
|
|
88136
|
+
outAmount: String(bestRoute.outAmount),
|
|
86040
88137
|
inputMint: params.inputMint,
|
|
86041
88138
|
outputMint: params.outputMint,
|
|
86042
|
-
|
|
86043
|
-
slippageBps: slippageValue
|
|
88139
|
+
transaction
|
|
86044
88140
|
}
|
|
88141
|
+
};
|
|
88142
|
+
} catch (e) {
|
|
88143
|
+
return {
|
|
88144
|
+
ok: false,
|
|
88145
|
+
error: new ByrealError({
|
|
88146
|
+
code: ErrorCodes.NETWORK_ERROR,
|
|
88147
|
+
type: "NETWORK",
|
|
88148
|
+
message: `Failed to build Titan transaction: ${e.message}`,
|
|
88149
|
+
retryable: true
|
|
88150
|
+
})
|
|
88151
|
+
};
|
|
88152
|
+
}
|
|
88153
|
+
}
|
|
88154
|
+
function pickBestRoute(quotes, swapMode) {
|
|
88155
|
+
let best = null;
|
|
88156
|
+
for (const route of Object.values(quotes)) {
|
|
88157
|
+
if (!route?.instructions?.length) continue;
|
|
88158
|
+
if (!best) {
|
|
88159
|
+
best = route;
|
|
88160
|
+
continue;
|
|
88161
|
+
}
|
|
88162
|
+
if (swapMode === "ExactIn") {
|
|
88163
|
+
if (BigInt(route.outAmount) > BigInt(best.outAmount)) best = route;
|
|
88164
|
+
} else {
|
|
88165
|
+
if (BigInt(route.inAmount) < BigInt(best.inAmount)) best = route;
|
|
88166
|
+
}
|
|
88167
|
+
}
|
|
88168
|
+
return best;
|
|
88169
|
+
}
|
|
88170
|
+
async function buildTransaction(instructions, altAddresses, userPublicKey, computeUnits) {
|
|
88171
|
+
const connection = getConnection();
|
|
88172
|
+
const payer = new import_web3120.PublicKey(userPublicKey);
|
|
88173
|
+
const budgetInstructions = [];
|
|
88174
|
+
if (computeUnits && computeUnits > 2e5) {
|
|
88175
|
+
budgetInstructions.push(
|
|
88176
|
+
import_web3120.ComputeBudgetProgram.setComputeUnitLimit({ units: computeUnits })
|
|
88177
|
+
);
|
|
88178
|
+
}
|
|
88179
|
+
budgetInstructions.push(
|
|
88180
|
+
import_web3120.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: DEFAULTS.PRIORITY_FEE_MICRO_LAMPORTS })
|
|
88181
|
+
);
|
|
88182
|
+
const txInstructions = instructions.map((ix) => {
|
|
88183
|
+
const accounts = (ix.a || []).map((acc) => ({
|
|
88184
|
+
pubkey: new import_web3120.PublicKey(acc.p),
|
|
88185
|
+
isSigner: acc.s ?? false,
|
|
88186
|
+
isWritable: acc.w ?? false
|
|
88187
|
+
}));
|
|
88188
|
+
return new import_web3120.TransactionInstruction({
|
|
88189
|
+
programId: new import_web3120.PublicKey(ix.p),
|
|
88190
|
+
keys: accounts,
|
|
88191
|
+
data: Buffer.from(ix.d)
|
|
86045
88192
|
});
|
|
86046
|
-
|
|
86047
|
-
|
|
88193
|
+
});
|
|
88194
|
+
let lookupTableAccounts = [];
|
|
88195
|
+
if (altAddresses?.length) {
|
|
88196
|
+
const fetched = await Promise.all(
|
|
88197
|
+
altAddresses.map(async (addr) => {
|
|
88198
|
+
try {
|
|
88199
|
+
const result = await connection.getAddressLookupTable(new import_web3120.PublicKey(addr));
|
|
88200
|
+
return result.value;
|
|
88201
|
+
} catch {
|
|
88202
|
+
return null;
|
|
88203
|
+
}
|
|
88204
|
+
})
|
|
88205
|
+
);
|
|
88206
|
+
lookupTableAccounts = fetched.filter(
|
|
88207
|
+
(t) => t !== null
|
|
88208
|
+
);
|
|
88209
|
+
}
|
|
88210
|
+
const { blockhash } = await connection.getLatestBlockhash("confirmed");
|
|
88211
|
+
const messageV0 = new import_web3120.TransactionMessage({
|
|
88212
|
+
payerKey: payer,
|
|
88213
|
+
recentBlockhash: blockhash,
|
|
88214
|
+
instructions: [...budgetInstructions, ...txInstructions]
|
|
88215
|
+
}).compileToV0Message(lookupTableAccounts);
|
|
88216
|
+
const tx = new import_web3120.VersionedTransaction(messageV0);
|
|
88217
|
+
return Buffer.from(tx.serialize()).toString("base64");
|
|
88218
|
+
}
|
|
88219
|
+
|
|
88220
|
+
// src/plugins/titan/commands.ts
|
|
88221
|
+
function fallbackHint2(route) {
|
|
88222
|
+
if (route === "direct") return "byreal proxy unreachable \u2014 using direct Titan Gateway with TITAN_AUTH_TOKEN";
|
|
88223
|
+
return null;
|
|
88224
|
+
}
|
|
88225
|
+
function createTitanSwapCommand() {
|
|
88226
|
+
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) => {
|
|
88227
|
+
const globalOptions = cmdObj.optsWithGlobals();
|
|
88228
|
+
const format = globalOptions.output;
|
|
88229
|
+
const startTime = Date.now();
|
|
88230
|
+
const mode = resolveExecutionMode(options);
|
|
88231
|
+
const walletAddress = globalOptions.walletAddress;
|
|
88232
|
+
if (!walletAddress) {
|
|
88233
|
+
const e = missingWalletAddressError();
|
|
88234
|
+
format === "json" ? outputErrorJson(e.toJSON()) : outputErrorTable(e.toJSON());
|
|
88235
|
+
process.exit(1);
|
|
88236
|
+
}
|
|
88237
|
+
try {
|
|
88238
|
+
new import_web3121.PublicKey(walletAddress);
|
|
88239
|
+
} catch {
|
|
88240
|
+
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
88241
|
+
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
88242
|
+
Error: ${msg}`));
|
|
88243
|
+
process.exit(1);
|
|
88244
|
+
}
|
|
88245
|
+
try {
|
|
88246
|
+
const swapMode = options.swapMode;
|
|
88247
|
+
const targetMint = swapMode === "ExactIn" ? options.inputMint : options.outputMint;
|
|
88248
|
+
const targetDecimals = await resolveDecimals(targetMint);
|
|
88249
|
+
const rawAmount = options.raw ? options.amount : uiToRaw(options.amount, targetDecimals);
|
|
88250
|
+
const slippageBps = options.slippage ? parseInt(options.slippage, 10) : getSlippageBps();
|
|
88251
|
+
const quoteResult = await getSwapQuote2({
|
|
88252
|
+
inputMint: options.inputMint,
|
|
88253
|
+
outputMint: options.outputMint,
|
|
88254
|
+
amount: rawAmount,
|
|
88255
|
+
swapMode,
|
|
88256
|
+
slippageBps,
|
|
88257
|
+
userPublicKey: walletAddress
|
|
88258
|
+
});
|
|
88259
|
+
if (!quoteResult.ok) {
|
|
88260
|
+
format === "json" ? outputErrorJson(quoteResult.error) : outputErrorTable(quoteResult.error);
|
|
88261
|
+
process.exit(1);
|
|
88262
|
+
}
|
|
88263
|
+
const quote = quoteResult.value;
|
|
88264
|
+
const inputDecimals = await resolveDecimals(options.inputMint);
|
|
88265
|
+
const outputDecimals = await resolveDecimals(options.outputMint);
|
|
88266
|
+
const uiInAmount = rawToUi(quote.inAmount, inputDecimals);
|
|
88267
|
+
const uiOutAmount = rawToUi(quote.outAmount, outputDecimals);
|
|
88268
|
+
if (mode === "dry-run") {
|
|
88269
|
+
printDryRunBanner();
|
|
88270
|
+
if (format === "json") {
|
|
88271
|
+
outputJson({
|
|
88272
|
+
mode: "dry-run",
|
|
88273
|
+
source: "titan",
|
|
88274
|
+
inputMint: quote.inputMint,
|
|
88275
|
+
outputMint: quote.outputMint,
|
|
88276
|
+
inAmount: quote.inAmount,
|
|
88277
|
+
outAmount: quote.outAmount,
|
|
88278
|
+
uiInAmount,
|
|
88279
|
+
uiOutAmount,
|
|
88280
|
+
swapMode,
|
|
88281
|
+
slippageBps
|
|
88282
|
+
}, startTime);
|
|
88283
|
+
} else {
|
|
88284
|
+
const table = new import_cli_table36.default({ chars: TABLE_CHARS });
|
|
88285
|
+
table.push(
|
|
88286
|
+
[source_default.gray("Source"), "Titan Exchange"],
|
|
88287
|
+
[source_default.gray("Input"), `${uiInAmount} (${options.inputMint})`],
|
|
88288
|
+
[source_default.gray("Output"), `${uiOutAmount} (${options.outputMint})`],
|
|
88289
|
+
[source_default.gray("Swap Mode"), swapMode],
|
|
88290
|
+
[source_default.gray("Slippage"), `${slippageBps} bps`]
|
|
88291
|
+
);
|
|
88292
|
+
console.log(source_default.cyan.bold("\n Titan Swap Preview\n"));
|
|
88293
|
+
console.log(table.toString());
|
|
88294
|
+
const hint = fallbackHint2(getLastRoute2());
|
|
88295
|
+
if (hint) console.error(source_default.gray(`[byreal] ${hint}`));
|
|
88296
|
+
console.log(source_default.yellow("\n Remove --dry-run to generate the unsigned transaction"));
|
|
88297
|
+
}
|
|
88298
|
+
return;
|
|
88299
|
+
}
|
|
88300
|
+
console.log(JSON.stringify({ unsignedTransactions: [quote.transaction] }));
|
|
88301
|
+
} catch (e) {
|
|
88302
|
+
const message = e.message || "Titan swap failed";
|
|
88303
|
+
format === "json" ? outputErrorJson({ code: "API_ERROR", type: "NETWORK", message, retryable: true }) : console.error(source_default.red(`
|
|
88304
|
+
Error: ${message}`));
|
|
88305
|
+
process.exit(1);
|
|
88306
|
+
}
|
|
88307
|
+
});
|
|
88308
|
+
}
|
|
88309
|
+
|
|
88310
|
+
// src/plugins/titan/index.ts
|
|
88311
|
+
var capabilities5 = [
|
|
88312
|
+
{
|
|
88313
|
+
id: "defi.titan.swap",
|
|
88314
|
+
name: "Titan Swap",
|
|
88315
|
+
description: "Swap tokens via Titan Exchange aggregator with WebSocket-based quote streaming",
|
|
88316
|
+
category: "execute",
|
|
88317
|
+
auth_required: true,
|
|
88318
|
+
command: "byreal-cli titan swap --wallet-address <address>",
|
|
88319
|
+
params: [
|
|
88320
|
+
{ name: "input-mint", type: "string", required: true, description: "Input token mint address" },
|
|
88321
|
+
{ name: "output-mint", type: "string", required: true, description: "Output token mint address" },
|
|
88322
|
+
{ name: "amount", type: "string", required: true, description: "Amount to swap (UI format)" },
|
|
88323
|
+
{ name: "swap-mode", type: "string", required: false, description: "Swap mode", default: "ExactIn", enum: ["ExactIn", "ExactOut"] },
|
|
88324
|
+
{ name: "slippage", type: "integer", required: false, description: "Slippage tolerance in basis points" },
|
|
88325
|
+
{ name: "raw", type: "boolean", required: false, description: "Amount is already in raw format" },
|
|
88326
|
+
{ name: "dry-run", type: "boolean", required: false, description: "Preview without generating transaction" }
|
|
88327
|
+
]
|
|
88328
|
+
}
|
|
88329
|
+
];
|
|
88330
|
+
var titanPlugin = {
|
|
88331
|
+
id: "titan",
|
|
88332
|
+
name: "Titan Exchange",
|
|
88333
|
+
createCommand() {
|
|
88334
|
+
const cmd = new Command("titan").description("Titan Exchange \u2014 swap");
|
|
88335
|
+
cmd.addCommand(createTitanSwapCommand());
|
|
88336
|
+
return cmd;
|
|
88337
|
+
},
|
|
88338
|
+
capabilities: capabilities5
|
|
88339
|
+
};
|
|
88340
|
+
|
|
88341
|
+
// src/plugins/dflow/commands.ts
|
|
88342
|
+
var import_cli_table37 = __toESM(require_cli_table3(), 1);
|
|
88343
|
+
var import_web3122 = __toESM(require_index_cjs(), 1);
|
|
88344
|
+
init_solana();
|
|
88345
|
+
init_errors();
|
|
88346
|
+
init_constants();
|
|
88347
|
+
|
|
88348
|
+
// src/plugins/dflow/api.ts
|
|
88349
|
+
init_errors();
|
|
88350
|
+
init_constants();
|
|
88351
|
+
init_solana();
|
|
88352
|
+
var lastRoute3 = null;
|
|
88353
|
+
function getLastRoute3() {
|
|
88354
|
+
return lastRoute3;
|
|
88355
|
+
}
|
|
88356
|
+
async function resolveOrderUrl() {
|
|
88357
|
+
if (await isProxyAvailable()) {
|
|
88358
|
+
lastRoute3 = "proxy";
|
|
88359
|
+
return {
|
|
88360
|
+
base: `${PROXY_URL.replace(/\/$/, "")}/dflow`,
|
|
88361
|
+
headers: {},
|
|
88362
|
+
route: "proxy"
|
|
88363
|
+
};
|
|
88364
|
+
}
|
|
88365
|
+
if (DFLOW_API_KEY) {
|
|
88366
|
+
lastRoute3 = "direct-paid";
|
|
88367
|
+
return {
|
|
88368
|
+
base: DFLOW_PAID_URL,
|
|
88369
|
+
headers: { "x-api-key": DFLOW_API_KEY },
|
|
88370
|
+
route: "direct-paid"
|
|
88371
|
+
};
|
|
88372
|
+
}
|
|
88373
|
+
lastRoute3 = "direct-free";
|
|
88374
|
+
return { base: DFLOW_FREE_URL, headers: {}, route: "direct-free" };
|
|
88375
|
+
}
|
|
88376
|
+
async function getSwapQuote3(params) {
|
|
88377
|
+
const slippageValue = params.slippageBps > 0 ? String(params.slippageBps) : "auto";
|
|
88378
|
+
const query = new URLSearchParams({
|
|
88379
|
+
userPublicKey: params.userPublicKey,
|
|
88380
|
+
inputMint: params.inputMint,
|
|
88381
|
+
outputMint: params.outputMint,
|
|
88382
|
+
amount: params.amount,
|
|
88383
|
+
slippageBps: slippageValue
|
|
88384
|
+
});
|
|
88385
|
+
const feeConfig = getFeeConfig();
|
|
88386
|
+
const { mint: feeMint, side: feeSide } = pickFeeSide(params.inputMint, params.outputMint);
|
|
88387
|
+
const feeAccount = feeConfig ? await resolveFeeAccountForSwap(feeMint, getConnection(), feeConfig) : null;
|
|
88388
|
+
if (feeConfig && feeAccount) {
|
|
88389
|
+
query.set("platformFeeBps", String(feeConfig.bps));
|
|
88390
|
+
query.set("platformFeeMode", feeSide === "input" ? "inputMint" : "outputMint");
|
|
88391
|
+
query.set("feeAccount", feeAccount);
|
|
88392
|
+
}
|
|
88393
|
+
const { base, headers } = await resolveOrderUrl();
|
|
88394
|
+
const url = `${base}/order?${query.toString()}`;
|
|
88395
|
+
if (process.env.DEBUG) {
|
|
88396
|
+
console.error(`[DEBUG] DFlow GET ${url}`);
|
|
88397
|
+
}
|
|
88398
|
+
const controller = new AbortController();
|
|
88399
|
+
const timer = setTimeout(() => controller.abort(), DEFAULTS.REQUEST_TIMEOUT_MS);
|
|
88400
|
+
let response;
|
|
88401
|
+
try {
|
|
88402
|
+
response = await fetch(url, {
|
|
88403
|
+
method: "GET",
|
|
88404
|
+
headers: { "User-Agent": "byreal-cli", ...headers },
|
|
88405
|
+
signal: controller.signal
|
|
88406
|
+
});
|
|
88407
|
+
} catch (e) {
|
|
88408
|
+
clearTimeout(timer);
|
|
88409
|
+
const aborted = e.name === "AbortError";
|
|
88410
|
+
return {
|
|
88411
|
+
ok: false,
|
|
88412
|
+
error: new ByrealError({
|
|
88413
|
+
code: aborted ? ErrorCodes.TIMEOUT : ErrorCodes.NETWORK_ERROR,
|
|
88414
|
+
type: "NETWORK",
|
|
88415
|
+
message: aborted ? "DFlow request timed out." : `DFlow swap failed: ${e.message}`,
|
|
88416
|
+
retryable: true
|
|
88417
|
+
})
|
|
88418
|
+
};
|
|
88419
|
+
}
|
|
88420
|
+
clearTimeout(timer);
|
|
88421
|
+
if (!response.ok) {
|
|
88422
|
+
if (response.status === 429) {
|
|
86048
88423
|
return {
|
|
86049
88424
|
ok: false,
|
|
86050
88425
|
error: new ByrealError({
|
|
86051
|
-
code: ErrorCodes.
|
|
88426
|
+
code: ErrorCodes.NETWORK_ERROR,
|
|
86052
88427
|
type: "NETWORK",
|
|
86053
|
-
message: "
|
|
88428
|
+
message: "DFlow rate limit exceeded.",
|
|
86054
88429
|
retryable: true
|
|
86055
88430
|
})
|
|
86056
88431
|
};
|
|
86057
88432
|
}
|
|
86058
88433
|
return {
|
|
86059
|
-
ok:
|
|
86060
|
-
|
|
86061
|
-
|
|
86062
|
-
|
|
86063
|
-
|
|
86064
|
-
|
|
86065
|
-
|
|
86066
|
-
|
|
86067
|
-
}
|
|
88434
|
+
ok: false,
|
|
88435
|
+
error: new ByrealError({
|
|
88436
|
+
code: ErrorCodes.API_ERROR,
|
|
88437
|
+
type: "NETWORK",
|
|
88438
|
+
message: `DFlow API error: ${response.status} ${response.statusText}`,
|
|
88439
|
+
details: { status_code: response.status },
|
|
88440
|
+
retryable: response.status >= 500
|
|
88441
|
+
})
|
|
86068
88442
|
};
|
|
86069
|
-
} catch (e) {
|
|
86070
|
-
return { ok: false, error: handleDFlowError(e) };
|
|
86071
88443
|
}
|
|
86072
|
-
|
|
86073
|
-
|
|
86074
|
-
|
|
86075
|
-
|
|
86076
|
-
|
|
86077
|
-
|
|
86078
|
-
code: ErrorCodes.NETWORK_ERROR,
|
|
88444
|
+
const data = await response.json();
|
|
88445
|
+
if (!data.transaction) {
|
|
88446
|
+
return {
|
|
88447
|
+
ok: false,
|
|
88448
|
+
error: new ByrealError({
|
|
88449
|
+
code: ErrorCodes.API_ERROR,
|
|
86079
88450
|
type: "NETWORK",
|
|
86080
|
-
message: "
|
|
88451
|
+
message: "No transaction returned from DFlow /order endpoint.",
|
|
86081
88452
|
retryable: true
|
|
86082
|
-
})
|
|
86083
|
-
}
|
|
86084
|
-
return new ByrealError({
|
|
86085
|
-
code: ErrorCodes.API_ERROR,
|
|
86086
|
-
type: "NETWORK",
|
|
86087
|
-
message: `DFlow API error: ${status} ${error.response.statusText}`,
|
|
86088
|
-
details: { status_code: status },
|
|
86089
|
-
retryable: status >= 500
|
|
86090
|
-
});
|
|
86091
|
-
}
|
|
86092
|
-
if (error instanceof TimeoutError) {
|
|
86093
|
-
return new ByrealError({
|
|
86094
|
-
code: ErrorCodes.TIMEOUT,
|
|
86095
|
-
type: "NETWORK",
|
|
86096
|
-
message: "DFlow request timed out.",
|
|
86097
|
-
retryable: true
|
|
86098
|
-
});
|
|
88453
|
+
})
|
|
88454
|
+
};
|
|
86099
88455
|
}
|
|
86100
|
-
|
|
86101
|
-
|
|
86102
|
-
|
|
86103
|
-
|
|
86104
|
-
|
|
86105
|
-
|
|
86106
|
-
|
|
88456
|
+
return {
|
|
88457
|
+
ok: true,
|
|
88458
|
+
value: {
|
|
88459
|
+
inAmount: data.inAmount || params.amount,
|
|
88460
|
+
outAmount: data.outAmount || "0",
|
|
88461
|
+
inputMint: data.inputMint || params.inputMint,
|
|
88462
|
+
outputMint: data.outputMint || params.outputMint,
|
|
88463
|
+
transaction: data.transaction,
|
|
88464
|
+
priceImpactPct: data.priceImpactPct
|
|
88465
|
+
}
|
|
88466
|
+
};
|
|
86107
88467
|
}
|
|
86108
88468
|
|
|
86109
88469
|
// src/plugins/dflow/commands.ts
|
|
88470
|
+
function fallbackHint3(route) {
|
|
88471
|
+
if (route === "direct-paid") return "byreal proxy unreachable \u2014 using quote-api.dflow.net with DFLOW_API_KEY";
|
|
88472
|
+
if (route === "direct-free") return "byreal proxy unreachable \u2014 using dev-quote-api.dflow.net (no key, rate-limited)";
|
|
88473
|
+
return null;
|
|
88474
|
+
}
|
|
86110
88475
|
function createDFlowSwapCommand() {
|
|
86111
88476
|
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) => {
|
|
86112
88477
|
const globalOptions = cmdObj.optsWithGlobals();
|
|
@@ -86120,7 +88485,7 @@ function createDFlowSwapCommand() {
|
|
|
86120
88485
|
process.exit(1);
|
|
86121
88486
|
}
|
|
86122
88487
|
try {
|
|
86123
|
-
new
|
|
88488
|
+
new import_web3122.PublicKey(walletAddress);
|
|
86124
88489
|
} catch {
|
|
86125
88490
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
86126
88491
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -86131,7 +88496,7 @@ Error: ${msg}`));
|
|
|
86131
88496
|
const inputDecimals = await resolveDecimals(options.inputMint);
|
|
86132
88497
|
const rawAmount = options.raw ? options.amount : uiToRaw(options.amount, inputDecimals);
|
|
86133
88498
|
const slippageBps = options.slippage ? parseInt(options.slippage, 10) : getSlippageBps();
|
|
86134
|
-
const quoteResult = await
|
|
88499
|
+
const quoteResult = await getSwapQuote3({
|
|
86135
88500
|
inputMint: options.inputMint,
|
|
86136
88501
|
outputMint: options.outputMint,
|
|
86137
88502
|
amount: rawAmount,
|
|
@@ -86162,7 +88527,7 @@ Error: ${msg}`));
|
|
|
86162
88527
|
slippageBps
|
|
86163
88528
|
}, startTime);
|
|
86164
88529
|
} else {
|
|
86165
|
-
const table = new
|
|
88530
|
+
const table = new import_cli_table37.default({ chars: TABLE_CHARS });
|
|
86166
88531
|
table.push(
|
|
86167
88532
|
[source_default.gray("Source"), "DFlow"],
|
|
86168
88533
|
[source_default.gray("Input"), `${uiInAmount} (${options.inputMint})`],
|
|
@@ -86176,6 +88541,8 @@ Error: ${msg}`));
|
|
|
86176
88541
|
}
|
|
86177
88542
|
console.log(source_default.cyan.bold("\n DFlow Swap Preview\n"));
|
|
86178
88543
|
console.log(table.toString());
|
|
88544
|
+
const hint = fallbackHint3(getLastRoute3());
|
|
88545
|
+
if (hint) console.error(source_default.gray(`[byreal] ${hint}`));
|
|
86179
88546
|
console.log(source_default.yellow("\n Remove --dry-run to generate the unsigned transaction"));
|
|
86180
88547
|
}
|
|
86181
88548
|
return;
|
|
@@ -86191,7 +88558,7 @@ Error: ${message}`));
|
|
|
86191
88558
|
}
|
|
86192
88559
|
|
|
86193
88560
|
// src/plugins/dflow/index.ts
|
|
86194
|
-
var
|
|
88561
|
+
var capabilities6 = [
|
|
86195
88562
|
{
|
|
86196
88563
|
id: "defi.dflow.swap",
|
|
86197
88564
|
name: "DFlow Swap",
|
|
@@ -86217,7 +88584,7 @@ var dflowPlugin = {
|
|
|
86217
88584
|
cmd.addCommand(createDFlowSwapCommand());
|
|
86218
88585
|
return cmd;
|
|
86219
88586
|
},
|
|
86220
|
-
capabilities:
|
|
88587
|
+
capabilities: capabilities6
|
|
86221
88588
|
};
|
|
86222
88589
|
|
|
86223
88590
|
// src/plugins/index.ts
|
|
@@ -86226,7 +88593,7 @@ var plugins = [
|
|
|
86226
88593
|
kaminoPlugin,
|
|
86227
88594
|
rentPlugin,
|
|
86228
88595
|
consolidatePlugin,
|
|
86229
|
-
|
|
88596
|
+
titanPlugin,
|
|
86230
88597
|
dflowPlugin
|
|
86231
88598
|
];
|
|
86232
88599
|
|
|
@@ -86575,12 +88942,12 @@ function searchCapabilities(keyword) {
|
|
|
86575
88942
|
(cap) => cap.id.toLowerCase().includes(lowerKeyword) || cap.name.toLowerCase().includes(lowerKeyword) || cap.description.toLowerCase().includes(lowerKeyword)
|
|
86576
88943
|
);
|
|
86577
88944
|
}
|
|
86578
|
-
function outputCapabilitiesTable(
|
|
86579
|
-
const table = new
|
|
88945
|
+
function outputCapabilitiesTable(capabilities7) {
|
|
88946
|
+
const table = new import_cli_table38.default({
|
|
86580
88947
|
head: [source_default.cyan.bold("ID"), source_default.cyan.bold("Name"), source_default.cyan.bold("Category"), source_default.cyan.bold("Auth")],
|
|
86581
88948
|
chars: TABLE_CHARS
|
|
86582
88949
|
});
|
|
86583
|
-
for (const cap of
|
|
88950
|
+
for (const cap of capabilities7) {
|
|
86584
88951
|
table.push([
|
|
86585
88952
|
source_default.white(cap.id),
|
|
86586
88953
|
cap.name,
|
|
@@ -86603,7 +88970,7 @@ ${cap.name}`));
|
|
|
86603
88970
|
Command: ${source_default.green(cap.command)}`));
|
|
86604
88971
|
if (cap.params.length > 0) {
|
|
86605
88972
|
console.log(source_default.cyan("\nParameters:"));
|
|
86606
|
-
const table = new
|
|
88973
|
+
const table = new import_cli_table38.default({
|
|
86607
88974
|
head: [source_default.cyan("Name"), source_default.cyan("Type"), source_default.cyan("Required"), source_default.cyan("Default"), source_default.cyan("Description")],
|
|
86608
88975
|
chars: TABLE_CHARS
|
|
86609
88976
|
});
|
|
@@ -86706,7 +89073,7 @@ Available Capabilities (${all.length}):
|
|
|
86706
89073
|
}
|
|
86707
89074
|
|
|
86708
89075
|
// src/cli/commands/wallet.ts
|
|
86709
|
-
var
|
|
89076
|
+
var import_web3123 = __toESM(require_index_cjs(), 1);
|
|
86710
89077
|
init_constants();
|
|
86711
89078
|
init_errors();
|
|
86712
89079
|
|
|
@@ -86743,7 +89110,7 @@ function createWalletCommand() {
|
|
|
86743
89110
|
}
|
|
86744
89111
|
let publicKey3;
|
|
86745
89112
|
try {
|
|
86746
|
-
publicKey3 = new
|
|
89113
|
+
publicKey3 = new import_web3123.PublicKey(walletAddress);
|
|
86747
89114
|
} catch {
|
|
86748
89115
|
outputError({
|
|
86749
89116
|
code: "INVALID_PARAMETER",
|
|
@@ -86756,9 +89123,9 @@ function createWalletCommand() {
|
|
|
86756
89123
|
try {
|
|
86757
89124
|
const configResult = loadConfig();
|
|
86758
89125
|
const rpcUrl = configResult.ok ? configResult.value.rpc_url : SOLANA_RPC_URL;
|
|
86759
|
-
const connection = new
|
|
89126
|
+
const connection = new import_web3123.Connection(rpcUrl);
|
|
86760
89127
|
const lamports = await connection.getBalance(publicKey3);
|
|
86761
|
-
const solBalance = lamports /
|
|
89128
|
+
const solBalance = lamports / import_web3123.LAMPORTS_PER_SOL;
|
|
86762
89129
|
const rawAccounts = [];
|
|
86763
89130
|
const [splResult, t22Result] = await Promise.allSettled([
|
|
86764
89131
|
connection.getTokenAccountsByOwner(publicKey3, { programId: TOKEN_PROGRAM_ID }),
|
|
@@ -86771,7 +89138,7 @@ function createWalletCommand() {
|
|
|
86771
89138
|
if (result.status !== "fulfilled") continue;
|
|
86772
89139
|
for (const { account } of result.value.value) {
|
|
86773
89140
|
const data = account.data;
|
|
86774
|
-
const mint = new
|
|
89141
|
+
const mint = new import_web3123.PublicKey(data.subarray(0, 32)).toBase58();
|
|
86775
89142
|
const amount = data.subarray(64, 72).readBigUInt64LE();
|
|
86776
89143
|
if (amount === 0n) continue;
|
|
86777
89144
|
rawAccounts.push({ mint, amount, isToken2022: isToken20222 });
|
|
@@ -86782,7 +89149,7 @@ function createWalletCommand() {
|
|
|
86782
89149
|
if (uniqueMints.length > 0) {
|
|
86783
89150
|
for (let i = 0; i < uniqueMints.length; i += 100) {
|
|
86784
89151
|
const batch = uniqueMints.slice(i, i + 100);
|
|
86785
|
-
const mintPubkeys = batch.map((m) => new
|
|
89152
|
+
const mintPubkeys = batch.map((m) => new import_web3123.PublicKey(m));
|
|
86786
89153
|
const mintInfos = await connection.getMultipleAccountsInfo(mintPubkeys);
|
|
86787
89154
|
for (let j = 0; j < batch.length; j++) {
|
|
86788
89155
|
const info = mintInfos[j];
|
|
@@ -86932,7 +89299,7 @@ Configuration updated: ${key} = ${value}`);
|
|
|
86932
89299
|
}
|
|
86933
89300
|
|
|
86934
89301
|
// src/cli/commands/swap.ts
|
|
86935
|
-
var
|
|
89302
|
+
var import_web3124 = __toESM(require_index_cjs(), 1);
|
|
86936
89303
|
init_solana();
|
|
86937
89304
|
init_errors();
|
|
86938
89305
|
async function resolveRawAmount(amount, swapMode, inputMint, outputMint, isRaw) {
|
|
@@ -86966,7 +89333,7 @@ function createSwapExecuteCommand() {
|
|
|
86966
89333
|
process.exit(1);
|
|
86967
89334
|
}
|
|
86968
89335
|
try {
|
|
86969
|
-
new
|
|
89336
|
+
new import_web3124.PublicKey(userPublicKey);
|
|
86970
89337
|
} catch {
|
|
86971
89338
|
if (format === "json") {
|
|
86972
89339
|
outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: `Invalid wallet address: ${userPublicKey}`, retryable: false });
|
|
@@ -87057,11 +89424,11 @@ function createSwapCommand() {
|
|
|
87057
89424
|
|
|
87058
89425
|
// src/cli/commands/positions.ts
|
|
87059
89426
|
var import_bn19 = __toESM(require_bn(), 1);
|
|
87060
|
-
var
|
|
89427
|
+
var import_web3126 = __toESM(require_index_cjs(), 1);
|
|
87061
89428
|
init_solana();
|
|
87062
89429
|
|
|
87063
89430
|
// src/core/transaction.ts
|
|
87064
|
-
var
|
|
89431
|
+
var import_web3125 = __toESM(require_index_cjs(), 1);
|
|
87065
89432
|
init_types();
|
|
87066
89433
|
init_errors();
|
|
87067
89434
|
function serializeTransaction(tx) {
|
|
@@ -87144,7 +89511,7 @@ var KNOWN_SYMBOLS = {
|
|
|
87144
89511
|
async function fetchWalletBalanceSummary(owner) {
|
|
87145
89512
|
const connection = getConnection();
|
|
87146
89513
|
const lamports = await connection.getBalance(owner);
|
|
87147
|
-
const solUi = (lamports /
|
|
89514
|
+
const solUi = (lamports / import_web3126.LAMPORTS_PER_SOL).toString();
|
|
87148
89515
|
const rawAccounts = [];
|
|
87149
89516
|
const [splResult, t22Result] = await Promise.allSettled([
|
|
87150
89517
|
connection.getTokenAccountsByOwner(owner, { programId: TOKEN_PROGRAM_ID }),
|
|
@@ -87156,7 +89523,7 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
87156
89523
|
if (result.status !== "fulfilled") continue;
|
|
87157
89524
|
for (const { account } of result.value.value) {
|
|
87158
89525
|
const data = account.data;
|
|
87159
|
-
const mint = new
|
|
89526
|
+
const mint = new import_web3126.PublicKey(data.subarray(0, 32)).toBase58();
|
|
87160
89527
|
const amount = data.subarray(64, 72).readBigUInt64LE();
|
|
87161
89528
|
if (amount === 0n) continue;
|
|
87162
89529
|
rawAccounts.push({ mint, amount });
|
|
@@ -87167,7 +89534,7 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
87167
89534
|
if (uniqueMints.length > 0) {
|
|
87168
89535
|
for (let i = 0; i < uniqueMints.length; i += 100) {
|
|
87169
89536
|
const batch = uniqueMints.slice(i, i + 100);
|
|
87170
|
-
const mintPubkeys = batch.map((m) => new
|
|
89537
|
+
const mintPubkeys = batch.map((m) => new import_web3126.PublicKey(m));
|
|
87171
89538
|
const mintInfos = await connection.getMultipleAccountsInfo(mintPubkeys);
|
|
87172
89539
|
for (let j = 0; j < batch.length; j++) {
|
|
87173
89540
|
const info = mintInfos[j];
|
|
@@ -87188,11 +89555,11 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
87188
89555
|
}
|
|
87189
89556
|
return { sol: solUi, tokens };
|
|
87190
89557
|
}
|
|
87191
|
-
var ASSOCIATED_TOKEN_PROGRAM = new
|
|
89558
|
+
var ASSOCIATED_TOKEN_PROGRAM = new import_web3126.PublicKey(
|
|
87192
89559
|
"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
87193
89560
|
);
|
|
87194
89561
|
function getAtaAddress(owner, mint, tokenProgramId) {
|
|
87195
|
-
const [address] =
|
|
89562
|
+
const [address] = import_web3126.PublicKey.findProgramAddressSync(
|
|
87196
89563
|
[owner.toBuffer(), tokenProgramId.toBuffer(), mint.toBuffer()],
|
|
87197
89564
|
ASSOCIATED_TOKEN_PROGRAM
|
|
87198
89565
|
);
|
|
@@ -87204,7 +89571,7 @@ async function getTokenBalance(owner, mint) {
|
|
|
87204
89571
|
const lamports = await connection.getBalance(owner);
|
|
87205
89572
|
return new import_bn19.default(lamports.toString());
|
|
87206
89573
|
}
|
|
87207
|
-
const mintPk = new
|
|
89574
|
+
const mintPk = new import_web3126.PublicKey(mint);
|
|
87208
89575
|
const ataSpl = getAtaAddress(owner, mintPk, TOKEN_PROGRAM_ID);
|
|
87209
89576
|
const ataT22 = getAtaAddress(owner, mintPk, TOKEN_2022_PROGRAM_ID);
|
|
87210
89577
|
const [splInfo, t22Info] = await Promise.allSettled([
|
|
@@ -87276,7 +89643,7 @@ function createPositionsOpenCommand() {
|
|
|
87276
89643
|
}
|
|
87277
89644
|
process.exit(1);
|
|
87278
89645
|
}
|
|
87279
|
-
const publicKey3 = new
|
|
89646
|
+
const publicKey3 = new import_web3126.PublicKey(walletAddress);
|
|
87280
89647
|
const useAmountUsd = !!options.amountUsd;
|
|
87281
89648
|
const useTokenAmount = !!options.amount;
|
|
87282
89649
|
if (useAmountUsd && useTokenAmount) {
|
|
@@ -87571,7 +89938,7 @@ function createPositionsIncreaseCommand() {
|
|
|
87571
89938
|
}
|
|
87572
89939
|
process.exit(1);
|
|
87573
89940
|
}
|
|
87574
|
-
const publicKey3 = new
|
|
89941
|
+
const publicKey3 = new import_web3126.PublicKey(walletAddress);
|
|
87575
89942
|
const useAmountUsd = !!options.amountUsd;
|
|
87576
89943
|
const useTokenAmount = !!options.amount;
|
|
87577
89944
|
if (useAmountUsd && useTokenAmount) {
|
|
@@ -87624,7 +89991,7 @@ function createPositionsIncreaseCommand() {
|
|
|
87624
89991
|
getAmountAFromAmountB: getAmountAFromAmountB2
|
|
87625
89992
|
} = await Promise.resolve().then(() => (init_esm4(), esm_exports));
|
|
87626
89993
|
const chain = getChain2();
|
|
87627
|
-
const nftMint = new
|
|
89994
|
+
const nftMint = new import_web3126.PublicKey(options.nftMint);
|
|
87628
89995
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
87629
89996
|
if (!positionInfo) {
|
|
87630
89997
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -87908,11 +90275,11 @@ function createPositionsDecreaseCommand() {
|
|
|
87908
90275
|
}
|
|
87909
90276
|
process.exit(1);
|
|
87910
90277
|
}
|
|
87911
|
-
const publicKey3 = new
|
|
90278
|
+
const publicKey3 = new import_web3126.PublicKey(walletAddress);
|
|
87912
90279
|
try {
|
|
87913
90280
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
87914
90281
|
const chain = getChain2();
|
|
87915
|
-
const nftMint = new
|
|
90282
|
+
const nftMint = new import_web3126.PublicKey(options.nftMint);
|
|
87916
90283
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
87917
90284
|
if (!positionInfo) {
|
|
87918
90285
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -88095,11 +90462,11 @@ function createPositionsCloseCommand() {
|
|
|
88095
90462
|
}
|
|
88096
90463
|
process.exit(1);
|
|
88097
90464
|
}
|
|
88098
|
-
const publicKey3 = new
|
|
90465
|
+
const publicKey3 = new import_web3126.PublicKey(walletAddress);
|
|
88099
90466
|
try {
|
|
88100
90467
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
88101
90468
|
const chain = getChain2();
|
|
88102
|
-
const nftMint = new
|
|
90469
|
+
const nftMint = new import_web3126.PublicKey(options.nftMint);
|
|
88103
90470
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
88104
90471
|
if (!positionInfo) {
|
|
88105
90472
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -88631,7 +90998,7 @@ Error: ${errMsg}`));
|
|
|
88631
90998
|
const pool = poolResult.value;
|
|
88632
90999
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
88633
91000
|
const chain = getChain2();
|
|
88634
|
-
const nftMint = new
|
|
91001
|
+
const nftMint = new import_web3126.PublicKey(nftMintStr);
|
|
88635
91002
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
88636
91003
|
if (!positionInfo) {
|
|
88637
91004
|
const errMsg = `Position not found on-chain for NFT mint: ${nftMintStr}`;
|
|
@@ -88829,9 +91196,9 @@ function createCopyPositionCommand() {
|
|
|
88829
91196
|
}
|
|
88830
91197
|
process.exit(1);
|
|
88831
91198
|
}
|
|
88832
|
-
const publicKey3 = new
|
|
91199
|
+
const publicKey3 = new import_web3126.PublicKey(walletAddress);
|
|
88833
91200
|
try {
|
|
88834
|
-
const positionAddress = new
|
|
91201
|
+
const positionAddress = new import_web3126.PublicKey(options.position);
|
|
88835
91202
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
88836
91203
|
const { calculateTokenAmountsFromUsd: calculateTokenAmountsFromUsd2, getRawPositionInfoByAddress: getRawPositionInfoByAddress2 } = await Promise.resolve().then(() => (init_calculate(), calculate_exports));
|
|
88837
91204
|
const chain = getChain2();
|