Skip to content

Commit 24b95aa

Browse files
committed
update readme file
1 parent 010b316 commit 24b95aa

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

packages/tfchain_client/README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,41 @@ There are 2 types of client. one for just query the chain and the other one for
1616
import 'package:tfchain_client/tfchain_client.dart';
1717
1818
final client = QueryClient("wss://tfchain.dev.grid.tf/ws");
19-
client.connect();
19+
await client.connect();
2020
final contract = await client.contracts.get(contractId: BigInt.from(123456));
2121
print(contract!.toJson());
22-
client.disconnect();
22+
await client.disconnect();
2323
```
2424

2525
### Full Client
2626

2727
```dart
28-
final client = Client("wss://tfchain.dev.grid.tf/ws", "your-mnemonic");
28+
final client = Client("wss://tfchain.dev.grid.tf/ws", "your-mnemonic", "sr25519");
2929
client.connect();
30-
final extrinsic = await client.clientFarms.create(CreateFarmOptions(name: "name"));
31-
await client.apply(extrinsic);
32-
client.disconnect();
30+
final farmId = await client.farma.create(CreateFarmOptions(name: "name"));
31+
print(farmId);
32+
await client.disconnect();
3333
```
3434

3535
## Run Tests
36+
### Prerequisites
37+
38+
1- Provide your mnemonic as environment variable.
39+
```bash
40+
export MNEMONIC="your-mnemonic"
41+
```
42+
2- provide chain url and the signing type.
43+
By default the chain url is set to `wss://tfchain.dev.grid.tf/ws` and the signing type is `sr25519`. Note that signing type can be either `sr25519` or `ed25519`.
44+
```bash
45+
export LINK="chain_url"
46+
```
47+
```bash
48+
export SIGN_TYPE="sr25519"
49+
```
50+
51+
52+
53+
3654

3755
To run the tests, run the following command
3856

0 commit comments

Comments
 (0)