flipmeme-sdk 1.2.33 → 1.2.35
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +58 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -319,4 +319,9 @@ declare const VALID_SIZE_PAIR: {
|
|
|
319
319
|
};
|
|
320
320
|
};
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
/**
|
|
323
|
+
* this function only works for solana mainnet. So don't need to get connection as parameter
|
|
324
|
+
*/
|
|
325
|
+
declare function placeTensorCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string): Promise<void>;
|
|
326
|
+
|
|
327
|
+
export { type AssetData, type AssetInfo, BlockchainType, type BuyCreditParams, type BuyParams, type BuyResponse, type CollectionInfo, type CollectionParams, type Compression, type CreateCollectionResponse, ENV, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NftInfo, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, SDK_SOLANA_CONFIG, SOLANA, SOLANA_PUBKEYS, type SellData, type SellParams, type SellResponse, type SolanaConfig, VALID_SIZE_PAIR, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
|
package/dist/index.d.ts
CHANGED
|
@@ -319,4 +319,9 @@ declare const VALID_SIZE_PAIR: {
|
|
|
319
319
|
};
|
|
320
320
|
};
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
/**
|
|
323
|
+
* this function only works for solana mainnet. So don't need to get connection as parameter
|
|
324
|
+
*/
|
|
325
|
+
declare function placeTensorCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string): Promise<void>;
|
|
326
|
+
|
|
327
|
+
export { type AssetData, type AssetInfo, BlockchainType, type BuyCreditParams, type BuyParams, type BuyResponse, type CollectionInfo, type CollectionParams, type Compression, type CreateCollectionResponse, ENV, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NftInfo, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, SDK_SOLANA_CONFIG, SOLANA, SOLANA_PUBKEYS, type SellData, type SellParams, type SellResponse, type SolanaConfig, VALID_SIZE_PAIR, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
|
package/dist/index.js
CHANGED
|
@@ -60,7 +60,8 @@ __export(index_exports, {
|
|
|
60
60
|
SOLANA_PUBKEYS: () => SOLANA_PUBKEYS,
|
|
61
61
|
VALID_SIZE_PAIR: () => VALID_SIZE_PAIR,
|
|
62
62
|
isEthereumConfig: () => isEthereumConfig,
|
|
63
|
-
isSolanaConfig: () => isSolanaConfig
|
|
63
|
+
isSolanaConfig: () => isSolanaConfig,
|
|
64
|
+
placeTensorCollectionBid: () => placeTensorCollectionBid
|
|
64
65
|
});
|
|
65
66
|
module.exports = __toCommonJS(index_exports);
|
|
66
67
|
|
|
@@ -1995,9 +1996,9 @@ var SOLANA_PUBKEYS = {
|
|
|
1995
1996
|
};
|
|
1996
1997
|
var SDK_SOLANA_CONFIG = {
|
|
1997
1998
|
MINT_CHUNK_SIZE: 3,
|
|
1998
|
-
BUY_CHUNK_SIZE:
|
|
1999
|
-
SELL_CHUNK_SIZE:
|
|
2000
|
-
EJECT_CHUNK_SIZE:
|
|
1999
|
+
BUY_CHUNK_SIZE: 5,
|
|
2000
|
+
SELL_CHUNK_SIZE: 5,
|
|
2001
|
+
EJECT_CHUNK_SIZE: 5
|
|
2001
2002
|
};
|
|
2002
2003
|
var VALID_SIZE_PAIR = {
|
|
2003
2004
|
3: { maxBufferSize: 8, maxDepth: 3 },
|
|
@@ -3146,6 +3147,57 @@ var FlipmemeSDK = class {
|
|
|
3146
3147
|
}
|
|
3147
3148
|
/**For testing end */
|
|
3148
3149
|
};
|
|
3150
|
+
|
|
3151
|
+
// src/solana/tensor.ts
|
|
3152
|
+
var import_web35 = require("@solana/web3.js");
|
|
3153
|
+
var import_axios = __toESM(require("axios"));
|
|
3154
|
+
var import_bytes = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
|
|
3155
|
+
var BASE_TENSOR_URI = "https://api.mainnet.tensordev.io/api/v1/";
|
|
3156
|
+
function getCollectionId(collectionMint) {
|
|
3157
|
+
return __async(this, null, function* () {
|
|
3158
|
+
const { data } = yield import_axios.default.get(
|
|
3159
|
+
`${BASE_TENSOR_URI}/collections/find_collection?filter=${collectionMint}`
|
|
3160
|
+
);
|
|
3161
|
+
console.log("====collection Mint====", collectionMint);
|
|
3162
|
+
console.log("====collection collId====", data.collId);
|
|
3163
|
+
return data.collId;
|
|
3164
|
+
});
|
|
3165
|
+
}
|
|
3166
|
+
function placeTensorCollectionBid(price, quantity, collectionMint, privateKey) {
|
|
3167
|
+
return __async(this, null, function* () {
|
|
3168
|
+
try {
|
|
3169
|
+
const keypair = import_web35.Keypair.fromSecretKey(import_bytes.bs58.decode(privateKey));
|
|
3170
|
+
const tensorCollId = yield getCollectionId(collectionMint);
|
|
3171
|
+
const rpc = RPC["Mainnet" /* Mainnet */];
|
|
3172
|
+
const connectionA = new import_web35.Connection(rpc);
|
|
3173
|
+
const blockhash = yield connectionA.getLatestBlockhash();
|
|
3174
|
+
const params = `owner=${keypair.publicKey.toString()}&price=${price}&collId=${tensorCollId}&quantity=${quantity}&blockhash=${blockhash.blockhash}`;
|
|
3175
|
+
console.log("params", params);
|
|
3176
|
+
const { data } = yield import_axios.default.get(
|
|
3177
|
+
"https://api.mainnet.tensordev.io/api/v1/tx/collection_bid?" + params,
|
|
3178
|
+
{
|
|
3179
|
+
headers: {
|
|
3180
|
+
Accept: "application/json",
|
|
3181
|
+
"x-tensor-api-key": "f990052f-72e5-4493-bb44-7ed3aea0d9fe"
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
);
|
|
3185
|
+
console.log("res", data);
|
|
3186
|
+
const buff = Buffer.from(data.txs[0].txV0);
|
|
3187
|
+
const tx = import_web35.VersionedTransaction.deserialize(buff);
|
|
3188
|
+
tx.sign([keypair]);
|
|
3189
|
+
let signature = yield connectionA.sendTransaction(tx, {
|
|
3190
|
+
skipPreflight: true,
|
|
3191
|
+
preflightCommitment: "confirmed"
|
|
3192
|
+
});
|
|
3193
|
+
console.log("signature", signature);
|
|
3194
|
+
} catch (e) {
|
|
3195
|
+
if (e instanceof import_axios.AxiosError) {
|
|
3196
|
+
console.log("api error", e.message);
|
|
3197
|
+
}
|
|
3198
|
+
}
|
|
3199
|
+
});
|
|
3200
|
+
}
|
|
3149
3201
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3150
3202
|
0 && (module.exports = {
|
|
3151
3203
|
BlockchainType,
|
|
@@ -3158,6 +3210,7 @@ var FlipmemeSDK = class {
|
|
|
3158
3210
|
SOLANA_PUBKEYS,
|
|
3159
3211
|
VALID_SIZE_PAIR,
|
|
3160
3212
|
isEthereumConfig,
|
|
3161
|
-
isSolanaConfig
|
|
3213
|
+
isSolanaConfig,
|
|
3214
|
+
placeTensorCollectionBid
|
|
3162
3215
|
});
|
|
3163
3216
|
//# sourceMappingURL=index.js.map
|