@nadohq/client 0.8.0 → 0.10.0
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 +94 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -1,3 +1,96 @@
|
|
|
1
1
|
# `@nadohq/client`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The main entry point for the Nado TypeScript SDK. Composes the engine, indexer, trigger, and shared packages into a single `NadoClient` with domain-specific APIs for market data, trading, collateral management, and real-time subscriptions.
|
|
4
|
+
|
|
5
|
+
[Full SDK Documentation](https://nadohq.github.io/nado-typescript-sdk/index.html)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @nadohq/client viem bignumber.js
|
|
11
|
+
# or
|
|
12
|
+
yarn add @nadohq/client viem bignumber.js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`viem` and `bignumber.js` are peer dependencies and must be installed separately.
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { createNadoClient } from '@nadohq/client';
|
|
21
|
+
import { createPublicClient, createWalletClient, http } from 'viem';
|
|
22
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
23
|
+
import { ink } from 'viem/chains';
|
|
24
|
+
|
|
25
|
+
const account = privateKeyToAccount('0x...');
|
|
26
|
+
|
|
27
|
+
const publicClient = createPublicClient({
|
|
28
|
+
chain: ink,
|
|
29
|
+
transport: http(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const walletClient = createWalletClient({
|
|
33
|
+
account,
|
|
34
|
+
chain: ink,
|
|
35
|
+
transport: http(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const client = createNadoClient('inkMainnet', {
|
|
39
|
+
publicClient,
|
|
40
|
+
walletClient,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Query all markets
|
|
44
|
+
const markets = await client.market.getAllMarkets();
|
|
45
|
+
|
|
46
|
+
// Place a perp order
|
|
47
|
+
await client.market.placeOrder({
|
|
48
|
+
/* order params */
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Get subaccount summary
|
|
52
|
+
const summary = await client.subaccount.getSummary({
|
|
53
|
+
/* subaccount params */
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## API Overview
|
|
58
|
+
|
|
59
|
+
The `NadoClient` exposes five domain APIs:
|
|
60
|
+
|
|
61
|
+
| API | Description |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `client.market` | Market data, order placement & cancellation, trigger orders, liquidity, prices, candlesticks |
|
|
64
|
+
| `client.subaccount` | Subaccount summaries, isolated positions, fee rates, linked signers, referrals, liquidation |
|
|
65
|
+
| `client.spot` | Deposits, withdrawals, token allowances, quote transfers, NLP mint/burn |
|
|
66
|
+
| `client.perp` | Perp-specific price queries |
|
|
67
|
+
| `client.ws` | WebSocket query, execute, and subscription message builders |
|
|
68
|
+
|
|
69
|
+
## Re-exports
|
|
70
|
+
|
|
71
|
+
This package re-exports everything from the underlying packages, so most apps only need to depend on `@nadohq/client`:
|
|
72
|
+
|
|
73
|
+
- `@nadohq/engine-client`
|
|
74
|
+
- `@nadohq/indexer-client`
|
|
75
|
+
- `@nadohq/trigger-client`
|
|
76
|
+
- `@nadohq/shared`
|
|
77
|
+
|
|
78
|
+
## Advanced: Custom Endpoints
|
|
79
|
+
|
|
80
|
+
Pass a custom configuration object instead of a `ChainEnv` string to connect to custom endpoints:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
const client = createNadoClient(
|
|
84
|
+
{
|
|
85
|
+
contractAddresses: { ... },
|
|
86
|
+
engineEndpoint: 'https://...',
|
|
87
|
+
indexerEndpoint: 'https://...',
|
|
88
|
+
triggerEndpoint: 'https://...',
|
|
89
|
+
},
|
|
90
|
+
{ publicClient, walletClient },
|
|
91
|
+
);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
ISC
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadohq/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Nado SDK client — unified API for trading, market data, and collateral management on Nado",
|
|
7
7
|
"author": "Frank Jia <frank@inkfnd.com>",
|
|
8
8
|
"homepage": "",
|
|
9
9
|
"license": "ISC",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"module": "./dist/index.js",
|
|
42
42
|
"types": "./dist/index.d.ts",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@nadohq/engine-client": "^0.
|
|
45
|
-
"@nadohq/indexer-client": "^0.
|
|
46
|
-
"@nadohq/shared": "^0.
|
|
47
|
-
"@nadohq/trigger-client": "^0.
|
|
48
|
-
"ts-mixer": "
|
|
44
|
+
"@nadohq/engine-client": "^0.10.0",
|
|
45
|
+
"@nadohq/indexer-client": "^0.10.0",
|
|
46
|
+
"@nadohq/shared": "^0.10.0",
|
|
47
|
+
"@nadohq/trigger-client": "^0.10.0",
|
|
48
|
+
"ts-mixer": "6.0.4"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"bignumber.js": "
|
|
52
|
-
"viem": "
|
|
51
|
+
"bignumber.js": "10.0.0",
|
|
52
|
+
"viem": "2.41.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"bignumber.js": "
|
|
56
|
-
"viem": "
|
|
55
|
+
"bignumber.js": "10.0.2",
|
|
56
|
+
"viem": "2.41.2"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "e516a80d16ed2bc1ee29fa51d1ee23fd00006075"
|
|
59
59
|
}
|