Skip to content

Commit

Permalink
Configure Kinobi for PrintV1 and fix some program errors (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva authored Aug 21, 2023
1 parent 0c7111b commit b9aa26e
Show file tree
Hide file tree
Showing 9 changed files with 594 additions and 57 deletions.
2 changes: 1 addition & 1 deletion clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@metaplex-foundation/umi": "^0.8.2"
},
"dependencies": {
"@metaplex-foundation/mpl-toolbox": "^0.8.0"
"@metaplex-foundation/mpl-toolbox": "^0.8.1"
},
"devDependencies": {
"@ava/typescript": "^3.0.1",
Expand Down
8 changes: 4 additions & 4 deletions clients/js/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions clients/js/src/generated/accounts/editionMarkerV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
import {
Serializer,
bytes,
publicKey as publicKeySerializer,
string,
struct,
} from '@metaplex-foundation/umi/serializers';
import { Key, KeyArgs, getKeySerializer } from '../types';
Expand Down Expand Up @@ -145,3 +147,47 @@ export function getEditionMarkerV2GpaBuilder(
deserializeEditionMarkerV2(account)
);
}

export function findEditionMarkerV2Pda(
context: Pick<Context, 'eddsa' | 'programs'>,
seeds: {
/** The address of the mint account */
mint: PublicKey;
}
): Pda {
const programId = context.programs.getPublicKey(
'mplTokenMetadata',
'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'
);
return context.eddsa.findPda(programId, [
string({ size: 'variable' }).serialize('metadata'),
publicKeySerializer().serialize(programId),
publicKeySerializer().serialize(seeds.mint),
string({ size: 'variable' }).serialize('edition'),
string({ size: 'variable' }).serialize('marker'),
]);
}

export async function fetchEditionMarkerV2FromSeeds(
context: Pick<Context, 'eddsa' | 'programs' | 'rpc'>,
seeds: Parameters<typeof findEditionMarkerV2Pda>[1],
options?: RpcGetAccountOptions
): Promise<EditionMarkerV2> {
return fetchEditionMarkerV2(
context,
findEditionMarkerV2Pda(context, seeds),
options
);
}

export async function safeFetchEditionMarkerV2FromSeeds(
context: Pick<Context, 'eddsa' | 'programs' | 'rpc'>,
seeds: Parameters<typeof findEditionMarkerV2Pda>[1],
options?: RpcGetAccountOptions
): Promise<EditionMarkerV2 | null> {
return safeFetchEditionMarkerV2(
context,
findEditionMarkerV2Pda(context, seeds),
options
);
}
Loading

0 comments on commit b9aa26e

Please sign in to comment.