mirror of
https://github.com/fdundjer/solana-sniper-bot.git
synced 2025-11-10 04:22:05 +10:00
feat: add error handling
This commit is contained in:
2
bot.ts
2
bot.ts
@ -173,6 +173,7 @@ export class Bot {
|
|||||||
{
|
{
|
||||||
mint: poolState.baseMint.toString(),
|
mint: poolState.baseMint.toString(),
|
||||||
signature: result.signature,
|
signature: result.signature,
|
||||||
|
error: result.error,
|
||||||
},
|
},
|
||||||
`Error confirming buy tx`,
|
`Error confirming buy tx`,
|
||||||
);
|
);
|
||||||
@ -258,6 +259,7 @@ export class Bot {
|
|||||||
{
|
{
|
||||||
mint: rawAccount.mint.toString(),
|
mint: rawAccount.mint.toString(),
|
||||||
signature: result.signature,
|
signature: result.signature,
|
||||||
|
error: result.error,
|
||||||
},
|
},
|
||||||
`Error confirming sell tx`,
|
`Error confirming sell tx`,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -5,5 +5,5 @@ export interface TransactionExecutor {
|
|||||||
transaction: VersionedTransaction,
|
transaction: VersionedTransaction,
|
||||||
payer: Keypair,
|
payer: Keypair,
|
||||||
latestBlockHash: BlockhashWithExpiryBlockHeight,
|
latestBlockHash: BlockhashWithExpiryBlockHeight,
|
||||||
): Promise<{ confirmed: boolean; signature?: string }>;
|
): Promise<{ confirmed: boolean; signature?: string, error?: string }>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ export class WarpTransactionExecutor implements TransactionExecutor {
|
|||||||
const warpFeeTx = new VersionedTransaction(warpFeeMessage);
|
const warpFeeTx = new VersionedTransaction(warpFeeMessage);
|
||||||
warpFeeTx.sign([payer]);
|
warpFeeTx.sign([payer]);
|
||||||
|
|
||||||
const response = await axios.post<{ confirmed: boolean; signature: string }>(
|
const response = await axios.post<{ confirmed: boolean; signature: string, error?: string }>(
|
||||||
'https://tx.warp.id/transaction/execute',
|
'https://tx.warp.id/transaction/execute',
|
||||||
{
|
{
|
||||||
transactions: [bs58.encode(warpFeeTx.serialize()), bs58.encode(transaction.serialize())],
|
transactions: [bs58.encode(warpFeeTx.serialize()), bs58.encode(transaction.serialize())],
|
||||||
|
|||||||
Reference in New Issue
Block a user