Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transferring OCP tokens #73

Open
nealburton opened this issue Mar 21, 2023 · 1 comment
Open

Transferring OCP tokens #73

nealburton opened this issue Mar 21, 2023 · 1 comment

Comments

@nealburton
Copy link

I'm trying to follow the tutorial here to transfer an OCP token: https://magiceden-oss.github.io/open_creator_protocol/open-creator-protocol/tutorials

I have some questions

  1. How do I know if a given token address is an OCP token?
  2. How do I know which is the correct Policy account to use in the transfer instruction?
@nothing0012
Copy link
Contributor

  1. https://magiceden-oss.github.io/open_creator_protocol/open-creator-protocol/concepts#mint-state One can use the mint_state to determine if a token is under the control of OCP
  2. the policy is a field inside mint_state, see the code example below
export const findMintStatePk = (mint: PublicKey) => {
  return PublicKey.findProgramAddressSync(
    [utils.bytes.utf8.encode("mint_state"), mint.toBuffer()],
    PROGRAM_ID
  )[0];
};

const mintStatePk = findMintStatePk(mint);
const mintStateAcc = await conn.getAccountInfo(mintStatePk);
const policy = mintStateAcc.policy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants