lending/js: fix unintentional recursion (#2018)

* bind to layout

* version bump: 0.3.4
This commit is contained in:
Jordan Sexton 2021-07-02 17:05:31 -05:00 committed by GitHub
parent 73e4e0c533
commit 3f675317bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@solana/spl-token-lending", "name": "@solana/spl-token-lending",
"version": "0.3.3", "version": "0.3.4",
"description": "SPL Token Lending JavaScript API", "description": "SPL Token Lending JavaScript API",
"license": "MIT", "license": "MIT",
"author": "Solana Maintainers <maintainers@solana.foundation>", "author": "Solana Maintainers <maintainers@solana.foundation>",

View File

@ -23,8 +23,8 @@ export interface EncodeDecode<T> {
/** @internal */ /** @internal */
export const encodeDecode = <T>(layout: Layout<T>): EncodeDecode<T> => { export const encodeDecode = <T>(layout: Layout<T>): EncodeDecode<T> => {
const decode = (buffer: Buffer, offset?: number) => layout.decode(buffer, offset); const decode = layout.decode.bind(layout);
const encode = (src: T, buffer: Buffer, offset?: number) => layout.encode(src, buffer, offset); const encode = layout.encode.bind(layout);
return { decode, encode }; return { decode, encode };
}; };