Installation
npm install @quickscope/sdkUsage
Initialization
First, initialize the Quickscope class with your location ("frankfurt" or "nyc") and your API key:
import Quickscope from '@quickscope/sdk';
// OR
const Quickscope = require('@quickscope/sdk');
const quickscope = new Quickscope("frankfurt", "your-api-key");Method: createTransaction
createTransactionDescription
The createTransaction method converts a base64-encoded swap transaction into a VersionedTransaction object. This is useful when you receive a transaction payload from getSwapBest or getSwapCustom and need to simulate, sign, or broadcast it using Solana’s native tools.
Use this method to deserialize swap payloads returned by the Quickscope API into fully usable Solana transaction objects.
Parameters
swapTransactionData: string- swapTransactionData: (string) – A base64-encoded serialized Solana transaction, typically returned from a swap endpoint.
Returns
Promise<VersionedTransaction>: A promise that resolves to a VersionedTransaction object that can be signed, simulated, or sent using Solana's RPC.
Example
async function decodeSwapTransaction() {
try {
// Assume this came from quickscope.v1.swap.getSwapCustom() or getSwapBest()
const encodedTx = "AAABAgMEBQYH..."; // base64-encoded transaction
const transaction = await quickscope.v1.utils.createTransaction(encodedTx);
console.log("Decoded transaction:", transaction);
// You can now simulate, sign, or send this VersionedTransaction
} catch (error) {
console.error("Error decoding transaction:", error);
}
}
decodeSwapTransaction();Error Handling
This method throws or returns an error if:
- The base64 string is malformed
- The data cannot be parsed into a valid
VersionedTransaction
Wrap the call in a try/catch block for robust error handling.
