Merge pull request #91 from fdundjer/master

feat: warp errors
This commit is contained in:
Filip Dunđer
2024-04-21 14:05:38 +02:00
committed by GitHub
3 changed files with 6 additions and 3 deletions

3
bot.ts
View File

@ -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,

View File

@ -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 }>;
}

View File

@ -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())],