@neutral-trade/sdk 0.2.5 → 0.2.7
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 +49 -0
- package/dist/index.d.mts +268 -2234
- package/dist/index.mjs +312 -2573
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -67,6 +67,15 @@ See the [documentation](https://sdk.neutral.trade) for the complete list of vaul
|
|
|
67
67
|
|
|
68
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
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.
|
|
78
|
+
|
|
70
79
|
### Registry URLs
|
|
71
80
|
|
|
72
81
|
- **GitHub Raw**: `https://raw.githubusercontent.com/neutral-trade/sdk/main/src/registry/vaults.json`
|
|
@@ -74,6 +83,24 @@ The SDK includes built-in vault configurations, but you can also fetch the lates
|
|
|
74
83
|
|
|
75
84
|
### Usage
|
|
76
85
|
|
|
86
|
+
**Use a local registry array (good for custom/new vaults):**
|
|
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
|
+
})
|
|
102
|
+
```
|
|
103
|
+
|
|
77
104
|
**Use the registry URL if you don't upgrade the SDK frequently:**
|
|
78
105
|
|
|
79
106
|
```typescript
|
|
@@ -85,6 +112,19 @@ const sdk = await NeutralTrade.create({
|
|
|
85
112
|
|
|
86
113
|
This ensures you always have the latest vault configurations without needing to update the SDK package.
|
|
87
114
|
|
|
115
|
+
**Use both local + registry URL (URL overrides local when same vaultId exists):**
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const sdk = await NeutralTrade.create({
|
|
119
|
+
rpcUrl: 'YOUR_RPC_URL_HERE',
|
|
120
|
+
registry: [
|
|
121
|
+
// Local overrides built-in
|
|
122
|
+
],
|
|
123
|
+
registryUrl: 'https://cdn.jsdelivr.net/gh/neutral-trade/sdk@main/src/registry/vaults.json'
|
|
124
|
+
// Remote overrides local
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
|
|
88
128
|
**Use built-in configs if you upgrade the SDK regularly:**
|
|
89
129
|
|
|
90
130
|
```typescript
|
|
@@ -94,6 +134,15 @@ const sdk = await NeutralTrade.create({
|
|
|
94
134
|
})
|
|
95
135
|
```
|
|
96
136
|
|
|
137
|
+
**Select devnet default Bundle program ID:**
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
const sdk = await NeutralTrade.create({
|
|
141
|
+
rpcUrl: 'YOUR_RPC_URL_HERE',
|
|
142
|
+
bundleCluster: 'devnet'
|
|
143
|
+
})
|
|
144
|
+
```
|
|
145
|
+
|
|
97
146
|
This is simpler and doesn't require an additional network request at initialization.
|
|
98
147
|
|
|
99
148
|
## Examples
|