@graphprotocol/graph-cli 0.37.0 → 0.37.1-alpha-20221207192322-dd39b34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +6 -3
- package/src/command-helpers/abi.js +2 -0
- package/src/command-helpers/network.test.js +13 -10
- package/tests/cli/validation/call-handler-with-tuple/generated/schema.ts +44 -0
- package/tests/cli/validation/example-values-found/generated/ExampleSubgraph/ExampleContract.ts +35 -0
- package/tests/cli/validation/example-values-found/generated/schema.ts +44 -0
- package/tests/cli/validation/source-without-address-is-valid/generated/ExampleSubgraph/ExampleContract.ts +35 -0
- package/.eslintrc +0 -10
- package/.prettierrc.json +0 -6
- package/.travis.yml +0 -37
- package/CONTRIBUTING.md +0 -16
- package/LICENSE-APACHE +0 -190
- package/LICENSE-MIT +0 -21
- package/NEWS.md +0 -80
- package/README.md +0 -146
- package/examples/basic-event-handlers/LICENSE +0 -21
- package/examples/basic-event-handlers/README.md +0 -3
- package/examples/basic-event-handlers/abis/Gravity.json +0 -1
- package/examples/basic-event-handlers/bin/Counter.bin +0 -1
- package/examples/basic-event-handlers/build/Gravity/Gravity.wasm +0 -0
- package/examples/basic-event-handlers/build/Gravity/abis/Gravity.json +0 -199
- package/examples/basic-event-handlers/build/schema.graphql +0 -13
- package/examples/basic-event-handlers/build/subgraph.yaml +0 -27
- package/examples/basic-event-handlers/contracts/Gravity.sol +0 -62
- package/examples/basic-event-handlers/contracts/Migrations.sol +0 -23
- package/examples/basic-event-handlers/generated/Gravity/Gravity.ts +0 -343
- package/examples/basic-event-handlers/generated/schema.ts +0 -133
- package/examples/basic-event-handlers/migrations/1_initial_migration.js +0 -5
- package/examples/basic-event-handlers/migrations/2_deploy_contract.js +0 -5
- package/examples/basic-event-handlers/migrations/3_create_gravatars.js +0 -14
- package/examples/basic-event-handlers/migrations/4_update_gravatars.js +0 -9
- package/examples/basic-event-handlers/package.json +0 -24
- package/examples/basic-event-handlers/schema.graphql +0 -13
- package/examples/basic-event-handlers/src/mapping.ts +0 -21
- package/examples/basic-event-handlers/subgraph.yaml +0 -27
- package/examples/basic-event-handlers/test/handlers.js +0 -110
- package/examples/basic-event-handlers/truffle.js +0 -34
- package/examples/basic-event-handlers/yarn.lock +0 -1027
- package/examples/example-subgraph/abis/ExampleContract.json +0 -2388
- package/examples/example-subgraph/dist/ExampleSubgraph/ExampleSubgraph.wasm +0 -0
- package/examples/example-subgraph/dist/ExampleSubgraph/abis/ExampleContract.json +0 -2394
- package/examples/example-subgraph/dist/abis/ExampleContract.json +0 -2388
- package/examples/example-subgraph/dist/schema.graphql +0 -37
- package/examples/example-subgraph/dist/subgraph.yaml +0 -26
- package/examples/example-subgraph/package.json +0 -15
- package/examples/example-subgraph/schema.graphql +0 -37
- package/examples/example-subgraph/src/mapping.ts +0 -286
- package/examples/example-subgraph/subgraph.yaml +0 -26
- package/examples/example-subgraph/yarn.lock +0 -28
- package/resources/test/docker-compose-standalone-node.yml +0 -20
- package/resources/test/docker-compose.yml +0 -43
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ethereum,
|
|
5
|
-
JSONValue,
|
|
6
|
-
TypedMap,
|
|
7
|
-
Entity,
|
|
8
|
-
Bytes,
|
|
9
|
-
Address,
|
|
10
|
-
BigInt
|
|
11
|
-
} from "@graphprotocol/graph-ts";
|
|
12
|
-
|
|
13
|
-
export class NewGravatar extends ethereum.Event {
|
|
14
|
-
get params(): NewGravatar__Params {
|
|
15
|
-
return new NewGravatar__Params(this);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class NewGravatar__Params {
|
|
20
|
-
_event: NewGravatar;
|
|
21
|
-
|
|
22
|
-
constructor(event: NewGravatar) {
|
|
23
|
-
this._event = event;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get id(): BigInt {
|
|
27
|
-
return this._event.parameters[0].value.toBigInt();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get owner(): Address {
|
|
31
|
-
return this._event.parameters[1].value.toAddress();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get displayName(): string {
|
|
35
|
-
return this._event.parameters[2].value.toString();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get imageUrl(): string {
|
|
39
|
-
return this._event.parameters[3].value.toString();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export class UpdatedGravatar extends ethereum.Event {
|
|
44
|
-
get params(): UpdatedGravatar__Params {
|
|
45
|
-
return new UpdatedGravatar__Params(this);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export class UpdatedGravatar__Params {
|
|
50
|
-
_event: UpdatedGravatar;
|
|
51
|
-
|
|
52
|
-
constructor(event: UpdatedGravatar) {
|
|
53
|
-
this._event = event;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
get id(): BigInt {
|
|
57
|
-
return this._event.parameters[0].value.toBigInt();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
get owner(): Address {
|
|
61
|
-
return this._event.parameters[1].value.toAddress();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
get displayName(): string {
|
|
65
|
-
return this._event.parameters[2].value.toString();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
get imageUrl(): string {
|
|
69
|
-
return this._event.parameters[3].value.toString();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export class Gravity__getGravatarResult {
|
|
74
|
-
value0: string;
|
|
75
|
-
value1: string;
|
|
76
|
-
|
|
77
|
-
constructor(value0: string, value1: string) {
|
|
78
|
-
this.value0 = value0;
|
|
79
|
-
this.value1 = value1;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
toMap(): TypedMap<string, ethereum.Value> {
|
|
83
|
-
let map = new TypedMap<string, ethereum.Value>();
|
|
84
|
-
map.set("value0", ethereum.Value.fromString(this.value0));
|
|
85
|
-
map.set("value1", ethereum.Value.fromString(this.value1));
|
|
86
|
-
return map;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export class Gravity__gravatarsResult {
|
|
91
|
-
value0: Address;
|
|
92
|
-
value1: string;
|
|
93
|
-
value2: string;
|
|
94
|
-
|
|
95
|
-
constructor(value0: Address, value1: string, value2: string) {
|
|
96
|
-
this.value0 = value0;
|
|
97
|
-
this.value1 = value1;
|
|
98
|
-
this.value2 = value2;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
toMap(): TypedMap<string, ethereum.Value> {
|
|
102
|
-
let map = new TypedMap<string, ethereum.Value>();
|
|
103
|
-
map.set("value0", ethereum.Value.fromAddress(this.value0));
|
|
104
|
-
map.set("value1", ethereum.Value.fromString(this.value1));
|
|
105
|
-
map.set("value2", ethereum.Value.fromString(this.value2));
|
|
106
|
-
return map;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export class Gravity extends ethereum.SmartContract {
|
|
111
|
-
static bind(address: Address): Gravity {
|
|
112
|
-
return new Gravity("Gravity", address);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
getGravatar(owner: Address): Gravity__getGravatarResult {
|
|
116
|
-
let result = super.call(
|
|
117
|
-
"getGravatar",
|
|
118
|
-
"getGravatar(address):(string,string)",
|
|
119
|
-
[ethereum.Value.fromAddress(owner)]
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
return new Gravity__getGravatarResult(
|
|
123
|
-
result[0].toString(),
|
|
124
|
-
result[1].toString()
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
try_getGravatar(
|
|
129
|
-
owner: Address
|
|
130
|
-
): ethereum.CallResult<Gravity__getGravatarResult> {
|
|
131
|
-
let result = super.tryCall(
|
|
132
|
-
"getGravatar",
|
|
133
|
-
"getGravatar(address):(string,string)",
|
|
134
|
-
[ethereum.Value.fromAddress(owner)]
|
|
135
|
-
);
|
|
136
|
-
if (result.reverted) {
|
|
137
|
-
return new ethereum.CallResult();
|
|
138
|
-
}
|
|
139
|
-
let value = result.value;
|
|
140
|
-
return ethereum.CallResult.fromValue(
|
|
141
|
-
new Gravity__getGravatarResult(value[0].toString(), value[1].toString())
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
gravatarToOwner(param0: BigInt): Address {
|
|
146
|
-
let result = super.call(
|
|
147
|
-
"gravatarToOwner",
|
|
148
|
-
"gravatarToOwner(uint256):(address)",
|
|
149
|
-
[ethereum.Value.fromUnsignedBigInt(param0)]
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
return result[0].toAddress();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
try_gravatarToOwner(param0: BigInt): ethereum.CallResult<Address> {
|
|
156
|
-
let result = super.tryCall(
|
|
157
|
-
"gravatarToOwner",
|
|
158
|
-
"gravatarToOwner(uint256):(address)",
|
|
159
|
-
[ethereum.Value.fromUnsignedBigInt(param0)]
|
|
160
|
-
);
|
|
161
|
-
if (result.reverted) {
|
|
162
|
-
return new ethereum.CallResult();
|
|
163
|
-
}
|
|
164
|
-
let value = result.value;
|
|
165
|
-
return ethereum.CallResult.fromValue(value[0].toAddress());
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
ownerToGravatar(param0: Address): BigInt {
|
|
169
|
-
let result = super.call(
|
|
170
|
-
"ownerToGravatar",
|
|
171
|
-
"ownerToGravatar(address):(uint256)",
|
|
172
|
-
[ethereum.Value.fromAddress(param0)]
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
return result[0].toBigInt();
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
try_ownerToGravatar(param0: Address): ethereum.CallResult<BigInt> {
|
|
179
|
-
let result = super.tryCall(
|
|
180
|
-
"ownerToGravatar",
|
|
181
|
-
"ownerToGravatar(address):(uint256)",
|
|
182
|
-
[ethereum.Value.fromAddress(param0)]
|
|
183
|
-
);
|
|
184
|
-
if (result.reverted) {
|
|
185
|
-
return new ethereum.CallResult();
|
|
186
|
-
}
|
|
187
|
-
let value = result.value;
|
|
188
|
-
return ethereum.CallResult.fromValue(value[0].toBigInt());
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
gravatars(param0: BigInt): Gravity__gravatarsResult {
|
|
192
|
-
let result = super.call(
|
|
193
|
-
"gravatars",
|
|
194
|
-
"gravatars(uint256):(address,string,string)",
|
|
195
|
-
[ethereum.Value.fromUnsignedBigInt(param0)]
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
return new Gravity__gravatarsResult(
|
|
199
|
-
result[0].toAddress(),
|
|
200
|
-
result[1].toString(),
|
|
201
|
-
result[2].toString()
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
try_gravatars(param0: BigInt): ethereum.CallResult<Gravity__gravatarsResult> {
|
|
206
|
-
let result = super.tryCall(
|
|
207
|
-
"gravatars",
|
|
208
|
-
"gravatars(uint256):(address,string,string)",
|
|
209
|
-
[ethereum.Value.fromUnsignedBigInt(param0)]
|
|
210
|
-
);
|
|
211
|
-
if (result.reverted) {
|
|
212
|
-
return new ethereum.CallResult();
|
|
213
|
-
}
|
|
214
|
-
let value = result.value;
|
|
215
|
-
return ethereum.CallResult.fromValue(
|
|
216
|
-
new Gravity__gravatarsResult(
|
|
217
|
-
value[0].toAddress(),
|
|
218
|
-
value[1].toString(),
|
|
219
|
-
value[2].toString()
|
|
220
|
-
)
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export class UpdateGravatarImageCall extends ethereum.Call {
|
|
226
|
-
get inputs(): UpdateGravatarImageCall__Inputs {
|
|
227
|
-
return new UpdateGravatarImageCall__Inputs(this);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
get outputs(): UpdateGravatarImageCall__Outputs {
|
|
231
|
-
return new UpdateGravatarImageCall__Outputs(this);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export class UpdateGravatarImageCall__Inputs {
|
|
236
|
-
_call: UpdateGravatarImageCall;
|
|
237
|
-
|
|
238
|
-
constructor(call: UpdateGravatarImageCall) {
|
|
239
|
-
this._call = call;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
get _imageUrl(): string {
|
|
243
|
-
return this._call.inputValues[0].value.toString();
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export class UpdateGravatarImageCall__Outputs {
|
|
248
|
-
_call: UpdateGravatarImageCall;
|
|
249
|
-
|
|
250
|
-
constructor(call: UpdateGravatarImageCall) {
|
|
251
|
-
this._call = call;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export class SetMythicalGravatarCall extends ethereum.Call {
|
|
256
|
-
get inputs(): SetMythicalGravatarCall__Inputs {
|
|
257
|
-
return new SetMythicalGravatarCall__Inputs(this);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
get outputs(): SetMythicalGravatarCall__Outputs {
|
|
261
|
-
return new SetMythicalGravatarCall__Outputs(this);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export class SetMythicalGravatarCall__Inputs {
|
|
266
|
-
_call: SetMythicalGravatarCall;
|
|
267
|
-
|
|
268
|
-
constructor(call: SetMythicalGravatarCall) {
|
|
269
|
-
this._call = call;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export class SetMythicalGravatarCall__Outputs {
|
|
274
|
-
_call: SetMythicalGravatarCall;
|
|
275
|
-
|
|
276
|
-
constructor(call: SetMythicalGravatarCall) {
|
|
277
|
-
this._call = call;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
export class UpdateGravatarNameCall extends ethereum.Call {
|
|
282
|
-
get inputs(): UpdateGravatarNameCall__Inputs {
|
|
283
|
-
return new UpdateGravatarNameCall__Inputs(this);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
get outputs(): UpdateGravatarNameCall__Outputs {
|
|
287
|
-
return new UpdateGravatarNameCall__Outputs(this);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export class UpdateGravatarNameCall__Inputs {
|
|
292
|
-
_call: UpdateGravatarNameCall;
|
|
293
|
-
|
|
294
|
-
constructor(call: UpdateGravatarNameCall) {
|
|
295
|
-
this._call = call;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
get _displayName(): string {
|
|
299
|
-
return this._call.inputValues[0].value.toString();
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
export class UpdateGravatarNameCall__Outputs {
|
|
304
|
-
_call: UpdateGravatarNameCall;
|
|
305
|
-
|
|
306
|
-
constructor(call: UpdateGravatarNameCall) {
|
|
307
|
-
this._call = call;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
export class CreateGravatarCall extends ethereum.Call {
|
|
312
|
-
get inputs(): CreateGravatarCall__Inputs {
|
|
313
|
-
return new CreateGravatarCall__Inputs(this);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
get outputs(): CreateGravatarCall__Outputs {
|
|
317
|
-
return new CreateGravatarCall__Outputs(this);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
export class CreateGravatarCall__Inputs {
|
|
322
|
-
_call: CreateGravatarCall;
|
|
323
|
-
|
|
324
|
-
constructor(call: CreateGravatarCall) {
|
|
325
|
-
this._call = call;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
get _displayName(): string {
|
|
329
|
-
return this._call.inputValues[0].value.toString();
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
get _imageUrl(): string {
|
|
333
|
-
return this._call.inputValues[1].value.toString();
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
export class CreateGravatarCall__Outputs {
|
|
338
|
-
_call: CreateGravatarCall;
|
|
339
|
-
|
|
340
|
-
constructor(call: CreateGravatarCall) {
|
|
341
|
-
this._call = call;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
TypedMap,
|
|
5
|
-
Entity,
|
|
6
|
-
Value,
|
|
7
|
-
ValueKind,
|
|
8
|
-
store,
|
|
9
|
-
Address,
|
|
10
|
-
Bytes,
|
|
11
|
-
BigInt,
|
|
12
|
-
BigDecimal
|
|
13
|
-
} from "@graphprotocol/graph-ts";
|
|
14
|
-
|
|
15
|
-
export class NewGravatar extends Entity {
|
|
16
|
-
constructor(id: string) {
|
|
17
|
-
super();
|
|
18
|
-
this.set("id", Value.fromString(id));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
save(): void {
|
|
22
|
-
let id = this.get("id");
|
|
23
|
-
assert(id != null, "Cannot save NewGravatar entity without an ID");
|
|
24
|
-
if (id) {
|
|
25
|
-
assert(
|
|
26
|
-
id.kind == ValueKind.STRING,
|
|
27
|
-
"Cannot save NewGravatar entity with non-string ID. " +
|
|
28
|
-
'Considering using .toHex() to convert the "id" to a string.'
|
|
29
|
-
);
|
|
30
|
-
store.set("NewGravatar", id.toString(), this);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static load(id: string): NewGravatar | null {
|
|
35
|
-
return changetype<NewGravatar | null>(store.get("NewGravatar", id));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get id(): string {
|
|
39
|
-
let value = this.get("id");
|
|
40
|
-
return value!.toString();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
set id(value: string) {
|
|
44
|
-
this.set("id", Value.fromString(value));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get owner(): Bytes {
|
|
48
|
-
let value = this.get("owner");
|
|
49
|
-
return value!.toBytes();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
set owner(value: Bytes) {
|
|
53
|
-
this.set("owner", Value.fromBytes(value));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
get displayName(): string {
|
|
57
|
-
let value = this.get("displayName");
|
|
58
|
-
return value!.toString();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
set displayName(value: string) {
|
|
62
|
-
this.set("displayName", Value.fromString(value));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
get imageUrl(): string {
|
|
66
|
-
let value = this.get("imageUrl");
|
|
67
|
-
return value!.toString();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
set imageUrl(value: string) {
|
|
71
|
-
this.set("imageUrl", Value.fromString(value));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export class UpdatedGravatar extends Entity {
|
|
76
|
-
constructor(id: string) {
|
|
77
|
-
super();
|
|
78
|
-
this.set("id", Value.fromString(id));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
save(): void {
|
|
82
|
-
let id = this.get("id");
|
|
83
|
-
assert(id != null, "Cannot save UpdatedGravatar entity without an ID");
|
|
84
|
-
if (id) {
|
|
85
|
-
assert(
|
|
86
|
-
id.kind == ValueKind.STRING,
|
|
87
|
-
"Cannot save UpdatedGravatar entity with non-string ID. " +
|
|
88
|
-
'Considering using .toHex() to convert the "id" to a string.'
|
|
89
|
-
);
|
|
90
|
-
store.set("UpdatedGravatar", id.toString(), this);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
static load(id: string): UpdatedGravatar | null {
|
|
95
|
-
return changetype<UpdatedGravatar | null>(store.get("UpdatedGravatar", id));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
get id(): string {
|
|
99
|
-
let value = this.get("id");
|
|
100
|
-
return value!.toString();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
set id(value: string) {
|
|
104
|
-
this.set("id", Value.fromString(value));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
get owner(): Bytes {
|
|
108
|
-
let value = this.get("owner");
|
|
109
|
-
return value!.toBytes();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
set owner(value: Bytes) {
|
|
113
|
-
this.set("owner", Value.fromBytes(value));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
get displayName(): string {
|
|
117
|
-
let value = this.get("displayName");
|
|
118
|
-
return value!.toString();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
set displayName(value: string) {
|
|
122
|
-
this.set("displayName", Value.fromString(value));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
get imageUrl(): string {
|
|
126
|
-
let value = this.get("imageUrl");
|
|
127
|
-
return value!.toString();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
set imageUrl(value: string) {
|
|
131
|
-
this.set("imageUrl", Value.fromString(value));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const GravatarRegistry = artifacts.require('./GravatarRegistry.sol')
|
|
2
|
-
|
|
3
|
-
module.exports = async function(deployer) {
|
|
4
|
-
let accounts = await web3.eth.getAccounts()
|
|
5
|
-
|
|
6
|
-
const registry = await GravatarRegistry.deployed()
|
|
7
|
-
await registry.setMythicalGravatar( { from: accounts[0] });
|
|
8
|
-
await registry.createGravatar('Carl', 'https://thegraph.com/img/team/team_04.png', {
|
|
9
|
-
from: accounts[0],
|
|
10
|
-
})
|
|
11
|
-
await registry.createGravatar('Lucas', 'https://thegraph.com/img/team/bw_Lucas.jpg', {
|
|
12
|
-
from: accounts[1],
|
|
13
|
-
})
|
|
14
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const GravatarRegistry = artifacts.require('./GravatarRegistry.sol')
|
|
2
|
-
|
|
3
|
-
module.exports = async function(deployer) {
|
|
4
|
-
let accounts = await web3.eth.getAccounts()
|
|
5
|
-
|
|
6
|
-
const registry = await GravatarRegistry.deployed()
|
|
7
|
-
await registry.updateGravatarName('Nena', { from: accounts[0] })
|
|
8
|
-
await registry.updateGravatarName('Jorge', { from: accounts[1] })
|
|
9
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "basic-event-handlers",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"scripts": {
|
|
5
|
-
"codegen": "../../bin/graph codegen",
|
|
6
|
-
"build": "../../bin/graph build",
|
|
7
|
-
"test": "truffle test --network test",
|
|
8
|
-
"create-test": "../../bin/graph create test/basic-event-handlers --node http://127.0.0.1:18020",
|
|
9
|
-
"deploy-test": "../../bin/graph deploy test/basic-event-handlers --version-label v0.0.1 --ipfs http://localhost:15001 --node http://127.0.0.1:18020"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"@graphprotocol/graph-ts": "0.28.1",
|
|
13
|
-
"apollo-fetch": "^0.7.0"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"babel-polyfill": "6.26.0",
|
|
17
|
-
"babel-register": "6.26.0",
|
|
18
|
-
"truffle": "5.0.12",
|
|
19
|
-
"truffle-hdwallet-provider": "1.0.6"
|
|
20
|
-
},
|
|
21
|
-
"resolutions": {
|
|
22
|
-
"assemblyscript": "0.19.10"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NewGravatar as NewGravatarEvent,
|
|
3
|
-
UpdatedGravatar as UpdatedGravatarEvent,
|
|
4
|
-
} from '../generated/Gravity/Gravity'
|
|
5
|
-
import { NewGravatar, UpdatedGravatar } from '../generated/schema'
|
|
6
|
-
|
|
7
|
-
export function handleNewGravatar(event: NewGravatarEvent): void {
|
|
8
|
-
let newGravatar = new NewGravatar(event.params.id.toHex())
|
|
9
|
-
newGravatar.owner = event.params.owner
|
|
10
|
-
newGravatar.displayName = event.params.displayName
|
|
11
|
-
newGravatar.imageUrl = event.params.imageUrl
|
|
12
|
-
newGravatar.save()
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function handleUpdatedGravatar(event: UpdatedGravatarEvent): void {
|
|
16
|
-
let updatedGravatar = new UpdatedGravatar(event.params.id.toHex())
|
|
17
|
-
updatedGravatar.owner = event.params.owner
|
|
18
|
-
updatedGravatar.displayName = event.params.displayName
|
|
19
|
-
updatedGravatar.imageUrl = event.params.imageUrl
|
|
20
|
-
updatedGravatar.save()
|
|
21
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
specVersion: 0.0.5
|
|
2
|
-
description: Gravatar for Ethereum
|
|
3
|
-
repository: https://github.com/graphprotocol/example-subgraph
|
|
4
|
-
schema:
|
|
5
|
-
file: ./schema.graphql
|
|
6
|
-
dataSources:
|
|
7
|
-
- kind: ethereum/contract
|
|
8
|
-
name: Gravity
|
|
9
|
-
network: test
|
|
10
|
-
source:
|
|
11
|
-
address: '0xCfEB869F69431e42cdB54A4F4f105C19C080A601'
|
|
12
|
-
abi: Gravity
|
|
13
|
-
mapping:
|
|
14
|
-
kind: ethereum/events
|
|
15
|
-
apiVersion: 0.0.7
|
|
16
|
-
language: wasm/assemblyscript
|
|
17
|
-
entities:
|
|
18
|
-
- Gravatar
|
|
19
|
-
abis:
|
|
20
|
-
- name: Gravity
|
|
21
|
-
file: ./abis/Gravity.json
|
|
22
|
-
eventHandlers:
|
|
23
|
-
- event: NewGravatar(uint256,address,string,string)
|
|
24
|
-
handler: handleNewGravatar
|
|
25
|
-
- event: UpdatedGravatar(uint256,address,string,string)
|
|
26
|
-
handler: handleUpdatedGravatar
|
|
27
|
-
file: ./src/mapping.ts
|