From 86d0d192c1f1b19e99f9390255e01c3e6a09f342 Mon Sep 17 00:00:00 2001 From: joon9823 Date: Fri, 15 Nov 2024 16:02:49 +0900 Subject: [PATCH] Export endian functions --- package-lock.json | 4 ++-- package.json | 2 +- src/util/bcs.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed48fb9..73260c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@initia/initia.js", - "version": "0.2.22", + "version": "0.2.23", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@initia/initia.js", - "version": "0.2.22", + "version": "0.2.23", "license": "Apache-2.0", "dependencies": { "@bitcoinerlab/secp256k1": "^1.1.1", diff --git a/package.json b/package.json index edf0130..917835b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@initia/initia.js", - "version": "0.2.22", + "version": "0.2.23", "description": "The JavaScript SDK for Initia", "license": "Apache-2.0", "author": "Initia Foundation", diff --git a/src/util/bcs.ts b/src/util/bcs.ts index 6a9baeb..060bff2 100644 --- a/src/util/bcs.ts +++ b/src/util/bcs.ts @@ -143,7 +143,7 @@ export const bcs = { ...initiaBcs, } -function toLittleEndian(bigint: bigint): Uint8Array { +export function toLittleEndian(bigint: bigint): Uint8Array { const result = [] while (bigint > 0) { result.push(Number(bigint % BigInt(256))) @@ -152,7 +152,7 @@ function toLittleEndian(bigint: bigint): Uint8Array { return new Uint8Array(result) } -function fromLittleEndian(bytes: number[]): bigint { +export function fromLittleEndian(bytes: number[]): bigint { let result = 0n while (bytes.length > 0) { result = result * 256n + BigInt(bytes.pop() as number)