diff --git a/examples/telescope-with-contracts/components/sell-nfts.tsx b/examples/telescope-with-contracts/components/sell-nfts.tsx
index b806a8989..67dbe2d82 100644
--- a/examples/telescope-with-contracts/components/sell-nfts.tsx
+++ b/examples/telescope-with-contracts/components/sell-nfts.tsx
@@ -60,6 +60,7 @@ export const SellNfts = () => {
const transferModalControl = useDisclosure();
const burnModalControl = useDisclosure();
const updatePriceModalControl = useDisclosure();
+ const updatePriceModalRQControl = useDisclosure();
const removeListingModalControl = useDisclosure();
useEffect(() => {
@@ -252,6 +253,7 @@ export const SellNfts = () => {
transferNft: transferModalControl.onOpen,
removeListing: removeListingModalControl.onOpen,
updatePrice: updatePriceModalControl.onOpen,
+ updatePriceRQ: updatePriceModalRQControl.onOpen,
}}
/>
)}
@@ -289,6 +291,18 @@ export const SellNfts = () => {
update={update}
token={selectedToken}
price={price}
+ isRQ={false}
+ />
+ )}
+
+ {selectedToken && selectedCollection && price && (
+
)}
diff --git a/examples/telescope-with-contracts/components/ui/modal/nft-detail-modal.tsx b/examples/telescope-with-contracts/components/ui/modal/nft-detail-modal.tsx
index f39e9d35e..b100566cb 100644
--- a/examples/telescope-with-contracts/components/ui/modal/nft-detail-modal.tsx
+++ b/examples/telescope-with-contracts/components/ui/modal/nft-detail-modal.tsx
@@ -52,6 +52,7 @@ export const NftDetailModal = ({
burn: () => void;
transferNft: () => void;
updatePrice: () => void;
+ updatePriceRQ: () => void;
removeListing: () => void;
};
}) => {
@@ -162,7 +163,6 @@ export const NftDetailModal = ({
/>
)}
-
{token.forSale && token.saleType && (
)}
-
{token.forSale ? (
)}
-
+ {token.forSale && (
+
+ }
+ text="Update Price(React Query)"
+ type="solid"
+ />
+
+ )}
void;
}) => {
const [inputValue, setInputValue] = useState('');
const [isLoading, setIsLoading] = useState(false);
+ const {
+ isSuccess: isRQSuccess,
+ isError: isRQError,
+ error: rqError,
+ isLoading: isRQLoading,
+ mutate: updateAskPrice,
+ } = useMarketplaceUpdateAskPriceMutation();
const { showToast } = useTransactionToast();
@@ -75,6 +85,44 @@ export const UpdatePriceModal = ({
}
};
+ const handleRQUpdateClick = async () => {
+ try {
+ console.log("react query's working.");
+
+ const marketplaceClient =
+ marketplace.getSigningClient(marketplaceContract);
+ updateAskPrice({
+ client: marketplaceClient,
+ msg: {
+ collection: token.collectionAddr,
+ price: {
+ amount: toRawAmount(inputValue, exponent),
+ denom: coin.base,
+ },
+ tokenId: parseInt(token.tokenId),
+ },
+ });
+ } catch (ex) {
+ showToast(TxResult.Failed, ex);
+ console.error(ex);
+ }
+ };
+
+ useEffect(() => {
+ if (isRQSuccess) {
+ showToast(TxResult.Success);
+ update();
+ closeModal();
+ }
+ }, [isRQSuccess]);
+
+ useEffect(() => {
+ if (isRQError) {
+ showToast(TxResult.Failed, rqError);
+ console.error(rqError);
+ }
+ }, [isRQError, rqError]);
+
const { textColor, bgColor } = useColor();
return (
@@ -140,9 +188,9 @@ export const UpdatePriceModal = ({
-
+
-
-
-
-
+ }}
+ signerOptions={signerOptions}
+ >
+
+
+
+
+
);
}
diff --git a/examples/telescope-with-contracts/scripts/codegen.js b/examples/telescope-with-contracts/scripts/codegen.js
index 0a9b2eae5..267962f69 100644
--- a/examples/telescope-with-contracts/scripts/codegen.js
+++ b/examples/telescope-with-contracts/scripts/codegen.js
@@ -79,6 +79,11 @@ telescope({
messageComposer: {
enabled: true,
},
+ reactQuery: {
+ enabled: true,
+ version: 'v4',
+ mutations: true,
+ },
useContractsHooks: {
enabled: true
}
diff --git a/examples/telescope-with-contracts/src/codegen/Marketplace.react-query.ts b/examples/telescope-with-contracts/src/codegen/Marketplace.react-query.ts
index 649e12a8d..bcd5db34d 100644
--- a/examples/telescope-with-contracts/src/codegen/Marketplace.react-query.ts
+++ b/examples/telescope-with-contracts/src/codegen/Marketplace.react-query.ts
@@ -1,15 +1,19 @@
/**
-* This file was automatically generated by @cosmwasm/ts-codegen@latest.
+* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6.
* 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 { UseQueryOptions, useQuery } from "react-query";
+import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from "@tanstack/react-query";
+import { ExecuteResult } from "@cosmjs/cosmwasm-stargate";
+import { StdFee } from "@cosmjs/amino";
import { Uint128, Duration, InstantiateMsg, ExpiryRange, ExecuteMsg, Timestamp, Uint64, SaleType, Coin, QueryMsg, Addr, AskOffset, CollectionOffset, BidOffset, CollectionBidOffset, AsksResponse, Ask, AskCountResponse, HooksResponse, BidResponse, Bid, BidsResponse, CollectionBidResponse, CollectionBid, CollectionsResponse, Decimal, ParamsResponse, SudoParams } from "./Marketplace.types";
-import { MarketplaceQueryClient } from "./Marketplace.client";
+import { MarketplaceQueryClient, MarketplaceClient } from "./Marketplace.client";
export interface MarketplaceReactQuery {
client: MarketplaceQueryClient;
- options?: UseQueryOptions;
+ options?: Omit, "'queryKey' | 'queryFn' | 'initialData'"> & {
+ initialData?: undefined;
+ };
}
export interface MarketplaceParamsQuery extends MarketplaceReactQuery {}
export function useMarketplaceParamsQuery({
@@ -382,4 +386,369 @@ export function useMarketplaceCollectionsQuery({
limit: args.limit,
startAfter: args.startAfter
}), options);
+}
+export interface MarketplaceRemoveStaleCollectionBidMutation {
+ client: MarketplaceClient;
+ msg: {
+ bidder: string;
+ collection: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceRemoveStaleCollectionBidMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.removeStaleCollectionBid(msg, fee, memo, funds), options);
+}
+export interface MarketplaceRemoveStaleBidMutation {
+ client: MarketplaceClient;
+ msg: {
+ bidder: string;
+ collection: string;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceRemoveStaleBidMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.removeStaleBid(msg, fee, memo, funds), options);
+}
+export interface MarketplaceRemoveStaleAskMutation {
+ client: MarketplaceClient;
+ msg: {
+ collection: string;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceRemoveStaleAskMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.removeStaleAsk(msg, fee, memo, funds), options);
+}
+export interface MarketplaceSyncAskMutation {
+ client: MarketplaceClient;
+ msg: {
+ collection: string;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceSyncAskMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.syncAsk(msg, fee, memo, funds), options);
+}
+export interface MarketplaceAcceptCollectionBidMutation {
+ client: MarketplaceClient;
+ msg: {
+ bidder: string;
+ collection: string;
+ finder?: string;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceAcceptCollectionBidMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.acceptCollectionBid(msg, fee, memo, funds), options);
+}
+export interface MarketplaceRemoveCollectionBidMutation {
+ client: MarketplaceClient;
+ msg: {
+ collection: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceRemoveCollectionBidMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.removeCollectionBid(msg, fee, memo, funds), options);
+}
+export interface MarketplaceSetCollectionBidMutation {
+ client: MarketplaceClient;
+ msg: {
+ collection: string;
+ expires: Timestamp;
+ findersFeeBps?: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceSetCollectionBidMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.setCollectionBid(msg, fee, memo, funds), options);
+}
+export interface MarketplaceRejectBidMutation {
+ client: MarketplaceClient;
+ msg: {
+ bidder: string;
+ collection: string;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceRejectBidMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.rejectBid(msg, fee, memo, funds), options);
+}
+export interface MarketplaceAcceptBidMutation {
+ client: MarketplaceClient;
+ msg: {
+ bidder: string;
+ collection: string;
+ finder?: string;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceAcceptBidMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.acceptBid(msg, fee, memo, funds), options);
+}
+export interface MarketplaceRemoveBidMutation {
+ client: MarketplaceClient;
+ msg: {
+ collection: string;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceRemoveBidMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.removeBid(msg, fee, memo, funds), options);
+}
+export interface MarketplaceBuyNowMutation {
+ client: MarketplaceClient;
+ msg: {
+ collection: string;
+ expires: Timestamp;
+ finder?: string;
+ findersFeeBps?: number;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceBuyNowMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.buyNow(msg, fee, memo, funds), options);
+}
+export interface MarketplaceSetBidMutation {
+ client: MarketplaceClient;
+ msg: {
+ collection: string;
+ expires: Timestamp;
+ finder?: string;
+ findersFeeBps?: number;
+ saleType: SaleType;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceSetBidMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.setBid(msg, fee, memo, funds), options);
+}
+export interface MarketplaceUpdateAskPriceMutation {
+ client: MarketplaceClient;
+ msg: {
+ collection: string;
+ price: Coin;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceUpdateAskPriceMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.updateAskPrice(msg, fee, memo, funds), options);
+}
+export interface MarketplaceRemoveAskMutation {
+ client: MarketplaceClient;
+ msg: {
+ collection: string;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceRemoveAskMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.removeAsk(msg, fee, memo, funds), options);
+}
+export interface MarketplaceSetAskMutation {
+ client: MarketplaceClient;
+ msg: {
+ collection: string;
+ expires: Timestamp;
+ findersFeeBps?: number;
+ fundsRecipient?: string;
+ price: Coin;
+ reserveFor?: string;
+ saleType: SaleType;
+ tokenId: number;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useMarketplaceSetAskMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.setAsk(msg, fee, memo, funds), options);
}
\ No newline at end of file
diff --git a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.react-query.ts b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.react-query.ts
index 9b047dfaa..db6b79b67 100644
--- a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.react-query.ts
+++ b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.react-query.ts
@@ -1,15 +1,19 @@
/**
-* This file was automatically generated by @cosmwasm/ts-codegen@latest.
+* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6.
* 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 { UseQueryOptions, useQuery } from "react-query";
+import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from "@tanstack/react-query";
+import { ExecuteResult } from "@cosmjs/cosmwasm-stargate";
+import { StdFee, Coin } from "@cosmjs/amino";
import { Expiration, Timestamp, Uint64, AllNftInfoResponse, OwnerOfResponse, Approval, NftInfoResponseForEmpty, Empty, AllOperatorsResponse, AllTokensResponse, ApprovalResponse, ApprovalsResponse, Decimal, CollectionInfoResponse, RoyaltyInfoResponse, ContractInfoResponse, ExecuteMsgForNullable_EmptyAndEmpty, Binary, UpdateCollectionInfoMsgForRoyaltyInfoResponse, InstantiateMsg, CollectionInfoForRoyaltyInfoResponse, MinterResponse, NftInfoResponse, NumTokensResponse, QueryMsg, TokensResponse } from "./Sg721Updatable.types";
-import { Sg721UpdatableQueryClient } from "./Sg721Updatable.client";
+import { Sg721UpdatableQueryClient, Sg721UpdatableClient } from "./Sg721Updatable.client";
export interface Sg721UpdatableReactQuery {
client: Sg721UpdatableQueryClient;
- options?: UseQueryOptions;
+ options?: Omit, "'queryKey' | 'queryFn' | 'initialData'"> & {
+ initialData?: undefined;
+ };
}
export interface Sg721UpdatableOwnershipQuery extends Sg721UpdatableReactQuery {}
export function useSg721UpdatableOwnershipQuery({
@@ -179,4 +183,329 @@ export function useSg721UpdatableOwnerOfQuery({
includeExpired: args.includeExpired,
tokenId: args.tokenId
}), options);
+}
+export interface Sg721UpdatableExtensionMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ msg: Empty;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableExtensionMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.extension(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableMintMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ extension?: Empty;
+ owner: string;
+ tokenId: string;
+ tokenUri?: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableMintMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.mint(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableFreezeCollectionInfoMutation {
+ client: Sg721UpdatableClient;
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableFreezeCollectionInfoMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.freezeCollectionInfo(fee, memo, funds), options);
+}
+export interface Sg721UpdatableUpdateTradingStartTimeMutation {
+ client: Sg721UpdatableClient;
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableUpdateTradingStartTimeMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.updateTradingStartTime(fee, memo, funds), options);
+}
+export interface Sg721UpdatableUpdateCollectionInfoMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ collectionInfo: UpdateCollectionInfoMsgForRoyaltyInfoResponse;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableUpdateCollectionInfoMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.updateCollectionInfo(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableBurnMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ tokenId: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableBurnMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.burn(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableRevokeAllMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ operator: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableRevokeAllMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.revokeAll(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableApproveAllMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ expires?: Expiration;
+ operator: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableApproveAllMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.approveAll(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableRevokeMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ spender: string;
+ tokenId: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableRevokeMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.revoke(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableApproveMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ expires?: Expiration;
+ spender: string;
+ tokenId: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableApproveMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.approve(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableSendNftMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ contract: string;
+ msg: Binary;
+ tokenId: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableSendNftMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.sendNft(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableTransferNftMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ recipient: string;
+ tokenId: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableTransferNftMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.transferNft(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableEnableUpdatableMutation {
+ client: Sg721UpdatableClient;
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableEnableUpdatableMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.enableUpdatable(fee, memo, funds), options);
+}
+export interface Sg721UpdatableUpdateTokenMetadataMutation {
+ client: Sg721UpdatableClient;
+ msg: {
+ tokenId: string;
+ tokenUri?: string;
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableUpdateTokenMetadataMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.updateTokenMetadata(msg, fee, memo, funds), options);
+}
+export interface Sg721UpdatableFreezeTokenMetadataMutation {
+ client: Sg721UpdatableClient;
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useSg721UpdatableFreezeTokenMetadataMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.freezeTokenMetadata(fee, memo, funds), options);
}
\ No newline at end of file
diff --git a/examples/telescope-with-contracts/src/codegen/Whitelist.react-query.ts b/examples/telescope-with-contracts/src/codegen/Whitelist.react-query.ts
index 05a7f9789..4090b6569 100644
--- a/examples/telescope-with-contracts/src/codegen/Whitelist.react-query.ts
+++ b/examples/telescope-with-contracts/src/codegen/Whitelist.react-query.ts
@@ -1,15 +1,19 @@
/**
-* This file was automatically generated by @cosmwasm/ts-codegen@latest.
+* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6.
* 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 { UseQueryOptions, useQuery } from "react-query";
+import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from "@tanstack/react-query";
+import { ExecuteResult } from "@cosmjs/cosmwasm-stargate";
+import { StdFee } from "@cosmjs/amino";
import { AdminListResponse, CanExecuteResponse, Timestamp, Uint64, Uint128, ConfigResponse, Coin, Config, ExecuteMsg, AddMembersMsg, RemoveMembersMsg, HasEndedResponse, HasMemberResponse, HasStartedResponse, InstantiateMsg, IsActiveResponse, MembersResponse, QueryMsg, CosmosMsgForEmpty, BankMsg, WasmMsg, Binary, Empty } from "./Whitelist.types";
-import { WhitelistQueryClient } from "./Whitelist.client";
+import { WhitelistQueryClient, WhitelistClient } from "./Whitelist.client";
export interface WhitelistReactQuery {
client: WhitelistQueryClient;
- options?: UseQueryOptions;
+ options?: Omit, "'queryKey' | 'queryFn' | 'initialData'"> & {
+ initialData?: undefined;
+ };
}
export interface WhitelistCanExecuteQuery extends WhitelistReactQuery {
args: {
@@ -91,4 +95,162 @@ export function useWhitelistHasStartedQuery({
options
}: WhitelistHasStartedQuery) {
return useQuery(["whitelistHasStarted", client.contractAddress], () => client.hasStarted(), options);
+}
+export interface WhitelistFreezeMutation {
+ client: WhitelistClient;
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useWhitelistFreezeMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.freeze(fee, memo, funds), options);
+}
+export interface WhitelistUpdateAdminsMutation {
+ client: WhitelistClient;
+ msg: {
+ admins: string[];
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useWhitelistUpdateAdminsMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.updateAdmins(msg, fee, memo, funds), options);
+}
+export interface WhitelistIncreaseMemberLimitMutation {
+ client: WhitelistClient;
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useWhitelistIncreaseMemberLimitMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.increaseMemberLimit(fee, memo, funds), options);
+}
+export interface WhitelistUpdatePerAddressLimitMutation {
+ client: WhitelistClient;
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useWhitelistUpdatePerAddressLimitMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.updatePerAddressLimit(fee, memo, funds), options);
+}
+export interface WhitelistRemoveMembersMutation {
+ client: WhitelistClient;
+ msg: {
+ toRemove: string[];
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useWhitelistRemoveMembersMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.removeMembers(msg, fee, memo, funds), options);
+}
+export interface WhitelistAddMembersMutation {
+ client: WhitelistClient;
+ msg: {
+ toAdd: string[];
+ };
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useWhitelistAddMembersMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.addMembers(msg, fee, memo, funds), options);
+}
+export interface WhitelistUpdateEndTimeMutation {
+ client: WhitelistClient;
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useWhitelistUpdateEndTimeMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.updateEndTime(msg, fee, memo, funds), options);
+}
+export interface WhitelistUpdateStartTimeMutation {
+ client: WhitelistClient;
+ args?: {
+ fee?: number | StdFee | "auto";
+ memo?: string;
+ funds?: Coin[];
+ };
+}
+export function useWhitelistUpdateStartTimeMutation(options?: Omit, "mutationFn">) {
+ return useMutation(({
+ client,
+ msg,
+ args: {
+ fee,
+ memo,
+ funds
+ } = {}
+ }) => client.updateStartTime(msg, fee, memo, funds), options);
}
\ No newline at end of file
diff --git a/examples/telescope-with-contracts/src/codegen/contracts.ts b/examples/telescope-with-contracts/src/codegen/contracts.ts
index e0ef6aa8d..acbe3afec 100644
--- a/examples/telescope-with-contracts/src/codegen/contracts.ts
+++ b/examples/telescope-with-contracts/src/codegen/contracts.ts
@@ -7,29 +7,35 @@
import * as _0 from "./Sg721Updatable.types";
import * as _1 from "./Sg721Updatable.client";
import * as _2 from "./Sg721Updatable.message-composer";
-import * as _3 from "./Sg721Updatable.provider";
-import * as _4 from "./Whitelist.types";
-import * as _5 from "./Whitelist.client";
-import * as _6 from "./Whitelist.message-composer";
-import * as _7 from "./Whitelist.provider";
-import * as _8 from "./Marketplace.types";
-import * as _9 from "./Marketplace.client";
-import * as _10 from "./Marketplace.message-composer";
-import * as _11 from "./Marketplace.provider";
+import * as _3 from "./Sg721Updatable.react-query";
+import * as _4 from "./Sg721Updatable.provider";
+import * as _5 from "./Whitelist.types";
+import * as _6 from "./Whitelist.client";
+import * as _7 from "./Whitelist.message-composer";
+import * as _8 from "./Whitelist.react-query";
+import * as _9 from "./Whitelist.provider";
+import * as _10 from "./Marketplace.types";
+import * as _11 from "./Marketplace.client";
+import * as _12 from "./Marketplace.message-composer";
+import * as _13 from "./Marketplace.react-query";
+import * as _14 from "./Marketplace.provider";
export namespace contracts {
export const Sg721Updatable = { ..._0,
..._1,
..._2,
- ..._3
+ ..._3,
+ ..._4
};
- export const Whitelist = { ..._4,
- ..._5,
+ export const Whitelist = { ..._5,
..._6,
- ..._7
+ ..._7,
+ ..._8,
+ ..._9
};
- export const Marketplace = { ..._8,
- ..._9,
- ..._10,
- ..._11
+ export const Marketplace = { ..._10,
+ ..._11,
+ ..._12,
+ ..._13,
+ ..._14
};
}
\ No newline at end of file
diff --git a/examples/telescope/scripts/codegen.js b/examples/telescope/scripts/codegen.js
index 0b406f383..4ff44af5e 100644
--- a/examples/telescope/scripts/codegen.js
+++ b/examples/telescope/scripts/codegen.js
@@ -1,51 +1,53 @@
-const { join, resolve } = require('path');
-const telescope = require('@osmonauts/telescope').default;
+import { join } from 'path';
+import telescope from '@osmonauts/telescope';
+import { rimrafSync as rimraf } from 'rimraf';
+import { AMINO_MAP } from './aminos';
const protoDirs = [join(__dirname, '/../proto')];
+const outPath = join(__dirname, '../src/codegen');
+rimraf(outPath);
telescope({
protoDirs,
- outPath: join(__dirname, '../codegen'),
+ outPath,
options: {
tsDisable: {
files: [
- 'ibc/core/types/v1/genesis.ts',
- 'google/protobuf/descriptor.ts',
- 'google/protobuf/struct.ts'
+ 'cosmos/authz/v1beta1/tx.amino.ts',
+ 'cosmos/staking/v1beta1/tx.amino.ts'
]
},
prototypes: {
- allowUndefinedTypes: true,
- fieldDefaultIsOptional: true,
includePackageVar: false,
typingsFormat: {
+ num64: 'bigint',
useDeepPartial: false,
useExact: false,
- num64: "bigint",
- timestamp: 'date',
+ timestamp: 'timestamp',
duration: 'duration'
},
+ methods: {
+ toJSON: true,
+ fromJSON: true
+ }
},
aminoEncoding: {
- enabled: true
+ enabled: true,
+ exceptions: AMINO_MAP
},
lcdClients: {
- enabled: true
+ enabled: false
},
rpcClients: {
enabled: true,
camelCase: true
- },
- reactQuery: {
- enabled: true
- },
- mobx: {
- enabled: true
}
}
-}).then(() => {
- console.log('✨ all done!');
-}).catch(e=>{
- console.error(e);
-});
-
+})
+ .then(() => {
+ console.log('✨ all done!');
+ })
+ .catch((e) => {
+ console.error(e);
+ process.exit(1);
+ });
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 2834a708b..f3875fda7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7683,7 +7683,7 @@ before-after-hook@^2.2.0:
resolved "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz"
integrity sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==
-big-integer@^1.6.48:
+big-integer@^1.6.16, big-integer@^1.6.48:
version "1.6.51"
resolved "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz"
integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==
@@ -7772,6 +7772,20 @@ braces@^3.0.2, braces@~3.0.2:
dependencies:
fill-range "^7.0.1"
+broadcast-channel@^3.4.1:
+ version "3.7.0"
+ resolved "https://registry.npmmirror.com/broadcast-channel/-/broadcast-channel-3.7.0.tgz#2dfa5c7b4289547ac3f6705f9c00af8723889937"
+ integrity sha512-cIAKJXAxGJceNZGTZSBzMxzyOn72cVgPnKx4dc6LRjQgbaJUQqhy5rzL3zbMxkMWsGKkv2hSFkPRMEXfoMZ2Mg==
+ dependencies:
+ "@babel/runtime" "^7.7.2"
+ detect-node "^2.1.0"
+ js-sha3 "0.8.0"
+ microseconds "0.2.0"
+ nano-time "1.0.0"
+ oblivious-set "1.0.0"
+ rimraf "3.0.2"
+ unload "2.2.0"
+
brorand@^1.1.0:
version "1.1.0"
resolved "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
@@ -8788,6 +8802,11 @@ detect-node-es@^1.1.0:
resolved "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz"
integrity sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==
+detect-node@^2.0.4, detect-node@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.npmmirror.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1"
+ integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==
+
detective@^5.2.1:
version "5.2.1"
resolved "https://registry.npmjs.org/detective/-/detective-5.2.1.tgz"
@@ -12107,6 +12126,14 @@ map-obj@^4.0.0:
resolved "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz"
integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==
+match-sorter@^6.0.2:
+ version "6.3.1"
+ resolved "https://registry.npmmirror.com/match-sorter/-/match-sorter-6.3.1.tgz#98cc37fda756093424ddf3cbc62bfe9c75b92bda"
+ integrity sha512-mxybbo3pPNuA+ZuCUhm5bwNkXrJTbsk5VWbR5wiwz/GC6LIiegBGn2w3O08UG/jdbYLinw51fSQ5xNU1U3MgBw==
+ dependencies:
+ "@babel/runtime" "^7.12.5"
+ remove-accents "0.4.2"
+
md5.js@^1.3.4:
version "1.3.5"
resolved "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz"
@@ -12429,6 +12456,11 @@ micromatch@^4.0.0, micromatch@^4.0.4, micromatch@^4.0.5:
braces "^3.0.2"
picomatch "^2.3.1"
+microseconds@0.2.0:
+ version "0.2.0"
+ resolved "https://registry.npmmirror.com/microseconds/-/microseconds-0.2.0.tgz#233b25f50c62a65d861f978a4a4f8ec18797dc39"
+ integrity sha512-n7DHHMjR1avBbSpsTBj6fmMGh2AGrifVV4e+WYc3Q9lO+xnSZ3NyhcBND3vzzatt05LFhoKFRxrIyklmLlUtyA==
+
mime-db@1.52.0:
version "1.52.0"
resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
@@ -13118,6 +13150,11 @@ object.values@^1.1.6:
define-properties "^1.1.4"
es-abstract "^1.20.4"
+oblivious-set@1.0.0:
+ version "1.0.0"
+ resolved "https://registry.npmmirror.com/oblivious-set/-/oblivious-set-1.0.0.tgz#c8316f2c2fb6ff7b11b6158db3234c49f733c566"
+ integrity sha512-z+pI07qxo4c2CulUHCDf9lcqDlMSo72N/4rLUpRXf6fu+q8vjt8y0xS+Tlf8NTJDdTXHbdeO1n3MlbctwEoXZw==
+
on-exit-leak-free@^0.2.0:
version "0.2.0"
resolved "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz"
@@ -13967,6 +14004,15 @@ react-minimal-pie-chart@^8.4.0:
dependencies:
"@types/svg-path-parser" "^1.1.3"
+react-query@3.39.3:
+ version "3.39.3"
+ resolved "https://registry.npmmirror.com/react-query/-/react-query-3.39.3.tgz#4cea7127c6c26bdea2de5fb63e51044330b03f35"
+ integrity sha512-nLfLz7GiohKTJDuT4us4X3h/8unOh+00MLb2yJoGTPjxKs2bc1iDhkNx2bd5MKklXnOD3NrVZ+J2UXujA5In4g==
+ dependencies:
+ "@babel/runtime" "^7.5.5"
+ broadcast-channel "^3.4.1"
+ match-sorter "^6.0.2"
+
react-remove-scroll-bar@^2.3.3:
version "2.3.4"
resolved "https://registry.npmjs.org/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.4.tgz"
@@ -14289,6 +14335,11 @@ remark-rehype@^10.0.0:
mdast-util-to-hast "^12.1.0"
unified "^10.0.0"
+remove-accents@0.4.2:
+ version "0.4.2"
+ resolved "https://registry.npmmirror.com/remove-accents/-/remove-accents-0.4.2.tgz#0a43d3aaae1e80db919e07ae254b285d9e1c7bb5"
+ integrity sha512-7pXIJqJOq5tFgG1A2Zxti3Ht8jJF337m4sowbuHsW30ZnkQFnDzy9qBNhgzX8ZLW4+UBcXiiR7SwR6pokHsxiA==
+
request@^2.88.0, request@^2.88.2:
version "2.88.2"
resolved "https://registry.npmjs.org/request/-/request-2.88.2.tgz"
@@ -15738,6 +15789,14 @@ universalify@^2.0.0:
resolved "https://registry.npmmirror.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
+unload@2.2.0:
+ version "2.2.0"
+ resolved "https://registry.npmmirror.com/unload/-/unload-2.2.0.tgz#ccc88fdcad345faa06a92039ec0f80b488880ef7"
+ integrity sha512-B60uB5TNBLtN6/LsgAf3udH9saB5p7gqJwcFfbOEZ8BcBHnGwCf6G/TGiEqkRAxX7zAFIUtzdrXQSdL3Q/wqNA==
+ dependencies:
+ "@babel/runtime" "^7.6.2"
+ detect-node "^2.0.4"
+
unorm@^1.5.0:
version "1.6.0"
resolved "https://registry.npmmirror.com/unorm/-/unorm-1.6.0.tgz#029b289661fba714f1a9af439eb51d9b16c205af"