增加全局遍历jc.wallet

This commit is contained in:
cebgcontract 2022-06-16 16:56:23 +08:00
parent 1a193f1f0e
commit 77def1b26d

View File

@ -5,7 +5,6 @@ import { ZError } from "./common/ZError";
import { AllChains } from "./data/allchain"; import { AllChains } from "./data/allchain";
import { createWalletEvents, WALLET_CHAIN_CHANGE } from "./common/WalletEvent"; import { createWalletEvents, WALLET_CHAIN_CHANGE } from "./common/WalletEvent";
export interface IChainData { export interface IChainData {
name: string, name: string,
type: string, type: string,
@ -14,10 +13,10 @@ export interface IChainData {
symbol: string, symbol: string,
explorerurl: string explorerurl: string
} }
interface Window { declare namespace jc {
JCWallet: JCWallet export let wallet: JCWallet
} }
declare let window: Window
@singleton @singleton
export default class JCWallet { export default class JCWallet {
web3: Web3 = null web3: Web3 = null
@ -37,7 +36,7 @@ export default class JCWallet {
this.wallet.add(key); this.wallet.add(key);
this.web3.eth.accounts.wallet.save(this.password); this.web3.eth.accounts.wallet.save(this.password);
} }
window.JCWallet = this jc.wallet = this
} }
public init({chains}: {chains: number[]}) { public init({chains}: {chains: number[]}) {