Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Use u64 on buy-audio/sagas to fix typecheck (#2875)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickyrombo authored Feb 16, 2023
1 parent ba476cd commit aee1bd0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/web/src/store/application/ui/buy-audio/sagas.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable new-cap */
import {
IntKeys,
Name,
Expand Down Expand Up @@ -685,7 +686,8 @@ function* swapStep({
const beforeSwapAudioAccountInfo = yield* call(getAudioAccountInfo, {
tokenAccount
})
const beforeSwapAudioBalance = beforeSwapAudioAccountInfo?.amount ?? new BN(0)
const beforeSwapAudioBalance =
beforeSwapAudioAccountInfo?.amount ?? new u64(0)

// Swap the SOL for AUDIO
yield* put(swapStarted())
Expand Down Expand Up @@ -738,7 +740,7 @@ function* swapStep({

type TransferStepParams = {
rootAccount: Keypair
transferAmount: BN
transferAmount: u64
transactionHandler: TransactionHandler
provider: OnRampProvider
}
Expand Down Expand Up @@ -915,7 +917,7 @@ function* doBuyAudio({
surplusAudio: parseFloat(
formatWei(
convertWAudioToWei(
audioSwappedSpl.sub(new BN(desiredAudioAmount.amount))
audioSwappedSpl.sub(new u64(desiredAudioAmount.amount))
)
).replaceAll(',', '')
)
Expand Down Expand Up @@ -1086,10 +1088,10 @@ function* recoverPurchaseIfNecessary() {
const audioAccountInfo = yield* call(getAudioAccountInfo, {
tokenAccount
})
const audioBalance = audioAccountInfo?.amount ?? new BN(0)
const audioBalance = audioAccountInfo?.amount ?? new u64(0)

// If the user's root wallet has $AUDIO, that usually indicates a failed transfer
if (audioBalance.gt(new BN(0))) {
if (audioBalance.gt(new u64(0))) {
// Check we can afford to transfer
if (
new BN(existingBalance)
Expand Down

0 comments on commit aee1bd0

Please sign in to comment.