Skip to content

Commit

Permalink
Fix usages of getTokenAccountInfo to conform to new arg type (#10446)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickyrombo authored Nov 15, 2024
1 parent 998e1f7 commit 1e0c951
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 14 deletions.
3 changes: 0 additions & 3 deletions packages/common/src/services/audius-backend/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ export const getUserbankAccountInfo = async (

return getTokenAccountInfo(audiusBackendInstance, {
tokenAccount,
mint,
commitment
})
}
Expand Down Expand Up @@ -295,7 +294,6 @@ export const pollForTokenBalanceChange = async (
const debugTokenName = mint.toUpperCase()
let retries = 0
let tokenAccountInfo = await getTokenAccountInfo(audiusBackendInstance, {
mint,
tokenAccount
})
while (
Expand All @@ -317,7 +315,6 @@ export const pollForTokenBalanceChange = async (
}
await delay(retryDelayMs)
tokenAccountInfo = await getTokenAccountInfo(audiusBackendInstance, {
mint,
tokenAccount
})
}
Expand Down
4 changes: 1 addition & 3 deletions packages/common/src/store/buy-crypto/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ function* doBuyCryptoViaSol({

// Save pre swap token balance
const account = yield* call(getTokenAccountInfo, audiusBackendInstance, {
mint,
tokenAccount: userbank
})
const preSwapTokenBalance = account?.amount ?? BigInt(0)
Expand Down Expand Up @@ -778,8 +777,7 @@ function* recoverBuyCryptoViaSolIfNecessary() {

// Get pre swap token balance
const account = yield* call(getTokenAccountInfo, audiusBackendInstance, {
tokenAccount: userbank,
mint
tokenAccount: userbank
})

// Get a quote for swapping the entire balance
Expand Down
5 changes: 1 addition & 4 deletions packages/common/src/store/buy-usdc/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ function* purchaseStep({
getTokenAccountInfo,
audiusBackendInstance,
{
mint: 'usdc',
tokenAccount
}
)
Expand Down Expand Up @@ -429,7 +428,6 @@ function* recoverPurchaseIfNecessary() {
getTokenAccountInfo,
audiusBackendInstance,
{
mint: 'usdc',
tokenAccount: usdcTokenAccount
}
)
Expand All @@ -440,8 +438,7 @@ function* recoverPurchaseIfNecessary() {

const userBank = yield* getOrCreateUSDCUserBank()
const userBankAccountInfo = yield* call(pollForTokenAccountInfo, {
tokenAccount: userBank,
mint: 'usdc'
tokenAccount: userBank
})

const userBankInitialBalance = userBankAccountInfo?.amount ?? BigInt(0)
Expand Down
3 changes: 1 addition & 2 deletions packages/common/src/store/buy-usdc/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PublicKey } from '@solana/web3.js'
import { call, delay, select } from 'typed-redux-saga'

import { getTokenAccountInfo, MintName } from '~/services/audius-backend/solana'
import { getTokenAccountInfo } from '~/services/audius-backend/solana'
import { IntKeys } from '~/services/remote-config'
import {
MAX_CONTENT_PRICE_CENTS,
Expand Down Expand Up @@ -54,7 +54,6 @@ export function* pollForTokenAccountInfo({
...getTokenAccountInfoArgs
}: {
tokenAccount: PublicKey
mint?: MintName
retryDelayMs?: number
maxRetryCount?: number
}) {
Expand Down
2 changes: 0 additions & 2 deletions packages/common/src/store/purchase-content/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ function* doStartPurchaseContentFlow({

const userBank = yield* call(getOrCreateUSDCUserBank)
const tokenAccountInfo = yield* call(pollForTokenAccountInfo, {
mint: 'usdc',
tokenAccount: userBank
})

Expand Down Expand Up @@ -923,7 +922,6 @@ function* purchaseWithAnything({
// Get the USDC user bank
const usdcUserBank = yield* call(getOrCreateUSDCUserBank)
const usdcUserBankTokenAccount = yield* call(pollForTokenAccountInfo, {
mint: 'usdc',
tokenAccount: usdcUserBank
})
if (!usdcUserBankTokenAccount) {
Expand Down

0 comments on commit 1e0c951

Please sign in to comment.