aftermath-ts-sdk 2.0.0 → 2.1.0-dev.2dc2267
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 +36 -10
- package/dist/index.d.ts +7637 -5550
- package/dist/index.js +10016 -9006
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm i aftermath-ts-sdk
|
|
|
13
13
|
For most integrations, use the Aftermath SDK for simplified access:
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
|
|
17
|
-
await
|
|
16
|
+
// "MAINNET" | "TESTNET" | "DEVNET" | "LOCAL"
|
|
17
|
+
const afSdk = await Aftermath.create({ network: "MAINNET" });
|
|
18
18
|
|
|
19
19
|
// Access protocols
|
|
20
20
|
const router = afSdk.Router();
|
|
@@ -29,16 +29,19 @@ const dca = afSdk.Dca();
|
|
|
29
29
|
For complex transaction construction, use AftermathApi for direct control:
|
|
30
30
|
|
|
31
31
|
```typescript
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
33
|
+
import { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
|
|
34
|
+
|
|
35
|
+
const afSdk = await Aftermath.create({ network: "MAINNET" });
|
|
36
|
+
const addresses = await afSdk.getAddresses();
|
|
37
|
+
|
|
38
|
+
const fullnodeUrl = "https://fullnode.mainnet.sui.io";
|
|
34
39
|
|
|
35
40
|
const afApi = new AftermathApi(
|
|
36
|
-
new
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}),
|
|
41
|
-
addresses // Configuration addresses
|
|
41
|
+
new SuiGrpcClient({ network: "mainnet", baseUrl: fullnodeUrl }),
|
|
42
|
+
addresses, // Configuration addresses
|
|
43
|
+
// Still required by the few helpers that have no gRPC equivalent — see below
|
|
44
|
+
new SuiJsonRpcClient({ network: "mainnet", url: fullnodeUrl })
|
|
42
45
|
);
|
|
43
46
|
|
|
44
47
|
// Access protocol APIs
|
|
@@ -47,6 +50,29 @@ const stakingApi = afApi.Staking();
|
|
|
47
50
|
const farmsApi = afApi.Farms();
|
|
48
51
|
```
|
|
49
52
|
|
|
53
|
+
`Aftermath.create`'s `fullnodeUrl` option takes a **gRPC base URL** (it is passed
|
|
54
|
+
to `SuiGrpcClient` as `baseUrl`, and to `SuiJsonRpcClient` as `url`). Sui
|
|
55
|
+
fullnodes serve both protocols from the same host, so a single URL is enough.
|
|
56
|
+
|
|
57
|
+
### Remaining JSON-RPC surface
|
|
58
|
+
|
|
59
|
+
Sui JSON-RPC is deprecated and scheduled for removal from fullnodes in
|
|
60
|
+
mid-October 2026. Every fullnode call this SDK makes goes over gRPC **except**
|
|
61
|
+
the following, which cannot be expressed with `SuiGrpcClient` without changing
|
|
62
|
+
what they return:
|
|
63
|
+
|
|
64
|
+
| Helper | Why |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `Events().fetchCastEventsWithCursor` | `suix_queryEvents` has no `SuiGrpcClient` equivalent; `ledgerService.ListEvents` has a different filter model and BCS-only payloads |
|
|
67
|
+
| `Transactions().fetchTransactionsWithCursor` | `suix_queryTransactionBlocks` has no gRPC equivalent at all |
|
|
68
|
+
| `Objects().fetchObject` / `fetchObjectGeneral` / `fetchObjectBatch` / `fetchOwnedObjects` | gRPC returns Move object contents as BCS bytes or as a differently-shaped `json` view, so the parsed `content.fields` these helpers' casters consume cannot be reproduced |
|
|
69
|
+
| `DynamicFields().fetchDynamicFieldObject` | same; gRPC returns the field value as BCS bytes |
|
|
70
|
+
| `Sui().fetchSystemState` (deprecated) | gRPC has no `SuiSystemStateSummary` equivalent |
|
|
71
|
+
|
|
72
|
+
Prefer the Aftermath API (`Aftermath.create(...)`'s high-level providers) for
|
|
73
|
+
events, transaction history and system state — those already avoid the fullnode
|
|
74
|
+
entirely.
|
|
75
|
+
|
|
50
76
|
## Available Protocols
|
|
51
77
|
|
|
52
78
|
### Pools (AMM)
|