Skip to content

Commit

Permalink
chore: update rest transaction typing
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasRalee committed Sep 4, 2024
1 parent f3696f7 commit 93cf15b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ export class IndexerRestExplorerTransformer {
height: transaction.block_number,
time: transaction.block_unix_timestamp,
type: transaction.messages[0].type,
logs: transaction.logs,
signatures: transaction.signatures,
fee: transaction.gas_fee.amount
? new BigNumberInWei(transaction.gas_fee.amount[0].amount).toBase()
: ZERO_IN_BASE,
Expand Down
25 changes: 6 additions & 19 deletions packages/sdk-ts/src/client/indexer/types/explorer-rest.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* eslint-disable camelcase */
import {
EventLog,
Signature,
ValidatorUptime,
BlockWithTxs as BaseBlockWithTxs,
Transaction as BaseTransaction,
ValidatorUptime,
} from './explorer'

export enum AccessTypeCode {
Expand Down Expand Up @@ -37,28 +39,11 @@ export interface ExplorerApiResponseWithPagination<T> {
}
}

export interface EventLogEvent {
type: string
attributes: Array<{
key: string
value: string
}>
}

export interface EventLog {
events: EventLogEvent[]
}

export interface TransactionFromExplorerApiResponse {
id: string
block_number: number
block_timestamp: string
signatures: Array<{
pubkey: string
address: string
signature: string
sequence: number
}>
signatures: Signature[]
tx_type: string
hash: string
code: number
Expand Down Expand Up @@ -216,6 +201,8 @@ export interface ContractTransactionExplorerApiResponse {
}
},
]
logs: EventLog[]
signatures: Signature[]
}

export interface CW20BalanceExplorerApiResponse {
Expand Down
30 changes: 23 additions & 7 deletions packages/sdk-ts/src/client/indexer/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ import { InjectiveExplorerRpc } from '@injectivelabs/indexer-proto-ts'
import { Coin } from '@injectivelabs/ts-types'
import { TokenStatic } from '../../../types/token'

export interface EventLogEvent {
type: string
attributes: Array<{
key: string
value: string
}>
}

export interface EventLog {
events: EventLogEvent[]
}

export interface Signature {
pubkey: string
address: string
signature: string
sequence: number
}

export interface IBCTransferTx {
sender: string
receiver: string
Expand Down Expand Up @@ -113,14 +132,9 @@ export interface Transaction {
attributes: Record<string, string>
}>
txType: string
signatures: Array<{
pubkey: string
address: string
sequence: number
signature: string
}>
signatures: Signature[]
codespace: string
messages?: Array<TxMessage>
messages?: TxMessage[]
errorLog?: string
}

Expand Down Expand Up @@ -267,6 +281,8 @@ export interface ContractTransaction {
memo: string
tx_number: number
error_log: string
logs: EventLog[]
signatures: Signature[]
}

export interface ContractTransactionWithMessages extends ContractTransaction {
Expand Down

0 comments on commit 93cf15b

Please sign in to comment.