Skip to content

Commit

Permalink
fixed decimal bug in maya synths (#994)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorian1te authored Jan 18, 2024
1 parent ee87097 commit 273da94
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-carpets-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@xchainjs/xchain-mayachain': patch
---

Maya synths return with 1e8 instead of 1e10
1 change: 1 addition & 0 deletions packages/xchain-mayachain/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const txUrl = `${DEFAULT_EXPLORER_URL}/tx`
const addressUrl = `${DEFAULT_EXPLORER_URL}/address`

export const CACAO_DECIMAL = 10
export const MAYA_SYNTH_DECIMAL = 8
export const MAYA_DECIMAL = 4
export const DEFAULT_GAS_ADJUSTMENT = 2
export const DEFAULT_GAS_LIMIT_VALUE = '4000000'
Expand Down
4 changes: 2 additions & 2 deletions packages/xchain-mayachain/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import axios from 'axios'
import * as bech32Buffer from 'bech32-buffer'
import Long from 'long'

import { AssetCacao, AssetMaya, CACAO_DECIMAL, DEFAULT_GAS_ADJUSTMENT, MAYA_DECIMAL } from './const'
import { AssetCacao, AssetMaya, CACAO_DECIMAL, DEFAULT_GAS_ADJUSTMENT, MAYA_DECIMAL, MAYA_SYNTH_DECIMAL } from './const'
import { ChainId, ExplorerUrls, NodeInfoResponse, TxData } from './types'
import { MsgNativeTx } from './types/messages'
import types from './types/proto/MsgCompiled'
Expand Down Expand Up @@ -371,7 +371,7 @@ export const getBalance = async ({
if (hasAssetFromString) {
return {
asset: hasAssetFromString,
amount: baseAmount(balance.amount, CACAO_DECIMAL),
amount: baseAmount(balance.amount, MAYA_SYNTH_DECIMAL),
}
}

Expand Down

0 comments on commit 273da94

Please sign in to comment.