Skip to content

Commit

Permalink
fix: update fee type and formated fee (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
wainola authored Apr 5, 2024
1 parent 4df7b79 commit 41af46b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ export type Execution = {
export type Fee = {
amount: string
id: string
resource: { decimals: number; id: string; type: string }
resourceID: string
tokenAddress: string
tokenSymbol: string
transferId: string
decimals: number
}

export type Transfer = {
Expand Down
6 changes: 2 additions & 4 deletions src/utils/Helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ describe("Helpers", () => {
tokenAddress: "0x0000000000000000000000000000000000000000",
tokenSymbol: "eth",
transferId: "0x",
resource: { decimals: 18, id: "0x", type: "fungible" },
resourceID: "0x",
decimals: 6,
id: "0x",
})

Expand All @@ -23,8 +22,7 @@ describe("Helpers", () => {
tokenAddress: '{"Concrete":{"parents":"0","interior":"Here"}}',
tokenSymbol: "PHA",
transferId: "0x",
resource: { decimals: 6, id: "0x", type: "fungible" },
resourceID: "0x",
decimals: 6,
id: "0x",
})

Expand Down
5 changes: 1 addition & 4 deletions src/utils/Helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,7 @@ export const getFormatedFee = (fee: Transfer["fee"]): string => {
let formatedFee = "No fee"

if (fee && Object.keys(fee).length) {
const {
resource: { decimals },
tokenSymbol,
} = fee
const { decimals, tokenSymbol } = fee
formatedFee = `${ethers.formatUnits(fee.amount, decimals !== 0 ? decimals : 18).toString()} ${tokenSymbol.toUpperCase()}`
}

Expand Down

0 comments on commit 41af46b

Please sign in to comment.