Skip to content

Commit 4cd8241

Browse files
fersirni0xslipkrubengucsnyk-bot
authored
Version 1.0.1 (Integration with Front-end changes) (#8)
* updating polkadot api * Updating polkadot api version (#7) * change skipped test (#2) * fixes * fix documentation * fix images folder Co-authored-by: Fernando Sirni <[email protected]> * [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é <[email protected]> Co-authored-by: Ruben Gutierrez <[email protected]> Co-authored-by: Snyk bot <[email protected]> * 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é <[email protected]> Co-authored-by: Ruben Gutierrez <[email protected]> Co-authored-by: Snyk bot <[email protected]>
1 parent 7e24e91 commit 4cd8241

40 files changed

+2326
-686
lines changed

README-es.md

Lines changed: 365 additions & 61 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 365 additions & 61 deletions
Large diffs are not rendered by default.

docker-compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ services:
1313
- postgres
1414
build:
1515
context: .
16-
dockerfile: dev.Dockerfile
16+
dockerfile: Dockerfile #dev.Dockefile
1717
ports:
1818
- 8080:8080
1919
volumes:
2020
- .:/usr/src/app
2121
- /usr/src/app/node_modules
2222
- /usr/src/app/dist
23+
env_file:
24+
- .env
2325
networks:
2426
ink-explorer-network:
2527
aliases:
2628
- "backend"
27-
env_file:
28-
- .env
2929
postgres:
3030
image: postgres:14.4
3131
restart: always

mocks/base64-metadata.mock.ts

Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.

mocks/blocks-mocks.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ export const mockBlock = {
22
hash: '0x03b26a67c6c7fda467f7b96d09b99d04ef9a8163043e72b5e5474358631afad2',
33
parentHash: '0x9b0f818b9cac7d9451819de6172e308d67c4b8ff8c2f1f6773cdb20c40573858',
44
number: 27,
5+
timestamp: 1590000000,
6+
encodedLength: 100,
57
createdDate: '2022-08-25 22:49:21.843575',
68
}
79

mocks/contracts-mocks.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@ export const mockContract = {
1010
address: '5GRYcveXcsy8Y6jpHc19xE9wm6xSfzKbzZPFKZvGwzBms4hz',
1111
metadata: JSON.stringify(abi),
1212
}
13+
14+
export const mockContracts = [mockContract]
15+
16+
export const mockContractQueries = {
17+
...mockContract,
18+
queries: [{ args: [{ fake: 'arg' }] }],
19+
}
20+
21+
export const mockQueryString = [{ args: ['{"fake":"arg"}'] }]

mocks/events-mocks.ts

Lines changed: 58 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,61 @@
11
import { numberToU8a } from '@polkadot/util'
22

3+
export const mockFormattedEvent = {
4+
from: '',
5+
to: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
6+
value: '30000000',
7+
}
8+
9+
export const mockDecodedEvent = {
10+
args: [
11+
{
12+
toString: () => '',
13+
},
14+
{
15+
toString: () => '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
16+
},
17+
{
18+
toString: () => '30000000',
19+
},
20+
],
21+
event: {
22+
args: [
23+
{
24+
name: 'from',
25+
type: {
26+
info: 9,
27+
lookupIndex: 11,
28+
lookupName: undefined,
29+
type: 'Option<AccountId>',
30+
docs: [],
31+
namespace: 'Option',
32+
},
33+
toString: () => '',
34+
},
35+
{
36+
name: 'to',
37+
type: {
38+
info: 9,
39+
lookupIndex: 11,
40+
lookupName: undefined,
41+
type: 'Option<AccountId>',
42+
docs: [],
43+
namespace: 'Option',
44+
},
45+
toString: () => '',
46+
},
47+
{
48+
name: 'value',
49+
type: {
50+
info: 10,
51+
type: 'Balance',
52+
},
53+
toString: () => '',
54+
},
55+
],
56+
},
57+
}
58+
359
export const mockEvents = [
460
{
561
id: '34709348-7d86-5bb3-81ce-4320b3fd1f4e',
@@ -13,6 +69,7 @@ export const mockEvents = [
1369
'5C9QorN8S8X2Cwpa98cRevWR7YHmKqDGUPMDM3rZnLzWnRj9',
1470
'0x000001d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0000c52ebca2b1000000000000000000',
1571
],
72+
decodedData: undefined,
1673
createdDate: '2022-08-31 20:03:28.568881',
1774
contractAddress: '5C9QorN8S8X2Cwpa98cRevWR7YHmKqDGUPMDM3rZnLzWnRj9',
1875
},
@@ -28,6 +85,7 @@ export const mockEvents = [
2885
'5C9QorN8S8X2Cwpa98cRevWR7YHmKqDGUPMDM3rZnLzWnRj9',
2986
'0x0001d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01fe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e0040e59c301200000000000000000000',
3087
],
88+
decodedData: mockDecodedEvent,
3189
createdDate: '2022-08-31 20:03:38.814484',
3290
contractAddress: '5C9QorN8S8X2Cwpa98cRevWR7YHmKqDGUPMDM3rZnLzWnRj9',
3391
},
@@ -90,53 +148,3 @@ export const mockRecords = [
90148
'[0x0045726332303a3a5472616e7366657200000000000000000000000000000000, 0x63c87cd1c4007df77d6b16ae28c5393bee3a62fb8577e38243a6f6f5a82c457f, 0xda2d695d3b5a304e0039e7fc4419c34fa0c1f239189c99bb72a6484f1634782b]',
91149
},
92150
]
93-
94-
export const mockDecodedEvent = {
95-
args: [
96-
{
97-
toString: () => '',
98-
},
99-
{
100-
toString: () => '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
101-
},
102-
{
103-
toString: () => '30000000',
104-
},
105-
],
106-
event: {
107-
args: [
108-
{
109-
name: 'from',
110-
type: {
111-
info: 9,
112-
lookupIndex: 11,
113-
lookupName: undefined,
114-
type: 'Option<AccountId>',
115-
docs: [],
116-
namespace: 'Option',
117-
},
118-
toString: () => '',
119-
},
120-
{
121-
name: 'to',
122-
type: {
123-
info: 9,
124-
lookupIndex: 11,
125-
lookupName: undefined,
126-
type: 'Option<AccountId>',
127-
docs: [],
128-
namespace: 'Option',
129-
},
130-
toString: () => '',
131-
},
132-
{
133-
name: 'value',
134-
type: {
135-
info: 10,
136-
type: 'Balance',
137-
},
138-
toString: () => '',
139-
},
140-
],
141-
},
142-
}

mocks/pino-mocks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ export const mockPinoService = (serviceName: string) => ({
66
info: jest.fn(),
77
debug: jest.fn(),
88
error: jest.fn(),
9+
warn: jest.fn(),
910
},
1011
})

