Skip to content

Commit

Permalink
fix: change native sol address (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov authored Jul 17, 2024
1 parent b4fc1dc commit b7e32d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export const AddressZero = '0x0000000000000000000000000000000000000000'
export const AlternativeAddressZero =
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
export const wrappedSolAddress = 'So11111111111111111111111111111111111111112'
export const SolSystemProgram = '11111111111111111111111111111111'
5 changes: 2 additions & 3 deletions src/core/Solana/getSolanaBalance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ChainId, Token, TokenAmount } from '@lifi/types'
import { PublicKey } from '@solana/web3.js'
import { wrappedSolAddress } from '../../constants.js'
import { SolSystemProgram } from '../../constants.js'
import { getSolanaConnection } from './connection.js'
import { TokenProgramAddress } from './types.js'

Expand Down Expand Up @@ -53,8 +53,7 @@ const getSolanaBalanceDefault = async (
{} as Record<string, bigint>
)
: {}
walletTokenAmounts[wrappedSolAddress] ??= 0n
walletTokenAmounts[wrappedSolAddress] += solBalance
walletTokenAmounts[SolSystemProgram] = solBalance
const tokenAmounts: TokenAmount[] = tokens.map((token) => {
if (walletTokenAmounts[token.address]) {
return {
Expand Down

0 comments on commit b7e32d1

Please sign in to comment.