Skip to content

Commit

Permalink
fix token conversion naming
Browse files Browse the repository at this point in the history
  • Loading branch information
goulinkh committed Jun 24, 2024
1 parent ec426dd commit b03a8b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
12 changes: 8 additions & 4 deletions src/services/dot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
14 changes: 9 additions & 5 deletions src/services/ksm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit b03a8b0

Please sign in to comment.