Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Lint and Test Beet Solana
name: Build Lint and Test Beet BBAChain

on:
push:
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
yarn run build

- name: yarn build, lint and test
working-directory: ./beet-solana
working-directory: ./beet-bbachain
run: |
yarn run build
yarn run lint
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
## Packages

- [beet](./beet) primitive, collections and composite de/serializers as well as _beet_ struct
configurations | [API docs](https://metaplex-foundation.github.io/beet/docs/beet)
- [beet-solana](./beet-solana) solana specific _beet_ de/serializers | [API docs](https://metaplex-foundation.github.io/beet/docs/beet-solana)
configurations | [API docs](https://bbachain.github.io/beet/docs/beet)
- [beet-bbachain](./beet-bbachain) bbachain specific _beet_ de/serializers | [API docs](https://bbachain.github.io/beet/docs/beet-bbachain)

## LICENSE

Expand Down
File renamed without changes.
File renamed without changes.
20 changes: 10 additions & 10 deletions beet-solana/README.md → beet-bbachain/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# @metaplex-foundation/beet-solana
# @bbachain/beet-bbachain

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

## API

Please find the [API docs here](https://metaplex-foundation.github.io/beet/docs/beet-solana).
Please find the [API docs here](https://bbachain.github.io/beet/docs/beet-bbachain).

## GPA Builders

solana-beet uses `beet`s knowledge about account layouts to provide `GpaBuilder`s for
bbachain-beet uses `beet`s knowledge about account layouts to provide `GpaBuilder`s for
them which allow to filter by account data size and content.

1. Create a GPA Builder via `const gpaBuilder = GpaBuilder.fromStruct(programId, accountStruct)`
Expand Down Expand Up @@ -103,15 +103,15 @@ const account = await gpaBuilder

## PublicKey

solana-beet provides a de/serializer for solana public keys.
beet-bbachain provides a de/serializer for bbachain public keys.
They can either be used directly or as part of a struct.

### Examples

#### Using PublicKey Directly

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

const generatedKey = Keypair.generate().publicKey
const buf = Buffer.alloc(publicKey.byteSize)
Expand All @@ -122,17 +122,17 @@ beet.read(buf, 0) // same as generatedKey
#### PublicKey as part of a Struct Configuration

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

type InstructionArgs = {
authority: web3.PublicKey
}

const createStruct = new beet.BeetArgsStruct<InstructionArgs>(
[
['authority', beetSolana.publicKey]
['authority', beetBBA.publicKey]
],
'InstructionArgs'
)
Expand Down
23 changes: 12 additions & 11 deletions beet-solana/package.json → beet-bbachain/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@metaplex-foundation/beet-solana",
"version": "0.4.1",
"description": "Solana specific extension for beet, the borsh compatible de/serializer",
"name": "@bbachain/beet-bbachain",
"version": "0.0.1",
"description": "BBAChain specific extension for beet, the borsh compatible de/serializer",
"sideEffects": false,
"main": "dist/cjs/src/beet-solana.js",
"types": "dist/types/src/beet-solana.d.ts",
"main": "dist/cjs/src/beet-bbachain.js",
"types": "dist/types/src/beet-bbachain.d.ts",
"scripts": {
"check:publish-ready": "yarn build && yarn test",
"preversion": "yarn check:publish-ready",
Expand All @@ -16,10 +16,10 @@
"test": "tape dist/cjs/test/*.js",
"lint": "prettier -c ./src/",
"lint:fix": "prettier --write ./src",
"doc": "rimraf ../docs/beet-solana && typedoc"
"doc": "rimraf ../docs/beet-bbachain && typedoc"
},
"repository": "git@github.com:metaplex-foundation/beet-solana.git",
"author": "Thorsten Lorenz <thlorenz@gmx.de>",
"repository": "git@github.com:bbachain/beet.git",
"author": "BBAChain Labs <developers@bbachain.com>",
"license": "Apache-2.0",
"directories": {
"dist": "./dist/src"
Expand All @@ -29,10 +29,11 @@
"dist/types/src/*"
],
"dependencies": {
"@metaplex-foundation/beet": ">=0.1.0",
"@solana/web3.js": "^1.56.2",
"@bbachain/beet": ">=0.0.0",
"@bbachain/web3.js": "^1.1.3",
"bs58": "^5.0.0",
"debug": "^4.3.4"
"debug": "^4.3.4",
"rpc-websockets": "7.11.0"
},
"devDependencies": {
"@types/debug": "^4.1.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SupportedTypeDefinition } from '@metaplex-foundation/beet'
import { SupportedTypeDefinition } from '@bbachain/beet'
import { KeysExports, keysTypeMap, KeysTypeMapKey } from './keys'

export * from './keys'
Expand All @@ -7,22 +7,22 @@ export * from './gpa'
/**
* @category TypeDefinition
*/
export type BeetSolanaTypeMapKey = KeysTypeMapKey
export type BeetBBAChainTypeMapKey = KeysTypeMapKey
/**
* @category TypeDefinition
*/
export type BeetSolanaExports = KeysExports
export type BeetBBAChainExports = KeysExports

/**
* Maps solana beet exports to metadata which describes in which package it
* Maps bbachain beet exports to metadata which describes in which package it
* is defined as well as which TypeScript type is used to represent the
* deserialized value in JavaScript.
*
* @category TypeDefinition
*/
export const supportedTypeMap: Record<
BeetSolanaTypeMapKey,
BeetBBAChainTypeMapKey,
SupportedTypeDefinition & {
beet: BeetSolanaExports
beet: BeetBBAChainExports
}
> = keysTypeMap
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
FixableBeetStruct,
FixedSizeBeet,
isFixedSizeBeet,
} from '@metaplex-foundation/beet'
} from '@bbachain/beet'
import {
Connection,
GetProgramAccountsConfig,
GetProgramAccountsFilter,
PublicKey,
} from '@solana/web3.js'
} from '@bbachain/web3.js'
import { strict as assert } from 'assert'
import { logTrace } from '../utils'
import { encodeFixedBeet } from './util'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FixedSizeBeet } from '@metaplex-foundation/beet'
import { FixedSizeBeet } from '@bbachain/beet'
import base58 from 'bs58'

export function encodeFixedBeet<T>(beet: FixedSizeBeet<T>, val: T) {
Expand Down
22 changes: 11 additions & 11 deletions beet-solana/src/keys.ts → beet-bbachain/src/keys.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { PublicKey } from '@solana/web3.js'
import { PublicKey } from '@bbachain/web3.js'
import {
FixedSizeBeet,
fixedSizeUint8Array,
SupportedTypeDefinition,
} from '@metaplex-foundation/beet'
const BEET_SOLANA_PACKAGE = '@metaplex-foundation/beet-solana'
const SOLANA_WEB3_PACKAGE = '@solana/web3.js'
} from '@bbachain/beet'
const BEET_BBACHAIN_PACKAGE = '@bbachain/beet-bbachain'
const BBACHAIN_WEB3_PACKAGE = '@bbachain/web3.js'

const uint8Array32 = fixedSizeUint8Array(32)

/**
* De/Serializer for solana {@link PublicKey}s aka `publicKey`.
* De/Serializer for bbachain {@link PublicKey}s aka `publicKey`.
*
*
* ## Using PublicKey Directly
*
* ```ts
* import { publicKey } from '@metaplex-foundation/beet-solana'
* import { publicKey } from '@bbachain/beet-bbachain'
*
* const generatedKey = Keypair.generate().publicKey
* const buf = Buffer.alloc(publicKey.byteSize)
Expand All @@ -27,7 +27,7 @@ const uint8Array32 = fixedSizeUint8Array(32)
* ## PublicKey as part of a Struct Configuration
*
* ```ts
* import { publicKey } from '@metaplex-foundation/beet-solana'
* import { publicKey } from '@bbachain/beet-bbachain'
*
* type InstructionArgs = {
* authority: web3.PublicKey
Expand All @@ -41,7 +41,7 @@ const uint8Array32 = fixedSizeUint8Array(32)
* )
* ```
*
* @category beet/solana
* @category beet/bbachain
*/
export const publicKey: FixedSizeBeet<PublicKey> = {
write: function (buf: Buffer, offset: number, value: PublicKey): void {
Expand Down Expand Up @@ -74,7 +74,7 @@ export type KeysTypeMap = Record<
>

/**
* Maps solana keys beet exports to metadata which describes in which package it
* Maps bbachain keys beet exports to metadata which describes in which package it
* is defined as well as which TypeScript type is used to represent the
* deserialized value in JavaScript.
*
Expand All @@ -84,8 +84,8 @@ export const keysTypeMap: KeysTypeMap = {
publicKey: {
beet: 'publicKey',
isFixable: false,
sourcePack: BEET_SOLANA_PACKAGE,
sourcePack: BEET_BBACHAIN_PACKAGE,
ts: 'PublicKey',
pack: SOLANA_WEB3_PACKAGE,
pack: BBACHAIN_WEB3_PACKAGE,
},
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Trader,
withDecodedBytes,
} from './utils'
import { GpaBuilder } from '../src/beet-solana'
import { GpaBuilder } from '../src/beet-bbachain'

test('gpa: fixed struct nested inside fixed struct', (t) => {
let gpaBuilder: GpaBuilder<Trader> = GpaBuilder.fromStruct<Trader>(
Expand Down
6 changes: 3 additions & 3 deletions beet-solana/test/gpa.ts → beet-bbachain/test/gpa.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import test from 'tape'
import spok from 'spok'
import { BeetStruct } from '@metaplex-foundation/beet'
import { u8 } from '@metaplex-foundation/beet'
import { BeetStruct } from '@bbachain/beet'
import { u8 } from '@bbachain/beet'
import {
IntAndString,
PROGRAM_ID,
Results,
stringFilter,
withDecodedBytes,
} from './utils'
import { GpaBuilder } from '../src/beet-solana'
import { GpaBuilder } from '../src/beet-bbachain'

test('gpa: fixed struct with one u8', (t) => {
type Args = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FixedSizeBeet } from '@metaplex-foundation/beet'
import { PublicKey, Keypair } from '@solana/web3.js'
import { publicKey } from '../src/beet-solana'
import { FixedSizeBeet } from '@bbachain/beet'
import { PublicKey, Keypair } from '@bbachain/web3.js'
import { publicKey } from '../src/beet-bbachain'
import test from 'tape'

function checkCases(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import {
u16,
u8,
utf8String,
} from '@metaplex-foundation/beet'
} from '@bbachain/beet'
import {
GetProgramAccountsConfig,
GetProgramAccountsFilter,
MemcmpFilter,
PublicKey,
} from '@solana/web3.js'
} from '@bbachain/web3.js'
import base58 from 'bs58'
import * as util from 'util'

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions beet-solana/typedoc.json → beet-bbachain/typedoc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"entryPoints": ["src/beet-solana.ts"],
"entryPoints": ["src/beet-bbachain.ts"],
"excludePrivate": true,
"categorizeByGroup": false,
"readme": "none",
"emit": "both",
"out": "../docs/beet-solana"
"out": "../docs/beet-bbachain"
}
Loading