description |
---|
Take the 𝔉rc20 token purchase listing as a seller |
op=list-take-sellnow,tick=fixes,amt=10000.0
Key | Required | FType | Description |
---|---|---|---|
tick | true | t.String | Ticker: identity of the 𝔉rc20 token |
batchSellItems | true | t.Dictionary({ key: t.String, value: t.UFix64 }) | The dictionary for selling:
|
📓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.
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;
}
{% @github-files/github-code-block url="https://github.com/fixes-world/fixes/blob/main/cadence/transactions/marketplace/user-take-as-seller-with-commission.cdc" %}