@neutral-trade/sdk 0.3.11 → 0.4.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 +25 -76
- package/dist/index.d.mts +28 -3248
- package/dist/index.mjs +31 -13004
- package/dist/internal.d.mts +2 -0
- package/dist/internal.mjs +3 -0
- package/dist/neutral-trade-core-CnZjPsze.mjs +13031 -0
- package/dist/neutral-trade-core-CqhZMPWM.d.mts +3267 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -35,15 +35,15 @@ Runtime dependencies are declared normally (Anchor, Solana web3, etc.); consumer
|
|
|
35
35
|
```typescript
|
|
36
36
|
import { NeutralTrade, VaultId } from '@neutral-trade/sdk'
|
|
37
37
|
|
|
38
|
-
// Initialize the SDK
|
|
38
|
+
// Initialize the SDK (uses built-in vault registry for your cluster)
|
|
39
39
|
const sdk = await NeutralTrade.create({
|
|
40
|
-
rpcUrl: 'YOUR_RPC_URL_HERE'
|
|
40
|
+
rpcUrl: 'YOUR_RPC_URL_HERE',
|
|
41
41
|
})
|
|
42
42
|
|
|
43
43
|
// Get user balance for Bundle vaults only
|
|
44
44
|
const balances = await sdk.getUserBalanceByVaultIds({
|
|
45
45
|
vaultIds: [VaultId.hyperliquid_funding_arb_48, VaultId.alp_delta_neutral_49],
|
|
46
|
-
userAddress: 'YOUR_WALLET_ADDRESS'
|
|
46
|
+
userAddress: 'YOUR_WALLET_ADDRESS',
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
console.log(balances)
|
|
@@ -51,99 +51,48 @@ console.log(balances)
|
|
|
51
51
|
|
|
52
52
|
## Vault registry
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
import { VaultId } from '@neutral-trade/sdk'
|
|
58
|
-
|
|
59
|
-
// Examples — Bundle vaults (balances supported here)
|
|
60
|
-
VaultId.hyperliquid_funding_arb_48 // Hyperliquid Funding Arb
|
|
61
|
-
VaultId.alp_delta_neutral_49 // ALP Delta Neutral
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
See the [documentation](https://sdk.neutral.trade) for the complete list of vault IDs.
|
|
65
|
-
|
|
66
|
-
## Configuration Registry
|
|
67
|
-
|
|
68
|
-
The SDK includes built-in vault configurations, but you can also fetch the latest configurations from a remote registry. This is useful if you don't upgrade the SDK package frequently.
|
|
69
|
-
|
|
70
|
-
Merge order is:
|
|
71
|
-
|
|
72
|
-
- built-in configs
|
|
73
|
-
- `registry` (local array you provide)
|
|
74
|
-
- `registryUrl` (remote, highest priority)
|
|
75
|
-
|
|
76
|
-
Use `bundleCluster` to select fixed default Bundle program ID by cluster (`mainnet` or `devnet`).
|
|
77
|
-
If a vault entry includes `bundleProgramId`, that vault-specific program ID is used instead.
|
|
54
|
+
Vault configurations are **bundled with the SDK** at build time (`src/registry/vaults.json` for mainnet, `vaults.devnet.json` for devnet). The SDK does **not** fetch or accept external registry overrides.
|
|
78
55
|
|
|
79
|
-
###
|
|
56
|
+
### Getting the latest vault list
|
|
80
57
|
|
|
81
|
-
|
|
82
|
-
- **jsDelivr CDN**: `https://cdn.jsdelivr.net/gh/neutral-trade/sdk@main/src/registry/vaults.json`
|
|
58
|
+
**Upgrade the SDK package** whenever Neutral Trade ships new vaults:
|
|
83
59
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
const sdk = await NeutralTrade.create({
|
|
90
|
-
rpcUrl: 'YOUR_RPC_URL_HERE',
|
|
91
|
-
registry: [
|
|
92
|
-
{
|
|
93
|
-
vaultId: 9999,
|
|
94
|
-
name: 'My Custom Vault',
|
|
95
|
-
type: 'Bundle',
|
|
96
|
-
category: 'Market Neutral',
|
|
97
|
-
vaultAddress: 'YOUR_VAULT_ADDRESS',
|
|
98
|
-
depositToken: 'USDC'
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
})
|
|
60
|
+
```bash
|
|
61
|
+
pnpm add @neutral-trade/sdk@latest
|
|
62
|
+
# or pin a specific version, e.g. @neutral-trade/sdk@0.4.0
|
|
102
63
|
```
|
|
103
64
|
|
|
104
|
-
|
|
65
|
+
Each release includes an updated built-in registry. There is no runtime registry URL.
|
|
105
66
|
|
|
106
|
-
|
|
107
|
-
const sdk = await NeutralTrade.create({
|
|
108
|
-
rpcUrl: 'YOUR_RPC_URL_HERE',
|
|
109
|
-
registryUrl: 'https://cdn.jsdelivr.net/gh/neutral-trade/sdk@main/src/registry/vaults.json'
|
|
110
|
-
})
|
|
111
|
-
```
|
|
67
|
+
### Integrators who cannot upgrade frequently
|
|
112
68
|
|
|
113
|
-
|
|
69
|
+
- Use the **[Neutral Trade API](https://www.neutral.trade/api/v1)** to build unsigned deposit/withdraw instructions server-side, or
|
|
70
|
+
- **Contact us on [Telegram](https://t.me/neutraltrade)** for API access and integration support.
|
|
114
71
|
|
|
115
|
-
|
|
72
|
+
Built-in configs include multiple vault **types** in metadata (`VaultType` may still include `Drift` for historical entries). **Balance queries** in this package apply only to **`VaultType.Bundle`** rows.
|
|
116
73
|
|
|
117
74
|
```typescript
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
registryUrl: 'https://cdn.jsdelivr.net/gh/neutral-trade/sdk@main/src/registry/vaults.json'
|
|
124
|
-
// Remote overrides local
|
|
125
|
-
})
|
|
75
|
+
import { VaultId } from '@neutral-trade/sdk'
|
|
76
|
+
|
|
77
|
+
// Examples — Bundle vaults (balances supported here)
|
|
78
|
+
VaultId.hyperliquid_funding_arb_48 // Hyperliquid Funding Arb
|
|
79
|
+
VaultId.alp_delta_neutral_49 // ALP Delta Neutral
|
|
126
80
|
```
|
|
127
81
|
|
|
128
|
-
|
|
82
|
+
See the [documentation](https://sdk.neutral.trade) for the complete list of vault IDs.
|
|
129
83
|
|
|
130
|
-
|
|
131
|
-
const sdk = await NeutralTrade.create({
|
|
132
|
-
rpcUrl: 'YOUR_RPC_URL_HERE'
|
|
133
|
-
// No registryUrl - uses built-in configurations
|
|
134
|
-
})
|
|
135
|
-
```
|
|
84
|
+
### Cluster selection
|
|
136
85
|
|
|
137
|
-
|
|
86
|
+
Use `bundleCluster` to select the built-in registry and default Bundle program ID (`mainnet` or `devnet`):
|
|
138
87
|
|
|
139
88
|
```typescript
|
|
140
89
|
const sdk = await NeutralTrade.create({
|
|
141
90
|
rpcUrl: 'YOUR_RPC_URL_HERE',
|
|
142
|
-
bundleCluster: 'devnet'
|
|
91
|
+
bundleCluster: 'devnet',
|
|
143
92
|
})
|
|
144
93
|
```
|
|
145
94
|
|
|
146
|
-
|
|
95
|
+
If a vault entry includes `bundleProgramId`, that vault-specific program ID is used instead of the cluster default. Only official Neutral Trade program IDs are accepted for fund-moving instructions.
|
|
147
96
|
|
|
148
97
|
## Examples
|
|
149
98
|
|
|
@@ -156,7 +105,7 @@ pnpm example:devnet:deposit
|
|
|
156
105
|
pnpm example:devnet:withdraw
|
|
157
106
|
```
|
|
158
107
|
|
|
159
|
-
Uses the built-in devnet registry (`src/registry/vaults.devnet.json`, e.g. vault `100000001`). Your RPC must serve that vault on-chain; override vault id with `DEVNET_BUNDLE_VAULT_ID
|
|
108
|
+
Uses the built-in devnet registry (`src/registry/vaults.devnet.json`, e.g. vault `100000001`). Your RPC must serve that vault on-chain; override vault id with `DEVNET_BUNDLE_VAULT_ID`.
|
|
160
109
|
|
|
161
110
|
## License
|
|
162
111
|
|