Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};