Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Giannis Chatziveroglou committed Sep 15, 2023
1 parent 4cfb036 commit 5f812d8
Show file tree
Hide file tree
Showing 63 changed files with 2,891 additions and 2,132 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
run: cargo build-bpf

- name: Run local validator
run: solana-test-validator --url https://api.devnet.solana.com --clone metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s --clone PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT --clone 5qkkEWkKfGEuLZ4iveZzGSHZUM5WqyXTitsVr3TEU1Gp --clone CFDKv9emss3eeYDwGZMPd6CkZXYb9vpYgDGCEwojJp6i --clone cciMwwUJPstviYDc6w5pQkF5x8De12MGkMj54TUB3xS --bpf-program ccsxqYAg64wuLEh45KabyPvkKjrEfDPsDZUQrGn7mf3 ./target/deploy/cardinal_creator_standard.so --reset --quiet & echo $$! > validator.PID
run: solana-test-validator --url https://api.devnet.solana.com --clone metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s --clone PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT --clone 5qkkEWkKfGEuLZ4iveZzGSHZUM5WqyXTitsVr3TEU1Gp --clone CFDKv9emss3eeYDwGZMPd6CkZXYb9vpYgDGCEwojJp6i --clone cciMwwUJPstviYDc6w5pQkF5x8De12MGkMj54TUB3xS --bpf-program ccsxqYAg64wuLEh45KabyPvkKjrEfDPsDZUQrGn7mf3 ./target/deploy/solana_nft_programs_creator_standard.so --reset --quiet & echo $$! > validator.PID
- run: sleep 6
- run: solana airdrop 1000 $(solana-keygen pubkey ./tests/test-keypairs/test-key.json) --url http://localhost:8899
- run: yarn test
Expand Down
4 changes: 2 additions & 2 deletions .solitarc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const path = require("path");
const programDir = path.join(__dirname, "programs/cardinal-creator-standard");
const programDir = path.join(__dirname, "programs/solana-nft-programs-creator-standard");
const idlDir = path.join(__dirname, "sdk/idl");
const sdkDir = path.join(__dirname, "sdk", "generated");
const binaryInstallDir = path.join(__dirname, "..", "..", "target", "solita");

