When you have a wallet without a wrapped SOL account address and try to open a position with sol in the pair, the program breaks.
Error:
Cannot read properties of undefined (reading 'tokenAccountAddress')
at francium-sdk/dist/model/farm/farm.js:60:95
source code snippet where the error is:
if (isNativeMint(targetFarmInfo.tknMint0)) {
userTknAccount0 = parsedTokenAccounts[NATIVE_MINT.toBase58()].tokenAccountAddress;
} else if (isNativeMint(targetFarmInfo.tknMint1)) {
userTknAccount1 = parsedTokenAccounts[NATIVE_MINT.toBase58()].tokenAccountAddress;
} else {
// not include SOL
}
since wallet does not have a wrapped sol account, it won't have an address. parsedTokenAccounts[NATIVE_MINT.toBase58()]. will be undefined.
Fix:
check if wallet has a wrapped sol addr, if not create one first.
When you have a wallet without a wrapped SOL account address and try to open a position with sol in the pair, the program breaks.
Error:
source code snippet where the error is:
since wallet does not have a wrapped sol account, it won't have an address.
parsedTokenAccounts[NATIVE_MINT.toBase58()].
will be undefined.Fix: