Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyLi28 committed Nov 21, 2024
1 parent 609e72e commit 7112056
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 38 deletions.
4 changes: 0 additions & 4 deletions programs/mmm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ pub enum MMMErrorCode {
InvalidTokenExtension, // 0x1791
#[msg("Unsupported asset plugin")]
UnsupportedAssetPlugin, // 0x1792
#[msg("Mismatched creator data lengths")]
MismatchedCreatorDataLengths, // 0x1793
#[msg("Invalid cnft creators")]
InvalidCnftCreators, // 0x1794
#[msg("Invalid cnft metadata")]
InvalidCnftMetadata, // 0x1795
#[msg("Invalid cnft metadata args")]
Expand Down
2 changes: 1 addition & 1 deletion programs/mmm/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ pub fn hash_creators_from_metadata_args(
if creator_accounts.len() != creator_shares.len()
|| creator_accounts.len() != creator_verified.len()
{
return Err(MMMErrorCode::MismatchedCreatorDataLengths.into());
return Err(MMMErrorCode::InvalidCreatorAddress.into());
}

// Convert input data to a vector of Creator structs
Expand Down
24 changes: 2 additions & 22 deletions sdk/src/idl/mmm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3249,21 +3249,11 @@ export type Mmm = {
},
{
"code": 6035,
"name": "MismatchedCreatorDataLengths",
"msg": "Mismatched creator data lengths"
},
{
"code": 6036,
"name": "InvalidCnftCreators",
"msg": "Invalid cnft creators"
},
{
"code": 6037,
"name": "InvalidCnftMetadata",
"msg": "Invalid cnft metadata"
},
{
"code": 6038,
"code": 6036,
"name": "InvalidCnftMetadataArgs",
"msg": "Invalid cnft metadata args"
}
Expand Down Expand Up @@ -6521,21 +6511,11 @@ export const IDL: Mmm = {
},
{
"code": 6035,
"name": "MismatchedCreatorDataLengths",
"msg": "Mismatched creator data lengths"
},
{
"code": 6036,
"name": "InvalidCnftCreators",
"msg": "Invalid cnft creators"
},
{
"code": 6037,
"name": "InvalidCnftMetadata",
"msg": "Invalid cnft metadata"
},
{
"code": 6038,
"code": 6036,
"name": "InvalidCnftMetadataArgs",
"msg": "Invalid cnft metadata args"
}
Expand Down
6 changes: 0 additions & 6 deletions tests/mmm-cnft.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,6 @@ describe('cnft tests', () => {
buyerSolEscrowAccountBalanceAfter + spotPrice * LAMPORTS_PER_SOL,
);

// In production it should be seller buy tx fee, but with this test set up, buyer pays
// tx fee due to provider is initiated under buyer.
assert.equal(
sellerAfter,
sellerBefore +
Expand Down Expand Up @@ -573,8 +571,6 @@ describe('cnft tests', () => {
buyerSolEscrowAccountBalanceAfter,
);

// In production it should be seller buy tx fee, but with this test set up, buyer pays
// tx fee due to provider is initiated under buyer.
assert.equal(sellerAfter, sellerBefore);

assert.equal(creator1After, creator1Before);
Expand Down Expand Up @@ -789,8 +785,6 @@ describe('cnft tests', () => {
buyerSolEscrowAccountBalanceAfter,
);

// In production it should be seller buy tx fee, but with this test set up, buyer pays
// tx fee due to provider is initiated under buyer.
assert.equal(sellerAfter, sellerBefore);

assert.equal(creator1After, creator1Before);
Expand Down
5 changes: 0 additions & 5 deletions tests/utils/cnft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ export const ME_TREASURY = new Web3PubKey(
'rFqFJ9g7TGBD8Ed7TPDnvGKZ5pWLPDyxLcvcH2eRCtt',
);

export const treasury = publicKey(ME_TREASURY.toBase58());

export const createUmi = async (endpoint?: string, airdropAmount?: SolAmount) =>
(await baseCreateUmi(endpoint, { commitment: 'confirmed' }, airdropAmount))
.use(mplTokenMetadata())
Expand Down Expand Up @@ -176,9 +174,6 @@ export const mint = async (
};
};

// This is Hash(metadataArgs). Useful for verifying sellers fee basis points are valid.
// NOTE: this does not perform any checks on the hash, it is recommended to use getMetadataHashChecked
// in production!!
export function hashMetadataArgsArgs(metadata: MetadataArgsArgs): Uint8Array {
return hash(getMetadataArgsSerializer().serialize(metadata));
}
Expand Down

0 comments on commit 7112056

Please sign in to comment.