@byreal-io/byreal-cli-realclaw 0.3.10 → 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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/dist/index.cjs +347 -114
  3. 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
 
@@ -91,6 +92,7 @@ All commands support `-o json` for structured output.
91
92
  | `kamino status` | View Kamino lending positions and yield |
92
93
  | `rent reclaim` | Close empty token accounts to recover SOL rent |
93
94
  | `sweep execute` | Consolidate dust tokens into target token |
95
+ | `dflow swap` | Swap tokens via DFlow order-flow aggregator |
94
96
  | `update check` | Check for CLI updates |
95
97
 
96
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.10" : void 0;
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 PublicKey48 = class _PublicKey2 extends Struct {
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 = PublicKey48;
27151
- PublicKey48.default = new _PublicKey("11111111111111111111111111111111");
27152
- SOLANA_SCHEMA.set(PublicKey48, {
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 PublicKey48(this._publicKey);
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 PublicKey48("BPFLoader1111111111111111111111111111111111");
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 PublicKey48(address)), ...readonlySigners.map(([address]) => new PublicKey48(address)), ...writableNonSigners.map(([address]) => new PublicKey48(address)), ...readonlyNonSigners.map(([address]) => new PublicKey48(address))];
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 PublicKey48(address);
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 PublicKey48(account));
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 PublicKey48(buffer.Buffer.from(account)));
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 PublicKey48(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2)));
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 PublicKey48(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
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 PublicKey48(programId),
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 PublicKey48("SysvarC1ock11111111111111111111111111111111");
28689
- var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey48("SysvarEpochSchedu1e111111111111111111111111");
28690
- var SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey48("Sysvar1nstructions1111111111111111111111111");
28691
- var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey48("SysvarRecentB1ockHashes11111111111111111111");
28692
- var SYSVAR_RENT_PUBKEY5 = new PublicKey48("SysvarRent111111111111111111111111111111111");
28693
- var SYSVAR_REWARDS_PUBKEY = new PublicKey48("SysvarRewards111111111111111111111111111111");
28694
- var SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey48("SysvarS1otHashes111111111111111111111111111");
28695
- var SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey48("SysvarS1otHistory11111111111111111111111111");
28696
- var SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey48("SysvarStakeHistory1111111111111111111111111");
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 PublicKey48(nonceAccount.authorizedPubkey),
28888
- nonce: new PublicKey48(nonceAccount.nonce).toString(),
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 PublicKey48(programId)
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 PublicKey48(programId)
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 PublicKey48(base),
29021
+ basePubkey: new PublicKey49(base),
29017
29022
  seed,
29018
29023
  space,
29019
- programId: new PublicKey48(programId)
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 PublicKey48(programId)
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 PublicKey48(base),
29054
+ basePubkey: new PublicKey49(base),
29050
29055
  seed,
29051
- programId: new PublicKey48(programId)
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 PublicKey48(base),
29075
+ basePubkey: new PublicKey49(base),
29071
29076
  seed,
29072
29077
  lamports,
29073
29078
  space,
29074
- programId: new PublicKey48(programId)
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 PublicKey48(authorized2)
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 PublicKey48(authorized2)
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 PublicKey48("11111111111111111111111111111111");
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 PublicKey48("BPFLoader2111111111111111111111111111111111");
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 PublicKey48(meta.authority[0]) : void 0,
30504
- addresses: addresses.map((address) => new PublicKey48(address))
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(PublicKey48), superstruct.string(), (value) => new PublicKey48(value));
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 PublicKey48(accountKey)),
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 PublicKey48(this._keypair.publicKey);
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 PublicKey48(buffer2))
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] = PublicKey48.findProgramAddressSync([params.authority.toBuffer(), codecsNumbers.getU64Encoder().encode(params.recentSlot)], this.programId);
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 PublicKey48("AddressLookupTab1e1111111111111111111111111");
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 PublicKey48("ComputeBudget111111111111111111111111111111");
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 PublicKey48("Ed25519SigVerify111111111111111111111111111");
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 PublicKey48("KeccakSecp256k11111111111111111111111111111");
34693
+ Secp256k1Program.programId = new PublicKey49("KeccakSecp256k11111111111111111111111111111");
34689
34694
  var _Lockup;
