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

Mintbase / mintbase-js / 4222151799

pending completion
4222151799

push

github

cif
fix(sdk): :white_check_mark: Fix import in config test

556 of 762 branches covered (72.97%)

Branch coverage included in aggregate %.

818 of 882 relevant lines covered (92.74%)

4.57 hits per line

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

68.42
/packages/sdk/src/buy/buy.ts
1
/* eslint-disable @typescript-eslint/camelcase */
2
import { mbjs } from '../config/config';
1✔
3
import { GAS  } from '../constants';
1✔
4
import { ERROR_MESSAGES } from '../errorMessages';
1✔
5
import { BuyArgs, BuyArgsResponse, MARKET_METHOD_NAMES, NearContractCall } from '../types';
1✔
6

7
//todo make a buy at listed price method
8

9
/**
10
 * Buys a listed token for a specified price as long as its above the price for which is was listed
11
 * @param buyArguments {@link BuyArgs}
12
 * @returns contract call to be passed to @mintbase-js/sdk execute method
13
 */
14
export const buy = (args: BuyArgs): NearContractCall<BuyArgsResponse>=> {
1✔
15
  const { contractAddress = mbjs.keys.contractAddress, tokenId, referrerId = null, marketId = mbjs.keys.marketAddress, price, affiliateAccount } = args;
1!
16

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

21
  return {
1✔
22
    contractAddress: marketId || mbjs.keys.marketAddress,
1!
23
    args: {
24
      nft_contract_id: contractAddress || mbjs.keys.contractAddress,
1!
25
      token_id: tokenId,
26
      referrer_id: affiliateAccount || referrerId,
1!
27
    },
28
    methodName: MARKET_METHOD_NAMES.BUY,
29
    gas: GAS,
30
    deposit: price,
31
  };
32
};
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