From cc60b562a3226b14374b8518ef54982dd7922ce8 Mon Sep 17 00:00:00 2001 From: Ilies Zareb <73179254+menefrego15@users.noreply.github.com> Date: Fri, 15 Nov 2024 17:53:27 +0100 Subject: [PATCH 1/2] feat: add token to small units conversion (#157) --- src/utils.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/utils.ts b/src/utils.ts index 73b33d7..d640037 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -204,3 +204,38 @@ export const compressPublicKey = (pubkey: string): string => { const compressed_key = Buffer.concat([new Uint8Array(Buffer.from(prefix, 'hex')), x]); return compressed_key.toString('hex'); }; + +// Convert ATOM to uATOM +export const atomToUatom = (atom: string): bigint => { + return parseUnits(atom, 6); +}; + +// Convert DYDX to adydx +export const dydxToAdydx = (dydx: string): bigint => { + return parseUnits(dydx, 18); // adydx uses 18 decimals +}; + +// Convert ZETA to azeta +export const zetaToAzeta = (zeta: string): bigint => { + return parseUnits(zeta, 18); // azeta uses 18 decimals +}; + +// Convert OSMO to uosmo +export const osmoToUosmo = (osmo: string): bigint => { + return parseUnits(osmo, 6); +}; + +// Convert INJ to inj +export const injToInj = (inj: string): bigint => { + return parseUnits(inj, 18); // inj uses 18 decimals +}; + +// Convert TIA to utia +export const tiaToUtia = (tia: string): bigint => { + return parseUnits(tia, 6); +}; + +// Convert FET to afet +export const fetToAfet = (fet: string): bigint => { + return parseUnits(fet, 18); // afet uses 18 decimals +}; From 244464042d5c3087ec5d4093c75149d3cc08225b Mon Sep 17 00:00:00 2001 From: Ilies Zareb <73179254+menefrego15@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:58:28 +0100 Subject: [PATCH 2/2] feat: release 3.1.17 cosmos utils (#158) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e1f6845..fec3ed8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kilnfi/sdk", - "version": "3.1.16", + "version": "3.1.17", "autor": "Kiln (https://kiln.fi)", "license": "BUSL-1.1", "description": "JavaScript sdk for Kiln API",