Skip to content

Commit

Permalink
Merge pull request #7 from avianlabs/programid-in-publickey-extension
Browse files Browse the repository at this point in the history
allow to specify program ID for associatedTokenAddress()
  • Loading branch information
wiyarmir authored Feb 13, 2024
2 parents a35b04a + 1e3a2e2 commit f0bd4f3
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ public object AssociatedTokenProgram : Program(

public fun PublicKey.associatedTokenAddress(
tokenMintAddress: PublicKey,
programId: PublicKey = TokenProgram.programId,
): ProgramDerivedAddress = Program.findProgramAddress(
listOf(
bytes.copyOf(),
TokenProgram.programId.toByteArray(),
programId.toByteArray(),
tokenMintAddress.toByteArray()
),
AssociatedTokenProgram.programId,
Expand Down

0 comments on commit f0bd4f3

Please sign in to comment.