Skip to content

Commit

Permalink
fix: fetch metadata for immortal payloads (#1773)
Browse files Browse the repository at this point in the history
* fix: fetch metadata for immortal payloads

* fix: ignore block hash when estimating fees

* fix: comment
  • Loading branch information
0xKheops authored Jan 8, 2025
1 parent e720c76 commit bef6a3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions apps/extension/src/ui/util/getExtrinsicDispatchInfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { GenericExtrinsic } from "@polkadot/types"
import { assert } from "@polkadot/util"
import { HexString } from "@polkadot/util/types"

import { stateCall } from "./stateCall"

Expand All @@ -12,7 +11,6 @@ type ExtrinsicDispatchInfo = {
export const getExtrinsicDispatchInfo = async (
chainId: string,
signedExtrinsic: GenericExtrinsic,
blockHash?: HexString,
): Promise<ExtrinsicDispatchInfo> => {
assert(signedExtrinsic.isSigned, "Extrinsic must be signed (or fakeSigned) in order to query fee")

Expand All @@ -23,7 +21,7 @@ export const getExtrinsicDispatchInfo = async (
"TransactionPaymentApi_query_info",
"RuntimeDispatchInfo",
[signedExtrinsic, len],
blockHash,
undefined,
true,
)

Expand Down
4 changes: 4 additions & 0 deletions packages/extension-core/src/util/getMetadataDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const getMetadataDefInner = async (
): Promise<TalismanMetadataDef | undefined> => {
const [chain, genesisHash] = await getChainAndGenesisHashFromIdOrHash(chainIdOrHash)

// blockHash being equal to genesisHash happens when trying to decode payload of immortal transactions
// in that case, blockHash must not be used as block reference when fetching data
if (blockHash && blockHash === genesisHash) blockHash = undefined

const cacheKey = getResultCacheKey(genesisHash, specVersion)
if (cacheKey && CACHE_RESULTS.has(cacheKey)) return CACHE_RESULTS.get(cacheKey)

Expand Down

0 comments on commit bef6a3c

Please sign in to comment.