@graphprotocol/graph-cli 0.64.1-alpha-20231219035922-3e45e5d → 0.64.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
- ## 0.64.1-alpha-20231219035922-3e45e5d
3
+ ## 0.64.1
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -1,11 +1,36 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
5
28
  Object.defineProperty(exports, "__esModule", { value: true });
6
29
  const path_1 = __importDefault(require("path"));
7
30
  const fs_extra_1 = __importDefault(require("fs-extra"));
31
+ const immutable_1 = __importDefault(require("immutable"));
8
32
  const vitest_1 = require("vitest");
33
+ const ts = __importStar(require("../../../codegen/typescript"));
9
34
  const abi_1 = __importDefault(require("../abi"));
10
35
  const abi_2 = __importDefault(require("./abi"));
11
36
  let tempdir;
@@ -175,7 +200,14 @@ vitest_1.describe.concurrent('ABI code generation', () => {
175
200
  });
176
201
  (0, vitest_1.describe)('Generated types', () => {
177
202
  (0, vitest_1.test)('All expected types are generated', () => {
178
- (0, vitest_1.expect)(generatedTypes.map(type => type.name)).toMatchSnapshot();
203
+ (0, vitest_1.expect)(generatedTypes.map(type => type.name)).toEqual([
204
+ 'Contract__getProposalResultValue0Struct',
205
+ 'Contract__getProposalInputParam1Struct',
206
+ 'Contract__getProposalInputParam1BarStruct',
207
+ 'Contract__getProposalsResultValue1Struct',
208
+ 'Contract__getProposalsResult',
209
+ 'Contract',
210
+ ]);
179
211
  });
180
212
  });
