|
1 | 1 | # Agoric REPL
|
2 | 2 |
|
3 |
| -**Note**: This page describes the Agoric REPL. |
4 |
| -If you are instead looking for information about `node` or the Node.js REPL, see |
5 |
| -[Node.js documentation](https://nodejs.org/api/repl.html). |
6 |
| - |
7 |
| -## Introduction |
8 |
| - |
9 |
| -When you run `agoric start --reset`, you start a local _ag-solo_. |
10 |
| - |
11 |
| -You use `agoric start` to start what we call an _ag-solo_, which is a |
12 |
| -single personal local Agoric node. You need an ag-solo running on your |
13 |
| -machine to interact with Agoric network services, whether a built-in |
14 |
| -simulated chain (also started by `agoric start`), or a fully-decentralized public Agoric |
15 |
| -blockchain. |
16 |
| - |
17 |
| -All deployment happens via the local running Agoric process. This is usually the |
18 |
| -ag-solo process, and frequently referred to as that or just as ag-solo. It is also |
19 |
| -sometimes described as/called an Agoric VM or a local server. |
20 |
| - |
21 |
| -An ag-solo communicates with either a locally running or remote chain. This local process (the ag-solo) |
22 |
| -has a home object, which contains references to services on-chain, including Zoe, the |
23 |
| -Board for sharing objects, and an application user's Wallet, among others. Developers can |
24 |
| -use these service references to call the service's associated API commands. |
25 |
| - |
26 |
| -Contract code starts in a file on a user's computer, either written by them or |
27 |
| -imported from `agoric/zoe`. The code is _bundled_; turned into a particularly formatted |
28 |
| -blob of code that exists in memory while a deploy script is running. When `E(zoe).install()` is |
29 |
| -called, the blob is sent to and stored on-chain so that Zoe can access it. |
30 |
| - |
31 |
| -An ag-solo has an associated REPL (_Read-Eval-Print Loop_). From the REPL and the `home` |
32 |
| -object, developers can use all the on-chain commands that deployment scripts use to |
33 |
| -deploy contracts and Dapps. In addition to the on-chain commands, they can also run |
34 |
| -any other JavaScript commands from the REPL. |
35 |
| - |
36 |
| -## Accessing the REPL |
37 |
| - |
38 |
| -Once an ag-solo is running and on-chain, you can access its associated REPL |
39 |
| -in two ways. |
40 |
| - |
41 |
| -- In a browser tab, go to `localhost:8000`. Depending on the browser's width, you |
42 |
| - will see the Wallet UI and REPL either in separate columns or separate rows. |
43 |
| - |
44 |
| - |
45 |
| - |
46 |
| - |
47 |
| - |
48 |
| -- From a shell, run `agoric open --repl` This opens the user's Wallet UI and its |
49 |
| - associated REPL. To open only the REPL, run `agoric open --repl only` |
50 |
| - |
51 |
| - |
52 |
| - |
53 |
| -## Using the REPL |
54 |
| - |
55 |
| -You can run JavaScript commands from the REPL. You can also use the REPL's |
56 |
| -`home` object's predefined connections to other objects and services. To see what’s |
57 |
| -available, just type `home` into the REPL: |
58 |
| - |
59 |
| - |
60 |
| - |
61 |
| -```js |
62 |
| -Command[1] home |
63 |
| -History[1] {"chainTimerService":[Presence o-50],"contractHost":[Presence o-52],"ibcport":[Presence o-53],"registrar":[Presence o-54],"registry":[Presence o-55],"zoe":[Presence o-56],"localTimerService":[Presence o-57],"uploads":[Presence o-58],"spawner":[Presence o-59],"wallet":[Presence o-60],"network":[Presence o-61],"http":[Presence o-62]} |
64 |
| -``` |
65 |
| - |
66 |
| -The results of what is entered into the REPL is saved under `history[N]` |
67 |
| - |
68 |
| -The following sections describe the `home` objects developers can use. Click on the |
69 |
| -section header to go to more detailed documentation about that object. |
70 |
| -Several `home` objects are either for internal Agoric use only or have been deprecated. These |
71 |
| -are listed together in the final section. External developers should ignore them and not try to use |
72 |
| -them. |
73 |
| - |
74 |
| -### [`wallet`](../wallet-api/) |
75 |
| - |
76 |
| -Holds on-chain digital assets and object capabilities on behalf of the user. |
77 |
| -The header link takes you to the standard non-REPL specific `wallet` API documentation. When calling |
78 |
| -`wallet` API methods from the REPL, `wallet` must be prefaced by `home.` and use `E()`. For |
79 |
| -example, `E(home.wallet).getPurses()`. [Full Wallet API documentation.](/guides/wallet/) |
80 |
| - |
81 |
| -### [`chainTimerService`](./timerServices) |
82 |
| - |
83 |
| -On-chain time authority used to schedule events. [Full `chainTimerService` documentation.](./timerServices) |
84 |
| - |
85 |
| -### [`localTimerService`](./timerServices) |
86 |
| - |
87 |
| -Local off-chain time authority used to schedule events. [Full `localTimerService` documentation.](./timerServices) |
88 |
| - |
89 |
| -### [`board`](./board) |
90 |
| - |
91 |
| -Shared on-chain location where users can post generally accessible values. [Full `board` documentation.](./board) |
92 |
| - |
93 |
| -### [`ibcport`](./networking) |
94 |
| - |
95 |
| -IBC implementation that lets vats open and close listening ports, |
96 |
| -connect and disconnect to/from remote ports, and send and receive |
97 |
| -data over those connections. [Full `ibcport` documentation.](./networking) |
98 |
| - |
99 |
| -### [`zoe`](../zoe-api/zoe) |
100 |
| - |
101 |
| -Deploy and interact with smart contracts. Zoe protects smart contract users by escrowing |
102 |
| -digital assets and guaranteeing users get either what they want or get a refund of what |
103 |
| -they escrowed. Even if the contract is buggy or malicious. The header link takes you to the |
104 |
| -standard, non-REPL specific, `zoe` API documentation. When calling any of the `zoe` API |
105 |
| -methods from the REPL, `zoe` must be prefaced by `home.` and use `E()`. For |
106 |
| -example, `E(home.zoe).getFoo()`. [Full Zoe API documentation.](../zoe-api/zoe) |
107 |
| - |
108 |
| -### [`priceAuthority`](./priceAuthority) |
109 |
| - |
110 |
| -Get price quotes for pairs of digital assets. [Full `priceAuthority` documentation.](./priceAuthority) |
111 |
| - |
112 |
| -### [`scratch`](./scratch) |
113 |
| - |
114 |
| -An off-chain, private, place to store key-value pairs on your ag-solo for later use. [Full `scratch` documentation.](./scratch) |
115 |
| - |
116 |
| -### Deprecated and Internal-Only Objects |
117 |
| - |
118 |
| -- `contractHost`: Replaced by the `spawner` object. |
119 |
| -- `faucet`: Internal for chain setup. |
120 |
| -- `http`: `api/deploy.js` uses this to install new HTTP and WebSocket handlers in an |
121 |
| - ag-solo. You should not need to use it. |
122 |
| -- `network`: Privileged object for internal use. [Full Network documentation.](./networking) |
123 |
| -- `plugin`: Privileged object for internal use. |
124 |
| -- `priceAuthorityAdmin`: Privileged object for internal use. |
125 |
| -- `registrar`: Deprecated. |
126 |
| -- `registry`: Deprecated. |
127 |
| -- `spawner`: Privileged object for internal use. |
128 |
| -- `uploads`: Deprecated name for `scratch`. |
129 |
| -- `vattp`: Privileged object for internal use. |
| 3 | +**Note**: Agoric REPL has been deprecated. Please see [Testing a Contract](/guides/zoe/contract-hello#testing-a-contract) |
| 4 | +for information on how to test your smart contracts using [AVA](https://github.com/avajs/ava). |
0 commit comments