flipmeme-sdk 1.3.21 → 1.3.23

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 CHANGED
@@ -2,14 +2,15 @@ import { AnchorProvider } from '@coral-xyz/anchor';
2
2
  import { SendTransactionOptions } from '@solana/wallet-adapter-base';
3
3
  import BN from 'bn.js';
4
4
  import { PublicKey, Transaction, VersionedTransaction, Connection, TransactionSignature, Keypair } from '@solana/web3.js';
5
+ import { Signer } from 'ethers';
6
+ import Decimal from 'decimal.js';
5
7
 
6
8
  declare enum BlockchainType {
7
9
  SOLANA = "solana",
8
10
  ETHEREUM = "ethereum"
9
11
  }
10
12
  interface EthereumConfig {
11
- rpcUrl: string;
12
- privateKey?: string;
13
+ signer: Signer;
13
14
  chainId: number;
14
15
  }
15
16
  interface SolanaConfig {
@@ -23,6 +24,8 @@ interface CollectionParams {
23
24
  name: string;
24
25
  tokenUri: string;
25
26
  totalSupply: number;
27
+ symbol?: string;
28
+ premint?: number;
26
29
  }
27
30
  interface CreateCollectionResponse {
28
31
  collectionId: string;
@@ -32,6 +35,10 @@ interface SellData {
32
35
  tokenIds: string[];
33
36
  collectionInfo: CollectionInfo;
34
37
  }
38
+ interface EthSellData {
39
+ tokenIds: number[];
40
+ collectionInfo: string;
41
+ }
35
42
  interface ReserveToken {
36
43
  buy: string[] | null;
37
44
  mintAndBuy: string[] | null;
@@ -42,6 +49,17 @@ interface BuyParams {
42
49
  reserveToken: ReserveToken | null;
43
50
  slippage: number;
44
51
  }
52
+ /**
53
+ * buy param for mint and buy or buy
54
+ * if baseUri is null means the param is used for buy from liquidity pool
55
+ * and in this case amount should be 0;
56
+ */
57
+ interface EthBuyParams {
58
+ collectionAddress: string;
59
+ baseUri?: string;
60
+ amount: number;
61
+ tokenIds: number[];
62
+ }
45
63
  interface NftInfo {
46
64
  nftId: string;
47
65
  nftOnwer: string;
@@ -105,10 +123,18 @@ interface SellParams {
105
123
  slippage: number;
106
124
  ownedTokens: string[];
107
125
  }
126
+ interface EthSellParams {
127
+ collectionAddress: string;
128
+ tokenIds: number[];
129
+ }
108
130
  interface ProfileSellParams {
109
131
  data: Record<string, SellData>;
110
132
  slippage: number;
111
133
  }
134
+ interface EthProfileSellParams {
135
+ data: Record<string, EthSellData>;
136
+ slippage: number;
137
+ }
112
138
  declare function isEthereumConfig(config: EthereumConfig | SolanaConfig): config is EthereumConfig;
113
139
  declare function isSolanaConfig(config: EthereumConfig | SolanaConfig): config is SolanaConfig;
114
140
  interface TransferParams {
@@ -175,6 +201,13 @@ interface AssetInfo {
175
201
  assetData: AssetData;
176
202
  assetProof: MerkleProof;
177
203
  }
204
+ interface ETHAddresses {
205
+ TREASURY: string;
206
+ LP_SELL_OUT: string;
207
+ LP_PROVIDER: string;
208
+ ROYALTY: string;
209
+ FACTORY: string;
210
+ }
178
211
 
179
212
  declare const SOLANA_MAIN: {
180
213
  LOOKUP_TABLE_STR: string;
@@ -195,7 +228,6 @@ declare const SOLANA_COMMON: {
195
228
  LP_PROVISIONER_ID: PublicKey;
196
229
  ROYALITY_ID: PublicKey;
197
230
  MPL_CORE: PublicKey;
198
- REFERRAL_ID: PublicKey;
199
231
  ADMIN_FOR_CREDIT_BUY: PublicKey;
200
232
  RENT_TOKEN_ID: PublicKey;
201
233
  SYSTEM_PROGRAM_ID: PublicKey;
@@ -220,12 +252,12 @@ declare const SOLANA_PUBKEYS: {
220
252
  LP_PROVISIONER_ID: PublicKey;
221
253
  ROYALITY_ID: PublicKey;
222
254
  MPL_CORE: PublicKey;
223
- REFERRAL_ID: PublicKey;
224
255
  ADMIN_FOR_CREDIT_BUY: PublicKey;
225
256
  RENT_TOKEN_ID: PublicKey;
226
257
  SYSTEM_PROGRAM_ID: PublicKey;
227
258
  LOOKUP_TABLE: PublicKey;
228
259
  STATE_ID: PublicKey;
260
+ REFERRAL_ID: PublicKey;
229
261
  };
230
262
  declare const SOLANA_PUBKEYS_DEV: {
231
263
  UPDATE_AUTHORITY_ID: PublicKey;
@@ -234,12 +266,12 @@ declare const SOLANA_PUBKEYS_DEV: {
234
266
  LP_PROVISIONER_ID: PublicKey;
235
267
  ROYALITY_ID: PublicKey;
236
268
  MPL_CORE: PublicKey;
237
- REFERRAL_ID: PublicKey;
238
269
  ADMIN_FOR_CREDIT_BUY: PublicKey;
239
270
  RENT_TOKEN_ID: PublicKey;
240
271
  SYSTEM_PROGRAM_ID: PublicKey;
241
272
  LOOKUP_TABLE: PublicKey;
242
273
  STATE_ID: PublicKey;
274
+ REFERRAL_ID: PublicKey;
243
275
  };
244
276
  declare const SOLANA_PUBKEYS_STAGE: {
245
277
  UPDATE_AUTHORITY_ID: PublicKey;
@@ -248,12 +280,12 @@ declare const SOLANA_PUBKEYS_STAGE: {
248
280
  LP_PROVISIONER_ID: PublicKey;
249
281
  ROYALITY_ID: PublicKey;
250
282
  MPL_CORE: PublicKey;
251
- REFERRAL_ID: PublicKey;
252
283
  ADMIN_FOR_CREDIT_BUY: PublicKey;
253
284
  RENT_TOKEN_ID: PublicKey;
254
285
  SYSTEM_PROGRAM_ID: PublicKey;
255
286
  LOOKUP_TABLE: PublicKey;
256
287
  STATE_ID: PublicKey;
288
+ REFERRAL_ID: PublicKey;
257
289
  };
258
290
  declare const SDK_SOLANA_CONFIG: {
259
291
  MINT_CHUNK_SIZE: number;
@@ -352,6 +384,19 @@ declare const VALID_SIZE_PAIR: {
352
384
  maxDepth: number;
353
385
  };
354
386
  };
387
+ declare const ETH_COMMON: {
388
+ TREASURY: string;
389
+ LP_SELL_OUT: string;
390
+ LP_PROVIDER: string;
391
+ ROYALTY: string;
392
+ };
393
+ declare const ETH_DEV: {
394
+ TREASURY: string;
395
+ LP_SELL_OUT: string;
396
+ LP_PROVIDER: string;
397
+ ROYALTY: string;
398
+ FACTORY: string;
399
+ };
355
400
 
356
401
  declare class FlipmemeSDK {
357
402
  private blockchainType;
@@ -360,7 +405,7 @@ declare class FlipmemeSDK {
360
405
  constructor(chainType: BlockchainType, plateform: PLATFORM, config: EthereumConfig | SolanaConfig);
361
406
  updateConfig(chainType: BlockchainType, plateform: PLATFORM, config: EthereumConfig | SolanaConfig): void;
362
407
  createCollection(params: CollectionParams): Promise<CreateCollectionResponse>;
363
- buy(params: BuyParams): Promise<ConfirmResult>;
408
+ buy(params: BuyParams | EthBuyParams): Promise<ConfirmResult>;
364
409
  flipSell(params: SellParams): Promise<ConfirmResult>;
365
410
  profileSell(data: ProfileSellParams): Promise<ConfirmResult>;
366
411
  buyCredit(params: TransferParams): Promise<string>;
@@ -397,5 +442,6 @@ declare class FlipmemeSDK {
397
442
  declare function placeTensorCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string, tensorApiKey: string): Promise<String>;
398
443
 
399
444
  declare function decodeStr(str: string): string;
445
+ declare function getPrice(_mintCount: string, _nftCount: string, _steepness: string, _midPoint: string, _startPrice: string, _endPrice: string): Decimal;
400
446
 
401
- 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, PLATFORM, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, type SDKSignature, type SDKTransaction, SDK_SOLANA_CONFIG, SOLANA_COMMON, SOLANA_DEV, SOLANA_MAIN, SOLANA_PUBKEYS, SOLANA_PUBKEYS_DEV, SOLANA_PUBKEYS_STAGE, SOLANA_STAGE, type SellData, type SellParams, type SellResponse, type SolanaConfig, type TransferParams, VALID_SIZE_PAIR, decodeStr, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
447
+ 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 ETHAddresses, ETH_COMMON, ETH_DEV, type EthBuyParams, type EthProfileSellParams, type EthSellData, type EthSellParams, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NetworkAddress, type NftInfo, type Ownership, PLATFORM, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, type SDKSignature, type SDKTransaction, SDK_SOLANA_CONFIG, SOLANA_COMMON, SOLANA_DEV, SOLANA_MAIN, SOLANA_PUBKEYS, SOLANA_PUBKEYS_DEV, SOLANA_PUBKEYS_STAGE, SOLANA_STAGE, type SellData, type SellParams, type SellResponse, type SolanaConfig, type TransferParams, VALID_SIZE_PAIR, decodeStr, getPrice, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
package/dist/index.d.ts CHANGED
@@ -2,14 +2,15 @@ import { AnchorProvider } from '@coral-xyz/anchor';
2
2
  import { SendTransactionOptions } from '@solana/wallet-adapter-base';
3
3
  import BN from 'bn.js';
4
4
  import { PublicKey, Transaction, VersionedTransaction, Connection, TransactionSignature, Keypair } from '@solana/web3.js';
5
+ import { Signer } from 'ethers';
6
+ import Decimal from 'decimal.js';
5
7
 
6
8
  declare enum BlockchainType {
7
9
  SOLANA = "solana",
8
10
  ETHEREUM = "ethereum"
9
11
  }
10
12
  interface EthereumConfig {
11
- rpcUrl: string;
12
- privateKey?: string;
13
+ signer: Signer;
13
14
  chainId: number;
14
15
  }
15
16
  interface SolanaConfig {
@@ -23,6 +24,8 @@ interface CollectionParams {
23
24
  name: string;
24
25
  tokenUri: string;
25
26
  totalSupply: number;
27
+ symbol?: string;
28
+ premint?: number;
26
29
  }
27
30
  interface CreateCollectionResponse {
28
31
  collectionId: string;
@@ -32,6 +35,10 @@ interface SellData {
32
35
  tokenIds: string[];
33
36
  collectionInfo: CollectionInfo;
34
37
  }
38
+ interface EthSellData {
39
+ tokenIds: number[];
40
+ collectionInfo: string;
41
+ }
35
42
  interface ReserveToken {
36
43
  buy: string[] | null;
37
44
  mintAndBuy: string[] | null;
@@ -42,6 +49,17 @@ interface BuyParams {
42
49
  reserveToken: ReserveToken | null;
43
50
  slippage: number;
44
51
  }
52
+ /**
53
+ * buy param for mint and buy or buy
54
+ * if baseUri is null means the param is used for buy from liquidity pool
55
+ * and in this case amount should be 0;
56
+ */
57
+ interface EthBuyParams {
58
+ collectionAddress: string;
59
+ baseUri?: string;
60
+ amount: number;
61
+ tokenIds: number[];
62
+ }
45
63
  interface NftInfo {
46
64
  nftId: string;
47
65
  nftOnwer: string;
@@ -105,10 +123,18 @@ interface SellParams {
105
123
  slippage: number;
106
124
  ownedTokens: string[];
107
125
  }
126
+ interface EthSellParams {
127
+ collectionAddress: string;
128
+ tokenIds: number[];
129
+ }
108
130
  interface ProfileSellParams {
109
131
  data: Record<string, SellData>;
110
132
  slippage: number;
111
133
  }
134
+ interface EthProfileSellParams {
135
+ data: Record<string, EthSellData>;
136
+ slippage: number;
137
+ }
112
138
  declare function isEthereumConfig(config: EthereumConfig | SolanaConfig): config is EthereumConfig;
113
139
  declare function isSolanaConfig(config: EthereumConfig | SolanaConfig): config is SolanaConfig;
114
140
  interface TransferParams {
@@ -175,6 +201,13 @@ interface AssetInfo {
175
201
  assetData: AssetData;
176
202
  assetProof: MerkleProof;
177
203
  }
204
+ interface ETHAddresses {
205
+ TREASURY: string;
206
+ LP_SELL_OUT: string;
207
+ LP_PROVIDER: string;
208
+ ROYALTY: string;
209
+ FACTORY: string;
210
+ }
178
211
 
179
212
  declare const SOLANA_MAIN: {
180
213
  LOOKUP_TABLE_STR: string;
@@ -195,7 +228,6 @@ declare const SOLANA_COMMON: {
195
228
  LP_PROVISIONER_ID: PublicKey;
196
229
  ROYALITY_ID: PublicKey;
197
230
  MPL_CORE: PublicKey;
198
- REFERRAL_ID: PublicKey;
199
231
  ADMIN_FOR_CREDIT_BUY: PublicKey;
200
232
  RENT_TOKEN_ID: PublicKey;
201
233
  SYSTEM_PROGRAM_ID: PublicKey;
@@ -220,12 +252,12 @@ declare const SOLANA_PUBKEYS: {
220
252
  LP_PROVISIONER_ID: PublicKey;
221
253
  ROYALITY_ID: PublicKey;
222
254
  MPL_CORE: PublicKey;
223
- REFERRAL_ID: PublicKey;
224
255
  ADMIN_FOR_CREDIT_BUY: PublicKey;
225
256
  RENT_TOKEN_ID: PublicKey;
226
257
  SYSTEM_PROGRAM_ID: PublicKey;
227
258
  LOOKUP_TABLE: PublicKey;
228
259
  STATE_ID: PublicKey;
260
+ REFERRAL_ID: PublicKey;
229
261
  };
230
262
  declare const SOLANA_PUBKEYS_DEV: {
231
263
  UPDATE_AUTHORITY_ID: PublicKey;
@@ -234,12 +266,12 @@ declare const SOLANA_PUBKEYS_DEV: {
234
266
  LP_PROVISIONER_ID: PublicKey;
235
267
  ROYALITY_ID: PublicKey;
236
268
  MPL_CORE: PublicKey;
237
- REFERRAL_ID: PublicKey;
238
269
  ADMIN_FOR_CREDIT_BUY: PublicKey;
239
270
  RENT_TOKEN_ID: PublicKey;
240
271
  SYSTEM_PROGRAM_ID: PublicKey;
241
272
  LOOKUP_TABLE: PublicKey;
242
273
  STATE_ID: PublicKey;
274
+ REFERRAL_ID: PublicKey;
243
275
  };
244
276
  declare const SOLANA_PUBKEYS_STAGE: {
245
277
  UPDATE_AUTHORITY_ID: PublicKey;
@@ -248,12 +280,12 @@ declare const SOLANA_PUBKEYS_STAGE: {
248
280
  LP_PROVISIONER_ID: PublicKey;
249
281
  ROYALITY_ID: PublicKey;
250
282
  MPL_CORE: PublicKey;
251
- REFERRAL_ID: PublicKey;
252
283
  ADMIN_FOR_CREDIT_BUY: PublicKey;
253
284
  RENT_TOKEN_ID: PublicKey;
254
285
  SYSTEM_PROGRAM_ID: PublicKey;
255
286
  LOOKUP_TABLE: PublicKey;
256
287
  STATE_ID: PublicKey;
288
+ REFERRAL_ID: PublicKey;
257
289
  };
258
290
  declare const SDK_SOLANA_CONFIG: {
259
291
  MINT_CHUNK_SIZE: number;
@@ -352,6 +384,19 @@ declare const VALID_SIZE_PAIR: {
352
384
  maxDepth: number;
353
385
  };
354
386
  };
387
+ declare const ETH_COMMON: {
388
+ TREASURY: string;
389
+ LP_SELL_OUT: string;
390
+ LP_PROVIDER: string;
391
+ ROYALTY: string;
392
+ };
393
+ declare const ETH_DEV: {
394
+ TREASURY: string;
395
+ LP_SELL_OUT: string;
396
+ LP_PROVIDER: string;
397
+ ROYALTY: string;
398
+ FACTORY: string;
399
+ };
355
400
 
356
401
  declare class FlipmemeSDK {
357
402
  private blockchainType;
@@ -360,7 +405,7 @@ declare class FlipmemeSDK {
360
405
  constructor(chainType: BlockchainType, plateform: PLATFORM, config: EthereumConfig | SolanaConfig);
361
406
  updateConfig(chainType: BlockchainType, plateform: PLATFORM, config: EthereumConfig | SolanaConfig): void;
362
407
  createCollection(params: CollectionParams): Promise<CreateCollectionResponse>;
363
- buy(params: BuyParams): Promise<ConfirmResult>;
408
+ buy(params: BuyParams | EthBuyParams): Promise<ConfirmResult>;
364
409
  flipSell(params: SellParams): Promise<ConfirmResult>;
365
410
  profileSell(data: ProfileSellParams): Promise<ConfirmResult>;
366
411
  buyCredit(params: TransferParams): Promise<string>;
@@ -397,5 +442,6 @@ declare class FlipmemeSDK {
397
442
  declare function placeTensorCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string, tensorApiKey: string): Promise<String>;
398
443
 
399
444
  declare function decodeStr(str: string): string;
445
+ declare function getPrice(_mintCount: string, _nftCount: string, _steepness: string, _midPoint: string, _startPrice: string, _endPrice: string): Decimal;
400
446
 
401
- 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, PLATFORM, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, type SDKSignature, type SDKTransaction, SDK_SOLANA_CONFIG, SOLANA_COMMON, SOLANA_DEV, SOLANA_MAIN, SOLANA_PUBKEYS, SOLANA_PUBKEYS_DEV, SOLANA_PUBKEYS_STAGE, SOLANA_STAGE, type SellData, type SellParams, type SellResponse, type SolanaConfig, type TransferParams, VALID_SIZE_PAIR, decodeStr, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };
447
+ 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 ETHAddresses, ETH_COMMON, ETH_DEV, type EthBuyParams, type EthProfileSellParams, type EthSellData, type EthSellParams, type EthereumConfig, FlipmemeSDK, type MerkleProof, type NetworkAddress, type NftInfo, type Ownership, PLATFORM, type ProfileSellParams, PurcahseType, RPC, type ReserveToken, type SDKSignature, type SDKTransaction, SDK_SOLANA_CONFIG, SOLANA_COMMON, SOLANA_DEV, SOLANA_MAIN, SOLANA_PUBKEYS, SOLANA_PUBKEYS_DEV, SOLANA_PUBKEYS_STAGE, SOLANA_STAGE, type SellData, type SellParams, type SellResponse, type SolanaConfig, type TransferParams, VALID_SIZE_PAIR, decodeStr, getPrice, isEthereumConfig, isSolanaConfig, placeTensorCollectionBid };