Skip to content

Commit

Permalink
fix(namada): return null on wasm not found
Browse files Browse the repository at this point in the history
  • Loading branch information
egasimus committed Aug 23, 2024
1 parent 2474a14 commit 6d08db8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/namada/NamadaGov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function fetchProposalInfo (

export async function fetchProposalWasm (
connection: Pick<Connection, 'abciQuery'|'decode'>, id: number|bigint
) {
): Promise<NamadaGovernanceProposalWasm|null> {
id = BigInt(id)
const codeKey = connection.decode.gov_proposal_code_key(BigInt(id))
let wasm
Expand All @@ -48,7 +48,7 @@ export async function fetchProposalWasm (
wasm = wasm.slice(4) // trim length prefix
return { id, codeKey, wasm }
} else {
throw new Error(`WASM for proposal ${id} was not found at key ${codeKey}`)
return null
}
}

Expand Down Expand Up @@ -82,8 +82,9 @@ interface NamadaGovernanceProposal {
}

interface NamadaGovernanceProposalWasm {
readonly codeKey: string
readonly wasm?: Uint8Array
readonly id: bigint
readonly codeKey: string
readonly wasm?: Uint8Array
}

interface NamadaGovernanceProposalResult {
Expand Down

0 comments on commit 6d08db8

Please sign in to comment.