solana-tx-serialize
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

solana-tx-serialize

Serialize Solana web3.Transaction objects to bs58 and back

Install

yarn add solana-tx-serialize
npm install solana-tx-serialize

Example

const pk = Keypair.generate();
const inst = SystemProgram.createAccount({
	fromPubkey: pk.publicKey,
	newAccountPubkey: pk.publicKey,
	lamports: 0,
	space: 0,
	programId: SystemProgram.programId,
});

const tx = new Transaction();
tx.add(inst);
tx.recentBlockhash = Keypair.generate().publicKey.toBase58();
tx.feePayer = pk.publicKey;
tx.sign(pk);

const bs58string = bs58Transaction(tx);
console.log(bs58string);

const decodedTx = unbs58Transaction(bs58string);
console.log(decodedTx);

Readme

Keywords

none

Package Sidebar

Install

npm i solana-tx-serialize

Weekly Downloads

2

Version

1.0.4

License

MIT

Unpacked Size

9.08 kB

Total Files

10

Last publish

Collaborators

  • dvcrn
  • saifubot