Quellcode durchsuchen

feat: add error handling

Filip Dunder vor 1 Jahr
Ursprung
Commit
d0b59102c9

+ 2 - 0
bot.ts

@@ -173,6 +173,7 @@ export class Bot {
             {
               mint: poolState.baseMint.toString(),
               signature: result.signature,
+              error: result.error,
             },
             `Error confirming buy tx`,
           );
@@ -258,6 +259,7 @@ export class Bot {
             {
               mint: rawAccount.mint.toString(),
               signature: result.signature,
+              error: result.error,
             },
             `Error confirming sell tx`,
           );

+ 1 - 1
transactions/transaction-executor.interface.ts

@@ -5,5 +5,5 @@ export interface TransactionExecutor {
     transaction: VersionedTransaction,
     payer: Keypair,
     latestBlockHash: BlockhashWithExpiryBlockHeight,
-  ): Promise<{ confirmed: boolean; signature?: string }>;
+  ): Promise<{ confirmed: boolean; signature?: string, error?: string }>;
 }

+ 1 - 1
transactions/warp-transaction-executor.ts

@@ -41,7 +41,7 @@ export class WarpTransactionExecutor implements TransactionExecutor {
       const warpFeeTx = new VersionedTransaction(warpFeeMessage);
       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',
         {
           transactions: [bs58.encode(warpFeeTx.serialize()), bs58.encode(transaction.serialize())],