-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eliminate
PublicKey
from isAddressLookupTableAccount
- Loading branch information
1 parent
5856efc
commit 0504ce2
Showing
3 changed files
with
11 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { PublicKey } from '@solana/web3.js'; | ||
import { Base58EncodedAddress } from 'web3js-experimental'; | ||
|
||
const PROGRAM_ID = 'AddressLookupTab1e1111111111111111111111111'; | ||
const LOOKUP_TABLE_ACCOUNT_TYPE = 1; | ||
const PROGRAM_ID = | ||
'AddressLookupTab1e1111111111111111111111111' as Base58EncodedAddress<'AddressLookupTab1e1111111111111111111111111'>; | ||
|
||
export function isAddressLookupTableAccount(accountOwner: PublicKey, accountData: Uint8Array): boolean { | ||
if (accountOwner.toBase58() !== PROGRAM_ID) return false; | ||
export function isAddressLookupTableAccount(accountOwner: Base58EncodedAddress, accountData: Uint8Array): boolean { | ||
if (accountOwner !== PROGRAM_ID) return false; | ||
if (!accountData || accountData.length === 0) return false; | ||
const LOOKUP_TABLE_ACCOUNT_TYPE = 1; | ||
return accountData[0] === LOOKUP_TABLE_ACCOUNT_TYPE; | ||
} |