Skip to content

Commit

Permalink
fix BigInt issue
Browse files Browse the repository at this point in the history
prettier
  • Loading branch information
brenzi committed Sep 9, 2024
1 parent 89b2506 commit 0e97a86
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
18 changes: 11 additions & 7 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@
Bond TEER to accumulate TEERdays
</div>
<div
v-if="accountStore.getTransferrable < Math.pow(10, 9)"
v-if="
accountStore.getTransferrable <
BigInt(Math.pow(10, 9))
"
class="text-sm text-red-500"
>
Not enough transferrable TEER. Please get free test TEER
Expand Down Expand Up @@ -442,9 +445,10 @@
step="0.1"
:min="0.1"
:max="
accountStore.getTransferrable /
Math.pow(10, 12) -
0.1
Number(
accountStore.getTransferrable /
BigInt(Math.pow(10, 12)),
) - 0.1
"
required
class="flex-grow rounded-md border-0 bg-gray-800 py-1.5 text-white shadow-sm ring-1 ring-inset ring-gray-700 focus:ring-1 focus:ring-inset focus:ring-incognitee-green sm:text-sm sm:leading-6"
Expand Down Expand Up @@ -1161,9 +1165,9 @@ watch(accountStore, async () => {
},
}) => {
console.log("TEER balance:" + currentFree);
accountStore.free = Number(currentFree);
accountStore.reserved = Number(currentReserved);
accountStore.frozen = Number(currentFrozen);
accountStore.free = BigInt(currentFree);
accountStore.reserved = BigInt(currentReserved);
accountStore.frozen = BigInt(currentFrozen);
isFetchingTeerBalance.value = false;
},
);
Expand Down
6 changes: 3 additions & 3 deletions store/teerAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { formatBalance } from "@polkadot/util";
export const useAccount = defineStore("teerAccount", {
state: () => ({
address: <string | null>null,
free: 0,
reserved: 0,
frozen: 0,
free: BigInt(0),
reserved: BigInt(0),
frozen: BigInt(0),
}),
getters: {
getShortAddress({ address }): string {
Expand Down

0 comments on commit 0e97a86

Please sign in to comment.