181
213
  (0, vitest_1.describe)('Contract class', () => {
@@ -198,11 +230,51 @@ vitest_1.describe.concurrent('ABI code generation', () => {
198
230
  (0, vitest_1.describe)('Methods for callable functions', () => {
199
231
  (0, vitest_1.test)('Have correct parameters', () => {
200
232
  const contract = generatedTypes.find(type => type.name === 'Contract');
201
- (0, vitest_1.expect)(contract.methods.map((method) => [method.name, method.params])).toMatchSnapshot();
233
+ (0, vitest_1.expect)(contract.methods.map((method) => [method.name, method.params])).toEqual([
234
+ ['bind', immutable_1.default.List([ts.param('address', 'Address')])],
235
+ ['read', immutable_1.default.List()],
236
+ ['try_read', immutable_1.default.List()],
237
+ [
238
+ 'getProposal',
239
+ immutable_1.default.List([
240
+ ts.param('proposalId', 'BigInt'),
241
+ ts.param('param1', 'Contract__getProposalInputParam1Struct'),
242
+ ]),
243
+ ],
244
+ [
245
+ 'try_getProposal',
246
+ immutable_1.default.List([
247
+ ts.param('proposalId', 'BigInt'),
248
+ ts.param('param1', 'Contract__getProposalInputParam1Struct'),
249
+ ]),
250
+ ],
251
+ ['getProposals', immutable_1.default.List()],
252
+ ['try_getProposals', immutable_1.default.List()],
253
+ ['overloaded', immutable_1.default.List([ts.param('param0', 'string')])],
254
+ ['try_overloaded', immutable_1.default.List([ts.param('param0', 'string')])],
255
+ ['overloaded1', immutable_1.default.List([ts.param('param0', 'BigInt')])],
256
+ ['try_overloaded1', immutable_1.default.List([ts.param('param0', 'BigInt')])],
257
+ ['overloaded2', immutable_1.default.List([ts.param('param0', 'Bytes')])],
258
+ ['try_overloaded2', immutable_1.default.List([ts.param('param0', 'Bytes')])],
259
+ ]);
202
260
  });
203
261
  (0, vitest_1.test)('Have correct return types', () => {
204
262
  const contract = generatedTypes.find(type => type.name === 'Contract');
205
- (0, vitest_1.expect)(contract.methods.map((method) => [method.name, method.returnType])).toMatchSnapshot();
263
+ (0, vitest_1.expect)(contract.methods.map((method) => [method.name, method.returnType])).toEqual([
264
+ ['bind', ts.namedType('Contract')],
265
+ ['read', ts.namedType('Bytes')],
266
+ ['try_read', 'ethereum.CallResult<Bytes>'],
267
+ ['getProposal', ts.namedType('Contract__getProposalResultValue0Struct')],
268
+ ['try_getProposal', 'ethereum.CallResult<Contract__getProposalResultValue0Struct>'],
269
+ ['getProposals', ts.namedType('Contract__getProposalsResult')],
270
+ ['try_getProposals', 'ethereum.CallResult<Contract__getProposalsResult>'],
271
+ ['overloaded', ts.namedType('string')],
272
+ ['try_overloaded', 'ethereum.CallResult<string>'],
273
+ ['overloaded1', ts.namedType('string')],
274
+ ['try_overloaded1', 'ethereum.CallResult<string>'],
275
+ ['overloaded2', ts.namedType('string')],
276
+ ['try_overloaded2', 'ethereum.CallResult<string>'],
277
+ ]);
206
278
  });
207
279
  });
208
280
  (0, vitest_1.describe)('Tuples', () => {
@@ -212,14 +284,19 @@ vitest_1.describe.concurrent('ABI code generation', () => {
212
284
  (0, vitest_1.expect)(tupleType.methods).toBeDefined();
213
285
  // Verify that the tuple type has getters for all tuple fields with
214
286
  // the right return types
215
- (0, vitest_1.expect)(tupleType.methods.map((method) => [method.name, method.returnType])).toMatchSnapshot();
287
+ (0, vitest_1.expect)(tupleType.methods.map((method) => [method.name, method.returnType])).toEqual([
288
+ ['get foo', 'i32'],
289
+ ['get bar', 'Contract__getProposalInputParam1BarStruct'],
290
+ ]);
216
291
  // Inner tuple:
217
292
  tupleType = generatedTypes.find(type => type.name === 'Contract__getProposalInputParam1BarStruct');
218
293
  // Verify that the tuple type has methods
219
294
  (0, vitest_1.expect)(tupleType.methods).toBeDefined();
220
295
  // Verify that the tuple type has getters for all tuple fields with
221
296
  // the right return types
222
- (0, vitest_1.expect)(tupleType.methods.map((method) => [method.name, method.returnType])).toMatchSnapshot();
297
+ (0, vitest_1.expect)(tupleType.methods.map((method) => [method.name, method.returnType])).toEqual([
298
+ ['get baz', 'Address'],
299
+ ]);
223
300
  });
224
301
  (0, vitest_1.test)('Tuple types exist for function return values', () => {
225
302
  const tupleType = generatedTypes.find(type => type.name === 'Contract__getProposalResultValue0Struct');
@@ -227,7 +304,17 @@ vitest_1.describe.concurrent('ABI code generation', () => {
227
304
  (0, vitest_1.expect)(tupleType.methods).toBeDefined();
228
305
  // Verify that the tuple type has getters for all tuple fields with
229
306
  // the right return types
230
- (0, vitest_1.expect)(tupleType.methods.map((method) => [method.name, method.returnType])).toMatchSnapshot();
307
+ (0, vitest_1.expect)(tupleType.methods.map((method) => [method.name, method.returnType])).toEqual([
308
+ ['get result', 'i32'],
309
+ ['get target', 'Address'],
310
+ ['get data', 'Bytes'],
311
+ ['get proposer', 'Address'],
312
+ ['get feeRecipient', 'Address'],
313
+ ['get fee', 'BigInt'],
314
+ ['get startTime', 'BigInt'],
315
+ ['get yesCount', 'BigInt'],
316
+ ['get noCount', 'BigInt'],
317
+ ]);
231
318
  });
232
319
  (0, vitest_1.test)('Function bodies are generated correctly for tuple arrays', () => {
233
320
  const contract = generatedTypes.find(type => type.name === 'Contract');
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.64.1-alpha-20231219035922-3e45e5d",
2
+ "version": "0.64.1",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.64.1-alpha-20231219035922-3e45e5d",
3
+ "version": "0.64.1",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {