-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64756ba
commit 6f02737
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { pipeAsyncFunctions, formatters, bigToNumber, unfuckEthersObj } from "/js/utils.js"; | ||
import { utils as ethersUtils } from "https://esm.sh/[email protected]"; | ||
|
||
// process each obj through a pipeline of fns | ||
async function transformer(fns, objs) { | ||
|
@@ -8,11 +9,25 @@ async function transformer(fns, objs) { | |
return xobjs; | ||
} | ||
|
||
function decodeBLS(blob) { | ||
let data; | ||
try { | ||
data = ethersUtils.defaultAbiCoder.decode(["bytes", "bytes"], blob); | ||
} catch (err) { | ||
console.log("error decoding BLS", blob); | ||
data = [null, null]; | ||
} | ||
return data; | ||
} | ||
|
||
async function fixupMinipool(obj) { | ||
obj.nodeAddr = obj.nodeID; | ||
obj.nodeID = await formatters.nodeAddrToId(obj.nodeAddr); | ||
obj.status = formatters.formatMPStatus(obj.status); | ||
obj.txID = await formatters.toCB58(obj.txID); | ||
const blob = decodeBLS(obj.blsPubkeyAndSig); | ||
obj.blsPubkey = blob[0]; | ||
obj.blsSig = blob[1]; | ||
|
||
obj.errorCode = formatters.formatErrorMsg(obj.errorCode); | ||
|
||
|