MCPcopy Create free account
hub / github.com/cutupdev/Solana-Volume-Bot / execute

Function execute

executor/legacy.ts:11–35  ·  view source on GitHub ↗
(transaction: VersionedTransaction, latestBlockhash: Blockhash, isBuy: boolean = true)

Source from the content-addressed store, hash-verified

9}
10
11export const execute = async (transaction: VersionedTransaction, latestBlockhash: Blockhash, isBuy: boolean = true) => {
12 const solanaConnection = new Connection(RPC_ENDPOINT, {
13 wsEndpoint: RPC_WEBSOCKET_ENDPOINT,
14 })
15
16 const signature = await solanaConnection.sendRawTransaction(transaction.serialize(), { skipPreflight: true })
17 const confirmation = await solanaConnection.confirmTransaction(
18 {
19 signature,
20 lastValidBlockHeight: latestBlockhash.lastValidBlockHeight,
21 blockhash: latestBlockhash.blockhash,
22 }
23 );
24
25 if (confirmation.value.err) {
26 console.log("Confrimtaion error")
27 return ""
28 } else {
29 if (isBuy)
30 console.log(`Success in buy transaction: https://solscan.io/tx/${signature}`)
31 else
32 console.log(`Success in Sell transaction: https://solscan.io/tx/${signature}`)
33 }
34 return signature
35}

Callers 6

distributeSolFunction · 0.90
buyFunction · 0.90
sellFunction · 0.90
distributeSolAndTokenFunction · 0.90
buyFunction · 0.90
sellFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected