flipmeme-sdk 1.2.2 → 1.2.3
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 +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +80 -112
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -66,7 +66,6 @@ interface BuyResponse {
|
|
|
66
66
|
interface SellResponse {
|
|
67
67
|
seller: string;
|
|
68
68
|
collectionAddress: string;
|
|
69
|
-
nftAddress: string;
|
|
70
69
|
tokenId: string;
|
|
71
70
|
price: string;
|
|
72
71
|
nextPrice: string;
|
|
@@ -91,7 +90,7 @@ interface BuyCreditParams {
|
|
|
91
90
|
adminPubKey: PublicKey;
|
|
92
91
|
amount: number;
|
|
93
92
|
}
|
|
94
|
-
declare enum
|
|
93
|
+
declare enum PurcahseType {
|
|
95
94
|
BUY = "buy",
|
|
96
95
|
SELL = "sell"
|
|
97
96
|
}
|
|
@@ -138,7 +137,7 @@ declare class FlipmemeSDK {
|
|
|
138
137
|
flipSell(params: SellParams): Promise<SellResponse[]>;
|
|
139
138
|
profileSell(data: ProfileSellParams): Promise<SellResponse[]>;
|
|
140
139
|
buyCredit(params: BuyCreditParams): Promise<string>;
|
|
141
|
-
getTotalPrice(type:
|
|
140
|
+
getTotalPrice(type: PurcahseType, collectionId: string, amount: number): Promise<string>;
|
|
142
141
|
createMerkle(collectionId: string, maxBufferSize: number, maxDepth: number): Promise<PublicKey>;
|
|
143
142
|
/**For testing */
|
|
144
143
|
getStateInfo(): Promise<{
|
|
@@ -174,7 +173,7 @@ declare class FlipmemeSDK {
|
|
|
174
173
|
};
|
|
175
174
|
collectionAddress: PublicKey;
|
|
176
175
|
}>;
|
|
177
|
-
getTransactionTest(signature: string): Promise<BuyResponse[]>;
|
|
176
|
+
getTransactionTest(signature: string, transactionType?: string): Promise<BuyResponse[] | SellResponse[]>;
|
|
178
177
|
getInstructionData(instruction: string): Promise<void>;
|
|
179
178
|
}
|
|
180
179
|
|
|
@@ -192,4 +191,4 @@ declare class Utility {
|
|
|
192
191
|
static createMerkleTreeFromContract(env: ENV, privateKey: string, collectionSize: number, collectionId: string): Promise<PublicKey>;
|
|
193
192
|
}
|
|
194
193
|
|
|
195
|
-
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,
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -66,7 +66,6 @@ interface BuyResponse {
|
|
|
66
66
|
interface SellResponse {
|
|
67
67
|
seller: string;
|
|
68
68
|
collectionAddress: string;
|
|
69
|
-
nftAddress: string;
|
|
70
69
|
tokenId: string;
|
|
71
70
|
price: string;
|
|
72
71
|
nextPrice: string;
|
|
@@ -91,7 +90,7 @@ interface BuyCreditParams {
|
|
|
91
90
|
adminPubKey: PublicKey;
|
|
92
91
|
amount: number;
|
|
93
92
|
}
|
|
94
|
-
declare enum
|
|
93
|
+
declare enum PurcahseType {
|
|
95
94
|
BUY = "buy",
|
|
96
95
|
SELL = "sell"
|
|
97
96
|
}
|
|
@@ -138,7 +137,7 @@ declare class FlipmemeSDK {
|
|
|
138
137
|
flipSell(params: SellParams): Promise<SellResponse[]>;
|
|
139
138
|
profileSell(data: ProfileSellParams): Promise<SellResponse[]>;
|
|
140
139
|
buyCredit(params: BuyCreditParams): Promise<string>;
|
|
141
|
-
getTotalPrice(type:
|
|
140
|
+
getTotalPrice(type: PurcahseType, collectionId: string, amount: number): Promise<string>;
|
|
142
141
|
createMerkle(collectionId: string, maxBufferSize: number, maxDepth: number): Promise<PublicKey>;
|
|
143
142
|
/**For testing */
|
|
144
143
|
getStateInfo(): Promise<{
|
|
@@ -174,7 +173,7 @@ declare class FlipmemeSDK {
|
|
|
174
173
|
};
|
|
175
174
|
collectionAddress: PublicKey;
|
|
176
175
|
}>;
|
|
177
|
-
getTransactionTest(signature: string): Promise<BuyResponse[]>;
|
|
176
|
+
getTransactionTest(signature: string, transactionType?: string): Promise<BuyResponse[] | SellResponse[]>;
|
|
178
177
|
getInstructionData(instruction: string): Promise<void>;
|
|
179
178
|
}
|
|
180
179
|
|
|
@@ -192,4 +191,4 @@ declare class Utility {
|
|
|
192
191
|
static createMerkleTreeFromContract(env: ENV, privateKey: string, collectionSize: number, collectionId: string): Promise<PublicKey>;
|
|
193
192
|
}
|
|
194
193
|
|
|
195
|
-
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,
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ var index_exports = {};
|
|
|
52
52
|
__export(index_exports, {
|
|
53
53
|
BlockchainType: () => BlockchainType,
|
|
54
54
|
FlipmemeSDK: () => FlipmemeSDK,
|
|
55
|
-
|
|
55
|
+
PurcahseType: () => PurcahseType,
|
|
56
56
|
Utility: () => Utility,
|
|
57
57
|
isEthereumConfig: () => isEthereumConfig,
|
|
58
58
|
isSolanaConfig: () => isSolanaConfig
|
|
@@ -89,11 +89,11 @@ function isEthereumConfig(config) {
|
|
|
89
89
|
function isSolanaConfig(config) {
|
|
90
90
|
return "sendTransaction" in config;
|
|
91
91
|
}
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return
|
|
96
|
-
})(
|
|
92
|
+
var PurcahseType = /* @__PURE__ */ ((PurcahseType3) => {
|
|
93
|
+
PurcahseType3["BUY"] = "buy";
|
|
94
|
+
PurcahseType3["SELL"] = "sell";
|
|
95
|
+
return PurcahseType3;
|
|
96
|
+
})(PurcahseType || {});
|
|
97
97
|
|
|
98
98
|
// src/solana/idls/flipmeme.json
|
|
99
99
|
var flipmeme_default = {
|
|
@@ -751,7 +751,8 @@ var flipmeme_default = {
|
|
|
751
751
|
"# Arguments",
|
|
752
752
|
"",
|
|
753
753
|
"* `ctx` - The Anchor context holding the accounts",
|
|
754
|
-
"* `token_id` - The token_id of the NFT"
|
|
754
|
+
"* `token_id` - The token_id of the NFT",
|
|
755
|
+
""
|
|
755
756
|
],
|
|
756
757
|
discriminator: [
|
|
757
758
|
156,
|
|
@@ -767,6 +768,14 @@ var flipmeme_default = {
|
|
|
767
768
|
{
|
|
768
769
|
name: "state"
|
|
769
770
|
},
|
|
771
|
+
{
|
|
772
|
+
name: "merkle_tree_config",
|
|
773
|
+
writable: true
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
name: "merkle_tree",
|
|
777
|
+
writable: true
|
|
778
|
+
},
|
|
770
779
|
{
|
|
771
780
|
name: "collection",
|
|
772
781
|
writable: true,
|
|
@@ -798,37 +807,6 @@ var flipmeme_default = {
|
|
|
798
807
|
]
|
|
799
808
|
}
|
|
800
809
|
},
|
|
801
|
-
{
|
|
802
|
-
name: "collection_nft",
|
|
803
|
-
writable: true,
|
|
804
|
-
pda: {
|
|
805
|
-
seeds: [
|
|
806
|
-
{
|
|
807
|
-
kind: "const",
|
|
808
|
-
value: [
|
|
809
|
-
99,
|
|
810
|
-
111,
|
|
811
|
-
108,
|
|
812
|
-
108,
|
|
813
|
-
101,
|
|
814
|
-
99,
|
|
815
|
-
116,
|
|
816
|
-
105,
|
|
817
|
-
111,
|
|
818
|
-
110,
|
|
819
|
-
95,
|
|
820
|
-
110,
|
|
821
|
-
102,
|
|
822
|
-
116
|
|
823
|
-
]
|
|
824
|
-
},
|
|
825
|
-
{
|
|
826
|
-
kind: "account",
|
|
827
|
-
path: "collection"
|
|
828
|
-
}
|
|
829
|
-
]
|
|
830
|
-
}
|
|
831
|
-
},
|
|
832
810
|
{
|
|
833
811
|
name: "nft_owner"
|
|
834
812
|
},
|
|
@@ -863,42 +841,26 @@ var flipmeme_default = {
|
|
|
863
841
|
]
|
|
864
842
|
}
|
|
865
843
|
},
|
|
866
|
-
{
|
|
867
|
-
name: "nft",
|
|
868
|
-
writable: true,
|
|
869
|
-
pda: {
|
|
870
|
-
seeds: [
|
|
871
|
-
{
|
|
872
|
-
kind: "const",
|
|
873
|
-
value: [
|
|
874
|
-
110,
|
|
875
|
-
102,
|
|
876
|
-
116
|
|
877
|
-
]
|
|
878
|
-
},
|
|
879
|
-
{
|
|
880
|
-
kind: "account",
|
|
881
|
-
path: "state"
|
|
882
|
-
},
|
|
883
|
-
{
|
|
884
|
-
kind: "account",
|
|
885
|
-
path: "collection"
|
|
886
|
-
},
|
|
887
|
-
{
|
|
888
|
-
kind: "arg",
|
|
889
|
-
path: "token_id"
|
|
890
|
-
}
|
|
891
|
-
]
|
|
892
|
-
}
|
|
893
|
-
},
|
|
894
844
|
{
|
|
895
845
|
name: "operator",
|
|
896
846
|
writable: true,
|
|
897
847
|
signer: true
|
|
898
848
|
},
|
|
899
849
|
{
|
|
900
|
-
name: "
|
|
901
|
-
address: "
|
|
850
|
+
name: "compression_program",
|
|
851
|
+
address: "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK"
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
name: "token_metadata_program",
|
|
855
|
+
address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
name: "mpl_bubblegum_program",
|
|
859
|
+
address: "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
name: "log_wrapper",
|
|
863
|
+
address: "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV"
|
|
902
864
|
},
|
|
903
865
|
{
|
|
904
866
|
name: "system_program",
|
|
@@ -909,6 +871,41 @@ var flipmeme_default = {
|
|
|
909
871
|
{
|
|
910
872
|
name: "_token_id",
|
|
911
873
|
type: "u32"
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
name: "root",
|
|
877
|
+
type: {
|
|
878
|
+
array: [
|
|
879
|
+
"u8",
|
|
880
|
+
32
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
name: "data_hash",
|
|
886
|
+
type: {
|
|
887
|
+
array: [
|
|
888
|
+
"u8",
|
|
889
|
+
32
|
|
890
|
+
]
|
|
891
|
+
}
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
name: "creator_hash",
|
|
895
|
+
type: {
|
|
896
|
+
array: [
|
|
897
|
+
"u8",
|
|
898
|
+
32
|
|
899
|
+
]
|
|
900
|
+
}
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
name: "nonce",
|
|
904
|
+
type: "u64"
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
name: "index",
|
|
908
|
+
type: "u32"
|
|
912
909
|
}
|
|
913
910
|
]
|
|
914
911
|
},
|
|
@@ -1467,37 +1464,6 @@ var flipmeme_default = {
|
|
|
1467
1464
|
]
|
|
1468
1465
|
}
|
|
1469
1466
|
},
|
|
1470
|
-
{
|
|
1471
|
-
name: "collection_nft",
|
|
1472
|
-
writable: true,
|
|
1473
|
-
pda: {
|
|
1474
|
-
seeds: [
|
|
1475
|
-
{
|
|
1476
|
-
kind: "const",
|
|
1477
|
-
value: [
|
|
1478
|
-
99,
|
|
1479
|
-
111,
|
|
1480
|
-
108,
|
|
1481
|
-
108,
|
|
1482
|
-
101,
|
|
1483
|
-
99,
|
|
1484
|
-
116,
|
|
1485
|
-
105,
|
|
1486
|
-
111,
|
|
1487
|
-
110,
|
|
1488
|
-
95,
|
|
1489
|
-
110,
|
|
1490
|
-
102,
|
|
1491
|
-
116
|
|
1492
|
-
]
|
|
1493
|
-
},
|
|
1494
|
-
{
|
|
1495
|
-
kind: "account",
|
|
1496
|
-
path: "collection"
|
|
1497
|
-
}
|
|
1498
|
-
]
|
|
1499
|
-
}
|
|
1500
|
-
},
|
|
1501
1467
|
{
|
|
1502
1468
|
name: "treasury",
|
|
1503
1469
|
writable: true
|
|
@@ -2112,10 +2078,6 @@ var flipmeme_default = {
|
|
|
2112
2078
|
name: "name",
|
|
2113
2079
|
type: "string"
|
|
2114
2080
|
},
|
|
2115
|
-
{
|
|
2116
|
-
name: "uri",
|
|
2117
|
-
type: "string"
|
|
2118
|
-
},
|
|
2119
2081
|
{
|
|
2120
2082
|
name: "mint_count",
|
|
2121
2083
|
type: "u32"
|
|
@@ -2512,7 +2474,6 @@ function analyzeSellTransaction(program, transactionData) {
|
|
|
2512
2474
|
sellResponse.push({
|
|
2513
2475
|
seller: decodedData.data.seller.toString(),
|
|
2514
2476
|
collectionAddress: decodedData.data.collection.toString(),
|
|
2515
|
-
nftAddress: decodedData.data.nft.toString(),
|
|
2516
2477
|
tokenId: decodedData.data.tokenId.toString(),
|
|
2517
2478
|
price: decodedData.data.price.toString(),
|
|
2518
2479
|
nextPrice: decodedData.data.nextPrice.toString(),
|
|
@@ -3154,7 +3115,7 @@ var SolanaConnector = class {
|
|
|
3154
3115
|
25e4 * chunk.length
|
|
3155
3116
|
);
|
|
3156
3117
|
for (const token of chunk) {
|
|
3157
|
-
const { compression,
|
|
3118
|
+
const { compression, proof, root } = token;
|
|
3158
3119
|
const proofPath = proof.map((node) => ({
|
|
3159
3120
|
pubkey: new import_web35.PublicKey(node),
|
|
3160
3121
|
isSigner: false,
|
|
@@ -3174,7 +3135,6 @@ var SolanaConnector = class {
|
|
|
3174
3135
|
merkleTreeConfig: treeConfigPda2,
|
|
3175
3136
|
merkleTree: new import_web35.PublicKey(merkleTree),
|
|
3176
3137
|
collection: collectionPda2,
|
|
3177
|
-
collectionNft: collectionNftPda2,
|
|
3178
3138
|
treasury: SOLANA_PUBKEYS.TREASURY_ID,
|
|
3179
3139
|
nftHolder: nftHolderPda2,
|
|
3180
3140
|
seller: userPublicKey,
|
|
@@ -3301,7 +3261,7 @@ var SolanaConnector = class {
|
|
|
3301
3261
|
return ins;
|
|
3302
3262
|
});
|
|
3303
3263
|
}
|
|
3304
|
-
getTransactionTest(signature) {
|
|
3264
|
+
getTransactionTest(signature, transactionType = "buy") {
|
|
3305
3265
|
return __async(this, null, function* () {
|
|
3306
3266
|
const transaction = yield this.config.provider.connection.getTransaction(
|
|
3307
3267
|
signature,
|
|
@@ -3311,7 +3271,11 @@ var SolanaConnector = class {
|
|
|
3311
3271
|
}
|
|
3312
3272
|
);
|
|
3313
3273
|
if (transaction && this.program) {
|
|
3314
|
-
|
|
3274
|
+
if (transactionType == "buy") {
|
|
3275
|
+
return analyzeBuyTransaction(this.program, transaction);
|
|
3276
|
+
} else if (transactionType == "sell") {
|
|
3277
|
+
return analyzeSellTransaction(this.program, transaction);
|
|
3278
|
+
}
|
|
3315
3279
|
}
|
|
3316
3280
|
return [];
|
|
3317
3281
|
});
|
|
@@ -3420,7 +3384,11 @@ var FlipmemeSDK = class {
|
|
|
3420
3384
|
createMerkle(collectionId, maxBufferSize, maxDepth) {
|
|
3421
3385
|
return __async(this, null, function* () {
|
|
3422
3386
|
if (this.blockchainType === "solana" /* SOLANA */ && this.solana) {
|
|
3423
|
-
return yield this.solana.createMerkle(
|
|
3387
|
+
return yield this.solana.createMerkle(
|
|
3388
|
+
collectionId,
|
|
3389
|
+
maxBufferSize,
|
|
3390
|
+
maxDepth
|
|
3391
|
+
);
|
|
3424
3392
|
} else {
|
|
3425
3393
|
throw new Error("Cannot call this function");
|
|
3426
3394
|
}
|
|
@@ -3445,10 +3413,10 @@ var FlipmemeSDK = class {
|
|
|
3445
3413
|
}
|
|
3446
3414
|
});
|
|
3447
3415
|
}
|
|
3448
|
-
getTransactionTest(signature) {
|
|
3416
|
+
getTransactionTest(signature, transactionType) {
|
|
3449
3417
|
return __async(this, null, function* () {
|
|
3450
3418
|
if (this.blockchainType === "solana" /* SOLANA */ && this.solana) {
|
|
3451
|
-
return this.solana.getTransactionTest(signature);
|
|
3419
|
+
return this.solana.getTransactionTest(signature, transactionType);
|
|
3452
3420
|
} else {
|
|
3453
3421
|
throw new Error("Cannot call this function");
|
|
3454
3422
|
}
|
|
@@ -3551,7 +3519,7 @@ var Utility = class {
|
|
|
3551
3519
|
0 && (module.exports = {
|
|
3552
3520
|
BlockchainType,
|
|
3553
3521
|
FlipmemeSDK,
|
|
3554
|
-
|
|
3522
|
+
PurcahseType,
|
|
3555
3523
|
Utility,
|
|
3556
3524
|
isEthereumConfig,
|
|
3557
3525
|
isSolanaConfig
|