| 7 | import { DefaultWaitOpts, type WaitOpts } from '../contract/wait_opts.js'; |
| 8 | |
| 9 | export const waitForNode = async (node: AztecNode, logger?: Logger) => { |
| 10 | await retryUntil(async () => { |
| 11 | try { |
| 12 | logger?.verbose('Attempting to contact Aztec node...'); |
| 13 | await node.getNodeInfo(); |
| 14 | logger?.verbose('Contacted Aztec node'); |
| 15 | return true; |
| 16 | } catch { |
| 17 | logger?.verbose('Failed to contact Aztec Node'); |
| 18 | } |
| 19 | return undefined; |
| 20 | }, 'RPC Get Node Info'); |
| 21 | }; |
| 22 | |
| 23 | /** Returns true if the receipt status is at least the desired status level. */ |
| 24 | function hasReachedStatus(receipt: TxReceipt, desiredStatus: TxStatus): boolean { |