update borsh package builds and config (#2291)
This commit is contained in:
parent
35f4e26ef8
commit
fa2f18a2c0
|
@ -22,3 +22,4 @@ cli/npm-package/*.tgz
|
|||
docker-target
|
||||
.rollup.cache/
|
||||
test-keypair.json
|
||||
tsconfig.tsbuildinfo
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"name": "@coral-xyz/borsh",
|
||||
"version": "0.2.6",
|
||||
"description": "Anchor Borsh",
|
||||
"main": "dist/lib/index.js",
|
||||
"types": "dist/lib/index.d.ts",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./dist/lib/index.js"
|
||||
".": "./dist/index.js"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"publishConfig": {
|
||||
|
|
|
@ -10,6 +10,7 @@ import {
|
|||
} from "buffer-layout";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import BN from "bn.js";
|
||||
|
||||
export {
|
||||
u8,
|
||||
s8 as i8,
|
||||
|
|
|
@ -2,21 +2,17 @@
|
|||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2019",
|
||||
|
||||
"outDir": "./dist/lib",
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"typeRoots": ["../../types/", "../../node_modules/@types"]
|
||||
"typeRoots": ["./types"]
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["src/**/*.test.ts", "**/node_modules"]
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
|
||||
declare module 'buffer-layout' {
|
||||
// TODO: remove `any`.
|
||||
export class Layout<T = any> {
|
||||
span: number;
|
||||
property?: string;
|
||||
|
||||
constructor(span: number, property?: string);
|
||||
|
||||
decode(b: Buffer | string, offset?: number): T;
|
||||
encode(src: T, b: Buffer, offset?: number): number;
|
||||
getSpan(b: Buffer, offset?: number): number;
|
||||
replicate(name: string): this;
|
||||
}
|
||||
// TODO: remove any.
|
||||
export class Structure<T = any> extends Layout<T> {
|
||||
span: any;
|
||||
}
|
||||
export function greedy(
|
||||
elementSpan?: number,
|
||||
property?: string,
|
||||
): Layout<number>;
|
||||
export function offset<T>(
|
||||
layout: Layout<T>,
|
||||
offset?: number,
|
||||
property?: string,
|
||||
): Layout<T>;
|
||||
export function u8(property?: string): Layout<number>;
|
||||
export function u16(property?: string): Layout<number>;
|
||||
export function u24(property?: string): Layout<number>;
|
||||
export function u32(property?: string): Layout<number>;
|
||||
export function u40(property?: string): Layout<number>;
|
||||
export function u48(property?: string): Layout<number>;
|
||||
export function nu64(property?: string): Layout<number>;
|
||||
export function u16be(property?: string): Layout<number>;
|
||||
export function u24be(property?: string): Layout<number>;
|
||||
export function u32be(property?: string): Layout<number>;
|
||||
export function u40be(property?: string): Layout<number>;
|
||||
export function u48be(property?: string): Layout<number>;
|
||||
export function nu64be(property?: string): Layout<number>;
|
||||
export function s8(property?: string): Layout<number>;
|
||||
export function s16(property?: string): Layout<number>;
|
||||
export function s24(property?: string): Layout<number>;
|
||||
export function s32(property?: string): Layout<number>;
|
||||
export function s40(property?: string): Layout<number>;
|
||||
export function s48(property?: string): Layout<number>;
|
||||
export function ns64(property?: string): Layout<number>;
|
||||
export function s16be(property?: string): Layout<number>;
|
||||
export function s24be(property?: string): Layout<number>;
|
||||
export function s32be(property?: string): Layout<number>;
|
||||
export function s40be(property?: string): Layout<number>;
|
||||
export function s48be(property?: string): Layout<number>;
|
||||
export function ns64be(property?: string): Layout<number>;
|
||||
export function f32(property?: string): Layout<number>;
|
||||
export function f32be(property?: string): Layout<number>;
|
||||
export function f64(property?: string): Layout<number>;
|
||||
export function f64be(property?: string): Layout<number>;
|
||||
export function struct<T>(
|
||||
fields: Layout<any>[],
|
||||
property?: string,
|
||||
decodePrefixes?: boolean,
|
||||
): Layout<T>;
|
||||
export function bits(
|
||||
word: Layout<number>,
|
||||
msb?: boolean,
|
||||
property?: string,
|
||||
): any;
|
||||
export function seq<T>(
|
||||
elementLayout: Layout<T>,
|
||||
count: number | Layout<number>,
|
||||
property?: string,
|
||||
): Layout<T[]>;
|
||||
export function union(
|
||||
discr: Layout<any>,
|
||||
defaultLayout?: any,
|
||||
property?: string,
|
||||
): any;
|
||||
export function unionLayoutDiscriminator(
|
||||
layout: Layout<any>,
|
||||
property?: string,
|
||||
): any;
|
||||
export function blob(
|
||||
length: number | Layout<number>,
|
||||
property?: string,
|
||||
): Layout<Buffer>;
|
||||
export function cstr(property?: string): Layout<string>;
|
||||
export function utf8(maxSpan: number, property?: string): Layout<string>;
|
||||
}
|
Loading…
Reference in New Issue