Skip to content

Commit fa8b5e0

Browse files
committed
docs; orca dapp UI docs
1 parent 8110710 commit fa8b5e0

File tree

11 files changed

+129
-62
lines changed

11 files changed

+129
-62
lines changed

main/.vitepress/config.mjs

-4
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ export default defineConfig({
137137
text: 'Send Anywhere Example',
138138
link: '/guides/orchestration/contract-walkthrough/send-anywhere',
139139
},
140-
{
141-
text: 'Cross-Chain Swap Example',
142-
link: '/guides/orchestration/contract-walkthrough/cross-chain-swap',
143-
},
144140
{
145141
text: 'Cross-Chain Unbond Example',
146142
link: '/guides/orchestration/contract-walkthrough/cross-chain-unbond',

main/.vitepress/themeConfig/nav.js

-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ export const nav = [
2424
text: 'Send Anywhere Example',
2525
link: '/guides/orchestration/contract-walkthrough/send-anywhere',
2626
},
27-
{
28-
text: 'Cross-Chain Swap Example',
29-
link: '/guides/orchestration/contract-walkthrough/cross-chain-swap',
30-
},
3127
{
3228
text: 'Cross-Chain Unbond Example',
3329
link: '/guides/orchestration/contract-walkthrough/cross-chain-unbond',

main/guides/orchestration/contract-walkthrough/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contract Walkthroughs
22

3-
This section is designed to provide detailed explanations and insights into example orchestration smart contracts.
3+
This section is designed to provide detailed explanations and insights into example Orchestration smart contracts.
44

55
In this section, we will cover two primary contracts:
66

@@ -16,9 +16,9 @@ The "Send Anywhere" contract is a robust and secure solution for transferring as
1616
- Assets are securely held in a local account before being transferred.
1717
- Detailed logs are kept for transparency and error tracing.
1818
- The contract is resilient to failure, with built-in rollback mechanisms.
19-
- By using Agoric’s orchestration tools, this contract provides a secure way to facilitate cross-chain asset transfers.
19+
- By using Agoric’s Orchestration tools, this contract provides a secure way to facilitate cross-chain asset transfers.
2020

21-
[See Contract Overview](/guides/orchestration/getting-started/contract-walkthrough/send-anywhere)
21+
[See Contract Overview](/guides/orchestration/contract-walkthrough/send-anywhere)
2222

2323
## Unbond Contract
2424

@@ -28,4 +28,4 @@ The Unbond Contract focuses on the process of unbonding staked assets and perfor
2828
- Implementing delegation and undelegation logic.
2929
- Managing asynchronous operations and ensuring the completion of long-running processes.
3030

31-
[See Contract Overview](/guides/orchestration/getting-started/contract-walkthrough/cross-chain-unbond)
31+
[See Contract Overview](/guides/orchestration/contract-walkthrough/cross-chain-unbond)

main/guides/orchestration/contract-walkthrough/send-anywhere.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ The contract begins by importing various modules and utilities necessary for its
2626

2727
- **State management**: `makeSharedStateRecord` is imported to create and manage the state across contract incarnations.
2828
- **Type validation**: `AmountShape` and `InvitationShape` ensure that the contract works with correct data types, such as amounts and invitations.
29-
- **Orchestration utilities**: `withOrchestration` is imported to facilitate interactions with orchestration functions.
30-
- **Flows**: The orchestration flows for handling transfers are imported from `send-anywhere.flows.js` to be made available to Zoe.
29+
- **Orchestration utilities**: `withOrchestration` is imported to facilitate interactions with Orchestration functions.
30+
- **Flows**: The Orchestration flows for handling transfers are imported from `send-anywhere.flows.js` to be made available to Zoe.
3131

3232
These imports set up the contract for the validation, orchestration, and execution of transfers through Zoe API.
3333

@@ -204,4 +204,4 @@ The "Send Anywhere" contract is a robust and flexible solution for transferring
204204
- Assets are securely held in a local account before being transferred.
205205
- Detailed logs are kept for transparency and error tracing.
206206
- The contract is resilient to failure, with built-in rollback mechanisms.
207-
- By using Agoric’s orchestration tools, this contract provides a secure way to facilitate cross-chain asset transfers.
207+
- By using Agoric’s Orchestration tools, this contract provides a secure way to facilitate cross-chain asset transfers.

main/guides/orchestration/how-orch-works.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Orchestration relies on protocols and mechanisms that allow blockchains to
44
communicate and transact with each other securely and efficiently. The primary
5-
objectives of orchestration are:
5+
objectives of Orchestration are:
66

77
- **Interoperability:** Enabling different blockchain networks to interact and
88
transact with one another.
@@ -124,10 +124,10 @@ asynchronous, makes it particularly well-suited for Interchain Accounts and
124124
Interchain Queries. When contracts on Agoric interact, the system is designed
125125
to handle cases where the other contract may reside on a remote machine or
126126
another blockchain. This inherent architecture allows Agoric to seamlessly
127-
control and manage Interchain Accounts, further enhancing the orchestration
127+
control and manage Interchain Accounts, further enhancing the Orchestration
128128
capabilities.
129129

130-
By leveraging ICA and ICQ, blockchain orchestration becomes more flexible and
130+
By leveraging ICA and ICQ, Orchestration becomes more flexible and
131131
powerful, enabling direct, programmable interactions between blockchains. This
132132
unlocks a wide range of possibilities, from decentralized finance (DeFi) to
133133
supply chain management and beyond.

main/guides/orchestration/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The Orchestration API handles asynchronous tasks and complex workflows, includin
2222

2323
## Introduction to Orchestration API Flow
2424

25-
The following sequence diagram provides a comprehensive overview of the orchestration process within the Agoric platform. This example illustrates the interaction between various components, highlighting how the orchestration library (`OrchLib`) facilitates cross-chain operations. This is a good first example to understand the flow of the Orchestration API, showing the steps involved in creating and managing cross-chain transactions.
25+
The following sequence diagram provides a comprehensive overview of the Orchestration process within the Agoric platform. This example illustrates the interaction between various components, highlighting how the Orchestration library (`OrchLib`) facilitates cross-chain operations. This is a good first example to understand the flow of the Orchestration API, showing the steps involved in creating and managing cross-chain transactions.
2626

2727
<br/>
2828
<img src="/reference/assets/sequence-diagrams/orchestration-workflow-1.svg" width="100%" />

main/guides/orchestration/key-concepts.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Orchestration Key Concepts and APIs
22

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

66
## Orchestrator Interface
@@ -35,7 +35,7 @@ const amount = orchestrator.asAmount({ denom: 'uatom', value: 1000n });
3535

3636
Orchestration accounts are a key concept in the Agoric Orchestration API, represented by the [`OrchestrationAccountI`](https://agoric-sdk.pages.dev/interfaces/_agoric_orchestration.OrchestrationAccountI)
3737
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
38+
interaction and management of interchain accounts. The Orchestration accounts abstract the complexity of interchain
3939
interactions, providing a unified and simplified interface for developers.
4040

4141
### Account Creation
@@ -89,7 +89,7 @@ await orchestrationAccount.deposit(payment);
8989
## ChainHub
9090

9191
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.
92+
multiple chains, providing a unified interface for the Orchestration logic to manage cross-chain operations effectively.
9393
A chainHub instance can be created using a call to `makeChainHub` that makes a new ChainHub in the zone (or in the heap
9494
if no [zone](/glossary/#zone) is provided). The resulting object is an [Exo](/glossary/#exo) singleton. It has no
9595
precious state. Its only state is a cache of queries to `agoricNames` and the info provided in registration calls. When

main/guides/orchestration/orchestration-basics/contract.md

+59-38
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# Orca Contract Code Walkthrough
22

3-
This section provides a walkthrough of the Orca contract code, explaining its structure, key components, and functionality. The Orca contract is designed to manage orchestration accounts and fund them. It interacts with multiple chains and provides functionality for creating accounts and funding them. The code for the contract logic is in two files:
3+
This section provides a walkthrough of the Orca contract code, explaining its structure, key components, and
4+
functionality. The Orca contract is designed to manage Orchestration accounts and fund them. It interacts with multiple
5+
chains and provides functionality for creating accounts and funding them. The code for the contract logic is in two
6+
files:
47

5-
1. `orca.contract.js`
6-
2. `orca.flows.js`
8+
1. [`orca.contract.js`](https://github.com/Agoric/dapp-orchestration-basics/blob/main/contract/src/orca.contract.js)
9+
2. [`orca.flows.js`](https://github.com/Agoric/dapp-orchestration-basics/blob/main/contract/src/orca.flows.js)
710

811
## Walkthrough: `orca.contract.js`
912

10-
The `orca.contract.js` files brings in necessary dependencies and types from various Agoric packages. The flows import contains specific logic for the Orca contract operations.
13+
The `orca.contract.js` file brings in necessary dependencies and types from various Agoric packages. The `flows` import
14+
contains specific logic for the Orca contract offer handling operations.
1115

1216
```js
1317
import { AmountShape } from '@agoric/ertp';
@@ -21,7 +25,7 @@ import * as flows from './orca.flows.js';
2125

2226
### Type Definitions and Shapes
2327

24-
These definitions create shapes for validating the structure of amounts and orchestration powers.
28+
The following definitions create shapes for validating the structure of `amount` and Orchestration powers.
2529

2630
```js
2731
const SingleAmountRecord = M.and(
@@ -40,7 +44,7 @@ const OrchestrationPowersShape = M.splitRecord({
4044

4145
### Main Contract Function
4246

43-
This is the main contract function that sets up the contract's functionality.
47+
This is the main `contract` function that initializes and sets up the contract's functionality.
4448

4549
```js
4650
const contract = async (
@@ -55,7 +59,7 @@ const contract = async (
5559

5660
Within the `contract` function, following actions are performed.
5761

58-
- **Chain Registration**: Below section registers chains and their connections with the `chainHub`.
62+
- **Chain Registration**: Below code section registers chains and their connections with the `chainHub`.
5963

6064
```js
6165
const { chainDetails } = zcf.getTerms();
@@ -72,15 +76,18 @@ for (const [name, info] of entries(chainDetails)) {
7276
}
7377
```
7478

75-
- **Creating Account and Funding Functions**: These functions are created using the `orchestrateAll` helper, which sets up the necessary flow logic for account creation and funding.
79+
- **Creating Account and Funding Functions**: These functions are created using the `orchestrateAll` helper, which sets
80+
up the necessary flow logic for account creation and funding but the logic is implemented in `orca.flows.js` file
81+
([discussed below](#walkthrough-orcaflowsjs)).
7682

7783
```js
7884
const { makeAccount, makeCreateAndFund } = orchestrateAll(flows, {
7985
localTransfer: zoeTools.localTransfer
8086
});
8187
```
8288

83-
- **Public Facet**: The public facet provides two methods: `makeAccountInvitation` creates an invitation to make an orchestration account, and `makeCreateAndFundInvitation` creates an invitation to make an account and fund it.
89+
- **Public Facet**: The public facet provides two methods: `makeAccountInvitation` creates an invitation to make an
90+
Orchestration account, and `makeCreateAndFundInvitation` creates an invitation to make an account and fund it.
8491

8592
```js
8693
const publicFacet = zone.exo(
@@ -107,7 +114,8 @@ const publicFacet = zone.exo(
107114

108115
### `start` Function
109116

110-
The start function is wrapped with `withOrchestration`, which provides additional orchestration setup and tools for the contract.
117+
The start function is wrapped with `withOrchestration`, which provides additional Orchestration setup and tools for the
118+
contract.
111119

112120
```js
113121
export const start = withOrchestration(contract);
@@ -116,7 +124,8 @@ harden(start);
116124

117125
## Walkthrough `orca.flows.js`
118126

119-
This section provides a walkthrough of the `orca.flows.js` file, which contains flow functions for the Orca contract. The `orca.flows.js` file defines two main functions:
127+
This section provides a walkthrough of the `orca.flows.js` file, which contains flow functions for the Orca contract.
128+
The `orca.flows.js` file defines two main functions:
120129

121130
1. `makeAccount`: Creates an account on a Cosmos chain.
122131
2. `makeCreateAndFund`: Creates an account on a Cosmos chain and funds it.
@@ -125,14 +134,21 @@ These functions are called by the Zoe vat when a user makes an offer using a cor
125134

126135
### `makeAccount` Function
127136

128-
This function creates an account on a specified Cosmos chain. This function not only creates the account but also returns a continuing offer that allows the user to perform further actions like delegation, rewards withdrawl, and transfers. Here are the parameters of this function:
137+
This function creates an account on a specified Cosmos chain. This function not only creates the account but also
138+
returns a continuing offer that allows the user to perform further actions like delegation, rewards withdrawl, and
139+
transfers. Here are the parameters of this function:
140+
141+
- `orch`: An Orchestrator instance parameter represents an instance of the `Orchestrator`, a powerful abstraction that
142+
manages interactions with the blockchain. It provides methods to interact with different chains, create accounts, and
143+
fetch chain information.
129144

130-
- `orch`: An Orchestrator instance parameter represents an instance of the `Orchestrator`, a powerful abstraction that manages interactions with the blockchain. It provides methods to interact with different chains, create accounts, and fetch chain information.
131145
- `_ctx`: Unused context object
132146
- `seat`: A `ZCFSeat` instance. It holds a proposal object corresponding to the current offer.
133-
- `offerArgs`: An object containing `chainName` (that identifies the chain the orchestration account should be created on) and `denom`.
147+
- `offerArgs`: An object containing `chainName` (that identifies the chain the Orchestration account should be created on) and `denom`.
134148

135-
The function validates the `offerArgs` to ensure it contains a `chainName`, retrieves the specified chain using `orch`, creates an account on the chain using `chain.makeAccount()`, and returns the account as a continuing offer. Below is the code of `makeAccount` after removing some debug information logging code.
149+
The function validates the `offerArgs` to ensure it contains a `chainName`, retrieves the specified chain using `orch`,
150+
creates an account on the chain using `chain.makeAccount()`, and returns the account as a continuing offer. Below is the
151+
code of `makeAccount` after removing some debug information logging code.
136152

137153
```js
138154
mustMatch(offerArgs, M.splitRecord({ chainName: M.string() }));
@@ -143,11 +159,14 @@ const chainAccount = await chain.makeAccount();
143159
return chainAccount.asContinuingOffer();
144160
```
145161

146-
Once the account is created, the function returns a continuing offer by calling `chainAccount.asContinuingOffer()`. This allows the user to perform further actions on the account, such as delegating tokens or withdrawing rewards, through subsequent offers.
162+
Once the account is created, the function returns a continuing offer by calling `chainAccount.asContinuingOffer()`. This
163+
allows the user to perform further actions on the account, such as delegating tokens or withdrawing rewards, through
164+
subsequent offers.
147165

148166
### `makeCreateAndFund` Function
149167

150-
This function creates an account on a specified Cosmos chain and funds it. It accepts the same set of parameters as `make Account`. The function:
168+
This function creates an account on a specified Cosmos chain and funds it. It accepts the same set of parameters as
169+
`make Account`. The function:
151170

152171
- Extracts the amount to be transferred from the seat's proposal, and retrieves both the Agoric chain and the specified target chain.
153172
- Fetches chain info and asset information.
@@ -159,27 +178,29 @@ This function creates an account on a specified Cosmos chain and funds it. It ac
159178
Below is the code of `makeCreateAndFund` after removing some debug information logging code.
160179

161180
```js
162-
const { give } = seat.getProposal();
163-
const [[_kw, amt]] = Object.entries(give);
164-
const [agoric, chain] = await Promise.all([
165-
orch.getChain('agoric'),
166-
orch.getChain(chainName),
167-
]);
168-
const localAccount = await agoric.makeAccount();
169-
const remoteAccount = await chain.makeAccount();
170-
const remoteAddress = await remoteAccount.getAddress();
171-
await localTransfer(seat, localAccount, give);
172-
await localAccount.transfer(
173-
{
174-
denom: 'ubld',
175-
value: amt.value / 2n,
176-
},
177-
remoteAddress,
178-
);
179-
seat.exit();
180-
return remoteAccount.asContinuingOffer();
181+
const { give } = seat.getProposal();
182+
const [[_kw, amt]] = Object.entries(give);
183+
const [agoric, chain] = await Promise.all([
184+
orch.getChain('agoric'),
185+
orch.getChain(chainName)
186+
]);
187+
const localAccount = await agoric.makeAccount();
188+
const remoteAccount = await chain.makeAccount();
189+
const remoteAddress = await remoteAccount.getAddress();
190+
await localTransfer(seat, localAccount, give);
191+
await localAccount.transfer(
192+
{
193+
denom: 'ubld',
194+
value: amt.value / 2n
195+
},
196+
remoteAddress
197+
);
198+
seat.exit();
199+
return remoteAccount.asContinuingOffer();
181200
```
182201

183-
As in the previous case, the function returns a continuing offer by calling `remoteAccount.asContinuingOffer()` for further actions on the account.
202+
As in the previous case, the function returns a continuing offer by calling `remoteAccount.asContinuingOffer()` for
203+
further actions on the account.
184204

185-
Apart from above mentioned logic, several trace calls are made to log the current state of the function. This is useful for debugging and ensuring that the function's inputs and intermediate states are correct.
205+
Apart from above mentioned logic, several trace calls are made to log the current state of the function. This is useful
206+
for debugging and ensuring that the function's inputs and intermediate states are correct.

main/guides/orchestration/orchestration-basics/index.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
To get started with developing using the Orchestration API, developers can make use of our [dapp-orchestration-basics](https://github.com/Agoric/dapp-orchestration-basics) template.
44

5-
Following the dApp pattern of our existing dapp templates, `dapp-orchestration-basics` contains both ui & contract directory within a single yarn workspace. In this walkthrough, we learn about the installation process, the contract code, and UI components of `dapp-orchestration-basics`.
5+
Following the dApp pattern of our existing dapp templates, `dapp-orchestration-basics` also contains a `contract` and a `ui`
6+
directory within a single yarn workspace. In this walkthrough, we learn about the installation process, the contract
7+
code, and UI components of `dapp-orchestration-basics`.
68

79
1. [Installation and Deployment](installation)
810
2. [Contract Code Walkthrough](contract)

0 commit comments

Comments
 (0)