flipmeme-sdk 1.0.11 → 1.0.12

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
@@ -1,6 +1,8 @@
1
+ import * as bn_js from 'bn.js';
2
+ import * as _solana_web3_js from '@solana/web3.js';
3
+ import { PublicKey, Transaction, VersionedTransaction, Connection, TransactionSignature } from '@solana/web3.js';
1
4
  import { AnchorProvider } from '@coral-xyz/anchor';
2
5
  import { SendTransactionOptions } from '@solana/wallet-adapter-base';
3
- import { PublicKey, Transaction, VersionedTransaction, Connection, TransactionSignature } from '@solana/web3.js';
4
6
 
5
7
  declare enum BlockchainType {
6
8
  SOLANA = "solana",
@@ -22,11 +24,8 @@ interface SolanaConfig {
22
24
  }
23
25
  interface CollectionParams {
24
26
  name: string;
25
- symbol: string;
26
27
  tokenUri: string;
27
28
  totalSupply: number;
28
- collectionId: string;
29
- collectionAddress: string;
30
29
  }
31
30
  interface NFTTradingData {
32
31
  name: string;
@@ -75,6 +74,41 @@ declare class FlipmemeSDK {
75
74
  flipSell(params: SellParams): Promise<void>;
76
75
  profileSell(data: ProfileSellParams): Promise<void>;
77
76
  buyCredit(params: BuyCreditParams): Promise<string>;
77
+ /**For testing */
78
+ getStateInfo(): Promise<{
79
+ admin: _solana_web3_js.PublicKey;
80
+ treasury: _solana_web3_js.PublicKey;
81
+ lpProvisioner: _solana_web3_js.PublicKey;
82
+ collectionCount: number;
83
+ protocolFeeBps: number;
84
+ sellerFeeBasisPoints: number;
85
+ }>;
86
+ getCollectionInfo(collectionId: string): Promise<{
87
+ collectionInfo: {
88
+ pool: {
89
+ currentPrice: bn_js;
90
+ startPrice: bn_js;
91
+ endPrice: bn_js;
92
+ nftCount: number;
93
+ steepness: number;
94
+ midPoint: number;
95
+ padding: number[];
96
+ };
97
+ creator: _solana_web3_js.PublicKey;
98
+ totalSol: bn_js;
99
+ totalSupply: number;
100
+ mintCount: number;
101
+ id: number;
102
+ sellerFeeBasisPoints: number;
103
+ protocolFeeBps: number;
104
+ isSoldOut: number;
105
+ isPaused: number;
106
+ bump: number;
107
+ collectionNftBump: number;
108
+ padding: number[];
109
+ };
110
+ collectionAddress: _solana_web3_js.PublicKey;
111
+ }>;
78
112
  }
79
113
 
80
114
  export { BlockchainType, type BuyCreditParams, type BuyParams, type CollectionInfo, type CollectionParams, type EthereumConfig, FlipmemeSDK, type NFTTradingData, type ProfileSellParams, type ReserveToken, type SellParams, type SolanaConfig, isEthereumConfig, isSolanaConfig };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ import * as bn_js from 'bn.js';
2
+ import * as _solana_web3_js from '@solana/web3.js';
3
+ import { PublicKey, Transaction, VersionedTransaction, Connection, TransactionSignature } from '@solana/web3.js';
1
4
  import { AnchorProvider } from '@coral-xyz/anchor';
2
5
  import { SendTransactionOptions } from '@solana/wallet-adapter-base';
3
- import { PublicKey, Transaction, VersionedTransaction, Connection, TransactionSignature } from '@solana/web3.js';
4
6
 
5
7
  declare enum BlockchainType {
6
8
  SOLANA = "solana",
@@ -22,11 +24,8 @@ interface SolanaConfig {
22
24
  }
23
25
  interface CollectionParams {
24
26
  name: string;
25
- symbol: string;
26
27
  tokenUri: string;
27
28
  totalSupply: number;
28
- collectionId: string;
29
- collectionAddress: string;
30
29
  }
31
30
  interface NFTTradingData {
32
31
  name: string;
@@ -75,6 +74,41 @@ declare class FlipmemeSDK {
75
74
  flipSell(params: SellParams): Promise<void>;
76
75
  profileSell(data: ProfileSellParams): Promise<void>;
77
76
  buyCredit(params: BuyCreditParams): Promise<string>;
77
+ /**For testing */
78
+ getStateInfo(): Promise<{
79
+ admin: _solana_web3_js.PublicKey;
80
+ treasury: _solana_web3_js.PublicKey;
81
+ lpProvisioner: _solana_web3_js.PublicKey;
82
+ collectionCount: number;
83
+ protocolFeeBps: number;
84
+ sellerFeeBasisPoints: number;
85
+ }>;
86
+ getCollectionInfo(collectionId: string): Promise<{
87
+ collectionInfo: {
88
+ pool: {
89
+ currentPrice: bn_js;
90
+ startPrice: bn_js;
91
+ endPrice: bn_js;
92
+ nftCount: number;
93
+ steepness: number;
94
+ midPoint: number;
95
+ padding: number[];
96
+ };
97
+ creator: _solana_web3_js.PublicKey;
98
+ totalSol: bn_js;
99
+ totalSupply: number;
100
+ mintCount: number;
101
+ id: number;
102
+ sellerFeeBasisPoints: number;
103
+ protocolFeeBps: number;
104
+ isSoldOut: number;
105
+ isPaused: number;
106
+ bump: number;
107
+ collectionNftBump: number;
108
+ padding: number[];
109
+ };
110
+ collectionAddress: _solana_web3_js.PublicKey;
111
+ }>;
78
112
  }
79
113
 
80
114
  export { BlockchainType, type BuyCreditParams, type BuyParams, type CollectionInfo, type CollectionParams, type EthereumConfig, FlipmemeSDK, type NFTTradingData, type ProfileSellParams, type ReserveToken, type SellParams, type SolanaConfig, isEthereumConfig, isSolanaConfig };
package/dist/index.js CHANGED
@@ -1471,7 +1471,6 @@ var SOLANA_PUBKEYS = {
1471
1471
  // src/solana/index.ts
1472
1472
  var import_web34 = require("@solana/web3.js");
1473
1473
  var import_bytes = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
1474
- var import_spl_token2 = require("@solana/spl-token");
1475
1474
  var import_bn = require("bn.js");
1476
1475
 
1477
1476
  // src/solana/accounts.ts
@@ -1614,28 +1613,6 @@ var SolanaConnector = class {
1614
1613
  [import_bytes.utf8.encode("collection_nft"), collection.toBuffer()],
1615
1614
  this.program.programId
1616
1615
  );
1617
- const [collectionMetadataPda] = import_web34.PublicKey.findProgramAddressSync(
1618
- [
1619
- Buffer.from("metadata"),
1620
- SOLANA_PUBKEYS.TOKEN_METADATA_PROGRAM_ID.toBuffer(),
1621
- collectionNftPda.toBuffer()
1622
- ],
1623
- SOLANA_PUBKEYS.TOKEN_METADATA_PROGRAM_ID
1624
- );
1625
- const [masterEditionMetadata] = import_web34.PublicKey.findProgramAddressSync(
1626
- [
1627
- Buffer.from("metadata"),
1628
- SOLANA_PUBKEYS.TOKEN_METADATA_PROGRAM_ID.toBuffer(),
1629
- collectionNftPda.toBuffer(),
1630
- Buffer.from("edition")
1631
- ],
1632
- SOLANA_PUBKEYS.TOKEN_METADATA_PROGRAM_ID
1633
- );
1634
- const collectionNftAuthorityAta = (0, import_spl_token2.getAssociatedTokenAddress)(
1635
- collectionNftPda,
1636
- collection,
1637
- true
1638
- );
1639
1616
  const { name, tokenUri, totalSupply } = params;
1640
1617
  const instruction = yield this.program.methods.createCollection(
1641
1618
  name,
@@ -1825,6 +1802,27 @@ var SolanaConnector = class {
1825
1802
  return yield this.config.sendTransaction(transaction, this.config.provider.connection);
1826
1803
  });
1827
1804
  }
1805
+ //for testing
1806
+ getStateInfo() {
1807
+ return __async(this, null, function* () {
1808
+ if (!this.program) {
1809
+ throw new Error("Program not initialized");
1810
+ }
1811
+ const state = yield this.program.account.state.fetch(SOLANA_PUBKEYS.STATE_ID);
1812
+ return state;
1813
+ });
1814
+ }
1815
+ //for testing
1816
+ getCollectionInfo(collectionId) {
1817
+ return __async(this, null, function* () {
1818
+ if (!this.program) {
1819
+ throw new Error("Program not initialized");
1820
+ }
1821
+ const collectionAddress = yield collectionPda(collectionId, this.program.programId);
1822
+ const collectionInfo = yield this.program.account.collection.fetch(collectionAddress);
1823
+ return { collectionInfo, collectionAddress };
1824
+ });
1825
+ }
1828
1826
  //useSenTxn.ts
1829
1827
  sendTxn(instructions) {
1830
1828
  return __async(this, null, function* () {
@@ -1949,6 +1947,9 @@ var SolanaConnector = class {
1949
1947
  const { nftPda: nftPda2, collectionPda: collectionPda2, nftHolderPda: nftHolderPda2 } = yield getNftAccounts(
1950
1948
  tokenId
1951
1949
  );
1950
+ console.log("nftPda", nftPda2);
1951
+ console.log("collectionPda", collectionPda2);
1952
+ console.log("nftHolderPda", nftHolderPda2);
1952
1953
  const instruction = yield this.program.methods.mintAndBuy(name, tokenURI).accountsStrict({
1953
1954
  state: SOLANA_PUBKEYS.STATE_ID,
1954
1955
  treasury: stateAccount.treasury,
@@ -2097,6 +2098,26 @@ var FlipmemeSDK = class {
2097
2098
  }
2098
2099
  });
2099
2100
  }
2101
+ /**For testing */
2102
+ getStateInfo() {
2103
+ return __async(this, null, function* () {
2104
+ if (this.blockchainType === "solana" /* SOLANA */ && this.solana) {
2105
+ return this.solana.getStateInfo();
2106
+ } else {
2107
+ throw new Error("Cannot call this function");
2108
+ }
2109
+ });
2110
+ }
2111
+ getCollectionInfo(collectionId) {
2112
+ return __async(this, null, function* () {
2113
+ if (this.blockchainType === "solana" /* SOLANA */ && this.solana) {
2114
+ return this.solana.getCollectionInfo(collectionId);
2115
+ } else {
2116
+ throw new Error("Cannot call this function");
2117
+ }
2118
+ });
2119
+ }
2120
+ /**For testing end */
2100
2121
  };
2101
2122
  // Annotate the CommonJS export names for ESM import in node:
2102
2123
  0 && (module.exports = {