diff --git a/contracts/openEditionMinter/contract.ts b/contracts/openEditionMinter/contract.ts index 25838c4..9db36b6 100644 --- a/contracts/openEditionMinter/contract.ts +++ b/contracts/openEditionMinter/contract.ts @@ -28,13 +28,18 @@ export interface OpenEditionMinterInstance { //Query getConfig: () => Promise getStartTime: () => Promise + getEndTime: () => Promise getMintPrice: () => Promise getMintCount: (address: string) => Promise + getTotalMintCount: () => Promise getStatus: () => Promise //Execute mint: (senderAddress: string) => Promise purge: (senderAddress: string) => Promise + updateMintPrice: (senderAddress: string, price: string) => Promise + updateStartTime: (senderAddress: string, time: Timestamp) => Promise + updateEndTime: (senderAddress: string, time: Timestamp) => Promise updateStartTradingTime: (senderAddress: string, time?: Timestamp) => Promise updatePerAddressLimit: (senderAddress: string, perAddressLimit: number) => Promise mintTo: (senderAddress: string, recipient: string) => Promise @@ -45,6 +50,9 @@ export interface OpenEditionMinterInstance { export interface OpenEditionMinterMessages { mint: () => MintMessage purge: () => PurgeMessage + updateMintPrice: (price: string) => UpdateMintPriceMessage + updateStartTime: (time: Timestamp) => UpdateStartTimeMessage + updateEndTime: (time: Timestamp) => UpdateEndTimeMessage updateStartTradingTime: (time: Timestamp) => UpdateStartTradingTimeMessage updatePerAddressLimit: (perAddressLimit: number) => UpdatePerAddressLimitMessage mintTo: (recipient: string) => MintToMessage @@ -79,6 +87,35 @@ export interface UpdateStartTradingTimeMessage { funds: Coin[] } +export interface UpdateStartTimeMessage { + sender: string + contract: string + msg: { + update_start_time: string + } + funds: Coin[] +} + +export interface UpdateEndTimeMessage { + sender: string + contract: string + msg: { + update_end_time: string + } + funds: Coin[] +} + +export interface UpdateMintPriceMessage { + sender: string + contract: string + msg: { + update_mint_price: { + price: string + } + } + funds: Coin[] +} + export interface UpdatePerAddressLimitMessage { sender: string contract: string @@ -162,6 +199,13 @@ export const openEditionMinter = (client: SigningCosmWasmClient, txSigner: strin return res } + const getEndTime = async (): Promise => { + const res = await client.queryContractSmart(contractAddress, { + end_time: {}, + }) + return res + } + const getMintPrice = async (): Promise => { const res = await client.queryContractSmart(contractAddress, { mint_price: {}, @@ -176,6 +220,13 @@ export const openEditionMinter = (client: SigningCosmWasmClient, txSigner: strin return res } + const getTotalMintCount = async (): Promise => { + const res = await client.queryContractSmart(contractAddress, { + total_mint_count: {}, + }) + return res + } + const getStatus = async (): Promise => { const res = await client.queryContractSmart(contractAddress, { status: {}, @@ -228,6 +279,50 @@ export const openEditionMinter = (client: SigningCosmWasmClient, txSigner: strin return res.transactionHash } + const updateStartTime = async (senderAddress: string, time: Timestamp): Promise => { + const res = await client.execute( + senderAddress, + contractAddress, + { + update_start_time: time, + }, + 'auto', + '', + ) + + return res.transactionHash + } + + const updateEndTime = async (senderAddress: string, time: Timestamp): Promise => { + const res = await client.execute( + senderAddress, + contractAddress, + { + update_end_time: time, + }, + 'auto', + '', + ) + + return res.transactionHash + } + + const updateMintPrice = async (senderAddress: string, price: string): Promise => { + const res = await client.execute( + senderAddress, + contractAddress, + { + update_mint_price: { + price: (Number(price) * 1000000).toString(), + }, + }, + 'auto', + '', + ) + + return res.transactionHash + } + const updatePerAddressLimit = async (senderAddress: string, perAddressLimit: number): Promise => { const res = await client.execute( senderAddress, @@ -306,12 +401,17 @@ export const openEditionMinter = (client: SigningCosmWasmClient, txSigner: strin contractAddress, getConfig, getStartTime, + getEndTime, getMintPrice, getMintCount, + getTotalMintCount, getStatus, mint, purge, updateStartTradingTime, + updateStartTime, + updateEndTime, + updateMintPrice, updatePerAddressLimit, mintTo, batchMint, @@ -383,6 +483,41 @@ export const openEditionMinter = (client: SigningCosmWasmClient, txSigner: strin } } + const updateStartTime = (startTime: string): UpdateStartTimeMessage => { + return { + sender: txSigner, + contract: contractAddress, + msg: { + update_start_time: startTime, + }, + funds: [], + } + } + + const updateEndTime = (endTime: string): UpdateEndTimeMessage => { + return { + sender: txSigner, + contract: contractAddress, + msg: { + update_end_time: endTime, + }, + funds: [], + } + } + + const updateMintPrice = (price: string): UpdateMintPriceMessage => { + return { + sender: txSigner, + contract: contractAddress, + msg: { + update_mint_price: { + price: (Number(price) * 1000000).toString(), + }, + }, + funds: [], + } + } + const updatePerAddressLimit = (limit: number): UpdatePerAddressLimitMessage => { return { sender: txSigner, @@ -439,6 +574,9 @@ export const openEditionMinter = (client: SigningCosmWasmClient, txSigner: strin mint, purge, updateStartTradingTime, + updateStartTime, + updateEndTime, + updateMintPrice, updatePerAddressLimit, mintTo, batchMint,