34690
- var STAKE_CONFIG_ID = new PublicKey48("StakeConfig11111111111111111111111111111111");
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, PublicKey48.default);
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 PublicKey48(authorized2.staker), new PublicKey48(authorized2.withdrawer)),
34760
- lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new PublicKey48(lockup2.custodian))
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 PublicKey48(newAuthorized),
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 PublicKey48(authorityOwner),
34816
- newAuthorizedPubkey: new PublicKey48(newAuthorized),
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 PublicKey48("Stake11111111111111111111111111111111111111");
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 PublicKey48(voteInit2.nodePubkey), new PublicKey48(voteInit2.authorizedVoter), new PublicKey48(voteInit2.authorizedWithdrawer), voteInit2.commission)
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 PublicKey48(newAuthorized),
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 PublicKey48(currentAuthorityDerivedKeyOwnerPubkey),
35465
+ currentAuthorityDerivedKeyOwnerPubkey: new PublicKey49(currentAuthorityDerivedKeyOwnerPubkey),
35461
35466
  currentAuthorityDerivedKeySeed,
35462
- newAuthorizedPubkey: new PublicKey48(newAuthorized),
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 PublicKey48("Vote111111111111111111111111111111111111111");
35758
+ VoteProgram.programId = new PublicKey49("Vote111111111111111111111111111111111111111");
35754
35759
  VoteProgram.space = 3762;
35755
- var VALIDATOR_INFO_KEY = new PublicKey48("Va1idator1nfo111111111111111111111111111111");
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 PublicKey48(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH2));
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 PublicKey48("Vote111111111111111111111111111111111111111");
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 PublicKey48(va.nodePubkey),
35865
- authorizedWithdrawer: new PublicKey48(va.authorizedWithdrawer),
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 PublicKey48(authorizedVoter)
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 PublicKey48(authorizedPubkey),
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 = PublicKey48;
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 Table7 = class extends Array {
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
- Table7.reset = () => debug.reset();
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 = Table7;
39861
+ module2.exports = Table8;
39857
39862
  }
39858
39863
  });
39859
39864
 
@@ -84356,6 +84361,7 @@ byreal-cli catalog show dex.pool.list
84356
84361
  | defi.kamino.status | View Kamino positions and APY |
84357
84362
  | defi.rent.reclaim | Close empty accounts to reclaim SOL rent |
84358
84363
  | defi.sweep.execute | Consolidate dust tokens into USDC |
84364
+ | defi.dflow.swap | Swap tokens via DFlow order-flow aggregator |
84359
84365
 
84360
84366
  ## Global Options
84361
84367
 
