Skip to content

Commit

Permalink
defined funds parameter for execute call
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntVal authored and codingki committed Feb 24, 2023
1 parent 0da21ea commit d0d4dbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/graz/src/actions/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export interface ExecuteContractArgs<Message extends Record<string, unknown>> {
fee: StdFee | "auto" | number;
senderAddress: string;
contractAddress: string;
funds: Coin[];
}

export type ExecuteContractMutationArgs<Message extends Record<string, unknown>> = Omit<
Expand All @@ -152,14 +153,15 @@ export const executeContract = async <Message extends Record<string, unknown>>({
msg,
fee,
contractAddress,
funds,
}: ExecuteContractArgs<Message>) => {
const { signingClients } = useGrazStore.getState();

if (!signingClients?.cosmWasm) {
throw new Error("CosmWasm signing client is not ready");
}

return signingClients.cosmWasm.execute(senderAddress, contractAddress, msg, fee);
return signingClients.cosmWasm.execute(senderAddress, contractAddress, msg, fee, funds);
};

export const getQuerySmart = async <TData>(address: string, queryMsg: Record<string, unknown>): Promise<TData> => {
Expand Down
1 change: 1 addition & 0 deletions packages/graz/src/hooks/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ export const useExecuteContract = <Message extends Record<string, unknown>>({
fee: args.fee ?? "auto",
senderAddress: accountAddress,
contractAddress,
funds: args.funds ?? [],
};

return executeContract(executeArgs);
Expand Down

0 comments on commit d0d4dbb

Please sign in to comment.