From 14036cebc03846370c115a8b593479a29d4540d7 Mon Sep 17 00:00:00 2001 From: Matthew A Elder Date: Thu, 24 Feb 2022 12:24:48 -0700 Subject: [PATCH] fix regression --- lib/multisigHelpers.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/multisigHelpers.js b/lib/multisigHelpers.js index 4e30aaa3..3e5b861a 100644 --- a/lib/multisigHelpers.js +++ b/lib/multisigHelpers.js @@ -51,15 +51,22 @@ const getMultisigAccount = async (address, client) => { // is new, and has never submitted a transaction its pubkeys will not be // available from a node. If the multisig was created with this instance // of this tool its pubkey will be available in the fauna datastore - const accountOnChain = await client.getAccount(address); + let accountOnChain = await client.getAccount(address); const chainId = await client.getChainId(); if (!accountOnChain || !accountOnChain.pubkey) { + console.log("No pubkey on chain for: ", address); const res = await axios.get(`/api/chain/${chainId}/multisig/${address}`); if (res.status !== 200) { throw new Error("Multisig has no pubkey on node, and was not created using this tool."); } + const pubkey = JSON.parse(res.data.pubkeyJSON); + + if (!accountOnChain) { + accountOnChain = {}; + } + accountOnChain.pubkey = pubkey; } return accountOnChain; };