@@ -84432,6 +84438,8 @@ Present on-chain data first, then external context, then synthesize how external
84432
84438
  | Kamino status | \`byreal-cli kamino status --wallet-address <addr>\` |
84433
84439
  | Rent reclaim scan | \`byreal-cli rent reclaim --dry-run --wallet-address <addr>\` |
84434
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>\` |
84435
84443
  | Sweep dust preview | \`byreal-cli sweep execute --dry-run --wallet-address <addr>\` |
84436
84444
  | Sweep dust execute | \`byreal-cli sweep execute --wallet-address <addr>\` |
84437
84445
 
@@ -84547,14 +84555,18 @@ When user asks vague questions like "\u6709\u4EC0\u4E48\u4ED3\u4F4D\u53EF\u4EE5
84547
84555
  - If all positions in a pool are out-of-range, skip that pool and explain why
84548
84556
  - To inspect a specific LP's full portfolio: \`byreal-cli positions list --user <wallet-address> -o json\`
84549
84557
 
84550
- ## Workflow: Jupiter Swap (External)
84558
+ ## Swap Routing Priority
84551
84559
 
84552
- When user wants to swap tokens via Jupiter (not the built-in Byreal swap):
84553
- 1. **Preview**: \`byreal-cli jup swap --input-mint <mint> --output-mint <mint> --amount <amt> --dry-run --wallet-address <addr>\`
84554
- 2. **Execute**: Remove \`--dry-run\` to generate the unsigned transaction
84555
- 3. Output: \`{ unsignedTransactions: [base64] }\`
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.
84556
84561
 
84557
- **When to use Jupiter swap vs Byreal swap**: Use \`jup swap\` for general Solana token swaps (any SPL token pair). Use \`swap execute\` for tokens listed on the Byreal DEX. Jupiter aggregates across all Solana DEXes for best price.
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\`.
84558
84570
 
84559
84571
  ## Workflow: Idle Yield with Kamino
84560
84572
 
@@ -84613,7 +84625,7 @@ function createSkillCommand() {
84613
84625
  }
84614
84626
 
84615
84627
  // src/cli/commands/catalog.ts
84616
- var import_cli_table36 = __toESM(require_cli_table3(), 1);
84628
+ var import_cli_table37 = __toESM(require_cli_table3(), 1);
84617
84629
  init_constants();
84618
84630
 
84619
84631
  // src/plugins/jupiter/commands.ts
@@ -84683,8 +84695,7 @@ init_constants();
84683
84695
  // src/plugins/jupiter/api.ts
84684
84696
  init_types();
84685
84697
  init_errors();
84686
- var JUP_SWAP_API = "https://api.jup.ag/swap/v1";
84687
- var JUP_PRICE_API = "https://api.jup.ag/price/v3";
84698
+ init_constants();
84688
84699
  async function getQuote(params) {
84689
84700
  try {
84690
84701
  const searchParams = new URLSearchParams({
@@ -85989,12 +86000,234 @@ var consolidatePlugin = {
85989
86000
  capabilities: capabilities4
85990
86001
  };
85991
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
+
85992
86223
  // src/plugins/index.ts
85993
86224
  var plugins = [
85994
86225
  jupiterPlugin,
85995
86226
  kaminoPlugin,
85996
86227
  rentPlugin,
85997
- consolidatePlugin
86228
+ consolidatePlugin,
86229
+ // titanPlugin,
86230
+ dflowPlugin
85998
86231
  ];
85999
86232
 
86000
86233
  // src/cli/commands/catalog.ts
@@ -86342,12 +86575,12 @@ function searchCapabilities(keyword) {
86342
86575
  (cap) => cap.id.toLowerCase().includes(lowerKeyword) || cap.name.toLowerCase().includes(lowerKeyword) || cap.description.toLowerCase().includes(lowerKeyword)
86343
86576
  );
86344
86577
  }
86345
- function outputCapabilitiesTable(capabilities5) {
86346
- const table = new import_cli_table36.default({
86578
+ function outputCapabilitiesTable(capabilities6) {
86579
+ const table = new import_cli_table37.default({
86347
86580
  head: [source_default.cyan.bold("ID"), source_default.cyan.bold("Name"), source_default.cyan.bold("Category"), source_default.cyan.bold("Auth")],
86348
86581
  chars: TABLE_CHARS
86349
86582
  });
86350
- for (const cap of capabilities5) {
86583
+ for (const cap of capabilities6) {
86351
86584
  table.push([
86352
86585
  source_default.white(cap.id),
86353
86586
  cap.name,
@@ -86370,7 +86603,7 @@ ${cap.name}`));
86370
86603
  Command: ${source_default.green(cap.command)}`));
86371
86604
  if (cap.params.length > 0) {
86372
86605
  console.log(source_default.cyan("\nParameters:"));
86373
- const table = new import_cli_table36.default({
86606
+ const table = new import_cli_table37.default({
86374
86607
  head: [source_default.cyan("Name"), source_default.cyan("Type"), source_default.cyan("Required"), source_default.cyan("Default"), source_default.cyan("Description")],
86375
86608
  chars: TABLE_CHARS
86376
86609
  });
@@ -86473,7 +86706,7 @@ Available Capabilities (${all.length}):
86473
86706
  }
86474
86707
 
86475
86708
  // src/cli/commands/wallet.ts
86476
- var import_web3119 = __toESM(require_index_cjs(), 1);
86709
+ var import_web3120 = __toESM(require_index_cjs(), 1);
86477
86710
  init_constants();
86478
86711
  init_errors();
86479
86712
 
@@ -86510,7 +86743,7 @@ function createWalletCommand() {
86510
86743
  }
86511
86744
  let publicKey3;
86512
86745
  try {
86513
- publicKey3 = new import_web3119.PublicKey(walletAddress);
86746
+ publicKey3 = new import_web3120.PublicKey(walletAddress);
86514
86747
  } catch {
86515
86748
  outputError({
86516
86749
  code: "INVALID_PARAMETER",
@@ -86523,9 +86756,9 @@ function createWalletCommand() {
86523
86756
  try {
86524
86757
  const configResult = loadConfig();
86525
86758
  const rpcUrl = configResult.ok ? configResult.value.rpc_url : SOLANA_RPC_URL;
86526
- const connection = new import_web3119.Connection(rpcUrl);
86759
+ const connection = new import_web3120.Connection(rpcUrl);
86527
86760
  const lamports = await connection.getBalance(publicKey3);
86528
- const solBalance = lamports / import_web3119.LAMPORTS_PER_SOL;
86761
+ const solBalance = lamports / import_web3120.LAMPORTS_PER_SOL;
86529
86762
  const rawAccounts = [];
86530
86763
  const [splResult, t22Result] = await Promise.allSettled([
86531
86764
  connection.getTokenAccountsByOwner(publicKey3, { programId: TOKEN_PROGRAM_ID }),
@@ -86538,7 +86771,7 @@ function createWalletCommand() {
86538
86771
  if (result.status !== "fulfilled") continue;
86539
86772
  for (const { account } of result.value.value) {
86540
86773
  const data = account.data;
86541
- const mint = new import_web3119.PublicKey(data.subarray(0, 32)).toBase58();
86774
+ const mint = new import_web3120.PublicKey(data.subarray(0, 32)).toBase58();
86542
86775
  const amount = data.subarray(64, 72).readBigUInt64LE();
86543
86776
  if (amount === 0n) continue;
86544
86777
  rawAccounts.push({ mint, amount, isToken2022: isToken20222 });
@@ -86549,7 +86782,7 @@ function createWalletCommand() {
86549
86782
  if (uniqueMints.length > 0) {
86550
86783
  for (let i = 0; i < uniqueMints.length; i += 100) {
86551
86784
  const batch = uniqueMints.slice(i, i + 100);
86552
- const mintPubkeys = batch.map((m) => new import_web3119.PublicKey(m));
86785
+ const mintPubkeys = batch.map((m) => new import_web3120.PublicKey(m));
86553
86786
  const mintInfos = await connection.getMultipleAccountsInfo(mintPubkeys);
86554
86787
  for (let j = 0; j < batch.length; j++) {
86555
86788
  const info = mintInfos[j];
@@ -86699,7 +86932,7 @@ Configuration updated: ${key} = ${value}`);
86699
86932
  }
