From aa98d91c7a4a054f32b0dade0d2a86265d4da707 Mon Sep 17 00:00:00 2001 From: Shredder <110225819+EmperorOrokuSaki@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:37:25 +0330 Subject: [PATCH] style: fix eslint errors for subgraph (#218) * style: fix eslint errors. * fix: remove yarn-error.log from serverless dir. --- subgraph/src/access-control.ts | 160 ++++++++---------- subgraph/src/access-point.ts | 21 +-- subgraph/src/approval.ts | 51 +++--- subgraph/src/contract.ts | 39 ++--- subgraph/src/fleek-nfa.ts | 2 +- subgraph/src/metadata-update.ts | 16 +- subgraph/src/mint.ts | 35 ++-- subgraph/src/transfer.ts | 4 +- ...ange-access-point-creation-status.test.ts} | 7 +- ...> change-access-point-name-verify.test.ts} | 4 +- subgraph/tests/matchstick/helpers/utils.ts | 52 +++--- subgraph/tests/matchstick/owner.test.ts | 6 +- subgraph/tests/matchstick/transfer.test.ts | 6 +- 13 files changed, 184 insertions(+), 219 deletions(-) rename subgraph/tests/matchstick/access-points/{changeAccessPointCreationStatus.test.ts => change-access-point-creation-status.test.ts} (93%) rename subgraph/tests/matchstick/access-points/{changeAccessPointNameVerify.test.ts => change-access-point-name-verify.test.ts} (95%) diff --git a/subgraph/src/access-control.ts b/subgraph/src/access-control.ts index b3a80f5..d482072 100644 --- a/subgraph/src/access-control.ts +++ b/subgraph/src/access-control.ts @@ -1,110 +1,100 @@ -import { - Address, - Bytes, - log, - store, - ethereum, - BigInt, -} from '@graphprotocol/graph-ts'; +import { Bytes, log } from '@graphprotocol/graph-ts'; // Event Imports [based on the yaml config] import { - TokenRoleChanged as TokenRoleChangedEvent, - CollectionRoleChanged as CollectionRoleChangedEvent, + TokenRoleChanged as TokenRoleChangedEvent, + CollectionRoleChanged as CollectionRoleChangedEvent, } from '../generated/FleekNFA/FleekNFA'; // Entity Imports [based on the schema] -import { - Owner, - Token, -} from '../generated/schema'; +import { Owner, Token } from '../generated/schema'; enum CollectionRoles { - Owner, + Owner, } enum TokenRoles { - Controller, + Controller, } export function handleCollectionRoleChanged( - event: CollectionRoleChangedEvent + event: CollectionRoleChangedEvent ): void { - let toAddress = event.params.toAddress; - let byAddress = event.params.byAddress; - let role = event.params.role; - let status = event.params.status; + const toAddress = event.params.toAddress; + const byAddress = event.params.byAddress; + const role = event.params.role; + const status = event.params.status; - if (role === CollectionRoles.Owner) { - // Owner role - if (status) { - // granted - let owner = Owner.load(toAddress); - if (!owner) { - owner = new Owner(toAddress); - } - owner.collection = true; - owner.save(); - } else { - // revoked - let owner = Owner.load(toAddress); - if (!owner) { - log.error( - 'Owner entity not found. Role: {}, byAddress: {}, toAddress: {}', - [role.toString(), byAddress.toHexString(), toAddress.toHexString()] - ); - return; - } - owner.collection = false; - owner.save(); - } + if (role === CollectionRoles.Owner) { + // Owner role + if (status) { + // granted + let owner = Owner.load(toAddress); + if (!owner) { + owner = new Owner(toAddress); + } + owner.collection = true; + owner.save(); } else { - log.error('Role not supported. Role: {}, byAddress: {}, toAddress: {}', [ - role.toString(), - byAddress.toHexString(), - toAddress.toHexString(), - ]); + // revoked + const owner = Owner.load(toAddress); + if (!owner) { + log.error( + 'Owner entity not found. Role: {}, byAddress: {}, toAddress: {}', + [role.toString(), byAddress.toHexString(), toAddress.toHexString()] + ); + return; + } + owner.collection = false; + owner.save(); } + } else { + log.error('Role not supported. Role: {}, byAddress: {}, toAddress: {}', [ + role.toString(), + byAddress.toHexString(), + toAddress.toHexString(), + ]); + } } export function handleTokenRoleChanged(event: TokenRoleChangedEvent): void { - let tokenId = event.params.tokenId; - let toAddress = event.params.toAddress; - let byAddress = event.params.byAddress; - let role = event.params.role; - let status = event.params.status; + const tokenId = event.params.tokenId; + const toAddress = event.params.toAddress; + const byAddress = event.params.byAddress; + const role = event.params.role; + const status = event.params.status; - // load token - let token = Token.load(Bytes.fromByteArray(Bytes.fromBigInt(tokenId))); - if (!token) { - log.error('Token not found. TokenId: {}', [tokenId.toString()]); - return; + // load token + const token = Token.load(Bytes.fromByteArray(Bytes.fromBigInt(tokenId))); + if (!token) { + log.error('Token not found. TokenId: {}', [tokenId.toString()]); + return; + } + + if (role === TokenRoles.Controller) { + // Controller role + // get the list of controllers. + let token_controllers = token.controllers; + if (!token_controllers) { + token_controllers = []; } - - if (role === TokenRoles.Controller) { - // Controller role - // get the list of controllers. - let token_controllers = token.controllers; - if (!token_controllers) { - token_controllers = []; - } - if (status) { - // granted - token_controllers.push(toAddress); - } else { - // revoked - // remove address from the controllers list - const index = token_controllers.indexOf(event.params.toAddress, 0); - if (index > -1) { - token_controllers.splice(index, 1); - } - } - token.controllers = token_controllers; + if (status) { + // granted + token_controllers.push(toAddress); } else { - log.error('Role not supported. Role: {}, byAddress: {}, toAddress: {}', [ - role.toString(), - byAddress.toHexString(), - toAddress.toHexString(), - ]); + // revoked + // remove address from the controllers list + const index = token_controllers.indexOf(event.params.toAddress, 0); + if (index > -1) { + token_controllers.splice(index, 1); + } } -} \ No newline at end of file + token.controllers = token_controllers; + } else { + log.error('Role not supported. Role: {}, byAddress: {}, toAddress: {}', [ + role.toString(), + byAddress.toHexString(), + toAddress.toHexString(), + ]); + } +} diff --git a/subgraph/src/access-point.ts b/subgraph/src/access-point.ts index bda9ba1..f3f074b 100644 --- a/subgraph/src/access-point.ts +++ b/subgraph/src/access-point.ts @@ -1,11 +1,4 @@ -import { - Address, - Bytes, - log, - store, - ethereum, - BigInt, -} from '@graphprotocol/graph-ts'; +import { Bytes, log, BigInt } from '@graphprotocol/graph-ts'; // Event Imports [based on the yaml config] import { @@ -27,7 +20,7 @@ import { AccessPoint, Owner } from '../generated/schema'; */ export function handleNewAccessPoint(event: NewAccessPointEvent): void { // Create an AccessPoint entity - let accessPointEntity = new AccessPoint(event.params.apName); + const accessPointEntity = new AccessPoint(event.params.apName); accessPointEntity.score = BigInt.fromU32(0); accessPointEntity.contentVerified = false; accessPointEntity.nameVerified = false; @@ -59,8 +52,8 @@ export function handleChangeAccessPointCreationStatus( event: ChangeAccessPointCreationStatusEvent ): void { // Load the AccessPoint entity - let accessPointEntity = AccessPoint.load(event.params.apName); - let status = event.params.status; + const accessPointEntity = AccessPoint.load(event.params.apName); + const status = event.params.status; if (accessPointEntity) { switch (status) { @@ -101,7 +94,7 @@ export function handleChangeAccessPointScore( event: ChangeAccessPointCreationScoreEvent ): void { // Load the AccessPoint entity - let accessPointEntity = AccessPoint.load(event.params.apName); + const accessPointEntity = AccessPoint.load(event.params.apName); if (accessPointEntity) { accessPointEntity.score = event.params.score; @@ -122,7 +115,7 @@ export function handleChangeAccessPointNameVerify( event: ChangeAccessPointNameVerifyEvent ): void { // Load the AccessPoint entity - let accessPointEntity = AccessPoint.load(event.params.apName); + const accessPointEntity = AccessPoint.load(event.params.apName); if (accessPointEntity) { accessPointEntity.nameVerified = event.params.verified; @@ -143,7 +136,7 @@ export function handleChangeAccessPointContentVerify( event: ChangeAccessPointContentVerifyEvent ): void { // Load the AccessPoint entity - let accessPointEntity = AccessPoint.load(event.params.apName); + const accessPointEntity = AccessPoint.load(event.params.apName); if (accessPointEntity) { accessPointEntity.contentVerified = event.params.verified; diff --git a/subgraph/src/approval.ts b/subgraph/src/approval.ts index 82cf72c..b6648a2 100644 --- a/subgraph/src/approval.ts +++ b/subgraph/src/approval.ts @@ -1,41 +1,38 @@ // Event Imports [based on the yaml config] import { - Approval as ApprovalEvent, - ApprovalForAll as ApprovalForAllEvent, + Approval as ApprovalEvent, + ApprovalForAll as ApprovalForAllEvent, } from '../generated/FleekNFA/FleekNFA'; // Entity Imports [based on the schema] -import { - Approval, - ApprovalForAll, -} from '../generated/schema'; +import { Approval, ApprovalForAll } from '../generated/schema'; export function handleApproval(event: ApprovalEvent): void { - let entity = new Approval( - event.transaction.hash.concatI32(event.logIndex.toI32()) - ); - entity.owner = event.params.owner; - entity.approved = event.params.approved; - entity.tokenId = event.params.tokenId; + const entity = new Approval( + event.transaction.hash.concatI32(event.logIndex.toI32()) + ); + entity.owner = event.params.owner; + entity.approved = event.params.approved; + entity.tokenId = event.params.tokenId; - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; - entity.transactionHash = event.transaction.hash; + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; - entity.save(); + entity.save(); } export function handleApprovalForAll(event: ApprovalForAllEvent): void { - let entity = new ApprovalForAll( - event.transaction.hash.concatI32(event.logIndex.toI32()) - ); - entity.owner = event.params.owner; - entity.operator = event.params.operator; - entity.approved = event.params.approved; + const entity = new ApprovalForAll( + event.transaction.hash.concatI32(event.logIndex.toI32()) + ); + entity.owner = event.params.owner; + entity.operator = event.params.operator; + entity.approved = event.params.approved; - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; - entity.transactionHash = event.transaction.hash; + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; - entity.save(); -} \ No newline at end of file + entity.save(); +} diff --git a/subgraph/src/contract.ts b/subgraph/src/contract.ts index 944bbdf..1b6d918 100644 --- a/subgraph/src/contract.ts +++ b/subgraph/src/contract.ts @@ -1,29 +1,22 @@ -import { - log, - ethereum, -} from '@graphprotocol/graph-ts'; +import { log, ethereum } from '@graphprotocol/graph-ts'; // Event Imports [based on the yaml config] -import { - Initialized as InitializedEvent, -} from '../generated/FleekNFA/FleekNFA'; +import { Initialized as InitializedEvent } from '../generated/FleekNFA/FleekNFA'; // Entity Imports [based on the schema] -import { - Owner, -} from '../generated/schema'; +import { Owner } from '../generated/schema'; export function handleInitialized(event: InitializedEvent): void { - // This is the contract creation transaction. - log.warning('This is the contract creation transaction.', []); - if (event.receipt) { - let receipt = event.receipt as ethereum.TransactionReceipt; - log.warning('Contract address is: {}', [ - receipt.contractAddress.toHexString(), - ]); + // This is the contract creation transaction. + log.warning('This is the contract creation transaction.', []); + if (event.receipt) { + const receipt = event.receipt as ethereum.TransactionReceipt; + log.warning('Contract address is: {}', [ + receipt.contractAddress.toHexString(), + ]); - // add owner - let owner = new Owner(event.transaction.from); - owner.collection = true; - owner.save(); - } -} \ No newline at end of file + // add owner + const owner = new Owner(event.transaction.from); + owner.collection = true; + owner.save(); + } +} diff --git a/subgraph/src/fleek-nfa.ts b/subgraph/src/fleek-nfa.ts index 27863d5..f4f2c55 100644 --- a/subgraph/src/fleek-nfa.ts +++ b/subgraph/src/fleek-nfa.ts @@ -1,5 +1,5 @@ export * from './access-control'; -export * from './access-point'; +export * from './access-point'; export * from './approval'; export * from './contract'; export * from './metadata-update'; diff --git a/subgraph/src/metadata-update.ts b/subgraph/src/metadata-update.ts index 5ab2b5b..449e2c1 100644 --- a/subgraph/src/metadata-update.ts +++ b/subgraph/src/metadata-update.ts @@ -27,7 +27,7 @@ export function handleMetadataUpdateWithStringValue( * setTokenDescription * setTokenLogo * */ - let entity = new MetadataUpdate( + const entity = new MetadataUpdate( event.transaction.hash.concatI32(event.logIndex.toI32()) ); @@ -41,7 +41,7 @@ export function handleMetadataUpdateWithStringValue( entity.save(); // UPDATE TOKEN - let token = Token.load( + const token = Token.load( Bytes.fromByteArray(Bytes.fromBigInt(event.params._tokenId)) ); @@ -68,7 +68,7 @@ export function handleMetadataUpdateWithDoubleStringValue( /** * setTokenBuild */ - let entity = new MetadataUpdate( + const entity = new MetadataUpdate( event.transaction.hash.concatI32(event.logIndex.toI32()) ); @@ -82,7 +82,7 @@ export function handleMetadataUpdateWithDoubleStringValue( entity.save(); // UPDATE TOKEN - let token = Token.load( + const token = Token.load( Bytes.fromByteArray(Bytes.fromBigInt(event.params._tokenId)) ); @@ -107,7 +107,7 @@ export function handleMetadataUpdateWithIntValue( /** * setTokenColor */ - let entity = new MetadataUpdate( + const entity = new MetadataUpdate( event.transaction.hash.concatI32(event.logIndex.toI32()) ); @@ -120,7 +120,7 @@ export function handleMetadataUpdateWithIntValue( entity.save(); - let token = Token.load( + const token = Token.load( Bytes.fromByteArray(Bytes.fromBigInt(event.params._tokenId)) ); @@ -138,7 +138,7 @@ export function handleMetadataUpdateWithBooleanValue( /** * accessPointAutoApproval */ - let entity = new MetadataUpdate( + const entity = new MetadataUpdate( event.transaction.hash.concatI32(event.logIndex.toI32()) ); @@ -151,7 +151,7 @@ export function handleMetadataUpdateWithBooleanValue( entity.save(); - let token = Token.load( + const token = Token.load( Bytes.fromByteArray(Bytes.fromBigInt(event.params._tokenId)) ); diff --git a/subgraph/src/mint.ts b/subgraph/src/mint.ts index df4d20c..a0b24d1 100644 --- a/subgraph/src/mint.ts +++ b/subgraph/src/mint.ts @@ -4,30 +4,25 @@ import { Bytes, log } from '@graphprotocol/graph-ts'; import { NewMint as NewMintEvent } from '../generated/FleekNFA/FleekNFA'; // Entity Imports [based on the schema] -import { - Owner, - GitRepository as GitRepositoryEntity, - NewMint, - Token, -} from '../generated/schema'; +import { Owner, NewMint, Token } from '../generated/schema'; export function handleNewMint(event: NewMintEvent): void { - let newMintEntity = new NewMint( + const newMintEntity = new NewMint( event.transaction.hash.concatI32(event.logIndex.toI32()) ); - let name = event.params.name; - let description = event.params.description; - let externalURL = event.params.externalURL; - let ENS = event.params.ENS; - let gitRepository = event.params.gitRepository; - let commitHash = event.params.commitHash; - let logo = event.params.logo; - let color = event.params.color; - let accessPointAutoApproval = event.params.accessPointAutoApproval; - let tokenId = event.params.tokenId; - let ownerAddress = event.params.owner; - let verifierAddress = event.params.verifier; + const name = event.params.name; + const description = event.params.description; + const externalURL = event.params.externalURL; + const ENS = event.params.ENS; + const gitRepository = event.params.gitRepository; + const commitHash = event.params.commitHash; + const logo = event.params.logo; + const color = event.params.color; + const accessPointAutoApproval = event.params.accessPointAutoApproval; + const tokenId = event.params.tokenId; + const ownerAddress = event.params.owner; + const verifierAddress = event.params.verifier; newMintEntity.tokenId = tokenId; newMintEntity.name = name; @@ -51,7 +46,7 @@ export function handleNewMint(event: NewMintEvent): void { // Create Token, Owner, and Controller entities let owner = Owner.load(ownerAddress); - let token = new Token(Bytes.fromByteArray(Bytes.fromBigInt(tokenId))); + const token = new Token(Bytes.fromByteArray(Bytes.fromBigInt(tokenId))); if (!owner) { // Create a new owner entity diff --git a/subgraph/src/transfer.ts b/subgraph/src/transfer.ts index dcd1869..ec49ba8 100644 --- a/subgraph/src/transfer.ts +++ b/subgraph/src/transfer.ts @@ -7,7 +7,7 @@ import { Transfer as TransferEvent } from '../generated/FleekNFA/FleekNFA'; import { Owner, Token, Transfer } from '../generated/schema'; export function handleTransfer(event: TransferEvent): void { - let transfer = new Transfer( + const transfer = new Transfer( event.transaction.hash.concatI32(event.logIndex.toI32()) ); @@ -25,7 +25,7 @@ export function handleTransfer(event: TransferEvent): void { let token: Token | null; - let owner_address = event.params.to; + const owner_address = event.params.to; let owner = Owner.load(owner_address); if (!owner) { diff --git a/subgraph/tests/matchstick/access-points/changeAccessPointCreationStatus.test.ts b/subgraph/tests/matchstick/access-points/change-access-point-creation-status.test.ts similarity index 93% rename from subgraph/tests/matchstick/access-points/changeAccessPointCreationStatus.test.ts rename to subgraph/tests/matchstick/access-points/change-access-point-creation-status.test.ts index 777fb60..cb5854d 100644 --- a/subgraph/tests/matchstick/access-points/changeAccessPointCreationStatus.test.ts +++ b/subgraph/tests/matchstick/access-points/change-access-point-creation-status.test.ts @@ -6,13 +6,12 @@ import { beforeAll, afterAll, } from 'matchstick-as/assembly/index'; -import { BigInt, Bytes } from '@graphprotocol/graph-ts'; +import { BigInt } from '@graphprotocol/graph-ts'; import { createNewAccessPointEvent, createNewChangeAccessPointCreationStatus, handleChangeAccessPointCreationStatusList, handleNewAccessPoints, - makeEventId, USER_ONE, USER_TWO, } from '../helpers/utils'; @@ -24,7 +23,7 @@ import { describe('Change Access Point Creation Status tests', () => { beforeAll(() => { // New Access Points - let newAccessPoints: NewAccessPoint[] = []; + const newAccessPoints: NewAccessPoint[] = []; // User One has two access points: one for tokenId 0 and one for tokenId 1 newAccessPoints.push( @@ -54,7 +53,7 @@ describe('Change Access Point Creation Status tests', () => { test('Check the `creationStatus` field of each access point entity after changing it', () => { // New Access Points - let changeAccessPointCreationStatusList: ChangeAccessPointCreationStatus[] = + const changeAccessPointCreationStatusList: ChangeAccessPointCreationStatus[] = []; // User One has two access points: one for tokenId 0 and one for tokenId 1 diff --git a/subgraph/tests/matchstick/access-points/changeAccessPointNameVerify.test.ts b/subgraph/tests/matchstick/access-points/change-access-point-name-verify.test.ts similarity index 95% rename from subgraph/tests/matchstick/access-points/changeAccessPointNameVerify.test.ts rename to subgraph/tests/matchstick/access-points/change-access-point-name-verify.test.ts index 87355c1..b5b255b 100644 --- a/subgraph/tests/matchstick/access-points/changeAccessPointNameVerify.test.ts +++ b/subgraph/tests/matchstick/access-points/change-access-point-name-verify.test.ts @@ -23,7 +23,7 @@ import { describe('Change Access Point Name Verify tests', () => { beforeAll(() => { // New Access Points - let newAccessPoints: NewAccessPoint[] = []; + const newAccessPoints: NewAccessPoint[] = []; // User One has two access points: one for tokenId 0 and one for tokenId 1 newAccessPoints.push( @@ -53,7 +53,7 @@ describe('Change Access Point Name Verify tests', () => { test('Check the `nameVerified` field of each access point entity after changing it', () => { // New Access Point Name Verified fields - let changeAccessPointNameVerifies: ChangeAccessPointNameVerify[] = []; + const changeAccessPointNameVerifies: ChangeAccessPointNameVerify[] = []; changeAccessPointNameVerifies.push( createNewChangeAccessPointNameVerify( diff --git a/subgraph/tests/matchstick/helpers/utils.ts b/subgraph/tests/matchstick/helpers/utils.ts index 0388d41..804163a 100644 --- a/subgraph/tests/matchstick/helpers/utils.ts +++ b/subgraph/tests/matchstick/helpers/utils.ts @@ -27,11 +27,11 @@ export function createApprovalEvent( event_count: i32, owner: Address, approved: Address, - tokenId: BigInt + tokenId: bigint ): ApprovalEvent { - let approvalEvent = changetype(newMockEvent()); + const approvalEvent = changetype(newMockEvent()); - approvalEvent.parameters = new Array(); + approvalEvent.parameters = []; approvalEvent.parameters.push( new ethereum.EventParam('owner', ethereum.Value.fromAddress(owner)) @@ -58,9 +58,9 @@ export function createApprovalForAllEvent( operator: Address, approved: boolean ): ApprovalForAllEvent { - let approvalForAllEvent = changetype(newMockEvent()); + const approvalForAllEvent = changetype(newMockEvent()); - approvalForAllEvent.parameters = new Array(); + approvalForAllEvent.parameters = []; approvalForAllEvent.parameters.push( new ethereum.EventParam('owner', ethereum.Value.fromAddress(owner)) @@ -82,11 +82,11 @@ export function createTransferEvent( event_count: i32, from: Address, to: Address, - tokenId: BigInt + tokenId: bigint ): TransferEvent { - let transferEvent = changetype(newMockEvent()); + const transferEvent = changetype(newMockEvent()); - transferEvent.parameters = new Array(); + transferEvent.parameters = []; transferEvent.parameters.push( new ethereum.EventParam('from', ethereum.Value.fromAddress(from)) @@ -110,11 +110,11 @@ export function createTransferEvent( export function createNewMintEvent( event_count: i32, to: Address, - tokenId: BigInt + tokenId: bigint ): NewMintEvent { - let newMintEvent = changetype(newMockEvent()); + const newMintEvent = changetype(newMockEvent()); - newMintEvent.parameters = new Array(); + newMintEvent.parameters = []; newMintEvent.parameters.push( new ethereum.EventParam( @@ -177,12 +177,12 @@ export function createNewMintEvent( export function createNewAccessPointEvent( event_count: i32, apName: string, - tokenId: BigInt, + tokenId: bigint, owner: Address ): NewAccessPoint { - let newAccessPoint = changetype(newMockEvent()); + const newAccessPoint = changetype(newMockEvent()); - newAccessPoint.parameters = new Array(); + newAccessPoint.parameters = []; newAccessPoint.parameters.push( new ethereum.EventParam( @@ -211,14 +211,14 @@ export function createNewAccessPointEvent( export function createNewChangeAccessPointCreationStatus( event_count: i32, apName: string, - tokenId: BigInt, + tokenId: bigint, status: i32, triggeredBy: Address ): ChangeAccessPointCreationStatus { - let changeAccessPointCreationStatus = + const changeAccessPointCreationStatus = changetype(newMockEvent()); - changeAccessPointCreationStatus.parameters = new Array(); + changeAccessPointCreationStatus.parameters = []; changeAccessPointCreationStatus.parameters.push( new ethereum.EventParam( @@ -254,15 +254,15 @@ export function createNewChangeAccessPointCreationStatus( export function createNewChangeAccessPointNameVerify( event_count: i32, apName: string, - tokenId: BigInt, + tokenId: bigint, verified: boolean, triggeredBy: Address ): ChangeAccessPointNameVerify { - let changeAccessPointNameVerify = changetype( + const changeAccessPointNameVerify = changetype( newMockEvent() ); - changeAccessPointNameVerify.parameters = new Array(); + changeAccessPointNameVerify.parameters = []; changeAccessPointNameVerify.parameters.push( new ethereum.EventParam( @@ -297,15 +297,15 @@ export function createNewChangeAccessPointNameVerify( export function createNewTokenRoleChanged( event_count: i32, - tokenId: BigInt, + tokenId: bigint, role: i32, toAddress: Address, status: boolean, byAddress: Address ): TokenRoleChanged { - let tokenRoleChanged = changetype(newMockEvent()); + const tokenRoleChanged = changetype(newMockEvent()); - tokenRoleChanged.parameters = new Array(); + tokenRoleChanged.parameters = []; tokenRoleChanged.parameters.push( new ethereum.EventParam( @@ -343,9 +343,11 @@ export function createNewCollectionRoleChanged( status: boolean, byAddress: Address ): CollectionRoleChanged { - let collectionRoleChanged = changetype(newMockEvent()); + const collectionRoleChanged = changetype( + newMockEvent() + ); - collectionRoleChanged.parameters = new Array(); + collectionRoleChanged.parameters = []; collectionRoleChanged.parameters.push( new ethereum.EventParam('role', ethereum.Value.fromI32(role)) diff --git a/subgraph/tests/matchstick/owner.test.ts b/subgraph/tests/matchstick/owner.test.ts index 089c317..6fa1d63 100644 --- a/subgraph/tests/matchstick/owner.test.ts +++ b/subgraph/tests/matchstick/owner.test.ts @@ -5,8 +5,6 @@ import { clearStore, beforeAll, afterAll, - logStore, - log, } from 'matchstick-as/assembly/index'; import { BigInt } from '@graphprotocol/graph-ts'; import { @@ -24,7 +22,7 @@ import { NewMint, Transfer } from '../../generated/FleekNFA/FleekNFA'; describe('Owner tests', () => { beforeAll(() => { // NEW MINTS - let newMints: NewMint[] = []; + const newMints: NewMint[] = []; newMints.push(createNewMintEvent(0, USER_ONE, BigInt.fromI32(0))); newMints.push(createNewMintEvent(1, USER_TWO, BigInt.fromI32(1))); newMints.push(createNewMintEvent(2, USER_ONE, BigInt.fromI32(2))); @@ -32,7 +30,7 @@ describe('Owner tests', () => { newMints.push(createNewMintEvent(4, USER_TWO, BigInt.fromI32(4))); handleNewMints(newMints); // TRANSFERS - let transfers: Transfer[] = []; + const transfers: Transfer[] = []; transfers.push( createTransferEvent(0, CONTRACT, USER_ONE, BigInt.fromI32(0)) ); diff --git a/subgraph/tests/matchstick/transfer.test.ts b/subgraph/tests/matchstick/transfer.test.ts index 7945226..36cb5bc 100644 --- a/subgraph/tests/matchstick/transfer.test.ts +++ b/subgraph/tests/matchstick/transfer.test.ts @@ -5,10 +5,8 @@ import { clearStore, beforeAll, afterAll, - logStore, - log, } from 'matchstick-as/assembly/index'; -import { BigInt, Bytes } from '@graphprotocol/graph-ts'; +import { BigInt } from '@graphprotocol/graph-ts'; import { CONTRACT, createTransferEvent, @@ -22,7 +20,7 @@ import { Transfer } from '../../generated/FleekNFA/FleekNFA'; describe('Transfer tests', () => { beforeAll(() => { // TRANSFERS - let transfers: Transfer[] = []; + const transfers: Transfer[] = []; transfers.push( createTransferEvent(0, CONTRACT, USER_ONE, BigInt.fromI32(0)) );