handle missing tokens for srm

This commit is contained in:
Tyler Shipe 2021-04-29 16:28:55 -04:00
parent 6fbd949b9f
commit fe5172803a
3 changed files with 10 additions and 12 deletions

View File

@ -56,9 +56,11 @@ const AccountSelect = ({
getSymbolForTokenMintAddress(a.account.mint.toString())
)
const missingTokens = Object.keys(symbols)
.filter((sym) => !symbolsForAccounts.includes(sym))
.join(', ')
const missingTokens = symbols
? Object.keys(symbols)
.filter((sym) => !symbolsForAccounts.includes(sym))
.join(', ')
: null
return (
<div className={`relative inline-block w-full`}>
@ -181,10 +183,10 @@ const AccountSelect = ({
</Listbox.Option>
)
})}
{symbols && accounts.length !== 3 ? (
{missingTokens && accounts.length !== 3 ? (
<Listbox.Option value="">
<div className="flex items-center justify-center text-th-fgd-1 p-2">
Wallet token addresses not found for: {missingTokens}
Wallet token address not found for: {missingTokens}
</div>
</Listbox.Option>
) : null}

View File

@ -102,9 +102,9 @@ export const RefreshClockwiseIcon = ({ className }) => {
>
<path
d="M20 4.00188L19.418 9.00188M19.418 9.00188C18.7542 7.36001 17.5643 5.98479 16.035 5.09174C14.5056 4.19869 12.7232 3.83829 10.967 4.06702C9.21086 4.29575 7.58021 5.10068 6.33063 6.35566C5.08105 7.61064 4.28316 9.24474 4.062 11.0019M19.418 9.00188H15M4 20.0019L4.581 15.0019M4.581 15.0019C5.2458 16.6428 6.43597 18.0169 7.96517 18.9092C9.49436 19.8014 11.2763 20.1614 13.0319 19.9328C14.7875 19.7041 16.4178 18.8998 17.6675 17.6456C18.9171 16.3915 19.7156 14.7583 19.938 13.0019M4.581 15.0019H9"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)

View File

@ -229,10 +229,8 @@ const useMangoStore = create<MangoStore>((set, get) => ({
const mangoClient = get().mangoClient
const programId = IDS[cluster].mango_program_id
const set = get().set
console.log('BEFORE-----------------------------------')
if (!wallet?.publicKey || !wallet.publicKey) return
console.log('AFTER======--------------')
return mangoClient
.getMarginAccountsForOwner(
@ -242,8 +240,6 @@ const useMangoStore = create<MangoStore>((set, get) => ({
wallet
)
.then((marginAccounts) => {
console.log('HERE=========================================')
if (marginAccounts.length > 0) {
set((state) => {
state.marginAccounts = marginAccounts