bridge_ui: reset slice upon success
Change-Id: I5b6e6f0bc80436cdcdc2abde2f9b18a060c6ec08
This commit is contained in:
parent
848d8d1462
commit
a32e66fb71
|
@ -7,6 +7,7 @@
|
|||
"": {
|
||||
"name": "test_ui",
|
||||
"version": "0.1.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "file:..\\sdk\\js",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
|
@ -28,6 +29,7 @@
|
|||
"devDependencies": {
|
||||
"@craco/craco": "^6.2.0",
|
||||
"@truffle/hdwallet-provider": "^1.4.1",
|
||||
"@types/node": "^16.6.1",
|
||||
"prettier": "^2.3.2",
|
||||
"truffle": "^5.4.1",
|
||||
"wasm-loader": "^1.3.0"
|
||||
|
@ -40,6 +42,8 @@
|
|||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@improbable-eng/grpc-web": "^0.14.0",
|
||||
"@project-serum/sol-wallet-adapter": "^0.2.5",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
"@solana/web3.js": "^1.24.0",
|
||||
"protobufjs": "^6.11.2",
|
||||
"rxjs": "^7.3.0"
|
||||
|
@ -48,7 +52,9 @@
|
|||
"@openzeppelin/contracts": "^4.2.0",
|
||||
"@typechain/ethers-v5": "^7.0.1",
|
||||
"@types/long": "^4.0.1",
|
||||
"@types/node": "^16.6.1",
|
||||
"copy-dir": "^1.3.0",
|
||||
"ethers": "^5.4.4",
|
||||
"prettier": "^2.3.2",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0",
|
||||
|
@ -7255,9 +7261,9 @@
|
|||
"integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ=="
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "16.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.3.3.tgz",
|
||||
"integrity": "sha512-8h7k1YgQKxKXWckzFCMfsIwn0Y61UK6tlD6y2lOb3hTOIMlK3t9/QwHOhc81TwU+RMf0As5fj7NPjroERCnejQ=="
|
||||
"version": "16.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.6.1.tgz",
|
||||
"integrity": "sha512-Sr7BhXEAer9xyGuCN3Ek9eg9xPviCF2gfu9kTfuU2HkTVAMYSDeX40fvpmo72n5nansg3nsBjuQBrsS28r+NUw=="
|
||||
},
|
||||
"node_modules/@types/normalize-package-data": {
|
||||
"version": "2.4.1",
|
||||
|
@ -39961,10 +39967,14 @@
|
|||
"requires": {
|
||||
"@improbable-eng/grpc-web": "^0.14.0",
|
||||
"@openzeppelin/contracts": "^4.2.0",
|
||||
"@project-serum/sol-wallet-adapter": "^0.2.5",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
"@solana/web3.js": "^1.24.0",
|
||||
"@typechain/ethers-v5": "^7.0.1",
|
||||
"@types/long": "^4.0.1",
|
||||
"@types/node": "^16.6.1",
|
||||
"copy-dir": "^1.3.0",
|
||||
"ethers": "^5.4.4",
|
||||
"prettier": "^2.3.2",
|
||||
"protobufjs": "^6.11.2",
|
||||
"rxjs": "^7.3.0",
|
||||
|
@ -44218,9 +44228,9 @@
|
|||
"integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "16.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.3.3.tgz",
|
||||
"integrity": "sha512-8h7k1YgQKxKXWckzFCMfsIwn0Y61UK6tlD6y2lOb3hTOIMlK3t9/QwHOhc81TwU+RMf0As5fj7NPjroERCnejQ=="
|
||||
"version": "16.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.6.1.tgz",
|
||||
"integrity": "sha512-Sr7BhXEAer9xyGuCN3Ek9eg9xPviCF2gfu9kTfuU2HkTVAMYSDeX40fvpmo72n5nansg3nsBjuQBrsS28r+NUw=="
|
||||
},
|
||||
"@types/normalize-package-data": {
|
||||
"version": "2.4.1",
|
||||
|
|
|
@ -21,9 +21,10 @@
|
|||
"redux": "^3.7.2"
|
||||
},
|
||||
"scripts": {
|
||||
"preinstall": "npm ci --prefix ../sdk/js && npm run build --prefix ../sdk/js",
|
||||
"start": "craco start",
|
||||
"build": "npm run build-contracts && craco build",
|
||||
"test": "npm run build-contracts && craco test",
|
||||
"build": "craco build",
|
||||
"test": "craco test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
|
@ -47,6 +48,7 @@
|
|||
"devDependencies": {
|
||||
"@craco/craco": "^6.2.0",
|
||||
"@truffle/hdwallet-provider": "^1.4.1",
|
||||
"@types/node": "^16.6.1",
|
||||
"prettier": "^2.3.2",
|
||||
"truffle": "^5.4.1",
|
||||
"wasm-loader": "^1.3.0"
|
||||
|
|
|
@ -5,7 +5,7 @@ import { useDispatch, useSelector } from "react-redux";
|
|||
import { useEthereumProvider } from "../../contexts/EthereumProviderContext";
|
||||
import { useSolanaWallet } from "../../contexts/SolanaWalletContext";
|
||||
import useAttestSignedVAA from "../../hooks/useAttestSignedVAA";
|
||||
import { setIsCreating } from "../../store/attestSlice";
|
||||
import { reset, setIsCreating } from "../../store/attestSlice";
|
||||
import {
|
||||
selectAttestIsCreating,
|
||||
selectAttestTargetChain,
|
||||
|
@ -34,13 +34,17 @@ function Create() {
|
|||
const { signer } = useEthereumProvider();
|
||||
const handleCreateClick = useCallback(() => {
|
||||
if (targetChain === CHAIN_ID_SOLANA && signedVAA) {
|
||||
dispatch(setIsCreating(true));
|
||||
createWrappedOnSolana(wallet, solPK?.toString(), signedVAA);
|
||||
(async () => {
|
||||
dispatch(setIsCreating(true));
|
||||
await createWrappedOnSolana(wallet, solPK?.toString(), signedVAA);
|
||||
dispatch(reset());
|
||||
})();
|
||||
}
|
||||
if (targetChain === CHAIN_ID_ETH && signedVAA) {
|
||||
(async () => {
|
||||
dispatch(setIsCreating(true));
|
||||
createWrappedOnEth(signer, signedVAA);
|
||||
await createWrappedOnEth(signer, signedVAA);
|
||||
dispatch(reset());
|
||||
})();
|
||||
}
|
||||
}, [dispatch, targetChain, wallet, solPK, signedVAA, signer]);
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
selectTransferTargetAsset,
|
||||
selectTransferTargetChain,
|
||||
} from "../../store/selectors";
|
||||
import { setIsRedeeming } from "../../store/transferSlice";
|
||||
import { reset, setIsRedeeming } from "../../store/transferSlice";
|
||||
import { redeemOnEth, redeemOnSolana } from "../../utils/redeemOn";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
|
@ -39,18 +39,24 @@ function Redeem() {
|
|||
const isRedeeming = useSelector(selectTransferIsRedeeming);
|
||||
const handleRedeemClick = useCallback(() => {
|
||||
if (targetChain === CHAIN_ID_ETH && signedVAA) {
|
||||
dispatch(setIsRedeeming(true));
|
||||
redeemOnEth(signer, signedVAA);
|
||||
(async () => {
|
||||
dispatch(setIsRedeeming(true));
|
||||
await redeemOnEth(signer, signedVAA);
|
||||
dispatch(reset());
|
||||
})();
|
||||
}
|
||||
if (targetChain === CHAIN_ID_SOLANA && signedVAA) {
|
||||
dispatch(setIsRedeeming(true));
|
||||
redeemOnSolana(
|
||||
wallet,
|
||||
solPK?.toString(),
|
||||
signedVAA,
|
||||
!!isSourceAssetWormholeWrapped && originChain === CHAIN_ID_SOLANA,
|
||||
targetAsset || undefined
|
||||
);
|
||||
(async () => {
|
||||
dispatch(setIsRedeeming(true));
|
||||
await redeemOnSolana(
|
||||
wallet,
|
||||
solPK?.toString(),
|
||||
signedVAA,
|
||||
!!isSourceAssetWormholeWrapped && originChain === CHAIN_ID_SOLANA,
|
||||
targetAsset || undefined
|
||||
);
|
||||
dispatch(reset());
|
||||
})();
|
||||
}
|
||||
}, [
|
||||
dispatch,
|
||||
|
|
|
@ -89,6 +89,7 @@ export const attestSlice = createSlice({
|
|||
setIsCreating: (state, action: PayloadAction<boolean>) => {
|
||||
state.isCreating = action.payload;
|
||||
},
|
||||
reset: () => initialState,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -102,6 +103,7 @@ export const {
|
|||
setSignedVAAHex,
|
||||
setIsSending,
|
||||
setIsCreating,
|
||||
reset,
|
||||
} = attestSlice.actions;
|
||||
|
||||
export default attestSlice.reducer;
|
||||
|
|
|
@ -147,6 +147,7 @@ export const transferSlice = createSlice({
|
|||
setIsRedeeming: (state, action: PayloadAction<boolean>) => {
|
||||
state.isRedeeming = action.payload;
|
||||
},
|
||||
reset: () => initialState,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -165,6 +166,7 @@ export const {
|
|||
setSignedVAAHex,
|
||||
setIsSending,
|
||||
setIsRedeeming,
|
||||
reset,
|
||||
} = transferSlice.actions;
|
||||
|
||||
export default transferSlice.reducer;
|
||||
|
|
Loading…
Reference in New Issue