private currentProvider: any; // 初期化 constructor() { const providers = ethers.providers; const network = providers.networks[networkName]; const myProvider = new providers.JsonRpcProvider('http://<your-provider-url>'); const infuraProvider = new providers.InfuraProvider(network, '<your-api-key>'); this.currentProvider = new providers.FallbackProvider([ myProvider, infuraProvider ]); } // コントラクト取得 getContract(abi: any, address: string): any { return new ethers.Contract(address, abi, this.currentProvider); } // ウォレット作成 getNewWallet(): any { return ethers.Wallet.createRandom(); } }