Skip to content

Commit d80469b

Browse files
committed
chore: update account creation section
1 parent c8795db commit d80469b

File tree

2 files changed

+56
-57
lines changed

2 files changed

+56
-57
lines changed

main/.vitepress/config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ export default defineConfig({
426426
collapsed: true,
427427
items: [
428428
{
429-
text: 'Key Concepts',
429+
text: 'Key Concepts and APIs',
430430
link: '/guides/orchestration/getting-started/key-concepts',
431431
},
432432
{
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,64 @@
11
# Orchestration Key Concepts and APIs
22

3-
This document provides an overview of the fundamental concepts involved in building orchestration smart contracts, focusing on Orchestrator Interface, Orchestration Accounts, and ChainHub.
3+
This document provides an overview of the fundamental concepts involved in building orchestration smart contracts,
4+
focusing on Orchestrator Interface, Orchestration Accounts, and ChainHub.
45

56
## Orchestrator Interface
67

7-
The [`Orchestrator`](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.Orchestrator) interface provides a set of high-level methods to manage and interact with
8-
local and remote chains. Below are the primary methods:
8+
The [`Orchestrator`](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.Orchestrator) interface provides a
9+
set of high-level methods to manage and interact with local and remote chains. Below are the primary methods:
910

1011
### Access Chain Object
1112

12-
- `getChain` retrieves a chain object for the given `chainName` to get access to
13-
chain-specific methods. See [getChain](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.Orchestrator#getChain).
13+
- `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

1515
```javascript
16-
const chain = await orchestrator.getChain('chainName');
17-
```
18-
19-
### Create an Account
20-
21-
- `makeLocalAccount` creates a new account on local chain. See [makeLocalAccount](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.Orchestrator#makeLocalAccount).
22-
23-
```javascript
24-
const localAccount = await orchestrator.makeLocalAccount();
16+
const chain = await orchestrator.getChain('chainName')
2517
```
2618

2719
### Brand Utility Functions
2820

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

3324
```javascript
34-
const brandInfo = orchestrator.getBrandInfo('denom');
25+
const brandInfo = orchestrator.getBrandInfo('denom')
3526
```
3627

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

3930
```javascript
40-
const amount = orchestrator.asAmount({ denom: 'uatom', value: 1000n });
31+
const amount = orchestrator.asAmount({ denom: 'uatom', value: 1000n })
4132
```
4233

4334
## Orchestration Account
4435

45-
Orchestration accounts are a key concept in the Agoric Orchestration API, represented by the
46-
[`OrchestrationAccountI`](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.OrchestrationAccountI) interface. These accounts provide high-level operations for managing
47-
accounts on remote chains, allowing seamless interaction and management of interchain
48-
accounts. The orchestration accounts abstract the complexity of interchain interactions,
49-
providing a unified and simplified interface for developers.
36+
Orchestration accounts are a key concept in the Agoric Orchestration API, represented by the [`OrchestrationAccountI`](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.OrchestrationAccountI)
37+
interface. These accounts provide high-level operations for managing accounts on remote chains, allowing seamless
38+
interaction and management of interchain accounts. The orchestration accounts abstract the complexity of interchain
39+
interactions, providing a unified and simplified interface for developers.
40+
41+
### Account Creation
42+
43+
- `makeAccount` (for a chain object) creates a new account on local and/or remote chain as below.
44+
45+
```javascript
46+
const [agoric, remoteChain] = await Promise.all([
47+
orch.getChain('agoric'),
48+
orch.getChain(chainName)
49+
])
50+
const [localAccount, remoteAccount] = await Promise.all([
51+
agoric.makeAccount(),
52+
remoteChain.makeAccount()
53+
])
54+
```
5055

5156
### Address Management
5257

5358
- `getAddress` retrieves the address of the account on the remote chain.
5459

5560
```javascript
56-
const address = await orchestrationAccount.getAddress();
61+
const address = await orchestrationAccount.getAddress()
5762
```
5863

5964
### Balance Management
@@ -62,49 +67,43 @@ const address = await orchestrationAccount.getAddress();
6267
- `getBalance` retrieves the balance of a specific denom for the account.
6368

6469
```javascript
65-
const balances = await orchestrationAccount.getBalances();
66-
const balance = await orchestrationAccount.getBalance('uatom');
70+
const balances = await orchestrationAccount.getBalances()
71+
const balance = await orchestrationAccount.getBalance('uatom')
6772
```
6873

6974
### Funds Transfer
7075

7176
- `send` transfers an amount to another account on the same chain.
7277
- `transfer` transfers an amount to another account, typically on another chain.
7378
- `transferSteps` transfers an amount in multiple steps, handling complex transfer paths.
74-
- `deposit` deposits payment from Zoe to the account. For remote accounts, an IBC Transfer
75-
will be executed to transfer funds there.
79+
- `deposit` deposits payment from Zoe to the account. For remote accounts, an IBC Transfer will be executed to transfer
80+
funds there.
7681

7782
```javascript
78-
await orchestrationAccount.send(receiverAddress, amount);
79-
await orchestrationAccount.transfer(amount, destinationAddress);
80-
await orchestrationAccount.transferSteps(amount, transferMsg);
81-
await orchestrationAccount.deposit(payment);
83+
await orchestrationAccount.send(receiverAddress, amount)
84+
await orchestrationAccount.transfer(amount, destinationAddress)
85+
await orchestrationAccount.transferSteps(amount, transferMsg)
86+
await orchestrationAccount.deposit(payment)
8287
```
8388

8489
## ChainHub
8590

86-
ChainHub is a centeralized registry of chains, connections, and denoms
87-
that simplifies accessing and interacting with multiple chains, providing
88-
a unified interface for the orchestration logic to manage cross-chain
89-
operations effectively. A chainHub instance can be created using a call
90-
to `makeChainHub` that makes a new ChainHub in the zone (or in the heap
91-
if no [zone](/glossary/#zone) is provided). The resulting object is an [Exo](/glossary/#exo) singleton.
92-
It has no precious state. Its only state is a cache of queries to
93-
`agoricNames` and the info provided in registration calls. When you
94-
need a newer version you can simply make a hub and repeat the registrations.
95-
ChainHub allows dynamic registration and use of chain and connection
96-
information using the following API.
91+
ChainHub is a centralized registry of chains, connections, and denoms that simplifies accessing and interacting with
92+
multiple chains, providing a unified interface for the orchestration logic to manage cross-chain operations effectively.
93+
A chainHub instance can be created using a call to `makeChainHub` that makes a new ChainHub in the zone (or in the heap
94+
if no [zone](/glossary/#zone) is provided). The resulting object is an [Exo](/glossary/#exo) singleton. It has no
95+
precious state. Its only state is a cache of queries to `agoricNames` and the info provided in registration calls. When
96+
you need a newer version you can simply make a hub and repeat the registrations. ChainHub allows dynamic registration
97+
and use of chain and connection information using the following API.
9798

9899
### Registration APIs
99100

100-
- `registerChain` register a new chain with `chainHub`. The name will override
101-
a name in well known chain names. If a durable zone was not provided,
102-
registration will not survive a reincarnation of the vat, and will have to be
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
103103
registered again.
104104
- `registerConnection` registers a connections between two given chain IDs.
105-
- `registerAsset` registers an asset that may be held on a chain other than
106-
the issuing chain. Both corresponding chains should already be registered
107-
before this call.
105+
- `registerAsset` registers an asset that may be held on a chain other than the issuing chain. Both corresponding chains
106+
should already be registered before this call.
108107

109108
### Information Retrieval
110109

@@ -114,19 +113,19 @@ information using the following API.
114113
- `getAsset` retrieves holding, issuing chain names etc. for a denom.
115114
- `getDenom` retrieves denom (string) for a `Brand`.
116115

117-
In the below example, `chainHub` is used to register a new chain and establish a connection
118-
between the Agoric chain and the newly registered chain.
116+
In the below example, `chainHub` is used to register a new chain and establish a connection between the Agoric chain and
117+
the newly registered chain.
119118

120119
```javascript
121-
const chainHub = makeChainHub(privateArgs.agoricNames, vowTools);
120+
const chainHub = makeChainHub(privateArgs.agoricNames, vowTools)
122121

123122
// Register a new chain with its information
124-
chainHub.registerChain(chainKey, chainInfo);
123+
chainHub.registerChain(chainKey, chainInfo)
125124

126125
// Register a connection between the Agoric chain and the new chain
127126
chainHub.registerConnection(
128127
agoricChainInfo.chainId,
129128
chainInfo.chainId,
130-
connectionInfo,
131-
);
129+
connectionInfo
130+
)
132131
```

0 commit comments

Comments
 (0)