소스 검색

Merge pull request #91 from fdundjer/master

feat: warp errors
Filip Dunđer 1 년 전
부모
커밋
c0999a59ee
3개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 0
      bot.ts
  2. 2 2
      transactions/transaction-executor.interface.ts
  3. 1 1
      transactions/warp-transaction-executor.ts

+ 3 - 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`,
           );
@@ -274,6 +276,7 @@ export class Bot {
     }
   }
 
+  // noinspection JSUnusedLocalSymbols
   private async swap(
     poolKeys: LiquidityPoolKeysV4,
     ataIn: PublicKey,

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

@@ -1,9 +1,9 @@
-import { BlockhashWithExpiryBlockHeight, Keypair, MessageV0, Signer, VersionedTransaction } from '@solana/web3.js';
+import { BlockhashWithExpiryBlockHeight, Keypair, VersionedTransaction } from '@solana/web3.js';
 
 export interface TransactionExecutor {
   executeAndConfirm(
     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())],