@@ -2,17 +2,17 @@ _section: Contract @<Contract> @SRC<contracts:class.Contract>
2
2
3
3
Explain contract here...
4
4
5
- _subsection: Creating Instances @<contract --creating>
5
+ _subsection: Creating Instances @<Contract --creating>
6
6
7
7
_property: new ethers.Contract(address, abi, signerOrProvider) @src<contracts:constructor.Contract>
8
8
9
- _property: contract.attach(addressOrName) => [[Contract]] @<contract -attach> @SRC<contracts:Contract.attach>
9
+ _property: contract.attach(addressOrName) => [[Contract]] @<Contract -attach> @SRC<contracts:Contract.attach>
10
10
Returns a new instance of the **Contract** attached to a new
11
11
address. This is useful if there are multiple similar or identical
12
12
copies of a Contract on the network and you wish to interact with
13
13
each of them.
14
14
15
- _property: contract.connect(providerOrSigner) => [[Contract]] @<contract -connect> @SRC<contracts:Contract.connect>
15
+ _property: contract.connect(providerOrSigner) => [[Contract]] @<Contract -connect> @SRC<contracts:Contract.connect>
16
16
Returns a new instance of the Contract, but connected to
17
17
//providerOrSigner//.
18
18
@@ -23,7 +23,7 @@ By passing in a [[Signer]]. the will return a **Contract** which
23
23
will act on behalf of that signer.
24
24
25
25
26
- _subsection: Properties @<contrct --properties>
26
+ _subsection: Properties @<Contract --properties>
27
27
28
28
_property: contract.address => string<[[address]]>
29
29
This is the address (or ENS name) the contract was constructed with.
@@ -49,41 +49,41 @@ _property: contract.signer => [[Signer]]
49
49
If a signer was provided to the constructor, this is that signer.
50
50
51
51
52
- _subsection: Methods
52
+ _subsection: Methods @<Contract--methods>
53
53
54
- _property: contract.deployed() => Promise<[[Contract]]> @<contract -deployed> @SRC<contracts>
54
+ _property: contract.deployed() => Promise<[[Contract]]> @<Contract -deployed> @SRC<contracts>
55
55
56
- _property: Contract.isIndexed(value) => boolean @<contract -isIndexed> @SRC<contracts>
56
+ _property: Contract.isIndexed(value) => boolean @<Contract -isIndexed> @SRC<contracts>
57
57
58
58
59
- _subsection: Events
59
+ _subsection: Events @<Contract--events>
60
60
61
- _property: contract.queryFilter(event [ , fromBlockOrBlockHash [ , toBlock ]) => Promise<Array<Event>> @<contract -queryFilter> @SRC<contracts>
61
+ _property: contract.queryFilter(event [ , fromBlockOrBlockHash [ , toBlock ]) => Promise<Array<Event>> @<Contract -queryFilter> @SRC<contracts>
62
62
Return Events that match the //event//.
63
63
64
- _property: contract.listenerCount([ event ]) => number @<contract -listenerCount> @SRC<contracts:Contract.listenerCount>
64
+ _property: contract.listenerCount([ event ]) => number @<Contract -listenerCount> @SRC<contracts:Contract.listenerCount>
65
65
Return the number of listeners that are subscribed to //event//. If
66
66
no event is provided, returns the total count of all events.
67
67
68
- _property: contract.listeners(event) => Array<Listener> @<contract -listeners> @SRC<contracts:Contract.listeners>
68
+ _property: contract.listeners(event) => Array<Listener> @<Contract -listeners> @SRC<contracts:Contract.listeners>
69
69
Return a list of listeners that are subscribed to //event//.
70
70
71
- _property: contract.off(event, listener) => this @<contract -off> @SRC<contracts>
71
+ _property: contract.off(event, listener) => this @<Contract -off> @SRC<contracts>
72
72
Unsubscribe //listener// to //event//.
73
73
74
- _property: contract.on(event, listener) => this @<contract -on> @SRC<contracts>
74
+ _property: contract.on(event, listener) => this @<Contract -on> @SRC<contracts>
75
75
Subscribe to //event// calling //listener// when the event occurs.
76
76
77
- _property: contract.once(event, listener) => this @<contract -once> @SRC<contracts>
77
+ _property: contract.once(event, listener) => this @<Contract -once> @SRC<contracts>
78
78
Subscribe once to //event// calling //listener// when the event
79
79
occurs.
80
80
81
- _property: contract.removeAllListeners([ event ]) => this @<contract -removeAllListeners> @SRC<contracts:Contract.removeAllListeners>
81
+ _property: contract.removeAllListeners([ event ]) => this @<Contract -removeAllListeners> @SRC<contracts:Contract.removeAllListeners>
82
82
Unsubscribe all listeners for //event//. If no event is provided,
83
83
all events are unsubscribed.
84
84
85
85
86
- _subsection: Meta-Class @<contract --metaclass>
86
+ _subsection: Meta-Class @<Contract --metaclass>
87
87
88
88
A Meta-Class is a Class which has any of its properties determined
89
89
at run-time. The **Contract** object uses a Contract's ABI to
@@ -92,15 +92,15 @@ describe the generic ways to interact with the properties added
92
92
at run-time during the **Contract** constructor.
93
93
94
94
95
- _heading: Read-Only Methods (constant) @<contract --readonly>
95
+ _heading: Read-Only Methods (constant) @<Contract --readonly>
96
96
97
97
A constant method is read-only and evaluates a small amount of EVM
98
98
code against the current blockchain state and can be computed by
99
99
asking a single node, which can return a result. It is therefore
100
100
free and does not require any ether, but **cannot make changes** to
101
101
the blockchain state..
102
102
103
- _property: contract.METHOD_NAME(...args [ overrides ]) => Promise<any> @<contract -functionsCall>
103
+ _property: contract.METHOD_NAME(...args [, overrides ]) => Promise<any> @<Contract -functionsCall>
104
104
The type of the result depends on the ABI.
105
105
106
106
For values that have a simple meaning in JavaScript, the types are fairly
@@ -113,8 +113,24 @@ number is used. Otherwise a [[BigNumber]] is returned.
113
113
114
114
For bytes (both fixed length and dynamic), a [[DataHexString]] is returned.
115
115
116
+ _property: contract.functions.METHOD_NAME(...args [, overrides ]) => Promise<[[Result]]>
116
117
117
- _heading: Write Methods (non-constant) @<contract--write>
118
+ The result will always be a [[Result]], even if there is only a single
119
+ return value type.
120
+
121
+ This simplifies frameworks which wish to use the [[Contract]] object,
122
+ since they do not need to inspect the return types to unwrap simplified
123
+ functions.
124
+
125
+ Another use for this method is for error recovery. For example, if a
126
+ function result is an invalid UTF-8 string, the normal call using the
127
+ above meta-class function will throw an exception. This allows using the
128
+ Result access error to access the low-level bytes and reason for the error
129
+ allowing an alternate UTF-8 error strategy to be used.
130
+
131
+ Most developers should not require this.
132
+
133
+ _heading: Write Methods (non-constant) @<Contract--write>
118
134
119
135
A non-constant method requires a transaction to be signed and requires
120
136
payment in the form of a fee to be paid to a miner. This transaction
@@ -132,7 +148,7 @@ it is sent to the network. This requires the **Contract** has a
132
148
signer.
133
149
134
150
135
- _heading: Write Methods Analysis @<contract --check>
151
+ _heading: Write Methods Analysis @<Contract --check>
136
152
137
153
There are secveral options to analyze properties and results of a
138
154
write method without actually executing it.
@@ -154,9 +170,9 @@ return the result.
154
170
This does not actually chagne any state, but is free. This in some cases
155
171
can be used to determine if a transaction will fail or succeed.
156
172
157
- This otherwise functions the same as a [Read-Only Method](contract --readonly).
173
+ This otherwise functions the same as a [Read-Only Method](Contract --readonly).
158
174
159
- _heading: Event Filters @<contract -filters>
175
+ _heading: Event Filters @<Contract- -filters>
160
176
An event filter is made up of topics, which are values logged in a
161
177
[[link-wiki-bloomfilter]], allowing efficient searching for entries
162
178
which match a filter.
0 commit comments