From a7394a2d1e0e46941b088626073c44e04d8a5bc8 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Wed, 26 Jul 2023 14:46:35 +0800 Subject: [PATCH 1/2] react query hooks provider sample --- .../components/ui/nft/list-tab.tsx | 8 + .../telescope-with-contracts/package.json | 5 +- .../scripts/codegen.js | 3 + .../src/codegen/Marketplace.client.ts | 2 +- .../codegen/Marketplace.message-composer.ts | 2 +- .../src/codegen/Marketplace.provider.ts | 54 +- .../src/codegen/Marketplace.react-query.ts | 600 ++++++++++++------ .../src/codegen/Marketplace.types.ts | 2 +- .../src/codegen/Sg721Updatable.client.ts | 2 +- .../Sg721Updatable.message-composer.ts | 2 +- .../src/codegen/Sg721Updatable.provider.ts | 2 +- .../src/codegen/Sg721Updatable.types.ts | 2 +- .../src/codegen/Whitelist.client.ts | 2 +- .../src/codegen/Whitelist.message-composer.ts | 2 +- .../src/codegen/Whitelist.provider.ts | 2 +- .../src/codegen/Whitelist.types.ts | 2 +- .../src/codegen/contractContextBase.ts | 4 + .../src/codegen/contractContextProviders.ts | 76 ++- .../src/codegen/contracts-context.tsx | 2 +- .../src/codegen/contracts.ts | 42 +- examples/telescope/scripts/codegen.js | 50 +- 21 files changed, 576 insertions(+), 290 deletions(-) diff --git a/examples/telescope-with-contracts/components/ui/nft/list-tab.tsx b/examples/telescope-with-contracts/components/ui/nft/list-tab.tsx index f0c122cc5..f324c95e4 100644 --- a/examples/telescope-with-contracts/components/ui/nft/list-tab.tsx +++ b/examples/telescope-with-contracts/components/ui/nft/list-tab.tsx @@ -51,6 +51,14 @@ export const ListTab = ({ const { marketplace, sg721Updatable } = useContracts(); + const hooks = marketplace.getReactQueryHooks(marketplaceContract); + + const { useMarketplaceParamsQuery } = hooks; + + useMarketplaceParamsQuery({ + options: {}, + }); + const handleClick = async () => { if (!address) return; setIsLoading(true); diff --git a/examples/telescope-with-contracts/package.json b/examples/telescope-with-contracts/package.json index d686ffdd4..206135c38 100644 --- a/examples/telescope-with-contracts/package.json +++ b/examples/telescope-with-contracts/package.json @@ -13,6 +13,7 @@ "codegen": "cross-env NODE_ENV=development babel-node scripts/codegen.js" }, "dependencies": { + "@apollo/client": "3.7.14", "@babel/cli": "7.19.3", "@babel/core": "7.19.3", "@babel/eslint-parser": "^7.19.1", @@ -26,8 +27,6 @@ "@babel/plugin-transform-runtime": "7.19.1", "@babel/preset-env": "7.19.4", "@babel/preset-typescript": "^7.18.6", - "@osmonauts/telescope": "^0.99.12", - "@apollo/client": "3.7.14", "@chain-registry/types": "0.14.0", "@chakra-ui/icons": "2.0.12", "@chakra-ui/react": "2.5.1", @@ -40,6 +39,7 @@ "@cosmos-kit/react": "1.3.11", "@emotion/react": "11.10.6", "@emotion/styled": "11.10.6", + "@osmonauts/telescope": "^0.99.12", "bignumber.js": "9.1.0", "chain-registry": "1.10.0", "framer-motion": "9.0.7", @@ -48,6 +48,7 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-icons": "4.8.0", + "react-query": "3.39.3", "stargazejs": "0.14.0" }, "devDependencies": { diff --git a/examples/telescope-with-contracts/scripts/codegen.js b/examples/telescope-with-contracts/scripts/codegen.js index 0a9b2eae5..ec23b3f1d 100644 --- a/examples/telescope-with-contracts/scripts/codegen.js +++ b/examples/telescope-with-contracts/scripts/codegen.js @@ -79,6 +79,9 @@ telescope({ messageComposer: { enabled: true, }, + reactQuery: { + enabled: true + }, useContractsHooks: { enabled: true } diff --git a/examples/telescope-with-contracts/src/codegen/Marketplace.client.ts b/examples/telescope-with-contracts/src/codegen/Marketplace.client.ts index 46b738821..fa6c4aa3f 100644 --- a/examples/telescope-with-contracts/src/codegen/Marketplace.client.ts +++ b/examples/telescope-with-contracts/src/codegen/Marketplace.client.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/Marketplace.message-composer.ts b/examples/telescope-with-contracts/src/codegen/Marketplace.message-composer.ts index 6afe3c338..a947afa4a 100644 --- a/examples/telescope-with-contracts/src/codegen/Marketplace.message-composer.ts +++ b/examples/telescope-with-contracts/src/codegen/Marketplace.message-composer.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/Marketplace.provider.ts b/examples/telescope-with-contracts/src/codegen/Marketplace.provider.ts index 12606aec7..168c1b272 100644 --- a/examples/telescope-with-contracts/src/codegen/Marketplace.provider.ts +++ b/examples/telescope-with-contracts/src/codegen/Marketplace.provider.ts @@ -1,19 +1,51 @@ /** -* 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. -*/ + * 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 { ContractBase, IContractConstructor } from "./contractContextBase"; -import { MarketplaceClient, MarketplaceQueryClient } from "./Marketplace.client"; -import { MarketplaceMessageComposer } from "./Marketplace.message-composer"; -export class Marketplace extends ContractBase { +import { UseQueryResult } from 'react-query'; +import { ContractBase, IContractConstructor } from './contractContextBase'; +import { + MarketplaceClient, + MarketplaceQueryClient, +} from './Marketplace.client'; +import { MarketplaceMessageComposer } from './Marketplace.message-composer'; +import { + IMarketplaceReactQueryHooks, + MarketplaceParamsQuery, + useMarketplaceParamsQuery, +} from './Marketplace.react-query'; +import { ParamsResponse } from './Marketplace.types'; +export class Marketplace extends ContractBase< + MarketplaceClient, + MarketplaceQueryClient, + MarketplaceMessageComposer +> { constructor({ address, cosmWasmClient, - signingCosmWasmClient + signingCosmWasmClient, }: IContractConstructor) { - super(address, cosmWasmClient, signingCosmWasmClient, MarketplaceClient, MarketplaceQueryClient, MarketplaceMessageComposer); + super( + address, + cosmWasmClient, + signingCosmWasmClient, + MarketplaceClient, + MarketplaceQueryClient, + MarketplaceMessageComposer + ); } -} \ No newline at end of file + public getReactQueryHooks(contractAddr: string): IMarketplaceReactQueryHooks { + const queryClient = this.getQueryClient(contractAddr); + return { + useMarketplaceParamsQuery({ options }) { + return useMarketplaceParamsQuery({ + client: queryClient, + options, + }); + }, + }; + } +} 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..9645bd487 100644 --- a/examples/telescope-with-contracts/src/codegen/Marketplace.react-query.ts +++ b/examples/telescope-with-contracts/src/codegen/Marketplace.react-query.ts @@ -1,151 +1,257 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@latest. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ + * This file was automatically generated by @cosmwasm/ts-codegen@latest. + * 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 { 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 { UseQueryOptions, UseQueryResult, useQuery } from 'react-query'; +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'; export interface MarketplaceReactQuery { client: MarketplaceQueryClient; options?: UseQueryOptions; } -export interface MarketplaceParamsQuery extends MarketplaceReactQuery {} +export interface MarketplaceParamsQuery + extends MarketplaceReactQuery {} export function useMarketplaceParamsQuery({ client, - options + options, }: MarketplaceParamsQuery) { - return useQuery(["marketplaceParams", client.contractAddress], () => client.params(), options); -} -export interface MarketplaceSaleHooksQuery extends MarketplaceReactQuery {} + return useQuery( + ['marketplaceParams', client.contractAddress], + () => client.params(), + options + ); +} +export interface MarketplaceSaleHooksQuery + extends MarketplaceReactQuery {} export function useMarketplaceSaleHooksQuery({ client, - options + options, }: MarketplaceSaleHooksQuery) { - return useQuery(["marketplaceSaleHooks", client.contractAddress], () => client.saleHooks(), options); -} -export interface MarketplaceBidHooksQuery extends MarketplaceReactQuery {} + return useQuery( + ['marketplaceSaleHooks', client.contractAddress], + () => client.saleHooks(), + options + ); +} +export interface MarketplaceBidHooksQuery + extends MarketplaceReactQuery {} export function useMarketplaceBidHooksQuery({ client, - options + options, }: MarketplaceBidHooksQuery) { - return useQuery(["marketplaceBidHooks", client.contractAddress], () => client.bidHooks(), options); -} -export interface MarketplaceAskHooksQuery extends MarketplaceReactQuery {} + return useQuery( + ['marketplaceBidHooks', client.contractAddress], + () => client.bidHooks(), + options + ); +} +export interface MarketplaceAskHooksQuery + extends MarketplaceReactQuery {} export function useMarketplaceAskHooksQuery({ client, - options + options, }: MarketplaceAskHooksQuery) { - return useQuery(["marketplaceAskHooks", client.contractAddress], () => client.askHooks(), options); -} -export interface MarketplaceReverseCollectionBidsSortedByPriceQuery extends MarketplaceReactQuery { + return useQuery( + ['marketplaceAskHooks', client.contractAddress], + () => client.askHooks(), + options + ); +} +export interface MarketplaceReverseCollectionBidsSortedByPriceQuery + extends MarketplaceReactQuery { args: { collection: string; limit?: number; startBefore?: CollectionBidOffset; }; } -export function useMarketplaceReverseCollectionBidsSortedByPriceQuery({ +export function useMarketplaceReverseCollectionBidsSortedByPriceQuery< + TData = CollectionBidResponse +>({ client, args, - options + options, }: MarketplaceReverseCollectionBidsSortedByPriceQuery) { - return useQuery(["marketplaceReverseCollectionBidsSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.reverseCollectionBidsSortedByPrice({ - collection: args.collection, - limit: args.limit, - startBefore: args.startBefore - }), options); -} -export interface MarketplaceCollectionBidsSortedByPriceQuery extends MarketplaceReactQuery { + return useQuery( + [ + 'marketplaceReverseCollectionBidsSortedByPrice', + client.contractAddress, + JSON.stringify(args), + ], + () => + client.reverseCollectionBidsSortedByPrice({ + collection: args.collection, + limit: args.limit, + startBefore: args.startBefore, + }), + options + ); +} +export interface MarketplaceCollectionBidsSortedByPriceQuery + extends MarketplaceReactQuery { args: { collection: string; limit?: number; startAfter?: CollectionBidOffset; }; } -export function useMarketplaceCollectionBidsSortedByPriceQuery({ +export function useMarketplaceCollectionBidsSortedByPriceQuery< + TData = CollectionBidResponse +>({ client, args, - options + options, }: MarketplaceCollectionBidsSortedByPriceQuery) { - return useQuery(["marketplaceCollectionBidsSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.collectionBidsSortedByPrice({ - collection: args.collection, - limit: args.limit, - startAfter: args.startAfter - }), options); -} -export interface MarketplaceCollectionBidsByBidderSortedByExpirationQuery extends MarketplaceReactQuery { + return useQuery( + [ + 'marketplaceCollectionBidsSortedByPrice', + client.contractAddress, + JSON.stringify(args), + ], + () => + client.collectionBidsSortedByPrice({ + collection: args.collection, + limit: args.limit, + startAfter: args.startAfter, + }), + options + ); +} +export interface MarketplaceCollectionBidsByBidderSortedByExpirationQuery + extends MarketplaceReactQuery { args: { bidder: string; limit?: number; startAfter?: CollectionBidOffset; }; } -export function useMarketplaceCollectionBidsByBidderSortedByExpirationQuery({ +export function useMarketplaceCollectionBidsByBidderSortedByExpirationQuery< + TData = CollectionBidResponse +>({ client, args, - options + options, }: MarketplaceCollectionBidsByBidderSortedByExpirationQuery) { - return useQuery(["marketplaceCollectionBidsByBidderSortedByExpiration", client.contractAddress, JSON.stringify(args)], () => client.collectionBidsByBidderSortedByExpiration({ - bidder: args.bidder, - limit: args.limit, - startAfter: args.startAfter - }), options); -} -export interface MarketplaceCollectionBidsByBidderQuery extends MarketplaceReactQuery { + return useQuery( + [ + 'marketplaceCollectionBidsByBidderSortedByExpiration', + client.contractAddress, + JSON.stringify(args), + ], + () => + client.collectionBidsByBidderSortedByExpiration({ + bidder: args.bidder, + limit: args.limit, + startAfter: args.startAfter, + }), + options + ); +} +export interface MarketplaceCollectionBidsByBidderQuery + extends MarketplaceReactQuery { args: { bidder: string; limit?: number; startAfter?: CollectionOffset; }; } -export function useMarketplaceCollectionBidsByBidderQuery({ - client, - args, - options -}: MarketplaceCollectionBidsByBidderQuery) { - return useQuery(["marketplaceCollectionBidsByBidder", client.contractAddress, JSON.stringify(args)], () => client.collectionBidsByBidder({ - bidder: args.bidder, - limit: args.limit, - startAfter: args.startAfter - }), options); -} -export interface MarketplaceCollectionBidQuery extends MarketplaceReactQuery { +export function useMarketplaceCollectionBidsByBidderQuery< + TData = CollectionBidResponse +>({ client, args, options }: MarketplaceCollectionBidsByBidderQuery) { + return useQuery( + [ + 'marketplaceCollectionBidsByBidder', + client.contractAddress, + JSON.stringify(args), + ], + () => + client.collectionBidsByBidder({ + bidder: args.bidder, + limit: args.limit, + startAfter: args.startAfter, + }), + options + ); +} +export interface MarketplaceCollectionBidQuery + extends MarketplaceReactQuery { args: { bidder: string; collection: string; }; } -export function useMarketplaceCollectionBidQuery({ - client, - args, - options -}: MarketplaceCollectionBidQuery) { - return useQuery(["marketplaceCollectionBid", client.contractAddress, JSON.stringify(args)], () => client.collectionBid({ - bidder: args.bidder, - collection: args.collection - }), options); -} -export interface MarketplaceReverseBidsSortedByPriceQuery extends MarketplaceReactQuery { +export function useMarketplaceCollectionBidQuery< + TData = CollectionBidResponse +>({ client, args, options }: MarketplaceCollectionBidQuery) { + return useQuery( + ['marketplaceCollectionBid', client.contractAddress, JSON.stringify(args)], + () => + client.collectionBid({ + bidder: args.bidder, + collection: args.collection, + }), + options + ); +} +export interface MarketplaceReverseBidsSortedByPriceQuery + extends MarketplaceReactQuery { args: { collection: string; limit?: number; startBefore?: BidOffset; }; } -export function useMarketplaceReverseBidsSortedByPriceQuery({ - client, - args, - options -}: MarketplaceReverseBidsSortedByPriceQuery) { - return useQuery(["marketplaceReverseBidsSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.reverseBidsSortedByPrice({ - collection: args.collection, - limit: args.limit, - startBefore: args.startBefore - }), options); -} -export interface MarketplaceBidsSortedByPriceQuery extends MarketplaceReactQuery { +export function useMarketplaceReverseBidsSortedByPriceQuery< + TData = BidsResponse +>({ client, args, options }: MarketplaceReverseBidsSortedByPriceQuery) { + return useQuery( + [ + 'marketplaceReverseBidsSortedByPrice', + client.contractAddress, + JSON.stringify(args), + ], + () => + client.reverseBidsSortedByPrice({ + collection: args.collection, + limit: args.limit, + startBefore: args.startBefore, + }), + options + ); +} +export interface MarketplaceBidsSortedByPriceQuery + extends MarketplaceReactQuery { args: { collection: string; limit?: number; @@ -155,15 +261,25 @@ export interface MarketplaceBidsSortedByPriceQuery extends MarketplaceRea export function useMarketplaceBidsSortedByPriceQuery({ client, args, - options + options, }: MarketplaceBidsSortedByPriceQuery) { - return useQuery(["marketplaceBidsSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.bidsSortedByPrice({ - collection: args.collection, - limit: args.limit, - startAfter: args.startAfter - }), options); -} -export interface MarketplaceBidsQuery extends MarketplaceReactQuery { + return useQuery( + [ + 'marketplaceBidsSortedByPrice', + client.contractAddress, + JSON.stringify(args), + ], + () => + client.bidsSortedByPrice({ + collection: args.collection, + limit: args.limit, + startAfter: args.startAfter, + }), + options + ); +} +export interface MarketplaceBidsQuery + extends MarketplaceReactQuery { args: { collection: string; limit?: number; @@ -174,34 +290,52 @@ export interface MarketplaceBidsQuery extends MarketplaceReactQuery({ client, args, - options + options, }: MarketplaceBidsQuery) { - return useQuery(["marketplaceBids", client.contractAddress, JSON.stringify(args)], () => client.bids({ - collection: args.collection, - limit: args.limit, - startAfter: args.startAfter, - tokenId: args.tokenId - }), options); -} -export interface MarketplaceBidsByBidderSortedByExpirationQuery extends MarketplaceReactQuery { + return useQuery( + ['marketplaceBids', client.contractAddress, JSON.stringify(args)], + () => + client.bids({ + collection: args.collection, + limit: args.limit, + startAfter: args.startAfter, + tokenId: args.tokenId, + }), + options + ); +} +export interface MarketplaceBidsByBidderSortedByExpirationQuery + extends MarketplaceReactQuery { args: { bidder: string; limit?: number; startAfter?: CollectionOffset; }; } -export function useMarketplaceBidsByBidderSortedByExpirationQuery({ +export function useMarketplaceBidsByBidderSortedByExpirationQuery< + TData = BidsResponse +>({ client, args, - options + options, }: MarketplaceBidsByBidderSortedByExpirationQuery) { - return useQuery(["marketplaceBidsByBidderSortedByExpiration", client.contractAddress, JSON.stringify(args)], () => client.bidsByBidderSortedByExpiration({ - bidder: args.bidder, - limit: args.limit, - startAfter: args.startAfter - }), options); -} -export interface MarketplaceBidsByBidderQuery extends MarketplaceReactQuery { + return useQuery( + [ + 'marketplaceBidsByBidderSortedByExpiration', + client.contractAddress, + JSON.stringify(args), + ], + () => + client.bidsByBidderSortedByExpiration({ + bidder: args.bidder, + limit: args.limit, + startAfter: args.startAfter, + }), + options + ); +} +export interface MarketplaceBidsByBidderQuery + extends MarketplaceReactQuery { args: { bidder: string; limit?: number; @@ -211,15 +345,21 @@ export interface MarketplaceBidsByBidderQuery extends MarketplaceReactQue export function useMarketplaceBidsByBidderQuery({ client, args, - options + options, }: MarketplaceBidsByBidderQuery) { - return useQuery(["marketplaceBidsByBidder", client.contractAddress, JSON.stringify(args)], () => client.bidsByBidder({ - bidder: args.bidder, - limit: args.limit, - startAfter: args.startAfter - }), options); -} -export interface MarketplaceBidQuery extends MarketplaceReactQuery { + return useQuery( + ['marketplaceBidsByBidder', client.contractAddress, JSON.stringify(args)], + () => + client.bidsByBidder({ + bidder: args.bidder, + limit: args.limit, + startAfter: args.startAfter, + }), + options + ); +} +export interface MarketplaceBidQuery + extends MarketplaceReactQuery { args: { bidder: string; collection: string; @@ -229,15 +369,21 @@ export interface MarketplaceBidQuery extends MarketplaceReactQuery({ client, args, - options + options, }: MarketplaceBidQuery) { - return useQuery(["marketplaceBid", client.contractAddress, JSON.stringify(args)], () => client.bid({ - bidder: args.bidder, - collection: args.collection, - tokenId: args.tokenId - }), options); -} -export interface MarketplaceAsksBySellerQuery extends MarketplaceReactQuery { + return useQuery( + ['marketplaceBid', client.contractAddress, JSON.stringify(args)], + () => + client.bid({ + bidder: args.bidder, + collection: args.collection, + tokenId: args.tokenId, + }), + options + ); +} +export interface MarketplaceAsksBySellerQuery + extends MarketplaceReactQuery { args: { includeInactive?: boolean; limit?: number; @@ -248,16 +394,22 @@ export interface MarketplaceAsksBySellerQuery extends MarketplaceReactQue export function useMarketplaceAsksBySellerQuery({ client, args, - options + options, }: MarketplaceAsksBySellerQuery) { - return useQuery(["marketplaceAsksBySeller", client.contractAddress, JSON.stringify(args)], () => client.asksBySeller({ - includeInactive: args.includeInactive, - limit: args.limit, - seller: args.seller, - startAfter: args.startAfter - }), options); -} -export interface MarketplaceAskCountQuery extends MarketplaceReactQuery { + return useQuery( + ['marketplaceAsksBySeller', client.contractAddress, JSON.stringify(args)], + () => + client.asksBySeller({ + includeInactive: args.includeInactive, + limit: args.limit, + seller: args.seller, + startAfter: args.startAfter, + }), + options + ); +} +export interface MarketplaceAskCountQuery + extends MarketplaceReactQuery { args: { collection: string; }; @@ -265,13 +417,19 @@ export interface MarketplaceAskCountQuery extends MarketplaceReactQuery({ client, args, - options + options, }: MarketplaceAskCountQuery) { - return useQuery(["marketplaceAskCount", client.contractAddress, JSON.stringify(args)], () => client.askCount({ - collection: args.collection - }), options); -} -export interface MarketplaceReverseAsksSortedByPriceQuery extends MarketplaceReactQuery { + return useQuery( + ['marketplaceAskCount', client.contractAddress, JSON.stringify(args)], + () => + client.askCount({ + collection: args.collection, + }), + options + ); +} +export interface MarketplaceReverseAsksSortedByPriceQuery + extends MarketplaceReactQuery { args: { collection: string; includeInactive?: boolean; @@ -279,19 +437,27 @@ export interface MarketplaceReverseAsksSortedByPriceQuery extends Marketp startBefore?: AskOffset; }; } -export function useMarketplaceReverseAsksSortedByPriceQuery({ - client, - args, - options -}: MarketplaceReverseAsksSortedByPriceQuery) { - return useQuery(["marketplaceReverseAsksSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.reverseAsksSortedByPrice({ - collection: args.collection, - includeInactive: args.includeInactive, - limit: args.limit, - startBefore: args.startBefore - }), options); -} -export interface MarketplaceAsksSortedByPriceQuery extends MarketplaceReactQuery { +export function useMarketplaceReverseAsksSortedByPriceQuery< + TData = AsksResponse +>({ client, args, options }: MarketplaceReverseAsksSortedByPriceQuery) { + return useQuery( + [ + 'marketplaceReverseAsksSortedByPrice', + client.contractAddress, + JSON.stringify(args), + ], + () => + client.reverseAsksSortedByPrice({ + collection: args.collection, + includeInactive: args.includeInactive, + limit: args.limit, + startBefore: args.startBefore, + }), + options + ); +} +export interface MarketplaceAsksSortedByPriceQuery + extends MarketplaceReactQuery { args: { collection: string; includeInactive?: boolean; @@ -302,16 +468,26 @@ export interface MarketplaceAsksSortedByPriceQuery extends MarketplaceRea export function useMarketplaceAsksSortedByPriceQuery({ client, args, - options + options, }: MarketplaceAsksSortedByPriceQuery) { - return useQuery(["marketplaceAsksSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.asksSortedByPrice({ - collection: args.collection, - includeInactive: args.includeInactive, - limit: args.limit, - startAfter: args.startAfter - }), options); -} -export interface MarketplaceReverseAsksQuery extends MarketplaceReactQuery { + return useQuery( + [ + 'marketplaceAsksSortedByPrice', + client.contractAddress, + JSON.stringify(args), + ], + () => + client.asksSortedByPrice({ + collection: args.collection, + includeInactive: args.includeInactive, + limit: args.limit, + startAfter: args.startAfter, + }), + options + ); +} +export interface MarketplaceReverseAsksQuery + extends MarketplaceReactQuery { args: { collection: string; includeInactive?: boolean; @@ -322,16 +498,22 @@ export interface MarketplaceReverseAsksQuery extends MarketplaceReactQuer export function useMarketplaceReverseAsksQuery({ client, args, - options + options, }: MarketplaceReverseAsksQuery) { - return useQuery(["marketplaceReverseAsks", client.contractAddress, JSON.stringify(args)], () => client.reverseAsks({ - collection: args.collection, - includeInactive: args.includeInactive, - limit: args.limit, - startBefore: args.startBefore - }), options); -} -export interface MarketplaceAsksQuery extends MarketplaceReactQuery { + return useQuery( + ['marketplaceReverseAsks', client.contractAddress, JSON.stringify(args)], + () => + client.reverseAsks({ + collection: args.collection, + includeInactive: args.includeInactive, + limit: args.limit, + startBefore: args.startBefore, + }), + options + ); +} +export interface MarketplaceAsksQuery + extends MarketplaceReactQuery { args: { collection: string; includeInactive?: boolean; @@ -342,16 +524,22 @@ export interface MarketplaceAsksQuery extends MarketplaceReactQuery({ client, args, - options + options, }: MarketplaceAsksQuery) { - return useQuery(["marketplaceAsks", client.contractAddress, JSON.stringify(args)], () => client.asks({ - collection: args.collection, - includeInactive: args.includeInactive, - limit: args.limit, - startAfter: args.startAfter - }), options); -} -export interface MarketplaceAskQuery extends MarketplaceReactQuery { + return useQuery( + ['marketplaceAsks', client.contractAddress, JSON.stringify(args)], + () => + client.asks({ + collection: args.collection, + includeInactive: args.includeInactive, + limit: args.limit, + startAfter: args.startAfter, + }), + options + ); +} +export interface MarketplaceAskQuery + extends MarketplaceReactQuery { args: { collection: string; tokenId: number; @@ -360,14 +548,20 @@ export interface MarketplaceAskQuery extends MarketplaceReactQuery({ client, args, - options + options, }: MarketplaceAskQuery) { - return useQuery(["marketplaceAsk", client.contractAddress, JSON.stringify(args)], () => client.ask({ - collection: args.collection, - tokenId: args.tokenId - }), options); -} -export interface MarketplaceCollectionsQuery extends MarketplaceReactQuery { + return useQuery( + ['marketplaceAsk', client.contractAddress, JSON.stringify(args)], + () => + client.ask({ + collection: args.collection, + tokenId: args.tokenId, + }), + options + ); +} +export interface MarketplaceCollectionsQuery + extends MarketplaceReactQuery { args: { limit?: number; startAfter?: string; @@ -376,10 +570,24 @@ export interface MarketplaceCollectionsQuery extends MarketplaceReactQuer export function useMarketplaceCollectionsQuery({ client, args, - options + options, }: MarketplaceCollectionsQuery) { - return useQuery(["marketplaceCollections", client.contractAddress, JSON.stringify(args)], () => client.collections({ - limit: args.limit, - startAfter: args.startAfter - }), options); -} \ No newline at end of file + return useQuery( + ['marketplaceCollections', client.contractAddress, JSON.stringify(args)], + () => + client.collections({ + limit: args.limit, + startAfter: args.startAfter, + }), + options + ); +} + +export interface IMarketplaceReactQueryHooks { + useMarketplaceParamsQuery({ + options, + }: Omit, 'client'>): UseQueryResult< + TData, + Error + >; +} diff --git a/examples/telescope-with-contracts/src/codegen/Marketplace.types.ts b/examples/telescope-with-contracts/src/codegen/Marketplace.types.ts index 91157f155..52007deca 100644 --- a/examples/telescope-with-contracts/src/codegen/Marketplace.types.ts +++ b/examples/telescope-with-contracts/src/codegen/Marketplace.types.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.client.ts b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.client.ts index fcb025202..533771a57 100644 --- a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.client.ts +++ b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.client.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.message-composer.ts b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.message-composer.ts index 4e7786c8c..d717a293b 100644 --- a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.message-composer.ts +++ b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.message-composer.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.provider.ts b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.provider.ts index b79f97520..3323d5bd5 100644 --- a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.provider.ts +++ b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.provider.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.types.ts b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.types.ts index d32038ee5..3514a20bb 100644 --- a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.types.ts +++ b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.types.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/Whitelist.client.ts b/examples/telescope-with-contracts/src/codegen/Whitelist.client.ts index 7fcc9041d..bfe0524af 100644 --- a/examples/telescope-with-contracts/src/codegen/Whitelist.client.ts +++ b/examples/telescope-with-contracts/src/codegen/Whitelist.client.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/Whitelist.message-composer.ts b/examples/telescope-with-contracts/src/codegen/Whitelist.message-composer.ts index c36af9e9f..ad3e3f2fc 100644 --- a/examples/telescope-with-contracts/src/codegen/Whitelist.message-composer.ts +++ b/examples/telescope-with-contracts/src/codegen/Whitelist.message-composer.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/Whitelist.provider.ts b/examples/telescope-with-contracts/src/codegen/Whitelist.provider.ts index 684712bba..ec25a4bde 100644 --- a/examples/telescope-with-contracts/src/codegen/Whitelist.provider.ts +++ b/examples/telescope-with-contracts/src/codegen/Whitelist.provider.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/Whitelist.types.ts b/examples/telescope-with-contracts/src/codegen/Whitelist.types.ts index a48092af5..d291081bf 100644 --- a/examples/telescope-with-contracts/src/codegen/Whitelist.types.ts +++ b/examples/telescope-with-contracts/src/codegen/Whitelist.types.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/examples/telescope-with-contracts/src/codegen/contractContextBase.ts b/examples/telescope-with-contracts/src/codegen/contractContextBase.ts index 440290397..52bc17612 100644 --- a/examples/telescope-with-contracts/src/codegen/contractContextBase.ts +++ b/examples/telescope-with-contracts/src/codegen/contractContextBase.ts @@ -48,6 +48,10 @@ export interface IMessageComposerProvider { getMessageComposer(contractAddr: string): T; } +export interface IReactQueryHooksProvider { + getReactQueryHooks(contractAddr: string): T; +} + export class ContractBase< TSign = IEmptyClient, TQuery = IEmptyClient, diff --git a/examples/telescope-with-contracts/src/codegen/contractContextProviders.ts b/examples/telescope-with-contracts/src/codegen/contractContextProviders.ts index d35e35219..2a3d63767 100644 --- a/examples/telescope-with-contracts/src/codegen/contractContextProviders.ts +++ b/examples/telescope-with-contracts/src/codegen/contractContextProviders.ts @@ -1,42 +1,64 @@ /** -* 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. -*/ + * 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 { CosmWasmClient, SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; -import { IQueryClientProvider, ISigningClientProvider, IMessageComposerProvider } from "./contractContextBase"; -import { Sg721UpdatableQueryClient } from "./Sg721Updatable.client"; -import { Sg721UpdatableClient } from "./Sg721Updatable.client"; -import { Sg721UpdatableMessageComposer } from "./Sg721Updatable.message-composer"; -import { Sg721Updatable } from "./Sg721Updatable.provider"; -import { WhitelistQueryClient } from "./Whitelist.client"; -import { WhitelistClient } from "./Whitelist.client"; -import { WhitelistMessageComposer } from "./Whitelist.message-composer"; -import { Whitelist } from "./Whitelist.provider"; -import { MarketplaceQueryClient } from "./Marketplace.client"; -import { MarketplaceClient } from "./Marketplace.client"; -import { MarketplaceMessageComposer } from "./Marketplace.message-composer"; -import { Marketplace } from "./Marketplace.provider"; +import { + CosmWasmClient, + SigningCosmWasmClient, +} from '@cosmjs/cosmwasm-stargate'; +import { + IQueryClientProvider, + ISigningClientProvider, + IMessageComposerProvider, + IReactQueryHooksProvider, +} from './contractContextBase'; +import { Sg721UpdatableQueryClient } from './Sg721Updatable.client'; +import { Sg721UpdatableClient } from './Sg721Updatable.client'; +import { Sg721UpdatableMessageComposer } from './Sg721Updatable.message-composer'; +import { Sg721Updatable } from './Sg721Updatable.provider'; +import { WhitelistQueryClient } from './Whitelist.client'; +import { WhitelistClient } from './Whitelist.client'; +import { WhitelistMessageComposer } from './Whitelist.message-composer'; +import { Whitelist } from './Whitelist.provider'; +import { MarketplaceQueryClient } from './Marketplace.client'; +import { MarketplaceClient } from './Marketplace.client'; +import { MarketplaceMessageComposer } from './Marketplace.message-composer'; +import { + Marketplace, + MarketplaceReactQueryHooks, +} from './Marketplace.provider'; export interface IContractsContext { - sg721Updatable: IQueryClientProvider & ISigningClientProvider & IMessageComposerProvider; - whitelist: IQueryClientProvider & ISigningClientProvider & IMessageComposerProvider; - marketplace: IQueryClientProvider & ISigningClientProvider & IMessageComposerProvider; + sg721Updatable: IQueryClientProvider & + ISigningClientProvider & + IMessageComposerProvider; + whitelist: IQueryClientProvider & + ISigningClientProvider & + IMessageComposerProvider; + marketplace: IQueryClientProvider & + ISigningClientProvider & + IMessageComposerProvider & + IReactQueryHooksProvider; } -export const getProviders = (address?: string, cosmWasmClient?: CosmWasmClient, signingCosmWasmClient?: SigningCosmWasmClient) => ({ +export const getProviders = ( + address?: string, + cosmWasmClient?: CosmWasmClient, + signingCosmWasmClient?: SigningCosmWasmClient +) => ({ sg721Updatable: new Sg721Updatable({ address, cosmWasmClient, - signingCosmWasmClient + signingCosmWasmClient, }), whitelist: new Whitelist({ address, cosmWasmClient, - signingCosmWasmClient + signingCosmWasmClient, }), marketplace: new Marketplace({ address, cosmWasmClient, - signingCosmWasmClient - }) -}); \ No newline at end of file + signingCosmWasmClient, + }), +}); diff --git a/examples/telescope-with-contracts/src/codegen/contracts-context.tsx b/examples/telescope-with-contracts/src/codegen/contracts-context.tsx index 625a24352..38d23ef78 100644 --- a/examples/telescope-with-contracts/src/codegen/contracts-context.tsx +++ b/examples/telescope-with-contracts/src/codegen/contracts-context.tsx @@ -1,5 +1,5 @@ /** -* This file and any referenced files were automatically generated by @cosmwasm/ts-codegen@0.31.6 +* This file and any referenced files were automatically generated by @cosmwasm/ts-codegen@latest * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or yarn proto command to regenerate this bundle. */ diff --git a/examples/telescope-with-contracts/src/codegen/contracts.ts b/examples/telescope-with-contracts/src/codegen/contracts.ts index e0ef6aa8d..f40da0639 100644 --- a/examples/telescope-with-contracts/src/codegen/contracts.ts +++ b/examples/telescope-with-contracts/src/codegen/contracts.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.31.6. +* This file was automatically generated by @cosmwasm/ts-codegen@latest. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ @@ -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 From 650607080c5b49411f57b9d2191b09fdc029b113 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Thu, 27 Jul 2023 07:32:00 +0800 Subject: [PATCH 2/2] add react-query sample in telescope-with-contract --- .../components/sell-nfts.tsx | 14 + .../components/ui/modal/nft-detail-modal.tsx | 15 +- .../ui/modal/update-price-modal.tsx | 56 +- .../components/ui/nft/list-tab.tsx | 8 - .../telescope-with-contracts/pages/_app.tsx | 49 +- .../scripts/codegen.js | 4 +- .../src/codegen/Marketplace.client.ts | 2 +- .../codegen/Marketplace.message-composer.ts | 2 +- .../src/codegen/Marketplace.provider.ts | 54 +- .../src/codegen/Marketplace.react-query.ts | 967 ++++++++++-------- .../src/codegen/Marketplace.types.ts | 2 +- .../src/codegen/Sg721Updatable.client.ts | 2 +- .../Sg721Updatable.message-composer.ts | 2 +- .../src/codegen/Sg721Updatable.provider.ts | 2 +- .../src/codegen/Sg721Updatable.react-query.ts | 337 +++++- .../src/codegen/Sg721Updatable.types.ts | 2 +- .../src/codegen/Whitelist.client.ts | 2 +- .../src/codegen/Whitelist.message-composer.ts | 2 +- .../src/codegen/Whitelist.provider.ts | 2 +- .../src/codegen/Whitelist.react-query.ts | 170 ++- .../src/codegen/Whitelist.types.ts | 2 +- .../src/codegen/contractContextBase.ts | 4 - .../src/codegen/contractContextProviders.ts | 76 +- .../src/codegen/contracts-context.tsx | 2 +- .../src/codegen/contracts.ts | 2 +- yarn.lock | 75 +- 26 files changed, 1296 insertions(+), 559 deletions(-) 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 = ({ { if (!address) return; setIsLoading(true); diff --git a/examples/telescope-with-contracts/pages/_app.tsx b/examples/telescope-with-contracts/pages/_app.tsx index e61faf6cc..7636d39be 100644 --- a/examples/telescope-with-contracts/pages/_app.tsx +++ b/examples/telescope-with-contracts/pages/_app.tsx @@ -14,6 +14,9 @@ import { GasPrice } from '@cosmjs/stargate'; import { SignerOptions } from '@cosmos-kit/core'; import { Chain } from '@chain-registry/types'; import { defaultTheme } from 'config'; +import { QueryClientProvider, QueryClient } from '@tanstack/react-query'; + +const queryClient = new QueryClient(); const client = new ApolloClient({ uri: 'https://constellations-api.mainnet.stargaze-apis.com/graphql', @@ -37,29 +40,31 @@ function CreateCosmosApp({ Component, pageProps }: AppProps) { return ( - + - - - - + }} + wrappedWithChakra={true} + signerOptions={signerOptions} + > + + + + + ); } diff --git a/examples/telescope-with-contracts/scripts/codegen.js b/examples/telescope-with-contracts/scripts/codegen.js index ec23b3f1d..267962f69 100644 --- a/examples/telescope-with-contracts/scripts/codegen.js +++ b/examples/telescope-with-contracts/scripts/codegen.js @@ -80,7 +80,9 @@ telescope({ enabled: true, }, reactQuery: { - enabled: true + enabled: true, + version: 'v4', + mutations: true, }, useContractsHooks: { enabled: true diff --git a/examples/telescope-with-contracts/src/codegen/Marketplace.client.ts b/examples/telescope-with-contracts/src/codegen/Marketplace.client.ts index fa6c4aa3f..46b738821 100644 --- a/examples/telescope-with-contracts/src/codegen/Marketplace.client.ts +++ b/examples/telescope-with-contracts/src/codegen/Marketplace.client.ts @@ -1,5 +1,5 @@ /** -* 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. */ diff --git a/examples/telescope-with-contracts/src/codegen/Marketplace.message-composer.ts b/examples/telescope-with-contracts/src/codegen/Marketplace.message-composer.ts index a947afa4a..6afe3c338 100644 --- a/examples/telescope-with-contracts/src/codegen/Marketplace.message-composer.ts +++ b/examples/telescope-with-contracts/src/codegen/Marketplace.message-composer.ts @@ -1,5 +1,5 @@ /** -* 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. */ diff --git a/examples/telescope-with-contracts/src/codegen/Marketplace.provider.ts b/examples/telescope-with-contracts/src/codegen/Marketplace.provider.ts index 168c1b272..12606aec7 100644 --- a/examples/telescope-with-contracts/src/codegen/Marketplace.provider.ts +++ b/examples/telescope-with-contracts/src/codegen/Marketplace.provider.ts @@ -1,51 +1,19 @@ /** - * 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. - */ +* 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 { UseQueryResult } from 'react-query'; -import { ContractBase, IContractConstructor } from './contractContextBase'; -import { - MarketplaceClient, - MarketplaceQueryClient, -} from './Marketplace.client'; -import { MarketplaceMessageComposer } from './Marketplace.message-composer'; -import { - IMarketplaceReactQueryHooks, - MarketplaceParamsQuery, - useMarketplaceParamsQuery, -} from './Marketplace.react-query'; -import { ParamsResponse } from './Marketplace.types'; -export class Marketplace extends ContractBase< - MarketplaceClient, - MarketplaceQueryClient, - MarketplaceMessageComposer -> { +import { ContractBase, IContractConstructor } from "./contractContextBase"; +import { MarketplaceClient, MarketplaceQueryClient } from "./Marketplace.client"; +import { MarketplaceMessageComposer } from "./Marketplace.message-composer"; +export class Marketplace extends ContractBase { constructor({ address, cosmWasmClient, - signingCosmWasmClient, + signingCosmWasmClient }: IContractConstructor) { - super( - address, - cosmWasmClient, - signingCosmWasmClient, - MarketplaceClient, - MarketplaceQueryClient, - MarketplaceMessageComposer - ); + super(address, cosmWasmClient, signingCosmWasmClient, MarketplaceClient, MarketplaceQueryClient, MarketplaceMessageComposer); } - public getReactQueryHooks(contractAddr: string): IMarketplaceReactQueryHooks { - const queryClient = this.getQueryClient(contractAddr); - return { - useMarketplaceParamsQuery({ options }) { - return useMarketplaceParamsQuery({ - client: queryClient, - options, - }); - }, - }; - } -} +} \ No newline at end of file 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 9645bd487..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,257 +1,155 @@ /** - * This file was automatically generated by @cosmwasm/ts-codegen@latest. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ +* 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, UseQueryResult, useQuery } from 'react-query'; -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 { 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, MarketplaceClient } from "./Marketplace.client"; export interface MarketplaceReactQuery { client: MarketplaceQueryClient; - options?: UseQueryOptions; + options?: Omit, "'queryKey' | 'queryFn' | 'initialData'"> & { + initialData?: undefined; + }; } -export interface MarketplaceParamsQuery - extends MarketplaceReactQuery {} +export interface MarketplaceParamsQuery extends MarketplaceReactQuery {} export function useMarketplaceParamsQuery({ client, - options, + options }: MarketplaceParamsQuery) { - return useQuery( - ['marketplaceParams', client.contractAddress], - () => client.params(), - options - ); -} -export interface MarketplaceSaleHooksQuery - extends MarketplaceReactQuery {} + return useQuery(["marketplaceParams", client.contractAddress], () => client.params(), options); +} +export interface MarketplaceSaleHooksQuery extends MarketplaceReactQuery {} export function useMarketplaceSaleHooksQuery({ client, - options, + options }: MarketplaceSaleHooksQuery) { - return useQuery( - ['marketplaceSaleHooks', client.contractAddress], - () => client.saleHooks(), - options - ); -} -export interface MarketplaceBidHooksQuery - extends MarketplaceReactQuery {} + return useQuery(["marketplaceSaleHooks", client.contractAddress], () => client.saleHooks(), options); +} +export interface MarketplaceBidHooksQuery extends MarketplaceReactQuery {} export function useMarketplaceBidHooksQuery({ client, - options, + options }: MarketplaceBidHooksQuery) { - return useQuery( - ['marketplaceBidHooks', client.contractAddress], - () => client.bidHooks(), - options - ); -} -export interface MarketplaceAskHooksQuery - extends MarketplaceReactQuery {} + return useQuery(["marketplaceBidHooks", client.contractAddress], () => client.bidHooks(), options); +} +export interface MarketplaceAskHooksQuery extends MarketplaceReactQuery {} export function useMarketplaceAskHooksQuery({ client, - options, + options }: MarketplaceAskHooksQuery) { - return useQuery( - ['marketplaceAskHooks', client.contractAddress], - () => client.askHooks(), - options - ); -} -export interface MarketplaceReverseCollectionBidsSortedByPriceQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceAskHooks", client.contractAddress], () => client.askHooks(), options); +} +export interface MarketplaceReverseCollectionBidsSortedByPriceQuery extends MarketplaceReactQuery { args: { collection: string; limit?: number; startBefore?: CollectionBidOffset; }; } -export function useMarketplaceReverseCollectionBidsSortedByPriceQuery< - TData = CollectionBidResponse ->({ +export function useMarketplaceReverseCollectionBidsSortedByPriceQuery({ client, args, - options, + options }: MarketplaceReverseCollectionBidsSortedByPriceQuery) { - return useQuery( - [ - 'marketplaceReverseCollectionBidsSortedByPrice', - client.contractAddress, - JSON.stringify(args), - ], - () => - client.reverseCollectionBidsSortedByPrice({ - collection: args.collection, - limit: args.limit, - startBefore: args.startBefore, - }), - options - ); -} -export interface MarketplaceCollectionBidsSortedByPriceQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceReverseCollectionBidsSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.reverseCollectionBidsSortedByPrice({ + collection: args.collection, + limit: args.limit, + startBefore: args.startBefore + }), options); +} +export interface MarketplaceCollectionBidsSortedByPriceQuery extends MarketplaceReactQuery { args: { collection: string; limit?: number; startAfter?: CollectionBidOffset; }; } -export function useMarketplaceCollectionBidsSortedByPriceQuery< - TData = CollectionBidResponse ->({ +export function useMarketplaceCollectionBidsSortedByPriceQuery({ client, args, - options, + options }: MarketplaceCollectionBidsSortedByPriceQuery) { - return useQuery( - [ - 'marketplaceCollectionBidsSortedByPrice', - client.contractAddress, - JSON.stringify(args), - ], - () => - client.collectionBidsSortedByPrice({ - collection: args.collection, - limit: args.limit, - startAfter: args.startAfter, - }), - options - ); -} -export interface MarketplaceCollectionBidsByBidderSortedByExpirationQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceCollectionBidsSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.collectionBidsSortedByPrice({ + collection: args.collection, + limit: args.limit, + startAfter: args.startAfter + }), options); +} +export interface MarketplaceCollectionBidsByBidderSortedByExpirationQuery extends MarketplaceReactQuery { args: { bidder: string; limit?: number; startAfter?: CollectionBidOffset; }; } -export function useMarketplaceCollectionBidsByBidderSortedByExpirationQuery< - TData = CollectionBidResponse ->({ +export function useMarketplaceCollectionBidsByBidderSortedByExpirationQuery({ client, args, - options, + options }: MarketplaceCollectionBidsByBidderSortedByExpirationQuery) { - return useQuery( - [ - 'marketplaceCollectionBidsByBidderSortedByExpiration', - client.contractAddress, - JSON.stringify(args), - ], - () => - client.collectionBidsByBidderSortedByExpiration({ - bidder: args.bidder, - limit: args.limit, - startAfter: args.startAfter, - }), - options - ); -} -export interface MarketplaceCollectionBidsByBidderQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceCollectionBidsByBidderSortedByExpiration", client.contractAddress, JSON.stringify(args)], () => client.collectionBidsByBidderSortedByExpiration({ + bidder: args.bidder, + limit: args.limit, + startAfter: args.startAfter + }), options); +} +export interface MarketplaceCollectionBidsByBidderQuery extends MarketplaceReactQuery { args: { bidder: string; limit?: number; startAfter?: CollectionOffset; }; } -export function useMarketplaceCollectionBidsByBidderQuery< - TData = CollectionBidResponse ->({ client, args, options }: MarketplaceCollectionBidsByBidderQuery) { - return useQuery( - [ - 'marketplaceCollectionBidsByBidder', - client.contractAddress, - JSON.stringify(args), - ], - () => - client.collectionBidsByBidder({ - bidder: args.bidder, - limit: args.limit, - startAfter: args.startAfter, - }), - options - ); -} -export interface MarketplaceCollectionBidQuery - extends MarketplaceReactQuery { +export function useMarketplaceCollectionBidsByBidderQuery({ + client, + args, + options +}: MarketplaceCollectionBidsByBidderQuery) { + return useQuery(["marketplaceCollectionBidsByBidder", client.contractAddress, JSON.stringify(args)], () => client.collectionBidsByBidder({ + bidder: args.bidder, + limit: args.limit, + startAfter: args.startAfter + }), options); +} +export interface MarketplaceCollectionBidQuery extends MarketplaceReactQuery { args: { bidder: string; collection: string; }; } -export function useMarketplaceCollectionBidQuery< - TData = CollectionBidResponse ->({ client, args, options }: MarketplaceCollectionBidQuery) { - return useQuery( - ['marketplaceCollectionBid', client.contractAddress, JSON.stringify(args)], - () => - client.collectionBid({ - bidder: args.bidder, - collection: args.collection, - }), - options - ); -} -export interface MarketplaceReverseBidsSortedByPriceQuery - extends MarketplaceReactQuery { +export function useMarketplaceCollectionBidQuery({ + client, + args, + options +}: MarketplaceCollectionBidQuery) { + return useQuery(["marketplaceCollectionBid", client.contractAddress, JSON.stringify(args)], () => client.collectionBid({ + bidder: args.bidder, + collection: args.collection + }), options); +} +export interface MarketplaceReverseBidsSortedByPriceQuery extends MarketplaceReactQuery { args: { collection: string; limit?: number; startBefore?: BidOffset; }; } -export function useMarketplaceReverseBidsSortedByPriceQuery< - TData = BidsResponse ->({ client, args, options }: MarketplaceReverseBidsSortedByPriceQuery) { - return useQuery( - [ - 'marketplaceReverseBidsSortedByPrice', - client.contractAddress, - JSON.stringify(args), - ], - () => - client.reverseBidsSortedByPrice({ - collection: args.collection, - limit: args.limit, - startBefore: args.startBefore, - }), - options - ); -} -export interface MarketplaceBidsSortedByPriceQuery - extends MarketplaceReactQuery { +export function useMarketplaceReverseBidsSortedByPriceQuery({ + client, + args, + options +}: MarketplaceReverseBidsSortedByPriceQuery) { + return useQuery(["marketplaceReverseBidsSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.reverseBidsSortedByPrice({ + collection: args.collection, + limit: args.limit, + startBefore: args.startBefore + }), options); +} +export interface MarketplaceBidsSortedByPriceQuery extends MarketplaceReactQuery { args: { collection: string; limit?: number; @@ -261,25 +159,15 @@ export interface MarketplaceBidsSortedByPriceQuery export function useMarketplaceBidsSortedByPriceQuery({ client, args, - options, + options }: MarketplaceBidsSortedByPriceQuery) { - return useQuery( - [ - 'marketplaceBidsSortedByPrice', - client.contractAddress, - JSON.stringify(args), - ], - () => - client.bidsSortedByPrice({ - collection: args.collection, - limit: args.limit, - startAfter: args.startAfter, - }), - options - ); -} -export interface MarketplaceBidsQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceBidsSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.bidsSortedByPrice({ + collection: args.collection, + limit: args.limit, + startAfter: args.startAfter + }), options); +} +export interface MarketplaceBidsQuery extends MarketplaceReactQuery { args: { collection: string; limit?: number; @@ -290,52 +178,34 @@ export interface MarketplaceBidsQuery export function useMarketplaceBidsQuery({ client, args, - options, + options }: MarketplaceBidsQuery) { - return useQuery( - ['marketplaceBids', client.contractAddress, JSON.stringify(args)], - () => - client.bids({ - collection: args.collection, - limit: args.limit, - startAfter: args.startAfter, - tokenId: args.tokenId, - }), - options - ); -} -export interface MarketplaceBidsByBidderSortedByExpirationQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceBids", client.contractAddress, JSON.stringify(args)], () => client.bids({ + collection: args.collection, + limit: args.limit, + startAfter: args.startAfter, + tokenId: args.tokenId + }), options); +} +export interface MarketplaceBidsByBidderSortedByExpirationQuery extends MarketplaceReactQuery { args: { bidder: string; limit?: number; startAfter?: CollectionOffset; }; } -export function useMarketplaceBidsByBidderSortedByExpirationQuery< - TData = BidsResponse ->({ +export function useMarketplaceBidsByBidderSortedByExpirationQuery({ client, args, - options, + options }: MarketplaceBidsByBidderSortedByExpirationQuery) { - return useQuery( - [ - 'marketplaceBidsByBidderSortedByExpiration', - client.contractAddress, - JSON.stringify(args), - ], - () => - client.bidsByBidderSortedByExpiration({ - bidder: args.bidder, - limit: args.limit, - startAfter: args.startAfter, - }), - options - ); -} -export interface MarketplaceBidsByBidderQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceBidsByBidderSortedByExpiration", client.contractAddress, JSON.stringify(args)], () => client.bidsByBidderSortedByExpiration({ + bidder: args.bidder, + limit: args.limit, + startAfter: args.startAfter + }), options); +} +export interface MarketplaceBidsByBidderQuery extends MarketplaceReactQuery { args: { bidder: string; limit?: number; @@ -345,21 +215,15 @@ export interface MarketplaceBidsByBidderQuery export function useMarketplaceBidsByBidderQuery({ client, args, - options, + options }: MarketplaceBidsByBidderQuery) { - return useQuery( - ['marketplaceBidsByBidder', client.contractAddress, JSON.stringify(args)], - () => - client.bidsByBidder({ - bidder: args.bidder, - limit: args.limit, - startAfter: args.startAfter, - }), - options - ); -} -export interface MarketplaceBidQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceBidsByBidder", client.contractAddress, JSON.stringify(args)], () => client.bidsByBidder({ + bidder: args.bidder, + limit: args.limit, + startAfter: args.startAfter + }), options); +} +export interface MarketplaceBidQuery extends MarketplaceReactQuery { args: { bidder: string; collection: string; @@ -369,21 +233,15 @@ export interface MarketplaceBidQuery export function useMarketplaceBidQuery({ client, args, - options, + options }: MarketplaceBidQuery) { - return useQuery( - ['marketplaceBid', client.contractAddress, JSON.stringify(args)], - () => - client.bid({ - bidder: args.bidder, - collection: args.collection, - tokenId: args.tokenId, - }), - options - ); -} -export interface MarketplaceAsksBySellerQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceBid", client.contractAddress, JSON.stringify(args)], () => client.bid({ + bidder: args.bidder, + collection: args.collection, + tokenId: args.tokenId + }), options); +} +export interface MarketplaceAsksBySellerQuery extends MarketplaceReactQuery { args: { includeInactive?: boolean; limit?: number; @@ -394,22 +252,16 @@ export interface MarketplaceAsksBySellerQuery export function useMarketplaceAsksBySellerQuery({ client, args, - options, + options }: MarketplaceAsksBySellerQuery) { - return useQuery( - ['marketplaceAsksBySeller', client.contractAddress, JSON.stringify(args)], - () => - client.asksBySeller({ - includeInactive: args.includeInactive, - limit: args.limit, - seller: args.seller, - startAfter: args.startAfter, - }), - options - ); -} -export interface MarketplaceAskCountQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceAsksBySeller", client.contractAddress, JSON.stringify(args)], () => client.asksBySeller({ + includeInactive: args.includeInactive, + limit: args.limit, + seller: args.seller, + startAfter: args.startAfter + }), options); +} +export interface MarketplaceAskCountQuery extends MarketplaceReactQuery { args: { collection: string; }; @@ -417,19 +269,13 @@ export interface MarketplaceAskCountQuery export function useMarketplaceAskCountQuery({ client, args, - options, + options }: MarketplaceAskCountQuery) { - return useQuery( - ['marketplaceAskCount', client.contractAddress, JSON.stringify(args)], - () => - client.askCount({ - collection: args.collection, - }), - options - ); -} -export interface MarketplaceReverseAsksSortedByPriceQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceAskCount", client.contractAddress, JSON.stringify(args)], () => client.askCount({ + collection: args.collection + }), options); +} +export interface MarketplaceReverseAsksSortedByPriceQuery extends MarketplaceReactQuery { args: { collection: string; includeInactive?: boolean; @@ -437,27 +283,19 @@ export interface MarketplaceReverseAsksSortedByPriceQuery startBefore?: AskOffset; }; } -export function useMarketplaceReverseAsksSortedByPriceQuery< - TData = AsksResponse ->({ client, args, options }: MarketplaceReverseAsksSortedByPriceQuery) { - return useQuery( - [ - 'marketplaceReverseAsksSortedByPrice', - client.contractAddress, - JSON.stringify(args), - ], - () => - client.reverseAsksSortedByPrice({ - collection: args.collection, - includeInactive: args.includeInactive, - limit: args.limit, - startBefore: args.startBefore, - }), - options - ); -} -export interface MarketplaceAsksSortedByPriceQuery - extends MarketplaceReactQuery { +export function useMarketplaceReverseAsksSortedByPriceQuery({ + client, + args, + options +}: MarketplaceReverseAsksSortedByPriceQuery) { + return useQuery(["marketplaceReverseAsksSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.reverseAsksSortedByPrice({ + collection: args.collection, + includeInactive: args.includeInactive, + limit: args.limit, + startBefore: args.startBefore + }), options); +} +export interface MarketplaceAsksSortedByPriceQuery extends MarketplaceReactQuery { args: { collection: string; includeInactive?: boolean; @@ -468,26 +306,16 @@ export interface MarketplaceAsksSortedByPriceQuery export function useMarketplaceAsksSortedByPriceQuery({ client, args, - options, + options }: MarketplaceAsksSortedByPriceQuery) { - return useQuery( - [ - 'marketplaceAsksSortedByPrice', - client.contractAddress, - JSON.stringify(args), - ], - () => - client.asksSortedByPrice({ - collection: args.collection, - includeInactive: args.includeInactive, - limit: args.limit, - startAfter: args.startAfter, - }), - options - ); -} -export interface MarketplaceReverseAsksQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceAsksSortedByPrice", client.contractAddress, JSON.stringify(args)], () => client.asksSortedByPrice({ + collection: args.collection, + includeInactive: args.includeInactive, + limit: args.limit, + startAfter: args.startAfter + }), options); +} +export interface MarketplaceReverseAsksQuery extends MarketplaceReactQuery { args: { collection: string; includeInactive?: boolean; @@ -498,22 +326,16 @@ export interface MarketplaceReverseAsksQuery export function useMarketplaceReverseAsksQuery({ client, args, - options, + options }: MarketplaceReverseAsksQuery) { - return useQuery( - ['marketplaceReverseAsks', client.contractAddress, JSON.stringify(args)], - () => - client.reverseAsks({ - collection: args.collection, - includeInactive: args.includeInactive, - limit: args.limit, - startBefore: args.startBefore, - }), - options - ); -} -export interface MarketplaceAsksQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceReverseAsks", client.contractAddress, JSON.stringify(args)], () => client.reverseAsks({ + collection: args.collection, + includeInactive: args.includeInactive, + limit: args.limit, + startBefore: args.startBefore + }), options); +} +export interface MarketplaceAsksQuery extends MarketplaceReactQuery { args: { collection: string; includeInactive?: boolean; @@ -524,22 +346,16 @@ export interface MarketplaceAsksQuery export function useMarketplaceAsksQuery({ client, args, - options, + options }: MarketplaceAsksQuery) { - return useQuery( - ['marketplaceAsks', client.contractAddress, JSON.stringify(args)], - () => - client.asks({ - collection: args.collection, - includeInactive: args.includeInactive, - limit: args.limit, - startAfter: args.startAfter, - }), - options - ); -} -export interface MarketplaceAskQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceAsks", client.contractAddress, JSON.stringify(args)], () => client.asks({ + collection: args.collection, + includeInactive: args.includeInactive, + limit: args.limit, + startAfter: args.startAfter + }), options); +} +export interface MarketplaceAskQuery extends MarketplaceReactQuery { args: { collection: string; tokenId: number; @@ -548,20 +364,14 @@ export interface MarketplaceAskQuery export function useMarketplaceAskQuery({ client, args, - options, + options }: MarketplaceAskQuery) { - return useQuery( - ['marketplaceAsk', client.contractAddress, JSON.stringify(args)], - () => - client.ask({ - collection: args.collection, - tokenId: args.tokenId, - }), - options - ); -} -export interface MarketplaceCollectionsQuery - extends MarketplaceReactQuery { + return useQuery(["marketplaceAsk", client.contractAddress, JSON.stringify(args)], () => client.ask({ + collection: args.collection, + tokenId: args.tokenId + }), options); +} +export interface MarketplaceCollectionsQuery extends MarketplaceReactQuery { args: { limit?: number; startAfter?: string; @@ -570,24 +380,375 @@ export interface MarketplaceCollectionsQuery export function useMarketplaceCollectionsQuery({ client, args, - options, + options }: MarketplaceCollectionsQuery) { - return useQuery( - ['marketplaceCollections', client.contractAddress, JSON.stringify(args)], - () => - client.collections({ - limit: args.limit, - startAfter: args.startAfter, - }), - options - ); + return useQuery(["marketplaceCollections", client.contractAddress, JSON.stringify(args)], () => client.collections({ + 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 interface IMarketplaceReactQueryHooks { - useMarketplaceParamsQuery({ - options, - }: Omit, 'client'>): UseQueryResult< - TData, - Error - >; +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/Marketplace.types.ts b/examples/telescope-with-contracts/src/codegen/Marketplace.types.ts index 52007deca..91157f155 100644 --- a/examples/telescope-with-contracts/src/codegen/Marketplace.types.ts +++ b/examples/telescope-with-contracts/src/codegen/Marketplace.types.ts @@ -1,5 +1,5 @@ /** -* 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. */ diff --git a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.client.ts b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.client.ts index 533771a57..fcb025202 100644 --- a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.client.ts +++ b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.client.ts @@ -1,5 +1,5 @@ /** -* 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. */ diff --git a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.message-composer.ts b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.message-composer.ts index d717a293b..4e7786c8c 100644 --- a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.message-composer.ts +++ b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.message-composer.ts @@ -1,5 +1,5 @@ /** -* 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. */ diff --git a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.provider.ts b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.provider.ts index 3323d5bd5..b79f97520 100644 --- a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.provider.ts +++ b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.provider.ts @@ -1,5 +1,5 @@ /** -* 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. */ 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/Sg721Updatable.types.ts b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.types.ts index 3514a20bb..d32038ee5 100644 --- a/examples/telescope-with-contracts/src/codegen/Sg721Updatable.types.ts +++ b/examples/telescope-with-contracts/src/codegen/Sg721Updatable.types.ts @@ -1,5 +1,5 @@ /** -* 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. */ diff --git a/examples/telescope-with-contracts/src/codegen/Whitelist.client.ts b/examples/telescope-with-contracts/src/codegen/Whitelist.client.ts index bfe0524af..7fcc9041d 100644 --- a/examples/telescope-with-contracts/src/codegen/Whitelist.client.ts +++ b/examples/telescope-with-contracts/src/codegen/Whitelist.client.ts @@ -1,5 +1,5 @@ /** -* 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. */ diff --git a/examples/telescope-with-contracts/src/codegen/Whitelist.message-composer.ts b/examples/telescope-with-contracts/src/codegen/Whitelist.message-composer.ts index ad3e3f2fc..c36af9e9f 100644 --- a/examples/telescope-with-contracts/src/codegen/Whitelist.message-composer.ts +++ b/examples/telescope-with-contracts/src/codegen/Whitelist.message-composer.ts @@ -1,5 +1,5 @@ /** -* 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. */ diff --git a/examples/telescope-with-contracts/src/codegen/Whitelist.provider.ts b/examples/telescope-with-contracts/src/codegen/Whitelist.provider.ts index ec25a4bde..684712bba 100644 --- a/examples/telescope-with-contracts/src/codegen/Whitelist.provider.ts +++ b/examples/telescope-with-contracts/src/codegen/Whitelist.provider.ts @@ -1,5 +1,5 @@ /** -* 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. */ 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/Whitelist.types.ts b/examples/telescope-with-contracts/src/codegen/Whitelist.types.ts index d291081bf..a48092af5 100644 --- a/examples/telescope-with-contracts/src/codegen/Whitelist.types.ts +++ b/examples/telescope-with-contracts/src/codegen/Whitelist.types.ts @@ -1,5 +1,5 @@ /** -* 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. */ diff --git a/examples/telescope-with-contracts/src/codegen/contractContextBase.ts b/examples/telescope-with-contracts/src/codegen/contractContextBase.ts index 52bc17612..440290397 100644 --- a/examples/telescope-with-contracts/src/codegen/contractContextBase.ts +++ b/examples/telescope-with-contracts/src/codegen/contractContextBase.ts @@ -48,10 +48,6 @@ export interface IMessageComposerProvider { getMessageComposer(contractAddr: string): T; } -export interface IReactQueryHooksProvider { - getReactQueryHooks(contractAddr: string): T; -} - export class ContractBase< TSign = IEmptyClient, TQuery = IEmptyClient, diff --git a/examples/telescope-with-contracts/src/codegen/contractContextProviders.ts b/examples/telescope-with-contracts/src/codegen/contractContextProviders.ts index 2a3d63767..d35e35219 100644 --- a/examples/telescope-with-contracts/src/codegen/contractContextProviders.ts +++ b/examples/telescope-with-contracts/src/codegen/contractContextProviders.ts @@ -1,64 +1,42 @@ /** - * 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. - */ +* 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 { - CosmWasmClient, - SigningCosmWasmClient, -} from '@cosmjs/cosmwasm-stargate'; -import { - IQueryClientProvider, - ISigningClientProvider, - IMessageComposerProvider, - IReactQueryHooksProvider, -} from './contractContextBase'; -import { Sg721UpdatableQueryClient } from './Sg721Updatable.client'; -import { Sg721UpdatableClient } from './Sg721Updatable.client'; -import { Sg721UpdatableMessageComposer } from './Sg721Updatable.message-composer'; -import { Sg721Updatable } from './Sg721Updatable.provider'; -import { WhitelistQueryClient } from './Whitelist.client'; -import { WhitelistClient } from './Whitelist.client'; -import { WhitelistMessageComposer } from './Whitelist.message-composer'; -import { Whitelist } from './Whitelist.provider'; -import { MarketplaceQueryClient } from './Marketplace.client'; -import { MarketplaceClient } from './Marketplace.client'; -import { MarketplaceMessageComposer } from './Marketplace.message-composer'; -import { - Marketplace, - MarketplaceReactQueryHooks, -} from './Marketplace.provider'; +import { CosmWasmClient, SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; +import { IQueryClientProvider, ISigningClientProvider, IMessageComposerProvider } from "./contractContextBase"; +import { Sg721UpdatableQueryClient } from "./Sg721Updatable.client"; +import { Sg721UpdatableClient } from "./Sg721Updatable.client"; +import { Sg721UpdatableMessageComposer } from "./Sg721Updatable.message-composer"; +import { Sg721Updatable } from "./Sg721Updatable.provider"; +import { WhitelistQueryClient } from "./Whitelist.client"; +import { WhitelistClient } from "./Whitelist.client"; +import { WhitelistMessageComposer } from "./Whitelist.message-composer"; +import { Whitelist } from "./Whitelist.provider"; +import { MarketplaceQueryClient } from "./Marketplace.client"; +import { MarketplaceClient } from "./Marketplace.client"; +import { MarketplaceMessageComposer } from "./Marketplace.message-composer"; +import { Marketplace } from "./Marketplace.provider"; export interface IContractsContext { - sg721Updatable: IQueryClientProvider & - ISigningClientProvider & - IMessageComposerProvider; - whitelist: IQueryClientProvider & - ISigningClientProvider & - IMessageComposerProvider; - marketplace: IQueryClientProvider & - ISigningClientProvider & - IMessageComposerProvider & - IReactQueryHooksProvider; + sg721Updatable: IQueryClientProvider & ISigningClientProvider & IMessageComposerProvider; + whitelist: IQueryClientProvider & ISigningClientProvider & IMessageComposerProvider; + marketplace: IQueryClientProvider & ISigningClientProvider & IMessageComposerProvider; } -export const getProviders = ( - address?: string, - cosmWasmClient?: CosmWasmClient, - signingCosmWasmClient?: SigningCosmWasmClient -) => ({ +export const getProviders = (address?: string, cosmWasmClient?: CosmWasmClient, signingCosmWasmClient?: SigningCosmWasmClient) => ({ sg721Updatable: new Sg721Updatable({ address, cosmWasmClient, - signingCosmWasmClient, + signingCosmWasmClient }), whitelist: new Whitelist({ address, cosmWasmClient, - signingCosmWasmClient, + signingCosmWasmClient }), marketplace: new Marketplace({ address, cosmWasmClient, - signingCosmWasmClient, - }), -}); + signingCosmWasmClient + }) +}); \ No newline at end of file diff --git a/examples/telescope-with-contracts/src/codegen/contracts-context.tsx b/examples/telescope-with-contracts/src/codegen/contracts-context.tsx index 38d23ef78..625a24352 100644 --- a/examples/telescope-with-contracts/src/codegen/contracts-context.tsx +++ b/examples/telescope-with-contracts/src/codegen/contracts-context.tsx @@ -1,5 +1,5 @@ /** -* This file and any referenced files were automatically generated by @cosmwasm/ts-codegen@latest +* This file and any referenced files were automatically generated by @cosmwasm/ts-codegen@0.31.6 * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or yarn proto command to regenerate this bundle. */ diff --git a/examples/telescope-with-contracts/src/codegen/contracts.ts b/examples/telescope-with-contracts/src/codegen/contracts.ts index f40da0639..acbe3afec 100644 --- a/examples/telescope-with-contracts/src/codegen/contracts.ts +++ b/examples/telescope-with-contracts/src/codegen/contracts.ts @@ -1,5 +1,5 @@ /** -* 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. */ diff --git a/yarn.lock b/yarn.lock index dc68b1d86..4fbcff76a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1844,6 +1844,13 @@ dependencies: regenerator-runtime "^0.13.11" +"@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2": + version "7.22.6" + resolved "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.22.6.tgz#57d64b9ae3cff1d67eb067ae117dac087f5bd438" + integrity sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ== + dependencies: + regenerator-runtime "^0.13.11" + "@babel/template@^7.18.10", "@babel/template@^7.20.7", "@babel/template@^7.3.3": version "7.20.7" resolved "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz" @@ -8152,7 +8159,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== @@ -8241,6 +8248,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" @@ -9297,6 +9318,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" @@ -12626,6 +12652,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" @@ -12941,6 +12975,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" @@ -13264,6 +13303,13 @@ nan@^2.13.2: resolved "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz" integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== +nano-time@1.0.0: + version "1.0.0" + resolved "https://registry.npmmirror.com/nano-time/-/nano-time-1.0.0.tgz#b0554f69ad89e22d0907f7a12b0993a5d96137ef" + integrity sha512-flnngywOoQ0lLQOTRNexn2gGSNuM9bKj9RZAWSzhQ+UJYaAFG9bac4DW9VHjUAzrOaIcajHybCTHe/bkvozQqA== + dependencies: + big-integer "^1.6.16" + nanoid@3.3.3: version "3.3.3" resolved "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.3.tgz" @@ -13657,6 +13703,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" @@ -14506,6 +14557,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" @@ -14828,6 +14888,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" @@ -16271,6 +16336,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"