MCPcopy Create free account
hub / github.com/cardstack/cardstack / awaitBridgedToLayer2

Function awaitBridgedToLayer2

packages/cardpay-cli/bridge.ts:99–114  ·  view source on GitHub ↗
(
  network: string,
  fromBlock: string,
  recipient: string | undefined,
  mnemonic?: string
)

Source from the content-addressed store, hash-verified

97}
98
99export async function awaitBridgedToLayer2(
100 network: string,
101 fromBlock: string,
102 recipient: string | undefined,
103 mnemonic?: string
104): Promise<void> {
105 let web3 = await getWeb3(network, mnemonic);
106 let tokenBridge = await getSDK('TokenBridgeHomeSide', web3);
107 recipient = recipient ?? (await web3.eth.getAccounts())[0];
108
109 let blockExplorer = await getConstant('blockExplorer', web3);
110
111 console.log(`Waiting for bridging to complete for depot owner ${recipient} from block ${fromBlock}...`);
112 let result = await tokenBridge.waitForBridgingToLayer2Completed(recipient, fromBlock);
113 console.log(`Bridging transaction hash: ${blockExplorer}/tx/${result.transactionHash}`);
114}

Callers 1

index.tsFile · 0.70

Calls 5

getWeb3Function · 0.90
getSDKFunction · 0.90
getConstantFunction · 0.90
logMethod · 0.45

Tested by

no test coverage detected