flipmeme-sdk 1.2.6 → 1.2.8

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.d.mts CHANGED
@@ -139,6 +139,7 @@ declare class FlipmemeSDK {
139
139
  buyCredit(params: BuyCreditParams): Promise<string>;
140
140
  getTotalPrice(type: PurcahseType, collectionId: string, amount: number): Promise<string>;
141
141
  createMerkle(collectionId: string, depthSize: number): Promise<PublicKey>;
142
+ finalizeSale(collectionId: string): Promise<PublicKey>;
142
143
  /**For testing */
143
144
  getStateInfo(): Promise<{
144
145
  admin: PublicKey;
package/dist/index.d.ts CHANGED
@@ -139,6 +139,7 @@ declare class FlipmemeSDK {
139
139
  buyCredit(params: BuyCreditParams): Promise<string>;
140
140
  getTotalPrice(type: PurcahseType, collectionId: string, amount: number): Promise<string>;
141
141
  createMerkle(collectionId: string, depthSize: number): Promise<PublicKey>;
142
+ finalizeSale(collectionId: string): Promise<PublicKey>;
142
143
  /**For testing */
143
144
  getStateInfo(): Promise<{
144
145
  admin: PublicKey;
package/dist/index.js CHANGED
@@ -2083,6 +2083,10 @@ var flipmeme_default = {
2083
2083
  name: "name",
2084
2084
  type: "string"
2085
2085
  },
2086
+ {
2087
+ name: "uri",
2088
+ type: "string"
2089
+ },
2086
2090
  {
2087
2091
  name: "mint_count",
2088
2092
  type: "u32"
@@ -2418,7 +2422,7 @@ var import_anchor = require("@coral-xyz/anchor");
2418
2422
  var import_decimal = require("decimal.js");
2419
2423
  function analyzeBuyTransaction(program, transactionData) {
2420
2424
  var _a;
2421
- console.log("transactionData===", transactionData);
2425
+ console.log("buy transaction");
2422
2426
  let instructions = (_a = transactionData.meta) == null ? void 0 : _a.innerInstructions;
2423
2427
  let blockNumber = transactionData.slot;
2424
2428
  let blockTime = transactionData.blockTime;
@@ -2432,6 +2436,7 @@ function analyzeBuyTransaction(program, transactionData) {
2432
2436
  const base64Data = import_anchor.utils.bytes.base64.encode(rawData.subarray(8));
2433
2437
  let decodedData = program.coder.events.decode(base64Data);
2434
2438
  if ((decodedData == null ? void 0 : decodedData.name) === "mintEvent") {
2439
+ console.log("=======", decodedData);
2435
2440
  buyResponse.push({
2436
2441
  buyer: decodedData.data.buyer.toString(),
2437
2442
  collectionAddress: decodedData.data.collection.toString(),
@@ -2527,10 +2532,10 @@ var import_bn = require("bn.js");
2527
2532
  var import_lodash = __toESM(require("lodash"));
2528
2533
  var getAssetsInfo = (assetIds, merkleTree) => __async(void 0, null, function* () {
2529
2534
  let assetPubKeys = [];
2530
- for (let assetId in assetIds) {
2535
+ for (let index in assetIds) {
2531
2536
  let itemKey = yield (0, import_mpl_bubblegum.getLeafAssetId)(
2532
2537
  new import_web34.PublicKey(merkleTree),
2533
- new import_bn.BN(assetId)
2538
+ new import_bn.BN(assetIds[index])
2534
2539
  );
2535
2540
  assetPubKeys.push(itemKey.toBase58());
2536
2541
  }
@@ -2970,6 +2975,7 @@ var SolanaConnector = class {
2970
2975
  });
2971
2976
  return merkleTreeKeyPair.publicKey;
2972
2977
  } catch (e) {
2978
+ console.log("=====================", e);
2973
2979
  throw new Error("Cannot call this function");
2974
2980
  }
2975
2981
  });
@@ -3406,7 +3412,21 @@ var FlipmemeSDK = class {
3406
3412
  }
3407
3413
  });
3408
3414
  }
3409
- createMerkle(collectionId, depthSize) {
3415
+ createMerkle(collectionId, depthSize2) {
3416
+ return __async(this, null, function* () {
3417
+ const { maxBufferSize, maxDepth } = VALID_SIZE_PAIR[depthSize2];
3418
+ if (this.blockchainType === "solana" /* SOLANA */ && this.solana) {
3419
+ return yield this.solana.createMerkle(
3420
+ collectionId,
3421
+ maxBufferSize,
3422
+ maxDepth
3423
+ );
3424
+ } else {
3425
+ throw new Error("Cannot call this function");
3426
+ }
3427
+ });
3428
+ }
3429
+ finalizeSale(collectionId) {
3410
3430
  return __async(this, null, function* () {
3411
3431
  const { maxBufferSize, maxDepth } = VALID_SIZE_PAIR[depthSize];
3412
3432
  if (this.blockchainType === "solana" /* SOLANA */ && this.solana) {