Skip to content

Commit f8674ce

Browse files
committed
Update README.md
1 parent 11a15d5 commit f8674ce

File tree

4 files changed

+57
-38
lines changed

4 files changed

+57
-38
lines changed

README.md

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ It polls the RPC periodically, automatically batching and de-duping requests for
1414

1515
See https://github.com/p2p-org/p2p-agoric-vstorage-viewer to explore vstorage more.
1616

17-
*package.json:*
18-
```
19-
"@agoric/rpc": "^0.4.1-dev-7cf64bb.0"
20-
```
21-
22-
23-
*app.ts:*
2417
```ts
2518
import {
2619
makeAgoricChainStorageWatcher,
@@ -31,7 +24,7 @@ const watcher = makeAgoricChainStorageWatcher(rpc, chainName);
3124

3225
// Watch vstorage children at a given node.
3326
const stopWatching = watcher.watchLatest<string[]>(
34-
[Kind.Children, 'published.vaultFactory.managers',
27+
[Kind.Children, 'published.vaultFactory.managers'],
3528
managerIds => {
3629
console.log('Got vault manager IDs:', managerIds);
3730
}
@@ -42,7 +35,7 @@ stopWatching();
4235

4336
// Watch vstorage data at a given node.
4437
watcher.watchLatest<Brands>(
45-
[Kind.Data, 'published.agoricNames.brand',
38+
[Kind.Data, 'published.agoricNames.brand'],
4639
brands => {
4740
console.log('Do something with the brands');
4841
}
@@ -51,14 +44,6 @@ watcher.watchLatest<Brands>(
5144

5245
## Connecting to User's Account (Keplr)
5346

54-
*package.json:*
55-
```
56-
"@agoric/notifier": "^0.6.2",
57-
"@agoric/rpc": "^0.4.1-dev-7cf64bb.0",
58-
"@agoric/web-components": "0.10.1-dev-7cf64bb.0"
59-
```
60-
61-
*app.ts:*
6247
```ts
6348
import { subscribeLatest } from '@agoric/notifier';
6449
import { makeAgoricChainStorageWatcher } from '@agoric/rpc';
@@ -75,13 +60,6 @@ for await (const purses of subscribeLatest(pursesNotifier)) {
7560

7661
## Executing Offers
7762

78-
*package.json:*
79-
```
80-
"@agoric/rpc": "^0.4.1-dev-7cf64bb.0",
81-
"@agoric/web-components": "0.10.1-dev-7cf64bb.0"
82-
```
83-
84-
*app.ts:*
8563
```ts
8664
import { makeAgoricChainStorageWatcher } from '@agoric/rpc';
8765
import { makeAgoricWalletConnection } from '@agoric/web-components';
@@ -99,6 +77,7 @@ connection.makeOffer(
9977
callPipe: [
10078
['getSwapManagerForBrand', [amountToGive.brand]],
10179
['makeSwapOffer']
80+
]
10281
},
10382
{
10483
give: { In: amountToGive },
@@ -113,7 +92,7 @@ connection.makeOffer(
11392
console.log('Transaction submitted:', data.txn);
11493
console.log('Offer id:', data.offerId);
11594
}
116-
if (status === 'refunded')
95+
if (status === 'refunded') {
11796
console.log('Offer refunded');
11897
}
11998
if (status === 'accepted') {

packages/rpc/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
For more complete examples and setup see [Agoric/ui-kit](https://github.com/Agoric/ui-kit)
2+
3+
```ts
4+
import {
5+
makeAgoricChainStorageWatcher,
6+
AgoricChainStoragePathKind as Kind
7+
} from '@agoric/rpc';
8+
9+
const watcher = makeAgoricChainStorageWatcher(rpc, chainName);
10+
11+
// Watch vstorage children at a given node.
12+
const stopWatching = watcher.watchLatest<string[]>(
13+
[Kind.Children, 'published.vaultFactory.managers'],
14+
managerIds => {
15+
console.log('Got vault manager IDs:', managerIds);
16+
}
17+
)
18+
19+
// Stop watching.
20+
stopWatching();
21+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Linting and formatting
2+
3+
To scan the package for linting and formatting errors, run
4+
5+
```bash
6+
yarn lint
7+
```
8+
9+
To automatically fix linting and formatting errors, run
10+
11+
```bash
12+
yarn format
13+
```
14+
15+
## Tooling configs
16+
17+
For most of the tools, the configuration is in the `package.json` to minimize
18+
the amount of files in this package.

packages/web-components/README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
## Linting and formatting
1+
For complete examples and setup see [Agoric/ui-kit](https://github.com/Agoric/ui-kit)
22

3-
To scan the package for linting and formatting errors, run
3+
```ts
4+
import { subscribeLatest } from '@agoric/notifier';
5+
import { makeAgoricChainStorageWatcher } from '@agoric/rpc';
6+
import { makeAgoricWalletConnection } from '@agoric/web-components';
47

5-
```bash
6-
yarn lint
7-
```
8+
const watcher = makeAgoricChainStorageWatcher(rpc, chainName);
9+
const connection = await makeAgoricWalletConnection(watcher);
10+
const {pursesNotifier, publicSubscribersNotifier} = chainConnection;
811

9-
To automatically fix linting and formatting errors, run
12+
// Sign an on-chain offer transaction.
13+
connection.makeOffer(...offer);
1014

11-
```bash
12-
yarn format
15+
// Read the user's token balances.
16+
for await (const purses of subscribeLatest(pursesNotifier)) {
17+
console.log('Got user purses:', purses);
18+
}
1319
```
14-
15-
## Tooling configs
16-
17-
For most of the tools, the configuration is in the `package.json` to minimize
18-
the amount of files in this package.

0 commit comments

Comments
 (0)