From 4d9ba5a76d88f44b5b5b86a5bbe664153eff88e6 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sat, 18 Mar 2023 11:34:23 +0300 Subject: [PATCH] Add AdminList among WL Query Types --- contracts/whitelist/contract.ts | 8 ++++++++ contracts/whitelist/messages/query.ts | 13 ++++++++++++- pages/contracts/whitelist/query.tsx | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/contracts/whitelist/contract.ts b/contracts/whitelist/contract.ts index dadc083..2dee2e1 100644 --- a/contracts/whitelist/contract.ts +++ b/contracts/whitelist/contract.ts @@ -24,6 +24,7 @@ export interface WhiteListInstance { isActive: () => Promise members: (startAfter?: string, limit?: number) => Promise hasMember: (member: string) => Promise + adminList: () => Promise config: () => Promise //Execute @@ -149,6 +150,12 @@ export const WhiteList = (client: SigningCosmWasmClient, txSigner: string): Whit }) } + const adminList = async (): Promise => { + return client.queryContractSmart(contractAddress, { + admin_list: {}, + }) + } + const config = async (): Promise => { return client.queryContractSmart(contractAddress, { config: {}, @@ -233,6 +240,7 @@ export const WhiteList = (client: SigningCosmWasmClient, txSigner: string): Whit isActive, members, hasMember, + adminList, config, } } diff --git a/contracts/whitelist/messages/query.ts b/contracts/whitelist/messages/query.ts index 652e801..a33ca61 100644 --- a/contracts/whitelist/messages/query.ts +++ b/contracts/whitelist/messages/query.ts @@ -2,7 +2,15 @@ import type { WhiteListInstance } from '../contract' export type QueryType = typeof QUERY_TYPES[number] -export const QUERY_TYPES = ['has_started', 'has_ended', 'is_active', 'members', 'has_member', 'config'] as const +export const QUERY_TYPES = [ + 'has_started', + 'has_ended', + 'is_active', + 'members', + 'admin_list', + 'has_member', + 'config', +] as const export interface QueryListItem { id: QueryType @@ -15,6 +23,7 @@ export const QUERY_LIST: QueryListItem[] = [ { id: 'has_ended', name: 'Has Ended', description: 'Check if the whitelist minting has ended' }, { id: 'is_active', name: 'Is Active', description: 'Check if the whitelist minting is active' }, { id: 'members', name: 'Members', description: 'View the whitelist members' }, + { id: 'admin_list', name: 'Admin List', description: 'View the whitelist admin list' }, { id: 'has_member', name: 'Has Member', description: 'Check if a member is in the whitelist' }, { id: 'config', name: 'Config', description: 'View the whitelist configuration' }, ] @@ -36,6 +45,8 @@ export const dispatchQuery = (props: DispatchQueryProps) => { return messages?.isActive() case 'members': return messages?.members() + case 'admin_list': + return messages?.adminList() case 'has_member': return messages?.hasMember(address) case 'config': diff --git a/pages/contracts/whitelist/query.tsx b/pages/contracts/whitelist/query.tsx index bb0ffee..2555b9f 100644 --- a/pages/contracts/whitelist/query.tsx +++ b/pages/contracts/whitelist/query.tsx @@ -108,7 +108,7 @@ const WhitelistQueryPage: NextPage = () => { onChange={(e) => setType(e.target.value as QueryType)} > {QUERY_LIST.map(({ id, name }) => ( - ))}