Skip to content

Commit

Permalink
wip: temp packages
Browse files Browse the repository at this point in the history
  • Loading branch information
nhanphan committed Mar 20, 2024
1 parent 61a3bb1 commit d302c67
Show file tree
Hide file tree
Showing 61 changed files with 161 additions and 132 deletions.
8 changes: 4 additions & 4 deletions clients/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metaplex-foundation/mpl-candy-machine-asset",
"version": "0.0.1",
"name": "cma-preview",
"version": "0.0.3",
"description": "Client library for Candy Machine related programs",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand All @@ -25,10 +25,10 @@
"author": "Metaplex Maintainers <[email protected]>",
"license": "Apache-2.0",
"peerDependencies": {
"@metaplex-foundation/umi": ">= 0.8.2 < 1"
"@metaplex-foundation/umi": ">= 0.8.2 < 1",
"core-preview": "^0.1.1"
},
"dependencies": {
"@metaplex-foundation/mpl-core": "^0.1.0",
"@metaplex-foundation/mpl-token-metadata": "3.0.0-alpha.27",
"@metaplex-foundation/mpl-toolbox": "^0.9.0",
"@noble/hashes": "^1.2.0",
Expand Down
15 changes: 15 additions & 0 deletions clients/js/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion clients/js/src/createCandyGuard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function createCandyGuard<DA extends GuardSetArgs = DefaultGuardSetArgs>(
>
): TransactionBuilder {
const { guards, groups, ...rest } = input;
const program = context.programs.get<CandyGuardProgram>('mplCandyGuard');
const program = context.programs.get<CandyGuardProgram>('mplCandyGuardAsset');
const serializer = getCandyGuardDataSerializer<
DA extends undefined ? DefaultGuardSetArgs : DA,
any
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/createCandyMachineV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const createCandyMachineV2 = async (
newAccount: input.candyMachine,
lamports,
space,
programId: context.programs.get('mplCandyMachineCore').publicKey,
programId: context.programs.get('mplCandyMachineCoreAsset').publicKey,
})
)
.add(
Expand Down
10 changes: 5 additions & 5 deletions clients/js/src/createLutForCandyMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import {
TransactionBuilder,
uniquePublicKeys,
} from '@metaplex-foundation/umi';
import { getMplCoreProgramId } from '@metaplex-foundation/mpl-core';
import { getMplCoreProgramId } from 'core-preview';
import {
fetchCandyMachine,
getMplCandyMachineCoreProgramId,
getMplCandyMachineCoreAssetProgramId,
} from './generated';
import { findCandyMachineAuthorityPda } from './hooked';

Expand Down Expand Up @@ -48,13 +48,13 @@ export const getLutAddressesForCandyMachine = async (
collectionUpdateAuthority?: PublicKey
): Promise<PublicKey[]> => {
const candyMachineAccount = await fetchCandyMachine(context, candyMachine);
const { mintAuthority, collection } = candyMachineAccount;
const { mintAuthority, collectionMint } = candyMachineAccount;
collectionUpdateAuthority ??= context.identity.publicKey;

return uniquePublicKeys([
candyMachine,
mintAuthority,
collection,
collectionMint,
collectionUpdateAuthority,
findCandyMachineAuthorityPda(context, { candyMachine })[0],
getSysvar('instructions'),
Expand All @@ -63,6 +63,6 @@ export const getLutAddressesForCandyMachine = async (
getSplTokenProgramId(context),
getSplAssociatedTokenProgramId(context),
getMplTokenMetadataProgramId(context),
getMplCandyMachineCoreProgramId(context),
getMplCandyMachineCoreAssetProgramId(context),
]);
};
2 changes: 1 addition & 1 deletion clients/js/src/defaultGuards/freezeSolPayment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
} from '@metaplex-foundation/mpl-toolbox';
import { PublicKey, Signer } from '@metaplex-foundation/umi';
import { tuple, u64 } from '@metaplex-foundation/umi/serializers';
import { getMplCoreProgramId } from '@metaplex-foundation/mpl-core';
import { getMplCoreProgramId } from 'core-preview';
import { UnrecognizePathForRouteInstructionError } from '../errors';
import {
FreezeInstruction,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/defaultGuards/freezeTokenPayment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@metaplex-foundation/mpl-toolbox';
import { PublicKey, Signer } from '@metaplex-foundation/umi';
import { tuple, u64 } from '@metaplex-foundation/umi/serializers';
import { getMplCoreProgramId } from '@metaplex-foundation/mpl-core';
import { getMplCoreProgramId } from 'core-preview';
import { UnrecognizePathForRouteInstructionError } from '../errors';
import {
FreezeInstruction,
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/generated/accounts/allocationTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function getAllocationTrackerGpaBuilder(
context: Pick<Context, 'rpc' | 'programs'>
) {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return gpaBuilder(context, programId)
Expand All @@ -145,7 +145,7 @@ export function findAllocationTrackerPda(
}
): Pda {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return context.eddsa.findPda(programId, [
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/generated/accounts/allowListProof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function getAllowListProofGpaBuilder(
context: Pick<Context, 'rpc' | 'programs'>
) {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return gpaBuilder(context, programId)
Expand Down Expand Up @@ -142,7 +142,7 @@ export function findAllowListProofPda(
}
): Pda {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return context.eddsa.findPda(programId, [
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/generated/accounts/candyGuard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function getCandyGuardGpaBuilder(
context: Pick<Context, 'rpc' | 'programs'>
) {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return gpaBuilder(context, programId)
Expand Down Expand Up @@ -158,7 +158,7 @@ export function findCandyGuardPda(
}
): Pda {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return context.eddsa.findPda(programId, [
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/accounts/candyMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function getCandyMachineGpaBuilder(
context: Pick<Context, 'rpc' | 'programs'>
) {
const programId = context.programs.getPublicKey(
'mplCandyMachineCore',
'mplCandyMachineCoreAsset',
'CMACYFENjoBMHzapRXyo1JZkVS6EtaDDzkjMrmQLvr4J'
);
return gpaBuilder(context, programId)
Expand All @@ -111,7 +111,7 @@ export function getCandyMachineGpaBuilder(
features: Array<number>;
authority: PublicKey;
mintAuthority: PublicKey;
collection: PublicKey;
collectionMint: PublicKey;
itemsRedeemed: number | bigint;
data: CandyMachineDataArgs;
}>({
Expand All @@ -120,7 +120,7 @@ export function getCandyMachineGpaBuilder(
features: [9, array(u8(), { size: 6 })],
authority: [15, publicKeySerializer()],
mintAuthority: [47, publicKeySerializer()],
collection: [79, publicKeySerializer()],
collectionMint: [79, publicKeySerializer()],
itemsRedeemed: [111, u64()],
data: [119, getCandyMachineDataSerializer()],
})
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/generated/accounts/freezeEscrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export function getFreezeEscrowGpaBuilder(
context: Pick<Context, 'rpc' | 'programs'>
) {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return gpaBuilder(context, programId)
Expand Down Expand Up @@ -224,7 +224,7 @@ export function findFreezeEscrowPda(
}
): Pda {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return context.eddsa.findPda(programId, [
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/generated/accounts/mintCounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function getMintCounterGpaBuilder(
context: Pick<Context, 'rpc' | 'programs'>
) {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return gpaBuilder(context, programId)
Expand All @@ -133,7 +133,7 @@ export function findMintCounterPda(
}
): Pda {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return context.eddsa.findPda(programId, [
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/generated/accounts/nftMintCounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function getNftMintCounterGpaBuilder(
context: Pick<Context, 'rpc' | 'programs'>
) {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return gpaBuilder(context, programId)
Expand Down Expand Up @@ -142,7 +142,7 @@ export function findNftMintCounterPda(
}
): Pda {
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);
return context.eddsa.findPda(programId, [
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/generated/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

export * from './mplCandyGuard';
export * from './mplCandyMachineCore';
export * from './mplCandyGuardAsset';
export * from './mplCandyMachineCoreAsset';
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ nameToErrorMap.set('InvalidAccountVersion', CgInvalidAccountVersionError);
* Attempts to resolve a custom program error from the provided error code.
* @category Errors
*/
export function getMplCandyGuardErrorFromCode(
export function getMplCandyGuardAssetErrorFromCode(
code: number,
program: Program,
cause?: Error
Expand All @@ -748,7 +748,7 @@ export function getMplCandyGuardErrorFromCode(
* Attempts to resolve a custom program error from the provided error name, i.e. 'Unauthorized'.
* @category Errors
*/
export function getMplCandyGuardErrorFromName(
export function getMplCandyGuardAssetErrorFromName(
name: string,
program: Program,
cause?: Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ nameToErrorMap.set('IncorrectPluginAuthority', CmIncorrectPluginAuthorityError);
* Attempts to resolve a custom program error from the provided error code.
* @category Errors
*/
export function getMplCandyMachineCoreErrorFromCode(
export function getMplCandyMachineCoreAssetErrorFromCode(
code: number,
program: Program,
cause?: Error
Expand All @@ -510,7 +510,7 @@ export function getMplCandyMachineCoreErrorFromCode(
* Attempts to resolve a custom program error from the provided error name, i.e. 'Unauthorized'.
* @category Errors
*/
export function getMplCandyMachineCoreErrorFromName(
export function getMplCandyMachineCoreAssetErrorFromName(
name: string,
program: Program,
cause?: Error
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/addConfigLines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function addConfigLines(
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCandyMachineCore',
'mplCandyMachineCoreAsset',
'CMACYFENjoBMHzapRXyo1JZkVS6EtaDDzkjMrmQLvr4J'
);

Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/createCandyGuard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function createCandyGuard(
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);

Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/deleteCandyGuard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function deleteCandyGuard(
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function deleteCandyMachine(
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCandyMachineCore',
'mplCandyMachineCoreAsset',
'CMACYFENjoBMHzapRXyo1JZkVS6EtaDDzkjMrmQLvr4J'
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export function initializeCandyMachineV2(
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCandyMachineCore',
'mplCandyMachineCoreAsset',
'CMACYFENjoBMHzapRXyo1JZkVS6EtaDDzkjMrmQLvr4J'
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function mintAssetFromCandyMachine(
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCandyMachineCore',
'mplCandyMachineCoreAsset',
'CMACYFENjoBMHzapRXyo1JZkVS6EtaDDzkjMrmQLvr4J'
);

Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/mintV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export function mintV2(
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);

Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function route(
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function setCandyGuardAuthority(
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCandyGuard',
'mplCandyGuardAsset',
'CMAGAKJ67e9hRZgfC5SFTbZH8MgEmtqazKXjmkaJjWTJ'
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function setCandyMachineAuthority(
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCandyMachineCore',
'mplCandyMachineCoreAsset',
'CMACYFENjoBMHzapRXyo1JZkVS6EtaDDzkjMrmQLvr4J'
);

Expand Down
Loading

0 comments on commit d302c67

Please sign in to comment.