Skip to content

Commit

Permalink
chore: merged key concepts and API in orch
Browse files Browse the repository at this point in the history
  • Loading branch information
amessbee committed Sep 23, 2024
1 parent be956dc commit 64d7e64
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions main/guides/orchestration/getting-started/key-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ This document provides an overview of the fundamental concepts involved in build

## Orchestrator Interface

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

### Access Chain Object

- `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).
- `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');
Expand Down Expand Up @@ -40,7 +42,11 @@ const amount = orchestrator.asAmount({ denom: 'uatom', value: 1000n });

## Orchestration Account

Orchestration accounts are a key concept in the Agoric Orchestration API, represented by the [`OrchestrationAccountI`](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.OrchestrationAccountI) interface. These accounts provide high-level operations for managing accounts on remote chains, allowing seamless interaction and management of interchain accounts. The orchestration accounts abstract the complexity of interchain interactions, providing a unified and simplified interface for developers.
Orchestration accounts are a key concept in the Agoric Orchestration API, represented by the
[`OrchestrationAccountI`](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.OrchestrationAccountI) interface. These accounts provide high-level operations for managing
accounts on remote chains, allowing seamless interaction and management of interchain
accounts. The orchestration accounts abstract the complexity of interchain interactions,
providing a unified and simplified interface for developers.

### Address Management

Expand Down Expand Up @@ -76,23 +82,39 @@ await orchestrationAccount.deposit(payment);

## ChainHub

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

### Registration APIs

- `registerChain` registers 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.
- `registerConnection` registers a connection 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.
- `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.
- `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.

### Information Retrieval

- `getChainInfo` takes a chain name to get chain info.
- `getConnectionInfo` returns `Vow<IBCConnectionInfo>` for two given chain IDs.
- `getChainsAndConnection` is used to get chain and connection info given primary and counter chain names.
- `getAsset` retrieves holding, issuing chain names, etc. for a denom.
- `getChainsAndConnection` is used to get chain and connection info give primary and counter chain names.
- `getAsset` retrieves holding, issuing chain names etc. for a denom.
- `getDenom` retrieves denom (string) for a `Brand`.

In the below example, `chainHub` is used to register a new chain and establish a connection between the Agoric chain and the newly registered chain.
In the below example, `chainHub` is used to register a new chain and establish a connection
between the Agoric chain and the newly registered chain.

```javascript
const chainHub = makeChainHub(privateArgs.agoricNames, vowTools);
Expand Down

0 comments on commit 64d7e64

Please sign in to comment.