UNPKG

@solsdk/swapper_sdk

Version:

Solana Swap Library for Solana Tracker Swap API

17 lines (16 loc) 476 B
import bs58 from "bs58"; import { Transaction, VersionedTransaction } from "@solana/web3.js"; export function getSignature( transaction: Transaction | VersionedTransaction ): string { const signature = "signature" in transaction ? transaction.signature : transaction.signatures[0]; if (!signature) { throw new Error( "Missing transaction signature, the transaction was not signed by the fee payer" ); } return bs58.encode(signature); }