New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Walletconnect endpoints for DIDs, Datalayer, and NFT Bulk Mint #2308
base: main
Are you sure you want to change the base?
Conversation
Since updating my repo with recent commits for the PR, I have found that some of the new WC commands which used to work fine, now have issues. I will switch this PR to a draft for the time being, until I figure out why that is. |
There was no issue, I'm just a dumb dumb who forgot to run the build command |
Thank you for the great PR! |
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.
I've just finished a part of reviewing. I'll do more check later.
'Offers', | ||
'StoreMirrors', | ||
'PendingRoots', | ||
'Plugins', |
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.
'Files' is missing here
}), | ||
|
||
addMissingFiles: mutation(build, DataLayer, 'addMissingFiles', { | ||
invalidatesTags: (_result, _error, { ids }) => [{ type: 'Files', ids }], |
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.
According to https://redux-toolkit.js.org/rtk-query/usage/automated-refetching#invalidating-tags, invalidateTags
wouldn't recognize ids
property here.
The type of invalidateTags
is either {type: string; id?: string|number}
, {type: string}
, or just string
.
So I think this line should be:
invalidateTags: {_result, _error, { ids }) => ids.map(id => ({type: 'Files', id}))
}), | ||
|
||
cancelOffer: mutation(build, DataLayer, 'cancelOffer', { | ||
invalidatesTags: (_result, _error, { tradeId }) => [{ type: 'Offers', tradeId }], |
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.
The same as above. invalidateTags
won't accept tradeId
as a tag id. So this should be:
invalidatesTags: (_result, _error, { tradeId }) => [{ type: 'Offers', id: tradeId }],
}), | ||
|
||
clearPendingRoots: mutation(build, DataLayer, 'clearPendingRoots', { | ||
invalidatesTags: (_result, _error, { storeId }) => [{ type: 'PendingRoots', storeId }], |
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.
The same as above.
@@ -142,6 +142,10 @@ export const fullNodeApi = apiWithTag.injectEndpoints({ | |||
getFeeEstimate: query(build, FullNode, 'getFeeEstimate', { | |||
providesTags: [{ type: 'FeeEstimate' }], | |||
}), | |||
|
|||
pushTx: mutation(build, FullNode, 'pushTx', { | |||
invalidatesTags: [{ type: 'Transactions', id: 'LIST' }], |
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.
I think Transaction
(singular) is better than Transactions
(plural).
Need to add Transaction
tag name to Line#10:
const apiWithTag = api.enhanceEndpoints({ addTagTypes: ['BlockchainState', 'FeeEstimate', 'FullNodeConnections'] });
@@ -167,6 +201,7 @@ export const { | |||
useGetDIDNameQuery, | |||
useSetDIDNameMutation, | |||
useGetDIDRecoveryListQuery, | |||
useUpdateDIDMetadataMutation, | |||
useGetDIDInformationNeededForRecoveryQuery, | |||
useGetDIDCurrentCoinInfoQuery, | |||
useGetDIDInfoQuery, |
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.
usePushTxMutation
is missing in full node hooks.useGetDIDMetadataQuery
is missing in wallet hooksuseMintBulkMutation
is missing in wallet hooks
|
||
updateDIDMetadata: mutation(build, DID, 'updateDidMetadata', { | ||
invalidatesTags: (_result, _error, { walletId }) => [ | ||
{ type: 'DIDInfo', id: walletId }, |
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.
The type of id with tag DIDInfo
should be coinId.
I don't think this's appropriate to be here.
// }), | ||
|
||
getDIDMetadata: query(build, DID, 'getDidMetadata', { | ||
providesTags: (result, _error, { walletId }) => (result ? [{ type: 'DIDMetadata', id: walletId }] : []), |
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.
The tag name DIDMetadata
should be added to line#10 tagTypes
array.
{ type: 'DIDInfo', id: walletId }, | ||
{ type: 'DIDCoinInfo', id: walletId }, | ||
{ type: 'Wallets', id: walletId }, | ||
{ type: 'DIDWallet', id: walletId }, |
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.
{ type: 'DIDMetadata', id: walletId}
should be added.
Added a walletconnect endpoints for almost all DID and Datalayer commands, and nft_mint_bulk and push_tx to enable bulk minting via WC, and creating feature rich dapps.