flipmeme-sdk 1.3.8 → 1.3.10
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 +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +37 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -56,6 +56,7 @@ interface NetworkAddress {
|
|
|
56
56
|
ROYALITY_ID: PublicKey;
|
|
57
57
|
MPL_CORE: PublicKey;
|
|
58
58
|
ADMIN_FOR_CREDIT_BUY: PublicKey;
|
|
59
|
+
REFERRAL_ID: PublicKey;
|
|
59
60
|
RENT_TOKEN_ID: PublicKey;
|
|
60
61
|
SYSTEM_PROGRAM_ID: PublicKey;
|
|
61
62
|
}
|
|
@@ -110,7 +111,7 @@ interface ProfileSellParams {
|
|
|
110
111
|
}
|
|
111
112
|
declare function isEthereumConfig(config: EthereumConfig | SolanaConfig): config is EthereumConfig;
|
|
112
113
|
declare function isSolanaConfig(config: EthereumConfig | SolanaConfig): config is SolanaConfig;
|
|
113
|
-
interface
|
|
114
|
+
interface TransferParams {
|
|
114
115
|
userPubkey: PublicKey;
|
|
115
116
|
amount: number;
|
|
116
117
|
}
|
|
@@ -185,7 +186,7 @@ declare class FlipmemeSDK {
|
|
|
185
186
|
buy(params: BuyParams): Promise<ConfirmResult>;
|
|
186
187
|
flipSell(params: SellParams): Promise<ConfirmResult>;
|
|
187
188
|
profileSell(data: ProfileSellParams): Promise<ConfirmResult>;
|
|
188
|
-
buyCredit(params:
|
|
189
|
+
buyCredit(params: TransferParams): Promise<string>;
|
|
189
190
|
getTotalPrice(type: PurcahseType, collectionId: string, amount: number): Promise<string>;
|
|
190
191
|
/**
|
|
191
192
|
* create lookup table account with lookuptable addresses and return lookup table account
|
|
@@ -226,6 +227,7 @@ declare const SOLANA_COMMON: {
|
|
|
226
227
|
LP_PROVISIONER_ID: PublicKey;
|
|
227
228
|
ROYALITY_ID: PublicKey;
|
|
228
229
|
MPL_CORE: PublicKey;
|
|
230
|
+
REFERRAL_ID: PublicKey;
|
|
229
231
|
ADMIN_FOR_CREDIT_BUY: PublicKey;
|
|
230
232
|
RENT_TOKEN_ID: PublicKey;
|
|
231
233
|
SYSTEM_PROGRAM_ID: PublicKey;
|
|
@@ -245,6 +247,7 @@ declare const SOLANA_PUBKEYS: {
|
|
|
245
247
|
LP_PROVISIONER_ID: PublicKey;
|
|
246
248
|
ROYALITY_ID: PublicKey;
|
|
247
249
|
MPL_CORE: PublicKey;
|
|
250
|
+
REFERRAL_ID: PublicKey;
|
|
248
251
|
ADMIN_FOR_CREDIT_BUY: PublicKey;
|
|
249
252
|
RENT_TOKEN_ID: PublicKey;
|
|
250
253
|
SYSTEM_PROGRAM_ID: PublicKey;
|
|
@@ -258,6 +261,7 @@ declare const SOLANA_PUBKEYS_DEV: {
|
|
|
258
261
|
LP_PROVISIONER_ID: PublicKey;
|
|
259
262
|
ROYALITY_ID: PublicKey;
|
|
260
263
|
MPL_CORE: PublicKey;
|
|
264
|
+
REFERRAL_ID: PublicKey;
|
|
261
265
|
ADMIN_FOR_CREDIT_BUY: PublicKey;
|
|
262
266
|
RENT_TOKEN_ID: PublicKey;
|
|
263
267
|
SYSTEM_PROGRAM_ID: PublicKey;
|
|
@@ -369,4 +373,4 @@ declare function placeTensorCollectionBid(price: number, quantity: number, colle
|
|
|
369
373
|
|
|
370
374
|
declare function decodeStr(str: string): string;
|
|
371
375
|
|
|
372
|
-
export { type AssetData, type AssetInfo, BlockchainType, type
|
|
376
|
+
export { type AssetData, type AssetInfo, BlockchainType, type BuyParams, type BuyResponse, COLLECTION_BID_PRICE, type CollectionInfo, type CollectionParams, type Compression, type ConfirmResult, type CreateCollectionResponse, ENV, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NetworkAddress, type NftInfo, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, type SDKSignature, type SDKTransaction, SDK_SOLANA_CONFIG, SOLANA_COMMON, SOLANA_DEV, SOLANA_MAIN, SOLANA_PUBKEYS, SOLANA_PUBKEYS_DEV, type SellData, type SellParams, type SellResponse, type SolanaConfig, type TransferParams, VALID_SIZE_PAIR, decodeStr, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
|
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ interface NetworkAddress {
|
|
|
56
56
|
ROYALITY_ID: PublicKey;
|
|
57
57
|
MPL_CORE: PublicKey;
|
|
58
58
|
ADMIN_FOR_CREDIT_BUY: PublicKey;
|
|
59
|
+
REFERRAL_ID: PublicKey;
|
|
59
60
|
RENT_TOKEN_ID: PublicKey;
|
|
60
61
|
SYSTEM_PROGRAM_ID: PublicKey;
|
|
61
62
|
}
|
|
@@ -110,7 +111,7 @@ interface ProfileSellParams {
|
|
|
110
111
|
}
|
|
111
112
|
declare function isEthereumConfig(config: EthereumConfig | SolanaConfig): config is EthereumConfig;
|
|
112
113
|
declare function isSolanaConfig(config: EthereumConfig | SolanaConfig): config is SolanaConfig;
|
|
113
|
-
interface
|
|
114
|
+
interface TransferParams {
|
|
114
115
|
userPubkey: PublicKey;
|
|
115
116
|
amount: number;
|
|
116
117
|
}
|
|
@@ -185,7 +186,7 @@ declare class FlipmemeSDK {
|
|
|
185
186
|
buy(params: BuyParams): Promise<ConfirmResult>;
|
|
186
187
|
flipSell(params: SellParams): Promise<ConfirmResult>;
|
|
187
188
|
profileSell(data: ProfileSellParams): Promise<ConfirmResult>;
|
|
188
|
-
buyCredit(params:
|
|
189
|
+
buyCredit(params: TransferParams): Promise<string>;
|
|
189
190
|
getTotalPrice(type: PurcahseType, collectionId: string, amount: number): Promise<string>;
|
|
190
191
|
/**
|
|
191
192
|
* create lookup table account with lookuptable addresses and return lookup table account
|
|
@@ -226,6 +227,7 @@ declare const SOLANA_COMMON: {
|
|
|
226
227
|
LP_PROVISIONER_ID: PublicKey;
|
|
227
228
|
ROYALITY_ID: PublicKey;
|
|
228
229
|
MPL_CORE: PublicKey;
|
|
230
|
+
REFERRAL_ID: PublicKey;
|
|
229
231
|
ADMIN_FOR_CREDIT_BUY: PublicKey;
|
|
230
232
|
RENT_TOKEN_ID: PublicKey;
|
|
231
233
|
SYSTEM_PROGRAM_ID: PublicKey;
|
|
@@ -245,6 +247,7 @@ declare const SOLANA_PUBKEYS: {
|
|
|
245
247
|
LP_PROVISIONER_ID: PublicKey;
|
|
246
248
|
ROYALITY_ID: PublicKey;
|
|
247
249
|
MPL_CORE: PublicKey;
|
|
250
|
+
REFERRAL_ID: PublicKey;
|
|
248
251
|
ADMIN_FOR_CREDIT_BUY: PublicKey;
|
|
249
252
|
RENT_TOKEN_ID: PublicKey;
|
|
250
253
|
SYSTEM_PROGRAM_ID: PublicKey;
|
|
@@ -258,6 +261,7 @@ declare const SOLANA_PUBKEYS_DEV: {
|
|
|
258
261
|
LP_PROVISIONER_ID: PublicKey;
|
|
259
262
|
ROYALITY_ID: PublicKey;
|
|
260
263
|
MPL_CORE: PublicKey;
|
|
264
|
+
REFERRAL_ID: PublicKey;
|
|
261
265
|
ADMIN_FOR_CREDIT_BUY: PublicKey;
|
|
262
266
|
RENT_TOKEN_ID: PublicKey;
|
|
263
267
|
SYSTEM_PROGRAM_ID: PublicKey;
|
|
@@ -369,4 +373,4 @@ declare function placeTensorCollectionBid(price: number, quantity: number, colle
|
|
|
369
373
|
|
|
370
374
|
declare function decodeStr(str: string): string;
|
|
371
375
|
|
|
372
|
-
export { type AssetData, type AssetInfo, BlockchainType, type
|
|
376
|
+
export { type AssetData, type AssetInfo, BlockchainType, type BuyParams, type BuyResponse, COLLECTION_BID_PRICE, type CollectionInfo, type CollectionParams, type Compression, type ConfirmResult, type CreateCollectionResponse, ENV, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NetworkAddress, type NftInfo, type Ownership, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, type SDKSignature, type SDKTransaction, SDK_SOLANA_CONFIG, SOLANA_COMMON, SOLANA_DEV, SOLANA_MAIN, SOLANA_PUBKEYS, SOLANA_PUBKEYS_DEV, type SellData, type SellParams, type SellResponse, type SolanaConfig, type TransferParams, VALID_SIZE_PAIR, decodeStr, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
|
package/dist/index.js
CHANGED
|
@@ -2054,6 +2054,7 @@ var SOLANA_COMMON = {
|
|
|
2054
2054
|
),
|
|
2055
2055
|
ROYALITY_ID: new import_web3.PublicKey("6oYqWqe23Ff1pnP2qPGhtYAgC7zD3fdWCUfvafaoTJEX"),
|
|
2056
2056
|
MPL_CORE: new import_web3.PublicKey("CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"),
|
|
2057
|
+
REFERRAL_ID: new import_web3.PublicKey(""),
|
|
2057
2058
|
ADMIN_FOR_CREDIT_BUY: new import_web3.PublicKey(
|
|
2058
2059
|
"ELaia39FeuTV1EttanpKMy6jbWViJAmjUurnZCB7VxBg"
|
|
2059
2060
|
),
|
|
@@ -2529,6 +2530,24 @@ var SolanaConnector = class {
|
|
|
2529
2530
|
);
|
|
2530
2531
|
});
|
|
2531
2532
|
}
|
|
2533
|
+
claimReferralReward(params) {
|
|
2534
|
+
return __async(this, null, function* () {
|
|
2535
|
+
if (!this.program) {
|
|
2536
|
+
throw new Error("Program not initialized");
|
|
2537
|
+
}
|
|
2538
|
+
const transaction = new import_web34.Transaction().add(
|
|
2539
|
+
import_web34.SystemProgram.transfer({
|
|
2540
|
+
fromPubkey: this.configAddresses.ADMIN_FOR_CREDIT_BUY,
|
|
2541
|
+
toPubkey: params.userPubkey,
|
|
2542
|
+
lamports: new import_decimal2.default(params.amount).mul(10 ** 9).toNumber()
|
|
2543
|
+
})
|
|
2544
|
+
);
|
|
2545
|
+
return yield this.config.sendTransaction(
|
|
2546
|
+
transaction,
|
|
2547
|
+
this.config.provider.connection
|
|
2548
|
+
);
|
|
2549
|
+
});
|
|
2550
|
+
}
|
|
2532
2551
|
getCollectionInfo(collectionId) {
|
|
2533
2552
|
return __async(this, null, function* () {
|
|
2534
2553
|
if (!this.program) {
|
|
@@ -2896,29 +2915,31 @@ var SolanaConnector = class {
|
|
|
2896
2915
|
}).compileToV0Message(
|
|
2897
2916
|
lookupTableAccounts == null ? [] : [lookupTableAccounts]
|
|
2898
2917
|
);
|
|
2899
|
-
console.log("transaction size ", messageV0.serialize().length);
|
|
2900
2918
|
let versionedTx = new import_web34.VersionedTransaction(messageV0);
|
|
2901
2919
|
if (sdkTx.additionalSigher) versionedTx.sign(sdkTx.additionalSigher);
|
|
2902
2920
|
return versionedTx;
|
|
2903
2921
|
});
|
|
2904
2922
|
const signedTxs = yield this.config.signAllTransactions(txs);
|
|
2905
|
-
let signatures =
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2923
|
+
let signatures = [];
|
|
2924
|
+
for (let i = 0; i < signedTxs.length; i++) {
|
|
2925
|
+
let signedTx = signedTxs[i];
|
|
2926
|
+
if (signedTx instanceof import_web34.VersionedTransaction) {
|
|
2927
|
+
try {
|
|
2928
|
+
let signature = yield this.config.provider.connection.sendTransaction(
|
|
2929
|
+
signedTx,
|
|
2930
|
+
{
|
|
2910
2931
|
skipPreflight: true,
|
|
2911
2932
|
preflightCommitment: "confirmed"
|
|
2912
|
-
}
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
}
|
|
2933
|
+
}
|
|
2934
|
+
);
|
|
2935
|
+
signatures.push({ signature, i });
|
|
2936
|
+
} catch (e) {
|
|
2937
|
+
console.log("Transaction submit error:", e);
|
|
2938
|
+
signatures.push({ signature: null, i });
|
|
2918
2939
|
}
|
|
2919
|
-
}
|
|
2920
|
-
|
|
2921
|
-
console.log("signatures
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
console.log("signatures", signatures);
|
|
2922
2943
|
return {
|
|
2923
2944
|
signatures,
|
|
2924
2945
|
latestBlockhash
|
|
@@ -3112,6 +3133,7 @@ var SolanaConnector = class {
|
|
|
3112
3133
|
index - 1
|
|
3113
3134
|
// when mint calculate price and control index
|
|
3114
3135
|
).mul(slippage + 0.01).div(100).toFixed(0);
|
|
3136
|
+
console.log(index - 1, "'s slippage price", slippagePrice);
|
|
3115
3137
|
for (const nftName of chunks) {
|
|
3116
3138
|
const nftSeedKeypair = import_web34.Keypair.generate();
|
|
3117
3139
|
const nftPda2 = nftPda(
|
|
@@ -3120,7 +3142,6 @@ var SolanaConnector = class {
|
|
|
3120
3142
|
nftSeedKeypair.publicKey,
|
|
3121
3143
|
this.program.programId
|
|
3122
3144
|
);
|
|
3123
|
-
console.log("=======nft seed==========", nftSeedKeypair.publicKey);
|
|
3124
3145
|
const instruction = yield this.program.methods.mintAndBuy(
|
|
3125
3146
|
nftSeedKeypair.publicKey,
|
|
3126
3147
|
nftName,
|