• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Mintbase / mintbase-js / 13994325548

21 Mar 2025 02:43PM CUT coverage: 77.007%. First build
13994325548

Pull #555

github

rubenmarcus
deprecate packages
Pull Request #555: deprecate react and wallet packages

890 of 1336 branches covered (66.62%)

Branch coverage included in aggregate %.

1153 of 1317 relevant lines covered (87.55%)

15.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.27
/packages/sdk/src/updateMetadata/updateMetadata.ts
1
import { mbjs } from '../config/config';
3✔
2
import { GAS } from '../constants';
3✔
3
import { ERROR_MESSAGES } from '../errorMessages';
3✔
4
import { UpdateMetadataArgs, UpdateMetadataArgsResponse, NearContractCall, TOKEN_METHOD_NAMES } from '../types';
3✔
5
import { isIntString, isStoreV2 } from '../utils';
3✔
6

7
/**
8
 * Mint a token given via reference json on a given contract with a specified owner, amount of copies as well and royalties can be specified via options
9
 * @param mintArguments {@link MintArgs}
10
 * @returns contract call to be passed to @mintbase-js/sdk execute method
11
 */
12
export const updateMetadata = (
3✔
13
  args: UpdateMetadataArgs,
14
): NearContractCall<UpdateMetadataArgsResponse> => {
15
  const {
16
    contractAddress = mbjs.keys.contractAddress,
×
17
    metadataId,
18
    metadata,
19
    noReference = false,
6✔
20
    noMedia = false,
6✔
21
  } = args;
9✔
22

23
  if (!contractAddress) {
9!
24
    throw new Error(ERROR_MESSAGES.CONTRACT_ADDRESS);
×
25
  }
26
  
27
  if (!isStoreV2(contractAddress)) {
9!
28
    throw new Error(ERROR_MESSAGES.ONLY_V2);
×
29
  }
30

31
  if (!isIntString(metadataId)) {
9!
32
    throw new Error(ERROR_MESSAGES.METADATA_ID_NOT_INT);
×
33
  }
34

35
  // Reference and media need to be present or explicitly opted out of
36
  if (!noReference && !metadata.reference) {
9✔
37
    throw new Error(ERROR_MESSAGES.NO_REFERENCE);
3✔
38
  }
39
  if (!noMedia && !metadata.media) {
6✔
40
    throw new Error(ERROR_MESSAGES.NO_MEDIA);
3✔
41
  }
42

43

44
  return {
3✔
45
    contractAddress: contractAddress || mbjs.keys.contractAddress,
2!
46
    args: {
47
      metadata_id: metadataId,
48
      metadata,
49
    },
50
    methodName: TOKEN_METHOD_NAMES.UPDATE_METADATA,
51
    gas: GAS,
52
    deposit: '1', // FIXME: should cover storage, not only 1 yocto.
53
  };
54
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc