Spaces:
Sleeping
Sleeping
Download meteora/node_modules/@solana/buffer-layout-utils/src/native.ts from Trireme/hyper_dashboard: direct link, hf CLI and curl.
- Browser
- Download file 636 Bytes
-
https://huggingface.co/spaces/Trireme/hyper_dashboard/resolve/main/meteora/node_modules/%40solana/buffer-layout-utils/src/native.ts
- Command line
-
hf download hf://spaces/Trireme/hyper_dashboard/meteora/node_modules/@solana/buffer-layout-utils/src/native.ts
-
curl -L -o native.ts https://huggingface.co/spaces/Trireme/hyper_dashboard/resolve/main/meteora/node_modules/%40solana/buffer-layout-utils/src/native.ts
636 Bytes
| import { Layout, u8 } from '@solana/buffer-layout'; | |
| import { encodeDecode } from './base'; | |
| export const bool = (property?: string): Layout<boolean> => { | |
| const layout = u8(property); | |
| const { encode, decode } = encodeDecode(layout); | |
| const boolLayout = layout as Layout<unknown> as Layout<boolean>; | |
| boolLayout.decode = (buffer: Buffer, offset: number) => { | |
| const src = decode(buffer, offset); | |
| return !!src; | |
| }; | |
| boolLayout.encode = (bool: boolean, buffer: Buffer, offset: number) => { | |
| const src = Number(bool); | |
| return encode(src, buffer, offset); | |
| }; | |
| return boolLayout; | |
| }; | |