chg: getAccounts function call
MODIFY
src/abstracts/base_web3_client.ts
src/abstracts/base_web3_client.ts
@@ -3,6 +3,7 @@ import { ITransactionRequestConfig, ITransactionReceipt, ITransactionData, IBloc
import { Logger } from "../utils";
export abstract class BaseWeb3Client {
+ abstract name: string;
constructor(public logger: Logger) {
@@ -41,6 +42,17 @@ export abstract class BaseWeb3Client {
});
}
+ getAccounts_() {
+ return this.sendRPCRequest({
+ jsonrpc: '2.0',
+ method: 'eth_accounts',
+ params: [],
+ id: new Date().getTime()
+ }).then(payload => {
+ return payload.result;
+ });
+ }
+
abstract sendRPCRequest(request: IJsonRpcRequestPayload): Promise<IJsonRpcResponse>;
abstract encodeParameters(params: any[], types: any[]): string;

MODIFY
src/hermez/erc20.ts
src/hermez/erc20.ts
@@ -550,7 +550,7 @@ export class ERC20 extends HermezToken {
let contract: BaseContract;
let nonce: string;
- return Promise.all([client.getAccounts(), this.getContract(), client.getChainId(), this.getPermit()]).then(result => {
+ return Promise.all([client.name === 'WEB3' ? client.getAccounts_() : client.getAccounts(), this.getContract(), client.getChainId(), this.getPermit()]).then(result => {
account = result[0][0];
contract = result[1];
chainId = result[2];

chg: getAccounts function call