-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional
token_program_id
param to get_associated_token_address
- Loading branch information
1 parent
2a660e4
commit a3f8ba0
Showing
7 changed files
with
42 additions
and
3 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,5 +1,9 @@ | ||
from typing import Optional | ||
|
||
from solders.pubkey import Pubkey | ||
|
||
def get_associated_token_address( | ||
wallet_address: Pubkey, token_mint_address: Pubkey | ||
wallet_address: Pubkey, | ||
token_mint_address: Pubkey, | ||
token_program_id: Optional[Pubkey] = None, | ||
) -> Pubkey: ... |
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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from solders.pubkey import Pubkey | ||
from solders.token.associated import get_associated_token_address | ||
|
||
|
||
def test_ata() -> None: | ||
wallet_address = Pubkey.from_string("5d21Nx19eZBThbExCn1ESAk3RGmE8Rdp9PKMWZ2VedSK") | ||
token_mint = Pubkey.from_string("3CqfBkrmRsK3uXZaxktvTeeBkJp4yeFKs4mUi2jhKExz") | ||
assert get_associated_token_address( | ||
wallet_address, token_mint | ||
) == Pubkey.from_string("Aumq2SPVzZccYL3UAhvXoDDkNYLZr2zpyxLuJiyx79te") | ||
token22_id = Pubkey.from_string("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb") | ||
assert get_associated_token_address( | ||
wallet_address, token_mint, token22_id | ||
) == Pubkey.from_string("4xoV4cxTM3GcaWP7bKbUdu2Gp9P9nEgpmCPV8ykFGo4U") |