feat: add decodeUnchecked to borsh-schema.ts (#17620)

This commit is contained in:
Lieu Zheng Hong
2021-06-02 19:43:01 +08:00
committed by GitHub
parent bbcdf073ba
commit d47990e753
2 changed files with 12 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
import {Buffer} from 'buffer';
import {serialize, deserialize} from 'borsh';
import {serialize, deserialize, deserializeUnchecked} from 'borsh';
// Class wrapping a plain object
export class Struct {
@@ -14,6 +14,10 @@ export class Struct {
static decode(data: Buffer): any {
return deserialize(SOLANA_SCHEMA, this, data);
}
static decodeUnchecked(data: Buffer): any {
return deserializeUnchecked(SOLANA_SCHEMA, this, data);
}
}
// Class representing a Rust-compatible enum, since enums are only strings or