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

Mintbase / mintbase-js / 5268867622

pending completion
5268867622

push

github

sainthiago
:alien: update token attributes props

605 of 821 branches covered (73.69%)

Branch coverage included in aggregate %.

905 of 976 relevant lines covered (92.73%)

4.82 hits per line

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

63.64
/packages/sdk/src/delist/delist.ts
1
import { mbjs } from '../config/config';
1✔
2
import {  GAS, ONE_YOCTO } from '../constants';
1✔
3
import { ERROR_MESSAGES } from '../errorMessages';
1✔
4
import { TOKEN_METHOD_NAMES, MARKET_METHOD_NAMES, NearContractCall, ContractCall, DelistArgs, DelistArgsResponse, DelistMultipleArgsResponse } from '../types';
1✔
5

6

7
/**
8
 * Delist a token
9
 * @param args {@link DelistArgs}
10
 * @returns contract call to be passed to @mintbase-js/sdk execute method
11
 */
12

13
export const delist = (
1✔
14
  args: DelistArgs,
15
): NearContractCall<DelistArgsResponse> => {
16
  const { contractAddress = mbjs.keys.contractAddress, tokenIds, marketAddress = mbjs.keys.marketAddress, oldMarket = false } = args;
2!
17

18
  
19
  if (contractAddress == null) {
2!
20
    throw new Error(ERROR_MESSAGES.CONTRACT_ADDRESS);
×
21
  }
22

23
  if (!(tokenIds instanceof Array)) {
2!
24
    throw new Error(ERROR_MESSAGES.TOKEN_NOT_ARRAY);
×
25
  }
26

27
  if (!(tokenIds.length >0)) {
2!
28
    throw new Error(ERROR_MESSAGES.TOKEN_LENGTH);
×
29
  }
30

31
  const result: NearContractCall<DelistArgsResponse> = [];
2✔
32

33
  //revoke ownership for all tokens
34
  for (const tokenId of tokenIds) {
2✔
35
    result.push ({
2✔
36
      contractAddress: contractAddress || mbjs.keys.marketAddress,
2!
37
      args: {
38
        token_id: tokenId,
39
        account_id: marketAddress || mbjs.keys.marketAddress,
2!
40
      },
41
      methodName: TOKEN_METHOD_NAMES.TOKEN_ACCOUNT_REVOKE,
42
      gas: GAS,
43
      deposit: ONE_YOCTO,
44
    }as ContractCall<DelistArgsResponse>) ;
45
  }
46
  
47

48
  result.push( {
2✔
49
    contractAddress: marketAddress || mbjs.keys.marketAddress,
2!
50
    methodName: oldMarket? MARKET_METHOD_NAMES.UNLIST_OLD_MARKET: MARKET_METHOD_NAMES.UNLIST,
2!
51
    args: {
52
      token_ids: tokenIds,
53
      nft_contract_id: contractAddress || mbjs.keys.marketAddress,
2!
54
    },
55
    gas: GAS,
56
    deposit: ONE_YOCTO,
57
  } as ContractCall<DelistMultipleArgsResponse>);
58

59
  return result as NearContractCall<DelistMultipleArgsResponse>; 
2✔
60
};
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