Skip to content

Commit 58e741d

Browse files
authored
Merge pull request #27 from macalinao/igm/updates
Add master edition PDA
2 parents 9eaa914 + d2351f4 commit 58e741d

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

.changeset/crazy-melons-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@macalinao/clients-token-metadata": patch
3+
---
4+
5+
Add master edition PDA

clients/token-metadata/coda.config.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ const addCustomPDAsVisitor = addPdasVisitor({
2424
),
2525
],
2626
},
27+
{
28+
name: "masterEdition",
29+
seeds: [
30+
constantPdaSeedNodeFromString("utf8", "metadata"),
31+
variablePdaSeedNode(
32+
"programId",
33+
publicKeyTypeNode(),
34+
"The address of the program",
35+
),
36+
variablePdaSeedNode(
37+
"mint",
38+
publicKeyTypeNode(),
39+
"The address of the mint account",
40+
),
41+
constantPdaSeedNodeFromString("utf8", "edition"),
42+
],
43+
},
2744
],
2845
});
2946

clients/token-metadata/src/generated/pdas/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
* @see https://github.com/codama-idl/codama
77
*/
88

9+
export * from "./masterEdition.js";
910
export * from "./metadata.js";
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* This code was AUTOGENERATED using the codama library.
3+
* Please DO NOT EDIT THIS FILE, instead use visitors
4+
* to add features, then rerun codama to update it.
5+
*
6+
* @see https://github.com/codama-idl/codama
7+
*/
8+
9+
import type { Address, ProgramDerivedAddress } from "@solana/kit";
10+
import {
11+
getAddressEncoder,
12+
getProgramDerivedAddress,
13+
getUtf8Encoder,
14+
} from "@solana/kit";
15+
16+
export interface MasterEditionSeeds {
17+
/** The address of the program */
18+
programId: Address;
19+
/** The address of the mint account */
20+
mint: Address;
21+
}
22+
23+
export async function findMasterEditionPda(
24+
seeds: MasterEditionSeeds,
25+
config: { programAddress?: Address | undefined } = {},
26+
): Promise<ProgramDerivedAddress> {
27+
const {
28+
programAddress = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" as Address<"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s">,
29+
} = config;
30+
return await getProgramDerivedAddress({
31+
programAddress,
32+
seeds: [
33+
getUtf8Encoder().encode("metadata"),
34+
getAddressEncoder().encode(seeds.programId),
35+
getAddressEncoder().encode(seeds.mint),
36+
getUtf8Encoder().encode("edition"),
37+
],
38+
});
39+
}

0 commit comments

Comments
 (0)