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; };