flipmeme-sdk 1.3.84 → 1.3.86

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.mjs CHANGED
@@ -1,4 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
4
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -14,6 +16,7 @@ var __spreadValues = (a, b) => {
14
16
  }
15
17
  return a;
16
18
  };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
17
20
  var __export = (target, all) => {
18
21
  for (var name in all)
19
22
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -34684,6 +34687,10 @@ var EthereumConnector = class {
34684
34687
  return __async(this, null, function* () {
34685
34688
  var _a;
34686
34689
  let endPrice = collection.endPrice;
34690
+ let [isAvailable, errorMsg] = this.isPriceAvailable(endPrice);
34691
+ if (!isAvailable) {
34692
+ throw new Error(`Price ${endPrice} Error: ${errorMsg}`);
34693
+ }
34687
34694
  const startPrice = new Decimal2(endPrice).div(17).toFixed(0);
34688
34695
  console.log(`Creating collection with startPrice: ${startPrice} and endPrice: ${endPrice}`);
34689
34696
  let tx = yield this.factory.createCollection(
@@ -40851,6 +40858,35 @@ function placeSpaaceCollectionBid(price, collection, tokenIdStart, tokenIdEnd, w
40851
40858
  }
40852
40859
  });
40853
40860
  }
40861
+
40862
+ // src/evm/opensea.ts
40863
+ import { JsonRpcProvider, Wallet } from "opensea-js/node_modules/ethers";
40864
+ import { OpenSeaSDK } from "opensea-js";
40865
+ function placeOpenSeaCollectionBid(nework, privKey, rpcUrl, apiKey, params) {
40866
+ return __async(this, null, function* () {
40867
+ const privateKey = decodeStr(privKey);
40868
+ const provider = new JsonRpcProvider(rpcUrl);
40869
+ const signer = new Wallet(privateKey, provider);
40870
+ const sdk = new OpenSeaSDK(signer, {
40871
+ chain: nework,
40872
+ apiKey
40873
+ });
40874
+ const contractInfo = yield sdk.api.getContract(params.collectionAddress, nework);
40875
+ if (contractInfo.collection == null) {
40876
+ throw new Error("Failed to fetch collection info(slug name) from OpenSea");
40877
+ }
40878
+ console.log("contractInfo", contractInfo);
40879
+ const expirationTime = Math.floor(Date.now() / 1e3) + params.expirationHours * 3600;
40880
+ const offer = yield sdk.createCollectionOffer(__spreadProps(__spreadValues({}, params), {
40881
+ collectionSlug: contractInfo.collection,
40882
+ accountAddress: yield signer.getAddress(),
40883
+ expirationTime
40884
+ }));
40885
+ if (!offer) {
40886
+ throw new Error("Failed to create collection offer");
40887
+ }
40888
+ });
40889
+ }
40854
40890
  export {
40855
40891
  APE_DEV,
40856
40892
  BASE_DEV,
@@ -40887,6 +40923,7 @@ export {
40887
40923
  isEthereumConfig,
40888
40924
  isSolanaConfig,
40889
40925
  placeMagicEdenCollectionBid,
40926
+ placeOpenSeaCollectionBid,
40890
40927
  placeSpaaceCollectionBid,
40891
40928
  placeTensorCollectionBid
40892
40929
  };