mocks/transactions-mock.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const mockTransaction = {
1111
signer: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
1212
nonce: 37,
1313
tip: 0,
14+
timestamp: 1600000000000,
1415
createdDate: '2022-08-25 23:42:49.006343',
1516
}
1617

@@ -41,6 +42,8 @@ export const mockTransactions = [
4142
},
4243
]
4344

45+
export const mockTimestamp = 1600000000000
46+
4447
export const mockExtrinsics = [
4548
{
4649
hash: stringToHex('0x01c780fccc47dc4e9652180876a8267dc9f9dd501ed249f077e32c1653a89f2a'),
@@ -57,6 +60,22 @@ export const mockExtrinsics = [
5760
method: {
5861
method: 'set',
5962
section: 'timestamp',
63+
args: [mockTimestamp],
64+
},
65+
encodedLength: 0,
66+
registry: {
67+
chainDecimals: {
68+
toString: () => '12',
69+
},
70+
chainSS58: {
71+
toString: () => '42',
72+
},
73+
},
74+
era: {},
75+
version: 0,
76+
type: 0,
77+
callIndex: {
78+
toString: () => '0x0000',
6079
},
6180
},
6281
{
@@ -74,6 +93,7 @@ export const mockExtrinsics = [
7493
method: {
7594
method: 'call',
7695
section: 'timestamp',
96+
args: [mockTimestamp],
7797
},
7898
},
7999
]

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ink-substrate-explorer-api",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Ink Explorer is an application that provides Ink contracts related information on Substrate based blockchains.",
55
"author": "Blockcoders <[email protected]>",
66
"license": "MIT",
@@ -93,12 +93,12 @@
9393
"@nestjs/mapped-types": "1.1.0",
9494
"@nestjs/platform-fastify": "8.4.7",
9595
"@nestjs/typeorm": "9.0.0",
96-
"@polkadot/api": "^8.14.1",
97-
"@polkadot/api-augment": "^8.14.1",
98-
"@polkadot/api-contract": "^8.14.1",
99-
"@polkadot/types": "^8.14.1",
100-
"@polkadot/types-codec": "^8.14.1",
101-
"@polkadot/types-create": "^8.14.1",
96+
"@polkadot/api": "^9.4.3",
97+
"@polkadot/api-augment": "^9.4.3",
98+
"@polkadot/api-contract": "^9.4.3",
99+
"@polkadot/types": "^9.4.3",
100+
"@polkadot/types-codec": "^9.4.3",
101+
"@polkadot/types-create": "^9.4.3",
102102
"@polkadot/util": "10.1.2",
103103
"@substrate/txwrapper": "^7.0.1",
104104
"@substrate/txwrapper-core": "^3.1.7",

0 commit comments

Comments
 (0)