File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " dropkit.js" ,
3- "version" : " 0.0.12 " ,
3+ "version" : " 0.0.13 " ,
44 "description" : " NiftyKit.js SDK" ,
55 "main" : " dist/cjs/index.js" ,
66 "module" : " dist/esm/index.js" ,
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export default class DropKit {
3636 contract : Contract = { } as Contract
3737 walletAddress ?: string
3838 version : number
39+ maxSupply ?: number
3940 provider : Web3Provider = { } as Web3Provider
4041 signer : JsonRpcSigner = { } as JsonRpcSigner
4142 ethInstance : any
@@ -55,6 +56,7 @@ export default class DropKit {
5556 this . dev = isDev
5657 this . address = ''
5758 this . version = 0
59+ this . maxSupply = 0
5860 }
5961
6062 async init ( providerOptions : IProviderOptions ) : Promise < DropApiResponse > {
@@ -83,6 +85,7 @@ export default class DropKit {
8385 this . version = data . version
8486 this . networkName = data . networkName
8587 this . chainId = data . chainId
88+ this . maxSupply = data . version <= 3 ? data . maxAmount : 0
8689 const abi = abis [ data . version || 1 ]
8790
8891 const web3Modal = new Web3Modal ( {
@@ -139,6 +142,16 @@ export default class DropKit {
139142 return dropPrice
140143 }
141144
145+ async maxAmount ( ) : Promise < number > {
146+ if ( this . version <= 3 ) {
147+ return this . maxSupply || 0
148+ }
149+
150+ const dropMaxAmount = await this . contract . maxAmount ( )
151+
152+ return dropMaxAmount . toNumber ( )
153+ }
154+
142155 async maxPerMint ( ) : Promise < number > {
143156 const maxMint : BigNumber =
144157 this . version <= 3
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export type DropApiResponse = {
88 version : number
99 chainId : number
1010 networkName : string
11+ maxAmount ?: number
1112}
1213
1314export type ErrorApiResponse = {
You can’t perform that action at this time.
0 commit comments