86700
86933
 
86701
86934
  // src/cli/commands/swap.ts
86702
- var import_web3120 = __toESM(require_index_cjs(), 1);
86935
+ var import_web3121 = __toESM(require_index_cjs(), 1);
86703
86936
  init_solana();
86704
86937
  init_errors();
86705
86938
  async function resolveRawAmount(amount, swapMode, inputMint, outputMint, isRaw) {
@@ -86733,7 +86966,7 @@ function createSwapExecuteCommand() {
86733
86966
  process.exit(1);
86734
86967
  }
86735
86968
  try {
86736
- new import_web3120.PublicKey(userPublicKey);
86969
+ new import_web3121.PublicKey(userPublicKey);
86737
86970
  } catch {
86738
86971
  if (format === "json") {
86739
86972
  outputErrorJson({ code: "INVALID_PARAMETER", type: "VALIDATION", message: `Invalid wallet address: ${userPublicKey}`, retryable: false });
@@ -86824,11 +87057,11 @@ function createSwapCommand() {
86824
87057
 
86825
87058
  // src/cli/commands/positions.ts
86826
87059
  var import_bn19 = __toESM(require_bn(), 1);
86827
- var import_web3122 = __toESM(require_index_cjs(), 1);
87060
+ var import_web3123 = __toESM(require_index_cjs(), 1);
86828
87061
  init_solana();
86829
87062
 
86830
87063
  // src/core/transaction.ts
86831
- var import_web3121 = __toESM(require_index_cjs(), 1);
87064
+ var import_web3122 = __toESM(require_index_cjs(), 1);
86832
87065
  init_types();
86833
87066
  init_errors();
86834
87067
  function serializeTransaction(tx) {
@@ -86911,7 +87144,7 @@ var KNOWN_SYMBOLS = {
86911
87144
  async function fetchWalletBalanceSummary(owner) {
86912
87145
  const connection = getConnection();
86913
87146
  const lamports = await connection.getBalance(owner);
86914
- const solUi = (lamports / import_web3122.LAMPORTS_PER_SOL).toString();
87147
+ const solUi = (lamports / import_web3123.LAMPORTS_PER_SOL).toString();
86915
87148
  const rawAccounts = [];
86916
87149
  const [splResult, t22Result] = await Promise.allSettled([
86917
87150
  connection.getTokenAccountsByOwner(owner, { programId: TOKEN_PROGRAM_ID }),
@@ -86923,7 +87156,7 @@ async function fetchWalletBalanceSummary(owner) {
86923
87156
  if (result.status !== "fulfilled") continue;
86924
87157
  for (const { account } of result.value.value) {
86925
87158
  const data = account.data;
86926
- const mint = new import_web3122.PublicKey(data.subarray(0, 32)).toBase58();
87159
+ const mint = new import_web3123.PublicKey(data.subarray(0, 32)).toBase58();
86927
87160
  const amount = data.subarray(64, 72).readBigUInt64LE();
86928
87161
  if (amount === 0n) continue;
86929
87162
  rawAccounts.push({ mint, amount });
@@ -86934,7 +87167,7 @@ async function fetchWalletBalanceSummary(owner) {
86934
87167
  if (uniqueMints.length > 0) {
86935
87168
  for (let i = 0; i < uniqueMints.length; i += 100) {
86936
87169
  const batch = uniqueMints.slice(i, i + 100);
86937
- const mintPubkeys = batch.map((m) => new import_web3122.PublicKey(m));
87170
+ const mintPubkeys = batch.map((m) => new import_web3123.PublicKey(m));
86938
87171
  const mintInfos = await connection.getMultipleAccountsInfo(mintPubkeys);
86939
87172
  for (let j = 0; j < batch.length; j++) {
86940
87173
  const info = mintInfos[j];
@@ -86955,11 +87188,11 @@ async function fetchWalletBalanceSummary(owner) {
86955
87188
  }
86956
87189
  return { sol: solUi, tokens };
86957
87190
  }
86958
- var ASSOCIATED_TOKEN_PROGRAM = new import_web3122.PublicKey(
87191
+ var ASSOCIATED_TOKEN_PROGRAM = new import_web3123.PublicKey(
86959
87192
  "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
86960
87193
  );
86961
87194
  function getAtaAddress(owner, mint, tokenProgramId) {
86962
- const [address] = import_web3122.PublicKey.findProgramAddressSync(
87195
+ const [address] = import_web3123.PublicKey.findProgramAddressSync(
86963
87196
  [owner.toBuffer(), tokenProgramId.toBuffer(), mint.toBuffer()],
86964
87197
  ASSOCIATED_TOKEN_PROGRAM
86965
87198
  );
@@ -86971,7 +87204,7 @@ async function getTokenBalance(owner, mint) {
86971
87204
  const lamports = await connection.getBalance(owner);
86972
87205
  return new import_bn19.default(lamports.toString());
86973
87206
  }
86974
- const mintPk = new import_web3122.PublicKey(mint);
87207
+ const mintPk = new import_web3123.PublicKey(mint);
86975
87208
  const ataSpl = getAtaAddress(owner, mintPk, TOKEN_PROGRAM_ID);
86976
87209
  const ataT22 = getAtaAddress(owner, mintPk, TOKEN_2022_PROGRAM_ID);
86977
87210
  const [splInfo, t22Info] = await Promise.allSettled([
@@ -87043,7 +87276,7 @@ function createPositionsOpenCommand() {
87043
87276
  }
87044
87277
  process.exit(1);
87045
87278
  }
87046
- const publicKey3 = new import_web3122.PublicKey(walletAddress);
87279
+ const publicKey3 = new import_web3123.PublicKey(walletAddress);
87047
87280
  const useAmountUsd = !!options.amountUsd;
87048
87281
  const useTokenAmount = !!options.amount;
87049
87282
  if (useAmountUsd && useTokenAmount) {
@@ -87338,7 +87571,7 @@ function createPositionsIncreaseCommand() {
87338
87571
  }
87339
87572
  process.exit(1);
87340
87573
  }
87341
- const publicKey3 = new import_web3122.PublicKey(walletAddress);
87574
+ const publicKey3 = new import_web3123.PublicKey(walletAddress);
87342
87575
  const useAmountUsd = !!options.amountUsd;
87343
87576
  const useTokenAmount = !!options.amount;
87344
87577
  if (useAmountUsd && useTokenAmount) {
@@ -87391,7 +87624,7 @@ function createPositionsIncreaseCommand() {
87391
87624
  getAmountAFromAmountB: getAmountAFromAmountB2
87392
87625
  } = await Promise.resolve().then(() => (init_esm4(), esm_exports));
87393
87626
  const chain = getChain2();
87394
- const nftMint = new import_web3122.PublicKey(options.nftMint);
87627
+ const nftMint = new import_web3123.PublicKey(options.nftMint);
87395
87628
  const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
87396
87629
  if (!positionInfo) {
87397
87630
  const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
@@ -87675,11 +87908,11 @@ function createPositionsDecreaseCommand() {
87675
87908
  }
87676
87909
  process.exit(1);
87677
87910
  }
87678
- const publicKey3 = new import_web3122.PublicKey(walletAddress);
87911
+ const publicKey3 = new import_web3123.PublicKey(walletAddress);
87679
87912
  try {
87680
87913
  const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
87681
87914
  const chain = getChain2();
87682
- const nftMint = new import_web3122.PublicKey(options.nftMint);
87915
+ const nftMint = new import_web3123.PublicKey(options.nftMint);
87683
87916
  const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
87684
87917
  if (!positionInfo) {
87685
87918
  const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
@@ -87862,11 +88095,11 @@ function createPositionsCloseCommand() {
87862
88095
  }
87863
88096
  process.exit(1);
87864
88097
  }
87865
- const publicKey3 = new import_web3122.PublicKey(walletAddress);
88098
+ const publicKey3 = new import_web3123.PublicKey(walletAddress);
87866
88099
  try {
87867
88100
  const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
87868
88101
  const chain = getChain2();
87869
- const nftMint = new import_web3122.PublicKey(options.nftMint);
88102
+ const nftMint = new import_web3123.PublicKey(options.nftMint);
87870
88103
  const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
87871
88104
  if (!positionInfo) {
87872
88105
  const errMsg = `Position not found for NFT mint: ${options.nftMint}`;
@@ -88398,7 +88631,7 @@ Error: ${errMsg}`));
88398
88631
  const pool = poolResult.value;
88399
88632
  const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
88400
88633
  const chain = getChain2();
88401
- const nftMint = new import_web3122.PublicKey(nftMintStr);
88634
+ const nftMint = new import_web3123.PublicKey(nftMintStr);
88402
88635
  const positionInfo = await chain.getPositionInfoByNftMint(nftMint);
88403
88636
  if (!positionInfo) {
88404
88637
  const errMsg = `Position not found on-chain for NFT mint: ${nftMintStr}`;
@@ -88596,9 +88829,9 @@ function createCopyPositionCommand() {
88596
88829
  }
88597
88830
  process.exit(1);
88598
88831
  }
88599
- const publicKey3 = new import_web3122.PublicKey(walletAddress);
88832
+ const publicKey3 = new import_web3123.PublicKey(walletAddress);
88600
88833
  try {
88601
- const positionAddress = new import_web3122.PublicKey(options.position);
88834
+ const positionAddress = new import_web3123.PublicKey(options.position);
88602
88835
  const { getChain: getChain2 } = await Promise.resolve().then(() => (init_init(), init_exports));
88603
88836
  const { calculateTokenAmountsFromUsd: calculateTokenAmountsFromUsd2, getRawPositionInfoByAddress: getRawPositionInfoByAddress2 } = await Promise.resolve().then(() => (init_calculate(), calculate_exports));
88604
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.10",
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.0.0"
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
  }