createTransaction

Installation

npm install @karrotcapital/spiderswap

Usage

Initialization

First, initialize the 'Spiderswap' class with your API key.

import Spiderswap from '@karrotcapital/spiderswap';
// OR
const Spiderswap = require('@karrotcapital/spiderswap');

const spiderswap = new Spiderswap(ApiKey);

Method: createTransaction

Description

The 'createTransaction' method creates a Solana transaction from a base64-encoded string containing the swap transaction data.

Parameters

  • 'swapTransactionData' (string): The base64-encoded string containing the swap transaction data.

Returns

'Promise<VersionedTransaction>': A promise that resolves to a 'VersionedTransaction' object.

Example

This example demonstrates using both 'getSwap' and 'createTransaction' methods.

Implementation Details

This method converts the 'swapTransactionData' from a base64-encoded string to a buffer and deserializes it into a 'VersionedTransaction'.

Last updated