Skip to content

Commit

Permalink
fix(namada): patch up type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
egasimus committed Sep 27, 2024
1 parent 20f921b commit f5fc517
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/namada/NamadaBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function fetchBlockResultsByHeight (
}
const returned: Partial<BlockResults> = {}
for (const [key, value] of Object.entries(result)) {
returned[Case.camel(key) as keyof BlockResults] = value
returned[Case.camel(key) as keyof BlockResults] = value as any
}
return returned as BlockResults
}
Expand Down
2 changes: 1 addition & 1 deletion packages/namada/NamadaChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import NamadaConnection from './NamadaConnection'
import type { Validator } from './NamadaPoS'
import { Decode, initDecoder } from './NamadaDecode'
import type { NamadaDecoder } from './NamadaDecode'
import type { Epoch } from './Namada'
import type { Epoch } from './NamadaEpoch'

export default class NamadaChain extends CW.Chain {
decode: NamadaDecoder = Decode as unknown as NamadaDecoder
Expand Down
2 changes: 1 addition & 1 deletion packages/namada/NamadaConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as PoS from './NamadaPoS'
import * as PGF from './NamadaPGF'
import * as Gov from './NamadaGov'
import * as Epoch from './NamadaEpoch'
import type { Chain as Namada, Epoch } from './Namada'
import type { Chain as Namada } from './Namada'
import { decode, u256 } from '@hackbg/borshest'

export default class NamadaConnection extends CW.Connection {
Expand Down
8 changes: 4 additions & 4 deletions packages/namada/NamadaDecode.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Address, Uint128 } from '@hackbg/fadroma'
import init, { Decode } from './pkg/fadroma_namada.js'
import type NamadaBlock from './NamadaBlock'
import type { Transaction as NamadaTransaction } from './NamadaBlock'
import type { Block, Transaction } from './NamadaBlock'
import type { } from './NamadaBlock'
import type * as PGF from './NamadaPGF'
import type * as PoS from './NamadaPoS'
import type * as Gov from './NamadaGov'
Expand Down Expand Up @@ -145,8 +145,8 @@ export interface NamadaDecoder {

block (blockResponse: unknown, resultsResponse: unknown): {
hash: string,
header: NamadaBlock["header"]
transactions: Array<Partial<NamadaTransaction> & {id: string}>
header: Block["header"]
transactions: Array<Partial<Transaction> & {id: string}>
}

tx (): {
Expand Down
7 changes: 4 additions & 3 deletions packages/namada/NamadaPoS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import type { Address } from '@hackbg/fadroma'
import { Console, assign, base16, optionallyParallel} from '@hackbg/fadroma'
import { Staking } from '@fadroma/cw'
import { decode, u8, u64, u256, array, set } from '@hackbg/borshest'
import type { Chain as Namada, Connection as NamadaConnection, Epoch } from './Namada'
import type { Chain as Namada, Connection as NamadaConnection } from './Namada'
import type { Epoch } from './NamadaEpoch'

export type Params = Awaited<ReturnType<typeof fetchStakingParameters>>

Expand Down Expand Up @@ -377,7 +378,7 @@ const getRequests = (
/** Generates a warning handler for each request. */
const getWarnings = (connection: NamadaConnection, address: Address, epoch?: Epoch) => {
const warn = (msg: string) => (_: Error) => {
if (!isNaN(epoch)) msg += ` for epoch ${epoch}`
if (!isNaN(epoch as number)) msg += ` for epoch ${epoch}`
connection.log.warn(`${address}:`, msg)
return null
}
Expand All @@ -395,7 +396,7 @@ const getAbciQueryPaths = (address: Address, epoch?: Epoch) => {
let commissionPath = `/vp/pos/validator/commission/${address}`
let statePath = `/vp/pos/validator/state/${address}`
let stakePath = `/vp/pos/validator/stake/${address}`
if (!isNaN(epoch)) {
if (!isNaN(epoch as number)) {
const epochSuffix = `/${epoch}`
commissionPath += epochSuffix
statePath += epochSuffix
Expand Down

0 comments on commit f5fc517

Please sign in to comment.