module.exports = {
idlGenerator: "shank",
programName: "cardinal_creator_standard",
programName: "solana_nft_programs_creator_standard",
programId: "ccsxqYAg64wuLEh45KabyPvkKjrEfDPsDZUQrGn7mf3",
idlDir,
sdkDir,
Expand Down
46 changes: 23 additions & 23 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ all: build start test stop

build:
cargo build-bpf
yarn idl:generate && yarn solita && yarn lint
yarn solita && yarn lint

start:
solana-test-validator --url https://api.devnet.solana.com \
--clone metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s --clone PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT \
--clone 5qkkEWkKfGEuLZ4iveZzGSHZUM5WqyXTitsVr3TEU1Gp \
--clone CFDKv9emss3eeYDwGZMPd6CkZXYb9vpYgDGCEwojJp6i \
--clone cciMwwUJPstviYDc6w5pQkF5x8De12MGkMj54TUB3xS \
--bpf-program ccsxqYAg64wuLEh45KabyPvkKjrEfDPsDZUQrGn7mf3 ./target/deploy/cardinal_creator_standard.so \
--bpf-program ccsxqYAg64wuLEh45KabyPvkKjrEfDPsDZUQrGn7mf3 ./target/deploy/solana_nft_programs_creator_standard.so \
--reset --quiet & echo $$! > validator.PID
sleep 8
solana airdrop 1000 $(TEST_KEY) --url http://localhost:8899
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
# Cardinal Creator Standard

<div style="text-align: center; width: 100%;">
<img style="width: full" src="./doc-assets/banner.png" />
</div>

## Read the [GitBook](https://docs.cardinal.so/the-creator-standard/summary)
# Creator Standard

> Contains the entire end-to-end proposal that includes background, proposed solution, pricing and examples of technical integration.
Expand Down
Binary file removed doc-assets/banner.png
Binary file not shown.
17 changes: 5 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
{
"name": "@cardinal/creator-standard",
"version": "3.0.2",
"description": "SDK for cardinal-creator-standard",
"name": "@solana-nft-programs/creator-standard",
"version": "1.0.0",
"description": "SDK for creator-standard",
"keywords": [
"solana",
"anchor",
"cardinal",
"creator-standard"
],
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"repository": "[email protected]:cardinal-labs/cardinal-creator-standard.git",
"author": "The Cardinal Team <[email protected]>",
"bugs": {
"url": "https://github.com/cardinal-labs/cardinal-creator-standard/issues",
"email": "[email protected]"
},
"homepage": "https://cardinal.so",
"repository": "[email protected]:solana-nft-programs/creator-standard.git",
"license": "AGPL-3.0",
"publishConfig": {
"access": "public"
Expand All @@ -42,7 +35,7 @@
"@solana/web3.js": "^1.66.2"
},
"devDependencies": {
"@cardinal/common": "^4.0.1",
"@solana-nft-programs/common": "^1.0.0",
"@metaplex-foundation/mpl-token-metadata": "^1.2.5",
"@rushstack/eslint-patch": "^1.2.0",
"@types/jest": "^29.2.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
[package]
name = "cardinal-creator-standard"
name = "solana-nft-programs-creator-standard"
version = "3.0.2"
description = "The Cardinal Creator Standard"
description = "The Creator Standard"
edition = "2021"
homepage = "https://cardinal.so"
repository = "https://github.com/cardinal-labs/cardinal-creator-standard"
authors = ["Cardinal <[email protected]>"]
repository = "https://github.com/solana-nft-programs/creator-standard"
license = "AGPL-3.0"
keywords = ["solana", "cardinal"]
keywords = ["solana"]

[lib]
crate-type = ["cdylib", "lib"]
name = "cardinal_creator_standard"
name = "solana_nft_programs_creator_standard"

[features]
no-entrypoint = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ use solana_security_txt::security_txt;

solana_program::declare_id!("ccsxqYAg64wuLEh45KabyPvkKjrEfDPsDZUQrGn7mf3");

#[cfg(not(feature = "no-entrypoint"))]
security_txt! {
name: "Cardinal Creator Standard",
project_url: "cardinal.so",
contacts: "email:[email protected],twitter:@cardinal_labs",
policy: "https://github.com/cardinal-labs/cardinal-creator-standard/blob/main/LICENSE",
preferred_languages: "en",
source_code: "https://github.com/cardinal-labs/cardinal-creator-standard"
}

#[cfg(not(feature = "no-entrypoint"))]
solana_program::entrypoint!(process_instruction);

Expand Down
2 changes: 1 addition & 1 deletion sdk/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { findMintManagerId } from "./pda";

export const identifyCCSToken = async (
connection: Connection,
mintId: PublicKey
mintId: PublicKey,
): Promise<boolean> => {
const mintManagerId = findMintManagerId(mintId);
const mintData = await getMint(connection, mintId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "3.0.0",
"name": "cardinal_creator_standard",
"version": "3.0.2",
"name": "solana_nft_programs_creator_standard",
"instructions": [
{
"name": "InitRuleset",
Expand Down
2 changes: 1 addition & 1 deletion sdk/instructionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Ruleset } from "./generated";
// Needed for transfer, approve, set_in_use_by, approve_and_set_in_use_by instructions
export const handleRemainingAccountsForRuleset = (
ix: TransactionInstruction,
rulesetData: Ruleset
rulesetData: Ruleset,
): TransactionInstruction => {
for (const extension of rulesetData.extensions) {
ix.keys.push({
Expand Down
10 changes: 5 additions & 5 deletions sdk/pda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import { PublicKey } from "@solana/web3.js";
import { PROGRAM_ID } from "./generated";

export const METADATA_PROGRAM_ID = new PublicKey(
"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
);

export const findRulesetId = (name?: string): PublicKey => {
return findProgramAddressSync(
[utils.bytes.utf8.encode("ruleset"), utils.bytes.utf8.encode(name || "")],
PROGRAM_ID
PROGRAM_ID,
)[0];
};

export const findMintManagerId = (mintId: PublicKey): PublicKey => {
return findProgramAddressSync(
[utils.bytes.utf8.encode("mint-manager"), mintId.toBuffer()],
PROGRAM_ID
PROGRAM_ID,
)[0];
};

Expand All @@ -29,7 +29,7 @@ export const findMintMetadataId = (mintId: PublicKey): PublicKey => {
METADATA_PROGRAM_ID.toBuffer(),
mintId.toBuffer(),
],
METADATA_PROGRAM_ID
METADATA_PROGRAM_ID,
)[0];
};

Expand All @@ -41,6 +41,6 @@ export const findMintEditionId = (mintId: PublicKey): PublicKey => {
mintId.toBuffer(),
utils.bytes.utf8.encode("edition"),
],
METADATA_PROGRAM_ID
METADATA_PROGRAM_ID,
)[0];
};
28 changes: 14 additions & 14 deletions tests/in-use-by/fail-burn-in-use-by-token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { MintManager } from "../../sdk/generated/accounts/MintManager";
import { createBurnInstruction } from "../../sdk/generated/instructions/Burn";
import { createSetInUseByInstruction } from "../../sdk/generated/instructions/SetInUseBy";
import { findMintManagerId, findRulesetId } from "../../sdk/pda";
import type { CardinalProvider } from "../../utils";
import type { SolanaProvider } from "../../utils";
import {
createCCSMintTx,
executeTransaction,
Expand All @@ -24,7 +24,7 @@ const mintKeypair = Keypair.generate();
const RULESET_ID = findRulesetId();
const inUseByAddress = Keypair.generate();

let provider: CardinalProvider;
let provider: SolanaProvider;

beforeAll(async () => {
provider = await getProvider();
Expand All @@ -37,15 +37,15 @@ test("Init", async () => {
provider.connection,
mintKeypair.publicKey,
provider.wallet.publicKey,
RULESET_ID
RULESET_ID,
);
await executeTransaction(provider.connection, tx, provider.wallet, [
mintKeypair,
]);

// check mint
const mintInfo = await tryGetAccount(() =>
getMint(provider.connection, mintKeypair.publicKey)
getMint(provider.connection, mintKeypair.publicKey),
);
expect(mintInfo).not.toBeNull();
expect(mintInfo?.isInitialized).toBeTruthy();
Expand All @@ -57,24 +57,24 @@ test("Init", async () => {
// check mint manager
const mintManager = await MintManager.fromAccountAddress(
provider.connection,
mintManagerId
mintManagerId,
);
expect(mintManager.mint.toString()).toBe(mintKeypair.publicKey.toString());
expect(mintManager.authority.toString()).toBe(
provider.wallet.publicKey.toString()
provider.wallet.publicKey.toString(),
);
expect(mintManager.ruleset.toString()).toBe(RULESET_ID.toString());
});

test("Set in use by", async () => {
const rulesetData = await Ruleset.fromAccountAddress(
provider.connection,
RULESET_ID
RULESET_ID,
);
const mintManagerId = findMintManagerId(mintKeypair.publicKey);
const holderAtaId = getAssociatedTokenAddressSync(
mintKeypair.publicKey,
provider.wallet.publicKey
provider.wallet.publicKey,
);

const tx = new Transaction();
Expand All @@ -92,14 +92,14 @@ test("Set in use by", async () => {
// check mint manager
const mintManager = await MintManager.fromAccountAddress(
provider.connection,
mintManagerId
mintManagerId,
);
expect(mintManager.mint.toString()).toBe(mintKeypair.publicKey.toString());
expect(mintManager.inUseBy?.toString()).toBe(
inUseByAddress.publicKey.toString()
inUseByAddress.publicKey.toString(),
);
expect(mintManager.authority.toString()).toBe(
provider.wallet.publicKey.toString()
provider.wallet.publicKey.toString(),
);
expect(mintManager.ruleset.toString()).toBe(RULESET_ID.toString());
});
Expand All @@ -109,7 +109,7 @@ test("Burn mint", async () => {
const tx = new Transaction();
const holderAtaId = getAssociatedTokenAddressSync(
mintKeypair.publicKey,
provider.wallet.publicKey
provider.wallet.publicKey,
);
const holderAta = await getAccount(provider.connection, holderAtaId);
expect(holderAta.isFrozen).toBe(true);
Expand All @@ -122,9 +122,9 @@ test("Burn mint", async () => {
mint: mintKeypair.publicKey,
holderTokenAccount: holderAtaId,
holder: provider.wallet.publicKey,
})
}),
);
await expect(
executeTransaction(provider.connection, tx, provider.wallet)
executeTransaction(provider.connection, tx, provider.wallet),
).rejects.toThrow();
});
Loading

0 comments on commit 5f812d8

Please sign in to comment.