0.2.0 • Published 2 years ago

@yourtrading-ai/beet-solana v0.2.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

@metaplex-foundation/beet-solana

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

API

Please find the API docs here.

Examples

Using PublicKey Directly

import { publicKey } from '@metaplex-foundation/beet-solana'

const generatedKey  = Keypair.generate().publicKey
const buf = Buffer.alloc(publicKey.byteSize)
beet.write(buf, 0, generatedKey)
beet.read(buf, 0) // same as generatedKey

PublicKey as part of a Struct Configuration

import * as web3 from '@solana/web3.js'
import * as beet from '@metaplex-foundation/beet'
import * as beetSolana from '@metaplex-foundation/beet-solana'

type InstructionArgs = {
  authority: web3.PublicKey
}

const createStruct = new beet.BeetArgsStruct<InstructionArgs>(
  [ 
    ['authority', beetSolana.publicKey]
  ],
  'InstructionArgs'
)

LICENSE

Apache-2.0