@byreal-io/byreal-cli-realclaw 0.3.9 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.cjs +482 -130
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ npm install -g @byreal-io/byreal-cli-realclaw
|
|
|
32
32
|
- **Jupiter** — Swap tokens via Jupiter aggregator, get token prices.
|
|
33
33
|
- **Kamino** — Deposit and withdraw tokens on Kamino Lend for idle yield.
|
|
34
34
|
- **Rent Reclaim** — Close empty SPL token accounts to recover SOL rent.
|
|
35
|
+
- **DFlow** — Swap tokens via DFlow order-flow aggregator with MEV protection.
|
|
35
36
|
- **Token Sweep** — Consolidate dust tokens into USDC (or any target) via Jupiter swap + rent reclaim.
|
|
36
37
|
- **Config** — Configure RPC URL, slippage tolerance, priority fees.
|
|
37
38
|
|
|
@@ -85,11 +86,13 @@ All commands support `-o json` for structured output.
|
|
|
85
86
|
| `wallet balance` | Query wallet balance |
|
|
86
87
|
| `jup swap` | Swap tokens via Jupiter aggregator |
|
|
87
88
|
| `jup price` | Get token price from Jupiter |
|
|
89
|
+
| `kamino reserves` | Show Kamino Lend APY for SOL/USDC/USDT (or a specific token) |
|
|
88
90
|
| `kamino deposit` | Deposit tokens into Kamino Lend |
|
|
89
91
|
| `kamino withdraw` | Withdraw tokens from Kamino Lend |
|
|
90
92
|
| `kamino status` | View Kamino lending positions and yield |
|
|
91
93
|
| `rent reclaim` | Close empty token accounts to recover SOL rent |
|
|
92
94
|
| `sweep execute` | Consolidate dust tokens into target token |
|
|
95
|
+
| `dflow swap` | Swap tokens via DFlow order-flow aggregator |
|
|
93
96
|
| `update check` | Check for CLI updates |
|
|
94
97
|
|
|
95
98
|
## Update
|
package/dist/index.cjs
CHANGED
|
@@ -3029,11 +3029,11 @@ var require_commander = __commonJS({
|
|
|
3029
3029
|
});
|
|
3030
3030
|
|
|
3031
3031
|
// src/core/constants.ts
|
|
3032
|
-
var INJECTED_VERSION, VERSION, CLI_NAME, NPM_PACKAGE, API_BASE_URL, API_ENDPOINTS, SOLANA_RPC_URL, SOLANA_CLUSTER, CONFIG_DIR, CONFIG_FILE, DEFAULTS, TABLE_CHARS, LOGO, EXPERIMENTAL_WARNING, DEFAULT_CONFIG, DIR_PERMISSIONS;
|
|
3032
|
+
var INJECTED_VERSION, VERSION, CLI_NAME, NPM_PACKAGE, API_BASE_URL, API_ENDPOINTS, SOLANA_RPC_URL, SOLANA_CLUSTER, JUP_SWAP_API, JUP_PRICE_API, TITAN_AUTH_TOKEN, DFLOW_API_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.11" : void 0;
|
|
3037
3037
|
VERSION = INJECTED_VERSION ?? process.env.npm_package_version ?? "0.0.0";
|
|
3038
3038
|
CLI_NAME = "byreal-cli";
|
|
3039
3039
|
NPM_PACKAGE = "@byreal-io/byreal-cli-realclaw";
|
|
@@ -3067,6 +3067,11 @@ 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
|
+
JUP_SWAP_API = "https://api.jup.ag/swap/v1";
|
|
3071
|
+
JUP_PRICE_API = "https://api.jup.ag/price/v3";
|
|
3072
|
+
TITAN_AUTH_TOKEN = process.env.TITAN_AUTH_TOKEN;
|
|
3073
|
+
DFLOW_API_URL = "https://dev-quote-api.dflow.net";
|
|
3074
|
+
DFLOW_API_KEY = process.env.DFLOW_API_KEY;
|
|
3070
3075
|
CONFIG_DIR = "~/.config/byreal";
|
|
3071
3076
|
CONFIG_FILE = "config.json";
|
|
3072
3077
|
DEFAULTS = {
|
|
@@ -26985,7 +26990,7 @@ var require_index_cjs = __commonJS({
|
|
|
26985
26990
|
return value._bn !== void 0;
|
|
26986
26991
|
}
|
|
26987
26992
|
var uniquePublicKeyCounter = 1;
|
|
26988
|
-
var
|
|
26993
|
+
var PublicKey49 = class _PublicKey2 extends Struct {
|
|
26989
26994
|
/**
|
|
26990
26995
|
* Create a new PublicKey object
|
|
26991
26996
|
* @param value ed25519 public key as buffer or base-58 encoded string
|
|
@@ -27147,9 +27152,9 @@ var require_index_cjs = __commonJS({
|
|
|
27147
27152
|
return isOnCurve(pubkey.toBytes());
|
|
27148
27153
|
}
|
|
27149
27154
|
};
|
|
27150
|
-
_PublicKey =
|
|
27151
|
-
|
|
27152
|
-
SOLANA_SCHEMA.set(
|
|
27155
|
+
_PublicKey = PublicKey49;
|
|
27156
|
+
PublicKey49.default = new _PublicKey("11111111111111111111111111111111");
|
|
27157
|
+
SOLANA_SCHEMA.set(PublicKey49, {
|
|
27153
27158
|
kind: "struct",
|
|
27154
27159
|
fields: [["_bn", "u256"]]
|
|
27155
27160
|
});
|
|
@@ -27181,7 +27186,7 @@ var require_index_cjs = __commonJS({
|
|
|
27181
27186
|
* The public key for this account
|
|
27182
27187
|
*/
|
|
27183
27188
|
get publicKey() {
|
|
27184
|
-
return new
|
|
27189
|
+
return new PublicKey49(this._publicKey);
|
|
27185
27190
|
}
|
|
27186
27191
|
/**
|
|
27187
27192
|
* The **unencrypted** secret key for this account. The first 32 bytes
|
|
@@ -27192,7 +27197,7 @@ var require_index_cjs = __commonJS({
|
|
|
27192
27197
|
return buffer.Buffer.concat([this._secretKey, this._publicKey], 64);
|
|
27193
27198
|
}
|
|
27194
27199
|
};
|
|
27195
|
-
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new
|
|
27200
|
+
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey49("BPFLoader1111111111111111111111111111111111");
|
|
27196
27201
|
var PACKET_DATA_SIZE = 1280 - 40 - 8;
|
|
27197
27202
|
var VERSION_PREFIX_MASK = 127;
|
|
27198
27203
|
var SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
@@ -27423,7 +27428,7 @@ var require_index_cjs = __commonJS({
|
|
|
27423
27428
|
const [payerAddress] = writableSigners[0];
|
|
27424
27429
|
assert(payerAddress === this.payer.toBase58(), "Expected first writable signer key to be the fee payer");
|
|
27425
27430
|
}
|
|
27426
|
-
const staticAccountKeys = [...writableSigners.map(([address]) => new
|
|
27431
|
+
const staticAccountKeys = [...writableSigners.map(([address]) => new PublicKey49(address)), ...readonlySigners.map(([address]) => new PublicKey49(address)), ...writableNonSigners.map(([address]) => new PublicKey49(address)), ...readonlyNonSigners.map(([address]) => new PublicKey49(address))];
|
|
27427
27432
|
return [header, staticAccountKeys];
|
|
27428
27433
|
}
|
|
27429
27434
|
extractTableLookup(lookupTable) {
|
|
@@ -27447,7 +27452,7 @@ var require_index_cjs = __commonJS({
|
|
|
27447
27452
|
const drainedKeys = new Array();
|
|
27448
27453
|
for (const [address, keyMeta] of this.keyMetaMap.entries()) {
|
|
27449
27454
|
if (keyMetaFilter(keyMeta)) {
|
|
27450
|
-
const key = new
|
|
27455
|
+
const key = new PublicKey49(address);
|
|
27451
27456
|
const lookupTableIndex = lookupTableEntries.findIndex((entry) => entry.equals(key));
|
|
27452
27457
|
if (lookupTableIndex >= 0) {
|
|
27453
27458
|
assert(lookupTableIndex < 256, "Max lookup table index exceeded");
|
|
@@ -27482,7 +27487,7 @@ var require_index_cjs = __commonJS({
|
|
|
27482
27487
|
this.instructions = void 0;
|
|
27483
27488
|
this.indexToProgramIds = /* @__PURE__ */ new Map();
|
|
27484
27489
|
this.header = args.header;
|
|
27485
|
-
this.accountKeys = args.accountKeys.map((account) => new
|
|
27490
|
+
this.accountKeys = args.accountKeys.map((account) => new PublicKey49(account));
|
|
27486
27491
|
this.recentBlockhash = args.recentBlockhash;
|
|
27487
27492
|
this.instructions = args.instructions;
|
|
27488
27493
|
this.instructions.forEach((ix) => this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex]));
|
|
@@ -27608,7 +27613,7 @@ var require_index_cjs = __commonJS({
|
|
|
27608
27613
|
let accountKeys = [];
|
|
27609
27614
|
for (let i = 0; i < accountCount; i++) {
|
|
27610
27615
|
const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2);
|
|
27611
|
-
accountKeys.push(new
|
|
27616
|
+
accountKeys.push(new PublicKey49(buffer.Buffer.from(account)));
|
|
27612
27617
|
}
|
|
27613
27618
|
const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2);
|
|
27614
27619
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -27832,7 +27837,7 @@ var require_index_cjs = __commonJS({
|
|
|
27832
27837
|
const staticAccountKeys = [];
|
|
27833
27838
|
const staticAccountKeysLength = decodeLength(byteArray);
|
|
27834
27839
|
for (let i = 0; i < staticAccountKeysLength; i++) {
|
|
27835
|
-
staticAccountKeys.push(new
|
|
27840
|
+
staticAccountKeys.push(new PublicKey49(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2)));
|
|
27836
27841
|
}
|
|
27837
27842
|
const recentBlockhash = bs58__default.default.encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
27838
27843
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -27852,7 +27857,7 @@ var require_index_cjs = __commonJS({
|
|
|
27852
27857
|
const addressTableLookupsCount = decodeLength(byteArray);
|
|
27853
27858
|
const addressTableLookups = [];
|
|
27854
27859
|
for (let i = 0; i < addressTableLookupsCount; i++) {
|
|
27855
|
-
const accountKey = new
|
|
27860
|
+
const accountKey = new PublicKey49(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
27856
27861
|
const writableIndexesLength = decodeLength(byteArray);
|
|
27857
27862
|
const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);
|
|
27858
27863
|
const readonlyIndexesLength = decodeLength(byteArray);
|
|
@@ -28092,7 +28097,7 @@ var require_index_cjs = __commonJS({
|
|
|
28092
28097
|
});
|
|
28093
28098
|
programIds.forEach((programId) => {
|
|
28094
28099
|
accountMetas.push({
|
|
28095
|
-
pubkey: new
|
|
28100
|
+
pubkey: new PublicKey49(programId),
|
|
28096
28101
|
isSigner: false,
|
|
28097
28102
|
isWritable: false
|
|
28098
28103
|
});
|
|
@@ -28685,15 +28690,15 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
28685
28690
|
var DEFAULT_TICKS_PER_SLOT = 64;
|
|
28686
28691
|
var NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
28687
28692
|
var MS_PER_SLOT = 1e3 / NUM_SLOTS_PER_SECOND;
|
|
28688
|
-
var SYSVAR_CLOCK_PUBKEY2 = new
|
|
28689
|
-
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new
|
|
28690
|
-
var SYSVAR_INSTRUCTIONS_PUBKEY = new
|
|
28691
|
-
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new
|
|
28692
|
-
var SYSVAR_RENT_PUBKEY5 = new
|
|
28693
|
-
var SYSVAR_REWARDS_PUBKEY = new
|
|
28694
|
-
var SYSVAR_SLOT_HASHES_PUBKEY = new
|
|
28695
|
-
var SYSVAR_SLOT_HISTORY_PUBKEY = new
|
|
28696
|
-
var SYSVAR_STAKE_HISTORY_PUBKEY = new
|
|
28693
|
+
var SYSVAR_CLOCK_PUBKEY2 = new PublicKey49("SysvarC1ock11111111111111111111111111111111");
|
|
28694
|
+
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey49("SysvarEpochSchedu1e111111111111111111111111");
|
|
28695
|
+
var SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey49("Sysvar1nstructions1111111111111111111111111");
|
|
28696
|
+
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey49("SysvarRecentB1ockHashes11111111111111111111");
|
|
28697
|
+
var SYSVAR_RENT_PUBKEY5 = new PublicKey49("SysvarRent111111111111111111111111111111111");
|
|
28698
|
+
var SYSVAR_REWARDS_PUBKEY = new PublicKey49("SysvarRewards111111111111111111111111111111");
|
|
28699
|
+
var SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey49("SysvarS1otHashes111111111111111111111111111");
|
|
28700
|
+
var SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey49("SysvarS1otHistory11111111111111111111111111");
|
|
28701
|
+
var SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey49("SysvarStakeHistory1111111111111111111111111");
|
|
28697
28702
|
var SendTransactionError = class extends Error {
|
|
28698
28703
|
constructor({
|
|
28699
28704
|
action,
|
|
@@ -28884,8 +28889,8 @@ Message: ${transactionMessage}.
|
|
|
28884
28889
|
static fromAccountData(buffer2) {
|
|
28885
28890
|
const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer2), 0);
|
|
28886
28891
|
return new _NonceAccount({
|
|
28887
|
-
authorizedPubkey: new
|
|
28888
|
-
nonce: new
|
|
28892
|
+
authorizedPubkey: new PublicKey49(nonceAccount.authorizedPubkey),
|
|
28893
|
+
nonce: new PublicKey49(nonceAccount.nonce).toString(),
|
|
28889
28894
|
feeCalculator: nonceAccount.feeCalculator
|
|
28890
28895
|
});
|
|
28891
28896
|
}
|
|
@@ -28947,7 +28952,7 @@ Message: ${transactionMessage}.
|
|
|
28947
28952
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
28948
28953
|
lamports,
|
|
28949
28954
|
space,
|
|
28950
|
-
programId: new
|
|
28955
|
+
programId: new PublicKey49(programId)
|
|
28951
28956
|
};
|
|
28952
28957
|
}
|
|
28953
28958
|
/**
|
|
@@ -28982,7 +28987,7 @@ Message: ${transactionMessage}.
|
|
|
28982
28987
|
toPubkey: instruction.keys[2].pubkey,
|
|
28983
28988
|
lamports,
|
|
28984
28989
|
seed,
|
|
28985
|
-
programId: new
|
|
28990
|
+
programId: new PublicKey49(programId)
|
|
28986
28991
|
};
|
|
28987
28992
|
}
|
|
28988
28993
|
/**
|
|
@@ -29013,10 +29018,10 @@ Message: ${transactionMessage}.
|
|
|
29013
29018
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed, instruction.data);
|
|
29014
29019
|
return {
|
|
29015
29020
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29016
|
-
basePubkey: new
|
|
29021
|
+
basePubkey: new PublicKey49(base),
|
|
29017
29022
|
seed,
|
|
29018
29023
|
space,
|
|
29019
|
-
programId: new
|
|
29024
|
+
programId: new PublicKey49(programId)
|
|
29020
29025
|
};
|
|
29021
29026
|
}
|
|
29022
29027
|
/**
|
|
@@ -29030,7 +29035,7 @@ Message: ${transactionMessage}.
|
|
|
29030
29035
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign, instruction.data);
|
|
29031
29036
|
return {
|
|
29032
29037
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29033
|
-
programId: new
|
|
29038
|
+
programId: new PublicKey49(programId)
|
|
29034
29039
|
};
|
|
29035
29040
|
}
|
|
29036
29041
|
/**
|
|
@@ -29046,9 +29051,9 @@ Message: ${transactionMessage}.
|
|
|
29046
29051
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed, instruction.data);
|
|
29047
29052
|
return {
|
|
29048
29053
|
accountPubkey: instruction.keys[0].pubkey,
|
|
29049
|
-
basePubkey: new
|
|
29054
|
+
basePubkey: new PublicKey49(base),
|
|
29050
29055
|
seed,
|
|
29051
|
-
programId: new
|
|
29056
|
+
programId: new PublicKey49(programId)
|
|
29052
29057
|
};
|
|
29053
29058
|
}
|
|
29054
29059
|
/**
|
|
@@ -29067,11 +29072,11 @@ Message: ${transactionMessage}.
|
|
|
29067
29072
|
return {
|
|
29068
29073
|
fromPubkey: instruction.keys[0].pubkey,
|
|
29069
29074
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
29070
|
-
basePubkey: new
|
|
29075
|
+
basePubkey: new PublicKey49(base),
|
|
29071
29076
|
seed,
|
|
29072
29077
|
lamports,
|
|
29073
29078
|
space,
|
|
29074
|
-
programId: new
|
|
29079
|
+
programId: new PublicKey49(programId)
|
|
29075
29080
|
};
|
|
29076
29081
|
}
|
|
29077
29082
|
/**
|
|
@@ -29085,7 +29090,7 @@ Message: ${transactionMessage}.
|
|
|
29085
29090
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount, instruction.data);
|
|
29086
29091
|
return {
|
|
29087
29092
|
noncePubkey: instruction.keys[0].pubkey,
|
|
29088
|
-
authorizedPubkey: new
|
|
29093
|
+
authorizedPubkey: new PublicKey49(authorized2)
|
|
29089
29094
|
};
|
|
29090
29095
|
}
|
|
29091
29096
|
/**
|
|
@@ -29128,7 +29133,7 @@ Message: ${transactionMessage}.
|
|
|
29128
29133
|
return {
|
|
29129
29134
|
noncePubkey: instruction.keys[0].pubkey,
|
|
29130
29135
|
authorizedPubkey: instruction.keys[1].pubkey,
|
|
29131
|
-
newAuthorizedPubkey: new
|
|
29136
|
+
newAuthorizedPubkey: new PublicKey49(authorized2)
|
|
29132
29137
|
};
|
|
29133
29138
|
}
|
|
29134
29139
|
/**
|
|
@@ -29537,7 +29542,7 @@ Message: ${transactionMessage}.
|
|
|
29537
29542
|
});
|
|
29538
29543
|
}
|
|
29539
29544
|
};
|
|
29540
|
-
SystemProgram13.programId = new
|
|
29545
|
+
SystemProgram13.programId = new PublicKey49("11111111111111111111111111111111");
|
|
29541
29546
|
var CHUNK_SIZE = PACKET_DATA_SIZE - 300;
|
|
29542
29547
|
var Loader = class _Loader {
|
|
29543
29548
|
/**
|
|
@@ -29704,7 +29709,7 @@ Message: ${transactionMessage}.
|
|
|
29704
29709
|
}
|
|
29705
29710
|
};
|
|
29706
29711
|
Loader.chunkSize = CHUNK_SIZE;
|
|
29707
|
-
var BPF_LOADER_PROGRAM_ID = new
|
|
29712
|
+
var BPF_LOADER_PROGRAM_ID = new PublicKey49("BPFLoader2111111111111111111111111111111111");
|
|
29708
29713
|
var BpfLoader = class {
|
|
29709
29714
|
/**
|
|
29710
29715
|
* Minimum number of signatures required to load a program not including
|
|
@@ -30500,8 +30505,8 @@ Message: ${transactionMessage}.
|
|
|
30500
30505
|
deactivationSlot: meta.deactivationSlot,
|
|
30501
30506
|
lastExtendedSlot: meta.lastExtendedSlot,
|
|
30502
30507
|
lastExtendedSlotStartIndex: meta.lastExtendedStartIndex,
|
|
30503
|
-
authority: meta.authority.length !== 0 ? new
|
|
30504
|
-
addresses: addresses.map((address) => new
|
|
30508
|
+
authority: meta.authority.length !== 0 ? new PublicKey49(meta.authority[0]) : void 0,
|
|
30509
|
+
addresses: addresses.map((address) => new PublicKey49(address))
|
|
30505
30510
|
};
|
|
30506
30511
|
}
|
|
30507
30512
|
};
|
|
@@ -30543,7 +30548,7 @@ Message: ${transactionMessage}.
|
|
|
30543
30548
|
);
|
|
30544
30549
|
return `${protocol}//${hostish}${websocketPort}${rest}`;
|
|
30545
30550
|
}
|
|
30546
|
-
var PublicKeyFromString = superstruct.coerce(superstruct.instance(
|
|
30551
|
+
var PublicKeyFromString = superstruct.coerce(superstruct.instance(PublicKey49), superstruct.string(), (value) => new PublicKey49(value));
|
|
30547
30552
|
var RawAccountDataResult = superstruct.tuple([superstruct.string(), superstruct.literal("base64")]);
|
|
30548
30553
|
var BufferFromRawAccountData = superstruct.coerce(superstruct.instance(buffer.Buffer), RawAccountDataResult, (value) => buffer.Buffer.from(value[0], "base64"));
|
|
30549
30554
|
var BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1e3;
|
|
@@ -30628,7 +30633,7 @@ Message: ${transactionMessage}.
|
|
|
30628
30633
|
if (version2 === 0) {
|
|
30629
30634
|
return new MessageV0({
|
|
30630
30635
|
header: response.header,
|
|
30631
|
-
staticAccountKeys: response.accountKeys.map((accountKey) => new
|
|
30636
|
+
staticAccountKeys: response.accountKeys.map((accountKey) => new PublicKey49(accountKey)),
|
|
30632
30637
|
recentBlockhash: response.recentBlockhash,
|
|
30633
30638
|
compiledInstructions: response.instructions.map((ix) => ({
|
|
30634
30639
|
programIdIndex: ix.programIdIndex,
|
|
@@ -34068,7 +34073,7 @@ Message: ${transactionMessage}.
|
|
|
34068
34073
|
* @returns {PublicKey} PublicKey
|
|
34069
34074
|
*/
|
|
34070
34075
|
get publicKey() {
|
|
34071
|
-
return new
|
|
34076
|
+
return new PublicKey49(this._keypair.publicKey);
|
|
34072
34077
|
}
|
|
34073
34078
|
/**
|
|
34074
34079
|
* The raw secret key for this keypair
|
|
@@ -34146,7 +34151,7 @@ Message: ${transactionMessage}.
|
|
|
34146
34151
|
lookupTable: instruction.keys[0].pubkey,
|
|
34147
34152
|
authority: instruction.keys[1].pubkey,
|
|
34148
34153
|
payer: instruction.keys.length > 2 ? instruction.keys[2].pubkey : void 0,
|
|
34149
|
-
addresses: addresses.map((buffer2) => new
|
|
34154
|
+
addresses: addresses.map((buffer2) => new PublicKey49(buffer2))
|
|
34150
34155
|
};
|
|
34151
34156
|
}
|
|
34152
34157
|
static decodeCloseLookupTable(instruction) {
|
|
@@ -34198,7 +34203,7 @@ Message: ${transactionMessage}.
|
|
|
34198
34203
|
constructor() {
|
|
34199
34204
|
}
|
|
34200
34205
|
static createLookupTable(params) {
|
|
34201
|
-
const [lookupTableAddress, bumpSeed] =
|
|
34206
|
+
const [lookupTableAddress, bumpSeed] = PublicKey49.findProgramAddressSync([params.authority.toBuffer(), codecsNumbers.getU64Encoder().encode(params.recentSlot)], this.programId);
|
|
34202
34207
|
const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable;
|
|
34203
34208
|
const data = encodeData(type, {
|
|
34204
34209
|
recentSlot: BigInt(params.recentSlot),
|
|
@@ -34317,7 +34322,7 @@ Message: ${transactionMessage}.
|
|
|
34317
34322
|
});
|
|
34318
34323
|
}
|
|
34319
34324
|
};
|
|
34320
|
-
AddressLookupTableProgram.programId = new
|
|
34325
|
+
AddressLookupTableProgram.programId = new PublicKey49("AddressLookupTab1e1111111111111111111111111");
|
|
34321
34326
|
var ComputeBudgetInstruction = class {
|
|
34322
34327
|
/**
|
|
34323
34328
|
* @internal
|
|
@@ -34471,7 +34476,7 @@ Message: ${transactionMessage}.
|
|
|
34471
34476
|
});
|
|
34472
34477
|
}
|
|
34473
34478
|
};
|
|
34474
|
-
ComputeBudgetProgram3.programId = new
|
|
34479
|
+
ComputeBudgetProgram3.programId = new PublicKey49("ComputeBudget111111111111111111111111111111");
|
|
34475
34480
|
var PRIVATE_KEY_BYTES$1 = 64;
|
|
34476
34481
|
var PUBLIC_KEY_BYTES$1 = 32;
|
|
34477
34482
|
var SIGNATURE_BYTES = 64;
|
|
@@ -34551,7 +34556,7 @@ Message: ${transactionMessage}.
|
|
|
34551
34556
|
}
|
|
34552
34557
|
}
|
|
34553
34558
|
};
|
|
34554
|
-
Ed25519Program.programId = new
|
|
34559
|
+
Ed25519Program.programId = new PublicKey49("Ed25519SigVerify111111111111111111111111111");
|
|
34555
34560
|
var ecdsaSign = (msgHash, privKey) => {
|
|
34556
34561
|
const signature2 = secp256k1.secp256k1.sign(msgHash, privKey);
|
|
34557
34562
|
return [signature2.toCompactRawBytes(), signature2.recovery];
|
|
@@ -34685,9 +34690,9 @@ Message: ${transactionMessage}.
|
|
|
34685
34690
|
}
|
|
34686
34691
|
}
|
|
34687
34692
|
};
|
|
34688
|
-
Secp256k1Program.programId = new
|
|
34693
|
+
Secp256k1Program.programId = new PublicKey49("KeccakSecp256k11111111111111111111111111111");
|
|
34689
34694
|
var _Lockup;
|
|
34690
|
-
var STAKE_CONFIG_ID = new
|
|
34695
|
+
var STAKE_CONFIG_ID = new PublicKey49("StakeConfig11111111111111111111111111111111");
|
|
34691
34696
|
var Authorized = class {
|
|
34692
34697
|
/**
|
|
34693
34698
|
* Create a new Authorized object
|
|
@@ -34718,7 +34723,7 @@ Message: ${transactionMessage}.
|
|
|
34718
34723
|
*/
|
|
34719
34724
|
};
|
|
34720
34725
|
_Lockup = Lockup;
|
|
34721
|
-
Lockup.default = new _Lockup(0, 0,
|
|
34726
|
+
Lockup.default = new _Lockup(0, 0, PublicKey49.default);
|
|
34722
34727
|
var StakeInstruction = class {
|
|
34723
34728
|
/**
|
|
34724
34729
|
* @internal
|
|
@@ -34756,8 +34761,8 @@ Message: ${transactionMessage}.
|
|
|
34756
34761
|
} = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Initialize, instruction.data);
|
|
34757
34762
|
return {
|
|
34758
34763
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34759
|
-
authorized: new Authorized(new
|
|
34760
|
-
lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new
|
|
34764
|
+
authorized: new Authorized(new PublicKey49(authorized2.staker), new PublicKey49(authorized2.withdrawer)),
|
|
34765
|
+
lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new PublicKey49(lockup2.custodian))
|
|
34761
34766
|
};
|
|
34762
34767
|
}
|
|
34763
34768
|
/**
|
|
@@ -34786,7 +34791,7 @@ Message: ${transactionMessage}.
|
|
|
34786
34791
|
const o = {
|
|
34787
34792
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34788
34793
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
34789
|
-
newAuthorizedPubkey: new
|
|
34794
|
+
newAuthorizedPubkey: new PublicKey49(newAuthorized),
|
|
34790
34795
|
stakeAuthorizationType: {
|
|
34791
34796
|
index: stakeAuthorizationType
|
|
34792
34797
|
}
|
|
@@ -34812,8 +34817,8 @@ Message: ${transactionMessage}.
|
|
|
34812
34817
|
stakePubkey: instruction.keys[0].pubkey,
|
|
34813
34818
|
authorityBase: instruction.keys[1].pubkey,
|
|
34814
34819
|
authoritySeed,
|
|
34815
|
-
authorityOwner: new
|
|
34816
|
-
newAuthorizedPubkey: new
|
|
34820
|
+
authorityOwner: new PublicKey49(authorityOwner),
|
|
34821
|
+
newAuthorizedPubkey: new PublicKey49(newAuthorized),
|
|
34817
34822
|
stakeAuthorizationType: {
|
|
34818
34823
|
index: stakeAuthorizationType
|
|
34819
34824
|
}
|
|
@@ -35367,7 +35372,7 @@ Message: ${transactionMessage}.
|
|
|
35367
35372
|
});
|
|
35368
35373
|
}
|
|
35369
35374
|
};
|
|
35370
|
-
StakeProgram.programId = new
|
|
35375
|
+
StakeProgram.programId = new PublicKey49("Stake11111111111111111111111111111111111111");
|
|
35371
35376
|
StakeProgram.space = 200;
|
|
35372
35377
|
var VoteInit = class {
|
|
35373
35378
|
/** [0, 100] */
|
|
@@ -35419,7 +35424,7 @@ Message: ${transactionMessage}.
|
|
|
35419
35424
|
return {
|
|
35420
35425
|
votePubkey: instruction.keys[0].pubkey,
|
|
35421
35426
|
nodePubkey: instruction.keys[3].pubkey,
|
|
35422
|
-
voteInit: new VoteInit(new
|
|
35427
|
+
voteInit: new VoteInit(new PublicKey49(voteInit2.nodePubkey), new PublicKey49(voteInit2.authorizedVoter), new PublicKey49(voteInit2.authorizedWithdrawer), voteInit2.commission)
|
|
35423
35428
|
};
|
|
35424
35429
|
}
|
|
35425
35430
|
/**
|
|
@@ -35435,7 +35440,7 @@ Message: ${transactionMessage}.
|
|
|
35435
35440
|
return {
|
|
35436
35441
|
votePubkey: instruction.keys[0].pubkey,
|
|
35437
35442
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
35438
|
-
newAuthorizedPubkey: new
|
|
35443
|
+
newAuthorizedPubkey: new PublicKey49(newAuthorized),
|
|
35439
35444
|
voteAuthorizationType: {
|
|
35440
35445
|
index: voteAuthorizationType
|
|
35441
35446
|
}
|
|
@@ -35457,9 +35462,9 @@ Message: ${transactionMessage}.
|
|
|
35457
35462
|
} = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data);
|
|
35458
35463
|
return {
|
|
35459
35464
|
currentAuthorityDerivedKeyBasePubkey: instruction.keys[2].pubkey,
|
|
35460
|
-
currentAuthorityDerivedKeyOwnerPubkey: new
|
|
35465
|
+
currentAuthorityDerivedKeyOwnerPubkey: new PublicKey49(currentAuthorityDerivedKeyOwnerPubkey),
|
|
35461
35466
|
currentAuthorityDerivedKeySeed,
|
|
35462
|
-
newAuthorizedPubkey: new
|
|
35467
|
+
newAuthorizedPubkey: new PublicKey49(newAuthorized),
|
|
35463
35468
|
voteAuthorizationType: {
|
|
35464
35469
|
index: voteAuthorizationType
|
|
35465
35470
|
},
|
|
@@ -35750,9 +35755,9 @@ Message: ${transactionMessage}.
|
|
|
35750
35755
|
});
|
|
35751
35756
|
}
|
|
35752
35757
|
};
|
|
35753
|
-
VoteProgram.programId = new
|
|
35758
|
+
VoteProgram.programId = new PublicKey49("Vote111111111111111111111111111111111111111");
|
|
35754
35759
|
VoteProgram.space = 3762;
|
|
35755
|
-
var VALIDATOR_INFO_KEY = new
|
|
35760
|
+
var VALIDATOR_INFO_KEY = new PublicKey49("Va1idator1nfo111111111111111111111111111111");
|
|
35756
35761
|
var InfoString = superstruct.type({
|
|
35757
35762
|
name: superstruct.string(),
|
|
35758
35763
|
website: superstruct.optional(superstruct.string()),
|
|
@@ -35786,7 +35791,7 @@ Message: ${transactionMessage}.
|
|
|
35786
35791
|
if (configKeyCount !== 2) return null;
|
|
35787
35792
|
const configKeys = [];
|
|
35788
35793
|
for (let i = 0; i < 2; i++) {
|
|
35789
|
-
const publicKey4 = new
|
|
35794
|
+
const publicKey4 = new PublicKey49(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
|
|
35790
35795
|
const isSigner = guardedShift(byteArray) === 1;
|
|
35791
35796
|
configKeys.push({
|
|
35792
35797
|
publicKey: publicKey4,
|
|
@@ -35804,7 +35809,7 @@ Message: ${transactionMessage}.
|
|
|
35804
35809
|
return null;
|
|
35805
35810
|
}
|
|
35806
35811
|
};
|
|
35807
|
-
var VOTE_PROGRAM_ID = new
|
|
35812
|
+
var VOTE_PROGRAM_ID = new PublicKey49("Vote111111111111111111111111111111111111111");
|
|
35808
35813
|
var VoteAccountLayout = BufferLayout__namespace.struct([
|
|
35809
35814
|
publicKey3("nodePubkey"),
|
|
35810
35815
|
publicKey3("authorizedWithdrawer"),
|
|
@@ -35861,8 +35866,8 @@ Message: ${transactionMessage}.
|
|
|
35861
35866
|
rootSlot = null;
|
|
35862
35867
|
}
|
|
35863
35868
|
return new _VoteAccount({
|
|
35864
|
-
nodePubkey: new
|
|
35865
|
-
authorizedWithdrawer: new
|
|
35869
|
+
nodePubkey: new PublicKey49(va.nodePubkey),
|
|
35870
|
+
authorizedWithdrawer: new PublicKey49(va.authorizedWithdrawer),
|
|
35866
35871
|
commission: va.commission,
|
|
35867
35872
|
votes: va.votes,
|
|
35868
35873
|
rootSlot,
|
|
@@ -35879,7 +35884,7 @@ Message: ${transactionMessage}.
|
|
|
35879
35884
|
}) {
|
|
35880
35885
|
return {
|
|
35881
35886
|
epoch,
|
|
35882
|
-
authorizedVoter: new
|
|
35887
|
+
authorizedVoter: new PublicKey49(authorizedVoter)
|
|
35883
35888
|
};
|
|
35884
35889
|
}
|
|
35885
35890
|
function parsePriorVoters({
|
|
@@ -35888,7 +35893,7 @@ Message: ${transactionMessage}.
|
|
|
35888
35893
|
targetEpoch
|
|
35889
35894
|
}) {
|
|
35890
35895
|
return {
|
|
35891
|
-
authorizedPubkey: new
|
|
35896
|
+
authorizedPubkey: new PublicKey49(authorizedPubkey),
|
|
35892
35897
|
epochOfLastAuthorizedSwitch,
|
|
35893
35898
|
targetEpoch
|
|
35894
35899
|
};
|
|
@@ -35990,7 +35995,7 @@ Message: ${transactionMessage}.
|
|
|
35990
35995
|
exports2.NonceAccount = NonceAccount;
|
|
35991
35996
|
exports2.PACKET_DATA_SIZE = PACKET_DATA_SIZE;
|
|
35992
35997
|
exports2.PUBLIC_KEY_LENGTH = PUBLIC_KEY_LENGTH2;
|
|
35993
|
-
exports2.PublicKey =
|
|
35998
|
+
exports2.PublicKey = PublicKey49;
|
|
35994
35999
|
exports2.SIGNATURE_LENGTH_IN_BYTES = SIGNATURE_LENGTH_IN_BYTES;
|
|
35995
36000
|
exports2.SOLANA_SCHEMA = SOLANA_SCHEMA;
|
|
35996
36001
|
exports2.STAKE_CONFIG_ID = STAKE_CONFIG_ID;
|
|
@@ -39769,7 +39774,7 @@ var require_table = __commonJS({
|
|
|
39769
39774
|
var debug = require_debug();
|
|
39770
39775
|
var utils = require_utils4();
|
|
39771
39776
|
var tableLayout = require_layout_manager();
|
|
39772
|
-
var
|
|
39777
|
+
var Table8 = class extends Array {
|
|
39773
39778
|
constructor(opts) {
|
|
39774
39779
|
super();
|
|
39775
39780
|
const options = utils.mergeOptions(opts);
|
|
@@ -39844,7 +39849,7 @@ var require_table = __commonJS({
|
|
|
39844
39849
|
return str[0].length;
|
|
39845
39850
|
}
|
|
39846
39851
|
};
|
|
39847
|
-
|
|
39852
|
+
Table8.reset = () => debug.reset();
|
|
39848
39853
|
function doDraw(row, lineNum, result) {
|
|
39849
39854
|
let line = [];
|
|
39850
39855
|
row.forEach(function(cell) {
|
|
@@ -39853,7 +39858,7 @@ var require_table = __commonJS({
|
|
|
39853
39858
|
let str = line.join("");
|
|
39854
39859
|
if (str.length) result.push(str);
|
|
39855
39860
|
}
|
|
39856
|
-
module2.exports =
|
|
39861
|
+
module2.exports = Table8;
|
|
39857
39862
|
}
|
|
39858
39863
|
});
|
|
39859
39864
|
|
|
@@ -84350,11 +84355,13 @@ byreal-cli catalog show dex.pool.list
|
|
|
84350
84355
|
| update.install | Install latest CLI version |
|
|
84351
84356
|
| defi.jup.swap | Swap tokens via Jupiter aggregator |
|
|
84352
84357
|
| defi.jup.price | Get token prices from Jupiter |
|
|
84358
|
+
| defi.kamino.reserves | Show Kamino Lend APY for SOL/USDC/USDT (or a specific --token) |
|
|
84353
84359
|
| defi.kamino.deposit | Deposit to Kamino Lend |
|
|
84354
84360
|
| defi.kamino.withdraw | Withdraw from Kamino Lend |
|
|
84355
84361
|
| defi.kamino.status | View Kamino positions and APY |
|
|
84356
84362
|
| defi.rent.reclaim | Close empty accounts to reclaim SOL rent |
|
|
84357
84363
|
| defi.sweep.execute | Consolidate dust tokens into USDC |
|
|
84364
|
+
| defi.dflow.swap | Swap tokens via DFlow order-flow aggregator |
|
|
84358
84365
|
|
|
84359
84366
|
## Global Options
|
|
84360
84367
|
|
|
@@ -84424,11 +84431,15 @@ Present on-chain data first, then external context, then synthesize how external
|
|
|
84424
84431
|
| Jupiter swap preview | \`byreal-cli jup swap --input-mint <mint> --output-mint <mint> --amount <amt> --dry-run --wallet-address <addr>\` |
|
|
84425
84432
|
| Jupiter swap execute | \`byreal-cli jup swap --input-mint <mint> --output-mint <mint> --amount <amt> --wallet-address <addr>\` |
|
|
84426
84433
|
| Jupiter token price | \`byreal-cli jup price --mint <mint>\` |
|
|
84434
|
+
| Kamino APY (SOL/USDC/USDT) | \`byreal-cli kamino reserves\` |
|
|
84435
|
+
| Kamino APY (specific token) | \`byreal-cli kamino reserves --token <symbol|mint>\` |
|
|
84427
84436
|
| Kamino deposit | \`byreal-cli kamino deposit --amount <amt> --wallet-address <addr>\` |
|
|
84428
84437
|
| Kamino withdraw | \`byreal-cli kamino withdraw --amount <amt> --wallet-address <addr>\` |
|
|
84429
84438
|
| Kamino status | \`byreal-cli kamino status --wallet-address <addr>\` |
|
|
84430
84439
|
| Rent reclaim scan | \`byreal-cli rent reclaim --dry-run --wallet-address <addr>\` |
|
|
84431
84440
|
| Rent reclaim execute | \`byreal-cli rent reclaim --wallet-address <addr>\` |
|
|
84441
|
+
| DFlow swap preview | \`byreal-cli dflow swap --input-mint <mint> --output-mint <mint> --amount <amt> --dry-run --wallet-address <addr>\` |
|
|
84442
|
+
| DFlow swap execute | \`byreal-cli dflow swap --input-mint <mint> --output-mint <mint> --amount <amt> --wallet-address <addr>\` |
|
|
84432
84443
|
| Sweep dust preview | \`byreal-cli sweep execute --dry-run --wallet-address <addr>\` |
|
|
84433
84444
|
| Sweep dust execute | \`byreal-cli sweep execute --wallet-address <addr>\` |
|
|
84434
84445
|
|
|
@@ -84544,21 +84555,26 @@ When user asks vague questions like "\u6709\u4EC0\u4E48\u4ED3\u4F4D\u53EF\u4EE5
|
|
|
84544
84555
|
- If all positions in a pool are out-of-range, skip that pool and explain why
|
|
84545
84556
|
- To inspect a specific LP's full portfolio: \`byreal-cli positions list --user <wallet-address> -o json\`
|
|
84546
84557
|
|
|
84547
|
-
##
|
|
84558
|
+
## Swap Routing Priority
|
|
84548
84559
|
|
|
84549
|
-
|
|
84550
|
-
1. **Preview**: \`byreal-cli jup swap --input-mint <mint> --output-mint <mint> --amount <amt> --dry-run --wallet-address <addr>\`
|
|
84551
|
-
2. **Execute**: Remove \`--dry-run\` to generate the unsigned transaction
|
|
84552
|
-
3. Output: \`{ unsignedTransactions: [base64] }\`
|
|
84560
|
+
Default to \`byreal-cli swap execute\`. Fall back to \`jup swap\` / \`dflow swap\` only if Byreal returns no route, or the user names an aggregator explicitly.
|
|
84553
84561
|
|
|
84554
|
-
|
|
84562
|
+
## Workflow: Jupiter / DFlow Swap
|
|
84563
|
+
|
|
84564
|
+
\`\`\`
|
|
84565
|
+
byreal-cli jup swap --input-mint <mint> --output-mint <mint> --amount <amt> [--dry-run] --wallet-address <addr>
|
|
84566
|
+
byreal-cli dflow swap --input-mint <mint> --output-mint <mint> --amount <amt> [--dry-run] --wallet-address <addr>
|
|
84567
|
+
\`\`\`
|
|
84568
|
+
|
|
84569
|
+
Output: \`{ unsignedTransactions: [base64] }\`. DFlow optionally reads \`DFLOW_API_KEY\`.
|
|
84555
84570
|
|
|
84556
84571
|
## Workflow: Idle Yield with Kamino
|
|
84557
84572
|
|
|
84558
84573
|
When user wants to earn yield on idle tokens (e.g. USDC):
|
|
84559
|
-
1. **Check
|
|
84560
|
-
2. **
|
|
84561
|
-
3. **
|
|
84574
|
+
1. **Check APY**: \`byreal-cli kamino reserves\` \u2014 shows the supply/borrow APY for SOL, USDC, USDT. For any other token, pass \`--token <symbol|mint>\` (e.g. \`--token JitoSOL\`). This is an aid, not a browser \u2014 do not attempt to list every reserve.
|
|
84575
|
+
2. **Check status**: \`byreal-cli kamino status --wallet-address <addr>\` \u2014 view current positions and APY
|
|
84576
|
+
3. **Deposit**: \`byreal-cli kamino deposit --amount <amt> --wallet-address <addr>\` \u2014 deposit USDC (default) or specify \`--mint <mint>\` for other tokens
|
|
84577
|
+
4. **Withdraw**: \`byreal-cli kamino withdraw --amount <amt> --wallet-address <addr>\` \u2014 withdraw back to wallet
|
|
84562
84578
|
|
|
84563
84579
|
Default market: Kamino Main Market. Use \`--market <address>\` for a different market.
|
|
84564
84580
|
|
|
@@ -84609,7 +84625,7 @@ function createSkillCommand() {
|
|
|
84609
84625
|
}
|
|
84610
84626
|
|
|
84611
84627
|
// src/cli/commands/catalog.ts
|
|
84612
|
-
var
|
|
84628
|
+
var import_cli_table37 = __toESM(require_cli_table3(), 1);
|
|
84613
84629
|
init_constants();
|
|
84614
84630
|
|
|
84615
84631
|
// src/plugins/jupiter/commands.ts
|
|
@@ -84679,8 +84695,7 @@ init_constants();
|
|
|
84679
84695
|
// src/plugins/jupiter/api.ts
|
|
84680
84696
|
init_types();
|
|
84681
84697
|
init_errors();
|
|
84682
|
-
|
|
84683
|
-
var JUP_PRICE_API = "https://api.jup.ag/price/v3";
|
|
84698
|
+
init_constants();
|
|
84684
84699
|
async function getQuote(params) {
|
|
84685
84700
|
try {
|
|
84686
84701
|
const searchParams = new URLSearchParams({
|
|
@@ -84999,23 +85014,43 @@ function sfToRaw(valueSf) {
|
|
|
84999
85014
|
return "0";
|
|
85000
85015
|
}
|
|
85001
85016
|
}
|
|
85002
|
-
|
|
85017
|
+
function toReserveMetrics(r) {
|
|
85018
|
+
const totalSupplyUsd = parseFloat(r.totalSupplyUsd) || 0;
|
|
85019
|
+
const totalBorrowUsd = parseFloat(r.totalBorrowUsd) || 0;
|
|
85020
|
+
return {
|
|
85021
|
+
reserveAddress: r.reserve,
|
|
85022
|
+
mintAddress: r.liquidityTokenMint,
|
|
85023
|
+
symbol: r.liquidityToken,
|
|
85024
|
+
supplyApy: parseFloat(r.supplyApy) || 0,
|
|
85025
|
+
borrowApy: parseFloat(r.borrowApy) || 0,
|
|
85026
|
+
totalSupplyUsd,
|
|
85027
|
+
totalBorrowUsd,
|
|
85028
|
+
utilization: totalSupplyUsd > 0 ? totalBorrowUsd / totalSupplyUsd : 0,
|
|
85029
|
+
maxLtv: parseFloat(r.maxLtv) || 0
|
|
85030
|
+
};
|
|
85031
|
+
}
|
|
85032
|
+
async function getReservesMetrics(market) {
|
|
85003
85033
|
try {
|
|
85004
85034
|
const response = await fetch(`${KAMINO_API}/kamino-market/${market}/reserves/metrics`);
|
|
85005
|
-
if (!response.ok)
|
|
85006
|
-
|
|
85007
|
-
|
|
85008
|
-
for (const r of data) {
|
|
85009
|
-
result[r.reserve] = {
|
|
85010
|
-
supplyApy: parseFloat(r.supplyApy) || 0,
|
|
85011
|
-
borrowApy: parseFloat(r.borrowApy) || 0
|
|
85012
|
-
};
|
|
85035
|
+
if (!response.ok) {
|
|
85036
|
+
const text = await response.text();
|
|
85037
|
+
return err(apiError(`Kamino reserves metrics failed: ${text}`, response.status));
|
|
85013
85038
|
}
|
|
85014
|
-
|
|
85015
|
-
|
|
85016
|
-
|
|
85039
|
+
const data = await response.json();
|
|
85040
|
+
return ok(data.map(toReserveMetrics));
|
|
85041
|
+
} catch (error) {
|
|
85042
|
+
return err(networkError(`Kamino reserves metrics: ${error.message}`));
|
|
85017
85043
|
}
|
|
85018
85044
|
}
|
|
85045
|
+
async function getReserveApyMap(market) {
|
|
85046
|
+
const result = await getReservesMetrics(market);
|
|
85047
|
+
if (!result.ok) return {};
|
|
85048
|
+
const map = {};
|
|
85049
|
+
for (const r of result.value) {
|
|
85050
|
+
map[r.reserveAddress] = { supplyApy: r.supplyApy, borrowApy: r.borrowApy };
|
|
85051
|
+
}
|
|
85052
|
+
return map;
|
|
85053
|
+
}
|
|
85019
85054
|
async function getExchangeRate(market, reserve) {
|
|
85020
85055
|
try {
|
|
85021
85056
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -85054,7 +85089,7 @@ async function enrichObligations(rawObligations, market) {
|
|
|
85054
85089
|
}
|
|
85055
85090
|
const [priceResult, reserveMetrics, ...exchangeRateResults] = await Promise.all([
|
|
85056
85091
|
mintsToPrice.size > 0 ? getPrice([...mintsToPrice]) : Promise.resolve({ ok: false, error: null }),
|
|
85057
|
-
|
|
85092
|
+
getReserveApyMap(market),
|
|
85058
85093
|
...[...activeReserves].map((r) => getExchangeRate(market, r).then((rate) => ({ reserve: r, rate })))
|
|
85059
85094
|
]);
|
|
85060
85095
|
const prices = priceResult.ok ? priceResult.value : {};
|
|
@@ -85265,6 +85300,88 @@ Error: ${message}`));
|
|
|
85265
85300
|
}
|
|
85266
85301
|
});
|
|
85267
85302
|
}
|
|
85303
|
+
var DEFAULT_RESERVE_SYMBOLS = ["SOL", "USDC", "USDT"];
|
|
85304
|
+
function formatUsdThousands(value) {
|
|
85305
|
+
return `$${value.toLocaleString("en-US", { maximumFractionDigits: 2 })}`;
|
|
85306
|
+
}
|
|
85307
|
+
function createKaminoReservesCommand() {
|
|
85308
|
+
return new Command("reserves").description("Show Kamino Lend supply/borrow APY for SOL, USDC, USDT (or a specific --token)").option("--market <address>", "Market address", KAMINO_MAIN_MARKET).option("--token <symbolOrMint>", "Query a single token by symbol (e.g. JitoSOL) or mint address instead of the default set").action(async (options, cmdObj) => {
|
|
85309
|
+
const globalOptions = cmdObj.optsWithGlobals();
|
|
85310
|
+
const format = globalOptions.output;
|
|
85311
|
+
const startTime = Date.now();
|
|
85312
|
+
try {
|
|
85313
|
+
const result = await getReservesMetrics(options.market);
|
|
85314
|
+
if (!result.ok) {
|
|
85315
|
+
format === "json" ? outputErrorJson(result.error) : outputErrorTable(result.error);
|
|
85316
|
+
process.exit(1);
|
|
85317
|
+
}
|
|
85318
|
+
const all = result.value;
|
|
85319
|
+
let reserves;
|
|
85320
|
+
if (options.token) {
|
|
85321
|
+
const needle = String(options.token).trim();
|
|
85322
|
+
const bySymbol = all.filter((r) => r.symbol.toLowerCase() === needle.toLowerCase());
|
|
85323
|
+
const byMint = all.filter((r) => r.mintAddress === needle);
|
|
85324
|
+
reserves = bySymbol.length > 0 ? bySymbol : byMint;
|
|
85325
|
+
if (reserves.length === 0) {
|
|
85326
|
+
const msg = `Token "${needle}" not found in Kamino market ${options.market}. Pass a valid symbol (e.g. JitoSOL) or mint address.`;
|
|
85327
|
+
format === "json" ? outputErrorJson({ code: "NOT_FOUND", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
85328
|
+
Error: ${msg}`));
|
|
85329
|
+
process.exit(1);
|
|
85330
|
+
}
|
|
85331
|
+
} else {
|
|
85332
|
+
const order = new Map(DEFAULT_RESERVE_SYMBOLS.map((s, i) => [s, i]));
|
|
85333
|
+
reserves = all.filter((r) => order.has(r.symbol)).sort((a, b) => (order.get(a.symbol) ?? 0) - (order.get(b.symbol) ?? 0));
|
|
85334
|
+
}
|
|
85335
|
+
if (format === "json") {
|
|
85336
|
+
outputJson({
|
|
85337
|
+
market: options.market,
|
|
85338
|
+
query: options.token ?? "default",
|
|
85339
|
+
total: reserves.length,
|
|
85340
|
+
reserves
|
|
85341
|
+
}, startTime);
|
|
85342
|
+
return;
|
|
85343
|
+
}
|
|
85344
|
+
const table = new import_cli_table33.default({
|
|
85345
|
+
head: [
|
|
85346
|
+
source_default.cyan.bold("Token"),
|
|
85347
|
+
source_default.cyan.bold("Supply APY"),
|
|
85348
|
+
source_default.cyan.bold("Borrow APY"),
|
|
85349
|
+
source_default.cyan.bold("TVL (USD)"),
|
|
85350
|
+
source_default.cyan.bold("Borrowed (USD)"),
|
|
85351
|
+
source_default.cyan.bold("Utilization"),
|
|
85352
|
+
source_default.cyan.bold("Max LTV"),
|
|
85353
|
+
source_default.cyan.bold("Mint"),
|
|
85354
|
+
source_default.cyan.bold("Reserve")
|
|
85355
|
+
],
|
|
85356
|
+
chars: TABLE_CHARS
|
|
85357
|
+
});
|
|
85358
|
+
for (const r of reserves) {
|
|
85359
|
+
table.push([
|
|
85360
|
+
r.symbol,
|
|
85361
|
+
`${(r.supplyApy * 100).toFixed(2)}%`,
|
|
85362
|
+
`${(r.borrowApy * 100).toFixed(2)}%`,
|
|
85363
|
+
formatUsdThousands(r.totalSupplyUsd),
|
|
85364
|
+
formatUsdThousands(r.totalBorrowUsd),
|
|
85365
|
+
`${(r.utilization * 100).toFixed(2)}%`,
|
|
85366
|
+
`${(r.maxLtv * 100).toFixed(0)}%`,
|
|
85367
|
+
r.mintAddress,
|
|
85368
|
+
r.reserveAddress
|
|
85369
|
+
]);
|
|
85370
|
+
}
|
|
85371
|
+
console.log(source_default.cyan.bold("\n Kamino Lend Reserves"));
|
|
85372
|
+
console.log(source_default.gray(` Market: ${options.market}`));
|
|
85373
|
+
if (!options.token) {
|
|
85374
|
+
console.log(source_default.gray(` Showing default set: ${DEFAULT_RESERVE_SYMBOLS.join(", ")} (use --token <symbol|mint> for others)`));
|
|
85375
|
+
}
|
|
85376
|
+
console.log(table.toString());
|
|
85377
|
+
} catch (e) {
|
|
85378
|
+
const message = e.message || "Kamino reserves failed";
|
|
85379
|
+
format === "json" ? outputErrorJson({ code: "API_ERROR", type: "NETWORK", message, retryable: true }) : console.error(source_default.red(`
|
|
85380
|
+
Error: ${message}`));
|
|
85381
|
+
process.exit(1);
|
|
85382
|
+
}
|
|
85383
|
+
});
|
|
85384
|
+
}
|
|
85268
85385
|
function createKaminoStatusCommand() {
|
|
85269
85386
|
return new Command("status").description("View Kamino Lend positions and APY").option("--market <address>", "Market address", KAMINO_MAIN_MARKET).action(async (options, cmdObj) => {
|
|
85270
85387
|
const globalOptions = cmdObj.optsWithGlobals();
|
|
@@ -85367,6 +85484,18 @@ var capabilities2 = [
|
|
|
85367
85484
|
params: [
|
|
85368
85485
|
{ name: "market", type: "string", required: false, description: "Kamino market address", default: "main market" }
|
|
85369
85486
|
]
|
|
85487
|
+
},
|
|
85488
|
+
{
|
|
85489
|
+
id: "defi.kamino.reserves",
|
|
85490
|
+
name: "Kamino Reserves",
|
|
85491
|
+
description: "Show Kamino Lend supply/borrow APY for SOL, USDC, USDT by default. Use --token <symbol|mint> to query a specific other token.",
|
|
85492
|
+
category: "query",
|
|
85493
|
+
auth_required: false,
|
|
85494
|
+
command: "byreal-cli kamino reserves",
|
|
85495
|
+
params: [
|
|
85496
|
+
{ name: "market", type: "string", required: false, description: "Kamino market address", default: "main market" },
|
|
85497
|
+
{ name: "token", type: "string", required: false, description: "Query a single token by symbol or mint address instead of the default SOL/USDC/USDT set" }
|
|
85498
|
+
]
|
|
85370
85499
|
}
|
|
85371
85500
|
];
|
|
85372
85501
|
var kaminoPlugin = {
|
|
@@ -85374,6 +85503,7 @@ var kaminoPlugin = {
|
|
|
85374
85503
|
name: "Kamino Lend",
|
|
85375
85504
|
createCommand() {
|
|
85376
85505
|
const cmd = new Command("kamino").description("Kamino Lend \u2014 deposit, withdraw, yield status");
|
|
85506
|
+
cmd.addCommand(createKaminoReservesCommand());
|
|
85377
85507
|
cmd.addCommand(createKaminoDepositCommand());
|
|
85378
85508
|
cmd.addCommand(createKaminoWithdrawCommand());
|
|
85379
85509
|
cmd.addCommand(createKaminoStatusCommand());
|
|
@@ -85870,12 +86000,234 @@ var consolidatePlugin = {
|
|
|
85870
86000
|
capabilities: capabilities4
|
|
85871
86001
|
};
|
|
85872
86002
|
|
|
86003
|
+
// src/plugins/dflow/commands.ts
|
|
86004
|
+
var import_cli_table36 = __toESM(require_cli_table3(), 1);
|
|
86005
|
+
var import_web3119 = __toESM(require_index_cjs(), 1);
|
|
86006
|
+
init_solana();
|
|
86007
|
+
init_errors();
|
|
86008
|
+
init_constants();
|
|
86009
|
+
|
|
86010
|
+
// src/plugins/dflow/api.ts
|
|
86011
|
+
init_errors();
|
|
86012
|
+
init_constants();
|
|
86013
|
+
function createDFlowClient() {
|
|
86014
|
+
return distribution_default.create({
|
|
86015
|
+
prefixUrl: DFLOW_API_URL,
|
|
86016
|
+
timeout: DEFAULTS.REQUEST_TIMEOUT_MS,
|
|
86017
|
+
headers: {
|
|
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
|
+
});
|
|
86032
|
+
}
|
|
86033
|
+
async function getSwapQuote2(params) {
|
|
86034
|
+
const client2 = createDFlowClient();
|
|
86035
|
+
const slippageValue = params.slippageBps > 0 ? String(params.slippageBps) : "auto";
|
|
86036
|
+
try {
|
|
86037
|
+
const response = await client2.get("order", {
|
|
86038
|
+
searchParams: {
|
|
86039
|
+
userPublicKey: params.userPublicKey,
|
|
86040
|
+
inputMint: params.inputMint,
|
|
86041
|
+
outputMint: params.outputMint,
|
|
86042
|
+
amount: params.amount,
|
|
86043
|
+
slippageBps: slippageValue
|
|
86044
|
+
}
|
|
86045
|
+
});
|
|
86046
|
+
const data = await response.json();
|
|
86047
|
+
if (!data.transaction) {
|
|
86048
|
+
return {
|
|
86049
|
+
ok: false,
|
|
86050
|
+
error: new ByrealError({
|
|
86051
|
+
code: ErrorCodes.API_ERROR,
|
|
86052
|
+
type: "NETWORK",
|
|
86053
|
+
message: "No transaction returned from DFlow /order endpoint.",
|
|
86054
|
+
retryable: true
|
|
86055
|
+
})
|
|
86056
|
+
};
|
|
86057
|
+
}
|
|
86058
|
+
return {
|
|
86059
|
+
ok: true,
|
|
86060
|
+
value: {
|
|
86061
|
+
inAmount: data.inAmount || params.amount,
|
|
86062
|
+
outAmount: data.outAmount || "0",
|
|
86063
|
+
inputMint: data.inputMint || params.inputMint,
|
|
86064
|
+
outputMint: data.outputMint || params.outputMint,
|
|
86065
|
+
transaction: data.transaction,
|
|
86066
|
+
priceImpactPct: data.priceImpactPct
|
|
86067
|
+
}
|
|
86068
|
+
};
|
|
86069
|
+
} catch (e) {
|
|
86070
|
+
return { ok: false, error: handleDFlowError(e) };
|
|
86071
|
+
}
|
|
86072
|
+
}
|
|
86073
|
+
function handleDFlowError(error) {
|
|
86074
|
+
if (error instanceof HTTPError) {
|
|
86075
|
+
const status = error.response.status;
|
|
86076
|
+
if (status === 429) {
|
|
86077
|
+
return new ByrealError({
|
|
86078
|
+
code: ErrorCodes.NETWORK_ERROR,
|
|
86079
|
+
type: "NETWORK",
|
|
86080
|
+
message: "DFlow rate limit exceeded. Set DFLOW_API_KEY for production use.",
|
|
86081
|
+
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
|
+
});
|
|
86099
|
+
}
|
|
86100
|
+
const message = error instanceof Error ? error.message : "Unknown DFlow error";
|
|
86101
|
+
return new ByrealError({
|
|
86102
|
+
code: ErrorCodes.NETWORK_ERROR,
|
|
86103
|
+
type: "NETWORK",
|
|
86104
|
+
message: `DFlow swap failed: ${message}`,
|
|
86105
|
+
retryable: true
|
|
86106
|
+
});
|
|
86107
|
+
}
|
|
86108
|
+
|
|
86109
|
+
// src/plugins/dflow/commands.ts
|
|
86110
|
+
function createDFlowSwapCommand() {
|
|
86111
|
+
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
|
+
const globalOptions = cmdObj.optsWithGlobals();
|
|
86113
|
+
const format = globalOptions.output;
|
|
86114
|
+
const startTime = Date.now();
|
|
86115
|
+
const mode = resolveExecutionMode(options);
|
|
86116
|
+
const walletAddress = globalOptions.walletAddress;
|
|
86117
|
+
if (!walletAddress) {
|
|
86118
|
+
const e = missingWalletAddressError();
|
|
86119
|
+
format === "json" ? outputErrorJson(e.toJSON()) : outputErrorTable(e.toJSON());
|
|
86120
|
+
process.exit(1);
|
|
86121
|
+
}
|
|
86122
|
+
try {
|
|
86123
|
+
new import_web3119.PublicKey(walletAddress);
|
|
86124
|
+
} catch {
|
|
86125
|
+
const msg = `Invalid wallet address: ${walletAddress}`;
|
|
86126
|
+
format === "json" ? outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: msg, retryable: false }) : console.error(source_default.red(`
|
|
86127
|
+
Error: ${msg}`));
|
|
86128
|
+
process.exit(1);
|
|
86129
|
+
}
|
|
86130
|
+
try {
|
|
86131
|
+
const inputDecimals = await resolveDecimals(options.inputMint);
|
|
86132
|
+
const rawAmount = options.raw ? options.amount : uiToRaw(options.amount, inputDecimals);
|
|
86133
|
+
const slippageBps = options.slippage ? parseInt(options.slippage, 10) : getSlippageBps();
|
|
86134
|
+
const quoteResult = await getSwapQuote2({
|
|
86135
|
+
inputMint: options.inputMint,
|
|
86136
|
+
outputMint: options.outputMint,
|
|
86137
|
+
amount: rawAmount,
|
|
86138
|
+
slippageBps,
|
|
86139
|
+
userPublicKey: walletAddress
|
|
86140
|
+
});
|
|
86141
|
+
if (!quoteResult.ok) {
|
|
86142
|
+
format === "json" ? outputErrorJson(quoteResult.error) : outputErrorTable(quoteResult.error);
|
|
86143
|
+
process.exit(1);
|
|
86144
|
+
}
|
|
86145
|
+
const quote = quoteResult.value;
|
|
86146
|
+
const outputDecimals = await resolveDecimals(options.outputMint);
|
|
86147
|
+
const uiInAmount = rawToUi(quote.inAmount, inputDecimals);
|
|
86148
|
+
const uiOutAmount = rawToUi(quote.outAmount, outputDecimals);
|
|
86149
|
+
if (mode === "dry-run") {
|
|
86150
|
+
printDryRunBanner();
|
|
86151
|
+
if (format === "json") {
|
|
86152
|
+
outputJson({
|
|
86153
|
+
mode: "dry-run",
|
|
86154
|
+
source: "dflow",
|
|
86155
|
+
inputMint: quote.inputMint,
|
|
86156
|
+
outputMint: quote.outputMint,
|
|
86157
|
+
inAmount: quote.inAmount,
|
|
86158
|
+
outAmount: quote.outAmount,
|
|
86159
|
+
uiInAmount,
|
|
86160
|
+
uiOutAmount,
|
|
86161
|
+
priceImpactPct: quote.priceImpactPct,
|
|
86162
|
+
slippageBps
|
|
86163
|
+
}, startTime);
|
|
86164
|
+
} else {
|
|
86165
|
+
const table = new import_cli_table36.default({ chars: TABLE_CHARS });
|
|
86166
|
+
table.push(
|
|
86167
|
+
[source_default.gray("Source"), "DFlow"],
|
|
86168
|
+
[source_default.gray("Input"), `${uiInAmount} (${options.inputMint})`],
|
|
86169
|
+
[source_default.gray("Output"), `${uiOutAmount} (${options.outputMint})`],
|
|
86170
|
+
[source_default.gray("Slippage"), `${slippageBps} bps`]
|
|
86171
|
+
);
|
|
86172
|
+
if (quote.priceImpactPct) {
|
|
86173
|
+
const impact = parseFloat(quote.priceImpactPct);
|
|
86174
|
+
const color = impact > 1 ? source_default.red : impact > 0.5 ? source_default.yellow : source_default.green;
|
|
86175
|
+
table.push([source_default.gray("Price Impact"), color(`${impact.toFixed(4)}%`)]);
|
|
86176
|
+
}
|
|
86177
|
+
console.log(source_default.cyan.bold("\n DFlow Swap Preview\n"));
|
|
86178
|
+
console.log(table.toString());
|
|
86179
|
+
console.log(source_default.yellow("\n Remove --dry-run to generate the unsigned transaction"));
|
|
86180
|
+
}
|
|
86181
|
+
return;
|
|
86182
|
+
}
|
|
86183
|
+
console.log(JSON.stringify({ unsignedTransactions: [quote.transaction] }));
|
|
86184
|
+
} catch (e) {
|
|
86185
|
+
const message = e.message || "DFlow swap failed";
|
|
86186
|
+
format === "json" ? outputErrorJson({ code: "API_ERROR", type: "NETWORK", message, retryable: true }) : console.error(source_default.red(`
|
|
86187
|
+
Error: ${message}`));
|
|
86188
|
+
process.exit(1);
|
|
86189
|
+
}
|
|
86190
|
+
});
|
|
86191
|
+
}
|
|
86192
|
+
|
|
86193
|
+
// src/plugins/dflow/index.ts
|
|
86194
|
+
var capabilities5 = [
|
|
86195
|
+
{
|
|
86196
|
+
id: "defi.dflow.swap",
|
|
86197
|
+
name: "DFlow Swap",
|
|
86198
|
+
description: "Swap tokens via DFlow order-flow aggregator with MEV protection",
|
|
86199
|
+
category: "execute",
|
|
86200
|
+
auth_required: true,
|
|
86201
|
+
command: "byreal-cli dflow swap --wallet-address <address>",
|
|
86202
|
+
params: [
|
|
86203
|
+
{ name: "input-mint", type: "string", required: true, description: "Input token mint address" },
|
|
86204
|
+
{ name: "output-mint", type: "string", required: true, description: "Output token mint address" },
|
|
86205
|
+
{ name: "amount", type: "string", required: true, description: "Amount to swap (UI format)" },
|
|
86206
|
+
{ name: "slippage", type: "integer", required: false, description: "Slippage tolerance in basis points" },
|
|
86207
|
+
{ name: "raw", type: "boolean", required: false, description: "Amount is already in raw format" },
|
|
86208
|
+
{ name: "dry-run", type: "boolean", required: false, description: "Preview without generating transaction" }
|
|
86209
|
+
]
|
|
86210
|
+
}
|
|
86211
|
+
];
|
|
86212
|
+
var dflowPlugin = {
|
|
86213
|
+
id: "dflow",
|
|
86214
|
+
name: "DFlow",
|
|
86215
|
+
createCommand() {
|
|
86216
|
+
const cmd = new Command("dflow").description("DFlow \u2014 order-flow swap");
|
|
86217
|
+
cmd.addCommand(createDFlowSwapCommand());
|
|
86218
|
+
return cmd;
|
|
86219
|
+
},
|
|
86220
|
+
capabilities: capabilities5
|
|
86221
|
+
};
|
|
86222
|
+
|
|
85873
86223
|
// src/plugins/index.ts
|
|
85874
86224
|
var plugins = [
|
|
85875
86225
|
jupiterPlugin,
|
|
85876
86226
|
kaminoPlugin,
|
|
85877
86227
|
rentPlugin,
|
|
85878
|
-
consolidatePlugin
|
|
86228
|
+
consolidatePlugin,
|
|
86229
|
+
// titanPlugin,
|
|
86230
|
+
dflowPlugin
|
|
85879
86231
|
];
|
|
85880
86232
|
|
|
85881
86233
|
// src/cli/commands/catalog.ts
|
|
@@ -86223,12 +86575,12 @@ function searchCapabilities(keyword) {
|
|
|
86223
86575
|
(cap) => cap.id.toLowerCase().includes(lowerKeyword) || cap.name.toLowerCase().includes(lowerKeyword) || cap.description.toLowerCase().includes(lowerKeyword)
|
|
86224
86576
|
);
|
|
86225
86577
|
}
|
|
86226
|
-
function outputCapabilitiesTable(
|
|
86227
|
-
const table = new
|
|
86578
|
+
function outputCapabilitiesTable(capabilities6) {
|
|
86579
|
+
const table = new import_cli_table37.default({
|
|
86228
86580
|
head: [source_default.cyan.bold("ID"), source_default.cyan.bold("Name"), source_default.cyan.bold("Category"), source_default.cyan.bold("Auth")],
|
|
86229
86581
|
chars: TABLE_CHARS
|
|
86230
86582
|
});
|
|
86231
|
-
for (const cap of
|
|
86583
|
+
for (const cap of capabilities6) {
|
|
86232
86584
|
table.push([
|
|
86233
86585
|
source_default.white(cap.id),
|
|
86234
86586
|
cap.name,
|
|
@@ -86251,7 +86603,7 @@ ${cap.name}`));
|
|
|
86251
86603
|
Command: ${source_default.green(cap.command)}`));
|
|
86252
86604
|
if (cap.params.length > 0) {
|
|
86253
86605
|
console.log(source_default.cyan("\nParameters:"));
|
|
86254
|
-
const table = new
|
|
86606
|
+
const table = new import_cli_table37.default({
|
|
86255
86607
|
head: [source_default.cyan("Name"), source_default.cyan("Type"), source_default.cyan("Required"), source_default.cyan("Default"), source_default.cyan("Description")],
|
|
86256
86608
|
chars: TABLE_CHARS
|
|
86257
86609
|
});
|
|
@@ -86354,7 +86706,7 @@ Available Capabilities (${all.length}):
|
|
|
86354
86706
|
}
|
|
86355
86707
|
|
|
86356
86708
|
// src/cli/commands/wallet.ts
|
|
86357
|
-
var
|
|
86709
|
+
var import_web3120 = __toESM(require_index_cjs(), 1);
|
|
86358
86710
|
init_constants();
|
|
86359
86711
|
init_errors();
|
|
86360
86712
|
|
|
@@ -86391,7 +86743,7 @@ function createWalletCommand() {
|
|
|
86391
86743
|
}
|
|
86392
86744
|
let publicKey3;
|
|
86393
86745
|
try {
|
|
86394
|
-
publicKey3 = new
|
|
86746
|
+
publicKey3 = new import_web3120.PublicKey(walletAddress);
|
|
86395
86747
|
} catch {
|
|
86396
86748
|
outputError({
|
|
86397
86749
|
code: "INVALID_PARAMETER",
|
|
@@ -86404,9 +86756,9 @@ function createWalletCommand() {
|
|
|
86404
86756
|
try {
|
|
86405
86757
|
const configResult = loadConfig();
|
|
86406
86758
|
const rpcUrl = configResult.ok ? configResult.value.rpc_url : SOLANA_RPC_URL;
|
|
86407
|
-
const connection = new
|
|
86759
|
+
const connection = new import_web3120.Connection(rpcUrl);
|
|
86408
86760
|
const lamports = await connection.getBalance(publicKey3);
|
|
86409
|
-
const solBalance = lamports /
|
|
86761
|
+
const solBalance = lamports / import_web3120.LAMPORTS_PER_SOL;
|
|
86410
86762
|
const rawAccounts = [];
|
|
86411
86763
|
const [splResult, t22Result] = await Promise.allSettled([
|
|
86412
86764
|
connection.getTokenAccountsByOwner(publicKey3, { programId: TOKEN_PROGRAM_ID }),
|
|
@@ -86419,7 +86771,7 @@ function createWalletCommand() {
|
|
|
86419
86771
|
if (result.status !== "fulfilled") continue;
|
|
86420
86772
|
for (const { account } of result.value.value) {
|
|
86421
86773
|
const data = account.data;
|
|
86422
|
-
const mint = new
|
|
86774
|
+
const mint = new import_web3120.PublicKey(data.subarray(0, 32)).toBase58();
|
|
86423
86775
|
const amount = data.subarray(64, 72).readBigUInt64LE();
|
|
86424
86776
|
if (amount === 0n) continue;
|
|
86425
86777
|
rawAccounts.push({ mint, amount, isToken2022: isToken20222 });
|
|
@@ -86430,7 +86782,7 @@ function createWalletCommand() {
|
|
|
86430
86782
|
if (uniqueMints.length > 0) {
|
|
86431
86783
|
for (let i = 0; i < uniqueMints.length; i += 100) {
|
|
86432
86784
|
const batch = uniqueMints.slice(i, i + 100);
|
|
86433
|
-
const mintPubkeys = batch.map((m) => new
|
|
86785
|
+
const mintPubkeys = batch.map((m) => new import_web3120.PublicKey(m));
|
|
86434
86786
|
const mintInfos = await connection.getMultipleAccountsInfo(mintPubkeys);
|
|
86435
86787
|
for (let j = 0; j < batch.length; j++) {
|
|
86436
86788
|
const info = mintInfos[j];
|
|
@@ -86580,7 +86932,7 @@ Configuration updated: ${key} = ${value}`);
|
|
|
86580
86932
|
}
|
|
86581
86933
|
|
|
86582
86934
|
// src/cli/commands/swap.ts
|
|
86583
|
-
var
|
|
86935
|
+
var import_web3121 = __toESM(require_index_cjs(), 1);
|
|
86584
86936
|
init_solana();
|
|
86585
86937
|
init_errors();
|
|
86586
86938
|
async function resolveRawAmount(amount, swapMode, inputMint, outputMint, isRaw) {
|
|
@@ -86614,7 +86966,7 @@ function createSwapExecuteCommand() {
|
|
|
86614
86966
|
process.exit(1);
|
|
86615
86967
|
}
|
|
86616
86968
|
try {
|
|
86617
|
-
new
|
|
86969
|
+
new import_web3121.PublicKey(userPublicKey);
|
|
86618
86970
|
} catch {
|
|
86619
86971
|
if (format === "json") {
|
|
86620
86972
|
outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: `Invalid wallet address: ${userPublicKey}`, retryable: false });
|
|
@@ -86705,11 +87057,11 @@ function createSwapCommand() {
|
|
|
86705
87057
|
|
|
86706
87058
|
// src/cli/commands/positions.ts
|
|
86707
87059
|
var import_bn19 = __toESM(require_bn(), 1);
|
|
86708
|
-
var
|
|
87060
|
+
var import_web3123 = __toESM(require_index_cjs(), 1);
|
|
86709
87061
|
init_solana();
|
|
86710
87062
|
|
|
86711
87063
|
// src/core/transaction.ts
|
|
86712
|
-
var
|
|
87064
|
+
var import_web3122 = __toESM(require_index_cjs(), 1);
|
|
86713
87065
|
init_types();
|
|
86714
87066
|
init_errors();
|
|
86715
87067
|
function serializeTransaction(tx) {
|
|
@@ -86792,7 +87144,7 @@ var KNOWN_SYMBOLS = {
|
|
|
86792
87144
|
async function fetchWalletBalanceSummary(owner) {
|
|
86793
87145
|
const connection = getConnection();
|
|
86794
87146
|
const lamports = await connection.getBalance(owner);
|
|
86795
|
-
const solUi = (lamports /
|
|
87147
|
+
const solUi = (lamports / import_web3123.LAMPORTS_PER_SOL).toString();
|
|
86796
87148
|
const rawAccounts = [];
|
|
86797
87149
|
const [splResult, t22Result] = await Promise.allSettled([
|
|
86798
87150
|
connection.getTokenAccountsByOwner(owner, { programId: TOKEN_PROGRAM_ID }),
|
|
@@ -86804,7 +87156,7 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
86804
87156
|
if (result.status !== "fulfilled") continue;
|
|
86805
87157
|
for (const { account } of result.value.value) {
|
|
86806
87158
|
const data = account.data;
|
|
86807
|
-
const mint = new
|
|
87159
|
+
const mint = new import_web3123.PublicKey(data.subarray(0, 32)).toBase58();
|
|
86808
87160
|
const amount = data.subarray(64, 72).readBigUInt64LE();
|
|
86809
87161
|
if (amount === 0n) continue;
|
|
86810
87162
|
rawAccounts.push({ mint, amount });
|
|
@@ -86815,7 +87167,7 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
86815
87167
|
if (uniqueMints.length > 0) {
|
|
86816
87168
|
for (let i = 0; i < uniqueMints.length; i += 100) {
|
|
86817
87169
|
const batch = uniqueMints.slice(i, i + 100);
|
|
86818
|
-
const mintPubkeys = batch.map((m) => new
|
|
87170
|
+
const mintPubkeys = batch.map((m) => new import_web3123.PublicKey(m));
|
|
86819
87171
|
const mintInfos = await connection.getMultipleAccountsInfo(mintPubkeys);
|
|
86820
87172
|
for (let j = 0; j < batch.length; j++) {
|
|
86821
87173
|
const info = mintInfos[j];
|
|
@@ -86836,11 +87188,11 @@ async function fetchWalletBalanceSummary(owner) {
|
|
|
86836
87188
|
}
|
|
86837
87189
|
return { sol: solUi, tokens };
|
|
86838
87190
|
}
|
|
86839
|
-
var ASSOCIATED_TOKEN_PROGRAM = new
|
|
87191
|
+
var ASSOCIATED_TOKEN_PROGRAM = new import_web3123.PublicKey(
|
|
86840
87192
|
"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
86841
87193
|
);
|
|
86842
87194
|
function getAtaAddress(owner, mint, tokenProgramId) {
|
|
86843
|
-
const [address] =
|
|
87195
|
+
const [address] = import_web3123.PublicKey.findProgramAddressSync(
|
|
86844
87196
|
[owner.toBuffer(), tokenProgramId.toBuffer(), mint.toBuffer()],
|
|
86845
87197
|
ASSOCIATED_TOKEN_PROGRAM
|
|
86846
87198
|
);
|
|
@@ -86852,7 +87204,7 @@ async function getTokenBalance(owner, mint) {
|
|
|
86852
87204
|
const lamports = await connection.getBalance(owner);
|
|
86853
87205
|
return new import_bn19.default(lamports.toString());
|
|
86854
87206
|
}
|
|
86855
|
-
const mintPk = new
|
|
87207
|
+
const mintPk = new import_web3123.PublicKey(mint);
|
|
86856
87208
|
const ataSpl = getAtaAddress(owner, mintPk, TOKEN_PROGRAM_ID);
|
|
86857
87209
|
const ataT22 = getAtaAddress(owner, mintPk, TOKEN_2022_PROGRAM_ID);
|
|
86858
87210
|
const [splInfo, t22Info] = await Promise.allSettled([
|
|
@@ -86924,7 +87276,7 @@ function createPositionsOpenCommand() {
|
|
|
86924
87276
|
}
|
|
86925
87277
|
process.exit(1);
|
|
86926
87278
|
}
|
|
86927
|
-
const publicKey3 = new
|
|
87279
|
+
const publicKey3 = new import_web3123.PublicKey(walletAddress);
|
|
86928
87280
|
const useAmountUsd = !!options.amountUsd;
|
|
86929
87281
|
const useTokenAmount = !!options.amount;
|
|
86930
87282
|
if (useAmountUsd && useTokenAmount) {
|
|
@@ -87219,7 +87571,7 @@ function createPositionsIncreaseCommand() {
|
|
|
87219
87571
|
}
|
|
87220
87572
|
process.exit(1);
|
|
87221
87573
|
}
|
|
87222
|
-
const publicKey3 = new
|
|
87574
|
+
const publicKey3 = new import_web3123.PublicKey(walletAddress);
|
|
87223
87575
|
const useAmountUsd = !!options.amountUsd;
|
|
87224
87576
|
const useTokenAmount = !!options.amount;
|
|
87225
87577
|
if (useAmountUsd && useTokenAmount) {
|
|
@@ -87272,7 +87624,7 @@ function createPositionsIncreaseCommand() {
|
|
|
87272
87624
|
getAmountAFromAmountB: getAmountAFromAmountB2
|
|
87273
87625
|
} = await Promise.resolve().then(() => (init_esm4(), esm_exports));
|
|
87274
87626
|
const chain = getChain2();
|
|
87275
|
-
const nftMint = new
|
|
87627
|
+
const nftMint = new import_web3123.PublicKey(options.nftMint);
|
|
87276
87628
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
87277
87629
|
if (!positionInfo) {
|
|
87278
87630
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -87556,11 +87908,11 @@ function createPositionsDecreaseCommand() {
|
|
|
87556
87908
|
}
|
|
87557
87909
|
process.exit(1);
|
|
87558
87910
|
}
|
|
87559
|
-
const publicKey3 = new
|
|
87911
|
+
const publicKey3 = new import_web3123.PublicKey(walletAddress);
|
|
87560
87912
|
try {
|
|
87561
87913
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
87562
87914
|
const chain = getChain2();
|
|
87563
|
-
const nftMint = new
|
|
87915
|
+
const nftMint = new import_web3123.PublicKey(options.nftMint);
|
|
87564
87916
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
87565
87917
|
if (!positionInfo) {
|
|
87566
87918
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -87743,11 +88095,11 @@ function createPositionsCloseCommand() {
|
|
|
87743
88095
|
}
|
|
87744
88096
|
process.exit(1);
|
|
87745
88097
|
}
|
|
87746
|
-
const publicKey3 = new
|
|
88098
|
+
const publicKey3 = new import_web3123.PublicKey(walletAddress);
|
|
87747
88099
|
try {
|
|
87748
88100
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
87749
88101
|
const chain = getChain2();
|
|
87750
|
-
const nftMint = new
|
|
88102
|
+
const nftMint = new import_web3123.PublicKey(options.nftMint);
|
|
87751
88103
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
87752
88104
|
if (!positionInfo) {
|
|
87753
88105
|
const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
|
|
@@ -88279,7 +88631,7 @@ Error: ${errMsg}`));
|
|
|
88279
88631
|
const pool = poolResult.value;
|
|
88280
88632
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
88281
88633
|
const chain = getChain2();
|
|
88282
|
-
const nftMint = new
|
|
88634
|
+
const nftMint = new import_web3123.PublicKey(nftMintStr);
|
|
88283
88635
|
const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
|
|
88284
88636
|
if (!positionInfo) {
|
|
88285
88637
|
const errMsg = `Position not found on-chain for NFT mint: ${nftMintStr}`;
|
|
@@ -88477,9 +88829,9 @@ function createCopyPositionCommand() {
|
|
|
88477
88829
|
}
|
|
88478
88830
|
process.exit(1);
|
|
88479
88831
|
}
|
|
88480
|
-
const publicKey3 = new
|
|
88832
|
+
const publicKey3 = new import_web3123.PublicKey(walletAddress);
|
|
88481
88833
|
try {
|
|
88482
|
-
const positionAddress = new
|
|
88834
|
+
const positionAddress = new import_web3123.PublicKey(options.position);
|
|
88483
88835
|
const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
88484
88836
|
const { calculateTokenAmountsFromUsd: calculateTokenAmountsFromUsd2, getRawPositionInfoByAddress: getRawPositionInfoByAddress2 } = await Promise.resolve().then(() => (init_calculate(), calculate_exports));
|
|
88485
88837
|
const chain = getChain2();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byreal-io/byreal-cli-realclaw",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "AI-native CLI for Byreal CLMM DEX on Solana",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
|
-
"node": ">=18.
|
|
43
|
+
"node": ">=18.19.0"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"dist/index.cjs",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"vitest": "2.1.9"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@byreal-io/byreal-clmm-sdk": "^0.2.2"
|
|
74
|
+
"@byreal-io/byreal-clmm-sdk": "^0.2.2",
|
|
75
|
+
"@titanexchange/sdk-ts": "^0.1.1"
|
|
75
76
|
}
|
|
76
77
|
}
|