Skip to content

Commit

Permalink
fix listing buying
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Sramko committed Aug 17, 2021
1 parent 7bb3ddf commit 8301ef0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tatumio/tatum",
"version": "1.21.2",
"version": "1.21.3",
"description": "Tatum API client allows browsers and Node.js clients to interact with Tatum API.",
"main": "dist/src/index.js",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
12 changes: 7 additions & 5 deletions src/nft/marketplace/listing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,17 +317,19 @@ export const prepareMarketplaceCreateListing = async (testnet: boolean, body: Cr
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export const prepareMarketplaceBuyListing = async (testnet: boolean, body: InvokeMarketplaceListingOperation | InvokeTronMarketplaceListingOperation, provider?: string) => {
await validateBody(body, body.chain === Currency.TRON ? InvokeTronMarketplaceListingOperation : InvokeMarketplaceListingOperation)
const params = [body.listingId, body.erc20Address || '0x0000000000000000000000000000000000000000']
body.amount = undefined;
await validateBody(body, body.chain === Currency.TRON ? InvokeTronMarketplaceListingOperation : InvokeMarketplaceListingOperation);
const params = [body.listingId, body.erc20Address || '0x0000000000000000000000000000000000000000'];
if (body.erc20Address) {
body.amount = undefined;
}
if (body.chain === Currency.TRON) {
return await prepareSCCall(testnet, body, InvokeTronMarketplaceListingOperation, 'buyAssetFromListing',
[
{type: 'string', value: params[0]},
{type: 'address', value: convertAddressToHex(params[1])},
], 'buyAssetFromListing(string,address)', provider)
], 'buyAssetFromListing(string,address)', provider);
} else {
return await prepareSCCall(testnet, body, InvokeMarketplaceListingOperation, 'buyAssetFromListing', params, undefined, provider)
return await prepareSCCall(testnet, body, InvokeMarketplaceListingOperation, 'buyAssetFromListing', params, undefined, provider);
}
}

Expand Down

0 comments on commit 8301ef0

Please sign in to comment.