Skip to content

Commit

Permalink
Fixed contract events (ethers-io#404).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed May 23, 2019
1 parent 88a8324 commit 1d56538
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src.ts/base-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,10 @@ export class BaseProvider extends Provider {
filter.address = this.resolveName(f.address);
}

if (f.topics) {
filter.topics = f.topics;
}

if (f.blockHash != null) {
filter.blockHash = f.blockHash;
}
Expand Down
2 changes: 1 addition & 1 deletion src.ts/json-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class JsonRpcSigner extends Signer {
fromAddress
]).then((results) => {
let tx = results[0];
let hexTx = (<any>this.constructor).hexlifyTransaction(tx);
let hexTx = (<any>this.provider.constructor).hexlifyTransaction(tx);
hexTx.from = results[1];
return this.provider.send("eth_sendTransaction", [ hexTx ]).then((hash) => {
return hash;
Expand Down
8 changes: 6 additions & 2 deletions src.ts/url-json-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export class UrlJsonRpcProvider extends JsonRpcProvider {
constructor(network?: Networkish, apiKey?: string) {
errors.checkAbstract(new.target, UrlJsonRpcProvider);

network = getNetwork((network == null) ? "homestead": network);
// Normalize the Network and API Key
network = new.target.getNetwork(network);
apiKey = new.target.getApiKey(apiKey);

let url = new.target.getUrl(network, apiKey);
Expand All @@ -39,6 +40,10 @@ export class UrlJsonRpcProvider extends JsonRpcProvider {
return Promise.resolve([]);
}

static getNetwork(network?: Networkish): Network {
return getNetwork((network == null) ? "homestead": network);
}

// Return a defaultApiKey if null, otherwise validate the API key
static getApiKey(apiKey: string): string {
return apiKey;
Expand All @@ -50,5 +55,4 @@ export class UrlJsonRpcProvider extends JsonRpcProvider {
operation: "getUrl"
});
}

}

0 comments on commit 1d56538

Please sign in to comment.