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

Mintbase / mintbase-js / 3824313916

pending completion
3824313916

push

github

Ruben Marcus
remove useMinter ref

273 of 348 branches covered (78.45%)

Branch coverage included in aggregate %.

458 of 506 relevant lines covered (90.51%)

3.13 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 { DEFAULT_CONTRACT_ADDRESS, GAS, MB_MARKET_ADDRESS, ONE_YOCTO, TOKEN_METHOD_NAMES, MARKET_METHOD_NAMES } from '../constants';
1✔
2
import { ContractCall, NearContractCall } from '../execute';
3

4
type DelistArgs = {
5
    nftContractId: string;
6
    tokenIds: string[];
7
    marketId?: string;
8
    oldMarket?: boolean;
9
}
10

11
export const delist = (
1✔
12
  args: DelistArgs,
13
): NearContractCall => {
14
  const { nftContractId = DEFAULT_CONTRACT_ADDRESS, tokenIds, marketId = MB_MARKET_ADDRESS, oldMarket = false } = args;
2!
15

16
  
17
  if (nftContractId == null) {
2!
18
    throw new Error('You must provide a nftContractId or define a NFT_CONTRACT_ID enviroment variable to default to');
×
19
  }
20

21
  if (!(tokenIds instanceof Array)) {
2!
22
    throw new Error('tokenIds must be an array');
×
23
  }
24

25
  if (!(tokenIds.length >0)) {
2!
26
    throw new Error('tokenIds must have more than one element');
×
27
  }
28

29
  const result: NearContractCall = [];
2✔
30

31
  //revoke ownership for all tokens
32
  for (const tokenId of tokenIds) {
2✔
33
    result.push ({
2✔
34
      contractAddress: nftContractId,
35
      args: {
36
        token_id: tokenId,
37
        account_id: marketId,
38
      },
39
      methodName: TOKEN_METHOD_NAMES.TOKEN_ACCOUNT_REVOKE,
40
      gas: GAS,
41
      deposit: ONE_YOCTO,
42
    }as ContractCall) ;
43
  }
44
  
45

46
  result.push( {
2✔
47
    contractAddress: marketId,
48
    methodName: oldMarket? MARKET_METHOD_NAMES.UNLIST_OLD_MARKET: MARKET_METHOD_NAMES.UNLIST ,
2!
49
    args: {
50
      token_ids: tokenIds,
51
      nft_contract_id: nftContractId,
52
    },
53
    gas: GAS,
54
    deposit: ONE_YOCTO,
55
  } as ContractCall);
56

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