flipmeme-sdk 1.1.2 → 1.1.3
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/dist/index.js +30 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2317,43 +2317,52 @@ var SolanaConnector = class {
|
|
|
2317
2317
|
//useFlipProfile.ts
|
|
2318
2318
|
profileSell(data) {
|
|
2319
2319
|
return __async(this, null, function* () {
|
|
2320
|
+
var _a, _b, _c;
|
|
2320
2321
|
if (!this.program) {
|
|
2321
2322
|
throw new Error("Program not initialized");
|
|
2322
2323
|
}
|
|
2323
2324
|
let instructionsChunks = [];
|
|
2324
|
-
|
|
2325
|
-
|
|
2325
|
+
for (const collectionId in data.data) {
|
|
2326
|
+
const items = data.data[collectionId];
|
|
2326
2327
|
try {
|
|
2327
2328
|
console.log("items", items);
|
|
2328
|
-
|
|
2329
|
+
console.log("collectionId", collectionId);
|
|
2330
|
+
let instructionsChunksItem = yield this.getSellInstructions(
|
|
2329
2331
|
this.config.wallet,
|
|
2330
2332
|
collectionId,
|
|
2331
2333
|
items
|
|
2332
2334
|
);
|
|
2335
|
+
instructionsChunks.push(...instructionsChunksItem);
|
|
2333
2336
|
} catch (error) {
|
|
2334
2337
|
(_a = data.notify) == null ? void 0 : _a.onFailed(items, items.length);
|
|
2335
2338
|
console.error("Failed to getSellInstructions", { error });
|
|
2336
2339
|
throw error;
|
|
2337
2340
|
}
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
}
|
|
2341
|
+
}
|
|
2342
|
+
const successTxns = [];
|
|
2343
|
+
const failedItems = [];
|
|
2344
|
+
for (const [instructions, items] of instructionsChunks) {
|
|
2345
|
+
try {
|
|
2346
|
+
const { signature, latestBlockhash } = yield this.sendTxn(instructions);
|
|
2347
|
+
successTxns.push({ items, signature });
|
|
2348
|
+
(_b = data.notify) == null ? void 0 : _b.onSuccess(
|
|
2349
|
+
successTxns.map((txn) => txn.items).flat(),
|
|
2350
|
+
items.length,
|
|
2351
|
+
signature
|
|
2352
|
+
);
|
|
2353
|
+
const confirmResult = yield this.config.provider.connection.confirmTransaction({
|
|
2354
|
+
blockhash: latestBlockhash.blockhash,
|
|
2355
|
+
lastValidBlockHeight: latestBlockhash.lastValidBlockHeight,
|
|
2356
|
+
signature
|
|
2357
|
+
});
|
|
2358
|
+
console.log("confirmResult", confirmResult);
|
|
2359
|
+
} catch (e) {
|
|
2360
|
+
failedItems.push(...items);
|
|
2361
|
+
(_c = data.notify) == null ? void 0 : _c.onFailed(failedItems, items.length);
|
|
2362
|
+
console.error("Flip failed:", JSON.stringify(e), { items });
|
|
2363
|
+
throw e;
|
|
2355
2364
|
}
|
|
2356
|
-
}
|
|
2365
|
+
}
|
|
2357
2366
|
});
|
|
2358
2367
|
}
|
|
2359
2368
|
buyCredit(params) {
|