@byreal-io/byreal-cli-realclaw 0.3.12 → 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 +365 -142
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3033,7 +3033,7 @@ var INJECTED_VERSION, VERSION, CLI_NAME, NPM_PACKAGE, API_BASE_URL, API_ENDPOINT
|
|
|
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";
|
|
@@ -26993,7 +26993,7 @@ var require_index_cjs = __commonJS({
|
|
|
26993
26993
|
return value._bn !== void 0;
|
|
26994
26994
|
}
|
|
26995
26995
|
var uniquePublicKeyCounter = 1;
|
|
26996
|
-
var
|
|
26996
|
+
var PublicKey52 = class _PublicKey2 extends Struct {
|
|
26997
26997
|
/**
|
|
26998
26998
|
* Create a new PublicKey object
|
|
26999
26999
|
* @param value ed25519 public key as buffer or base-58 encoded string
|
|
@@ -27155,9 +27155,9 @@ var require_index_cjs = __commonJS({
|
|
|
27155
27155
|
return isOnCurve(pubkey.toBytes());
|
|
27156
27156
|
}
|
|
27157
27157
|
};
|
|
27158
|
-
_PublicKey =
|
|
27159
|
-
|
|
27160
|
-
SOLANA_SCHEMA.set(
|
|
27158
|
+
_PublicKey = PublicKey52;
|
|
27159
|
+
PublicKey52.default = new _PublicKey("11111111111111111111111111111111");
|
|
27160
|
+
SOLANA_SCHEMA.set(PublicKey52, {
|
|
27161
27161
|
kind: "struct",
|
|
27162
27162
|
fields: [["_bn", "u256"]]
|
|
27163
27163
|
});
|
|
@@ -27189,7 +27189,7 @@ var require_index_cjs = __commonJS({
|
|
|
27189
27189
|
* The public key for this account
|
|
27190
27190
|
*/
|
|
27191
27191
|
get publicKey() {
|
|
27192
|
-
return new
|
|
27192
|
+
return new PublicKey52(this._publicKey);
|
|
27193
27193
|
}
|
|
27194
27194
|
/**
|
|
27195
27195
|
* The **unencrypted** secret key for this account. The first 32 bytes
|
|
@@ -27200,7 +27200,7 @@ var require_index_cjs = __commonJS({
|
|
|
27200
27200
|
return buffer.Buffer.concat([this._secretKey, this._publicKey], 64);
|
|
27201
27201
|
}
|
|
27202
27202
|
};
|
|
27203
|
-
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new
|
|
27203
|
+
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey52("BPFLoader1111111111111111111111111111111111");
|
|
27204
27204
|
var PACKET_DATA_SIZE = 1280 - 40 - 8;
|
|
27205
27205
|
var VERSION_PREFIX_MASK = 127;
|
|
27206
27206
|
var SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
@@ -27431,7 +27431,7 @@ var require_index_cjs = __commonJS({
|
|
|
27431
27431
|
const [payerAddress] = writableSigners[0];
|
|
27432
27432
|
assert(payerAddress === this.payer.toBase58(), "Expected first writable signer key to be the fee payer");
|
|
27433
27433
|
}
|
|
27434
|
-
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))];
|
|
27435
27435
|
return [header, staticAccountKeys];
|
|
27436
27436
|
}
|
|
27437
27437
|
extractTableLookup(lookupTable) {
|
|
@@ -27455,7 +27455,7 @@ var require_index_cjs = __commonJS({
|
|
|
27455
27455
|
const drainedKeys = new Array();
|
|
27456
27456
|
for (const [address, keyMeta] of this.keyMetaMap.entries()) {
|
|
27457
27457
|
if (keyMetaFilter(keyMeta)) {
|
|
27458
|
-
const key = new
|
|
27458
|
+
const key = new PublicKey52(address);
|
|
27459
27459
|
const lookupTableIndex = lookupTableEntries.findIndex((entry) => entry.equals(key));
|
|
27460
27460
|
if (lookupTableIndex >= 0) {
|
|
27461
27461
|
assert(lookupTableIndex < 256, "Max lookup table index exceeded");
|
|
@@ -27490,7 +27490,7 @@ var require_index_cjs = __commonJS({
|
|
|
27490
27490
|
this.instructions = void 0;
|
|
27491
27491
|
this.indexToProgramIds = /* @__PURE__ */ new Map();
|
|
27492
27492
|
this.header = args.header;
|
|
27493
|
-
this.accountKeys = args.accountKeys.map((account) => new
|
|
27493
|
+
this.accountKeys = args.accountKeys.map((account) => new PublicKey52(account));
|
|
27494
27494
|
this.recentBlockhash = args.recentBlockhash;
|
|
27495
27495
|
this.instructions = args.instructions;
|
|
27496
27496
|
this.instructions.forEach((ix) => this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex]));
|
|
@@ -27616,7 +27616,7 @@ var require_index_cjs = __commonJS({
|
|
|
27616
27616
|
let accountKeys = [];
|
|
27617
27617
|
for (let i = 0; i < accountCount; i++) {
|
|
27618
27618
|
const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2);
|
|
27619
|
-
accountKeys.push(new
|
|
27619
|
+
accountKeys.push(new PublicKey52(buffer.Buffer.from(account)));
|
|
27620
27620
|
}
|
|
27621
27621
|
const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2);
|
|
27622
27622
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -27840,7 +27840,7 @@ var require_index_cjs = __commonJS({
|
|
|
27840
27840
|
const staticAccountKeys = [];
|
|
27841
27841
|
const staticAccountKeysLength = decodeLength(byteArray);
|
|
27842
27842
|
for (let i = 0; i < staticAccountKeysLength; i++) {
|
|
27843
|
-
staticAccountKeys.push(new
|
|
27843
|
+
staticAccountKeys.push(new PublicKey52(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2)));
|
|
27844
27844
|
}
|
|
27845
27845
|
const recentBlockhash = bs58__default.default.encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
27846
27846
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -27860,7 +27860,7 @@ var require_index_cjs = __commonJS({
|
|
|
27860
27860
|
const addressTableLookupsCount = decodeLength(byteArray);
|
|
27861
27861
|
const addressTableLookups = [];
|
|
27862
27862
|
for (let i = 0; i < addressTableLookupsCount; i++) {
|
|
27863
|
-
const accountKey = new
|
|
27863
|
+
const accountKey = new PublicKey52(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
27864
27864
|
const writableIndexesLength = decodeLength(byteArray);
|
|
27865
27865
|
const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);
|
|
27866
27866
|
const readonlyIndexesLength = decodeLength(byteArray);
|
|
@@ -28100,7 +28100,7 @@ var require_index_cjs = __commonJS({
|
|
|
28100
28100
|
});
|
|
28101
28101
|
programIds.forEach((programId) => {
|
|
28102
28102
|
accountMetas.push({
|
|
28103
|
-
pubkey: new
|
|
28103
|
+
pubkey: new PublicKey52(programId),
|
|
28104
28104
|
isSigner: false,
|
|
28105
28105
|
isWritable: false
|
|
28106
28106
|
});
|
|
@@ -28693,15 +28693,15 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28693
28693
|
var DEFAULT_TICKS_PER_SLOT = 64;
|
|
28694
28694
|
var NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
28695
28695
|
var MS_PER_SLOT = 1e3 / NUM_SLOTS_PER_SECOND;
|
|
28696
|
-
var SYSVAR_CLOCK_PUBKEY2 = new
|
|
28697
|
-
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new
|
|
28698
|
-
var SYSVAR_INSTRUCTIONS_PUBKEY = new
|
|
28699
|
-
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new
|
|
28700
|
-
var SYSVAR_RENT_PUBKEY5 = new
|
|
28701
|
-
var SYSVAR_REWARDS_PUBKEY = new
|
|
28702
|
-
var SYSVAR_SLOT_HASHES_PUBKEY = new
|
|
28703
|
-
var SYSVAR_SLOT_HISTORY_PUBKEY = new
|
|
28704
|
-
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");
|
|
28705
28705
|
var SendTransactionError = class extends Error {
|
|
28706
28706
|
constructor({
|
|
28707
28707
|
action,
|
|
@@ -28892,8 +28892,8 @@ Message: ${transactionMessage}.
|
|
|
28892
28892
|
static fromAccountData(buffer2) {
|
|
28893
28893
|
const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer2), 0);
|
|
28894
28894
|
return new _NonceAccount({
|
|
28895
|
-
authorizedPubkey: new
|
|
28896
|
-
nonce: new
|
|
28895
|
+
authorizedPubkey: new PublicKey52(nonceAccount.authorizedPubkey),
|
|
28896
|
+
nonce: new PublicKey52(nonceAccount.nonce).toString(),
|
|
28897
28897
|
feeCalculator: nonceAccount.feeCalculator
|
|
28898
28898
|
});
|
|
28899
28899
|
}
|
|
@@ -28955,7 +28955,7 @@ Message: ${transactionMessage}.
|
|
|
28955
28955
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
28956
28956
|
lamports,
|
|
28957
28957
|
space,
|
|
28958
|
-
programId: new
|
|
28958
|
+
programId: new PublicKey52(programId)
|
|
28959
28959
|
};
|
|
28960
28960
|
}
|
|
28961
28961
|
/**
|
|
@@ -28990,7 +28990,7 @@ Message: ${transactionMessage}.
|
|
|
28990
28990
|
toPubkey: instruction.keys[2].pubkey,
|
|
28991
28991
|
lamports,
|
|
28992
28992
|
seed,
|
|
28993
|
-
programId: new
|
|
28993
|
+
programId: new PublicKey52(programId)
|
|
28994
28994
|
};
|
|
28995
28995
|
}
|
|
28996
28996
|
/**
|
|
@@ -29021,10 +29021,10 @@ Message: ${transactionMessage}.
|
|
|
29021
29021
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed, instruction.data);
|
|
29022
29022
|
return {
|
|
29023
29023
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29024
|
-
basePubkey: new
|
|
29024
|
+
basePubkey: new PublicKey52(base),
|
|
29025
29025
|
seed,
|
|
29026
29026
|
space,
|
|
29027
|
-
programId: new
|
|
29027
|
+
programId: new PublicKey52(programId)
|
|
29028
29028
|
};
|
|
29029
29029
|
}
|
|
29030
29030
|
/**
|
|
@@ -29038,7 +29038,7 @@ Message: ${transactionMessage}.
|
|
|
29038
29038
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign, instruction.data);
|
|
29039
29039
|
return {
|
|
29040
29040
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29041
|
-
programId: new
|
|
29041
|
+
programId: new PublicKey52(programId)
|
|
29042
29042
|
};
|
|
29043
29043
|
}
|
|
29044
29044
|
/**
|
|
@@ -29054,9 +29054,9 @@ Message: ${transactionMessage}.
|
|
|
29054
29054
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed, instruction.data);
|
|
29055
29055
|
return {
|
|
29056
29056
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29057
|
-
basePubkey: new
|
|
29057
|
+
basePubkey: new PublicKey52(base),
|
|
29058
29058
|
seed,
|
|
29059
|
-
programId: new
|
|
29059
|
+
programId: new PublicKey52(programId)
|
|
29060
29060
|
};
|
|
29061
29061
|
}
|
|
29062
29062
|
/**
|
|
@@ -29075,11 +29075,11 @@ Message: ${transactionMessage}.
|
|
|
29075
29075
|
return {
|
|
29076
29076
|
fromPubkey: instruction.keys[0].pubkey,
|
|
29077
29077
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
29078
|
-
basePubkey: new
|
|
29078
|
+
basePubkey: new PublicKey52(base),
|
|
29079
29079
|
seed,
|
|
29080
29080
|
lamports,
|
|
29081
29081
|
space,
|
|
29082
|
-
programId: new
|
|
29082
|
+
programId: new PublicKey52(programId)
|
|
29083
29083
|
};
|
|
29084
29084
|
}
|
|
29085
29085
|
/**
|
|
@@ -29093,7 +29093,7 @@ Message: ${transactionMessage}.
|
|
|
29093
29093
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount, instruction.data);
|
|
29094
29094
|
return {
|
|
29095
29095
|
noncePubkey: instruction.keys[0].pubkey,
|
|
29096
|
-
authorizedPubkey: new
|
|
29096
|
+
authorizedPubkey: new PublicKey52(authorized2)
|
|
29097
29097
|
};
|
|
29098
29098
|
}
|
|
29099
29099
|
/**
|
|
@@ -29136,7 +29136,7 @@ Message: ${transactionMessage}.
|
|
|
29136
29136
|
return {
|
|
29137
29137
|
noncePubkey: instruction.keys[0].pubkey,
|
|
29138
29138
|
authorizedPubkey: instruction.keys[1].pubkey,
|
|
29139
|
-
newAuthorizedPubkey: new
|
|
29139
|
+
newAuthorizedPubkey: new PublicKey52(authorized2)
|
|
29140
29140
|
};
|
|
29141
29141
|
}
|
|
29142
29142
|
/**
|
|
@@ -29545,7 +29545,7 @@ Message: ${transactionMessage}.
|
|
|
29545
29545
|
});
|
|
29546
29546
|
}
|
|
29547
29547
|
};
|
|
29548
|
-
SystemProgram13.programId = new
|
|
29548
|
+
SystemProgram13.programId = new PublicKey52("11111111111111111111111111111111");
|
|
29549
29549
|
var CHUNK_SIZE = PACKET_DATA_SIZE - 300;
|
|
29550
29550
|
var Loader = class _Loader {
|
|
29551
29551
|
/**
|
|
@@ -29712,7 +29712,7 @@ Message: ${transactionMessage}.
|
|
|
29712
29712
|
}
|
|
29713
29713
|
};
|
|
29714
29714
|
Loader.chunkSize = CHUNK_SIZE;
|
|
29715
|
-
var BPF_LOADER_PROGRAM_ID = new
|
|
29715
|
+
var BPF_LOADER_PROGRAM_ID = new PublicKey52("BPFLoader2111111111111111111111111111111111");
|
|
29716
29716
|
var BpfLoader = class {
|
|
29717
29717
|
/**
|
|
29718
29718
|
* Minimum number of signatures required to load a program not including
|
|
@@ -30508,8 +30508,8 @@ Message: ${transactionMessage}.
|
|
|
30508
30508
|
deactivationSlot: meta.deactivationSlot,
|
|
30509
30509
|
lastExtendedSlot: meta.lastExtendedSlot,
|
|
30510
30510
|
lastExtendedSlotStartIndex: meta.lastExtendedStartIndex,
|
|
30511
|
-
authority: meta.authority.length !== 0 ? new
|
|
30512
|
-
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))
|
|
30513
30513
|
};
|
|
30514
30514
|
}
|
|
30515
30515
|
};
|
|
@@ -30551,7 +30551,7 @@ Message: ${transactionMessage}.
|
|
|
30551
30551
|
);
|
|
30552
30552
|
return `${protocol}//${hostish}${websocketPort}${rest}`;
|
|
30553
30553
|
}
|
|
30554
|
-
var PublicKeyFromString = superstruct.coerce(superstruct.instance(
|
|
30554
|
+
var PublicKeyFromString = superstruct.coerce(superstruct.instance(PublicKey52), superstruct.string(), (value) => new PublicKey52(value));
|
|
30555
30555
|
var RawAccountDataResult = superstruct.tuple([superstruct.string(), superstruct.literal("base64")]);
|
|
30556
30556
|
var BufferFromRawAccountData = superstruct.coerce(superstruct.instance(buffer.Buffer), RawAccountDataResult, (value) => buffer.Buffer.from(value[0], "base64"));
|
|
30557
30557
|
var BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1e3;
|
|
@@ -30636,7 +30636,7 @@ Message: ${transactionMessage}.
|
|
|
30636
30636
|
if (version2 === 0) {
|
|
30637
30637
|
return new MessageV0({
|
|
30638
30638
|
header: response.header,
|
|
30639
|
-
staticAccountKeys: response.accountKeys.map((accountKey) => new
|
|
30639
|
+
staticAccountKeys: response.accountKeys.map((accountKey) => new PublicKey52(accountKey)),
|
|
30640
30640
|
recentBlockhash: response.recentBlockhash,
|
|
30641
30641
|
compiledInstructions: response.instructions.map((ix) => ({
|
|
30642
30642
|
programIdIndex: ix.programIdIndex,
|
|
@@ -31300,7 +31300,7 @@ Message: ${transactionMessage}.
|
|
|
31300
31300
|
var COMMON_HTTP_HEADERS = {
|
|
31301
31301
|
"solana-client": `js/${"1.0.0-maintenance"}`
|
|
31302
31302
|
};
|
|
31303
|
-
var
|
|
31303
|
+
var Connection6 = class {
|
|
31304
31304
|
/**
|
|
31305
31305
|
* Establish a JSON RPC connection
|
|
31306
31306
|
*
|
|
@@ -34076,7 +34076,7 @@ Message: ${transactionMessage}.
|
|
|
34076
34076
|
* @returns {PublicKey} PublicKey
|
|
34077
34077
|
*/
|
|
34078
34078
|
get publicKey() {
|
|
34079
|
-
return new
|
|
34079
|
+
return new PublicKey52(this._keypair.publicKey);
|
|
34080
34080
|
}
|
|
34081
34081
|
/**
|
|
34082
34082
|
* The raw secret key for this keypair
|
|
@@ -34154,7 +34154,7 @@ Message: ${transactionMessage}.
|
|
|
34154
34154
|
lookupTable: instruction.keys[0].pubkey,
|
|
34155
34155
|
authority: instruction.keys[1].pubkey,
|
|
34156
34156
|
payer: instruction.keys.length > 2 ? instruction.keys[2].pubkey : void 0,
|
|
34157
|
-
addresses: addresses.map((buffer2) => new
|
|
34157
|
+
addresses: addresses.map((buffer2) => new PublicKey52(buffer2))
|
|
34158
34158
|
};
|
|
34159
34159
|
}
|
|
34160
34160
|
static decodeCloseLookupTable(instruction) {
|
|
@@ -34206,7 +34206,7 @@ Message: ${transactionMessage}.
|
|
|
34206
34206
|
constructor() {
|
|
34207
34207
|
}
|
|
34208
34208
|
static createLookupTable(params) {
|
|
34209
|
-
const [lookupTableAddress, bumpSeed] =
|
|
34209
|
+
const [lookupTableAddress, bumpSeed] = PublicKey52.findProgramAddressSync([params.authority.toBuffer(), codecsNumbers.getU64Encoder().encode(params.recentSlot)], this.programId);
|
|
34210
34210
|
const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable;
|
|
34211
34211
|
const data = encodeData(type, {
|
|
34212
34212
|
recentSlot: BigInt(params.recentSlot),
|
|
@@ -34325,7 +34325,7 @@ Message: ${transactionMessage}.
|
|
|
34325
34325
|
});
|
|
34326
34326
|
}
|
|
34327
34327
|
};
|
|
34328
|
-
AddressLookupTableProgram.programId = new
|
|
34328
|
+
AddressLookupTableProgram.programId = new PublicKey52("AddressLookupTab1e1111111111111111111111111");
|
|
34329
34329
|
var ComputeBudgetInstruction = class {
|
|
34330
34330
|
/**
|
|
34331
34331
|
* @internal
|
|
@@ -34479,7 +34479,7 @@ Message: ${transactionMessage}.
|
|
|
34479
34479
|
});
|
|
34480
34480
|
}
|
|
34481
34481
|
};
|
|
34482
|
-
ComputeBudgetProgram4.programId = new
|
|
34482
|
+
ComputeBudgetProgram4.programId = new PublicKey52("ComputeBudget111111111111111111111111111111");
|
|
34483
34483
|
var PRIVATE_KEY_BYTES$1 = 64;
|
|
34484
34484
|
var PUBLIC_KEY_BYTES$1 = 32;
|
|
34485
34485
|
var SIGNATURE_BYTES = 64;
|
|
@@ -34559,7 +34559,7 @@ Message: ${transactionMessage}.
|
|
|
34559
34559
|
}
|
|
34560
34560
|
}
|
|
34561
34561
|
};
|
|
34562
|
-
Ed25519Program.programId = new
|
|
34562
|
+
Ed25519Program.programId = new PublicKey52("Ed25519SigVerify111111111111111111111111111");
|
|
34563
34563
|
var ecdsaSign = (msgHash, privKey) => {
|
|
34564
34564
|
const signature2 = secp256k1.secp256k1.sign(msgHash, privKey);
|
|
34565
34565
|
return [signature2.toCompactRawBytes(), signature2.recovery];
|
|
@@ -34693,9 +34693,9 @@ Message: ${transactionMessage}.
|
|
|
34693
34693
|
}
|
|
34694
34694
|
}
|
|
34695
34695
|
};
|
|
34696
|
-
Secp256k1Program.programId = new
|
|
34696
|
+
Secp256k1Program.programId = new PublicKey52("KeccakSecp256k11111111111111111111111111111");
|
|
34697
34697
|
var _Lockup;
|
|
34698
|
-
var STAKE_CONFIG_ID = new
|
|
34698
|
+
var STAKE_CONFIG_ID = new PublicKey52("StakeConfig11111111111111111111111111111111");
|
|
34699
34699
|
var Authorized = class {
|
|
34700
34700
|
/**
|
|
34701
34701
|
* Create a new Authorized object
|
|
@@ -34726,7 +34726,7 @@ Message: ${transactionMessage}.
|
|
|
34726
34726
|
*/
|
|
34727
34727
|
};
|
|
34728
34728
|
_Lockup = Lockup;
|
|
34729
|
-
Lockup.default = new _Lockup(0, 0,
|
|
34729
|
+
Lockup.default = new _Lockup(0, 0, PublicKey52.default);
|
|
34730
34730
|
var StakeInstruction = class {
|
|
34731
34731
|
/**
|
|
34732
34732
|
* @internal
|
|
@@ -34764,8 +34764,8 @@ Message: ${transactionMessage}.
|
|
|
34764
34764
|
} = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Initialize, instruction.data);
|
|
34765
34765
|
return {
|
|
34766
34766
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34767
|
-
authorized: new Authorized(new
|
|
34768
|
-
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))
|
|
34769
34769
|
};
|
|
34770
34770
|
}
|
|
34771
34771
|
/**
|
|
@@ -34794,7 +34794,7 @@ Message: ${transactionMessage}.
|
|
|
34794
34794
|
const o = {
|
|
34795
34795
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34796
34796
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
34797
|
-
newAuthorizedPubkey: new
|
|
34797
|
+
newAuthorizedPubkey: new PublicKey52(newAuthorized),
|
|
34798
34798
|
stakeAuthorizationType: {
|
|
34799
34799
|
index: stakeAuthorizationType
|
|
34800
34800
|
}
|
|
@@ -34820,8 +34820,8 @@ Message: ${transactionMessage}.
|
|
|
34820
34820
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34821
34821
|
authorityBase: instruction.keys[1].pubkey,
|
|
34822
34822
|
authoritySeed,
|
|
34823
|
-
authorityOwner: new
|
|
34824
|
-
newAuthorizedPubkey: new
|
|
34823
|
+
authorityOwner: new PublicKey52(authorityOwner),
|
|
34824
|
+
newAuthorizedPubkey: new PublicKey52(newAuthorized),
|
|
34825
34825
|
stakeAuthorizationType: {
|
|
34826
34826
|
index: stakeAuthorizationType
|
|
34827
34827
|
}
|
|
@@ -35375,7 +35375,7 @@ Message: ${transactionMessage}.
|
|
|
35375
35375
|
});
|
|
35376
35376
|
}
|
|
35377
35377
|
};
|
|
35378
|
-
StakeProgram.programId = new
|
|
35378
|
+
StakeProgram.programId = new PublicKey52("Stake11111111111111111111111111111111111111");
|
|
35379
35379
|
StakeProgram.space = 200;
|
|
35380
35380
|
var VoteInit = class {
|
|
35381
35381
|
/** [0, 100] */
|
|
@@ -35427,7 +35427,7 @@ Message: ${transactionMessage}.
|
|
|
35427
35427
|
return {
|
|
35428
35428
|
votePubkey: instruction.keys[0].pubkey,
|
|
35429
35429
|
nodePubkey: instruction.keys[3].pubkey,
|
|
35430
|
-
voteInit: new VoteInit(new
|
|
35430
|
+
voteInit: new VoteInit(new PublicKey52(voteInit2.nodePubkey), new PublicKey52(voteInit2.authorizedVoter), new PublicKey52(voteInit2.authorizedWithdrawer), voteInit2.commission)
|
|
35431
35431
|
};
|
|
35432
35432
|
}
|
|
35433
35433
|
/**
|
|
@@ -35443,7 +35443,7 @@ Message: ${transactionMessage}.
|
|
|
35443
35443
|
return {
|
|
35444
35444
|
votePubkey: instruction.keys[0].pubkey,
|
|
35445
35445
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
35446
|
-
newAuthorizedPubkey: new
|
|
35446
|
+
newAuthorizedPubkey: new PublicKey52(newAuthorized),
|
|
35447
35447
|
voteAuthorizationType: {
|
|
35448
35448
|
index: voteAuthorizationType
|
|
35449
35449
|
}
|
|
@@ -35465,9 +35465,9 @@ Message: ${transactionMessage}.
|
|
|
35465
35465
|
} = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data);
|
|
35466
35466
|
return {
|
|
35467
35467
|
currentAuthorityDerivedKeyBasePubkey: instruction.keys[2].pubkey,
|
|
35468
|
-
currentAuthorityDerivedKeyOwnerPubkey: new
|
|
35468
|
+
currentAuthorityDerivedKeyOwnerPubkey: new PublicKey52(currentAuthorityDerivedKeyOwnerPubkey),
|
|
35469
35469
|
currentAuthorityDerivedKeySeed,
|
|
35470
|
-
newAuthorizedPubkey: new
|
|
35470
|
+
newAuthorizedPubkey: new PublicKey52(newAuthorized),
|
|
35471
35471
|
voteAuthorizationType: {
|
|
35472
35472
|
index: voteAuthorizationType
|
|
35473
35473
|
},
|
|
@@ -35758,9 +35758,9 @@ Message: ${transactionMessage}.
|
|
|
35758
35758
|
});
|
|
35759
35759
|
}
|
|
35760
35760
|
};
|
|
35761
|
-
VoteProgram.programId = new
|
|
35761
|
+
VoteProgram.programId = new PublicKey52("Vote111111111111111111111111111111111111111");
|
|
35762
35762
|
VoteProgram.space = 3762;
|
|
35763
|
-
var VALIDATOR_INFO_KEY = new
|
|
35763
|
+
var VALIDATOR_INFO_KEY = new PublicKey52("Va1idator1nfo111111111111111111111111111111");
|
|
35764
35764
|
var InfoString = superstruct.type({
|
|
35765
35765
|
name: superstruct.string(),
|
|
35766
35766
|
website: superstruct.optional(superstruct.string()),
|
|
@@ -35794,7 +35794,7 @@ Message: ${transactionMessage}.
|
|
|
35794
35794
|
if (configKeyCount !== 2) return null;
|
|
35795
35795
|
const configKeys = [];
|
|
35796
35796
|
for (let i = 0; i < 2; i++) {
|
|
35797
|
-
const publicKey4 = new
|
|
35797
|
+
const publicKey4 = new PublicKey52(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
35798
35798
|
const isSigner = guardedShift(byteArray) === 1;
|
|
35799
35799
|
configKeys.push({
|
|
35800
35800
|
publicKey: publicKey4,
|
|
@@ -35812,7 +35812,7 @@ Message: ${transactionMessage}.
|
|
|
35812
35812
|
return null;
|
|
35813
35813
|
}
|
|
35814
35814
|
};
|
|
35815
|
-
var VOTE_PROGRAM_ID = new
|
|
35815
|
+
var VOTE_PROGRAM_ID = new PublicKey52("Vote111111111111111111111111111111111111111");
|
|
35816
35816
|
var VoteAccountLayout = BufferLayout__namespace.struct([
|
|
35817
35817
|
publicKey3("nodePubkey"),
|
|
35818
35818
|
publicKey3("authorizedWithdrawer"),
|
|
@@ -35869,8 +35869,8 @@ Message: ${transactionMessage}.
|
|
|
35869
35869
|
rootSlot = null;
|
|
35870
35870
|
}
|
|
35871
35871
|
return new _VoteAccount({
|
|
35872
|
-
nodePubkey: new
|
|
35873
|
-
authorizedWithdrawer: new
|
|
35872
|
+
nodePubkey: new PublicKey52(va.nodePubkey),
|
|
35873
|
+
authorizedWithdrawer: new PublicKey52(va.authorizedWithdrawer),
|
|
35874
35874
|
commission: va.commission,
|
|
35875
35875
|
votes: va.votes,
|
|
35876
35876
|
rootSlot,
|
|
@@ -35887,7 +35887,7 @@ Message: ${transactionMessage}.
|
|
|
35887
35887
|
}) {
|
|
35888
35888
|
return {
|
|
35889
35889
|
epoch,
|
|
35890
|
-
authorizedVoter: new
|
|
35890
|
+
authorizedVoter: new PublicKey52(authorizedVoter)
|
|
35891
35891
|
};
|
|
35892
35892
|
}
|
|
35893
35893
|
function parsePriorVoters({
|
|
@@ -35896,7 +35896,7 @@ Message: ${transactionMessage}.
|
|
|
35896
35896
|
targetEpoch
|
|
35897
35897
|
}) {
|
|
35898
35898
|
return {
|
|
35899
|
-
authorizedPubkey: new
|
|
35899
|
+
authorizedPubkey: new PublicKey52(authorizedPubkey),
|
|
35900
35900
|
epochOfLastAuthorizedSwitch,
|
|
35901
35901
|
targetEpoch
|
|
35902
35902
|
};
|
|
@@ -35980,7 +35980,7 @@ Message: ${transactionMessage}.
|
|
|
35980
35980
|
exports2.COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS;
|
|
35981
35981
|
exports2.ComputeBudgetInstruction = ComputeBudgetInstruction;
|
|
35982
35982
|
exports2.ComputeBudgetProgram = ComputeBudgetProgram4;
|
|
35983
|
-
exports2.Connection =
|
|
35983
|
+
exports2.Connection = Connection6;
|
|
35984
35984
|
exports2.Ed25519Program = Ed25519Program;
|
|
35985
35985
|
exports2.Enum = Enum;
|
|
35986
35986
|
exports2.EpochSchedule = EpochSchedule;
|
|
@@ -35998,7 +35998,7 @@ Message: ${transactionMessage}.
|
|
|
35998
35998
|
exports2.NonceAccount = NonceAccount;
|
|
35999
35999
|
exports2.PACKET_DATA_SIZE = PACKET_DATA_SIZE;
|
|
36000
36000
|
exports2.PUBLIC_KEY_LENGTH = PUBLIC_KEY_LENGTH2;
|
|
36001
|
-
exports2.PublicKey =
|
|
36001
|
+
exports2.PublicKey = PublicKey52;
|
|
36002
36002
|
exports2.SIGNATURE_LENGTH_IN_BYTES = SIGNATURE_LENGTH_IN_BYTES;
|
|
36003
36003
|
exports2.SOLANA_SCHEMA = SOLANA_SCHEMA;
|
|
36004
36004
|
exports2.STAKE_CONFIG_ID = STAKE_CONFIG_ID;
|
|
@@ -42376,33 +42376,33 @@ var init_constants4 = __esm({
|
|
|
42376
42376
|
});
|
|
42377
42377
|
|
|
42378
42378
|
// node_modules/@byreal-io/byreal-clmm-sdk/node_modules/@solana/spl-token/lib/esm/errors.js
|
|
42379
|
-
var
|
|
42379
|
+
var TokenError2, TokenAccountNotFoundError2, TokenInvalidAccountOwnerError2, TokenInvalidAccountSizeError2, TokenInvalidMintError2;
|
|
42380
42380
|
var init_errors2 = __esm({
|
|
42381
42381
|
"node_modules/@byreal-io/byreal-clmm-sdk/node_modules/@solana/spl-token/lib/esm/errors.js"() {
|
|
42382
|
-
|
|
42382
|
+
TokenError2 = class extends Error {
|
|
42383
42383
|
constructor(message) {
|
|
42384
42384
|
super(message);
|
|
42385
42385
|
}
|
|
42386
42386
|
};
|
|
42387
|
-
|
|
42387
|
+
TokenAccountNotFoundError2 = class extends TokenError2 {
|
|
42388
42388
|
constructor() {
|
|
42389
42389
|
super(...arguments);
|
|
42390
42390
|
this.name = "TokenAccountNotFoundError";
|
|
42391
42391
|
}
|
|
42392
42392
|
};
|
|
42393
|
-
|
|
42393
|
+
TokenInvalidAccountOwnerError2 = class extends TokenError2 {
|
|
42394
42394
|
constructor() {
|
|
42395
42395
|
super(...arguments);
|
|
42396
42396
|
this.name = "TokenInvalidAccountOwnerError";
|
|
42397
42397
|
}
|
|
42398
42398
|
};
|
|
42399
|
-
|
|
42399
|
+
TokenInvalidAccountSizeError2 = class extends TokenError2 {
|
|
42400
42400
|
constructor() {
|
|
42401
42401
|
super(...arguments);
|
|
42402
42402
|
this.name = "TokenInvalidAccountSizeError";
|
|
42403
42403
|
}
|
|
42404
42404
|
};
|
|
42405
|
-
|
|
42405
|
+
TokenInvalidMintError2 = class extends TokenError2 {
|
|
42406
42406
|
constructor() {
|
|
42407
42407
|
super(...arguments);
|
|
42408
42408
|
this.name = "TokenInvalidMintError";
|
|
@@ -43237,20 +43237,20 @@ var init_extensionType = __esm({
|
|
|
43237
43237
|
// node_modules/@byreal-io/byreal-clmm-sdk/node_modules/@solana/spl-token/lib/esm/state/mint.js
|
|
43238
43238
|
function unpackMint(address, info, programId = TOKEN_PROGRAM_ID2) {
|
|
43239
43239
|
if (!info)
|
|
43240
|
-
throw new
|
|
43240
|
+
throw new TokenAccountNotFoundError2();
|
|
43241
43241
|
if (!info.owner.equals(programId))
|
|
43242
|
-
throw new
|
|
43242
|
+
throw new TokenInvalidAccountOwnerError2();
|
|
43243
43243
|
if (info.data.length < MINT_SIZE2)
|
|
43244
|
-
throw new
|
|
43244
|
+
throw new TokenInvalidAccountSizeError2();
|
|
43245
43245
|
const rawMint = MintLayout2.decode(info.data.slice(0, MINT_SIZE2));
|
|
43246
43246
|
let tlvData = Buffer.alloc(0);
|
|
43247
43247
|
if (info.data.length > MINT_SIZE2) {
|
|
43248
43248
|
if (info.data.length <= ACCOUNT_SIZE2)
|
|
43249
|
-
throw new
|
|
43249
|
+
throw new TokenInvalidAccountSizeError2();
|
|
43250
43250
|
if (info.data.length === MULTISIG_SIZE)
|
|
43251
|
-
throw new
|
|
43251
|
+
throw new TokenInvalidAccountSizeError2();
|
|
43252
43252
|
if (info.data[ACCOUNT_SIZE2] != AccountType.Mint)
|
|
43253
|
-
throw new
|
|
43253
|
+
throw new TokenInvalidMintError2();
|
|
43254
43254
|
tlvData = info.data.slice(ACCOUNT_SIZE2 + ACCOUNT_TYPE_SIZE);
|
|
43255
43255
|
}
|
|
43256
43256
|
return {
|
|
@@ -83198,6 +83198,19 @@ var ASSOCIATED_TOKEN_PROGRAM_ID = new import_web3.PublicKey("ATokenGPvbdGVxr1b2h
|
|
|
83198
83198
|
var NATIVE_MINT = new import_web3.PublicKey("So11111111111111111111111111111111111111112");
|
|
83199
83199
|
var NATIVE_MINT_2022 = new import_web3.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");
|
|
83200
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
|
+
|
|
83201
83214
|
// node_modules/@solana/spl-token/lib/esm/instructions/types.js
|
|
83202
83215
|
var TokenInstruction;
|
|
83203
83216
|
(function(TokenInstruction3) {
|
|
@@ -83303,6 +83316,12 @@ var MintLayout = (0, import_buffer_layout5.struct)([
|
|
|
83303
83316
|
publicKey("freezeAuthority")
|
|
83304
83317
|
]);
|
|
83305
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
|
+
}
|
|
83306
83325
|
|
|
83307
83326
|
// node_modules/@solana/spl-token/lib/esm/instructions/closeAccount.js
|
|
83308
83327
|
var import_buffer_layout6 = __toESM(require_Layout(), 1);
|
|
@@ -86342,7 +86361,7 @@ init_constants();
|
|
|
86342
86361
|
|
|
86343
86362
|
// src/plugins/jupiter/commands.ts
|
|
86344
86363
|
var import_cli_table32 = __toESM(require_cli_table3(), 1);
|
|
86345
|
-
var
|
|
86364
|
+
var import_web3114 = __toESM(require_index_cjs(), 1);
|
|
86346
86365
|
init_solana();
|
|
86347
86366
|
|
|
86348
86367
|
// src/core/token-registry.ts
|
|
@@ -86452,7 +86471,161 @@ async function probe() {
|
|
|
86452
86471
|
});
|
|
86453
86472
|
}
|
|
86454
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
|
+
|
|
86455
86627
|
// src/plugins/jupiter/api.ts
|
|
86628
|
+
init_solana();
|
|
86456
86629
|
var lastRoute = null;
|
|
86457
86630
|
function getLastRoute() {
|
|
86458
86631
|
return lastRoute;
|
|
@@ -86494,6 +86667,29 @@ async function getQuote(params) {
|
|
|
86494
86667
|
if (params.slippageBps !== void 0) {
|
|
86495
86668
|
searchParams.set("slippageBps", String(params.slippageBps));
|
|
86496
86669
|
}
|
|
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
|
+
}
|
|
86497
86693
|
const { url, headers } = await resolveRoute("/swap/v1/quote");
|
|
86498
86694
|
const response = await fetch(`${url}?${searchParams}`, { headers });
|
|
86499
86695
|
if (!response.ok) {
|
|
@@ -86508,6 +86704,15 @@ async function getQuote(params) {
|
|
|
86508
86704
|
}
|
|
86509
86705
|
async function getSwapTransaction(params) {
|
|
86510
86706
|
try {
|
|
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;
|
|
86511
86716
|
const { url, headers } = await resolveRoute("/swap/v1/swap");
|
|
86512
86717
|
const response = await fetch(url, {
|
|
86513
86718
|
method: "POST",
|
|
@@ -86524,7 +86729,8 @@ async function getSwapTransaction(params) {
|
|
|
86524
86729
|
global: false,
|
|
86525
86730
|
priorityLevel: "medium"
|
|
86526
86731
|
}
|
|
86527
|
-
}
|
|
86732
|
+
},
|
|
86733
|
+
...feeAccount ? { feeAccount } : {}
|
|
86528
86734
|
})
|
|
86529
86735
|
});
|
|
86530
86736
|
if (!response.ok) {
|
|
@@ -86571,7 +86777,7 @@ function createJupSwapCommand() {
|
|
|
86571
86777
|
process.exit(1);
|
|
86572
86778
|
}
|
|
86573
86779
|
try {
|
|
86574
|
-
new
|
|
86780
|
+
new import_web3114.PublicKey(walletAddress);
|
|
86575
86781
|
} catch {
|
|
86576
86782
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
86577
86783
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -86727,7 +86933,7 @@ var jupiterPlugin = {
|
|
|
86727
86933
|
|
|
86728
86934
|
// src/plugins/kamino/commands.ts
|
|
86729
86935
|
var import_cli_table33 = __toESM(require_cli_table3(), 1);
|
|
86730
|
-
var
|
|
86936
|
+
var import_web3115 = __toESM(require_index_cjs(), 1);
|
|
86731
86937
|
init_errors();
|
|
86732
86938
|
init_constants();
|
|
86733
86939
|
|
|
@@ -86980,7 +87186,7 @@ function validateWallet(walletAddress, format) {
|
|
|
86980
87186
|
process.exit(1);
|
|
86981
87187
|
}
|
|
86982
87188
|
try {
|
|
86983
|
-
new
|
|
87189
|
+
new import_web3115.PublicKey(walletAddress);
|
|
86984
87190
|
} catch {
|
|
86985
87191
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
86986
87192
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -87311,12 +87517,12 @@ var kaminoPlugin = {
|
|
|
87311
87517
|
|
|
87312
87518
|
// src/plugins/rent/commands.ts
|
|
87313
87519
|
var import_cli_table34 = __toESM(require_cli_table3(), 1);
|
|
87314
|
-
var
|
|
87520
|
+
var import_web3117 = __toESM(require_index_cjs(), 1);
|
|
87315
87521
|
init_errors();
|
|
87316
87522
|
init_constants();
|
|
87317
87523
|
|
|
87318
87524
|
// src/plugins/rent/accounts.ts
|
|
87319
|
-
var
|
|
87525
|
+
var import_web3116 = __toESM(require_index_cjs(), 1);
|
|
87320
87526
|
init_solana();
|
|
87321
87527
|
var ACCOUNT_EXCEPTIONS = /* @__PURE__ */ new Set([
|
|
87322
87528
|
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
@@ -87330,7 +87536,7 @@ var RENT_PER_ACCOUNT_SOL = 203928e-8;
|
|
|
87330
87536
|
var MAX_INSTRUCTIONS_PER_TX = 5;
|
|
87331
87537
|
async function scanEmptyAccounts(walletAddress, options = {}) {
|
|
87332
87538
|
const connection = getConnection();
|
|
87333
|
-
const owner = new
|
|
87539
|
+
const owner = new import_web3116.PublicKey(walletAddress);
|
|
87334
87540
|
const exceptions = /* @__PURE__ */ new Set([...ACCOUNT_EXCEPTIONS, ...options.excludeMints ?? []]);
|
|
87335
87541
|
const splAccounts = await findEmptyAccounts(connection, owner, TOKEN_PROGRAM_ID, exceptions);
|
|
87336
87542
|
let token2022Accounts = [];
|
|
@@ -87348,19 +87554,19 @@ async function scanEmptyAccounts(walletAddress, options = {}) {
|
|
|
87348
87554
|
async function buildCloseTransactions(walletAddress, emptyAccounts) {
|
|
87349
87555
|
if (emptyAccounts.length === 0) return [];
|
|
87350
87556
|
const connection = getConnection();
|
|
87351
|
-
const owner = new
|
|
87557
|
+
const owner = new import_web3116.PublicKey(walletAddress);
|
|
87352
87558
|
const { blockhash } = await connection.getLatestBlockhash();
|
|
87353
87559
|
const transactions = [];
|
|
87354
87560
|
for (let i = 0; i < emptyAccounts.length; i += MAX_INSTRUCTIONS_PER_TX) {
|
|
87355
87561
|
const batch = emptyAccounts.slice(i, i + MAX_INSTRUCTIONS_PER_TX);
|
|
87356
|
-
const tx = new
|
|
87562
|
+
const tx = new import_web3116.Transaction();
|
|
87357
87563
|
tx.recentBlockhash = blockhash;
|
|
87358
87564
|
tx.feePayer = owner;
|
|
87359
87565
|
for (const account of batch) {
|
|
87360
|
-
const programId = new
|
|
87566
|
+
const programId = new import_web3116.PublicKey(account.programId);
|
|
87361
87567
|
tx.add(
|
|
87362
87568
|
createCloseAccountInstruction(
|
|
87363
|
-
new
|
|
87569
|
+
new import_web3116.PublicKey(account.pubkey),
|
|
87364
87570
|
owner,
|
|
87365
87571
|
// destination: rent goes back to wallet
|
|
87366
87572
|
owner,
|
|
@@ -87412,7 +87618,7 @@ function createRentReclaimCommand() {
|
|
|
87412
87618
|
process.exit(1);
|
|
87413
87619
|
}
|
|
87414
87620
|
try {
|
|
87415
|
-
new
|
|
87621
|
+
new import_web3117.PublicKey(walletAddress);
|
|
87416
87622
|
} catch {
|
|
87417
87623
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
87418
87624
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -87507,7 +87713,7 @@ var rentPlugin = {
|
|
|
87507
87713
|
|
|
87508
87714
|
// src/plugins/consolidate/commands.ts
|
|
87509
87715
|
var import_cli_table35 = __toESM(require_cli_table3(), 1);
|
|
87510
|
-
var
|
|
87716
|
+
var import_web3119 = __toESM(require_index_cjs(), 1);
|
|
87511
87717
|
init_errors();
|
|
87512
87718
|
init_constants();
|
|
87513
87719
|
|
|
@@ -87515,7 +87721,7 @@ init_constants();
|
|
|
87515
87721
|
init_types();
|
|
87516
87722
|
init_errors();
|
|
87517
87723
|
init_solana();
|
|
87518
|
-
var
|
|
87724
|
+
var import_web3118 = __toESM(require_index_cjs(), 1);
|
|
87519
87725
|
var USDC_MINT2 = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
87520
87726
|
var SOL_MINT = "So11111111111111111111111111111111111111112";
|
|
87521
87727
|
async function buildSweepPlan(params) {
|
|
@@ -87529,7 +87735,7 @@ async function buildSweepPlan(params) {
|
|
|
87529
87735
|
]);
|
|
87530
87736
|
try {
|
|
87531
87737
|
const connection = getConnection();
|
|
87532
|
-
const owner = new
|
|
87738
|
+
const owner = new import_web3118.PublicKey(params.walletAddress);
|
|
87533
87739
|
const [splAccounts, token2022Accounts] = await Promise.all([
|
|
87534
87740
|
connection.getTokenAccountsByOwner(owner, { programId: TOKEN_PROGRAM_ID }, "confirmed"),
|
|
87535
87741
|
connection.getTokenAccountsByOwner(owner, { programId: TOKEN_2022_PROGRAM_ID }, "confirmed")
|
|
@@ -87549,7 +87755,7 @@ async function buildSweepPlan(params) {
|
|
|
87549
87755
|
if (tokenBalances.length === 0) {
|
|
87550
87756
|
return ok({ dustTokens: [], totalEstimatedUsd: 0, swapCount: 0, skipCount: 0 });
|
|
87551
87757
|
}
|
|
87552
|
-
const mintPubkeys = tokenBalances.map((t) => new
|
|
87758
|
+
const mintPubkeys = tokenBalances.map((t) => new import_web3118.PublicKey(t.mint));
|
|
87553
87759
|
const nftMints = /* @__PURE__ */ new Set();
|
|
87554
87760
|
for (let i = 0; i < mintPubkeys.length; i += 100) {
|
|
87555
87761
|
const batch = mintPubkeys.slice(i, i + 100);
|
|
@@ -87654,7 +87860,7 @@ function createSweepExecuteCommand() {
|
|
|
87654
87860
|
process.exit(1);
|
|
87655
87861
|
}
|
|
87656
87862
|
try {
|
|
87657
|
-
new
|
|
87863
|
+
new import_web3119.PublicKey(walletAddress);
|
|
87658
87864
|
} catch {
|
|
87659
87865
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
87660
87866
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -87799,13 +88005,13 @@ var consolidatePlugin = {
|
|
|
87799
88005
|
|
|
87800
88006
|
// src/plugins/titan/commands.ts
|
|
87801
88007
|
var import_cli_table36 = __toESM(require_cli_table3(), 1);
|
|
87802
|
-
var
|
|
88008
|
+
var import_web3121 = __toESM(require_index_cjs(), 1);
|
|
87803
88009
|
init_solana();
|
|
87804
88010
|
init_errors();
|
|
87805
88011
|
init_constants();
|
|
87806
88012
|
|
|
87807
88013
|
// src/plugins/titan/api.ts
|
|
87808
|
-
var
|
|
88014
|
+
var import_web3120 = __toESM(require_index_cjs(), 1);
|
|
87809
88015
|
var import_msgpack = __toESM(require_dist5(), 1);
|
|
87810
88016
|
init_errors();
|
|
87811
88017
|
init_constants();
|
|
@@ -87845,6 +88051,14 @@ async function getSwapQuote2(params) {
|
|
|
87845
88051
|
slippageBps: String(params.slippageBps),
|
|
87846
88052
|
swapMode: params.swapMode
|
|
87847
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
|
+
}
|
|
87848
88062
|
url = `${url}?${query.toString()}`;
|
|
87849
88063
|
const controller = new AbortController();
|
|
87850
88064
|
const timer = setTimeout(() => controller.abort(), TITAN_TIMEOUT_MS);
|
|
@@ -87955,24 +88169,24 @@ function pickBestRoute(quotes, swapMode) {
|
|
|
87955
88169
|
}
|
|
87956
88170
|
async function buildTransaction(instructions, altAddresses, userPublicKey, computeUnits) {
|
|
87957
88171
|
const connection = getConnection();
|
|
87958
|
-
const payer = new
|
|
88172
|
+
const payer = new import_web3120.PublicKey(userPublicKey);
|
|
87959
88173
|
const budgetInstructions = [];
|
|
87960
88174
|
if (computeUnits && computeUnits > 2e5) {
|
|
87961
88175
|
budgetInstructions.push(
|
|
87962
|
-
|
|
88176
|
+
import_web3120.ComputeBudgetProgram.setComputeUnitLimit({ units: computeUnits })
|
|
87963
88177
|
);
|
|
87964
88178
|
}
|
|
87965
88179
|
budgetInstructions.push(
|
|
87966
|
-
|
|
88180
|
+
import_web3120.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: DEFAULTS.PRIORITY_FEE_MICRO_LAMPORTS })
|
|
87967
88181
|
);
|
|
87968
88182
|
const txInstructions = instructions.map((ix) => {
|
|
87969
88183
|
const accounts = (ix.a || []).map((acc) => ({
|
|
87970
|
-
pubkey: new
|
|
88184
|
+
pubkey: new import_web3120.PublicKey(acc.p),
|
|
87971
88185
|
isSigner: acc.s ?? false,
|
|
87972
88186
|
isWritable: acc.w ?? false
|
|
87973
88187
|
}));
|
|
87974
|
-
return new
|
|
87975
|
-
programId: new
|
|
88188
|
+
return new import_web3120.TransactionInstruction({
|
|
88189
|
+
programId: new import_web3120.PublicKey(ix.p),
|
|
87976
88190
|
keys: accounts,
|
|
87977
88191
|
data: Buffer.from(ix.d)
|
|
87978
88192
|
});
|
|
@@ -87982,7 +88196,7 @@ async function buildTransaction(instructions, altAddresses, userPublicKey, compu
|
|
|
87982
88196
|
const fetched = await Promise.all(
|
|
87983
88197
|
altAddresses.map(async (addr) => {
|
|
87984
88198
|
try {
|
|
87985
|
-
const result = await connection.getAddressLookupTable(new
|
|
88199
|
+
const result = await connection.getAddressLookupTable(new import_web3120.PublicKey(addr));
|
|
87986
88200
|
return result.value;
|
|
87987
88201
|
} catch {
|
|
87988
88202
|
return null;
|
|
@@ -87994,12 +88208,12 @@ async function buildTransaction(instructions, altAddresses, userPublicKey, compu
|
|
|
87994
88208
|
);
|
|
87995
88209
|
}
|
|
87996
88210
|
const { blockhash } = await connection.getLatestBlockhash("confirmed");
|
|
87997
|
-
const messageV0 = new
|
|
88211
|
+
const messageV0 = new import_web3120.TransactionMessage({
|
|
87998
88212
|
payerKey: payer,
|
|
87999
88213
|
recentBlockhash: blockhash,
|
|
88000
88214
|
instructions: [...budgetInstructions, ...txInstructions]
|
|
88001
88215
|
}).compileToV0Message(lookupTableAccounts);
|
|
88002
|
-
const tx = new
|
|
88216
|
+
const tx = new import_web3120.VersionedTransaction(messageV0);
|
|
88003
88217
|
return Buffer.from(tx.serialize()).toString("base64");
|
|
88004
88218
|
}
|
|
88005
88219
|
|
|
@@ -88021,7 +88235,7 @@ function createTitanSwapCommand() {
|
|
|
88021
88235
|
process.exit(1);
|
|
88022
88236
|
}
|
|
88023
88237
|
try {
|
|
88024
|
-
new
|
|
88238
|
+
new import_web3121.PublicKey(walletAddress);
|
|
88025
88239
|
} catch {
|
|
88026
88240
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
88027
88241
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -88126,7 +88340,7 @@ var titanPlugin = {
|
|
|
88126
88340
|
|
|
88127
88341
|
// src/plugins/dflow/commands.ts
|
|
88128
88342
|
var import_cli_table37 = __toESM(require_cli_table3(), 1);
|
|
88129
|
-
var
|
|
88343
|
+
var import_web3122 = __toESM(require_index_cjs(), 1);
|
|
88130
88344
|
init_solana();
|
|
88131
88345
|
init_errors();
|
|
88132
88346
|
init_constants();
|
|
@@ -88134,6 +88348,7 @@ init_constants();
|
|
|
88134
88348
|
// src/plugins/dflow/api.ts
|
|
88135
88349
|
init_errors();
|
|
88136
88350
|
init_constants();
|
|
88351
|
+
init_solana();
|
|
88137
88352
|
var lastRoute3 = null;
|
|
88138
88353
|
function getLastRoute3() {
|
|
88139
88354
|
return lastRoute3;
|
|
@@ -88167,6 +88382,14 @@ async function getSwapQuote3(params) {
|
|
|
88167
88382
|
amount: params.amount,
|
|
88168
88383
|
slippageBps: slippageValue
|
|
88169
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
|
+
}
|
|
88170
88393
|
const { base, headers } = await resolveOrderUrl();
|
|
88171
88394
|
const url = `${base}/order?${query.toString()}`;
|
|
88172
88395
|
if (process.env.DEBUG) {
|
|
@@ -88262,7 +88485,7 @@ function createDFlowSwapCommand() {
|
|
|
88262
88485
|
process.exit(1);
|
|
88263
88486
|
}
|
|
88264
88487
|
try {
|
|
88265
|
-
new
|
|
88488
|
+
new import_web3122.PublicKey(walletAddress);
|
|
88266
88489
|
} catch {
|
|
88267
88490
|
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
88268
88491
|
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
@@ -88850,7 +89073,7 @@ Available Capabilities (${all.length}):
|
|
|
88850
89073
|
}
|
|
88851
89074
|
|
|
88852
89075
|
// src/cli/commands/wallet.ts
|
|
88853
|
-
var
|
|
89076
|
+
var import_web3123 = __toESM(require_index_cjs(), 1);
|
|
88854
89077
|
init_constants();
|
|
88855
89078
|
init_errors();
|
|
88856
89079
|
|
|
@@ -88887,7 +89110,7 @@ function createWalletCommand() {
|
|
|
88887
89110
|
}
|
|
88888
89111
|
let publicKey3;
|
|
88889
89112
|
try {
|
|
88890
|
-
publicKey3 = new
|
|
89113
|
+
publicKey3 = new import_web3123.PublicKey(walletAddress);
|
|
88891
89114
|
} catch {
|
|
88892
89115
|
outputError({
|
|
88893
89116
|
code: "INVALID_PARAMETER",
|
|
@@ -88900,9 +89123,9 @@ function createWalletCommand() {
|
|
|
88900
89123
|
try {
|
|
88901
89124
|
const configResult = loadConfig();
|
|
88902
89125
|
const rpcUrl = configResult.ok ? configResult.value.rpc_url : SOLANA_RPC_URL;
|
|
88903
|
-
const connection = new
|
|
89126
|
+
const connection = new import_web3123.Connection(rpcUrl);
|
|
88904
89127
|
const lamports = await connection.getBalance(publicKey3);
|
|
88905
|
-
const solBalance = lamports /
|
|
89128
|
+
const solBalance = lamports / import_web3123.LAMPORTS_PER_SOL;
|
|
88906
89129
|
const rawAccounts = [];
|
|
88907
89130
|
const [splResult, t22Result] = await Promise.allSettled([
|
|
88908
89131
|
connection.getTokenAccountsByOwner(publicKey3, { programId: TOKEN_PROGRAM_ID }),
|
|
@@ -88915,7 +89138,7 @@ function createWalletCommand() {
|
|
|
88915
89138
|
if (result.status !== "fulfilled") continue;
|
|
88916
89139
|
for (const { account } of result.value.value) {
|
|
88917
89140
|
const data = account.data;
|
|
88918
|
-
const mint = new
|
|
89141
|
+
const mint = new import_web3123.PublicKey(data.subarray(0, 32)).toBase58();
|
|
88919
89142
|
const amount = data.subarray(64, 72).readBigUInt64LE();
|
|
88920
89143
|
if (amount === 0n) continue;
|
|
88921
89144
|
rawAccounts.push({ mint, amount, isToken2022: isToken20222 });
|
|
@@ -88926,7 +89149,7 @@ function createWalletCommand() {
|
|
|
88926
89149
|
if (uniqueMints.length > 0) {
|
|
88927
89150
|
for (let i = 0; i < uniqueMints.length; i += 100) {
|
|
88928
89151
|
const batch = uniqueMints.slice(i, i + 100);
|
|
88929
|
-
const mintPubkeys = batch.map((m) => new
|
|
89152
|
+
const mintPubkeys = batch.map((m) => new import_web3123.PublicKey(m));
|
|
88930
89153
|
const mintInfos = await connection.getMultipleAccountsInfo(mintPubkeys);
|
|
88931
89154
|
for (let j = 0; j < batch.length; j++) {
|
|
88932
89155
|
const info = mintInfos[j];
|
|
@@ -89076,7 +89299,7 @@ Configuration updated: ${key} = ${value}`);
|
|
|
89076
89299
|
}
|
|
89077
89300
|
|
|
89078
89301
|
// src/cli/commands/swap.ts
|
|
89079
|
-
var
|
|
89302
|
+
var import_web3124 = __toESM(require_index_cjs(), 1);
|
|
89080
89303
|
init_solana();
|
|
89081
89304
|
init_errors();
|
|
89082
89305
|
async function resolveRawAmount(amount, swapMode, inputMint, outputMint, isRaw) {
|
|
@@ -89110,7 +89333,7 @@ function createSwapExecuteCommand() {
|
|
|
89110
89333
|
process.exit(1);
|
|
89111
89334
|
}
|
|
89112
89335
|
try {
|
|
89113
|
-
new
|
|
89336
|
+
new import_web3124.PublicKey(userPublicKey);
|
|
89114
89337
|
} catch {
|
|
89115
89338
|
if (format === "json") {
|
|
89116
89339
|
outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: `Invalid wallet address: ${userPublicKey}`, retryable: false });
|
|
@@ -89201,11 +89424,11 @@ function createSwapCommand() {
|
|
|
89201
89424
|
|
|
89202
89425
|
// src/cli/commands/positions.ts
|
|
89203
89426
|
var import_bn19 = __toESM(require_bn(), 1);
|
|
89204
|
-
var
|
|
89427
|
+
var import_web3126 = __toESM(require_index_cjs(), 1);
|
|
89205
89428
|
init_solana();
|
|
89206
89429
|
|
|
89207
89430
|
// src/core/transaction.ts
|
|
89208
|
-
var
|
|
89431
|
+
var import_web3125 = __toESM(require_index_cjs(), 1);
|
|
89209
89432
|
init_types();
|
|
89210
89433
|
init_errors();
|
|
89211
89434
|
function serializeTransaction(tx) {
|
|
@@ -89288,7 +89511,7 @@ var KNOWN_SYMBOLS = {
|
|
|
89288
89511
|
async function fetchWalletBalanceSummary(owner) {
|
|
89289
89512
|
const connection = getConnection();
|
|
89290
89513
|
const lamports = await connection.getBalance(owner);
|
|
89291
|
-
const solUi = (lamports /
|
|
89514
|
+
const solUi = (lamports / import_web3126.LAMPORTS_PER_SOL).toString();
|
|
89292
89515
|
const rawAccounts = [];
|
|
89293
89516
|
const [splResult, t22Result] = await Promise.allSettled([
|
|
89294
89517
|
connection.getTokenAccountsByOwner(owner, { programId: TOKEN_PROGRAM_ID }),
|
|
@@ -89300,7 +89523,7 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
89300
89523
|
if (result.status !== "fulfilled") continue;
|
|
89301
89524
|
for (const { account } of result.value.value) {
|
|
89302
89525
|
const data = account.data;
|
|
89303
|
-
const mint = new
|
|
89526
|
+
const mint = new import_web3126.PublicKey(data.subarray(0, 32)).toBase58();
|
|
89304
89527
|
const amount = data.subarray(64, 72).readBigUInt64LE();
|
|
89305
89528
|
if (amount === 0n) continue;
|
|
89306
89529
|
rawAccounts.push({ mint, amount });
|
|
@@ -89311,7 +89534,7 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
89311
89534
|
if (uniqueMints.length > 0) {
|
|
89312
89535
|
for (let i = 0; i < uniqueMints.length; i += 100) {
|
|
89313
89536
|
const batch = uniqueMints.slice(i, i + 100);
|
|
89314
|
-
const mintPubkeys = batch.map((m) => new
|
|
89537
|
+
const mintPubkeys = batch.map((m) => new import_web3126.PublicKey(m));
|
|
89315
89538
|
const mintInfos = await connection.getMultipleAccountsInfo(mintPubkeys);
|
|
89316
89539
|
for (let j = 0; j < batch.length; j++) {
|
|
89317
89540
|
const info = mintInfos[j];
|
|
@@ -89332,11 +89555,11 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
89332
89555
|
}
|
|
89333
89556
|
return { sol: solUi, tokens };
|
|
89334
89557
|
}
|
|
89335
|
-
var ASSOCIATED_TOKEN_PROGRAM = new
|
|
89558
|
+
var ASSOCIATED_TOKEN_PROGRAM = new import_web3126.PublicKey(
|
|
89336
89559
|
"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
89337
89560
|
);
|
|
89338
89561
|
function getAtaAddress(owner, mint, tokenProgramId) {
|
|
89339
|
-
const [address] =
|
|
89562
|
+
const [address] = import_web3126.PublicKey.findProgramAddressSync(
|
|
89340
89563
|
[owner.toBuffer(), tokenProgramId.toBuffer(), mint.toBuffer()],
|
|
89341
89564
|
ASSOCIATED_TOKEN_PROGRAM
|
|
89342
89565
|
);
|
|
@@ -89348,7 +89571,7 @@ async function getTokenBalance(owner, mint) {
|
|
|
89348
89571
|
const lamports = await connection.getBalance(owner);
|
|
89349
89572
|
return new import_bn19.default(lamports.toString());
|
|
89350
89573
|
}
|
|
89351
|
-
const mintPk = new
|
|
89574
|
+
const mintPk = new import_web3126.PublicKey(mint);
|
|
89352
89575
|
const ataSpl = getAtaAddress(owner, mintPk, TOKEN_PROGRAM_ID);
|
|
89353
89576
|
const ataT22 = getAtaAddress(owner, mintPk, TOKEN_2022_PROGRAM_ID);
|
|
89354
89577
|
const [splInfo, t22Info] = await Promise.allSettled([
|
|
@@ -89420,7 +89643,7 @@ function createPositionsOpenCommand() {
|
|
|
89420
89643
|
}
|
|
89421
89644
|
process.exit(1);
|
|
89422
89645
|
}
|
|
89423
|
-
const publicKey3 = new
|
|
89646
|
+
const publicKey3 = new import_web3126.PublicKey(walletAddress);
|
|
89424
89647
|
const useAmountUsd = !!options.amountUsd;
|
|
89425
89648
|
const useTokenAmount = !!options.amount;
|
|
89426
89649
|
if (useAmountUsd && useTokenAmount) {
|
|
@@ -89715,7 +89938,7 @@ function createPositionsIncreaseCommand() {
|
|
|
89715
89938
|
}
|
|
89716
89939
|
process.exit(1);
|
|
89717
89940
|
}
|
|
89718
|
-
const publicKey3 = new
|
|
89941
|
+
const publicKey3 = new import_web3126.PublicKey(walletAddress);
|
|
89719
89942
|
const useAmountUsd = !!options.amountUsd;
|
|
89720
89943
|
const useTokenAmount = !!options.amount;
|
|
89721
89944
|
if (useAmountUsd && useTokenAmount) {
|
|
@@ -89768,7 +89991,7 @@ function createPositionsIncreaseCommand() {
|
|
|
89768
89991
|
getAmountAFromAmountB: getAmountAFromAmountB2
|
|
89769
89992
|
} = await Promise.resolve().then(() => (init_esm4(), esm_exports));
|
|
89770
89993
|
const chain = getChain2();
|
|
89771
|
-
const nftMint = new
|
|
89994
|
+
const nftMint = new import_web3126.PublicKey(options.nftMint);
|
|
89772
89995
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
89773
89996
|
if (!positionInfo) {
|
|
89774
89997
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -90052,11 +90275,11 @@ function createPositionsDecreaseCommand() {
|
|
|
90052
90275
|
}
|
|
90053
90276
|
process.exit(1);
|
|
90054
90277
|
}
|
|
90055
|
-
const publicKey3 = new
|
|
90278
|
+
const publicKey3 = new import_web3126.PublicKey(walletAddress);
|
|
90056
90279
|
try {
|
|
90057
90280
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
90058
90281
|
const chain = getChain2();
|
|
90059
|
-
const nftMint = new
|
|
90282
|
+
const nftMint = new import_web3126.PublicKey(options.nftMint);
|
|
90060
90283
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
90061
90284
|
if (!positionInfo) {
|
|
90062
90285
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -90239,11 +90462,11 @@ function createPositionsCloseCommand() {
|
|
|
90239
90462
|
}
|
|
90240
90463
|
process.exit(1);
|
|
90241
90464
|
}
|
|
90242
|
-
const publicKey3 = new
|
|
90465
|
+
const publicKey3 = new import_web3126.PublicKey(walletAddress);
|
|
90243
90466
|
try {
|
|
90244
90467
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
90245
90468
|
const chain = getChain2();
|
|
90246
|
-
const nftMint = new
|
|
90469
|
+
const nftMint = new import_web3126.PublicKey(options.nftMint);
|
|
90247
90470
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
90248
90471
|
if (!positionInfo) {
|
|
90249
90472
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -90775,7 +90998,7 @@ Error: ${errMsg}`));
|
|
|
90775
90998
|
const pool = poolResult.value;
|
|
90776
90999
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
90777
91000
|
const chain = getChain2();
|
|
90778
|
-
const nftMint = new
|
|
91001
|
+
const nftMint = new import_web3126.PublicKey(nftMintStr);
|
|
90779
91002
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
90780
91003
|
if (!positionInfo) {
|
|
90781
91004
|
const errMsg = `Position not found on-chain for NFT mint: ${nftMintStr}`;
|
|
@@ -90973,9 +91196,9 @@ function createCopyPositionCommand() {
|
|
|
90973
91196
|
}
|
|
90974
91197
|
process.exit(1);
|
|
90975
91198
|
}
|
|
90976
|
-
const publicKey3 = new
|
|
91199
|
+
const publicKey3 = new import_web3126.PublicKey(walletAddress);
|
|
90977
91200
|
try {
|
|
90978
|
-
const positionAddress = new
|
|
91201
|
+
const positionAddress = new import_web3126.PublicKey(options.position);
|
|
90979
91202
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
90980
91203
|
const { calculateTokenAmountsFromUsd: calculateTokenAmountsFromUsd2, getRawPositionInfoByAddress: getRawPositionInfoByAddress2 } = await Promise.resolve().then(() => (init_calculate(), calculate_exports));
|
|
90981
91204
|
const chain = getChain2();
|