From b03a8b027894f61e28ec797cf8dc507e7a1864d5 Mon Sep 17 00:00:00 2001 From: Goulin Khoge <36013798+goulinkh@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:32:07 +0200 Subject: [PATCH] fix token conversion naming --- src/services/dot.ts | 12 ++++++++---- src/services/ksm.ts | 14 +++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/services/dot.ts b/src/services/dot.ts index f7d3f32..ed5566b 100644 --- a/src/services/dot.ts +++ b/src/services/dot.ts @@ -11,11 +11,15 @@ export class DotService extends SubstrateService { super(props, "DOT"); } + mainToPlanck(amount: string): string { + return this.mainToPlanck(amount); + } + /** - * Convert DOT token to planck - * @param amount amount in DOT + * Convert DOT planck to main + * @param amountDot amount in planck */ - mainToPlanck(amount: string): string { - return parseUnits(amount, 10).toString(); + planckToMain(amountDot: string): string { + return parseUnits(amountDot, 10).toString(); } } diff --git a/src/services/ksm.ts b/src/services/ksm.ts index 10eefc3..f4973c3 100644 --- a/src/services/ksm.ts +++ b/src/services/ksm.ts @@ -11,11 +11,15 @@ export class KsmService extends SubstrateService { super(props, "KSM"); } - /** - * Convert KSM token to planck - * @param amount amount in KSM - */ + mainToPlanck(amount: string): string { - return parseUnits(amount, 12).toString(); + return this.mainToPlanck(amount); } + + /** + * Convert KSM planck to main + * @param amountKsm amount in planck + */ + planckToMain(amountKsm: string): string { + return parseUnits(amountKsm, 12).toString(); }