From dbbd80e5129ea7e634b2106dca5fb210ae25bc9b Mon Sep 17 00:00:00 2001 From: impelcrypto <92044428+impelcrypto@users.noreply.github.com> Date: Thu, 7 Sep 2023 10:34:45 +0200 Subject: [PATCH] feat: dApp staking via EVM wallets (#857) * feat: stake with evm wallets * feat: updated compound function * feat: created EvmDappStakingService * fix: updated useCompoundRewards * feat: added withdraw function to the service * fix: resolved console errors * refactor: senderSs58Account * feat: added useClaimAll for SS58 * wip: multicall * wip: BatchRequest * feat: display Transaction Speed for EVM wallets * fix: dApp address in getIndividualClaimTxs * feat: claim rewards * refactor: clean up * fix: enables claiming rewards on Shibuya only * refactor: clean up * fix: typo * refactor: added dapp staking service factory * fix: updated setEvmGasCost * feat: added a toast to remind users claiming rewards before staking * feat: added failureMessage params in sendEvmTransaction function * fix: changed chopstick wss endpoint for Acala * fix: remove paras ad --- src/assets/img/paras_logo.svg | 10 - .../assets/transfer/LocalTransfer.vue | 9 +- src/components/dapp-staking/StakingTop.vue | 15 +- src/components/dapp-staking/dapp/Dapp.vue | 2 +- .../dapp-staking/dapp/DappAvatar.vue | 8 +- .../my-staking/DynamicAdsArea.vue | 2 - .../dapp-staking/my-staking/MyRewards.vue | 35 +- .../dapp-staking/my-staking/TopMetric.vue | 14 +- .../my-staking/components/CardList.vue | 3 - .../dapp-staking/stake-manage/StakeForm.vue | 67 +++- .../dapp-staking/stake-manage/StakeManage.vue | 26 -- .../header/modals/ModalConnectWallet.vue | 7 +- src/config/web3/abi/batch-abi.json | 112 ++++++ src/config/web3/abi/dapps-staking-abi.json | 116 +++++-- src/data/featured_dapp.json | 8 - src/hooks/chain/useAvgBlockTimeApi.ts | 11 +- src/hooks/dapps-staking/useClaimedReward.ts | 8 +- src/hooks/dapps-staking/useCompoundRewards.ts | 25 +- .../dapps-staking/useDispatchGetDapps.ts | 2 +- src/hooks/dapps-staking/useStake.ts | 12 +- src/hooks/dapps-staking/useStakerInfo.ts | 16 +- src/hooks/dapps-staking/useStakingList.ts | 15 +- src/hooks/dapps-staking/useUnbond.ts | 12 +- src/hooks/dapps-staking/useUnbonding.ts | 28 +- src/hooks/transfer/useTokenTransfer.ts | 2 + src/hooks/useAccount.ts | 10 +- src/hooks/useBalance.ts | 5 +- src/hooks/useClaimAll.ts | 87 ++--- src/hooks/useStaking.ts | 38 --- src/modules/precompiled/index.ts | 6 + src/store/dapp-staking/actions.ts | 14 +- src/v2/app.container.ts | 14 + src/v2/repositories/IDappStakingRepository.ts | 3 + .../implementations/DappStakingRepository.ts | 48 +++ src/v2/services/IDappStakingService.ts | 26 +- src/v2/services/IWalletService.ts | 19 ++ .../implementations/DappStakingService.ts | 47 ++- .../implementations/EvmDappStakingService.ts | 321 ++++++++++++++++++ .../implementations/MetamaskWalletService.ts | 78 ++++- .../implementations/PolkadotWalletService.ts | 15 +- .../services/implementations/XcmEvmService.ts | 8 +- src/v2/services/implementations/index.ts | 1 + src/v2/symbols.ts | 2 + tests/chopsticks/acala.yml | 38 +-- 44 files changed, 1003 insertions(+), 342 deletions(-) delete mode 100644 src/assets/img/paras_logo.svg create mode 100644 src/config/web3/abi/batch-abi.json delete mode 100644 src/hooks/useStaking.ts create mode 100644 src/modules/precompiled/index.ts create mode 100644 src/v2/services/implementations/EvmDappStakingService.ts diff --git a/src/assets/img/paras_logo.svg b/src/assets/img/paras_logo.svg deleted file mode 100644 index 3c621110a..000000000 --- a/src/assets/img/paras_logo.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/components/assets/transfer/LocalTransfer.vue b/src/components/assets/transfer/LocalTransfer.vue index 76cbf9d98..0c0c81834 100644 --- a/src/components/assets/transfer/LocalTransfer.vue +++ b/src/components/assets/transfer/LocalTransfer.vue @@ -233,6 +233,7 @@ export default defineComponent({ selectedGas, evmGasCost, isTransferNativeToken, + isEnableSpeedConfiguration, setSelectedGas, inputHandler, setSelectedTip, @@ -245,14 +246,6 @@ export default defineComponent({ ); const store = useStore(); - const isEnableSpeedConfiguration = computed(() => { - const currentWallet = store.getters['general/currentWallet']; - return ( - currentWallet !== SupportWallet.TalismanEvm && - currentWallet !== SupportWallet.SubWalletEvm && - currentWallet !== SupportWallet.OneKeyEvm - ); - }); const transfer = async (): Promise => { await transferAsset({ diff --git a/src/components/dapp-staking/StakingTop.vue b/src/components/dapp-staking/StakingTop.vue index d5f747cbf..66d2db79b 100644 --- a/src/components/dapp-staking/StakingTop.vue +++ b/src/components/dapp-staking/StakingTop.vue @@ -30,7 +30,7 @@