Skip to content

Commit

Permalink
Merge pull request #443 from provenance-io/jarryd/442/upgrade-to-wcjs…
Browse files Browse the repository at this point in the history
…-2.0.0

Upgrade to wcjs 2.0.4
  • Loading branch information
jarrydallison authored Nov 16, 2022
2 parents 1b5815b + 2368942 commit ef3bae2
Show file tree
Hide file tree
Showing 10 changed files with 342 additions and 586 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG | <img src="./public/logo.svg" style="height: 36px; margin: 0 0 -7px 4px;" alt="Provenance Explorer"/>

## Unreleased

### Bugs

### Features
- Upgrade to wcjs 2.0.0 #442

## 3.4.0

### Release Name: Saint Brendan
Expand Down
881 changes: 317 additions & 564 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"private": false,
"sideEffects": false,
"dependencies": {
"@provenanceio/wallet-utils": "2.0.0",
"@provenanceio/walletconnect-js": "1.2.9",
"@provenanceio/wallet-utils": "2.3.0",
"@provenanceio/walletconnect-js": "2.0.4",
"@reduxjs/toolkit": "1.8.1",
"axios": "0.21.2",
"bech32": "2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const ManageVotingModal = ({
voter: voterId,
votes,
});
wcs.customAction({
wcs.sendMessage({
description: 'Submit Proposal',
message: data.base64,
});
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Proposals/Components/ManageProposalModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const ManageProposalModal = ({
});

// Submit via walletconnect-js
wcs.customAction({
wcs.sendMessage({
description: 'Submit Proposal',
message: data.base64,
});
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Validators/Components/ManageStakingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export const ManageStakingModal = ({
const { action, data: submissionData } = actionSelector(amount);
const { data } = await action(submissionData as any);
// Submit via walletconnect-js
wcs.customAction({
wcs.sendMessage({
description: 'Submit Delegation',
message: data.base64,
});
Expand Down
6 changes: 1 addition & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { WalletConnectContextProvider } from '@provenanceio/walletconnect-js';
Expand All @@ -7,10 +6,7 @@ import App from './App';

ReactDOM.render(
<Provider store={store()}>
<WalletConnectContextProvider
network={process.env.REACT_APP_ENV === 'test' ? 'testnet' : 'mainnet'}
timeout={process.env.REACT_APP_ENV === 'test' ? 86400 : 1800}
>
<WalletConnectContextProvider>
<App />
</WalletConnectContextProvider>
</Provider>,
Expand Down
8 changes: 4 additions & 4 deletions src/redux/hooks/useProposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ export const useProposal = () => {
setShouldPull(true);
setSubmitted(true);
};
wcs.addListener(WINDOW_MESSAGES.CUSTOM_ACTION_COMPLETE, submitSuccess);
wcs.addListener(WINDOW_MESSAGES.SEND_MESSAGE_COMPLETE, submitSuccess);

// Fail message for transaction messages
const submitFailure = (result: BroadcastResults) => {
setSubmitted(false);
deactivateModalOpen();
};
wcs.addListener(WINDOW_MESSAGES.CUSTOM_ACTION_FAILED, submitFailure);
wcs.addListener(WINDOW_MESSAGES.SEND_MESSAGE_FAILED, submitFailure);

// Remove event listeners when no longer needed
return () => {
wcs.removeListener(WINDOW_MESSAGES.CUSTOM_ACTION_COMPLETE, submitSuccess);
wcs.removeListener(WINDOW_MESSAGES.CUSTOM_ACTION_FAILED, submitFailure);
wcs.removeListener(WINDOW_MESSAGES.SEND_MESSAGE_COMPLETE, submitSuccess);
wcs.removeListener(WINDOW_MESSAGES.SEND_MESSAGE_FAILED, submitFailure);
wcs.removeAllListeners();
};
}, [wcs, deactivateModalOpen]);
Expand Down
8 changes: 4 additions & 4 deletions src/redux/hooks/useStaking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,18 @@ export const useStaking = () => {
setShouldPull(true);
deactivateModalOpen();
};
wcs.addListener(WINDOW_MESSAGES.CUSTOM_ACTION_COMPLETE, submitSuccess);
wcs.addListener(WINDOW_MESSAGES.SEND_MESSAGE_COMPLETE, submitSuccess);

// Fail message for transaction messages
const submitFailure = (result: BroadcastResults) => {
setShouldPull(false);
};
wcs.addListener(WINDOW_MESSAGES.CUSTOM_ACTION_FAILED, submitFailure);
wcs.addListener(WINDOW_MESSAGES.SEND_MESSAGE_FAILED, submitFailure);

// Remove event listeners when no longer needed
return () => {
wcs.removeListener(WINDOW_MESSAGES.CUSTOM_ACTION_COMPLETE, submitSuccess);
wcs.removeListener(WINDOW_MESSAGES.CUSTOM_ACTION_FAILED, submitFailure);
wcs.removeListener(WINDOW_MESSAGES.SEND_MESSAGE_COMPLETE, submitSuccess);
wcs.removeListener(WINDOW_MESSAGES.SEND_MESSAGE_FAILED, submitFailure);
wcs.removeAllListeners();
};
}, [wcs, deactivateModalOpen]);
Expand Down
8 changes: 4 additions & 4 deletions src/redux/hooks/useVoting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ export const useVoting = () => {
const submitSuccess = (result: BroadcastResults) => {
setVoted(true);
};
wcs.addListener(WINDOW_MESSAGES.CUSTOM_ACTION_COMPLETE, submitSuccess);
wcs.addListener(WINDOW_MESSAGES.SEND_MESSAGE_COMPLETE, submitSuccess);

// Fail message for transaction messages
const submitFailure = (result: BroadcastResults) => {
setVoted(false);
deactivateModalOpen();
};
wcs.addListener(WINDOW_MESSAGES.CUSTOM_ACTION_FAILED, submitFailure);
wcs.addListener(WINDOW_MESSAGES.SEND_MESSAGE_FAILED, submitFailure);

// Remove event listeners when no longer needed
return () => {
wcs.removeListener(WINDOW_MESSAGES.CUSTOM_ACTION_COMPLETE, submitSuccess);
wcs.removeListener(WINDOW_MESSAGES.CUSTOM_ACTION_FAILED, submitFailure);
wcs.removeListener(WINDOW_MESSAGES.SEND_MESSAGE_COMPLETE, submitSuccess);
wcs.removeListener(WINDOW_MESSAGES.SEND_MESSAGE_FAILED, submitFailure);
wcs.removeAllListeners();
};
}, [wcs, deactivateModalOpen]);
Expand Down

0 comments on commit ef3bae2

Please sign in to comment.