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

Mintbase / mintbase-js / 9775811200

03 Jul 2024 10:01AM CUT coverage: 77.176% (+1.9%) from 75.281%
9775811200

Pull #515

github

bh2smith
Merge branch 'beta' into near-api-js
Pull Request #515: Update near-api-js to v3

880 of 1319 branches covered (66.72%)

Branch coverage included in aggregate %.

1159 of 1323 relevant lines covered (87.6%)

14.42 hits per line

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

60.0
/packages/sdk/src/lockMetadata/lockMetadata.ts
1
import { mbjs } from '../config/config';
3✔
2
import { GAS } from '../constants';
3✔
3
import { ERROR_MESSAGES } from '../errorMessages';
3✔
4
import { LockMetadataArgs, LockMetadataArgsResponse, 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 lockMetadata = (
3✔
13
  args: LockMetadataArgs,
14
): NearContractCall<LockMetadataArgsResponse> => {
15
  const {
16
    contractAddress = mbjs.keys.contractAddress,
×
17
    metadataId,
18
  } = args;
3✔
19

20
  if (!contractAddress) {
3!
21
    throw new Error(ERROR_MESSAGES.CONTRACT_ADDRESS);
×
22
  }
23

24
  if (!isStoreV2(contractAddress)) {
3!
25
    throw new Error(ERROR_MESSAGES.ONLY_V2);
×
26
  }
27

28
  if (!isIntString(metadataId)) {
3!
29
    throw new Error(ERROR_MESSAGES.METADATA_ID_NOT_INT);
×
30
  }
31

32
  return {
3✔
33
    contractAddress: contractAddress || mbjs.keys.contractAddress,
2!
34
    args: {
35
      metadata_id: metadataId,
36
    },
37
    methodName: TOKEN_METHOD_NAMES.LOCK_METADATA,
38
    gas: GAS,
39
    deposit: '1',
40
  };
41
};
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