Skip to content

Commit

Permalink
Bump polkadot-js and txwrapper dependencies (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
osipov-mit authored Nov 12, 2023
1 parent 2188737 commit 049674a
Show file tree
Hide file tree
Showing 4 changed files with 541 additions and 43 deletions.
12 changes: 6 additions & 6 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
],
"private": true,
"dependencies": {
"@polkadot/api": "^10.9.1",
"@polkadot/types": "^10.9.1",
"@polkadot/types-codec": "^10.9.1",
"@polkadot/util": "^12.2.1",
"@substrate/txwrapper-core": "7.0.1",
"@substrate/txwrapper-polkadot": "7.0.1",
"@polkadot/api": "10.10.1",
"@polkadot/types": "10.10.1",
"@polkadot/types-codec": "10.10.1",
"@polkadot/util": "12.5.1",
"@substrate/txwrapper-core": "7.1.1",
"@substrate/txwrapper-polkadot": "7.1.1",
"body-parser": "1.20.2",
"camelcase": "6.3.0",
"commander": "^11.0.0",
Expand Down
2 changes: 1 addition & 1 deletion server/src/helpers/gear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ApiDecoration } from '@polkadot/api/types';
import { Header, Index, SignedBlock } from '@polkadot/types/interfaces';
import { BlockIdentifier, Peer, SyncStatus } from 'rosetta-client';

import { NetworkConfig } from 'types';
import { NetworkConfig } from '../types';
import logger from '../logger';
import { ApiError, throwError } from './errors';

Expand Down
13 changes: 6 additions & 7 deletions server/src/services/BlockService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
TransactionIdentifier,
} from 'rosetta-client';


import config from '../config';
import { ApiError, getNetworkIdent, getOperations, getOperationStatus, getTxsAndEvents, throwError } from '../helpers';
import logger from '../logger';
Expand Down Expand Up @@ -39,7 +38,7 @@ const block = async ({ body: { network_identifier, block_identifier } }: { body:
throwError(ApiError.NOT_AVAILABLE_OFFLINE);
}
const { api, currency } = getNetworkIdent(network_identifier);

const [blockIdent, blockTs, _block, apiAt] = await api.getBlockIdent(block_identifier.hash || block_identifier.index);

const parentBlockHeight = blockIdent.index - 1;
Expand Down Expand Up @@ -69,7 +68,7 @@ const block = async ({ body: { network_identifier, block_identifier } }: { body:

if (operations.length > 0) {
const rosettaTransaction = new Transaction(transactionIdent, operations);

if (opStatus == OperationStatus.FAILURE) {
try {
const transactionMetadata = lookupError(statusEvent.event);
Expand Down Expand Up @@ -140,7 +139,7 @@ const blockTransaction = async ({
};

function lookupError(failureEvent: Event): TransactionErrorMetadata {
const [error, _] = failureEvent.data;
const [error] = failureEvent.data;

const dispatchError: DispatchError = error as unknown as DispatchError;

Expand All @@ -154,10 +153,10 @@ function lookupError(failureEvent: Event): TransactionErrorMetadata {
return {
pallet: section,
error: name,
description: docs.join(' ')
}
description: docs.join(' '),
};
} else {
throw Error(`Could not lookup error using registry [Index = ${errorIndex}, Error = ${errorType}]`)
throw Error(`Could not lookup error using registry [Index = ${errorIndex}, Error = ${errorType}]`);
}
}

Expand Down
Loading

0 comments on commit 049674a

Please sign in to comment.