Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@metaplex-foundation/beet-solana

Package Overview
Dependencies
Maintainers
6
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metaplex-foundation/beet-solana

Solana specific extension for beet, the borsh compatible de/serializer

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created

What is @metaplex-foundation/beet-solana?

@metaplex-foundation/beet-solana is a library designed to facilitate serialization and deserialization of data structures in the Solana blockchain ecosystem. It provides utilities to define and work with complex data types, making it easier to interact with Solana programs.

What are @metaplex-foundation/beet-solana's main functionalities?

Serialization and Deserialization

This feature allows users to define data structures and serialize/deserialize them to/from buffers. The code sample demonstrates how to define a simple struct with two fields and serialize/deserialize it using the library.

const { u8, struct } = require('@metaplex-foundation/beet-solana');

const MyStruct = struct([
  ['field1', u8],
  ['field2', u8]
]);

const buffer = Buffer.alloc(MyStruct.byteSize);
MyStruct.write(buffer, 0, { field1: 1, field2: 2 });

const result = MyStruct.read(buffer, 0);
console.log(result); // { field1: 1, field2: 2 }

Complex Data Types

This feature supports complex data types, such as arrays within structs. The code sample shows how to define a struct with an array field and serialize/deserialize it.

const { u8, array, struct } = require('@metaplex-foundation/beet-solana');

const ComplexStruct = struct([
  ['field1', u8],
  ['field2', array(u8, 3)]
]);

const buffer = Buffer.alloc(ComplexStruct.byteSize);
ComplexStruct.write(buffer, 0, { field1: 1, field2: [2, 3, 4] });

const result = ComplexStruct.read(buffer, 0);
console.log(result); // { field1: 1, field2: [2, 3, 4] }

Other packages similar to @metaplex-foundation/beet-solana

FAQs

Package last updated on 28 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc