Skip to content

Commit 5eefb62

Browse files
authored
chore(pjs): Update pjs deps and fix BlockHash type as part of build (#1830)
* chore(pjs): Update pjs deps * Fix bockhash type * lint
1 parent 8c4d120 commit 5eefb62

File tree

4 files changed

+658
-601
lines changed

4 files changed

+658
-601
lines changed

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@
5151
"test:test-release": "yarn build:scripts && node scripts/build/runYarnPack.js"
5252
},
5353
"dependencies": {
54-
"@polkadot/api": "^16.4.7",
55-
"@polkadot/api-augment": "^16.4.7",
56-
"@polkadot/api-contract": "^16.4.7",
57-
"@polkadot/types": "^16.4.7",
58-
"@polkadot/types-codec": "^16.4.7",
59-
"@polkadot/util": "^13.5.6",
60-
"@polkadot/util-crypto": "^13.5.6",
54+
"@polkadot/api": "^16.5.2",
55+
"@polkadot/api-augment": "^16.5.2",
56+
"@polkadot/api-contract": "^16.5.2",
57+
"@polkadot/types": "^16.5.2",
58+
"@polkadot/types-codec": "^16.5.2",
59+
"@polkadot/util": "^13.5.8",
60+
"@polkadot/util-crypto": "^13.5.8",
6161
"@substrate/calc": "0.3.1",
6262
"argparse": "^2.0.1",
6363
"confmgr": "^1.1.0",
@@ -71,7 +71,7 @@
7171
"winston-loki": "^6.1.3"
7272
},
7373
"devDependencies": {
74-
"@acala-network/chopsticks-testing": "^1.1.0",
74+
"@acala-network/chopsticks-testing": "^1.2.4",
7575
"@substrate/dev": "^0.9.0",
7676
"@types/argparse": "2.0.17",
7777
"@types/express": "^5.0.5",

src/controllers/blocks/BlocksController.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17+
import type { BlockHash } from '@polkadot/types/interfaces';
1718
import { isHex } from '@polkadot/util';
1819
import { RequestHandler, Response } from 'express';
1920
import { BadRequest } from 'http-errors';
@@ -322,7 +323,9 @@ export default class BlocksController extends AbstractController<BlocksService>
322323

323324
const historicApi = await this.api.at(hash);
324325

325-
const block = await this.service.fetchBlock(hash, historicApi, options);
326+
// ref: https://github.com/paritytech/substrate-api-sidecar/pull/1830
327+
// BlockHash and IU8a are the same underlying types
328+
const block = await this.service.fetchBlock(hash as unknown as BlockHash, historicApi, options);
326329
this.blockStore.set(cacheKey, block);
327330

328331
BlocksController.sanitizedSend(res, block);

src/controllers/rc/blocks/RcBlocksController.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17+
import type { BlockHash } from '@polkadot/types/interfaces';
1718
import { isHex } from '@polkadot/util';
1819
import { RequestHandler, Response } from 'express';
1920
import { BadRequest } from 'http-errors';
@@ -155,7 +156,9 @@ export default class RcBlocksController extends AbstractController<BlocksService
155156

156157
const historicApi = await rcApi.at(hash);
157158

158-
const block = await this.service.fetchBlock(hash, historicApi, options);
159+
// ref: https://github.com/paritytech/substrate-api-sidecar/pull/1830
160+
// BlockHash and IU8a are the same underlying types
161+
const block = await this.service.fetchBlock(hash as unknown as BlockHash, historicApi, options);
159162
this.blockStore.set(cacheKey, block);
160163

161164
RcBlocksController.sanitizedSend(res, block);

0 commit comments

Comments
 (0)