Skip to content

Commit 75d45eb

Browse files
committed
re-org & update README to match current spec (@truffle/contract-schema)
1 parent 0331034 commit 75d45eb

File tree

1 file changed

+104
-25
lines changed

1 file changed

+104
-25
lines changed

packages/contract-schema/README.md

Lines changed: 104 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,20 @@ Name used to identify the contract. Semi-alphanumeric string.
5656
| JSON Schema | [abi.spec.json](spec/abi.spec.json) |
5757
| **required** |
5858

59+
5960
External programmatic description of contract's interface. The contract's ABI
6061
determines the means by which applications may interact with individual contract
6162
instances. Array of functions and events representing valid inputs and outputs
6263
for the instance.
6364

6465

65-
### `ast`
66+
### `metadata`
6667

67-
| type | _object_ |
68+
| type | _string_ |
6869
| ---: | ---- |
6970

70-
_not included in current version of this specification_
7171

72-
Abstract Syntax Tree. A nested JSON object representation of contract source
73-
code, as output by compiler.
72+
Contract metadata. Stringified JSON.
7473

7574

7675

@@ -87,7 +86,6 @@ Specified as a hexadecimal string, may include `__`-prefixed (double underscore)
8786
link references.
8887

8988

90-
9189
### `deployedBytecode`
9290

9391
| type | _string_ matching pattern `^0x0$\|^0x([a-fA-F0-9]{2}\|__.{38})+$` |
@@ -101,6 +99,26 @@ Specified as a hexadecimal string, may include `__`-prefixed (double underscore)
10199
link references.
102100

103101

102+
### `sourceMap`
103+
104+
| type | _string_ matching pattern `^[0-9;]*` |
105+
| ---: | ---- |
106+
107+
108+
Source mapping for `bytecode`, pairing contract creation transaction data bytes
109+
with origin statements in uncompiled `source`.
110+
111+
112+
### `deployedSourceMap`
113+
114+
| type | _string_ matching pattern `^[0-9;]*` |
115+
| ---: | ---- |
116+
117+
118+
Source mapping for `deployedBytecode`, pairing contract program data bytes
119+
with origin statements in uncompiled `source`.
120+
121+
104122
### `source`
105123

106124
| type | _string_ |
@@ -115,86 +133,147 @@ Uncompiled source code for contract. Text string.
115133
| type | _string_ |
116134
| ---: | ---- |
117135

136+
118137
File path for uncompiled source code.
119138

120139

121-
### `sourceMap`
140+
### `ast`
122141

123-
| type | _string_ matching pattern `^[0-9;]*` |
142+
| type | _object_ |
124143
| ---: | ---- |
125144

126145

127-
Source mapping for `bytecode`, pairing contract creation transaction data bytes
128-
with origin statements in uncompiled `source`.
146+
_format not included in current version of this specification_
129147

148+
Abstract Syntax Tree. A nested JSON object representation of contract source
149+
code, as output by compiler.
130150

131-
### `deployedSourceMap`
132151

133-
| type | _string_ matching pattern `^[0-9;]*` |
152+
### `legacyAST`
153+
154+
| type | _object_ |
134155
| ---: | ---- |
135156

136-
Source mapping for `deployedBytecode`, pairing contract program data bytes
137-
with origin statements in uncompiled `source`.
138157

158+
_format not included in current version of this specification_
139159

140-
### `schemaVersion`
160+
Legacy Abstract Syntax Tree. A nested JSON object representation of contract source
161+
code, as output by compiler.
141162

142-
| type | _string_ matching pattern `[0-9]+\.[0-9]+\.[0-9]+` |
163+
164+
### `compiler`
165+
166+
| type | _object_ |
143167
| ---: | ---- |
144168

145-
Version of this schema used by contract object representation.
146169

170+
Compiler information.
147171

148172

149-
### `updatedAt`
173+
### `name`
150174

151-
| type | _string_ |
175+
| type | string |
152176
| ---: | ---- |
153-
| format | IS0-8601 Datetime |
154177

155178

156-
Time at which contract object representation was generated/most recently
157-
updated.
179+
Name of the compiler used.
180+
181+
182+
### `version`
183+
184+
| type | string |
185+
| ---: | ---- |
186+
187+
188+
Version of the compiler used.
158189

159190

160191
### `networks`
161192

162193
| type | _object_ |
163194
| ---: | ---- |
164195

196+
165197
Listing of contract instances. Object mapping network ID keys to network object
166198
values. Includes address information, links to other contract instances, and/or
167199
contract event logs.
168200

201+
169202
#### Properties (key matching `^[a-zA-Z0-9]+$`)
170203

171204
| type | _object_ |
172205
| ---: | ---- |
173206
| ref | [Network Object](network-object.spec.md) |
174207

175208

209+
### `schemaVersion`
210+
211+
| type | _string_ matching pattern `[0-9]+\.[0-9]+\.[0-9]+` |
212+
| ---: | ---- |
213+
214+
215+
Version of this schema used by contract object representation.
216+
217+
218+
### `updatedAt`
219+
220+
| type | _string_ |
221+
| ---: | ---- |
222+
| format | IS0-8601 Datetime |
223+
224+
225+
Time at which contract object representation was generated/most recently
226+
updated.
227+
228+
229+
### `networkType`
230+
231+
| type | string |
232+
| ---: | ---- |
233+
234+
235+
Specific blockchain network type targeted.
236+
237+
238+
### `devdoc`
239+
240+
| type | string |
241+
| ---: | ---- |
242+
243+
244+
NatSpec developer documentation of the contract.
245+
246+
247+
### `userdoc`
248+
249+
| type | string |
250+
| ---: | ---- |
251+
252+
253+
NatSpec user documentation of the contract.
254+
255+
176256
## Custom Properties
177257

178258
### `^x-([a-zA-Z]+-)*[a-zA-Z]+`
179259

180260
| type | _string or number or object or array_ |
181261
| ---: | ---- |
182262

263+
183264
Objects following this schema may include additional properties with
184265
`x-`-prefixed keys.
185266

186267

187-
188268
## Definitions
189269

190270

191-
192-
193271
### <a name="contract-object--bytecode">Bytecode</a>
194272

195273
| type | _string_ matching pattern `^0x0$\|^0x([a-fA-F0-9]{2}\|__.{38})+$` |
196274
| ---: | ---- |
197275

276+
198277
`0x`-prefixed string representing compiled EVM machine language.
199278

200279
This string representation may indicate link references in place of

0 commit comments

Comments
 (0)