cargo.api LAB

The lab contains experimental methods that are not part of the official API.

Emoji Legend

🌎 - Open method, authentication not required

🦊 - Method requiring MetaMask, or similar Web3 browser or extension. These methods use Web3 API's.

🔒 - Authenticated method, authentication required. A pre-requisite to authentication is getting an access token and to get an access token requires MetaMask or something like it. So by default all authenticated methods are also 🦊.

🍕 - Optional authenticated method. Authentication is optional and may affect response.

LAB_createConsecutiveSale 🔒

This method can be used to create a sale for a consecutive group of tokens. This can be used to sell thousands of collectibles that act as tickets, game items, or access keys. To create a consecutive sale you must meet these pre-requisites

  1. The collection must have been created by you on Cargo. Only Cargo ERC-721 contracts will support consecutive sales.

  2. The collection must be placed in a showcase.

  3. After creating the sale it is imperative that collections within the consecutive sale are not transferred by any other means than the consecutive purchase method. If you need to transfer tokens from the consecutive sale batch you can use the safeConsecutiveTransfer method in the Cargo selling contract.

If you haven't done so already - you will be asked to complete a transaction on the blockchain to allow Cargo to sell the specified collectibles on your behalf.

cargo.api.LAB_createConsecutiveSale(params, unApprovedFn).then(res => {})
Arguments
Response
Arguments

Argument

Description

params

An object containing the following keys and values:

  • crateId - string - The showcase (crate) ID that the collection is in

  • contractAddress - string - The collection (contract) address that contains the collectibles to be sold.

  • pricePerItem - string -The price, in Wei, that each item will be sold at.

  • fromTokenId - string - The starting token of the batch to be put up for sale.

  • toTokenId - string - The ending token of the batch to be put up for sale.

unApprovedFn

This is an optional function that will be called if the sale requires an approval from the collection smart contract. This is could be used to display a blocking modal which can then be removed once the method resolves completely.

Response
type SuccessResponse = {
err: false;
status: 200;
data: {
// Unique ID of sale
_id: string;
// Address of seller
seller: string;
// Address of collection
contract: string;
// Price in Wei per item
pricePerItem: string;
// Ending collectible ID in batch
toTokenId: string;
// Number of items available
balance: string;
// Showcase (crate) ID
crate: string;
}
}

LAB_consecutivePurchase 🌎

After creating a consecutive sale, your patrons can purchase a specified quantity by using this method.

cargo.api.LAB_consecutivePurchase(params).then(res)
Arguments
Second Tab
Arguments

Argument

Description

params

An object containing the following keys and values:

  • amount - string - The amount of collectibles to purchase

  • saleId - string - The ID for the given sale

  • sender - string - The address submitting the transaction

Second Tab