npm package: @kenolabs/aethokit
Description: an SDK that allows you sponsor transactions on the solana network.
Author: brite0x
Latest version: 1.0.5
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# AETHOKIT-SDK

Aethokit-sdk is a solana SDK that allows developers to sponsor gas transactions on the solana blockchain.

## USAGE
Install the NPM package
```bash
# Other package managers can be used such as yarn and npm.
bun i @kenolabs/aethokit
```

Then import the package and initialize it with a gasKey gotten from the aethokit dashboard(coming soon). But to test, reach out to [brite0x](https://t.me/brite0x).
```ts
import Aethokit from "@kenolabs/aethokit"

// Initalize the SDK 
// Without RPC or network
const aethokitClient = Aethokit({ gasKey: "aekt_..." }); // defaults to devnet

// With RPC (RPC can either be a testnet or mainnet RPC url)
const aethokitClient = Aethokit({ gasKey: "aekt_...", rpcOrNetwork: "private-rpc-url" });

// With network
const aethokitClient = Aethokit({ gasKey: "aekt_...", rpcOrNetwork: "mainnet" });
```

### USAGE SENDING SOL WITH KEYPAIR
```ts
import { 
  SystemProgram,
  TransactionMessage,
  Keypair,
  clusterApiUrl,
  PublicKey,
  Connection,
  VersionedTransaction,
  LAMPORTS_PER_SOL
} from "@solana/web3.js";

const senderKeypair = Keypair.generate();

const senderAmount = 1 * LAMPORTS_PER_SOL;

const fundUserIx = SystemProgram.transfer({
  fromPubkey: senderKeypair.publicKey,
  toPubkey: recieverPublicKey,
  lamports: senderAmount,
});

const gasAddress = await aethokitClient.getGasAddress();

const connection = new Connection(ClusterApiUrl("devnet")); // or mainnet
const { blockhash: recentBlockHash } = await connection.getLatestBlockhash("confirmed");

const txMsg = new TransactionMessage({
  payerKey: new PublicKey(gasAddress),
  recentBlockHash,
  instructions: [fundUserIx]
}).compileToV0Message();

const transaction = new VersionedTransaction(txMsg);

// Sign tx with sender keypair
transaction.sign([senderKeypair]);

const serializedTx = Buffer.from(transaction.serialize()).toString('base64');

// Send serialized transaction to the gas tank for sponsorship
const txHash = await aethokitClient.sponsorTx(serializedTx);

console.log({ txHash });
```

### USAGE SENDING SOL WITH PRIVY
```ts
const txMsg = ...;

const transaction = new VersionedTransaction(txMsg);
const serializedMessage = Buffer.from(transaction.message.serialize()).toString('base64');

// Kindly check the privy docs to know how to get the the wallet provider - https://docs.privy.io
const provider = await privySolWallet.getProvider();
const { signature: userSignature } = await provider.request({
  method: 'signMessage',
  params: {
    message: serializedMessage
  }
});

// Add user signature to the transaction
const userSignatureBuffer = Buffer.from(userSignature, 'base64');
transaction.addSignature(new PublicKey(privySolWallet.address), userSignatureBuffer);

const serializedTransaction = Buffer.from(transaction.serialize()).toString('base64');

// Send serialized transaction to the gas tank for sponsorship
const txHash = await aethokitClient.sponsorTx(serializedTransaction);

console.log({ txHash });
```

Other features coming soon!