Skip to content

Commit

Permalink
fix notify async issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmjs committed Jan 17, 2024
1 parent dbd3983 commit f7075d6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/lib/candid/types/reference/service/canister_function/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function serviceCall(
paramCandidTypes: CandidType[],
returnCandidType: CandidType
) {
return async (
return (
notify: boolean,
callFunction: CallRawFunction | NotifyRawFunction,
cycles: bigint,
Expand All @@ -184,14 +184,16 @@ function serviceCall(
throw error;
}
} else {
const encodedResult = await (callFunction as CallRawFunction)(
canisterId,
methodName,
encodedArgs,
cycles
);
return (async () => {
const encodedResult = await (callFunction as CallRawFunction)(
canisterId,
methodName,
encodedArgs,
cycles
);

return decode(returnCandidType, encodedResult);
return decode(returnCandidType, encodedResult);
})();
}
};
}

0 comments on commit f7075d6

Please sign in to comment.