flipmeme-sdk 1.3.26 → 1.3.28

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,15 +2,17 @@ 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, ethers, BigNumber } 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;
15
+ provider: ethers.providers.BaseProvider;
14
16
  }
15
17
  interface SolanaConfig {
16
18
  provider: AnchorProvider;
@@ -23,6 +25,8 @@ interface CollectionParams {
23
25
  name: string;
24
26
  tokenUri: string;
25
27
  totalSupply: number;
28
+ symbol?: string;
29
+ premint?: number;
26
30
  }
27
31
  interface CreateCollectionResponse {
28
32
  collectionId: string;
@@ -32,6 +36,10 @@ interface SellData {
32
36
  tokenIds: string[];
33
37
  collectionInfo: CollectionInfo;
34
38
  }
39
+ interface EthSellData {
40
+ tokenIds: number[];
41
+ collectionId: string;
42
+ }
35
43
  interface ReserveToken {
36
44
  buy: string[] | null;
37
45
  mintAndBuy: string[] | null;
@@ -42,6 +50,17 @@ interface BuyParams {
42
50
  reserveToken: ReserveToken | null;
43
51
  slippage: number;
44
52
  }
53
+ /**
54
+ * buy param for mint and buy or buy
55
+ * if baseUri is null means the param is used for buy from liquidity pool
56
+ * and in this case amount should be 0;
57
+ */
58
+ interface EthBuyParams {
59
+ collectionAddress: string;
60
+ baseUri?: string;
61
+ amount: number;
62
+ tokenIds: number[];
63
+ }
45
64
  interface NftInfo {
46
65
  nftId: string;
47
66
  nftOnwer: string;
@@ -105,10 +124,18 @@ interface SellParams {
105
124
  slippage: number;
106
125
  ownedTokens: string[];
107
126
  }
127
+ interface EthSellParams {
128
+ collectionAddress: string;
129
+ tokenIds: number[];
130
+ }
108
131
  interface ProfileSellParams {
109
132
  data: Record<string, SellData>;
110
133
  slippage: number;
111
134
  }
135
+ interface EthProfileSellParams {
136
+ data: Record<string, EthSellData>;
137
+ slippage: number;
138
+ }
112
139
  declare function isEthereumConfig(config: EthereumConfig | SolanaConfig): config is EthereumConfig;
113
140
  declare function isSolanaConfig(config: EthereumConfig | SolanaConfig): config is SolanaConfig;
114
141
  interface TransferParams {
@@ -175,6 +202,14 @@ interface AssetInfo {
175
202
  assetData: AssetData;
176
203
  assetProof: MerkleProof;
177
204
  }
205
+ interface ETHAddresses {
206
+ TREASURY: string;
207
+ LP_SELL_OUT: string;
208
+ LP_PROVIDER: string;
209
+ ROYALTY: string;
210
+ FACTORY: string;
211
+ PROTOCOL_FEE_BPS: number;
212
+ }
178
213
 
179
214
  declare const SOLANA_MAIN: {
180
215
  LOOKUP_TABLE_STR: string;
@@ -351,6 +386,25 @@ declare const VALID_SIZE_PAIR: {
351
386
  maxDepth: number;
352
387
  };
353
388
  };
389
+ declare const ETH_COMMON: {
390
+ TREASURY: string;
391
+ LP_SELL_OUT: string;
392
+ LP_PROVIDER: string;
393
+ ROYALTY: string;
394
+ ADMIN_FOR_CREDIT_BUY: string;
395
+ REFERRAL_CLAIM: string;
396
+ PROTOCOL_FEE_BPS: number;
397
+ };
398
+ declare const ETH_DEV: {
399
+ TREASURY: string;
400
+ LP_SELL_OUT: string;
401
+ LP_PROVIDER: string;
402
+ ROYALTY: string;
403
+ ADMIN_FOR_CREDIT_BUY: string;
404
+ REFERRAL_CLAIM: string;
405
+ PROTOCOL_FEE_BPS: number;
406
+ FACTORY: string;
407
+ };
354
408
 
355
409
  declare class FlipmemeSDK {
356
410
  private blockchainType;
@@ -359,9 +413,9 @@ declare class FlipmemeSDK {
359
413
  constructor(chainType: BlockchainType, plateform: PLATFORM, config: EthereumConfig | SolanaConfig);
360
414
  updateConfig(chainType: BlockchainType, plateform: PLATFORM, config: EthereumConfig | SolanaConfig): void;
361
415
  createCollection(params: CollectionParams): Promise<CreateCollectionResponse>;
362
- buy(params: BuyParams): Promise<ConfirmResult>;
363
- flipSell(params: SellParams): Promise<ConfirmResult>;
364
- profileSell(data: ProfileSellParams): Promise<ConfirmResult>;
416
+ buy(params: BuyParams | EthBuyParams): Promise<ConfirmResult>;
417
+ flipSell(params: SellParams | EthSellParams): Promise<ConfirmResult>;
418
+ profileSell(data: ProfileSellParams | EthProfileSellParams): Promise<ConfirmResult>;
365
419
  buyCredit(params: TransferParams): Promise<string>;
366
420
  getTotalPrice(type: PurcahseType, collectionId: string, amount: number): Promise<string>;
367
421
  /**
@@ -375,7 +429,7 @@ declare class FlipmemeSDK {
375
429
  claimReferralReward(params: TransferParams): Promise<void>;
376
430
  getConnectedAccount(): PublicKey;
377
431
  /**For testing */
378
- getStateInfo(): Promise<{
432
+ getStateInfo(): Promise<[string, BigNumber, string, BigNumber, BigNumber, string] | {
379
433
  admin: PublicKey;
380
434
  treasury: PublicKey;
381
435
  lpSellout: PublicKey;
@@ -385,7 +439,7 @@ declare class FlipmemeSDK {
385
439
  protocolFeeBps: number;
386
440
  sellerFeeBasisPoints: number;
387
441
  }>;
388
- getCollectionInfo(collectionId: string): Promise<CollectionInfo>;
442
+ getCollectionInfo(collectionId: string): Promise<CollectionInfo | [string, BigNumber, string, BigNumber, BigNumber, boolean, BigNumber, string, string, string]>;
389
443
  getTransactionTest(signature: string, transactionType?: string): Promise<BuyResponse[] | SellResponse[]>;
390
444
  getInstructionData(instruction: string): Promise<void>;
391
445
  }
@@ -396,10 +450,11 @@ declare class FlipmemeSDK {
396
450
  declare function placeTensorCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string, tensorApiKey: string): Promise<String>;
397
451
 
398
452
  declare function decodeStr(str: string): string;
453
+ declare function getPrice(_mintCount: string, _nftCount: string, _steepness: string, _midPoint: string, _startPrice: string, _endPrice: string): Decimal;
399
454
 
400
455
  /**
401
456
  * this function only works for solana mainnet. So don't need to get connection as parameter
402
457
  */
403
458
  declare function placeMagicEdenCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string, magicApiKey: string): Promise<String | undefined>;
404
459
 
405
- 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, placeMagicEdenCollectionBid, placeTensorCollectionBid };
460
+ 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, placeMagicEdenCollectionBid, placeTensorCollectionBid };
package/dist/index.d.ts CHANGED
@@ -2,15 +2,17 @@ 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, ethers, BigNumber } 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;
15
+ provider: ethers.providers.BaseProvider;
14
16
  }
15
17
  interface SolanaConfig {
16
18
  provider: AnchorProvider;
@@ -23,6 +25,8 @@ interface CollectionParams {
23
25
  name: string;
24
26
  tokenUri: string;
25
27
  totalSupply: number;
28
+ symbol?: string;
29
+ premint?: number;
26
30
  }
27
31
  interface CreateCollectionResponse {
28
32
  collectionId: string;
@@ -32,6 +36,10 @@ interface SellData {
32
36
  tokenIds: string[];
33
37
  collectionInfo: CollectionInfo;
34
38
  }
39
+ interface EthSellData {
40
+ tokenIds: number[];
41
+ collectionId: string;
42
+ }
35
43
  interface ReserveToken {
36
44
  buy: string[] | null;
37
45
  mintAndBuy: string[] | null;
@@ -42,6 +50,17 @@ interface BuyParams {
42
50
  reserveToken: ReserveToken | null;
43
51
  slippage: number;
44
52
  }
53
+ /**
54
+ * buy param for mint and buy or buy
55
+ * if baseUri is null means the param is used for buy from liquidity pool
56
+ * and in this case amount should be 0;
57
+ */
58
+ interface EthBuyParams {
59
+ collectionAddress: string;
60
+ baseUri?: string;
61
+ amount: number;
62
+ tokenIds: number[];
63
+ }
45
64
  interface NftInfo {
46
65
  nftId: string;
47
66
  nftOnwer: string;
@@ -105,10 +124,18 @@ interface SellParams {
105
124
  slippage: number;
106
125
  ownedTokens: string[];
107
126
  }
127
+ interface EthSellParams {
128
+ collectionAddress: string;
129
+ tokenIds: number[];
130
+ }
108
131
  interface ProfileSellParams {
109
132
  data: Record<string, SellData>;
110
133
  slippage: number;
111
134
  }
135
+ interface EthProfileSellParams {
136
+ data: Record<string, EthSellData>;
137
+ slippage: number;
138
+ }
112
139
  declare function isEthereumConfig(config: EthereumConfig | SolanaConfig): config is EthereumConfig;
113
140
  declare function isSolanaConfig(config: EthereumConfig | SolanaConfig): config is SolanaConfig;
114
141
  interface TransferParams {
@@ -175,6 +202,14 @@ interface AssetInfo {
175
202
  assetData: AssetData;
176
203
  assetProof: MerkleProof;
177
204
  }
205
+ interface ETHAddresses {
206
+ TREASURY: string;
207
+ LP_SELL_OUT: string;
208
+ LP_PROVIDER: string;
209
+ ROYALTY: string;
210
+ FACTORY: string;
211
+ PROTOCOL_FEE_BPS: number;
212
+ }
178
213
 
179
214
  declare const SOLANA_MAIN: {
180
215
  LOOKUP_TABLE_STR: string;
@@ -351,6 +386,25 @@ declare const VALID_SIZE_PAIR: {
351
386
  maxDepth: number;
352
387
  };
353
388
  };
389
+ declare const ETH_COMMON: {
390
+ TREASURY: string;
391
+ LP_SELL_OUT: string;
392
+ LP_PROVIDER: string;
393
+ ROYALTY: string;
394
+ ADMIN_FOR_CREDIT_BUY: string;
395
+ REFERRAL_CLAIM: string;
396
+ PROTOCOL_FEE_BPS: number;
397
+ };
398
+ declare const ETH_DEV: {
399
+ TREASURY: string;
400
+ LP_SELL_OUT: string;
401
+ LP_PROVIDER: string;
402
+ ROYALTY: string;
403
+ ADMIN_FOR_CREDIT_BUY: string;
404
+ REFERRAL_CLAIM: string;
405
+ PROTOCOL_FEE_BPS: number;
406
+ FACTORY: string;
407
+ };
354
408
 
355
409
  declare class FlipmemeSDK {
356
410
  private blockchainType;
@@ -359,9 +413,9 @@ declare class FlipmemeSDK {
359
413
  constructor(chainType: BlockchainType, plateform: PLATFORM, config: EthereumConfig | SolanaConfig);
360
414
  updateConfig(chainType: BlockchainType, plateform: PLATFORM, config: EthereumConfig | SolanaConfig): void;
361
415
  createCollection(params: CollectionParams): Promise<CreateCollectionResponse>;
362
- buy(params: BuyParams): Promise<ConfirmResult>;
363
- flipSell(params: SellParams): Promise<ConfirmResult>;
364
- profileSell(data: ProfileSellParams): Promise<ConfirmResult>;
416
+ buy(params: BuyParams | EthBuyParams): Promise<ConfirmResult>;
417
+ flipSell(params: SellParams | EthSellParams): Promise<ConfirmResult>;
418
+ profileSell(data: ProfileSellParams | EthProfileSellParams): Promise<ConfirmResult>;
365
419
  buyCredit(params: TransferParams): Promise<string>;
366
420
  getTotalPrice(type: PurcahseType, collectionId: string, amount: number): Promise<string>;
367
421
  /**
@@ -375,7 +429,7 @@ declare class FlipmemeSDK {
375
429
  claimReferralReward(params: TransferParams): Promise<void>;
376
430
  getConnectedAccount(): PublicKey;
377
431
  /**For testing */
378
- getStateInfo(): Promise<{
432
+ getStateInfo(): Promise<[string, BigNumber, string, BigNumber, BigNumber, string] | {
379
433
  admin: PublicKey;
380
434
  treasury: PublicKey;
381
435
  lpSellout: PublicKey;
@@ -385,7 +439,7 @@ declare class FlipmemeSDK {
385
439
  protocolFeeBps: number;
386
440
  sellerFeeBasisPoints: number;
387
441
  }>;
388
- getCollectionInfo(collectionId: string): Promise<CollectionInfo>;
442
+ getCollectionInfo(collectionId: string): Promise<CollectionInfo | [string, BigNumber, string, BigNumber, BigNumber, boolean, BigNumber, string, string, string]>;
389
443
  getTransactionTest(signature: string, transactionType?: string): Promise<BuyResponse[] | SellResponse[]>;
390
444
  getInstructionData(instruction: string): Promise<void>;
391
445
  }
@@ -396,10 +450,11 @@ declare class FlipmemeSDK {
396
450
  declare function placeTensorCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string, tensorApiKey: string): Promise<String>;
397
451
 
398
452
  declare function decodeStr(str: string): string;
453
+ declare function getPrice(_mintCount: string, _nftCount: string, _steepness: string, _midPoint: string, _startPrice: string, _endPrice: string): Decimal;
399
454
 
400
455
  /**
401
456
  * this function only works for solana mainnet. So don't need to get connection as parameter
402
457
  */
403
458
  declare function placeMagicEdenCollectionBid(price: number, quantity: number, collectionMint: string, privateKey: string, magicApiKey: string): Promise<String | undefined>;
404
459
 
405
- 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, placeMagicEdenCollectionBid, placeTensorCollectionBid };
460
+ 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, placeMagicEdenCollectionBid, placeTensorCollectionBid };