flipmeme-sdk 1.2.3 → 1.2.4
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 +125 -1
- package/dist/index.d.ts +125 -1
- package/dist/index.js +46 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -177,10 +177,134 @@ declare class FlipmemeSDK {
|
|
|
177
177
|
getInstructionData(instruction: string): Promise<void>;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
declare const SOLANA: {
|
|
181
|
+
STATE_ID_STR: string;
|
|
182
|
+
TREASURY_ID_STR: string;
|
|
183
|
+
LP_PROVISIONER_ID_STR: string;
|
|
184
|
+
TOKEN_METADATA_PROGRAM_ID_STR: string;
|
|
185
|
+
MPL_CORE_STR: string;
|
|
186
|
+
ADMIN_FOR_CREDIT_BUY_STR: string;
|
|
187
|
+
MPL_BUBBLEGUM_STR: string;
|
|
188
|
+
SPL_ACCOUNT_COMPRESSION_STR: string;
|
|
189
|
+
SPL_NOOP_STR: string;
|
|
190
|
+
SPL_TOKEN_STR: string;
|
|
191
|
+
SPL_ATA_TOKEN_STR: string;
|
|
192
|
+
RENT_TOKEN_STR: string;
|
|
193
|
+
};
|
|
180
194
|
declare enum ENV {
|
|
181
195
|
Devnet = "Devnet",
|
|
182
196
|
Mainnet = "Mainnet"
|
|
183
197
|
}
|
|
198
|
+
declare const RPC: {
|
|
199
|
+
Devnet: string;
|
|
200
|
+
Mainnet: string;
|
|
201
|
+
};
|
|
202
|
+
declare const SOLANA_PUBKEYS: {
|
|
203
|
+
STATE_ID: PublicKey;
|
|
204
|
+
TREASURY_ID: PublicKey;
|
|
205
|
+
LP_PROVISIONER_ID: PublicKey;
|
|
206
|
+
TOKEN_METADATA_PROGRAM_ID: PublicKey;
|
|
207
|
+
ADMIN_FOR_CREDIT_BUY: PublicKey;
|
|
208
|
+
MPL_BUBBLEGUM_ID: PublicKey;
|
|
209
|
+
SPL_ACCOUNT_COMPRESSION_ID: PublicKey;
|
|
210
|
+
SPL_NOOP_ID: PublicKey;
|
|
211
|
+
SPL_TOKEN_ID: PublicKey;
|
|
212
|
+
SPL_ATA_TOKEN_ID: PublicKey;
|
|
213
|
+
RENT_TOKEN_ID: PublicKey;
|
|
214
|
+
};
|
|
215
|
+
declare const SDK_SOLANA_CONFIG: {
|
|
216
|
+
CHUNK_SIZE: number;
|
|
217
|
+
};
|
|
218
|
+
declare const VALID_SIZE_PAIR: {
|
|
219
|
+
3: {
|
|
220
|
+
maxBufferSize: number;
|
|
221
|
+
maxDepth: number;
|
|
222
|
+
};
|
|
223
|
+
4: {
|
|
224
|
+
maxBufferSize: number;
|
|
225
|
+
maxDepth: number;
|
|
226
|
+
};
|
|
227
|
+
5: {
|
|
228
|
+
maxBufferSize: number;
|
|
229
|
+
maxDepth: number;
|
|
230
|
+
};
|
|
231
|
+
6: {
|
|
232
|
+
maxBufferSize: number;
|
|
233
|
+
maxDepth: number;
|
|
234
|
+
};
|
|
235
|
+
7: {
|
|
236
|
+
maxBufferSize: number;
|
|
237
|
+
maxDepth: number;
|
|
238
|
+
};
|
|
239
|
+
8: {
|
|
240
|
+
maxBufferSize: number;
|
|
241
|
+
maxDepth: number;
|
|
242
|
+
};
|
|
243
|
+
9: {
|
|
244
|
+
maxBufferSize: number;
|
|
245
|
+
maxDepth: number;
|
|
246
|
+
};
|
|
247
|
+
10: {
|
|
248
|
+
maxBufferSize: number;
|
|
249
|
+
maxDepth: number;
|
|
250
|
+
};
|
|
251
|
+
11: {
|
|
252
|
+
maxBufferSize: number;
|
|
253
|
+
maxDepth: number;
|
|
254
|
+
};
|
|
255
|
+
12: {
|
|
256
|
+
maxBufferSize: number;
|
|
257
|
+
maxDepth: number;
|
|
258
|
+
};
|
|
259
|
+
13: {
|
|
260
|
+
maxBufferSize: number;
|
|
261
|
+
maxDepth: number;
|
|
262
|
+
};
|
|
263
|
+
14: {
|
|
264
|
+
maxBufferSize: number;
|
|
265
|
+
maxDepth: number;
|
|
266
|
+
};
|
|
267
|
+
15: {
|
|
268
|
+
maxBufferSize: number;
|
|
269
|
+
maxDepth: number;
|
|
270
|
+
};
|
|
271
|
+
16: {
|
|
272
|
+
maxBufferSize: number;
|
|
273
|
+
maxDepth: number;
|
|
274
|
+
};
|
|
275
|
+
17: {
|
|
276
|
+
maxBufferSize: number;
|
|
277
|
+
maxDepth: number;
|
|
278
|
+
};
|
|
279
|
+
18: {
|
|
280
|
+
maxBufferSize: number;
|
|
281
|
+
maxDepth: number;
|
|
282
|
+
};
|
|
283
|
+
19: {
|
|
284
|
+
maxBufferSize: number;
|
|
285
|
+
maxDepth: number;
|
|
286
|
+
};
|
|
287
|
+
20: {
|
|
288
|
+
maxBufferSize: number;
|
|
289
|
+
maxDepth: number;
|
|
290
|
+
};
|
|
291
|
+
21: {
|
|
292
|
+
maxBufferSize: number;
|
|
293
|
+
maxDepth: number;
|
|
294
|
+
};
|
|
295
|
+
22: {
|
|
296
|
+
maxBufferSize: number;
|
|
297
|
+
maxDepth: number;
|
|
298
|
+
};
|
|
299
|
+
23: {
|
|
300
|
+
maxBufferSize: number;
|
|
301
|
+
maxDepth: number;
|
|
302
|
+
};
|
|
303
|
+
24: {
|
|
304
|
+
maxBufferSize: number;
|
|
305
|
+
maxDepth: number;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
184
308
|
|
|
185
309
|
declare class Utility {
|
|
186
310
|
/**
|
|
@@ -191,4 +315,4 @@ declare class Utility {
|
|
|
191
315
|
static createMerkleTreeFromContract(env: ENV, privateKey: string, collectionSize: number, collectionId: string): Promise<PublicKey>;
|
|
192
316
|
}
|
|
193
317
|
|
|
194
|
-
export { type AssetData, type AssetInfo, BlockchainType, type BuyCreditParams, type BuyParams, type BuyResponse, type CollectionInfo, type CollectionParams, type Compression, type CreateCollectionResponse, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NFTTradingData, type Ownership, type ProfileSellParams, PurcahseType, type ReserveToken, type SellParams, type SellResponse, type SolanaConfig, Utility, isEthereumConfig, isSolanaConfig };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -177,10 +177,134 @@ declare class FlipmemeSDK {
|
|
|
177
177
|
getInstructionData(instruction: string): Promise<void>;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
declare const SOLANA: {
|
|
181
|
+
STATE_ID_STR: string;
|
|
182
|
+
TREASURY_ID_STR: string;
|
|
183
|
+
LP_PROVISIONER_ID_STR: string;
|
|
184
|
+
TOKEN_METADATA_PROGRAM_ID_STR: string;
|
|
185
|
+
MPL_CORE_STR: string;
|
|
186
|
+
ADMIN_FOR_CREDIT_BUY_STR: string;
|
|
187
|
+
MPL_BUBBLEGUM_STR: string;
|
|
188
|
+
SPL_ACCOUNT_COMPRESSION_STR: string;
|
|
189
|
+
SPL_NOOP_STR: string;
|
|
190
|
+
SPL_TOKEN_STR: string;
|
|
191
|
+
SPL_ATA_TOKEN_STR: string;
|
|
192
|
+
RENT_TOKEN_STR: string;
|
|
193
|
+
};
|
|
180
194
|
declare enum ENV {
|
|
181
195
|
Devnet = "Devnet",
|
|
182
196
|
Mainnet = "Mainnet"
|
|
183
197
|
}
|
|
198
|
+
declare const RPC: {
|
|
199
|
+
Devnet: string;
|
|
200
|
+
Mainnet: string;
|
|
201
|
+
};
|
|
202
|
+
declare const SOLANA_PUBKEYS: {
|
|
203
|
+
STATE_ID: PublicKey;
|
|
204
|
+
TREASURY_ID: PublicKey;
|
|
205
|
+
LP_PROVISIONER_ID: PublicKey;
|
|
206
|
+
TOKEN_METADATA_PROGRAM_ID: PublicKey;
|
|
207
|
+
ADMIN_FOR_CREDIT_BUY: PublicKey;
|
|
208
|
+
MPL_BUBBLEGUM_ID: PublicKey;
|
|
209
|
+
SPL_ACCOUNT_COMPRESSION_ID: PublicKey;
|
|
210
|
+
SPL_NOOP_ID: PublicKey;
|
|
211
|
+
SPL_TOKEN_ID: PublicKey;
|
|
212
|
+
SPL_ATA_TOKEN_ID: PublicKey;
|
|
213
|
+
RENT_TOKEN_ID: PublicKey;
|
|
214
|
+
};
|
|
215
|
+
declare const SDK_SOLANA_CONFIG: {
|
|
216
|
+
CHUNK_SIZE: number;
|
|
217
|
+
};
|
|
218
|
+
declare const VALID_SIZE_PAIR: {
|
|
219
|
+
3: {
|
|
220
|
+
maxBufferSize: number;
|
|
221
|
+
maxDepth: number;
|
|
222
|
+
};
|
|
223
|
+
4: {
|
|
224
|
+
maxBufferSize: number;
|
|
225
|
+
maxDepth: number;
|
|
226
|
+
};
|
|
227
|
+
5: {
|
|
228
|
+
maxBufferSize: number;
|
|
229
|
+
maxDepth: number;
|
|
230
|
+
};
|
|
231
|
+
6: {
|
|
232
|
+
maxBufferSize: number;
|
|
233
|
+
maxDepth: number;
|
|
234
|
+
};
|
|
235
|
+
7: {
|
|
236
|
+
maxBufferSize: number;
|
|
237
|
+
maxDepth: number;
|
|
238
|
+
};
|
|
239
|
+
8: {
|
|
240
|
+
maxBufferSize: number;
|
|
241
|
+
maxDepth: number;
|
|
242
|
+
};
|
|
243
|
+
9: {
|
|
244
|
+
maxBufferSize: number;
|
|
245
|
+
maxDepth: number;
|
|
246
|
+
};
|
|
247
|
+
10: {
|
|
248
|
+
maxBufferSize: number;
|
|
249
|
+
maxDepth: number;
|
|
250
|
+
};
|
|
251
|
+
11: {
|
|
252
|
+
maxBufferSize: number;
|
|
253
|
+
maxDepth: number;
|
|
254
|
+
};
|
|
255
|
+
12: {
|
|
256
|
+
maxBufferSize: number;
|
|
257
|
+
maxDepth: number;
|
|
258
|
+
};
|
|
259
|
+
13: {
|
|
260
|
+
maxBufferSize: number;
|
|
261
|
+
maxDepth: number;
|
|
262
|
+
};
|
|
263
|
+
14: {
|
|
264
|
+
maxBufferSize: number;
|
|
265
|
+
maxDepth: number;
|
|
266
|
+
};
|
|
267
|
+
15: {
|
|
268
|
+
maxBufferSize: number;
|
|
269
|
+
maxDepth: number;
|
|
270
|
+
};
|
|
271
|
+
16: {
|
|
272
|
+
maxBufferSize: number;
|
|
273
|
+
maxDepth: number;
|
|
274
|
+
};
|
|
275
|
+
17: {
|
|
276
|
+
maxBufferSize: number;
|
|
277
|
+
maxDepth: number;
|
|
278
|
+
};
|
|
279
|
+
18: {
|
|
280
|
+
maxBufferSize: number;
|
|
281
|
+
maxDepth: number;
|
|
282
|
+
};
|
|
283
|
+
19: {
|
|
284
|
+
maxBufferSize: number;
|
|
285
|
+
maxDepth: number;
|
|
286
|
+
};
|
|
287
|
+
20: {
|
|
288
|
+
maxBufferSize: number;
|
|
289
|
+
maxDepth: number;
|
|
290
|
+
};
|
|
291
|
+
21: {
|
|
292
|
+
maxBufferSize: number;
|
|
293
|
+
maxDepth: number;
|
|
294
|
+
};
|
|
295
|
+
22: {
|
|
296
|
+
maxBufferSize: number;
|
|
297
|
+
maxDepth: number;
|
|
298
|
+
};
|
|
299
|
+
23: {
|
|
300
|
+
maxBufferSize: number;
|
|
301
|
+
maxDepth: number;
|
|
302
|
+
};
|
|
303
|
+
24: {
|
|
304
|
+
maxBufferSize: number;
|
|
305
|
+
maxDepth: number;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
184
308
|
|
|
185
309
|
declare class Utility {
|
|
186
310
|
/**
|
|
@@ -191,4 +315,4 @@ declare class Utility {
|
|
|
191
315
|
static createMerkleTreeFromContract(env: ENV, privateKey: string, collectionSize: number, collectionId: string): Promise<PublicKey>;
|
|
192
316
|
}
|
|
193
317
|
|
|
194
|
-
export { type AssetData, type AssetInfo, BlockchainType, type BuyCreditParams, type BuyParams, type BuyResponse, type CollectionInfo, type CollectionParams, type Compression, type CreateCollectionResponse, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NFTTradingData, type Ownership, type ProfileSellParams, PurcahseType, type ReserveToken, type SellParams, type SellResponse, type SolanaConfig, Utility, isEthereumConfig, isSolanaConfig };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -51,9 +51,15 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
var index_exports = {};
|
|
52
52
|
__export(index_exports, {
|
|
53
53
|
BlockchainType: () => BlockchainType,
|
|
54
|
+
ENV: () => ENV,
|
|
54
55
|
FlipmemeSDK: () => FlipmemeSDK,
|
|
55
56
|
PurcahseType: () => PurcahseType,
|
|
57
|
+
RPC: () => RPC,
|
|
58
|
+
SDK_SOLANA_CONFIG: () => SDK_SOLANA_CONFIG,
|
|
59
|
+
SOLANA: () => SOLANA,
|
|
60
|
+
SOLANA_PUBKEYS: () => SOLANA_PUBKEYS,
|
|
56
61
|
Utility: () => Utility,
|
|
62
|
+
VALID_SIZE_PAIR: () => VALID_SIZE_PAIR,
|
|
57
63
|
isEthereumConfig: () => isEthereumConfig,
|
|
58
64
|
isSolanaConfig: () => isSolanaConfig
|
|
59
65
|
});
|
|
@@ -2238,6 +2244,11 @@ var SOLANA = {
|
|
|
2238
2244
|
SPL_ATA_TOKEN_STR: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2239
2245
|
RENT_TOKEN_STR: "SysvarRent111111111111111111111111111111111"
|
|
2240
2246
|
};
|
|
2247
|
+
var ENV = /* @__PURE__ */ ((ENV3) => {
|
|
2248
|
+
ENV3["Devnet"] = "Devnet";
|
|
2249
|
+
ENV3["Mainnet"] = "Mainnet";
|
|
2250
|
+
return ENV3;
|
|
2251
|
+
})(ENV || {});
|
|
2241
2252
|
var RPC = {
|
|
2242
2253
|
Devnet: "https://api.devnet.solana.com",
|
|
2243
2254
|
Mainnet: "https://api.mainnet-beta.solana.com"
|
|
@@ -2896,8 +2907,14 @@ var SolanaConnector = class {
|
|
|
2896
2907
|
throw new Error("Program not initialized");
|
|
2897
2908
|
}
|
|
2898
2909
|
let merkleTreeKeyPair = new import_web35.Keypair();
|
|
2899
|
-
let
|
|
2900
|
-
|
|
2910
|
+
let canopyDepth = maxDepth > 6 ? 4 : 3;
|
|
2911
|
+
let accountInx = yield (0, import_spl_account_compression.createAllocTreeIx)(
|
|
2912
|
+
this.config.provider.connection,
|
|
2913
|
+
merkleTreeKeyPair.publicKey,
|
|
2914
|
+
this.config.wallet,
|
|
2915
|
+
//@ts-ignore
|
|
2916
|
+
VALID_SIZE_PAIR[maxDepth],
|
|
2917
|
+
canopyDepth
|
|
2901
2918
|
);
|
|
2902
2919
|
let collectionPda2 = collectionPda(
|
|
2903
2920
|
collectionId,
|
|
@@ -2940,18 +2957,22 @@ var SolanaConnector = class {
|
|
|
2940
2957
|
const result = yield this.config.provider.connection.simulateTransaction(
|
|
2941
2958
|
versionedTransaction
|
|
2942
2959
|
);
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2960
|
+
try {
|
|
2961
|
+
const tx = new import_web35.Transaction().add(modifyComputeUnits).add(addPriorityFee).add(accountInx).add(instruction);
|
|
2962
|
+
const txHash = yield this.config.provider.sendAndConfirm(
|
|
2963
|
+
tx,
|
|
2964
|
+
[merkleTreeKeyPair],
|
|
2965
|
+
{ commitment: "confirmed", skipPreflight: true }
|
|
2966
|
+
);
|
|
2967
|
+
const confirmResult = yield this.config.provider.connection.confirmTransaction({
|
|
2968
|
+
blockhash: blockHash,
|
|
2969
|
+
lastValidBlockHeight: latestBlockhash.lastValidBlockHeight,
|
|
2970
|
+
signature: txHash
|
|
2971
|
+
});
|
|
2972
|
+
return merkleTreeKeyPair.publicKey;
|
|
2973
|
+
} catch (e) {
|
|
2974
|
+
throw new Error("Cannot call this function");
|
|
2975
|
+
}
|
|
2955
2976
|
});
|
|
2956
2977
|
}
|
|
2957
2978
|
getTotalPrice(type, collectionId, amount) {
|
|
@@ -3245,6 +3266,11 @@ var SolanaConnector = class {
|
|
|
3245
3266
|
return instructions;
|
|
3246
3267
|
});
|
|
3247
3268
|
}
|
|
3269
|
+
/**
|
|
3270
|
+
* initialize account for merkle tree
|
|
3271
|
+
* @param merkleTree merkle tree address which is initialized
|
|
3272
|
+
* @returns
|
|
3273
|
+
*/
|
|
3248
3274
|
createAccountForMerkleTree(merkleTree) {
|
|
3249
3275
|
return __async(this, null, function* () {
|
|
3250
3276
|
const dataLen = 5112;
|
|
@@ -3518,9 +3544,15 @@ var Utility = class {
|
|
|
3518
3544
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3519
3545
|
0 && (module.exports = {
|
|
3520
3546
|
BlockchainType,
|
|
3547
|
+
ENV,
|
|
3521
3548
|
FlipmemeSDK,
|
|
3522
3549
|
PurcahseType,
|
|
3550
|
+
RPC,
|
|
3551
|
+
SDK_SOLANA_CONFIG,
|
|
3552
|
+
SOLANA,
|
|
3553
|
+
SOLANA_PUBKEYS,
|
|
3523
3554
|
Utility,
|
|
3555
|
+
VALID_SIZE_PAIR,
|
|
3524
3556
|
isEthereumConfig,
|
|
3525
3557
|
isSolanaConfig
|
|
3526
3558
|
});
|