Skip to content

Commit

Permalink
Merged main and regenerated files after removing second discriminator
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCipherCoder committed Nov 13, 2024
1 parent 21b4040 commit ee3a066
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ export function getInitializeNonTransferableMintDiscriminatorBytes() {
return getU8Encoder().encode(INITIALIZE_NON_TRANSFERABLE_MINT_DISCRIMINATOR);
}

export const INITIALIZE_NON_TRANSFERABLE_MINT_NON_TRANSFER_DISCRIMINATOR = 0;

export function getInitializeNonTransferableMintNonTransferDiscriminatorBytes() {
return getU8Encoder().encode(
INITIALIZE_NON_TRANSFERABLE_MINT_NON_TRANSFER_DISCRIMINATOR
);
}

export type InitializeNonTransferableMintInstruction<
TProgram extends string = typeof TOKEN_2022_PROGRAM_ADDRESS,
TAccountMint extends string | IAccountMeta<string> = string,
Expand All @@ -57,31 +49,22 @@ export type InitializeNonTransferableMintInstruction<

export type InitializeNonTransferableMintInstructionData = {
discriminator: number;
nonTransferDiscriminator: number;
};

export type InitializeNonTransferableMintInstructionDataArgs = {};

export function getInitializeNonTransferableMintInstructionDataEncoder(): Encoder<InitializeNonTransferableMintInstructionDataArgs> {
return transformEncoder(
getStructEncoder([
['discriminator', getU8Encoder()],
['nonTransferDiscriminator', getU8Encoder()],
]),
getStructEncoder([['discriminator', getU8Encoder()]]),
(value) => ({
...value,
discriminator: INITIALIZE_NON_TRANSFERABLE_MINT_DISCRIMINATOR,
nonTransferDiscriminator:
INITIALIZE_NON_TRANSFERABLE_MINT_NON_TRANSFER_DISCRIMINATOR,
})
);
}

export function getInitializeNonTransferableMintInstructionDataDecoder(): Decoder<InitializeNonTransferableMintInstructionData> {
return getStructDecoder([
['discriminator', getU8Decoder()],
['nonTransferDiscriminator', getU8Decoder()],
]);
return getStructDecoder([['discriminator', getU8Decoder()]]);
}

export function getInitializeNonTransferableMintInstructionDataCodec(): Codec<
Expand Down
5 changes: 1 addition & 4 deletions clients/js/src/generated/programs/token2022.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,7 @@ export function identifyToken2022Instruction(
) {
return Token2022Instruction.DisableMemoTransfers;
}
if (
containsBytes(data, getU8Encoder().encode(32), 0) &&
containsBytes(data, getU8Encoder().encode(0), 1)
) {
if (containsBytes(data, getU8Encoder().encode(32), 0)) {
return Token2022Instruction.InitializeNonTransferableMint;
}
if (
Expand Down
20 changes: 0 additions & 20 deletions program/idl.json
Original file line number Diff line number Diff line change
Expand Up @@ -5379,33 +5379,13 @@
"kind": "numberValueNode",
"number": 32
}
},
{
"kind": "instructionArgumentNode",
"name": "nonTransferDiscriminator",
"defaultValueStrategy": "omitted",
"docs": [],
"type": {
"kind": "numberTypeNode",
"format": "u8",
"endian": "le"
},
"defaultValue": {
"kind": "numberValueNode",
"number": 0
}
}
],
"discriminators": [
{
"kind": "fieldDiscriminatorNode",
"name": "discriminator",
"offset": 0
},
{
"kind": "fieldDiscriminatorNode",
"name": "nonTransferDiscriminator",
"offset": 1
}
]
},
Expand Down

0 comments on commit ee3a066

Please sign in to comment.