feat: [FEATURE] Safe Block Fetch #464
This commit is contained in:
@@ -37,6 +37,24 @@ export async function handle(state, action) {
|
||||
return {state};
|
||||
}
|
||||
|
||||
if (input.function === 'loadBlockData') {
|
||||
const height = input.height;
|
||||
const throwError = input.throwError;
|
||||
|
||||
const blockData = await SmartWeave.safeArweaveGet(
|
||||
throwError
|
||||
? `/blockkkk/height/${height}`
|
||||
: `/block/height/${height}`
|
||||
);
|
||||
|
||||
if (!state.blocks) {
|
||||
state.blocks = {};
|
||||
}
|
||||
|
||||
state.blocks["" + height] = blockData.indep_hash;
|
||||
return { state };
|
||||
}
|
||||
|
||||
if (input.function === 'dispatchEvent') {
|
||||
return {
|
||||
state,
|
||||
|
||||
Reference in New Issue
Block a user