aftermath-ts-sdk 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,29 +1,57 @@
|
|
|
1
|
-
# Aftermath TypeScript SDK
|
|
1
|
+
# Aftermath TypeScript SDK
|
|
2
2
|
|
|
3
3
|
## Install
|
|
4
4
|
|
|
5
|
-
```
|
|
5
|
+
```bash
|
|
6
6
|
npm i aftermath-ts-sdk
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
|
+
Create an instance of `Aftermath` for ease of use to make calls to our server, or create an instance of `AftermathApi` for finer control of transaction construction.
|
|
12
|
+
|
|
13
|
+
## Aftermath SDK
|
|
14
|
+
|
|
11
15
|
### 1. Create Aftermath provider
|
|
12
16
|
|
|
17
|
+
```ts
|
|
18
|
+
const afSdk = new Aftermath("MAINNET"); // "MAINNET" | "TESTNET" | "DEVNET"
|
|
13
19
|
```
|
|
14
|
-
const af = new Aftermath("TESTNET");
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
### 2. Create protocol provider
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const router = afSdk.Router();
|
|
25
|
+
const pools = afSdk.Pools();
|
|
26
|
+
const staking = afSdk.Staking();
|
|
27
|
+
const farms = afSdk.Farms();
|
|
20
28
|
```
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
## Aftermath API
|
|
23
31
|
|
|
32
|
+
### 1. Create Aftermath Api provider
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const fullnodeEndpoint = "https://fullnode.mainnet.sui.io";
|
|
36
|
+
const addresses = {...};
|
|
37
|
+
|
|
38
|
+
const afApi = new AftermathApi(
|
|
39
|
+
new SuiClient({
|
|
40
|
+
transport: new SuiHTTPTransport({
|
|
41
|
+
url: fullnodeEndpoint,
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
addresses,
|
|
45
|
+
new IndexerCaller("MAINNET"), // "MAINNET" | "TESTNET" | "DEVNET"
|
|
46
|
+
);
|
|
24
47
|
```
|
|
25
|
-
|
|
26
|
-
|
|
48
|
+
|
|
49
|
+
### 2. Create protocol provider
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
const poolsApi = afApi.Pools();
|
|
53
|
+
const stakinApi = afApi.Staking();
|
|
54
|
+
const farmsApi = afApi.Farms();
|
|
27
55
|
```
|
|
28
56
|
|
|
29
|
-
Find the complete documentation for using our router
|
|
57
|
+
Find the complete documentation for using our router, AMM pools, liquid staking, and more in our [GitBook](https://docs.aftermath.finance/aftermath-typescript-sdk/getting-started).
|