@metaplex-foundation/beet-solana
Advanced tools
Comparing version 0.0.0 to 0.0.1
import { SupportedTypeDefinition } from '@metaplex-foundation/beet'; | ||
import { KeysExports, KeysTypeMapKey } from './keys'; | ||
export * from './keys'; | ||
/** | ||
* @category TypeDefinition | ||
*/ | ||
export declare type BeetSolanaTypeMapKey = KeysTypeMapKey; | ||
/** | ||
* @category TypeDefinition | ||
*/ | ||
export declare type BeetSolanaExports = KeysExports; | ||
/** | ||
* Maps solana 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 declare const supportedTypeMap: Record<BeetSolanaTypeMapKey, SupportedTypeDefinition & { | ||
beet: BeetSolanaExports; | ||
}>; |
@@ -16,3 +16,10 @@ "use strict"; | ||
__exportStar(require("./keys"), exports); | ||
/** | ||
* Maps solana 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 | ||
*/ | ||
exports.supportedTypeMap = keys_1.keysTypeMap; | ||
//# sourceMappingURL=beet-solana.js.map |
import { PublicKey } from '@solana/web3.js'; | ||
import { Beet, SupportedTypeDefinition } from '@metaplex-foundation/beet'; | ||
/** | ||
* De/Serializer for solana {@link PublicKey}s aka `publicKey`. | ||
* | ||
* | ||
* ## Using PublicKey Directly | ||
* | ||
* ```ts | ||
* 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 | ||
* | ||
* ```ts | ||
* import { publicKey } from '@metaplex-foundation/beet-solana' | ||
* | ||
* type InstructionArgs = { | ||
* authority: web3.PublicKey | ||
* } | ||
* | ||
* const createStruct = new beet.BeetArgsStruct<InstructionArgs>( | ||
* [ | ||
* ['authority', publicKey] | ||
* ], | ||
* 'InstructionArgs' | ||
* ) | ||
* ``` | ||
* | ||
* @category beet/solana | ||
*/ | ||
export declare const publicKey: Beet<PublicKey>; | ||
/** | ||
* @category TypeDefinition | ||
*/ | ||
export declare type KeysExports = keyof typeof import('./keys'); | ||
/** | ||
* @category TypeDefinition | ||
*/ | ||
export declare type KeysTypeMapKey = 'publicKey'; | ||
/** | ||
* @category TypeDefinition | ||
*/ | ||
export declare type KeysTypeMap = Record<KeysTypeMapKey, SupportedTypeDefinition & { | ||
beet: KeysExports; | ||
}>; | ||
/** | ||
* Maps solana 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. | ||
* | ||
* @category TypeDefinition | ||
*/ | ||
export declare const keysTypeMap: KeysTypeMap; |
@@ -6,6 +6,39 @@ "use strict"; | ||
const beet_1 = require("@metaplex-foundation/beet"); | ||
const package_json_1 = require("../package.json"); | ||
const BEET_SOLANA_PACKAGE = package_json_1.name; | ||
const BEET_SOLANA_PACKAGE = '@metaplex-foundation/beet-solana'; | ||
const SOLANA_WEB3_PACKAGE = '@solana/web3.js'; | ||
const uint8Array32 = (0, beet_1.fixedSizeUint8Array)(32); | ||
/** | ||
* De/Serializer for solana {@link PublicKey}s aka `publicKey`. | ||
* | ||
* | ||
* ## Using PublicKey Directly | ||
* | ||
* ```ts | ||
* 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 | ||
* | ||
* ```ts | ||
* import { publicKey } from '@metaplex-foundation/beet-solana' | ||
* | ||
* type InstructionArgs = { | ||
* authority: web3.PublicKey | ||
* } | ||
* | ||
* const createStruct = new beet.BeetArgsStruct<InstructionArgs>( | ||
* [ | ||
* ['authority', publicKey] | ||
* ], | ||
* 'InstructionArgs' | ||
* ) | ||
* ``` | ||
* | ||
* @category beet/solana | ||
*/ | ||
exports.publicKey = { | ||
@@ -23,2 +56,9 @@ write: function (buf, offset, value) { | ||
}; | ||
/** | ||
* Maps solana 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. | ||
* | ||
* @category TypeDefinition | ||
*/ | ||
exports.keysTypeMap = { | ||
@@ -25,0 +65,0 @@ publicKey: { |
{ | ||
"name": "@metaplex-foundation/beet-solana", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "Solana specific extension for beet, the borsh compatible de/serializer", | ||
@@ -18,3 +18,3 @@ "main": "dist/src/beet-solana.js", | ||
"lint:fix": "prettier --write ./src", | ||
"doc": "typedoc src/*.ts --readme README.md" | ||
"doc": "rimraf ../docs/beet-solana && typedoc" | ||
}, | ||
@@ -43,2 +43,2 @@ "repository": "git@github.com:metaplex-foundation/beet-solana.git", | ||
} | ||
} | ||
} |
# @metaplex-foundation/beet-solana | ||
Solana 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). | ||
## Examples | ||
### Using PublicKey Directly | ||
```ts | ||
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 | ||
```ts | ||
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 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19986
172
44
1