From d0ba3080a4e28bc2eb946ace06c61e3852ba8d5e Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Wed, 25 Sep 2024 15:21:03 +0500 Subject: [PATCH] chore: simplify `registerChain` --- .../getting-started/key-concepts.md | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/main/guides/orchestration/getting-started/key-concepts.md b/main/guides/orchestration/getting-started/key-concepts.md index c210a313e..4d07b0539 100644 --- a/main/guides/orchestration/getting-started/key-concepts.md +++ b/main/guides/orchestration/getting-started/key-concepts.md @@ -13,7 +13,7 @@ set of high-level methods to manage and interact with local and remote chains. B - `getChain` retrieves a chain object for the given `chainName` to get access to chain-specific methods. See [getChain](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.Orchestrator#getChain). ```javascript -const chain = await orchestrator.getChain('chainName') +const chain = await orchestrator.getChain('chainName'); ``` ### Brand Utility Functions @@ -22,13 +22,13 @@ const chain = await orchestrator.getChain('chainName') held, and the chain that issues the corresponding asset. See [getBrandInfo](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.Orchestrator#getBrandInfo). ```javascript -const brandInfo = orchestrator.getBrandInfo('denom') +const brandInfo = orchestrator.getBrandInfo('denom'); ``` - `asAmount` converts a denom amount to an `Amount` with a brand. See [asAmount](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.Orchestrator#asAmount). ```javascript -const amount = orchestrator.asAmount({ denom: 'uatom', value: 1000n }) +const amount = orchestrator.asAmount({ denom: 'uatom', value: 1000n }); ``` ## Orchestration Account @@ -45,12 +45,12 @@ interactions, providing a unified and simplified interface for developers. ```javascript const [agoric, remoteChain] = await Promise.all([ orch.getChain('agoric'), - orch.getChain(chainName) -]) + orch.getChain(chainName), +]); const [localAccount, remoteAccount] = await Promise.all([ agoric.makeAccount(), - remoteChain.makeAccount() -]) + remoteChain.makeAccount(), +]); ``` ### Address Management @@ -58,7 +58,7 @@ const [localAccount, remoteAccount] = await Promise.all([ - `getAddress` retrieves the address of the account on the remote chain. ```javascript -const address = await orchestrationAccount.getAddress() +const address = await orchestrationAccount.getAddress(); ``` ### Balance Management @@ -67,8 +67,8 @@ const address = await orchestrationAccount.getAddress() - `getBalance` retrieves the balance of a specific denom for the account. ```javascript -const balances = await orchestrationAccount.getBalances() -const balance = await orchestrationAccount.getBalance('uatom') +const balances = await orchestrationAccount.getBalances(); +const balance = await orchestrationAccount.getBalance('uatom'); ``` ### Funds Transfer @@ -80,10 +80,10 @@ const balance = await orchestrationAccount.getBalance('uatom') funds there. ```javascript -await orchestrationAccount.send(receiverAddress, amount) -await orchestrationAccount.transfer(amount, destinationAddress) -await orchestrationAccount.transferSteps(amount, transferMsg) -await orchestrationAccount.deposit(payment) +await orchestrationAccount.send(receiverAddress, amount); +await orchestrationAccount.transfer(amount, destinationAddress); +await orchestrationAccount.transferSteps(amount, transferMsg); +await orchestrationAccount.deposit(payment); ``` ## ChainHub @@ -98,9 +98,7 @@ and use of chain and connection information using the following APIs: ### Registration APIs -- `registerChain` register a new chain with `chainHub`. The name will override a name in well-known chain names. If a - durable zone was not provided, registration will not survive a reincarnation of the vat, and will have to be - registered again. +- `registerChain` register a new chain with `chainHub`. The name will override a name in well-known chain names. - `registerConnection` registers a connections between two given chain IDs. - `registerAsset` registers an asset that may be held on a chain other than the issuing chain. Both corresponding chains should already be registered before this call. @@ -117,15 +115,15 @@ In the below example, `chainHub` is used to register a new chain and establish a the newly registered chain. ```javascript -const chainHub = makeChainHub(privateArgs.agoricNames, vowTools) +const chainHub = makeChainHub(privateArgs.agoricNames, vowTools); // Register a new chain with its information -chainHub.registerChain(chainKey, chainInfo) +chainHub.registerChain(chainKey, chainInfo); // Register a connection between the Agoric chain and the new chain chainHub.registerConnection( agoricChainInfo.chainId, chainInfo.chainId, - connectionInfo -) + connectionInfo, +); ```