This method is asynchronous.
This method is asynchronous.
This method is asynchronous.
This mostly behaves as WireDecoder.events.
However, unlike other variants of this function, this one, by default, restricts to events originating from this instance's address.
If you don't want to restrict like that, you can explicitly use address: undefined in the options to disable this.
(You can also of course set a different address to restrict to that.)
Used to determine what events to fetch; see the documentation on the EventOptions type for more.
This method is asynchronous.
Returns information about the state of the contract, but does not include information about the storage or decoded variables. See the documentation for the ContractState type for more.
The block to inspect the contract's state at. Defaults to latest. See BlockSpecifier for legal values.
This method is asynchronous.
Opposite of watchMappingKey; unwatches the specified mapping key. See watchMappingKey for more on how watching mapping keys works, and on how the parameters work.
Note that unwatching a mapping key will also unwatch all its descendants.
E.g., if m is of type mapping(uint => mapping(uint => uint)), then
unwatching m[0] will also unwatch m[0][0], m[0][1], etc, if these
are currently watched.
This function has the same caveats as watchMappingKey.
This method is asynchronous.
Decodes an individual contract variable; returns its value as a Result. See the documentation for variables() for various caveats that also apply here.
If the variable can't be located, throws an exception.
The name (or numeric ID, if you know that) of the variable. Can be given as a qualified name, allowing one to get at shadowed variables from base contracts. If given by ID, can be given as a number or numeric string.
The block to inspect the contract's state at. Defaults to latest. See BlockSpecifier for legal values.
This method is asynchronous.
Decodes the contract's variables; returns an array of these decoded variables. See the documentation of the [[DecodedVariable]] type for more.
Note that variable decoding can only operate in full mode; if the decoder wasn't able to start up in full mode, this method will throw an exception.
Note that decoding mappings requires first watching mapping keys in order to get any results; see the documentation for watchMappingKey. Additional methods to make mapping decoding a less manual affair are planned for the future.
Also, due to a technical limitation, it is not currently possible to usefully decode internal function pointers. See the FunctionInternalValue documentation and the README for more on how these are handled.
The block to inspect the contract's state at. Defaults to latest. See BlockSpecifier for legal values.
This method is asynchronous.
Watches a mapping key; adds it to the decoder's list of watched mapping keys. This affects the results of both variables() and variable(). When a mapping is decoded, only the values at its watched keys will be included in its value.
Note that it is possible to watch mappings that are inside structs, arrays, other mappings, etc; see below for more on how to do this.
Note that watching mapping keys is only possible in full mode; if the decoder wasn't able to start up in full mode, this method will throw an exception.
Warning: At the moment, this function does very little to check its input. Bad input may have unpredictable results. This will be remedied in the future (by having it throw exceptions on bad input), but right now essentially no checking is implemented. Also, there may be slight changes to the format of indices in the future.
(A bad variable name will cause an exception though; that input is checked.)
The variable that the mapping lives under; this works like the nameOrId argument to variable(). If the mapping is a top-level state variable, put the mapping itself here. Otherwise, put the top-level state variable it lives under.
Further arguments to watchMappingKey, if given, will be interpreted as indices into or members of the variable identified by the variable argument; see the example. Array indices and mapping keys are specified by value; struct members are specified by name or (if you know it) numeric ID.
Numeric values can be given as number, BN, or numeric string. Bytestring values are given as hex strings. Boolean values are given as booleans, or as the strings "true" or "false". Address values are given as hex strings; they are currently not required to be in checksum case, but this will likely change in the future, so don't rely on that.
Note that if the path to a given mapping key includes mapping keys above it, any ancestors will also be watched automatically.
Generated using TypeDoc
The ContractInstanceDecoder class. Decodes storage for a specified instance. Also, decodes transactions and logs. See below for a method listing.
Note that when using this class to decode transactions and logs, it does have one advantage over using the WireDecoder or ContractDecoder. If the artifact for the class does not have a deployedBytecode field, the WireDecoder (and therefore also the ContractDecoder) will not be able to tell that this instance is of that class, and so will fail to decode transactions sent to it or logs originating from it. However, the ContractInstanceDecoder has that information and will make use of it, making it possible for it to decode transactions sent to this instance, or logs originating from it, even if the deployedBytecode field is misssing.