@eluvio/elv-client-js 4.0.73 → 4.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -279,6 +279,7 @@ exports.CreateAccessGroup = async function({name, description, metadata={}, visi
|
|
|
279
279
|
|
|
280
280
|
groupMetadata["tenantId"] = tenantId;
|
|
281
281
|
} else {
|
|
282
|
+
// eslint-disable-next-line no-console
|
|
282
283
|
console.warn("No tenant ID associated with current tenant.");
|
|
283
284
|
}
|
|
284
285
|
|
|
@@ -1319,6 +1319,58 @@ exports.ClaimStatus = async function({marketplaceParams, sku}) {
|
|
|
1319
1319
|
}
|
|
1320
1320
|
};
|
|
1321
1321
|
|
|
1322
|
+
/**
|
|
1323
|
+
* Return status of the specified gift claim
|
|
1324
|
+
*
|
|
1325
|
+
* @methodGroup Status
|
|
1326
|
+
* @namedParams
|
|
1327
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
1328
|
+
* @param {string=} confirmationId - The confirmation ID of the gift purchase
|
|
1329
|
+
* @param {string=} giftId - The ID of the claimed gift
|
|
1330
|
+
*
|
|
1331
|
+
* @returns {Promise<Object>} - The transfer status of the gift claim
|
|
1332
|
+
*/
|
|
1333
|
+
exports.GiftClaimStatus = async function({marketplaceParams, confirmationId, giftId}) {
|
|
1334
|
+
try {
|
|
1335
|
+
const marketplaceInfo = await this.MarketplaceInfo({marketplaceParams});
|
|
1336
|
+
const statuses = await this.MintingStatus({tenantId: marketplaceInfo.tenantId});
|
|
1337
|
+
|
|
1338
|
+
// Status is a list of transfer statuses, may be multiple if quantity > 1
|
|
1339
|
+
const responses = statuses.filter(status => status.op === "nft-transfer" && ((confirmationId && status.confirmationId === confirmationId) || (giftId && status.giftId === giftId))) || { status: "none" };
|
|
1340
|
+
|
|
1341
|
+
if(responses.length === 0) {
|
|
1342
|
+
return { status: "none" };
|
|
1343
|
+
} else {
|
|
1344
|
+
if(responses.find(response => response.status === "failed")) {
|
|
1345
|
+
return {
|
|
1346
|
+
status: "failed",
|
|
1347
|
+
op: "nft-transfer",
|
|
1348
|
+
transfer_statuses: responses
|
|
1349
|
+
};
|
|
1350
|
+
} else if(responses.find(response => response.status !== "complete")) {
|
|
1351
|
+
return {
|
|
1352
|
+
status: "pending",
|
|
1353
|
+
op: "nft-transfer",
|
|
1354
|
+
transfer_statuses: responses
|
|
1355
|
+
};
|
|
1356
|
+
} else {
|
|
1357
|
+
return {
|
|
1358
|
+
status: "complete",
|
|
1359
|
+
op: "nft-transfer",
|
|
1360
|
+
transfer_statuses: responses,
|
|
1361
|
+
items: responses.map(response => ({
|
|
1362
|
+
token_addr: response.address,
|
|
1363
|
+
token_id_str: response.tokenId
|
|
1364
|
+
}))
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
} catch(error) {
|
|
1369
|
+
this.Log(error, true);
|
|
1370
|
+
return { status: "unknown" };
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1322
1374
|
/**
|
|
1323
1375
|
* Return status of the specified pack opening
|
|
1324
1376
|
*
|
|
@@ -1385,7 +1437,7 @@ exports.RedeemableOfferStatus = async function({tenantId, marketplaceParams, con
|
|
|
1385
1437
|
status.op === "nft-offer-redeem" &&
|
|
1386
1438
|
Utils.EqualAddress(status.address, contractAddress) &&
|
|
1387
1439
|
status.tokenId === (tokenId || "").toString() &&
|
|
1388
|
-
status.
|
|
1440
|
+
status.offerId === (offerId || "").toString()
|
|
1389
1441
|
) || { status: "none" };
|
|
1390
1442
|
} catch(error) {
|
|
1391
1443
|
this.Log(error, true);
|
|
@@ -1296,7 +1296,7 @@ class ElvWalletClient {
|
|
|
1296
1296
|
let [op, address, id] = status.op.split(":");
|
|
1297
1297
|
address = address.startsWith("0x") ? Utils.FormatAddress(address) : address;
|
|
1298
1298
|
|
|
1299
|
-
let confirmationId, tokenId;
|
|
1299
|
+
let confirmationId, tokenId, offerId, giftId;
|
|
1300
1300
|
if(op === "nft-buy") {
|
|
1301
1301
|
confirmationId = id;
|
|
1302
1302
|
} else if(op === "nft-claim") {
|
|
@@ -1315,6 +1315,15 @@ class ElvWalletClient {
|
|
|
1315
1315
|
|
|
1316
1316
|
if(op === "nft-transfer") {
|
|
1317
1317
|
confirmationId = status.extra && status.extra.trans_id;
|
|
1318
|
+
tokenId = (status.extra && status.extra.token_id_str) || tokenId;
|
|
1319
|
+
|
|
1320
|
+
if(status.extra && status.extra.gift_action === "nft-gift-claim") {
|
|
1321
|
+
giftId = status.extra.gift_id;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
if(op === "nft-offer-redeem") {
|
|
1326
|
+
offerId = status.op.split(":")[3];
|
|
1318
1327
|
}
|
|
1319
1328
|
|
|
1320
1329
|
return {
|
|
@@ -1325,7 +1334,9 @@ class ElvWalletClient {
|
|
|
1325
1334
|
confirmationId,
|
|
1326
1335
|
op,
|
|
1327
1336
|
address: Utils.FormatAddress(address),
|
|
1328
|
-
tokenId
|
|
1337
|
+
tokenId,
|
|
1338
|
+
offerId,
|
|
1339
|
+
giftId
|
|
1329
1340
|
};
|
|
1330
1341
|
})
|
|
1331
1342
|
.sort((a, b) => a.ts < b.ts ? 1 : -1);
|