flipmeme-sdk 1.2.63 → 1.2.64

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
@@ -357,6 +357,8 @@ declare const VALID_SIZE_PAIR: {
357
357
  /**
358
358
  * this function only works for solana mainnet. So don't need to get connection as parameter
359
359
  */
360
- declare function placeTensorCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string): Promise<String>;
360
+ declare function placeTensorCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string, tensorApiKey: string): Promise<String>;
361
361
 
362
- export { type AssetData, type AssetInfo, BlockchainType, type BuyCreditParams, type BuyParams, type BuyResponse, COLLECTION_BID_PRICE, type CollectionInfo, type CollectionParams, type Compression, type CreateCollectionResponse, ENV, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NetworkAddress, type NftInfo, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, type SDKTransaction, SDK_SOLANA_CONFIG, SOLANA_COMMON, SOLANA_DEV, SOLANA_MAIN, SOLANA_PUBKEYS, SOLANA_PUBKEYS_DEV, type SellData, type SellParams, type SellResponse, type SolanaConfig, VALID_SIZE_PAIR, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
362
+ declare function decodeStr(str: string): string;
363
+
364
+ export { type AssetData, type AssetInfo, BlockchainType, type BuyCreditParams, type BuyParams, type BuyResponse, COLLECTION_BID_PRICE, type CollectionInfo, type CollectionParams, type Compression, type CreateCollectionResponse, ENV, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NetworkAddress, type NftInfo, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, type SDKTransaction, SDK_SOLANA_CONFIG, SOLANA_COMMON, SOLANA_DEV, SOLANA_MAIN, SOLANA_PUBKEYS, SOLANA_PUBKEYS_DEV, type SellData, type SellParams, type SellResponse, type SolanaConfig, VALID_SIZE_PAIR, decodeStr, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
package/dist/index.d.ts CHANGED
@@ -357,6 +357,8 @@ declare const VALID_SIZE_PAIR: {
357
357
  /**
358
358
  * this function only works for solana mainnet. So don't need to get connection as parameter
359
359
  */
360
- declare function placeTensorCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string): Promise<String>;
360
+ declare function placeTensorCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string, tensorApiKey: string): Promise<String>;
361
361
 
362
- export { type AssetData, type AssetInfo, BlockchainType, type BuyCreditParams, type BuyParams, type BuyResponse, COLLECTION_BID_PRICE, type CollectionInfo, type CollectionParams, type Compression, type CreateCollectionResponse, ENV, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NetworkAddress, type NftInfo, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, type SDKTransaction, SDK_SOLANA_CONFIG, SOLANA_COMMON, SOLANA_DEV, SOLANA_MAIN, SOLANA_PUBKEYS, SOLANA_PUBKEYS_DEV, type SellData, type SellParams, type SellResponse, type SolanaConfig, VALID_SIZE_PAIR, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
362
+ declare function decodeStr(str: string): string;
363
+
364
+ export { type AssetData, type AssetInfo, BlockchainType, type BuyCreditParams, type BuyParams, type BuyResponse, COLLECTION_BID_PRICE, type CollectionInfo, type CollectionParams, type Compression, type CreateCollectionResponse, ENV, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NetworkAddress, type NftInfo, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, type SDKTransaction, SDK_SOLANA_CONFIG, SOLANA_COMMON, SOLANA_DEV, SOLANA_MAIN, SOLANA_PUBKEYS, SOLANA_PUBKEYS_DEV, type SellData, type SellParams, type SellResponse, type SolanaConfig, VALID_SIZE_PAIR, decodeStr, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
package/dist/index.js CHANGED
@@ -77,6 +77,7 @@ __export(index_exports, {
77
77
  SOLANA_PUBKEYS: () => SOLANA_PUBKEYS,
78
78
  SOLANA_PUBKEYS_DEV: () => SOLANA_PUBKEYS_DEV,
79
79
  VALID_SIZE_PAIR: () => VALID_SIZE_PAIR,
80
+ decodeStr: () => decodeStr,
80
81
  isEthereumConfig: () => isEthereumConfig,
81
82
  isSolanaConfig: () => isSolanaConfig,
82
83
  placeTensorCollectionBid: () => placeTensorCollectionBid
@@ -3230,27 +3231,53 @@ var FlipmemeSDK = class {
3230
3231
  // src/solana/tensor.ts
3231
3232
  var import_web35 = require("@solana/web3.js");
3232
3233
  var import_axios = __toESM(require("axios"));
3234
+ var import_bytes3 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
3235
+
3236
+ // src/utility.ts
3233
3237
  var import_bytes2 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
3238
+ var crypto = __toESM(require("crypto"));
3239
+ function splitEncryptedText(encryptedText) {
3240
+ return {
3241
+ ivString: encryptedText.slice(0, 32),
3242
+ encryptedDataString: encryptedText.slice(32)
3243
+ };
3244
+ }
3245
+ function decodeStr(str) {
3246
+ const { encryptedDataString, ivString } = splitEncryptedText(str);
3247
+ const encoding = "hex";
3248
+ try {
3249
+ const iv = Buffer.from(ivString, encoding);
3250
+ const encryptedText = Buffer.from(encryptedDataString, encoding);
3251
+ const decipher = crypto.createDecipheriv("aes-256-cbc", import_bytes2.bs58.decode("Dr1vQSrALU4KbiP6eDsYQCvneb7tY3QmrUCj2GNFQNUC"), iv);
3252
+ const decrypted = decipher.update(encryptedText);
3253
+ return Buffer.concat([decrypted, decipher.final()]).toString();
3254
+ } catch (e) {
3255
+ console.error(e);
3256
+ throw new Error("wrong message");
3257
+ }
3258
+ }
3259
+
3260
+ // src/solana/tensor.ts
3234
3261
  var BASE_TENSOR_URI = "https://api.mainnet.tensordev.io/api/v1";
3235
- function getCollectionId(collectionMint) {
3262
+ function getCollectionId(collectionMint, tensorApiKey) {
3236
3263
  return __async(this, null, function* () {
3237
3264
  const { data } = yield import_axios.default.get(
3238
3265
  `${BASE_TENSOR_URI}/collections/find_collection?filter=${collectionMint}`,
3239
3266
  {
3240
3267
  headers: {
3241
3268
  Accept: "application/json",
3242
- "x-tensor-api-key": "f990052f-72e5-4493-bb44-7ed3aea0d9fe"
3269
+ "x-tensor-api-key": decodeStr(tensorApiKey)
3243
3270
  }
3244
3271
  }
3245
3272
  );
3246
3273
  return data.collId;
3247
3274
  });
3248
3275
  }
3249
- function placeTensorCollectionBid(price, quantity, collectionMint, privateKey) {
3276
+ function placeTensorCollectionBid(price, quantity, collectionMint, privateKey, tensorApiKey) {
3250
3277
  return __async(this, null, function* () {
3251
3278
  try {
3252
- const keypair = import_web35.Keypair.fromSecretKey(import_bytes2.bs58.decode(privateKey));
3253
- const tensorCollId = yield getCollectionId(collectionMint);
3279
+ const keypair = import_web35.Keypair.fromSecretKey(import_bytes3.bs58.decode(decodeStr(privateKey)));
3280
+ const tensorCollId = yield getCollectionId(collectionMint, tensorApiKey);
3254
3281
  const rpc = RPC["Mainnet" /* Mainnet */];
3255
3282
  const connectionA = new import_web35.Connection(rpc);
3256
3283
  const blockhash = yield connectionA.getLatestBlockhash();
@@ -3260,7 +3287,7 @@ function placeTensorCollectionBid(price, quantity, collectionMint, privateKey) {
3260
3287
  {
3261
3288
  headers: {
3262
3289
  Accept: "application/json",
3263
- "x-tensor-api-key": "f990052f-72e5-4493-bb44-7ed3aea0d9fe"
3290
+ "x-tensor-api-key": decodeStr(tensorApiKey)
3264
3291
  }
3265
3292
  }
3266
3293
  );
@@ -3294,6 +3321,7 @@ function placeTensorCollectionBid(price, quantity, collectionMint, privateKey) {
3294
3321
  SOLANA_PUBKEYS,
3295
3322
  SOLANA_PUBKEYS_DEV,
3296
3323
  VALID_SIZE_PAIR,
3324
+ decodeStr,
3297
3325
  isEthereumConfig,
3298
3326
  isSolanaConfig,
3299
3327
  placeTensorCollectionBid