Skip to content

Commit b8cbddf

Browse files
committed
add BTC token (#179)
* add BTC * bump version * add convertor
1 parent 2be9179 commit b8cbddf

File tree

3 files changed

+44
-11
lines changed

3 files changed

+44
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kilnfi/sdk",
3-
"version": "4.0.2",
3+
"version": "4.0.3",
44
"autor": "Kiln <[email protected]> (https://kiln.fi)",
55
"license": "BUSL-1.1",
66
"description": "JavaScript sdk for Kiln API",

src/fireblocks_signer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export type FireblocksAssetId =
4040
| 'TON_TEST'
4141
| 'TON'
4242
| 'KAVA_KAVA'
43-
| 'TRX';
43+
| 'TRX'
44+
| 'BTC';
4445

4546
export class FireblocksSigner {
4647
protected fireblocks: FireblocksSDK;

src/utils.ts

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,20 @@ export const uunitToUnit = (uunit: bigint): string => {
148148
return formatUnits(uunit, 6);
149149
};
150150

151+
/**
152+
* Convert Satoshi to BTC
153+
*/
154+
export const satToBtc = (sat: bigint): string => {
155+
return formatUnits(sat, 8);
156+
};
157+
158+
/**
159+
* Convert BTC to Satoshi
160+
*/
161+
export const btcToSat = (btc: string): bigint => {
162+
return parseUnits(btc, 8);
163+
};
164+
151165
/**
152166
* Convert uOSMO to OSMO
153167
*/
@@ -219,47 +233,65 @@ export const compressPublicKey = (pubkey: string): string => {
219233
return compressed_key.toString('hex');
220234
};
221235

222-
// Convert ATOM to uATOM
236+
/**
237+
* Convert ATOM to uATOM
238+
*/
223239
export const atomToUatom = (atom: string): bigint => {
224240
return parseUnits(atom, 6);
225241
};
226242

227-
// Convert DYDX to adydx
243+
/**
244+
* Convert DYDX to adydx
245+
*/
228246
export const dydxToAdydx = (dydx: string): bigint => {
229247
return parseUnits(dydx, 18); // adydx uses 18 decimals
230248
};
231249

232-
// Convert ZETA to azeta
250+
/**
251+
* Convert ZETA to azeta
252+
*/
233253
export const zetaToAzeta = (zeta: string): bigint => {
234254
return parseUnits(zeta, 18); // azeta uses 18 decimals
235255
};
236256

237-
// Convert OSMO to uosmo
257+
/**
258+
* Convert OSMO to uosmo
259+
*/
238260
export const osmoToUosmo = (osmo: string): bigint => {
239261
return parseUnits(osmo, 6);
240262
};
241263

242-
// Convert INJ to inj
264+
/**
265+
* Convert INJ to inj
266+
*/
243267
export const injToInj = (inj: string): bigint => {
244268
return parseUnits(inj, 18); // inj uses 18 decimals
245269
};
246270

247-
// Convert TIA to utia
271+
/**
272+
* Convert TIA to utia
273+
*/
248274
export const tiaToUtia = (tia: string): bigint => {
249275
return parseUnits(tia, 6);
250276
};
251277

252-
// Convert FET to afet
278+
/**
279+
* Convert FET to afet
280+
*/
253281
export const fetToAfet = (fet: string): bigint => {
254282
return parseUnits(fet, 18); // afet uses 18 decimals
255283
};
256284

257-
// Convert TRX to sun
285+
/**
286+
* Convert TRX to sun
287+
*/
258288
export const trxToSun = (trx: string): bigint => {
259289
return parseUnits(trx, 6);
260290
};
261291

262-
// Convert sun to TRX
292+
/**
293+
* Convert sun to TRX
294+
*/
263295
export const sunToTrx = (trx: bigint): string => {
264296
return formatUnits(trx, 6);
265297
};

0 commit comments

Comments
 (0)