apollo-link-ethereum
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -329,3 +329,4 @@ (function (global, factory) { | ||
this.abiMapping = {}; | ||
this.addressMapping = {}; | ||
this.nameToAddressMapping = {}; | ||
this.addressToNameMapping = {}; | ||
} | ||
@@ -345,13 +346,23 @@ AbiMapping.prototype.addAbi = function (name, abiDefinition) { | ||
AbiMapping.prototype.addAddress = function (name, networkId, address) { | ||
if (!this.addressMapping[name]) { | ||
this.addressMapping[name] = {}; | ||
if (!this.nameToAddressMapping[name]) { | ||
this.nameToAddressMapping[name] = {}; | ||
} | ||
this.addressMapping[name][networkId] = address; | ||
if (!this.addressToNameMapping[address]) { | ||
this.addressToNameMapping[address] = {}; | ||
} | ||
this.nameToAddressMapping[name][networkId] = address; | ||
this.addressToNameMapping[address][networkId] = name; | ||
}; | ||
AbiMapping.prototype.getAddress = function (name, networkId) { | ||
if (!this.addressMapping[name]) { | ||
return null; | ||
if (!this.nameToAddressMapping[name]) { | ||
return undefined; | ||
} | ||
return this.addressMapping[name][networkId]; | ||
return this.nameToAddressMapping[name][networkId]; | ||
}; | ||
AbiMapping.prototype.getName = function (address, networkId) { | ||
if (!this.addressToNameMapping[address]) { | ||
return undefined; | ||
} | ||
return this.addressToNameMapping[address][networkId]; | ||
}; | ||
return AbiMapping; | ||
@@ -358,0 +369,0 @@ }()); |
import { AbiDefinition } from './AbiDefinition'; | ||
export declare class AbiMapping { | ||
abiMapping: object; | ||
addressMapping: object; | ||
nameToAddressMapping: object; | ||
addressToNameMapping: object; | ||
constructor(); | ||
@@ -10,2 +11,3 @@ addAbi(name: string, abiDefinition: AbiDefinition): void; | ||
getAddress(name: string, networkId: Number): any; | ||
getName(address: string, networkId: Number): any; | ||
} |
var AbiMapping = /** @class */ (function () { | ||
function AbiMapping() { | ||
this.abiMapping = {}; | ||
this.addressMapping = {}; | ||
this.nameToAddressMapping = {}; | ||
this.addressToNameMapping = {}; | ||
} | ||
@@ -19,13 +20,23 @@ AbiMapping.prototype.addAbi = function (name, abiDefinition) { | ||
AbiMapping.prototype.addAddress = function (name, networkId, address) { | ||
if (!this.addressMapping[name]) { | ||
this.addressMapping[name] = {}; | ||
if (!this.nameToAddressMapping[name]) { | ||
this.nameToAddressMapping[name] = {}; | ||
} | ||
this.addressMapping[name][networkId] = address; | ||
if (!this.addressToNameMapping[address]) { | ||
this.addressToNameMapping[address] = {}; | ||
} | ||
this.nameToAddressMapping[name][networkId] = address; | ||
this.addressToNameMapping[address][networkId] = name; | ||
}; | ||
AbiMapping.prototype.getAddress = function (name, networkId) { | ||
if (!this.addressMapping[name]) { | ||
return null; | ||
if (!this.nameToAddressMapping[name]) { | ||
return undefined; | ||
} | ||
return this.addressMapping[name][networkId]; | ||
return this.nameToAddressMapping[name][networkId]; | ||
}; | ||
AbiMapping.prototype.getName = function (address, networkId) { | ||
if (!this.addressToNameMapping[address]) { | ||
return undefined; | ||
} | ||
return this.addressToNameMapping[address][networkId]; | ||
}; | ||
return AbiMapping; | ||
@@ -32,0 +43,0 @@ }()); |
{ | ||
"name": "apollo-link-ethereum", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"main": "./dist/bundle.umd.js", | ||
@@ -34,3 +34,3 @@ "modules": "./lib/index.js", | ||
}, | ||
"gitHead": "536c85689bd4ad0581daa31550742851e3641372" | ||
"gitHead": "96014e16411941e51860121e98be5fd4c9eb2e6e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
480037
859