-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1354 from DA0-DA0/development
Deploy Stargaze mainnet and wallet bug fix
- Loading branch information
Showing
18 changed files
with
1,523 additions
and
203 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,237 @@ | ||
/** | ||
* This file was automatically generated by @cosmwasm/[email protected]. | ||
* 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 { selectorFamily } from 'recoil' | ||
|
||
import { WithChainId } from '@dao-dao/types' | ||
import { | ||
AllNftInfoResponse, | ||
AllOperatorsResponse, | ||
AllTokensResponse, | ||
ApprovalResponse, | ||
ApprovalsResponse, | ||
CollectionInfoResponse, | ||
ContractInfoResponse, | ||
MinterResponse, | ||
NftInfoResponse, | ||
NumTokensResponse, | ||
OwnerOfResponse, | ||
TokensResponse, | ||
} from '@dao-dao/types/contracts/Sg721Base' | ||
|
||
import { | ||
Sg721BaseClient, | ||
Sg721BaseQueryClient, | ||
} from '../../../contracts/Sg721Base' | ||
import { signingCosmWasmClientAtom } from '../../atoms' | ||
import { cosmWasmClientForChainSelector } from '../chain' | ||
|
||
type QueryClientParams = WithChainId<{ | ||
contractAddress: string | ||
}> | ||
|
||
export const queryClient = selectorFamily< | ||
Sg721BaseQueryClient, | ||
QueryClientParams | ||
>({ | ||
key: 'sg721BaseQueryClient', | ||
get: | ||
({ contractAddress, chainId }) => | ||
({ get }) => { | ||
const client = get(cosmWasmClientForChainSelector(chainId)) | ||
return new Sg721BaseQueryClient(client, contractAddress) | ||
}, | ||
dangerouslyAllowMutability: true, | ||
}) | ||
|
||
export type ExecuteClientParams = WithChainId<{ | ||
contractAddress: string | ||
sender: string | ||
}> | ||
|
||
export const executeClient = selectorFamily< | ||
Sg721BaseClient | undefined, | ||
ExecuteClientParams | ||
>({ | ||
key: 'sg721BaseExecuteClient', | ||
get: | ||
({ chainId, contractAddress, sender }) => | ||
({ get }) => { | ||
const client = get(signingCosmWasmClientAtom({ chainId })) | ||
if (!client) return | ||
return new Sg721BaseClient(client, sender, contractAddress) | ||
}, | ||
dangerouslyAllowMutability: true, | ||
}) | ||
|
||
export const ownerOfSelector = selectorFamily< | ||
OwnerOfResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['ownerOf']> | ||
} | ||
>({ | ||
key: 'sg721BaseOwnerOf', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.ownerOf(...params) | ||
}, | ||
}) | ||
export const approvalSelector = selectorFamily< | ||
ApprovalResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['approval']> | ||
} | ||
>({ | ||
key: 'sg721BaseApproval', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.approval(...params) | ||
}, | ||
}) | ||
export const approvalsSelector = selectorFamily< | ||
ApprovalsResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['approvals']> | ||
} | ||
>({ | ||
key: 'sg721BaseApprovals', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.approvals(...params) | ||
}, | ||
}) | ||
export const allOperatorsSelector = selectorFamily< | ||
AllOperatorsResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['allOperators']> | ||
} | ||
>({ | ||
key: 'sg721BaseAllOperators', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.allOperators(...params) | ||
}, | ||
}) | ||
export const numTokensSelector = selectorFamily< | ||
NumTokensResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['numTokens']> | ||
} | ||
>({ | ||
key: 'sg721BaseNumTokens', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.numTokens(...params) | ||
}, | ||
}) | ||
export const contractInfoSelector = selectorFamily< | ||
ContractInfoResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['contractInfo']> | ||
} | ||
>({ | ||
key: 'sg721BaseContractInfo', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.contractInfo(...params) | ||
}, | ||
}) | ||
export const nftInfoSelector = selectorFamily< | ||
NftInfoResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['nftInfo']> | ||
} | ||
>({ | ||
key: 'sg721BaseNftInfo', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.nftInfo(...params) | ||
}, | ||
}) | ||
export const allNftInfoSelector = selectorFamily< | ||
AllNftInfoResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['allNftInfo']> | ||
} | ||
>({ | ||
key: 'sg721BaseAllNftInfo', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.allNftInfo(...params) | ||
}, | ||
}) | ||
export const tokensSelector = selectorFamily< | ||
TokensResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['tokens']> | ||
} | ||
>({ | ||
key: 'sg721BaseTokens', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.tokens(...params) | ||
}, | ||
}) | ||
export const allTokensSelector = selectorFamily< | ||
AllTokensResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['allTokens']> | ||
} | ||
>({ | ||
key: 'sg721BaseAllTokens', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.allTokens(...params) | ||
}, | ||
}) | ||
export const minterSelector = selectorFamily< | ||
MinterResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['minter']> | ||
} | ||
>({ | ||
key: 'sg721BaseMinter', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.minter(...params) | ||
}, | ||
}) | ||
export const collectionInfoSelector = selectorFamily< | ||
CollectionInfoResponse, | ||
QueryClientParams & { | ||
params: Parameters<Sg721BaseQueryClient['collectionInfo']> | ||
} | ||
>({ | ||
key: 'sg721BaseCollectionInfo', | ||
get: | ||
({ params, ...queryClientParams }) => | ||
async ({ get }) => { | ||
const client = get(queryClient(queryClientParams)) | ||
return await client.collectionInfo(...params) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
|
||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' | ||
import { useCallback } from 'react' | ||
import { useRecoilValueLoadable } from 'recoil' | ||
|
||
import { Sg721BaseClient as ExecuteClient } from '@dao-dao/state/contracts/Sg721Base' | ||
import { | ||
ExecuteClientParams, | ||
executeClient, | ||
} from '@dao-dao/state/recoil/selectors/contracts/Sg721Base' | ||
import { useChain } from '@dao-dao/stateless' | ||
import { FunctionKeyOf } from '@dao-dao/types' | ||
|
||
import { useSyncWalletSigner } from '../useSyncWalletSigner' | ||
|
||
// This hook wrapper lets us easily make hooks out of all execution functions on | ||
// the contract clients, without having to fetch the `executeClient` selector as | ||
// a loadable and add `useCallback` hooks in all the components. | ||
const wrapExecuteHook = | ||
<T extends FunctionKeyOf<ExecuteClient>>(fn: T) => | ||
(params: Omit<ExecuteClientParams, 'chainId'>) => { | ||
// Make sure we have the signing client for this chain and wallet. | ||
useSyncWalletSigner() | ||
|
||
const { chain_id: chainId } = useChain() | ||
const clientLoadable = useRecoilValueLoadable( | ||
executeClient({ | ||
...params, | ||
chainId, | ||
}) | ||
) | ||
const client = | ||
clientLoadable.state === 'hasValue' ? clientLoadable.contents : undefined | ||
|
||
return useCallback( | ||
(...args: Parameters<ExecuteClient[T]>) => { | ||
if (client) | ||
return ( | ||
client[fn] as ( | ||
...args: Parameters<ExecuteClient[T]> | ||
) => Promise<ExecuteResult> | ||
)(...args) | ||
throw new Error('Wallet signer not set up.') | ||
}, | ||
[client] | ||
) | ||
} | ||
|
||
export const useTransferNft = wrapExecuteHook('transferNft') | ||
export const useSendNft = wrapExecuteHook('sendNft') | ||
export const useSendNftMultiple = wrapExecuteHook('sendNftMultiple') | ||
export const useApprove = wrapExecuteHook('approve') | ||
export const useRevoke = wrapExecuteHook('revoke') | ||
export const useApproveAll = wrapExecuteHook('approveAll') | ||
export const useRevokeAll = wrapExecuteHook('revokeAll') | ||
export const useMint = wrapExecuteHook('mint') | ||
export const useBurn = wrapExecuteHook('burn') | ||
export const useUpdateCollectionInfo = wrapExecuteHook('updateCollectionInfo') |
Oops, something went wrong.
c82a102
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
dapp-mainnet – ./apps/dapp
dapp-mainnet-git-main-da0da0.vercel.app
dao-dao.vercel.app
dapp-mainnet-da0da0.vercel.app
v1.daodao.zone
osmosis.daodao.zone
daodao.zone
juno.daodao.zone
www.daodao.zone
c82a102
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sda-mainnet – ./apps/sda
dao-dao-ui-sdp.vercel.app
sda-mainnet-git-main-da0da0.vercel.app
sda-mainnet-da0da0.vercel.app
dao.daodao.zone
dao.juno.daodao.zone
dao.osmosis.daodao.zone