flipmeme-sdk 1.2.4 → 1.2.6
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 +2 -11
- package/dist/index.d.ts +2 -11
- package/dist/index.js +6 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -93
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -138,7 +138,7 @@ declare class FlipmemeSDK {
|
|
|
138
138
|
profileSell(data: ProfileSellParams): Promise<SellResponse[]>;
|
|
139
139
|
buyCredit(params: BuyCreditParams): Promise<string>;
|
|
140
140
|
getTotalPrice(type: PurcahseType, collectionId: string, amount: number): Promise<string>;
|
|
141
|
-
createMerkle(collectionId: string,
|
|
141
|
+
createMerkle(collectionId: string, depthSize: number): Promise<PublicKey>;
|
|
142
142
|
/**For testing */
|
|
143
143
|
getStateInfo(): Promise<{
|
|
144
144
|
admin: PublicKey;
|
|
@@ -306,13 +306,4 @@ declare const VALID_SIZE_PAIR: {
|
|
|
306
306
|
};
|
|
307
307
|
};
|
|
308
308
|
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* this function is used to create merkle tree on backend side for bubblegum cNFT for metaplex
|
|
312
|
-
* backend pays the merkle tree create fee
|
|
313
|
-
* this function works on mpl_bubblegum version 4.3.1 but I downgrade the mpl_bubblegum for getLeafAsset function
|
|
314
|
-
*/
|
|
315
|
-
static createMerkleTreeFromContract(env: ENV, privateKey: string, collectionSize: number, collectionId: string): Promise<PublicKey>;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
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 NFTTradingData, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, SDK_SOLANA_CONFIG, SOLANA, SOLANA_PUBKEYS, type SellParams, type SellResponse, type SolanaConfig, Utility, VALID_SIZE_PAIR, isEthereumConfig, isSolanaConfig };
|
|
309
|
+
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 NFTTradingData, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, SDK_SOLANA_CONFIG, SOLANA, SOLANA_PUBKEYS, type SellParams, type SellResponse, type SolanaConfig, VALID_SIZE_PAIR, isEthereumConfig, isSolanaConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -138,7 +138,7 @@ declare class FlipmemeSDK {
|
|
|
138
138
|
profileSell(data: ProfileSellParams): Promise<SellResponse[]>;
|
|
139
139
|
buyCredit(params: BuyCreditParams): Promise<string>;
|
|
140
140
|
getTotalPrice(type: PurcahseType, collectionId: string, amount: number): Promise<string>;
|
|
141
|
-
createMerkle(collectionId: string,
|
|
141
|
+
createMerkle(collectionId: string, depthSize: number): Promise<PublicKey>;
|
|
142
142
|
/**For testing */
|
|
143
143
|
getStateInfo(): Promise<{
|
|
144
144
|
admin: PublicKey;
|
|
@@ -306,13 +306,4 @@ declare const VALID_SIZE_PAIR: {
|
|
|
306
306
|
};
|
|
307
307
|
};
|
|
308
308
|
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* this function is used to create merkle tree on backend side for bubblegum cNFT for metaplex
|
|
312
|
-
* backend pays the merkle tree create fee
|
|
313
|
-
* this function works on mpl_bubblegum version 4.3.1 but I downgrade the mpl_bubblegum for getLeafAsset function
|
|
314
|
-
*/
|
|
315
|
-
static createMerkleTreeFromContract(env: ENV, privateKey: string, collectionSize: number, collectionId: string): Promise<PublicKey>;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
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 NFTTradingData, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, SDK_SOLANA_CONFIG, SOLANA, SOLANA_PUBKEYS, type SellParams, type SellResponse, type SolanaConfig, Utility, VALID_SIZE_PAIR, isEthereumConfig, isSolanaConfig };
|
|
309
|
+
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 NFTTradingData, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, SDK_SOLANA_CONFIG, SOLANA, SOLANA_PUBKEYS, type SellParams, type SellResponse, type SolanaConfig, VALID_SIZE_PAIR, isEthereumConfig, isSolanaConfig };
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,6 @@ __export(index_exports, {
|
|
|
58
58
|
SDK_SOLANA_CONFIG: () => SDK_SOLANA_CONFIG,
|
|
59
59
|
SOLANA: () => SOLANA,
|
|
60
60
|
SOLANA_PUBKEYS: () => SOLANA_PUBKEYS,
|
|
61
|
-
Utility: () => Utility,
|
|
62
61
|
VALID_SIZE_PAIR: () => VALID_SIZE_PAIR,
|
|
63
62
|
isEthereumConfig: () => isEthereumConfig,
|
|
64
63
|
isSolanaConfig: () => isSolanaConfig
|
|
@@ -2244,10 +2243,10 @@ var SOLANA = {
|
|
|
2244
2243
|
SPL_ATA_TOKEN_STR: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2245
2244
|
RENT_TOKEN_STR: "SysvarRent111111111111111111111111111111111"
|
|
2246
2245
|
};
|
|
2247
|
-
var ENV = /* @__PURE__ */ ((
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
return
|
|
2246
|
+
var ENV = /* @__PURE__ */ ((ENV2) => {
|
|
2247
|
+
ENV2["Devnet"] = "Devnet";
|
|
2248
|
+
ENV2["Mainnet"] = "Mainnet";
|
|
2249
|
+
return ENV2;
|
|
2251
2250
|
})(ENV || {});
|
|
2252
2251
|
var RPC = {
|
|
2253
2252
|
Devnet: "https://api.devnet.solana.com",
|
|
@@ -3407,8 +3406,9 @@ var FlipmemeSDK = class {
|
|
|
3407
3406
|
}
|
|
3408
3407
|
});
|
|
3409
3408
|
}
|
|
3410
|
-
createMerkle(collectionId,
|
|
3409
|
+
createMerkle(collectionId, depthSize) {
|
|
3411
3410
|
return __async(this, null, function* () {
|
|
3411
|
+
const { maxBufferSize, maxDepth } = VALID_SIZE_PAIR[depthSize];
|
|
3412
3412
|
if (this.blockchainType === "solana" /* SOLANA */ && this.solana) {
|
|
3413
3413
|
return yield this.solana.createMerkle(
|
|
3414
3414
|
collectionId,
|
|
@@ -3459,88 +3459,6 @@ var FlipmemeSDK = class {
|
|
|
3459
3459
|
}
|
|
3460
3460
|
/**For testing end */
|
|
3461
3461
|
};
|
|
3462
|
-
|
|
3463
|
-
// src/utility.ts
|
|
3464
|
-
var import_bytes = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
|
|
3465
|
-
var import_web36 = require("@solana/web3.js");
|
|
3466
|
-
var import_anchor3 = require("@coral-xyz/anchor");
|
|
3467
|
-
var Utility = class {
|
|
3468
|
-
/**
|
|
3469
|
-
* this function is used to create merkle tree on backend side for bubblegum cNFT for metaplex
|
|
3470
|
-
* backend pays the merkle tree create fee
|
|
3471
|
-
* this function works on mpl_bubblegum version 4.3.1 but I downgrade the mpl_bubblegum for getLeafAsset function
|
|
3472
|
-
*/
|
|
3473
|
-
// static async createMerkleTree(
|
|
3474
|
-
// env: ENV,
|
|
3475
|
-
// payerPrivateKey: string,
|
|
3476
|
-
// collectionSize: number,
|
|
3477
|
-
// collectionId: string
|
|
3478
|
-
// ): Promise<PublicKey> {
|
|
3479
|
-
// if (collectionSize < 3 || collectionSize > 24)
|
|
3480
|
-
// throw new Error(`collection size won't be such value ${collectionSize}`);
|
|
3481
|
-
// const rpc = RPC[env];
|
|
3482
|
-
// const privKeyUtf8 = bs58.decode(payerPrivateKey);
|
|
3483
|
-
// let depthSize = Math.ceil(Math.log2(collectionSize));
|
|
3484
|
-
// //@ts-ignore
|
|
3485
|
-
// const { maxBufferSize, maxDepth } = VALID_SIZE_PAIR[depthSize];
|
|
3486
|
-
// let umi = createUmi(rpc);
|
|
3487
|
-
// const payer = umi.eddsa.createKeypairFromSecretKey(privKeyUtf8);
|
|
3488
|
-
// const signer = createSignerFromKeypair(umi, payer);
|
|
3489
|
-
// const merkleTree = generateSigner(umi);
|
|
3490
|
-
// umi.use(signerIdentity(signer));
|
|
3491
|
-
// let builder = await createTree(umi, {
|
|
3492
|
-
// merkleTree,
|
|
3493
|
-
// maxDepth,
|
|
3494
|
-
// maxBufferSize,
|
|
3495
|
-
// });
|
|
3496
|
-
// let res = await builder.sendAndConfirm(umi);
|
|
3497
|
-
// console.log(
|
|
3498
|
-
// "merkle tree create transaction signature",
|
|
3499
|
-
// res.signature.toString()
|
|
3500
|
-
// );
|
|
3501
|
-
// return new PublicKey(merkleTree.publicKey);
|
|
3502
|
-
// }
|
|
3503
|
-
static createMerkleTreeFromContract(env, privateKey, collectionSize, collectionId) {
|
|
3504
|
-
return __async(this, null, function* () {
|
|
3505
|
-
const rpc = RPC[env];
|
|
3506
|
-
let depthSize = Math.ceil(Math.log2(collectionSize));
|
|
3507
|
-
const { maxBufferSize, maxDepth } = VALID_SIZE_PAIR[depthSize];
|
|
3508
|
-
const keypair = import_web36.Keypair.fromSecretKey(import_bytes.bs58.decode(privateKey));
|
|
3509
|
-
const wallet = new import_anchor3.Wallet(keypair);
|
|
3510
|
-
const connectionA = new import_web36.Connection(rpc);
|
|
3511
|
-
const provider = new import_anchor3.AnchorProvider(connectionA, wallet, {
|
|
3512
|
-
skipPreflight: true,
|
|
3513
|
-
preflightCommitment: "confirmed"
|
|
3514
|
-
});
|
|
3515
|
-
const sendTransaction = (transaction, connection) => __async(this, null, function* () {
|
|
3516
|
-
if (transaction instanceof import_web36.Transaction) {
|
|
3517
|
-
let signature = yield (0, import_web36.sendAndConfirmTransaction)(
|
|
3518
|
-
connection,
|
|
3519
|
-
transaction,
|
|
3520
|
-
[keypair]
|
|
3521
|
-
);
|
|
3522
|
-
console.log("sendAndConfrimTransaction : signature", signature);
|
|
3523
|
-
return signature;
|
|
3524
|
-
} else {
|
|
3525
|
-
transaction.sign([keypair]);
|
|
3526
|
-
let signature = yield connectionA.sendTransaction(transaction, {
|
|
3527
|
-
skipPreflight: true,
|
|
3528
|
-
preflightCommitment: "confirmed"
|
|
3529
|
-
});
|
|
3530
|
-
console.log("signature", signature);
|
|
3531
|
-
return signature;
|
|
3532
|
-
}
|
|
3533
|
-
});
|
|
3534
|
-
const flipmemeSDK = new FlipmemeSDK("solana" /* SOLANA */, {
|
|
3535
|
-
provider,
|
|
3536
|
-
wallet: wallet.publicKey,
|
|
3537
|
-
sendTransaction
|
|
3538
|
-
});
|
|
3539
|
-
let merkleTreePubKey = yield flipmemeSDK.createMerkle(collectionId, maxBufferSize, maxDepth);
|
|
3540
|
-
return merkleTreePubKey;
|
|
3541
|
-
});
|
|
3542
|
-
}
|
|
3543
|
-
};
|
|
3544
3462
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3545
3463
|
0 && (module.exports = {
|
|
3546
3464
|
BlockchainType,
|
|
@@ -3551,7 +3469,6 @@ var Utility = class {
|
|
|
3551
3469
|
SDK_SOLANA_CONFIG,
|
|
3552
3470
|
SOLANA,
|
|
3553
3471
|
SOLANA_PUBKEYS,
|
|
3554
|
-
Utility,
|
|
3555
3472
|
VALID_SIZE_PAIR,
|
|
3556
3473
|
isEthereumConfig,
|
|
3557
3474
|
isSolanaConfig
|