Skip to content

Commit 0244423

Browse files
authored
chore: fix monad assetValue (#1600)
1 parent 25ea87f commit 0244423

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

.changeset/bold-pots-share.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@swapkit/helpers": patch
3+
---
4+
5+
Fixes Monad assetValue identifier and gas asset status

packages/helpers/src/modules/__tests__/assetValue.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,21 @@ describe("fromChainOrSignature", () => {
10881088
}),
10891089
);
10901090

1091+
const monadAsset = AssetValue.from({ chain: Chain.Monad });
1092+
const { baseDecimal: monadDecimal } = getChainConfig(Chain.Monad);
1093+
expect(monadAsset).toEqual(
1094+
expect.objectContaining({
1095+
address: undefined,
1096+
chain: Chain.Monad,
1097+
decimal: monadDecimal,
1098+
isGasAsset: true,
1099+
isSynthetic: false,
1100+
symbol: "MON",
1101+
ticker: "MON",
1102+
type: "Native",
1103+
}),
1104+
);
1105+
10911106
const thorAsset = AssetValue.from({ chain: Chain.THORChain });
10921107
const { baseDecimal: thorDecimal } = getChainConfig(Chain.THORChain);
10931108
expect(thorAsset).toEqual(

packages/helpers/src/utils/__tests__/asset.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const tickerMap: Record<string, string> = {
99
[Chain.Aurora]: "ETH",
1010
[Chain.Base]: "ETH",
1111
[Chain.BinanceSmartChain]: "BNB",
12+
[Chain.Monad]: "MON",
1213
[Chain.Cosmos]: "ATOM",
1314
[Chain.Maya]: "CACAO",
1415
[Chain.Optimism]: "ETH",

packages/helpers/src/utils/asset.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ export function isGasAsset({ chain, symbol }: { chain: Chain; symbol: string })
282282
.with(Chain.Berachain, () => symbol === "BERA")
283283
.with(Chain.BinanceSmartChain, () => symbol === "BNB")
284284
.with(Chain.Gnosis, () => symbol === "xDAI" || symbol === "XDAI")
285+
.with(Chain.Monad, () => symbol === "MON")
285286
.with(Chain.XLayer, () => symbol === "OKB")
286287
.with(Chain.Maya, () => symbol === "CACAO")
287288
.with(Chain.Cosmos, () => symbol === "ATOM")
@@ -300,6 +301,7 @@ export const getCommonAssetInfo = (assetString: CommonAssetString) => {
300301
.with(Chain.Cosmos, (asset) => ({ decimal, identifier: `${asset}.ATOM` }))
301302
.with(Chain.Maya, (asset) => ({ decimal: 10, identifier: `${asset}.CACAO` }))
302303
.with(Chain.BinanceSmartChain, (asset) => ({ decimal, identifier: `${asset}.BNB` }))
304+
.with(Chain.Monad, (asset) => ({ decimal, identifier: `${asset}.MON` }))
303305
.with(Chain.Avalanche, (asset) => ({ decimal, identifier: `${asset}.AVAX` }))
304306
.with(Chain.Gnosis, (asset) => ({ decimal, identifier: `${asset}.xDAI` }))
305307
.with(Chain.XLayer, (asset) => ({ decimal, identifier: `${asset}.OKB` }))
@@ -348,6 +350,7 @@ export function getAssetType({ chain, symbol }: { chain: Chain; symbol: string }
348350
.with(Chain.Cosmos, () => symbol === "ATOM")
349351
.with(Chain.BinanceSmartChain, () => symbol === "BNB")
350352
.with(Chain.Maya, () => symbol === "CACAO")
353+
.with(Chain.Monad, () => symbol === "MON")
351354
.with(Chain.THORChain, () => symbol === "RUNE")
352355
.with(Chain.Tron, () => symbol === "TRX")
353356
.with(Chain.XLayer, () => symbol === "OKB")

0 commit comments

Comments
 (0)