Handling Tx returned from the APIs

Buffers returned from the API have to be handled accordingly

// Call hyperspace API
var createBuyTx = await hsClient.createBuyTx(input)

// Create tx with data received from API
const tx = solanaWeb3.Transaction.from(Buffer.from(createBuyTx.createBuyTx.stdBuffer));

// sign tx with your keypair
tx.partialSign(accountFromSeed);

// Send tx
const sig = await conn.sendRawTransaction(tx.serialize())

Last updated