Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usages of getTokenAccountInfo to conform to new arg type #10446

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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