Skip to content

Commit

Permalink
Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwhit committed Jul 4, 2023
1 parent 2f53b6f commit c2ee2e1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/js/src/switchToPos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ async function doSwitchToPos(wsUrl: string, sudoKeyUri: string): Promise<void> {
.sudoUncheckedWeight(callback, overrideWeight)
.signAndSend(keyring, { nonce: -1 }, (result) => {
const finish = (fn: () => void) => {
console.log('finish called');
unsubscribe
.then((unsub) => {
console.log('unsubscribing');
unsub();
console.log('unsubscribed');
fn();
})
.catch(reject);
Expand Down Expand Up @@ -142,9 +145,10 @@ const inputSudoKeyUri = process.argv[3];
const waitNBlocks = process.argv[4] ? parseInt(process.argv[4].trim(), 10) : 0;

const preSwitch = waitNBlocks > 0 ? waitBlocks(inputWsUrl, waitNBlocks) : Promise.resolve();
preSwitch
.then(() => doSwitchToPos(inputWsUrl, inputSudoKeyUri))
.catch((reason) => {
preSwitch.then(
() => doSwitchToPos(inputWsUrl, inputSudoKeyUri),
(reason) => {
console.error(reason);
process.exit(1);
});
},
);

0 comments on commit c2ee2e1

Please sign in to comment.