UNPKG

@secux/app-sol

Version:
1 lines 668 B
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.u64=void 0;const utility_1=require("@secux/utility"),BufferLayout=require("@solana/buffer-layout");var length;exports.u64=(length=8,property=>{const layout=BufferLayout.blob(length,property),decode=layout.decode.bind(layout),encode=layout.encode.bind(layout),bigIntLayout=layout;return bigIntLayout.decode=(buffer,offset)=>{const src=decode(buffer,offset),hexValue=Buffer.from(src).toString("hex");return BigInt(`0x${hexValue}`)},bigIntLayout.encode=(bigInt,buffer,offset)=>{const src=(0,utility_1.BigIntToBuffer)(bigInt.toString(),length,!0);return encode(src,buffer,offset)},bigIntLayout});