diff --git a/src/vendors/__tests__/__snapshots__/oasisscan.test.ts.snap b/src/vendors/__tests__/__snapshots__/oasisscan.test.ts.snap index 47abfa6629..dc7539aa44 100644 --- a/src/vendors/__tests__/__snapshots__/oasisscan.test.ts.snap +++ b/src/vendors/__tests__/__snapshots__/oasisscan.test.ts.snap @@ -29,6 +29,20 @@ Object { exports[`oasisscan parse transaction list 1`] = ` Array [ + Object { + "amount": 200000000000, + "fee": undefined, + "from": "oasis1qqnk4au603zs94k0d0n7c0hkx8t4p6r87s60axru", + "hash": "25b84ca4582f6e3140c384ad60b98415d2c3079d1fc5f2221e45da7b13c70817", + "level": undefined, + "round": 997775, + "runtimeId": "000000000000000000000000000000000000000000000000e2eaa99fc008f87f", + "runtimeName": "Emerald", + "status": true, + "timestamp": 1649604086, + "to": "oasis1qzgc7dvlls36q47z5y6dvu6ylaa78rkrduqtxgdr", + "type": "consensus.Deposit", + }, Object { "amount": 116900000000, "fee": 2000, diff --git a/src/vendors/__tests__/oasisscan.test.ts b/src/vendors/__tests__/oasisscan.test.ts index 91c83fee01..5a411a4c6c 100644 --- a/src/vendors/__tests__/oasisscan.test.ts +++ b/src/vendors/__tests__/oasisscan.test.ts @@ -1,3 +1,4 @@ +import { TransactionMethod } from 'app/state/transaction/types' import { OperationsRowMethodEnum } from 'vendors/oasisscan/index' import { parseValidatorsList, @@ -137,6 +138,26 @@ describe('oasisscan', () => { test('parse transaction list', () => { expect( parseTransactionsList([ + // Emerald ParaTime Object + { + add: undefined, + amount: '200', + fee: undefined, + from: 'oasis1qqnk4au603zs94k0d0n7c0hkx8t4p6r87s60axru', + height: undefined, + method: 'consensus.Deposit' as TransactionMethod, + round: 997775, + runtimeId: '000000000000000000000000000000000000000000000000e2eaa99fc008f87f', + runtimeName: 'Emerald', + shares: undefined, + status: true, + time: undefined, + timestamp: 1649604086, + to: 'oasis1qzgc7dvlls36q47z5y6dvu6ylaa78rkrduqtxgdr', + txHash: '25b84ca4582f6e3140c384ad60b98415d2c3079d1fc5f2221e45da7b13c70817', + type: 'consensus.Deposit', + }, + // https://api.oasisscan.com/mainnet/chain/transactions?size=200&runtime=false&method=staking.Transfer&address=oasis1qz086axf5hreqpehv5hlgmtw7sfem79gz55v68wp { txHash: 'b831c4b2aa3188058717250cba279795d907e581bb4d7d40d9dc358d37a56254', diff --git a/src/vendors/oasisscan.ts b/src/vendors/oasisscan.ts index 36c6603677..458d302b85 100644 --- a/src/vendors/oasisscan.ts +++ b/src/vendors/oasisscan.ts @@ -161,15 +161,19 @@ export const transactionMethodMap: { [ParaTimeCtxRowMethodEnum.ConsensusAccount]: TransactionType.ConsensusAccount, } -type TransactionsListRow = Omit & { +type TransactionsListRow = Omit & { method: TransactionMethod + add: boolean | undefined + fee: string | undefined + height: number | undefined + time: number | undefined } export function parseTransactionsList(transactionsList: TransactionsListRow[]): Transaction[] { return transactionsList.map(t => { const parsed: Transaction = { amount: t.amount == null ? undefined : parseStringValueToInt(t.amount), - fee: parseStringValueToInt(t.fee), + fee: t.fee ? parseStringValueToInt(t.fee) : undefined, from: t.from, hash: t.txHash, level: t.height,