Take list as seller - tx

Take the 𝔉rc20 token purchase listing as a seller

Example of Fixes Inscription data string:

op=list-take-sellnow,tick=fixes,amt=10000.0

Transaction parameters:

KeyRequiredFTypeDescription

tick

t.String

Ticker: identity of the 𝔉rc20 token

batchSellItems

t.Dictionary({ key: t.String, value: t.UFix64 })

The dictionary for selling:

rankedId => Amount You can get RankedListingId by querying the marketplace

📓Note: The key of batchSellItems should be itemInMarket.rankedId which can be obtained in the response of querying listings. and the value is how much tokens you will take in the order. 𝔉rc20 trading orders support partial deal.

Transaction code example:

import txUserTakeAsSeller from "@fixes/contracts/transactions/marketplace/user-take-as-seller-with-commission.cdc?raw";

async function userTakeAsSeller(
  tick: string,
  batchSellItems: Record<string, number>
) {
  let args: Array<{ key: string; value: string }> = [];
  for (const key in batchSellItems) {
    if (!Object.prototype.hasOwnProperty.call(batchSellItems, key)) continue;
    args.push({
      key,
      value: batchSellItems[key].toFixed(8),
    });
  }
  const txid = await flow.sendTransaction(txUserTakeAsSeller, (arg, t) => [
    arg(tick, t.String),
    arg(args, t.Dictionary({ key: t.String, value: t.UFix64 })),
  ]);
  return txid;
}

Transaction source code

Last updated