Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
Replace dscp-node package with @polkadot/api (#64)
Browse files Browse the repository at this point in the history
* use polkadot directly

* version bump

* add api.catch() comment
  • Loading branch information
jonmattgray authored Nov 28, 2022
1 parent 96b85e9 commit a91ee53
Show file tree
Hide file tree
Showing 5 changed files with 425 additions and 409 deletions.
14 changes: 6 additions & 8 deletions app/util/substrateApi.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { buildApi } from '@digicatapult/dscp-node'
import { ApiPromise, WsProvider, Keyring } from '@polkadot/api'

import env from '../env.js'
import logger from '../logger.js'

const { API_HOST, API_PORT } = env

const { api, keyring: kr } = buildApi({
options: {
apiHost: API_HOST,
apiPort: API_PORT,
},
})
const provider = new WsProvider(`ws://${API_HOST}:${API_PORT}`)
const api = new ApiPromise({ provider })

api.isReadyOrError.catch(() => {}) // prevent unhandled promise rejection errors

api.on('disconnected', () => {
logger.warn(`Disconnected from substrate node at ${API_HOST}:${API_PORT}`)
Expand All @@ -25,4 +23,4 @@ api.on('error', (err) => {
})

export const substrateApi = api
export const keyring = kr
export const keyring = new Keyring({ type: 'sr25519' })
4 changes: 2 additions & 2 deletions helm/dscp-api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: dscp-api
appVersion: '4.8.1'
appVersion: '4.8.2'
description: A Helm chart for dscp-api
version: '4.8.1'
version: '4.8.2'
type: application
dependencies:
- name: dscp-node
Expand Down
2 changes: 1 addition & 1 deletion helm/dscp-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ service:
image:
repository: digicatapult/dscp-api
pullPolicy: IfNotPresent
tag: 'v4.8.1'
tag: 'v4.8.2'

dscpNode:
enabled: false
Expand Down
Loading

0 comments on commit a91ee53

Please sign in to comment.