Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.0.1 (Integration with Front-end changes) #8

Merged
merged 29 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6178e91
updating polkadot api
fersirni Oct 7, 2022
3375e6a
Updating polkadot api version (#7)
fersirni Oct 10, 2022
8ea30bd
Merge branch 'develompment' of github.com:blockcoders/ink-substrate-e…
fersirni Oct 10, 2022
1360272
lint
fersirni Oct 10, 2022
1d23532
dockerfile
fersirni Oct 10, 2022
0596e1c
query blocks with order
fersirni Oct 11, 2022
fda3102
adding transaction data
fersirni Oct 12, 2022
e901c9f
adding block data and transactions queries
fersirni Oct 17, 2022
9c0f549
rename resolver function
fersirni Oct 17, 2022
401262c
rename resolver function
fersirni Oct 17, 2022
70d791a
schema
fersirni Oct 17, 2022
27a17c7
events order asc
fersirni Oct 18, 2022
71cca52
get event resolver
fersirni Oct 18, 2022
90b957c
decode resolvers
fersirni Oct 19, 2022
1e64adb
version resolvers
fersirni Oct 19, 2022
c053269
contract queries resolver added
fersirni Oct 20, 2022
4de9885
execute queries resolver
fersirni Oct 21, 2022
a47cde5
execute queries resolver
fersirni Oct 23, 2022
a57109e
get contracts resolver
fersirni Oct 23, 2022
53803d9
decode events to mutiation
fersirni Oct 24, 2022
fb45676
decode events result
fersirni Oct 24, 2022
0eaa1d0
events check for existing
fersirni Oct 25, 2022
7b5ca30
fix tests
fersirni Oct 26, 2022
4b12c47
increasing coverage
fersirni Oct 26, 2022
728b506
test getContractQueries
fersirni Oct 26, 2022
6efeb6f
add warn case to mock pino looger
fersirni Oct 27, 2022
7a13337
tests coverage
fersirni Oct 27, 2022
74e784d
lint
fersirni Oct 28, 2022
3b09ea9
README
fersirni Oct 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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