Local API
Local API allows you to get a swap transaction, without sending to the RPC node. You should do it yourself. Each endpoint in Local API returns a transaction in bytes in this format:
{"transaction": { "content": "<base64 encoded transaction>" } }
The API is api.degen.ing
, it is located in NYC, East Coast of the USA.
Decoding and submitting the tx
ts
// ...assuming you got the result of the fetch
const tx = Transaction.from(Buffer.from(result.transaction.content, 'base64'));
await connection.sendTransaction(tx, [signerKeyPair]);
Fees
Each tx creation costs 0.0001 Sol (~0.02$). Does not matter how much you buy, fee is flat.