Skip to content

Commit

Permalink
Add TS interface & types for whitelist-updatable-flatrate
Browse files Browse the repository at this point in the history
  • Loading branch information
MightOfOaks committed Mar 27, 2024
1 parent 44a5172 commit 0079ca9
Show file tree
Hide file tree
Showing 2 changed files with 287 additions and 0 deletions.
217 changes: 217 additions & 0 deletions ts/src/WhitelistUpdatableFlatrate.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/

import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
import { Coin, StdFee } from "@cosmjs/amino";
import { InstantiateMsg, ExecuteMsg, QueryMsg, Uint64, AdminResponse, Addr, Config, Boolean, Nullableuint64 } from "./WhitelistUpdatableFlatrate.types";
export interface WhitelistUpdatableFlatrateReadOnlyInterface {
contractAddress: string;
config: () => Promise<Config>;
includesAddress: ({
address
}: {
address: string;
}) => Promise<Boolean>;
mintCount: ({
address
}: {
address: string;
}) => Promise<Uint64>;
isProcessable: ({
address
}: {
address: string;
}) => Promise<Boolean>;
admins: () => Promise<AdminResponse>;
addressCount: () => Promise<Uint64>;
perAddressLimit: () => Promise<Uint64>;
mintDiscountAmount: () => Promise<NullableUint64>;
}
export class WhitelistUpdatableFlatrateQueryClient implements WhitelistUpdatableFlatrateReadOnlyInterface {
client: CosmWasmClient;
contractAddress: string;

constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client;
this.contractAddress = contractAddress;
this.config = this.config.bind(this);
this.includesAddress = this.includesAddress.bind(this);
this.mintCount = this.mintCount.bind(this);
this.isProcessable = this.isProcessable.bind(this);
this.admins = this.admins.bind(this);
this.addressCount = this.addressCount.bind(this);
this.perAddressLimit = this.perAddressLimit.bind(this);
this.mintDiscountAmount = this.mintDiscountAmount.bind(this);
}

config = async (): Promise<Config> => {
return this.client.queryContractSmart(this.contractAddress, {
config: {}
});
};
includesAddress = async ({
address
}: {
address: string;
}): Promise<Boolean> => {
return this.client.queryContractSmart(this.contractAddress, {
includes_address: {
address
}
});
};
mintCount = async ({
address
}: {
address: string;
}): Promise<Uint64> => {
return this.client.queryContractSmart(this.contractAddress, {
mint_count: {
address
}
});
};
isProcessable = async ({
address
}: {
address: string;
}): Promise<Boolean> => {
return this.client.queryContractSmart(this.contractAddress, {
is_processable: {
address
}
});
};
admins = async (): Promise<AdminResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
admins: {}
});
};
addressCount = async (): Promise<Uint64> => {
return this.client.queryContractSmart(this.contractAddress, {
address_count: {}
});
};
perAddressLimit = async (): Promise<Uint64> => {
return this.client.queryContractSmart(this.contractAddress, {
per_address_limit: {}
});
};
mintDiscountAmount = async (): Promise<NullableUint64> => {
return this.client.queryContractSmart(this.contractAddress, {
mint_discount_amount: {}
});
};
}
export interface WhitelistUpdatableFlatrateInterface extends WhitelistUpdatableFlatrateReadOnlyInterface {
contractAddress: string;
sender: string;
updateAdmins: ({
newAdminList
}: {
newAdminList: string[];
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
addAddresses: ({
addresses
}: {
addresses: string[];
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
removeAddresses: ({
addresses
}: {
addresses: string[];
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
processAddress: ({
address
}: {
address: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
updatePerAddressLimit: ({
limit
}: {
limit: number;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
purge: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
}
export class WhitelistUpdatableFlatrateClient extends WhitelistUpdatableFlatrateQueryClient implements WhitelistUpdatableFlatrateInterface {
client: SigningCosmWasmClient;
sender: string;
contractAddress: string;

constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
super(client, contractAddress);
this.client = client;
this.sender = sender;
this.contractAddress = contractAddress;
this.updateAdmins = this.updateAdmins.bind(this);
this.addAddresses = this.addAddresses.bind(this);
this.removeAddresses = this.removeAddresses.bind(this);
this.processAddress = this.processAddress.bind(this);
this.updatePerAddressLimit = this.updatePerAddressLimit.bind(this);
this.purge = this.purge.bind(this);
}

updateAdmins = async ({
newAdminList
}: {
newAdminList: string[];
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
update_admins: {
new_admin_list: newAdminList
}
}, fee, memo, _funds);
};
addAddresses = async ({
addresses
}: {
addresses: string[];
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
add_addresses: {
addresses
}
}, fee, memo, _funds);
};
removeAddresses = async ({
addresses
}: {
addresses: string[];
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
remove_addresses: {
addresses
}
}, fee, memo, _funds);
};
processAddress = async ({
address
}: {
address: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
process_address: {
address
}
}, fee, memo, _funds);
};
updatePerAddressLimit = async ({
limit
}: {
limit: number;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
update_per_address_limit: {
limit
}
}, fee, memo, _funds);
};
purge = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
purge: {}
}, fee, memo, _funds);
};
}
70 changes: 70 additions & 0 deletions ts/src/WhitelistUpdatableFlatrate.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/

export interface InstantiateMsg {
addresses: string[];
admin_list?: string[] | null;
mint_discount_amount?: number | null;
per_address_limit: number;
}
export type ExecuteMsg = {
update_admins: {
new_admin_list: string[];
};
} | {
add_addresses: {
addresses: string[];
};
} | {
remove_addresses: {
addresses: string[];
};
} | {
process_address: {
address: string;
};
} | {
update_per_address_limit: {
limit: number;
};
} | {
purge: {};
};
export type QueryMsg = {
config: {};
} | {
includes_address: {
address: string;
};
} | {
mint_count: {
address: string;
};
} | {
is_processable: {
address: string;
};
} | {
admins: {};
} | {
address_count: {};
} | {
per_address_limit: {};
} | {
mint_discount_amount: {};
};
export type Uint64 = number;
export interface AdminResponse {
admin?: string | null;
}
export type Addr = string;
export interface Config {
admins: Addr[];
mint_discount_amount?: number | null;
per_address_limit: number;
}
export type Boolean = boolean;
export type Nullableuint64 = number | null;

0 comments on commit 0079ca9

Please sign in to comment.