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

Mintbase / mintbase-js / 4015446410

pending completion
4015446410

push

github

Sérgio
📝 Fixed main docs

483 of 648 branches covered (74.54%)

Branch coverage included in aggregate %.

721 of 780 relevant lines covered (92.44%)

4.23 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 { ContractCall, NearContractCall } from '../execute';
5
import { TOKEN_METHOD_NAMES, MARKET_METHOD_NAMES } from '../types';
1✔
6

7
type DelistArgs = {
8
  contractAddress: string;
9
    tokenIds: string[];
10
    marketAddress?: string;
11
    oldMarket?: boolean;
12
}
13

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

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

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

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

32
  const result: NearContractCall = [];
2✔
33

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

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

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