只配置了一个钱包, 点击登录时, 直接调用钱包登录方法

This commit is contained in:
CounterFire2023 2024-06-24 20:02:13 +08:00
parent 6a5e6223ea
commit 59e43a2cdd
3 changed files with 27 additions and 14 deletions

View File

@ -5,6 +5,7 @@ import {walletStore} from "@/store/wallet";
import WalletSelectModel from "@/components/chain/WalletSelectModel.vue";
import {createModal} from "@/utils/model.util";
import {ImtblMarket} from "@/components/chain/Market";
import { ALL_PROVIDERS } from "@/configs/configchain";
export const allProviders = {
1: MetaMaskWallet,
@ -48,6 +49,14 @@ export class BlockChain {
}
async connect() {
// if this only one provider configed, use it directly
if (ALL_PROVIDERS.length === 1) {
this.wallet = new allProviders[ALL_PROVIDERS[0].id]();
const { provider } = await this.wallet.web3Provider();
this.provider = provider
this.market.updateProvider(provider);
return
}
const rewardModal = createModal(WalletSelectModel, {});
let result = await rewardModal.show();
if (!result.errcode) {

View File

@ -100,17 +100,21 @@ function hideModal(result = null) {
.modal-title {
border-radius: 12px 12px 0 0;
padding: 15px 20px;
border-bottom: 1px solid rgba(195, 195, 195, 0.14);
// border-bottom: 1px solid rgba(195, 195, 195, 0.14);
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
font-size: 1.35417vw;
height: 3.125vw;
background-color: #1c1725;
.close{
cursor: pointer;
}
}
.modal-sub-title {
padding: 15px 20px;
border-bottom: 1px solid rgba(195, 195, 195, 0.14);
// border-bottom: 1px solid rgba(195, 195, 195, 0.14);
font-size: 16px;
font-weight: 400;
}

File diff suppressed because one or more lines are too long