pinpet-sdk 2.1.28 → 2.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pinpet-sdk.cjs.js +262 -301
- package/dist/pinpet-sdk.esm.js +262 -301
- package/dist/pinpet-sdk.js +262 -301
- package/dist/pinpet-sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/idl/pinpet.json +94 -99
- package/src/idl/pinpet_del.json +3730 -0
- package/src/modules/chain.js +86 -79
- package/src/modules/simulator/buy_sell_token.js +16 -14
- package/src/modules/simulator/long_shrot_stop.js +12 -12
- package/src/modules/simulator/utils.js +3 -3
- package/src/modules/simulator.js +22 -23
- package/src/modules/token.js +21 -63
- package/src/modules/trading.js +8 -8
package/dist/pinpet-sdk.js
CHANGED
|
@@ -20261,9 +20261,9 @@
|
|
|
20261
20261
|
|
|
20262
20262
|
// Maximum number of candidate indices to include in close_insert_indices
|
|
20263
20263
|
// This represents: 1 main position + N nodes before + N nodes after
|
|
20264
|
-
// Must be an odd number >= 1 (e.g.,
|
|
20265
|
-
// The contract accepts up to
|
|
20266
|
-
const MAX_CANDIDATE_INDICES$3 =
|
|
20264
|
+
// Must be an odd number >= 1 (e.g., 41 = 1 main + 20 before + 20 after)
|
|
20265
|
+
// The contract accepts up to 41
|
|
20266
|
+
const MAX_CANDIDATE_INDICES$3 = 19;
|
|
20267
20267
|
|
|
20268
20268
|
|
|
20269
20269
|
/**
|
|
@@ -20382,8 +20382,8 @@
|
|
|
20382
20382
|
)
|
|
20383
20383
|
: null;
|
|
20384
20384
|
|
|
20385
|
-
// 6. Get fee recipient accounts from curve account
|
|
20386
|
-
const curveAccountInfo = await this.sdk.chain.getCurveAccount(mint);
|
|
20385
|
+
// 6. Get fee recipient accounts from curve account (skipBalances: only need addresses)
|
|
20386
|
+
const curveAccountInfo = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
|
|
20387
20387
|
const feeRecipientAccount = new PublicKey$6(curveAccountInfo.feeRecipient);
|
|
20388
20388
|
const baseFeeRecipientAccount = new PublicKey$6(curveAccountInfo.baseFeeRecipient);
|
|
20389
20389
|
|
|
@@ -20518,8 +20518,8 @@
|
|
|
20518
20518
|
)
|
|
20519
20519
|
: null;
|
|
20520
20520
|
|
|
20521
|
-
// 6. Get fee recipient accounts from curve account
|
|
20522
|
-
const curveAccountInfo = await this.sdk.chain.getCurveAccount(mint);
|
|
20521
|
+
// 6. Get fee recipient accounts from curve account (skipBalances: only need addresses)
|
|
20522
|
+
const curveAccountInfo = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
|
|
20523
20523
|
const feeRecipientAccount = new PublicKey$6(curveAccountInfo.feeRecipient);
|
|
20524
20524
|
const baseFeeRecipientAccount = new PublicKey$6(curveAccountInfo.baseFeeRecipient);
|
|
20525
20525
|
|
|
@@ -20898,8 +20898,8 @@
|
|
|
20898
20898
|
this.sdk.programId
|
|
20899
20899
|
);
|
|
20900
20900
|
|
|
20901
|
-
// 4. 从 curve account 获取手续费接收账户 / Get fee recipient accounts from curve account
|
|
20902
|
-
const curveAccountInfo = await this.sdk.chain.getCurveAccount(mint);
|
|
20901
|
+
// 4. 从 curve account 获取手续费接收账户 / Get fee recipient accounts from curve account (skipBalances: only need addresses)
|
|
20902
|
+
const curveAccountInfo = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
|
|
20903
20903
|
const feeRecipientAccount = new PublicKey$6(curveAccountInfo.feeRecipient);
|
|
20904
20904
|
const baseFeeRecipientAccount = new PublicKey$6(curveAccountInfo.baseFeeRecipient);
|
|
20905
20905
|
|
|
@@ -21047,8 +21047,8 @@
|
|
|
21047
21047
|
this.sdk.programId
|
|
21048
21048
|
);
|
|
21049
21049
|
|
|
21050
|
-
// 4. 从 curve account 获取手续费接收账户 / Get fee recipient accounts from curve account
|
|
21051
|
-
const curveAccountInfo = await this.sdk.chain.getCurveAccount(mint);
|
|
21050
|
+
// 4. 从 curve account 获取手续费接收账户 / Get fee recipient accounts from curve account (skipBalances: only need addresses)
|
|
21051
|
+
const curveAccountInfo = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
|
|
21052
21052
|
const feeRecipientAccount = new PublicKey$6(curveAccountInfo.feeRecipient);
|
|
21053
21053
|
const baseFeeRecipientAccount = new PublicKey$6(curveAccountInfo.baseFeeRecipient);
|
|
21054
21054
|
|
|
@@ -21150,7 +21150,7 @@
|
|
|
21150
21150
|
|
|
21151
21151
|
var trading = TradingModule$1;
|
|
21152
21152
|
|
|
21153
|
-
const { ComputeBudgetProgram, PublicKey: PublicKey$5, Transaction: Transaction$2, Keypair, SystemProgram: SystemProgram$2, SYSVAR_RENT_PUBKEY: SYSVAR_RENT_PUBKEY$1
|
|
21153
|
+
const { ComputeBudgetProgram, PublicKey: PublicKey$5, Transaction: Transaction$2, Keypair, SystemProgram: SystemProgram$2, SYSVAR_RENT_PUBKEY: SYSVAR_RENT_PUBKEY$1 } = require$$0__default["default"];
|
|
21154
21154
|
const { TOKEN_PROGRAM_ID: TOKEN_PROGRAM_ID$1, getAssociatedTokenAddress: getAssociatedTokenAddress$1, createAssociatedTokenAccountInstruction, ASSOCIATED_TOKEN_PROGRAM_ID: ASSOCIATED_TOKEN_PROGRAM_ID$1 } = cjs$3;
|
|
21155
21155
|
const anchor$3 = require$$0__default$1["default"];
|
|
21156
21156
|
// 统一使用 buffer 包,所有平台一致
|
|
@@ -21387,13 +21387,8 @@
|
|
|
21387
21387
|
}
|
|
21388
21388
|
|
|
21389
21389
|
/**
|
|
21390
|
-
* Create token and buy in one transaction
|
|
21391
|
-
* 将 create 和 buy
|
|
21392
|
-
*
|
|
21393
|
-
* 注意:返回的 transaction 是 VersionedTransaction 类型(非 Legacy Transaction)
|
|
21394
|
-
* - feePayer 和 recentBlockhash 已在 SDK 端设置,网站端不需要再设置
|
|
21395
|
-
* - 签名方式:先 transaction.sign([mintKeypair]),再 phantom.signTransaction(tx)
|
|
21396
|
-
* - 发送方式:connection.sendRawTransaction(signedTx.serialize())
|
|
21390
|
+
* Create token and buy in one transaction
|
|
21391
|
+
* 将 create 和 buy 两个指令合并到一个交易中,一次签名提交
|
|
21397
21392
|
*
|
|
21398
21393
|
* @param {Object} params - Creation and buy parameters
|
|
21399
21394
|
* @param {Keypair} params.mint - Token mint keypair
|
|
@@ -21413,20 +21408,7 @@
|
|
|
21413
21408
|
*
|
|
21414
21409
|
* @param {Object} options - Optional parameters
|
|
21415
21410
|
* @param {number} options.computeUnits - Compute units limit, default 1800000
|
|
21416
|
-
* @returns {Promise<Object>} Object containing
|
|
21417
|
-
*
|
|
21418
|
-
* @example
|
|
21419
|
-
* // Node.js 环境
|
|
21420
|
-
* const result = await sdk.token.createAndBuy({...});
|
|
21421
|
-
* result.transaction.sign([wallet, ...result.signers]);
|
|
21422
|
-
* const sig = await connection.sendRawTransaction(result.transaction.serialize());
|
|
21423
|
-
*
|
|
21424
|
-
* @example
|
|
21425
|
-
* // 浏览器 Phantom 环境
|
|
21426
|
-
* const result = await sdk.token.createAndBuy({...});
|
|
21427
|
-
* result.transaction.sign(result.signers); // mint keypair 先签名
|
|
21428
|
-
* const signed = await phantom.signTransaction(result.transaction); // Phantom 追加 payer 签名
|
|
21429
|
-
* const sig = await connection.sendRawTransaction(signed.serialize());
|
|
21411
|
+
* @returns {Promise<Object>} Object containing transaction, signers and account info
|
|
21430
21412
|
*/
|
|
21431
21413
|
async createAndBuy({
|
|
21432
21414
|
mint,
|
|
@@ -21445,7 +21427,7 @@
|
|
|
21445
21427
|
}, options = {}) {
|
|
21446
21428
|
const { computeUnits = 1800000 } = options;
|
|
21447
21429
|
|
|
21448
|
-
console.log('Token Module - CreateAndBuy
|
|
21430
|
+
console.log('Token Module - CreateAndBuy:', {
|
|
21449
21431
|
mint: mint.publicKey.toString(),
|
|
21450
21432
|
name,
|
|
21451
21433
|
symbol,
|
|
@@ -21481,6 +21463,7 @@
|
|
|
21481
21463
|
console.log('Step 2: Fetching fee recipient accounts from params...');
|
|
21482
21464
|
|
|
21483
21465
|
// 直接从 SDK 配置中获取手续费接收账户(这些在 SDK 初始化时已经设置)
|
|
21466
|
+
// 避免使用 program.account.params.fetch() 因为可能有 provider 配置问题
|
|
21484
21467
|
const feeRecipientAccount = this.sdk.feeRecipient;
|
|
21485
21468
|
const baseFeeRecipientAccount = this.sdk.baseFeeRecipient;
|
|
21486
21469
|
|
|
@@ -21571,54 +21554,42 @@
|
|
|
21571
21554
|
})
|
|
21572
21555
|
.instruction();
|
|
21573
21556
|
|
|
21574
|
-
// 7.
|
|
21575
|
-
console.log('Step 6:
|
|
21576
|
-
const
|
|
21557
|
+
// 7. 合并交易:create + buy
|
|
21558
|
+
console.log('Step 6: Merging create and buy transactions...');
|
|
21559
|
+
const transaction = new Transaction$2();
|
|
21577
21560
|
|
|
21578
21561
|
// 设置计算单元限制
|
|
21579
21562
|
const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
|
|
21580
21563
|
units: computeUnits
|
|
21581
21564
|
});
|
|
21582
|
-
|
|
21565
|
+
transaction.add(modifyComputeUnits);
|
|
21583
21566
|
|
|
21584
21567
|
// 添加 create 交易的所有指令(跳过 create 中的计算单元指令)
|
|
21585
21568
|
createResult.transaction.instructions.forEach(ix => {
|
|
21569
|
+
// 跳过 create 交易中的计算单元指令(我们已经添加了)
|
|
21586
21570
|
if (ix.programId.equals(ComputeBudgetProgram.programId)) {
|
|
21587
21571
|
return;
|
|
21588
21572
|
}
|
|
21589
|
-
|
|
21573
|
+
transaction.add(ix);
|
|
21590
21574
|
});
|
|
21591
21575
|
|
|
21592
21576
|
// 添加 ATA 创建指令(如果需要)
|
|
21593
21577
|
if (createAtaIx) {
|
|
21594
|
-
|
|
21578
|
+
transaction.add(createAtaIx);
|
|
21595
21579
|
}
|
|
21596
21580
|
|
|
21597
|
-
// 添加 buy 指令
|
|
21598
|
-
|
|
21599
|
-
|
|
21600
|
-
// 8. 获取最新 blockhash 并构建 VersionedTransaction
|
|
21601
|
-
const blockhashResult = await this.sdk.connection.getLatestBlockhash('confirmed');
|
|
21602
|
-
|
|
21603
|
-
const messageV0 = new TransactionMessage({
|
|
21604
|
-
payerKey: payer,
|
|
21605
|
-
recentBlockhash: blockhashResult.blockhash,
|
|
21606
|
-
instructions: instructions,
|
|
21607
|
-
}).compileToV0Message();
|
|
21608
|
-
|
|
21609
|
-
const transaction = new VersionedTransaction(messageV0);
|
|
21610
|
-
|
|
21611
|
-
// 9. 用 mint keypair 预签名(调用方只需 payer 签名)
|
|
21612
|
-
transaction.sign([mint]);
|
|
21581
|
+
// 添加 buy 指令
|
|
21582
|
+
transaction.add(buyIx);
|
|
21613
21583
|
|
|
21614
|
-
console.log('CreateAndBuy
|
|
21615
|
-
console.log(' Total instructions:', instructions.length);
|
|
21584
|
+
console.log('CreateAndBuy transaction built successfully:');
|
|
21585
|
+
console.log(' Total instructions:', transaction.instructions.length);
|
|
21616
21586
|
console.log(' Compute units:', computeUnits);
|
|
21617
|
-
console.log('
|
|
21587
|
+
console.log(' Signers required:', [payer.toString(), mint.publicKey.toString()]);
|
|
21618
21588
|
|
|
21619
|
-
//
|
|
21589
|
+
// 8. 返回合并后的交易
|
|
21620
21590
|
return {
|
|
21621
|
-
transaction,
|
|
21591
|
+
transaction,
|
|
21592
|
+
signers: [mint], // mint keypair 需要签名
|
|
21622
21593
|
accounts: {
|
|
21623
21594
|
// create 的账户
|
|
21624
21595
|
...createResult.accounts,
|
|
@@ -21627,23 +21598,10 @@
|
|
|
21627
21598
|
cooldown: cooldownPDA,
|
|
21628
21599
|
feeRecipientAccount,
|
|
21629
21600
|
baseFeeRecipientAccount
|
|
21630
|
-
},
|
|
21631
|
-
// 返回 blockhash 信息供调用方确认交易使用
|
|
21632
|
-
blockhashInfo: {
|
|
21633
|
-
blockhash: blockhashResult.blockhash,
|
|
21634
|
-
lastValidBlockHeight: blockhashResult.lastValidBlockHeight
|
|
21635
21601
|
}
|
|
21636
21602
|
};
|
|
21637
21603
|
}
|
|
21638
21604
|
|
|
21639
|
-
/**
|
|
21640
|
-
* createAndBuy 的别名(功能完全相同)
|
|
21641
|
-
* 保留此方法以保持向后兼容
|
|
21642
|
-
*/
|
|
21643
|
-
async createAndBuySign(params, options = {}) {
|
|
21644
|
-
return this.createAndBuy(params, options);
|
|
21645
|
-
}
|
|
21646
|
-
|
|
21647
21605
|
}
|
|
21648
21606
|
|
|
21649
21607
|
var token = TokenModule$1;
|
|
@@ -33915,7 +33873,7 @@
|
|
|
33915
33873
|
|
|
33916
33874
|
// 如果没有传入 borrowFee 或池子参数,从链上一次性获取
|
|
33917
33875
|
if (borrowFee === null || initialVirtualSol === null || initialVirtualToken === null) {
|
|
33918
|
-
const curveAccount = await this.sdk.chain.getCurveAccount(mint);
|
|
33876
|
+
const curveAccount = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
|
|
33919
33877
|
if (borrowFee === null) borrowFee = curveAccount.borrowFee;
|
|
33920
33878
|
// 链上返回的是 u64 原始单位(lamports/最小单位),需要除以 10^9 转为人类可读单位
|
|
33921
33879
|
// 与 calcLiq.js 中的转换方式一致
|
|
@@ -34235,7 +34193,7 @@
|
|
|
34235
34193
|
|
|
34236
34194
|
// 如果没有传入 borrowFee 或池子参数,从链上一次性获取
|
|
34237
34195
|
if (borrowFee === null || initialVirtualSol === null || initialVirtualToken === null) {
|
|
34238
|
-
const curveAccount = await this.sdk.chain.getCurveAccount(mint);
|
|
34196
|
+
const curveAccount = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
|
|
34239
34197
|
if (borrowFee === null) borrowFee = curveAccount.borrowFee;
|
|
34240
34198
|
// 链上返回的是 u64 原始单位(lamports/最小单位),需要除以 10^9 转为人类可读单位
|
|
34241
34199
|
// 与 calcLiq.js 中的转换方式一致
|
|
@@ -34483,19 +34441,19 @@
|
|
|
34483
34441
|
* @since 2.0.0
|
|
34484
34442
|
* @version 2.0.0 - 从返回 prev_order_pda/next_order_pda 改为返回 close_insert_indices
|
|
34485
34443
|
*/
|
|
34486
|
-
async function simulateLongSolStopLoss$1(mint, buySolAmount, stopLossPrice, lastPrice = null, ordersData = null, borrowFee = null, initialVirtualSol = null, initialVirtualToken = null) {
|
|
34444
|
+
async function simulateLongSolStopLoss$1(mint, buySolAmount, stopLossPrice, lastPrice = null, ordersData = null, borrowFee = null, initialVirtualSol = null, initialVirtualToken = null, curveAccount = null) {
|
|
34487
34445
|
try {
|
|
34488
34446
|
// Parameter validation
|
|
34489
34447
|
if (!mint || !buySolAmount || !stopLossPrice) {
|
|
34490
34448
|
throw new Error('Missing required parameters');
|
|
34491
34449
|
}
|
|
34492
34450
|
|
|
34493
|
-
// 如果没有传入 borrowFee
|
|
34451
|
+
// 如果没有传入 borrowFee 或池子参数,从链上一次性获取(支持外部传入 curveAccount 避免重复 RPC)
|
|
34494
34452
|
if (borrowFee === null || initialVirtualSol === null || initialVirtualToken === null) {
|
|
34495
|
-
|
|
34453
|
+
if (!curveAccount) {
|
|
34454
|
+
curveAccount = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
|
|
34455
|
+
}
|
|
34496
34456
|
if (borrowFee === null) borrowFee = curveAccount.borrowFee;
|
|
34497
|
-
// 链上返回的是 u64 原始单位(lamports/最小单位),需要除以 10^9 转为人类可读单位
|
|
34498
|
-
// 与 calcLiq.js 中的转换方式一致
|
|
34499
34457
|
if (initialVirtualSol === null) initialVirtualSol = new Decimal$1(curveAccount.initialVirtualSol.toString()).div(CurveAMM$6.SOL_PRECISION_FACTOR_DECIMAL).toString();
|
|
34500
34458
|
if (initialVirtualToken === null) initialVirtualToken = new Decimal$1(curveAccount.initialVirtualToken.toString()).div(CurveAMM$6.TOKEN_PRECISION_FACTOR_DECIMAL).toString();
|
|
34501
34459
|
}
|
|
@@ -34667,19 +34625,19 @@
|
|
|
34667
34625
|
* @since 2.0.0
|
|
34668
34626
|
* @version 2.0.0 - 从返回 prev_order_pda/next_order_pda 改为返回 close_insert_indices
|
|
34669
34627
|
*/
|
|
34670
|
-
async function simulateShortSolStopLoss$1(mint, sellSolAmount, stopLossPrice, lastPrice = null, ordersData = null, borrowFee = null, initialVirtualSol = null, initialVirtualToken = null) {
|
|
34628
|
+
async function simulateShortSolStopLoss$1(mint, sellSolAmount, stopLossPrice, lastPrice = null, ordersData = null, borrowFee = null, initialVirtualSol = null, initialVirtualToken = null, curveAccount = null) {
|
|
34671
34629
|
try {
|
|
34672
34630
|
// Parameter validation
|
|
34673
34631
|
if (!mint || !sellSolAmount || !stopLossPrice) {
|
|
34674
34632
|
throw new Error('Missing required parameters');
|
|
34675
34633
|
}
|
|
34676
34634
|
|
|
34677
|
-
// 如果没有传入 borrowFee
|
|
34635
|
+
// 如果没有传入 borrowFee 或池子参数,从链上一次性获取(支持外部传入 curveAccount 避免重复 RPC)
|
|
34678
34636
|
if (borrowFee === null || initialVirtualSol === null || initialVirtualToken === null) {
|
|
34679
|
-
|
|
34637
|
+
if (!curveAccount) {
|
|
34638
|
+
curveAccount = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
|
|
34639
|
+
}
|
|
34680
34640
|
if (borrowFee === null) borrowFee = curveAccount.borrowFee;
|
|
34681
|
-
// 链上返回的是 u64 原始单位(lamports/最小单位),需要除以 10^9 转为人类可读单位
|
|
34682
|
-
// 与 calcLiq.js 中的转换方式一致
|
|
34683
34641
|
if (initialVirtualSol === null) initialVirtualSol = new Decimal$1(curveAccount.initialVirtualSol.toString()).div(CurveAMM$6.SOL_PRECISION_FACTOR_DECIMAL).toString();
|
|
34684
34642
|
if (initialVirtualToken === null) initialVirtualToken = new Decimal$1(curveAccount.initialVirtualToken.toString()).div(CurveAMM$6.TOKEN_PRECISION_FACTOR_DECIMAL).toString();
|
|
34685
34643
|
}
|
|
@@ -35608,7 +35566,7 @@
|
|
|
35608
35566
|
* - suggestedTokenAmount: {string} Recommended token amount to buy based on available liquidity
|
|
35609
35567
|
* - suggestedSolAmount: {string} Required SOL amount for suggested token purchase
|
|
35610
35568
|
*/
|
|
35611
|
-
async function simulateTokenBuy$1(mint, buyTokenAmount, passOrder = null, lastPrice = null, ordersData = null) {
|
|
35569
|
+
async function simulateTokenBuy$1(mint, buyTokenAmount, passOrder = null, lastPrice = null, ordersData = null, curveData = null) {
|
|
35612
35570
|
// 获取价格和订单数据
|
|
35613
35571
|
|
|
35614
35572
|
//console.log('simulateTokenBuy', mint, buyTokenAmount, passOrder, lastPrice, ordersData);
|
|
@@ -35631,12 +35589,13 @@
|
|
|
35631
35589
|
orders = ordersData.data.orders.slice(0, this.sdk.MAX_ORDERS_COUNT + 1);
|
|
35632
35590
|
}
|
|
35633
35591
|
|
|
35634
|
-
//
|
|
35635
|
-
|
|
35636
|
-
|
|
35637
|
-
|
|
35638
|
-
|
|
35639
|
-
|
|
35592
|
+
// 获取动态流动池参数(支持外部传入,避免重复请求)
|
|
35593
|
+
if (!curveData) {
|
|
35594
|
+
try {
|
|
35595
|
+
curveData = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
|
|
35596
|
+
} catch (error) {
|
|
35597
|
+
throw new Error(`Failed to get curve account data: ${error.message}`);
|
|
35598
|
+
}
|
|
35640
35599
|
}
|
|
35641
35600
|
|
|
35642
35601
|
// 调用 calcLiqTokenBuy 进行流动性计算(传入动态流动池参数)
|
|
@@ -35764,7 +35723,7 @@
|
|
|
35764
35723
|
* - suggestedTokenAmount: {string} Recommended token amount to sell based on available liquidity
|
|
35765
35724
|
* - suggestedSolAmount: {string} Expected SOL amount from suggested token sale
|
|
35766
35725
|
*/
|
|
35767
|
-
async function simulateTokenSell$1(mint, sellTokenAmount, passOrder = null, lastPrice = null, ordersData = null) {
|
|
35726
|
+
async function simulateTokenSell$1(mint, sellTokenAmount, passOrder = null, lastPrice = null, ordersData = null, curveData = null) {
|
|
35768
35727
|
// 获取价格和订单数据
|
|
35769
35728
|
let price = lastPrice;
|
|
35770
35729
|
if (!price) {
|
|
@@ -35786,12 +35745,13 @@
|
|
|
35786
35745
|
orders = ordersData.data.orders.slice(0, this.sdk.MAX_ORDERS_COUNT + 1);
|
|
35787
35746
|
}
|
|
35788
35747
|
|
|
35789
|
-
//
|
|
35790
|
-
|
|
35791
|
-
|
|
35792
|
-
|
|
35793
|
-
|
|
35794
|
-
|
|
35748
|
+
// 获取动态流动池参数(支持外部传入,避免重复请求)
|
|
35749
|
+
if (!curveData) {
|
|
35750
|
+
try {
|
|
35751
|
+
curveData = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
|
|
35752
|
+
} catch (error) {
|
|
35753
|
+
throw new Error(`Failed to get curve account data: ${error.message}`);
|
|
35754
|
+
}
|
|
35795
35755
|
}
|
|
35796
35756
|
|
|
35797
35757
|
// console.log('simulateTokenSell 获取的数据:');
|
|
@@ -36435,8 +36395,8 @@
|
|
|
36435
36395
|
* - suggestedTokenAmount: {string} Recommended token amount to buy based on available liquidity
|
|
36436
36396
|
* - suggestedSolAmount: {string} Required SOL amount for suggested token purchase
|
|
36437
36397
|
*/
|
|
36438
|
-
async simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPrice = null, ordersData = null) {
|
|
36439
|
-
return simulateTokenBuy.call(this, mint, buyTokenAmount, passOrder, lastPrice, ordersData);
|
|
36398
|
+
async simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPrice = null, ordersData = null, curveData = null) {
|
|
36399
|
+
return simulateTokenBuy.call(this, mint, buyTokenAmount, passOrder, lastPrice, ordersData, curveData);
|
|
36440
36400
|
}
|
|
36441
36401
|
|
|
36442
36402
|
/**
|
|
@@ -36462,8 +36422,8 @@
|
|
|
36462
36422
|
* - suggestedTokenAmount: {string} Recommended token amount to sell based on available liquidity
|
|
36463
36423
|
* - suggestedSolAmount: {string} Expected SOL amount from suggested token sale
|
|
36464
36424
|
*/
|
|
36465
|
-
async simulateTokenSell(mint, sellTokenAmount, passOrder = null, lastPrice = null, ordersData = null) {
|
|
36466
|
-
return simulateTokenSell.call(this, mint, sellTokenAmount, passOrder, lastPrice, ordersData);
|
|
36425
|
+
async simulateTokenSell(mint, sellTokenAmount, passOrder = null, lastPrice = null, ordersData = null, curveData = null) {
|
|
36426
|
+
return simulateTokenSell.call(this, mint, sellTokenAmount, passOrder, lastPrice, ordersData, curveData);
|
|
36467
36427
|
}
|
|
36468
36428
|
|
|
36469
36429
|
/**
|
|
@@ -36502,8 +36462,8 @@
|
|
|
36502
36462
|
* @param {number} borrowFee - Borrow fee rate, default 2000 (2000/100000 = 0.02%)
|
|
36503
36463
|
* @returns {Promise<Object>} Stop loss analysis result (same as simulateLongStopLoss)
|
|
36504
36464
|
*/
|
|
36505
|
-
async simulateLongSolStopLoss(mint, buySolAmount, stopLossPrice, lastPrice = null, ordersData = null, borrowFee = null) {
|
|
36506
|
-
return simulateLongSolStopLoss.call(this, mint, buySolAmount, stopLossPrice, lastPrice, ordersData, borrowFee);
|
|
36465
|
+
async simulateLongSolStopLoss(mint, buySolAmount, stopLossPrice, lastPrice = null, ordersData = null, borrowFee = null, initialVirtualSol = null, initialVirtualToken = null, curveAccount = null) {
|
|
36466
|
+
return simulateLongSolStopLoss.call(this, mint, buySolAmount, stopLossPrice, lastPrice, ordersData, borrowFee, initialVirtualSol, initialVirtualToken, curveAccount);
|
|
36507
36467
|
}
|
|
36508
36468
|
|
|
36509
36469
|
/**
|
|
@@ -36516,8 +36476,8 @@
|
|
|
36516
36476
|
* @param {number} borrowFee - Borrow fee rate, default 2000 (2000/100000 = 0.02%)
|
|
36517
36477
|
* @returns {Promise<Object>} Stop loss analysis result (same as simulateShortStopLoss)
|
|
36518
36478
|
*/
|
|
36519
|
-
async simulateShortSolStopLoss(mint, sellSolAmount, stopLossPrice, lastPrice = null, ordersData = null, borrowFee = null) {
|
|
36520
|
-
return simulateShortSolStopLoss.call(this, mint, sellSolAmount, stopLossPrice, lastPrice, ordersData, borrowFee);
|
|
36479
|
+
async simulateShortSolStopLoss(mint, sellSolAmount, stopLossPrice, lastPrice = null, ordersData = null, borrowFee = null, initialVirtualSol = null, initialVirtualToken = null, curveAccount = null) {
|
|
36480
|
+
return simulateShortSolStopLoss.call(this, mint, sellSolAmount, stopLossPrice, lastPrice, ordersData, borrowFee, initialVirtualSol, initialVirtualToken, curveAccount);
|
|
36521
36481
|
}
|
|
36522
36482
|
|
|
36523
36483
|
/**
|
|
@@ -36596,15 +36556,13 @@
|
|
|
36596
36556
|
};
|
|
36597
36557
|
}
|
|
36598
36558
|
|
|
36599
|
-
// Get current price and
|
|
36600
|
-
const priceResult = await
|
|
36601
|
-
|
|
36602
|
-
|
|
36603
|
-
|
|
36604
|
-
|
|
36605
|
-
|
|
36606
|
-
console.log("upOrdersResult:",upOrdersResult);
|
|
36607
|
-
console.log("upOrdersResult:",upOrdersResult.data.orders);
|
|
36559
|
+
// Get current price, orders data, and curve account in parallel
|
|
36560
|
+
const [priceResult, ordersResult, upOrdersResult, curveAccount] = await Promise.all([
|
|
36561
|
+
this.sdk.data.price(mint),
|
|
36562
|
+
this.sdk.data.orders(mint, { type: 'down_orders' }),
|
|
36563
|
+
this.sdk.data.orders(mint, { type: 'up_orders' }),
|
|
36564
|
+
this.sdk.chain.getCurveAccount(mint, { skipBalances: true })
|
|
36565
|
+
]);
|
|
36608
36566
|
|
|
36609
36567
|
if (!priceResult || !ordersResult) {
|
|
36610
36568
|
return {
|
|
@@ -36620,7 +36578,6 @@
|
|
|
36620
36578
|
const currentPrice = typeof priceResult === 'string' ? BigInt(priceResult) : BigInt(priceResult.last_price || priceResult);
|
|
36621
36579
|
|
|
36622
36580
|
// Get curve account data for initialVirtualSol and initialVirtualToken
|
|
36623
|
-
const curveAccount = await this.sdk.chain.getCurveAccount(mint);
|
|
36624
36581
|
const initialVirtualSol = curveAccount.initialVirtualSol;
|
|
36625
36582
|
const initialVirtualToken = curveAccount.initialVirtualToken;
|
|
36626
36583
|
|
|
@@ -36630,8 +36587,8 @@
|
|
|
36630
36587
|
|
|
36631
36588
|
const estimatedTokenAmount = reSolBuy.tokenAmount;
|
|
36632
36589
|
|
|
36633
|
-
// Call simulateTokenBuy with estimated amount
|
|
36634
|
-
const tokenBuyResult = await this.simulateTokenBuy(mint, estimatedTokenAmount, null, priceResult, ordersResult);
|
|
36590
|
+
// Call simulateTokenBuy with estimated amount, pass curveAccount to avoid duplicate RPC
|
|
36591
|
+
const tokenBuyResult = await this.simulateTokenBuy(mint, estimatedTokenAmount, null, priceResult, ordersResult, curveAccount);
|
|
36635
36592
|
|
|
36636
36593
|
// Transform result to match simulateBuy format
|
|
36637
36594
|
return {
|
|
@@ -36717,10 +36674,12 @@
|
|
|
36717
36674
|
};
|
|
36718
36675
|
}
|
|
36719
36676
|
|
|
36720
|
-
// Get current price and orders data
|
|
36677
|
+
// Get current price and orders data in parallel
|
|
36721
36678
|
// For sell transactions, we need down_orders (long orders that provide buy liquidity)
|
|
36722
|
-
const priceResult = await
|
|
36723
|
-
|
|
36679
|
+
const [priceResult, ordersResult] = await Promise.all([
|
|
36680
|
+
this.sdk.data.price(mint),
|
|
36681
|
+
this.sdk.data.orders(mint, { type: 'down_orders' })
|
|
36682
|
+
]);
|
|
36724
36683
|
|
|
36725
36684
|
if (!priceResult || !ordersResult) {
|
|
36726
36685
|
return {
|
|
@@ -36793,6 +36752,21 @@
|
|
|
36793
36752
|
class ChainModule$1 {
|
|
36794
36753
|
constructor(sdk) {
|
|
36795
36754
|
this.sdk = sdk;
|
|
36755
|
+
// getCurveAccount 缓存:key = mint string, value = { data, timestamp }
|
|
36756
|
+
this._curveAccountCache = new Map();
|
|
36757
|
+
this._CACHE_TTL = 10000; // 10 秒 TTL
|
|
36758
|
+
}
|
|
36759
|
+
|
|
36760
|
+
/**
|
|
36761
|
+
* 清除指定 mint 的 curveAccount 缓存(交易后调用)
|
|
36762
|
+
* @param {string} [mint] - 指定 mint 地址,不传则清除全部
|
|
36763
|
+
*/
|
|
36764
|
+
invalidateCurveCache(mint) {
|
|
36765
|
+
if (mint) {
|
|
36766
|
+
this._curveAccountCache.delete(typeof mint === 'string' ? mint : mint.toString());
|
|
36767
|
+
} else {
|
|
36768
|
+
this._curveAccountCache.clear();
|
|
36769
|
+
}
|
|
36796
36770
|
}
|
|
36797
36771
|
|
|
36798
36772
|
/**
|
|
@@ -36921,10 +36895,23 @@
|
|
|
36921
36895
|
* @version 2.0.0 - Updated to use new OrderBook structure (up_orderbook/down_orderbook instead of upHead/downHead)
|
|
36922
36896
|
* @author SpinPet SDK Team
|
|
36923
36897
|
*/
|
|
36924
|
-
async getCurveAccount(mint) {
|
|
36898
|
+
async getCurveAccount(mint, options = {}) {
|
|
36899
|
+
const { skipBalances = false } = options;
|
|
36925
36900
|
try {
|
|
36926
36901
|
// Parameter validation and conversion
|
|
36927
36902
|
const mintPubkey = typeof mint === 'string' ? new PublicKey$3(mint) : mint;
|
|
36903
|
+
const mintKey = mintPubkey.toString();
|
|
36904
|
+
|
|
36905
|
+
// 检查缓存
|
|
36906
|
+
const cached = this._curveAccountCache.get(mintKey);
|
|
36907
|
+
if (cached && (Date.now() - cached.timestamp < this._CACHE_TTL)) {
|
|
36908
|
+
// 缓存命中:如果请求包含余额但缓存没有,需要重新获取余额部分
|
|
36909
|
+
if (!skipBalances && cached.skipBalances) {
|
|
36910
|
+
// 缓存是 skipBalances 的,但现在需要余额,需要补充查询
|
|
36911
|
+
} else {
|
|
36912
|
+
return cached.data;
|
|
36913
|
+
}
|
|
36914
|
+
}
|
|
36928
36915
|
|
|
36929
36916
|
// Calculate curve_account PDA address
|
|
36930
36917
|
// Use the same seeds as in the contract: [b"borrowing_curve", mint_account.key().as_ref()]
|
|
@@ -36982,18 +36969,25 @@
|
|
|
36982
36969
|
this.sdk.programId
|
|
36983
36970
|
);
|
|
36984
36971
|
|
|
36985
|
-
// Query
|
|
36986
|
-
|
|
36987
|
-
|
|
36988
|
-
|
|
36989
|
-
|
|
36990
|
-
|
|
36991
|
-
|
|
36992
|
-
|
|
36993
|
-
|
|
36994
|
-
|
|
36995
|
-
|
|
36996
|
-
|
|
36972
|
+
// Query balances (skip if not needed)
|
|
36973
|
+
let baseFeeRecipientBalance = 0;
|
|
36974
|
+
let feeRecipientBalance = 0;
|
|
36975
|
+
let poolTokenBalance = { value: { amount: '0' } };
|
|
36976
|
+
let poolSolBalance = 0;
|
|
36977
|
+
|
|
36978
|
+
if (!skipBalances) {
|
|
36979
|
+
[
|
|
36980
|
+
baseFeeRecipientBalance,
|
|
36981
|
+
feeRecipientBalance,
|
|
36982
|
+
poolTokenBalance,
|
|
36983
|
+
poolSolBalance
|
|
36984
|
+
] = await Promise.all([
|
|
36985
|
+
this.sdk.connection.getBalance(decodedData.baseFeeRecipient),
|
|
36986
|
+
this.sdk.connection.getBalance(decodedData.feeRecipient),
|
|
36987
|
+
this.sdk.connection.getTokenAccountBalance(poolTokenAccountPDA).catch(() => ({ value: { amount: '0' } })),
|
|
36988
|
+
this.sdk.connection.getBalance(poolSolAccountPDA)
|
|
36989
|
+
]);
|
|
36990
|
+
}
|
|
36997
36991
|
|
|
36998
36992
|
// Convert data format
|
|
36999
36993
|
const convertedData = {
|
|
@@ -37049,6 +37043,13 @@
|
|
|
37049
37043
|
}
|
|
37050
37044
|
};
|
|
37051
37045
|
|
|
37046
|
+
// 写入缓存
|
|
37047
|
+
this._curveAccountCache.set(mintKey, {
|
|
37048
|
+
data: convertedData,
|
|
37049
|
+
timestamp: Date.now(),
|
|
37050
|
+
skipBalances: skipBalances
|
|
37051
|
+
});
|
|
37052
|
+
|
|
37052
37053
|
// Return converted data
|
|
37053
37054
|
return convertedData;
|
|
37054
37055
|
|
|
@@ -37105,58 +37106,13 @@
|
|
|
37105
37106
|
}
|
|
37106
37107
|
|
|
37107
37108
|
try {
|
|
37108
|
-
//
|
|
37109
|
-
|
|
37110
|
-
|
|
37111
|
-
mintPubkey = typeof mint === 'string' ? new PublicKey$3(mint) : mint;
|
|
37112
|
-
} catch (pubkeyError) {
|
|
37113
|
-
throw new Error(`Invalid mint address: ${mint}`);
|
|
37114
|
-
}
|
|
37115
|
-
|
|
37116
|
-
// Validate mintPubkey
|
|
37117
|
-
if (!mintPubkey || typeof mintPubkey.toBuffer !== 'function') {
|
|
37118
|
-
throw new Error(`Invalid mintPubkey`);
|
|
37119
|
-
}
|
|
37120
|
-
|
|
37121
|
-
// Calculate curve_account PDA address
|
|
37122
|
-
const [curveAccountPDA] = PublicKey$3.findProgramAddressSync(
|
|
37123
|
-
[
|
|
37124
|
-
Buffer$3.from("borrowing_curve"),
|
|
37125
|
-
mintPubkey.toBuffer()
|
|
37126
|
-
],
|
|
37127
|
-
this.sdk.programId
|
|
37128
|
-
);
|
|
37129
|
-
|
|
37130
|
-
// Use Anchor program to fetch account data directly
|
|
37131
|
-
let decodedData;
|
|
37132
|
-
try {
|
|
37133
|
-
decodedData = await this.sdk.program.account.borrowingBondingCurve.fetch(curveAccountPDA);
|
|
37134
|
-
} catch (fetchError) {
|
|
37135
|
-
// If fetch fails, use raw method
|
|
37136
|
-
const accountInfo = await this.sdk.connection.getAccountInfo(curveAccountPDA);
|
|
37137
|
-
if (!accountInfo) {
|
|
37138
|
-
throw new Error(`curve_account does not exist`);
|
|
37139
|
-
}
|
|
37109
|
+
// 复用 getCurveAccount 缓存,避免重复 fetch 同一个账户
|
|
37110
|
+
const curveData = await this.getCurveAccount(mint, { skipBalances: true });
|
|
37111
|
+
const price = curveData.price;
|
|
37140
37112
|
|
|
37141
|
-
|
|
37142
|
-
|
|
37143
|
-
|
|
37144
|
-
try {
|
|
37145
|
-
decodedData = accountsCoder.decode('BorrowingBondingCurve', accountInfo.data);
|
|
37146
|
-
} catch (decodeError1) {
|
|
37147
|
-
try {
|
|
37148
|
-
decodedData = accountsCoder.decode('borrowingBondingCurve', accountInfo.data);
|
|
37149
|
-
} catch (decodeError2) {
|
|
37150
|
-
throw new Error(`Cannot decode account data: ${decodeError1.message}`);
|
|
37151
|
-
}
|
|
37152
|
-
}
|
|
37153
|
-
}
|
|
37154
|
-
|
|
37155
|
-
// Check price data and return
|
|
37156
|
-
if (decodedData.price && decodedData.price.toString() !== '0') {
|
|
37157
|
-
return decodedData.price.toString();
|
|
37113
|
+
if (price && price !== 0n) {
|
|
37114
|
+
return price.toString();
|
|
37158
37115
|
} else {
|
|
37159
|
-
// If no price data, return initial price
|
|
37160
37116
|
const initialPrice = CurveAMM$2.getInitialPrice();
|
|
37161
37117
|
if (initialPrice === null) {
|
|
37162
37118
|
throw new Error('price: Unable to calculate initial price');
|
|
@@ -37252,14 +37208,16 @@
|
|
|
37252
37208
|
// Convert API type to orderbook direction
|
|
37253
37209
|
// "up_orders" = short orders = upOrderbook (orderType=2)
|
|
37254
37210
|
// "down_orders" = long orders = downOrderbook (orderType=1)
|
|
37255
|
-
const
|
|
37211
|
+
const seed = orderType === 'up_orders' ? 'up_orderbook' : 'down_orderbook';
|
|
37256
37212
|
|
|
37257
|
-
//
|
|
37258
|
-
const
|
|
37259
|
-
const
|
|
37213
|
+
// 本地计算 orderbook PDA,避免调用 getCurveAccount(省 5 个 RPC)
|
|
37214
|
+
const mintPubkey = new PublicKey$3(mint);
|
|
37215
|
+
const [orderbookPubkey] = PublicKey$3.findProgramAddressSync(
|
|
37216
|
+
[Buffer$3.from(seed), mintPubkey.toBuffer()],
|
|
37217
|
+
this.sdk.programId
|
|
37218
|
+
);
|
|
37260
37219
|
|
|
37261
37220
|
// Get OrderBook account data
|
|
37262
|
-
const orderbookPubkey = new PublicKey$3(orderbookAddress);
|
|
37263
37221
|
const accountInfo = await this.sdk.connection.getAccountInfo(orderbookPubkey);
|
|
37264
37222
|
|
|
37265
37223
|
if (!accountInfo) {
|
|
@@ -37710,15 +37668,15 @@
|
|
|
37710
37668
|
throw new Error('debug_orders: order type must be "up_orders" or "down_orders"');
|
|
37711
37669
|
}
|
|
37712
37670
|
|
|
37713
|
-
//
|
|
37714
|
-
const
|
|
37715
|
-
|
|
37716
|
-
|
|
37717
|
-
|
|
37718
|
-
|
|
37671
|
+
// 本地计算 orderbook PDA,避免调用 getCurveAccount(省 5 个 RPC)
|
|
37672
|
+
const seed = orderType === 'up_orders' ? 'up_orderbook' : 'down_orderbook';
|
|
37673
|
+
const mintPubkey = new PublicKey$3(mint);
|
|
37674
|
+
const [orderbookPubkey] = PublicKey$3.findProgramAddressSync(
|
|
37675
|
+
[Buffer$3.from(seed), mintPubkey.toBuffer()],
|
|
37676
|
+
this.sdk.programId
|
|
37677
|
+
);
|
|
37719
37678
|
|
|
37720
37679
|
// Get OrderBook account data
|
|
37721
|
-
const orderbookPubkey = new PublicKey$3(orderbookAddress);
|
|
37722
37680
|
const accountInfo = await this.sdk.connection.getAccountInfo(orderbookPubkey);
|
|
37723
37681
|
|
|
37724
37682
|
if (!accountInfo) {
|
|
@@ -37921,10 +37879,18 @@
|
|
|
37921
37879
|
const page = 1; // Always return page 1
|
|
37922
37880
|
const orderBy = options.order_by || 'start_time_desc';
|
|
37923
37881
|
|
|
37924
|
-
//
|
|
37925
|
-
const
|
|
37926
|
-
const
|
|
37927
|
-
|
|
37882
|
+
// 本地计算 orderbook PDA,避免调用 getCurveAccount(省 5 个 RPC)
|
|
37883
|
+
const mintPubkey = new PublicKey$3(mint);
|
|
37884
|
+
const [upOrderbookPubkey] = PublicKey$3.findProgramAddressSync(
|
|
37885
|
+
[Buffer$3.from('up_orderbook'), mintPubkey.toBuffer()],
|
|
37886
|
+
this.sdk.programId
|
|
37887
|
+
);
|
|
37888
|
+
const [downOrderbookPubkey] = PublicKey$3.findProgramAddressSync(
|
|
37889
|
+
[Buffer$3.from('down_orderbook'), mintPubkey.toBuffer()],
|
|
37890
|
+
this.sdk.programId
|
|
37891
|
+
);
|
|
37892
|
+
const upOrderbookAddress = upOrderbookPubkey.toString(); // Short orders (orderType=2)
|
|
37893
|
+
const downOrderbookAddress = downOrderbookPubkey.toString(); // Long orders (orderType=1)
|
|
37928
37894
|
|
|
37929
37895
|
// Collect all user orders from both OrderBooks
|
|
37930
37896
|
const allUserOrders = [];
|
|
@@ -38452,7 +38418,7 @@
|
|
|
38452
38418
|
|
|
38453
38419
|
var orderUtils = OrderUtils$2;
|
|
38454
38420
|
|
|
38455
|
-
var address = "
|
|
38421
|
+
var address = "F2FzigE1Z374iDvreiM6hZQe6oGXgomJfv8PyybvUXye";
|
|
38456
38422
|
var metadata = {
|
|
38457
38423
|
name: "pinpet",
|
|
38458
38424
|
version: "0.1.0",
|
|
@@ -41026,476 +40992,471 @@
|
|
|
41026
40992
|
},
|
|
41027
40993
|
{
|
|
41028
40994
|
code: 6021,
|
|
41029
|
-
name: "CloseShortImpossibleState",
|
|
41030
|
-
msg: "Close short impossible state: current_total should always be greater than remaining_close_reduced_sol_with_fee"
|
|
41031
|
-
},
|
|
41032
|
-
{
|
|
41033
|
-
code: 6022,
|
|
41034
40995
|
name: "FeeSplitCalculationOverflow",
|
|
41035
40996
|
msg: "Fee split calculation overflow"
|
|
41036
40997
|
},
|
|
41037
40998
|
{
|
|
41038
|
-
code:
|
|
40999
|
+
code: 6022,
|
|
41039
41000
|
name: "FeeAccumulationOverflow",
|
|
41040
41001
|
msg: "Fee accumulation overflow"
|
|
41041
41002
|
},
|
|
41042
41003
|
{
|
|
41043
|
-
code:
|
|
41004
|
+
code: 6023,
|
|
41044
41005
|
name: "PartnerFeeAdditionOverflow",
|
|
41045
41006
|
msg: "Partner fee addition overflow"
|
|
41046
41007
|
},
|
|
41047
41008
|
{
|
|
41048
|
-
code:
|
|
41009
|
+
code: 6024,
|
|
41049
41010
|
name: "BaseFeeAdditionOverflow",
|
|
41050
41011
|
msg: "Base fee addition overflow"
|
|
41051
41012
|
},
|
|
41052
41013
|
{
|
|
41053
|
-
code:
|
|
41014
|
+
code: 6025,
|
|
41054
41015
|
name: "PoolFeeDeductionOverflow",
|
|
41055
41016
|
msg: "Pool fee deduction overflow"
|
|
41056
41017
|
},
|
|
41057
41018
|
{
|
|
41058
|
-
code:
|
|
41019
|
+
code: 6026,
|
|
41059
41020
|
name: "FeeRandomDiscountOverflow",
|
|
41060
41021
|
msg: "Fee random discount calculation overflow"
|
|
41061
41022
|
},
|
|
41062
41023
|
{
|
|
41063
|
-
code:
|
|
41024
|
+
code: 6027,
|
|
41064
41025
|
name: "SolReserveAdditionOverflow",
|
|
41065
41026
|
msg: "SOL reserve addition overflow"
|
|
41066
41027
|
},
|
|
41067
41028
|
{
|
|
41068
|
-
code:
|
|
41029
|
+
code: 6028,
|
|
41069
41030
|
name: "SolReserveDeductionOverflow",
|
|
41070
41031
|
msg: "SOL reserve deduction overflow"
|
|
41071
41032
|
},
|
|
41072
41033
|
{
|
|
41073
|
-
code:
|
|
41034
|
+
code: 6029,
|
|
41074
41035
|
name: "TokenReserveAdditionOverflow",
|
|
41075
41036
|
msg: "Token reserve addition overflow"
|
|
41076
41037
|
},
|
|
41077
41038
|
{
|
|
41078
|
-
code:
|
|
41039
|
+
code: 6030,
|
|
41079
41040
|
name: "LamportsAdditionOverflow",
|
|
41080
41041
|
msg: "Lamports addition overflow"
|
|
41081
41042
|
},
|
|
41082
41043
|
{
|
|
41083
|
-
code:
|
|
41044
|
+
code: 6031,
|
|
41084
41045
|
name: "LamportsDeductionOverflow",
|
|
41085
41046
|
msg: "Lamports deduction overflow"
|
|
41086
41047
|
},
|
|
41087
41048
|
{
|
|
41088
|
-
code:
|
|
41049
|
+
code: 6032,
|
|
41089
41050
|
name: "DeadlineCalculationOverflow",
|
|
41090
41051
|
msg: "Deadline calculation overflow"
|
|
41091
41052
|
},
|
|
41092
41053
|
{
|
|
41093
|
-
code:
|
|
41054
|
+
code: 6033,
|
|
41094
41055
|
name: "FeeDiscountFlagOverflow",
|
|
41095
41056
|
msg: "Fee discount flag calculation overflow"
|
|
41096
41057
|
},
|
|
41097
41058
|
{
|
|
41098
|
-
code:
|
|
41059
|
+
code: 6034,
|
|
41099
41060
|
name: "Unauthorized",
|
|
41100
41061
|
msg: "Unauthorized operation"
|
|
41101
41062
|
},
|
|
41102
41063
|
{
|
|
41103
|
-
code:
|
|
41064
|
+
code: 6035,
|
|
41104
41065
|
name: "RequiredParameter",
|
|
41105
41066
|
msg: "All parameters are required during initialization"
|
|
41106
41067
|
},
|
|
41107
41068
|
{
|
|
41108
|
-
code:
|
|
41069
|
+
code: 6036,
|
|
41109
41070
|
name: "CurveCalculationError",
|
|
41110
41071
|
msg: "Curve calculation error"
|
|
41111
41072
|
},
|
|
41112
41073
|
{
|
|
41113
|
-
code:
|
|
41074
|
+
code: 6037,
|
|
41114
41075
|
name: "InitialPriceCalculationError",
|
|
41115
41076
|
msg: "Initial price calculation failed"
|
|
41116
41077
|
},
|
|
41117
41078
|
{
|
|
41118
|
-
code:
|
|
41079
|
+
code: 6038,
|
|
41119
41080
|
name: "BuyReserveRecalculationError",
|
|
41120
41081
|
msg: "Reserve recalculation failed (after buy)"
|
|
41121
41082
|
},
|
|
41122
41083
|
{
|
|
41123
|
-
code:
|
|
41084
|
+
code: 6039,
|
|
41124
41085
|
name: "SellReserveRecalculationError",
|
|
41125
41086
|
msg: "Reserve recalculation failed (after sell)"
|
|
41126
41087
|
},
|
|
41127
41088
|
{
|
|
41128
|
-
code:
|
|
41089
|
+
code: 6040,
|
|
41129
41090
|
name: "TotalAmountWithFeeError",
|
|
41130
41091
|
msg: "Total amount with fee calculation failed"
|
|
41131
41092
|
},
|
|
41132
41093
|
{
|
|
41133
|
-
code:
|
|
41094
|
+
code: 6041,
|
|
41134
41095
|
name: "AmountAfterFeeError",
|
|
41135
41096
|
msg: "Amount after fee calculation failed"
|
|
41136
41097
|
},
|
|
41137
41098
|
{
|
|
41138
|
-
code:
|
|
41099
|
+
code: 6042,
|
|
41139
41100
|
name: "BuyPriceRangeCalculationError",
|
|
41140
41101
|
msg: "Buy price range calculation failed"
|
|
41141
41102
|
},
|
|
41142
41103
|
{
|
|
41143
|
-
code:
|
|
41104
|
+
code: 6043,
|
|
41144
41105
|
name: "SellPriceRangeCalculationError",
|
|
41145
41106
|
msg: "Sell price range calculation failed"
|
|
41146
41107
|
},
|
|
41147
41108
|
{
|
|
41148
|
-
code:
|
|
41109
|
+
code: 6044,
|
|
41149
41110
|
name: "PriceAtStopLossBoundary",
|
|
41150
41111
|
msg: "Price has reached stop-loss boundary, head order must be liquidated first"
|
|
41151
41112
|
},
|
|
41152
41113
|
{
|
|
41153
|
-
code:
|
|
41114
|
+
code: 6045,
|
|
41154
41115
|
name: "RemainingRangeCalculationError",
|
|
41155
41116
|
msg: "Remaining range calculation failed"
|
|
41156
41117
|
},
|
|
41157
41118
|
{
|
|
41158
|
-
code:
|
|
41119
|
+
code: 6046,
|
|
41159
41120
|
name: "FullRangeCalculationError",
|
|
41160
41121
|
msg: "Full range calculation failed"
|
|
41161
41122
|
},
|
|
41162
41123
|
{
|
|
41163
|
-
code:
|
|
41124
|
+
code: 6047,
|
|
41164
41125
|
name: "BuyFromPriceWithTokenNoneError",
|
|
41165
41126
|
msg: "Curve function returned None: buy_from_price_with_token_output"
|
|
41166
41127
|
},
|
|
41167
41128
|
{
|
|
41168
|
-
code:
|
|
41129
|
+
code: 6048,
|
|
41169
41130
|
name: "SellFromPriceWithTokenNoneError",
|
|
41170
41131
|
msg: "Curve function returned None: sell_from_price_with_token_input"
|
|
41171
41132
|
},
|
|
41172
41133
|
{
|
|
41173
|
-
code:
|
|
41134
|
+
code: 6049,
|
|
41174
41135
|
name: "ExceedsMaxSolAmount",
|
|
41175
41136
|
msg: "Required SOL amount exceeds user-set maximum"
|
|
41176
41137
|
},
|
|
41177
41138
|
{
|
|
41178
|
-
code:
|
|
41139
|
+
code: 6050,
|
|
41179
41140
|
name: "InsufficientSolOutput",
|
|
41180
41141
|
msg: "Insufficient SOL output"
|
|
41181
41142
|
},
|
|
41182
41143
|
{
|
|
41183
|
-
code:
|
|
41144
|
+
code: 6051,
|
|
41184
41145
|
name: "InsufficientRepayment",
|
|
41185
41146
|
msg: "Insufficient proceeds to repay loan"
|
|
41186
41147
|
},
|
|
41187
41148
|
{
|
|
41188
|
-
code:
|
|
41149
|
+
code: 6052,
|
|
41189
41150
|
name: "InsufficientBorrowingReserve",
|
|
41190
41151
|
msg: "Insufficient borrowing reserve"
|
|
41191
41152
|
},
|
|
41192
41153
|
{
|
|
41193
|
-
code:
|
|
41154
|
+
code: 6053,
|
|
41194
41155
|
name: "InsufficientTokenSale",
|
|
41195
41156
|
msg: "Insufficient token sale amount"
|
|
41196
41157
|
},
|
|
41197
41158
|
{
|
|
41198
|
-
code:
|
|
41159
|
+
code: 6054,
|
|
41199
41160
|
name: "InsufficientLiquidity",
|
|
41200
41161
|
msg: "Insufficient liquidity in current order"
|
|
41201
41162
|
},
|
|
41202
41163
|
{
|
|
41203
|
-
code:
|
|
41164
|
+
code: 6055,
|
|
41204
41165
|
name: "InsufficientMarketLiquidity",
|
|
41205
41166
|
msg: "Insufficient market liquidity, cannot satisfy trade even after liquidating all stop-loss orders"
|
|
41206
41167
|
},
|
|
41207
41168
|
{
|
|
41208
|
-
code:
|
|
41169
|
+
code: 6056,
|
|
41209
41170
|
name: "TokenAmountDifferenceOutOfRange",
|
|
41210
41171
|
msg: "Token amount difference exceeds valid range in margin trade"
|
|
41211
41172
|
},
|
|
41212
41173
|
{
|
|
41213
|
-
code:
|
|
41174
|
+
code: 6057,
|
|
41214
41175
|
name: "BorrowAmountMismatch",
|
|
41215
41176
|
msg: "Borrow amount mismatch with locked tokens"
|
|
41216
41177
|
},
|
|
41217
41178
|
{
|
|
41218
|
-
code:
|
|
41179
|
+
code: 6058,
|
|
41219
41180
|
name: "CloseFeeCalculationError",
|
|
41220
41181
|
msg: "Close fee calculation error"
|
|
41221
41182
|
},
|
|
41222
41183
|
{
|
|
41223
|
-
code:
|
|
41184
|
+
code: 6059,
|
|
41224
41185
|
name: "InsufficientMargin",
|
|
41225
41186
|
msg: "Insufficient margin"
|
|
41226
41187
|
},
|
|
41227
41188
|
{
|
|
41228
|
-
code:
|
|
41189
|
+
code: 6060,
|
|
41229
41190
|
name: "InsufficientMinimumMargin",
|
|
41230
41191
|
msg: "Margin below minimum requirement"
|
|
41231
41192
|
},
|
|
41232
41193
|
{
|
|
41233
|
-
code:
|
|
41194
|
+
code: 6061,
|
|
41234
41195
|
name: "InvalidAccountOwner",
|
|
41235
41196
|
msg: "Invalid account owner"
|
|
41236
41197
|
},
|
|
41237
41198
|
{
|
|
41238
|
-
code:
|
|
41199
|
+
code: 6062,
|
|
41239
41200
|
name: "SellAmountExceedsOrderAmount",
|
|
41240
41201
|
msg: "Sell amount exceeds order's token holdings"
|
|
41241
41202
|
},
|
|
41242
41203
|
{
|
|
41243
|
-
code:
|
|
41204
|
+
code: 6063,
|
|
41244
41205
|
name: "OrderNotExpiredMustCloseByOwner",
|
|
41245
41206
|
msg: "Non-expired order must be closed by owner"
|
|
41246
41207
|
},
|
|
41247
41208
|
{
|
|
41248
|
-
code:
|
|
41209
|
+
code: 6064,
|
|
41249
41210
|
name: "SettlementAddressMustBeOwnerAddress",
|
|
41250
41211
|
msg: "Settlement address must be owner address"
|
|
41251
41212
|
},
|
|
41252
41213
|
{
|
|
41253
|
-
code:
|
|
41214
|
+
code: 6065,
|
|
41254
41215
|
name: "BuyAmountExceedsOrderAmount",
|
|
41255
41216
|
msg: "Buy amount exceeds order's token holdings"
|
|
41256
41217
|
},
|
|
41257
41218
|
{
|
|
41258
|
-
code:
|
|
41219
|
+
code: 6066,
|
|
41259
41220
|
name: "InsufficientTradeAmount",
|
|
41260
41221
|
msg: "Trade amount below minimum requirement"
|
|
41261
41222
|
},
|
|
41262
41223
|
{
|
|
41263
|
-
code:
|
|
41224
|
+
code: 6067,
|
|
41264
41225
|
name: "SolAmountTooLarge",
|
|
41265
41226
|
msg: "SOL amount exceeds maximum limit (10000000 SOL per transaction)"
|
|
41266
41227
|
},
|
|
41267
41228
|
{
|
|
41268
|
-
code:
|
|
41229
|
+
code: 6068,
|
|
41269
41230
|
name: "RemainingTokenAmountTooSmall",
|
|
41270
41231
|
msg: "Remaining token amount below minimum trade requirement"
|
|
41271
41232
|
},
|
|
41272
41233
|
{
|
|
41273
|
-
code:
|
|
41234
|
+
code: 6069,
|
|
41274
41235
|
name: "TradeCooldownNotExpired",
|
|
41275
41236
|
msg: "Trade cooldown period not expired, please try again later"
|
|
41276
41237
|
},
|
|
41277
41238
|
{
|
|
41278
|
-
code:
|
|
41239
|
+
code: 6070,
|
|
41279
41240
|
name: "ExceedApprovalAmount",
|
|
41280
41241
|
msg: "Sell amount exceeds approved amount, please call approval function first"
|
|
41281
41242
|
},
|
|
41282
41243
|
{
|
|
41283
|
-
code:
|
|
41244
|
+
code: 6071,
|
|
41284
41245
|
name: "CooldownNotInitialized",
|
|
41285
41246
|
msg: "Sell trade requires calling approval or buy function first to initialize cooldown PDA"
|
|
41286
41247
|
},
|
|
41287
41248
|
{
|
|
41288
|
-
code:
|
|
41249
|
+
code: 6072,
|
|
41289
41250
|
name: "CannotCloseCooldownWithBalance",
|
|
41290
41251
|
msg: "Cannot close cooldown PDA with non-zero token balance"
|
|
41291
41252
|
},
|
|
41292
41253
|
{
|
|
41293
|
-
code:
|
|
41254
|
+
code: 6073,
|
|
41294
41255
|
name: "PriceCalculationError",
|
|
41295
41256
|
msg: "Price calculation error"
|
|
41296
41257
|
},
|
|
41297
41258
|
{
|
|
41298
|
-
code:
|
|
41259
|
+
code: 6074,
|
|
41299
41260
|
name: "InvalidPartnerFeeRecipientAccount",
|
|
41300
41261
|
msg: "Invalid partner fee recipient account"
|
|
41301
41262
|
},
|
|
41302
41263
|
{
|
|
41303
|
-
code:
|
|
41264
|
+
code: 6075,
|
|
41304
41265
|
name: "InvalidBaseFeeRecipientAccount",
|
|
41305
41266
|
msg: "Invalid base fee recipient account"
|
|
41306
41267
|
},
|
|
41307
41268
|
{
|
|
41308
|
-
code:
|
|
41269
|
+
code: 6076,
|
|
41309
41270
|
name: "InvalidOrderbookAddress",
|
|
41310
41271
|
msg: "Orderbook address does not match curve account orderbook"
|
|
41311
41272
|
},
|
|
41312
41273
|
{
|
|
41313
|
-
code:
|
|
41274
|
+
code: 6077,
|
|
41314
41275
|
name: "InvalidFeePercentage",
|
|
41315
41276
|
msg: "Fee percentage must be between 0-100"
|
|
41316
41277
|
},
|
|
41317
41278
|
{
|
|
41318
|
-
code:
|
|
41279
|
+
code: 6078,
|
|
41319
41280
|
name: "InvalidFeeRate",
|
|
41320
41281
|
msg: "Fee rate exceeds maximum limit (10%)"
|
|
41321
41282
|
},
|
|
41322
41283
|
{
|
|
41323
|
-
code:
|
|
41284
|
+
code: 6079,
|
|
41324
41285
|
name: "InvalidCustomFeeRate",
|
|
41325
41286
|
msg: "Custom fee rate must be between 1000 (1%) and 5000 (5%)"
|
|
41326
41287
|
},
|
|
41327
41288
|
{
|
|
41328
|
-
code:
|
|
41289
|
+
code: 6080,
|
|
41329
41290
|
name: "InvalidBorrowDuration",
|
|
41330
41291
|
msg: "Borrow duration out of valid range (3-30 days)"
|
|
41331
41292
|
},
|
|
41332
41293
|
{
|
|
41333
|
-
code:
|
|
41294
|
+
code: 6081,
|
|
41334
41295
|
name: "InvalidStopLossPrice",
|
|
41335
41296
|
msg: "Stop loss price does not meet minimum interval requirement"
|
|
41336
41297
|
},
|
|
41337
41298
|
{
|
|
41338
|
-
code:
|
|
41299
|
+
code: 6082,
|
|
41339
41300
|
name: "NoProfitableFunds",
|
|
41340
41301
|
msg: "No profitable funds to transfer"
|
|
41341
41302
|
},
|
|
41342
41303
|
{
|
|
41343
|
-
code:
|
|
41304
|
+
code: 6083,
|
|
41344
41305
|
name: "InsufficientPoolFunds",
|
|
41345
41306
|
msg: "Insufficient pool funds"
|
|
41346
41307
|
},
|
|
41347
41308
|
{
|
|
41348
|
-
code:
|
|
41309
|
+
code: 6084,
|
|
41349
41310
|
name: "InsufficientPoolBalance",
|
|
41350
41311
|
msg: "Pool SOL account balance would fall below minimum required balance"
|
|
41351
41312
|
},
|
|
41352
41313
|
{
|
|
41353
|
-
code:
|
|
41314
|
+
code: 6085,
|
|
41354
41315
|
name: "OrderBookManagerOverflow",
|
|
41355
41316
|
msg: "Math operation overflow"
|
|
41356
41317
|
},
|
|
41357
41318
|
{
|
|
41358
|
-
code:
|
|
41319
|
+
code: 6086,
|
|
41359
41320
|
name: "OrderBookManagerInvalidSlotIndex",
|
|
41360
41321
|
msg: "Invalid slot index"
|
|
41361
41322
|
},
|
|
41362
41323
|
{
|
|
41363
|
-
code:
|
|
41324
|
+
code: 6087,
|
|
41364
41325
|
name: "OrderBookManagerInvalidAccountData",
|
|
41365
41326
|
msg: "Invalid account data"
|
|
41366
41327
|
},
|
|
41367
41328
|
{
|
|
41368
|
-
code:
|
|
41329
|
+
code: 6088,
|
|
41369
41330
|
name: "OrderBookManagerExceedsMaxCapacity",
|
|
41370
41331
|
msg: "New capacity exceeds maximum limit"
|
|
41371
41332
|
},
|
|
41372
41333
|
{
|
|
41373
|
-
code:
|
|
41334
|
+
code: 6089,
|
|
41374
41335
|
name: "OrderBookManagerExceedsAccountSizeLimit",
|
|
41375
41336
|
msg: "Account size exceeds 10MB limit"
|
|
41376
41337
|
},
|
|
41377
41338
|
{
|
|
41378
|
-
code:
|
|
41339
|
+
code: 6090,
|
|
41379
41340
|
name: "OrderBookManagerOrderIdMismatch",
|
|
41380
41341
|
msg: "Order ID mismatch"
|
|
41381
41342
|
},
|
|
41382
41343
|
{
|
|
41383
|
-
code:
|
|
41344
|
+
code: 6091,
|
|
41384
41345
|
name: "OrderBookManagerEmptyOrderBook",
|
|
41385
41346
|
msg: "Order book is empty"
|
|
41386
41347
|
},
|
|
41387
41348
|
{
|
|
41388
|
-
code:
|
|
41349
|
+
code: 6092,
|
|
41389
41350
|
name: "OrderBookManagerAccountNotWritable",
|
|
41390
41351
|
msg: "Account is not writable"
|
|
41391
41352
|
},
|
|
41392
41353
|
{
|
|
41393
|
-
code:
|
|
41354
|
+
code: 6093,
|
|
41394
41355
|
name: "OrderBookManagerNotRentExempt",
|
|
41395
41356
|
msg: "Account not rent-exempt"
|
|
41396
41357
|
},
|
|
41397
41358
|
{
|
|
41398
|
-
code:
|
|
41359
|
+
code: 6094,
|
|
41399
41360
|
name: "OrderBookManagerInvalidRentBalance",
|
|
41400
41361
|
msg: "Invalid rent balance"
|
|
41401
41362
|
},
|
|
41402
41363
|
{
|
|
41403
|
-
code:
|
|
41364
|
+
code: 6095,
|
|
41404
41365
|
name: "OrderBookManagerInsufficientFunds",
|
|
41405
41366
|
msg: "Insufficient funds"
|
|
41406
41367
|
},
|
|
41407
41368
|
{
|
|
41408
|
-
code:
|
|
41369
|
+
code: 6096,
|
|
41409
41370
|
name: "OrderBookManagerInvalidAccountOwner",
|
|
41410
41371
|
msg: "OrderBook account owner mismatch"
|
|
41411
41372
|
},
|
|
41412
41373
|
{
|
|
41413
|
-
code:
|
|
41374
|
+
code: 6097,
|
|
41414
41375
|
name: "OrderBookManagerDataOutOfBounds",
|
|
41415
41376
|
msg: "Data access out of bounds"
|
|
41416
41377
|
},
|
|
41417
41378
|
{
|
|
41418
|
-
code:
|
|
41379
|
+
code: 6098,
|
|
41419
41380
|
name: "NoValidInsertPosition",
|
|
41420
41381
|
msg: "Cannot find valid insert position, all candidates failed due to price range overlap"
|
|
41421
41382
|
},
|
|
41422
41383
|
{
|
|
41423
|
-
code:
|
|
41384
|
+
code: 6099,
|
|
41424
41385
|
name: "EmptyCloseInsertIndices",
|
|
41425
41386
|
msg: "close_insert_indices array cannot be empty"
|
|
41426
41387
|
},
|
|
41427
41388
|
{
|
|
41428
|
-
code:
|
|
41389
|
+
code: 6100,
|
|
41429
41390
|
name: "TooManyCloseInsertIndices",
|
|
41430
41391
|
msg: "close_insert_indices array cannot exceed 20 elements"
|
|
41431
41392
|
},
|
|
41432
41393
|
{
|
|
41433
|
-
code:
|
|
41394
|
+
code: 6101,
|
|
41434
41395
|
name: "CloseOrderNotFound",
|
|
41435
41396
|
msg: "Specified close order not found"
|
|
41436
41397
|
},
|
|
41437
41398
|
{
|
|
41438
|
-
code:
|
|
41399
|
+
code: 6102,
|
|
41439
41400
|
name: "LinkedListDeleteCountMismatch",
|
|
41440
41401
|
msg: "Linked list delete count mismatch: count inconsistent before/after deletion"
|
|
41441
41402
|
},
|
|
41442
41403
|
{
|
|
41443
|
-
code:
|
|
41404
|
+
code: 6103,
|
|
41444
41405
|
name: "NameTooLong",
|
|
41445
41406
|
msg: "Token name too long, max 32 bytes"
|
|
41446
41407
|
},
|
|
41447
41408
|
{
|
|
41448
|
-
code:
|
|
41409
|
+
code: 6104,
|
|
41449
41410
|
name: "NameEmpty",
|
|
41450
41411
|
msg: "Token name cannot be empty"
|
|
41451
41412
|
},
|
|
41452
41413
|
{
|
|
41453
|
-
code:
|
|
41414
|
+
code: 6105,
|
|
41454
41415
|
name: "SymbolTooLong",
|
|
41455
41416
|
msg: "Token symbol too long, max 10 bytes"
|
|
41456
41417
|
},
|
|
41457
41418
|
{
|
|
41458
|
-
code:
|
|
41419
|
+
code: 6106,
|
|
41459
41420
|
name: "SymbolEmpty",
|
|
41460
41421
|
msg: "Token symbol cannot be empty"
|
|
41461
41422
|
},
|
|
41462
41423
|
{
|
|
41463
|
-
code:
|
|
41424
|
+
code: 6107,
|
|
41464
41425
|
name: "UriTooLong",
|
|
41465
41426
|
msg: "URI too long, max 200 bytes"
|
|
41466
41427
|
},
|
|
41467
41428
|
{
|
|
41468
|
-
code:
|
|
41429
|
+
code: 6108,
|
|
41469
41430
|
name: "UriEmpty",
|
|
41470
41431
|
msg: "URI cannot be empty"
|
|
41471
41432
|
},
|
|
41472
41433
|
{
|
|
41473
|
-
code:
|
|
41434
|
+
code: 6109,
|
|
41474
41435
|
name: "IncompleteAdvancedPoolParams",
|
|
41475
41436
|
msg: "Incomplete advanced pool parameters: custom_lp_sol, custom_lp_token, custom_borrow_ratio, custom_borrow_duration must be provided together"
|
|
41476
41437
|
},
|
|
41477
41438
|
{
|
|
41478
|
-
code:
|
|
41439
|
+
code: 6110,
|
|
41479
41440
|
name: "InvalidInitialVirtualSol",
|
|
41480
41441
|
msg: "Initial virtual SOL out of valid range"
|
|
41481
41442
|
},
|
|
41482
41443
|
{
|
|
41483
|
-
code:
|
|
41444
|
+
code: 6111,
|
|
41484
41445
|
name: "InvalidInitialVirtualToken",
|
|
41485
41446
|
msg: "Initial virtual Token out of valid range"
|
|
41486
41447
|
},
|
|
41487
41448
|
{
|
|
41488
|
-
code:
|
|
41449
|
+
code: 6112,
|
|
41489
41450
|
name: "InvalidBorrowPoolRatio",
|
|
41490
41451
|
msg: "Borrow pool ratio out of valid range"
|
|
41491
41452
|
},
|
|
41492
41453
|
{
|
|
41493
|
-
code:
|
|
41454
|
+
code: 6113,
|
|
41494
41455
|
name: "BorrowTokenCalculationOverflow",
|
|
41495
41456
|
msg: "Borrow pool token amount calculation overflow"
|
|
41496
41457
|
},
|
|
41497
41458
|
{
|
|
41498
|
-
code:
|
|
41459
|
+
code: 6114,
|
|
41499
41460
|
name: "BorrowTokenAmountZero",
|
|
41500
41461
|
msg: "Borrow pool token amount cannot be zero"
|
|
41501
41462
|
}
|