Skip to content

Commit ab6004e

Browse files
committed
Parse ROFL transactions in API layer
1 parent 821d03e commit ab6004e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/oasis-nexus/api.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,3 +1538,42 @@ export const useGetRuntimeRoflAppsId: typeof generated.useGetRuntimeRoflAppsId =
15381538
},
15391539
})
15401540
}
1541+
1542+
export const useGetRuntimeRoflAppsIdTransactions: typeof generated.useGetRuntimeRoflAppsIdTransactions = (
1543+
network,
1544+
runtime,
1545+
id,
1546+
params?,
1547+
options?,
1548+
) => {
1549+
return generated.useGetRuntimeRoflAppsIdTransactions(network, runtime, id, params, {
1550+
...options,
1551+
request: {
1552+
...options?.request,
1553+
transformResponse: [
1554+
...arrayify(axios.defaults.transformResponse),
1555+
(data: generated.RuntimeTransactionList, headers, status) => {
1556+
if (status !== 200) return data
1557+
return {
1558+
...data,
1559+
transactions: data.transactions.map(tx => {
1560+
return {
1561+
...tx,
1562+
eth_hash: tx.eth_hash ? `0x${tx.eth_hash}` : undefined,
1563+
fee: fromBaseUnits(tx.fee, paraTimesConfig.sapphire.decimals),
1564+
fee_symbol: normalizeSymbol(tx.fee_symbol, { network, layer: runtime }),
1565+
charged_fee: fromBaseUnits(tx.charged_fee, paraTimesConfig.sapphire.decimals),
1566+
amount: tx.amount ? fromBaseUnits(tx.amount, paraTimesConfig.sapphire.decimals) : undefined,
1567+
amount_symbol: normalizeSymbol(tx.amount_symbol, { network, layer: runtime }),
1568+
layer: runtime,
1569+
network,
1570+
method: adjustRuntimeTransactionMethod(tx.method, tx.is_likely_native_token_transfer),
1571+
}
1572+
}),
1573+
}
1574+
},
1575+
...arrayify(options?.request?.transformResponse),
1576+
],
1577+
},
1578+
})
1579+
}

0 commit comments

Comments
 (0)