Skip to content

Commit 6914698

Browse files
committed
chore: simplify registerChain
1 parent 1ac54e6 commit 6914698

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

main/guides/orchestration/getting-started/key-concepts.md

+24-26
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ set of high-level methods to manage and interact with local and remote chains. B
1212

1313
- `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).
1414

15-
```javascript
16-
const chain = await orchestrator.getChain('chainName')
15+
```js
16+
const chain = await orchestrator.getChain('chainName');
1717
```
1818

1919
### Brand Utility Functions
2020

2121
- `getBrandInfo` returns information about a `denom`, including the equivalent local Brand, the chain where the denom is
2222
held, and the chain that issues the corresponding asset. See [getBrandInfo](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.Orchestrator#getBrandInfo).
2323

24-
```javascript
25-
const brandInfo = orchestrator.getBrandInfo('denom')
24+
```js
25+
const brandInfo = orchestrator.getBrandInfo('denom');
2626
```
2727

2828
- `asAmount` converts a denom amount to an `Amount` with a brand. See [asAmount](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.Orchestrator#asAmount).
2929

30-
```javascript
31-
const amount = orchestrator.asAmount({ denom: 'uatom', value: 1000n })
30+
```js
31+
const amount = orchestrator.asAmount({ denom: 'uatom', value: 1000n });
3232
```
3333

3434
## Orchestration Account
@@ -42,33 +42,33 @@ interactions, providing a unified and simplified interface for developers.
4242

4343
- `makeAccount` (for a chain object) creates a new account on local and/or remote chain as below.
4444

45-
```javascript
45+
```js
4646
const [agoric, remoteChain] = await Promise.all([
4747
orch.getChain('agoric'),
4848
orch.getChain(chainName)
49-
])
49+
]);
5050
const [localAccount, remoteAccount] = await Promise.all([
5151
agoric.makeAccount(),
5252
remoteChain.makeAccount()
53-
])
53+
]);
5454
```
5555

5656
### Address Management
5757

5858
- `getAddress` retrieves the address of the account on the remote chain.
5959

60-
```javascript
61-
const address = await orchestrationAccount.getAddress()
60+
```js
61+
const address = await orchestrationAccount.getAddress();
6262
```
6363

6464
### Balance Management
6565

6666
- `getBalances` returns an array of amounts for every balance in the account.
6767
- `getBalance` retrieves the balance of a specific denom for the account.
6868

69-
```javascript
70-
const balances = await orchestrationAccount.getBalances()
71-
const balance = await orchestrationAccount.getBalance('uatom')
69+
```js
70+
const balances = await orchestrationAccount.getBalances();
71+
const balance = await orchestrationAccount.getBalance('uatom');
7272
```
7373

7474
### Funds Transfer
@@ -79,11 +79,11 @@ const balance = await orchestrationAccount.getBalance('uatom')
7979
- `deposit` deposits payment from Zoe to the account. For remote accounts, an IBC Transfer will be executed to transfer
8080
funds there.
8181

82-
```javascript
83-
await orchestrationAccount.send(receiverAddress, amount)
84-
await orchestrationAccount.transfer(amount, destinationAddress)
85-
await orchestrationAccount.transferSteps(amount, transferMsg)
86-
await orchestrationAccount.deposit(payment)
82+
```js
83+
await orchestrationAccount.send(receiverAddress, amount);
84+
await orchestrationAccount.transfer(amount, destinationAddress);
85+
await orchestrationAccount.transferSteps(amount, transferMsg);
86+
await orchestrationAccount.deposit(payment);
8787
```
8888

8989
## ChainHub
@@ -98,9 +98,7 @@ and use of chain and connection information using the following APIs:
9898

9999
### Registration APIs
100100

101-
- `registerChain` register a new chain with `chainHub`. The name will override a name in well-known chain names. If a
102-
durable zone was not provided, registration will not survive a reincarnation of the vat, and will have to be
103-
registered again.
101+
- `registerChain` register a new chain with `chainHub`. The name will override a name in well-known chain names.
104102
- `registerConnection` registers a connections between two given chain IDs.
105103
- `registerAsset` registers an asset that may be held on a chain other than the issuing chain. Both corresponding chains
106104
should already be registered before this call.
@@ -116,16 +114,16 @@ and use of chain and connection information using the following APIs:
116114
In the below example, `chainHub` is used to register a new chain and establish a connection between the Agoric chain and
117115
the newly registered chain.
118116

119-
```javascript
120-
const chainHub = makeChainHub(privateArgs.agoricNames, vowTools)
117+
```js
118+
const chainHub = makeChainHub(privateArgs.agoricNames, vowTools);
121119

122120
// Register a new chain with its information
123-
chainHub.registerChain(chainKey, chainInfo)
121+
chainHub.registerChain(chainKey, chainInfo);
124122

125123
// Register a connection between the Agoric chain and the new chain
126124
chainHub.registerConnection(
127125
agoricChainInfo.chainId,
128126
chainInfo.chainId,
129127
connectionInfo
130-
)
128+
);
131129
```

0 commit comments

Comments
 (0)