Skip to content

Commit

Permalink
Version 1.0.1 (Integration with Front-end changes) (#8)
Browse files Browse the repository at this point in the history
* updating polkadot api

* Updating polkadot api version (#7)

* change skipped test (#2)

* fixes

* fix documentation

* fix images folder

Co-authored-by: Fernando Sirni <fsirni@gmail.com>

* [Snyk] Security upgrade node from 16.15-alpine to 16.16.0-alpine (#4)

fix: Dockerfile to reduce vulnerabilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-UPSTREAM-NODE-2946427
- https://snyk.io/vuln/SNYK-UPSTREAM-NODE-2946428
- https://snyk.io/vuln/SNYK-UPSTREAM-NODE-2946723
- https://snyk.io/vuln/SNYK-UPSTREAM-NODE-2946727
- https://snyk.io/vuln/SNYK-UPSTREAM-NODE-2946729

* [Snyk] Security upgrade node from 16.15-alpine to 16.16.0-alpine (#3)

fix: dev.Dockerfile to reduce vulnerabilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-UPSTREAM-NODE-2946427
- https://snyk.io/vuln/SNYK-UPSTREAM-NODE-2946428
- https://snyk.io/vuln/SNYK-UPSTREAM-NODE-2946723
- https://snyk.io/vuln/SNYK-UPSTREAM-NODE-2946727
- https://snyk.io/vuln/SNYK-UPSTREAM-NODE-2946729

* Update docs (#5)

* Update docs

* Update spanish docs

* Update CHANGELOG.md

* Review/env fix (#6)

* README.md fix

* env.sample fix

* updating polkadot api

* adding timestamp

Co-authored-by: José <jarcodallo@gmail.com>
Co-authored-by: Ruben Gutierrez <45153592+RubenGutierrezC@users.noreply.github.com>
Co-authored-by: Snyk bot <github+bot@snyk.io>

* lint

* dockerfile

* query blocks with order

* adding transaction data

* adding block data and transactions queries

* rename resolver function

* rename resolver function

* schema

* events order asc

* get event resolver

* decode resolvers

* version resolvers

* contract queries resolver added

* execute queries resolver

* execute queries resolver

* get contracts resolver

* decode events to mutiation

* decode events result

* events check for existing

* fix tests

* increasing coverage

* test getContractQueries

* add warn case to mock pino looger

* tests coverage

* lint

* README

Co-authored-by: José <jarcodallo@gmail.com>
Co-authored-by: Ruben Gutierrez <45153592+RubenGutierrezC@users.noreply.github.com>
Co-authored-by: Snyk bot <github+bot@snyk.io>
  • Loading branch information
4 people committed Oct 28, 2022
1 parent 7e24e91 commit 4cd8241
Show file tree
Hide file tree
Showing 40 changed files with 2,326 additions and 686 deletions.
426 changes: 365 additions & 61 deletions README-es.md

Large diffs are not rendered by default.

426 changes: 365 additions & 61 deletions README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ services:
- postgres
build:
context: .
dockerfile: dev.Dockerfile
dockerfile: Dockerfile #dev.Dockefile
ports:
- 8080:8080
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
- /usr/src/app/dist
env_file:
- .env
networks:
ink-explorer-network:
aliases:
- "backend"
env_file:
- .env
postgres:
image: postgres:14.4
restart: always
Expand Down
2 changes: 2 additions & 0 deletions mocks/base64-metadata.mock.ts

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions mocks/blocks-mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ export const mockBlock = {
hash: '0x03b26a67c6c7fda467f7b96d09b99d04ef9a8163043e72b5e5474358631afad2',
parentHash: '0x9b0f818b9cac7d9451819de6172e308d67c4b8ff8c2f1f6773cdb20c40573858',
number: 27,
timestamp: 1590000000,
encodedLength: 100,
createdDate: '2022-08-25 22:49:21.843575',
}

Expand Down
9 changes: 9 additions & 0 deletions mocks/contracts-mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ export const mockContract = {
address: '5GRYcveXcsy8Y6jpHc19xE9wm6xSfzKbzZPFKZvGwzBms4hz',
metadata: JSON.stringify(abi),
}

export const mockContracts = [mockContract]

export const mockContractQueries = {
...mockContract,
queries: [{ args: [{ fake: 'arg' }] }],
}

export const mockQueryString = [{ args: ['{"fake":"arg"}'] }]
108 changes: 58 additions & 50 deletions mocks/events-mocks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
import { numberToU8a } from '@polkadot/util'

export const mockFormattedEvent = {
from: '',
to: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
value: '30000000',
}

export const mockDecodedEvent = {
args: [
{
toString: () => '',
},
{
toString: () => '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
},
{
toString: () => '30000000',
},
],
event: {
args: [
{
name: 'from',
type: {
info: 9,
lookupIndex: 11,
lookupName: undefined,
type: 'Option<AccountId>',
docs: [],
namespace: 'Option',
},
toString: () => '',
},
{
name: 'to',
type: {
info: 9,
lookupIndex: 11,
lookupName: undefined,
type: 'Option<AccountId>',
docs: [],
namespace: 'Option',
},
toString: () => '',
},
{
name: 'value',
type: {
info: 10,
type: 'Balance',
},
toString: () => '',
},
],
},
}

export const mockEvents = [
{
id: '34709348-7d86-5bb3-81ce-4320b3fd1f4e',
Expand All @@ -13,6 +69,7 @@ export const mockEvents = [
'5C9QorN8S8X2Cwpa98cRevWR7YHmKqDGUPMDM3rZnLzWnRj9',
'0x000001d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0000c52ebca2b1000000000000000000',
],
decodedData: undefined,
createdDate: '2022-08-31 20:03:28.568881',
contractAddress: '5C9QorN8S8X2Cwpa98cRevWR7YHmKqDGUPMDM3rZnLzWnRj9',
},
Expand All @@ -28,6 +85,7 @@ export const mockEvents = [
'5C9QorN8S8X2Cwpa98cRevWR7YHmKqDGUPMDM3rZnLzWnRj9',
'0x0001d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01fe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e0040e59c301200000000000000000000',
],
decodedData: mockDecodedEvent,
createdDate: '2022-08-31 20:03:38.814484',
contractAddress: '5C9QorN8S8X2Cwpa98cRevWR7YHmKqDGUPMDM3rZnLzWnRj9',
},
Expand Down Expand Up @@ -90,53 +148,3 @@ export const mockRecords = [
'[0x0045726332303a3a5472616e7366657200000000000000000000000000000000, 0x63c87cd1c4007df77d6b16ae28c5393bee3a62fb8577e38243a6f6f5a82c457f, 0xda2d695d3b5a304e0039e7fc4419c34fa0c1f239189c99bb72a6484f1634782b]',
},
]

export const mockDecodedEvent = {
args: [
{
toString: () => '',
},
{
toString: () => '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
},
{
toString: () => '30000000',
},
],
event: {
args: [
{
name: 'from',
type: {
info: 9,
lookupIndex: 11,
lookupName: undefined,
type: 'Option<AccountId>',
docs: [],
namespace: 'Option',
},
toString: () => '',
},
{
name: 'to',
type: {
info: 9,
lookupIndex: 11,
lookupName: undefined,
type: 'Option<AccountId>',
docs: [],
namespace: 'Option',
},
toString: () => '',
},
{
name: 'value',
type: {
info: 10,
type: 'Balance',
},
toString: () => '',
},
],
},
}
1 change: 1 addition & 0 deletions mocks/pino-mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export const mockPinoService = (serviceName: string) => ({
info: jest.fn(),
debug: jest.fn(),
error: jest.fn(),
warn: jest.fn(),
},
})
20 changes: 20 additions & 0 deletions mocks/transactions-mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const mockTransaction = {
signer: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
nonce: 37,
tip: 0,
timestamp: 1600000000000,
createdDate: '2022-08-25 23:42:49.006343',
}

Expand Down Expand Up @@ -41,6 +42,8 @@ export const mockTransactions = [
},
]

export const mockTimestamp = 1600000000000

export const mockExtrinsics = [
{
hash: stringToHex('0x01c780fccc47dc4e9652180876a8267dc9f9dd501ed249f077e32c1653a89f2a'),
Expand All @@ -57,6 +60,22 @@ export const mockExtrinsics = [
method: {
method: 'set',
section: 'timestamp',
args: [mockTimestamp],
},
encodedLength: 0,
registry: {
chainDecimals: {
toString: () => '12',
},
chainSS58: {
toString: () => '42',
},
},
era: {},
version: 0,
type: 0,
callIndex: {
toString: () => '0x0000',
},
},
{
Expand All @@ -74,6 +93,7 @@ export const mockExtrinsics = [
method: {
method: 'call',
section: 'timestamp',
args: [mockTimestamp],
},
},
]
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ink-substrate-explorer-api",
"version": "1.0.0",
"version": "1.0.1",
"description": "Ink Explorer is an application that provides Ink contracts related information on Substrate based blockchains.",
"author": "Blockcoders <engineering@blockcoders.io>",
"license": "MIT",
Expand Down Expand Up @@ -93,12 +93,12 @@
"@nestjs/mapped-types": "1.1.0",
"@nestjs/platform-fastify": "8.4.7",
"@nestjs/typeorm": "9.0.0",
"@polkadot/api": "^8.14.1",
"@polkadot/api-augment": "^8.14.1",
"@polkadot/api-contract": "^8.14.1",
"@polkadot/types": "^8.14.1",
"@polkadot/types-codec": "^8.14.1",
"@polkadot/types-create": "^8.14.1",
"@polkadot/api": "^9.4.3",
"@polkadot/api-augment": "^9.4.3",
"@polkadot/api-contract": "^9.4.3",
"@polkadot/types": "^9.4.3",
"@polkadot/types-codec": "^9.4.3",
"@polkadot/types-create": "^9.4.3",
"@polkadot/util": "10.1.2",
"@substrate/txwrapper": "^7.0.1",
"@substrate/txwrapper-core": "^3.1.7",
Expand Down
Loading

0 comments on commit 4cd8241

Please sign in to comment.