@neutral-trade/sdk 0.4.1 → 0.4.3
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/dist/index.d.mts +3 -1
- package/dist/index.mjs +3 -1
- package/dist/internal.d.mts +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/{neutral-trade-core-CnZjPsze.mjs → neutral-trade-core-CVl2TjD0.mjs} +16 -3
- package/dist/{neutral-trade-core-CqhZMPWM.d.mts → neutral-trade-core-ChBn3_UV.d.mts} +5 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as SupportedToken, B as DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, C as VaultRegistryEntry, D as UserBundleAccount, E as OracleData, F as ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, G as getDefaultBundleProgramIdByCluster, H as assertAllowlistedBundleProgramId, I as BUNDLE_PROGRAM_ID_V2_MAINNET, K as isAllowlistedBundleProgramId, L as BundleCluster, M as getSolanaTokenDecimals, N as getSolanaTokenMint, O as UserBundleTempData, P as tokens, R as BundleProgram, S as VaultRegistry, T as BundleAccount, U as createAllowlistedBundleProgram, V as DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, W as createBundleProgramById, _ as vaults, b as VaultBalanceData, d as NeutralTradeConfig, f as getBundleProgramId, g as isValidVaultAddress, h as getVaultRegistry, j as Token, k as SupportedChain, m as getVaultById, p as getVaultByAddress, t as NeutralTradeCoreContext, u as NeutralTrade, v as vaultsDevnet, w as VaultType, x as VaultCategory, y as UserBalanceResult, z as BundleProvider } from "./neutral-trade-core-
|
|
1
|
+
import { A as SupportedToken, B as DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, C as VaultRegistryEntry, D as UserBundleAccount, E as OracleData, F as ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, G as getDefaultBundleProgramIdByCluster, H as assertAllowlistedBundleProgramId, I as BUNDLE_PROGRAM_ID_V2_MAINNET, K as isAllowlistedBundleProgramId, L as BundleCluster, M as getSolanaTokenDecimals, N as getSolanaTokenMint, O as UserBundleTempData, P as tokens, R as BundleProgram, S as VaultRegistry, T as BundleAccount, U as createAllowlistedBundleProgram, V as DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, W as createBundleProgramById, _ as vaults, b as VaultBalanceData, d as NeutralTradeConfig, f as getBundleProgramId, g as isValidVaultAddress, h as getVaultRegistry, j as Token, k as SupportedChain, m as getVaultById, p as getVaultByAddress, t as NeutralTradeCoreContext, u as NeutralTrade, v as vaultsDevnet, w as VaultType, x as VaultCategory, y as UserBalanceResult, z as BundleProvider } from "./neutral-trade-core-ChBn3_UV.mjs";
|
|
2
2
|
import { AnchorProvider, Wallet } from "@coral-xyz/anchor";
|
|
3
3
|
import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
4
4
|
import BN from "bn.js";
|
|
@@ -12,6 +12,8 @@ declare function createDummyWallet(): Wallet;
|
|
|
12
12
|
* Auto-generated from the vault registry JSON.
|
|
13
13
|
*/
|
|
14
14
|
declare enum VaultId {
|
|
15
|
+
/** Options-MM-Z */
|
|
16
|
+
options_mm_z_80 = 80,
|
|
15
17
|
/** Thirdeye-Flagship-USDC-Bundle */
|
|
16
18
|
thirdeye_flagship_usdc_bundle_79 = 79,
|
|
17
19
|
/** Velox-Cross-USDC-Bundle */
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as SupportedChain, B as createAllowlistedBundleProgram, C as getVaultById, D as vaultsDevnet, E as vaults, F as ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, H as getDefaultBundleProgramIdByCluster, I as BUNDLE_PROGRAM_ID_V2_MAINNET, L as DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, M as getSolanaTokenDecimals, N as getSolanaTokenMint, O as VaultCategory, P as tokens, R as DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, S as getVaultByAddress, T as isValidVaultAddress, U as isAllowlistedBundleProgramId, V as createBundleProgramById, W as createDummyWallet, _ as deriveUserPDA, a as buildBundleDepositInstructions, b as parseAmountRawToBigInt, d as SEED_PENDING_AUTH, f as SEED_TEMP, g as deriveTempDataPDA, h as derivePendingAuthPDA, i as initNeutralTradeCore, j as SupportedToken, k as VaultType, l as computeRequestWithdrawalSharesFromAmountRaw, m as deriveOraclePDA, n as buildRequestWithdrawInstructionForVaultId, o as buildBundleRequestWithdrawInstruction, p as SEED_USER, t as buildDepositInstructionsForVaultId, u as SEED_ORACLE, v as getVaultDepositorAddressSync, w as getVaultRegistry, x as getBundleProgramId, y as humanFloatToAmountRawString, z as assertAllowlistedBundleProgramId } from "./neutral-trade-core-
|
|
1
|
+
import { A as SupportedChain, B as createAllowlistedBundleProgram, C as getVaultById, D as vaultsDevnet, E as vaults, F as ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, H as getDefaultBundleProgramIdByCluster, I as BUNDLE_PROGRAM_ID_V2_MAINNET, L as DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, M as getSolanaTokenDecimals, N as getSolanaTokenMint, O as VaultCategory, P as tokens, R as DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, S as getVaultByAddress, T as isValidVaultAddress, U as isAllowlistedBundleProgramId, V as createBundleProgramById, W as createDummyWallet, _ as deriveUserPDA, a as buildBundleDepositInstructions, b as parseAmountRawToBigInt, d as SEED_PENDING_AUTH, f as SEED_TEMP, g as deriveTempDataPDA, h as derivePendingAuthPDA, i as initNeutralTradeCore, j as SupportedToken, k as VaultType, l as computeRequestWithdrawalSharesFromAmountRaw, m as deriveOraclePDA, n as buildRequestWithdrawInstructionForVaultId, o as buildBundleRequestWithdrawInstruction, p as SEED_USER, t as buildDepositInstructionsForVaultId, u as SEED_ORACLE, v as getVaultDepositorAddressSync, w as getVaultRegistry, x as getBundleProgramId, y as humanFloatToAmountRawString, z as assertAllowlistedBundleProgramId } from "./neutral-trade-core-CVl2TjD0.mjs";
|
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
|
3
3
|
|
|
4
4
|
//#region src/constants/vault-ids.ts
|
|
@@ -7,6 +7,8 @@ import { PublicKey } from "@solana/web3.js";
|
|
|
7
7
|
* Auto-generated from the vault registry JSON.
|
|
8
8
|
*/
|
|
9
9
|
let VaultId = /* @__PURE__ */ function(VaultId$1) {
|
|
10
|
+
/** Options-MM-Z */
|
|
11
|
+
VaultId$1[VaultId$1["options_mm_z_80"] = 80] = "options_mm_z_80";
|
|
10
12
|
/** Thirdeye-Flagship-USDC-Bundle */
|
|
11
13
|
VaultId$1[VaultId$1["thirdeye_flagship_usdc_bundle_79"] = 79] = "thirdeye_flagship_usdc_bundle_79";
|
|
12
14
|
/** Velox-Cross-USDC-Bundle */
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as initNeutralTradeCore, c as buildBundleDepositInstructionsWithVault, i as getBundleProgramForVault, l as buildBundleRequestWithdrawInstructionWithVault, n as buildDepositInstructionsForVaultId, o as BuildBundleDepositInstructionsCoreParams, r as buildRequestWithdrawInstructionForVaultId, s as BuildBundleRequestWithdrawInstructionCoreParams, t as NeutralTradeCoreContext } from "./neutral-trade-core-
|
|
1
|
+
import { a as initNeutralTradeCore, c as buildBundleDepositInstructionsWithVault, i as getBundleProgramForVault, l as buildBundleRequestWithdrawInstructionWithVault, n as buildDepositInstructionsForVaultId, o as BuildBundleDepositInstructionsCoreParams, r as buildRequestWithdrawInstructionForVaultId, s as BuildBundleRequestWithdrawInstructionCoreParams, t as NeutralTradeCoreContext } from "./neutral-trade-core-ChBn3_UV.mjs";
|
|
2
2
|
export { type BuildBundleDepositInstructionsCoreParams, type BuildBundleRequestWithdrawInstructionCoreParams, type NeutralTradeCoreContext, buildBundleDepositInstructionsWithVault, buildBundleRequestWithdrawInstructionWithVault, buildDepositInstructionsForVaultId, buildRequestWithdrawInstructionForVaultId, getBundleProgramForVault, initNeutralTradeCore };
|
package/dist/internal.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as buildBundleRequestWithdrawInstructionWithVault, i as initNeutralTradeCore, n as buildRequestWithdrawInstructionForVaultId, r as getBundleProgramForVault, s as buildBundleDepositInstructionsWithVault, t as buildDepositInstructionsForVaultId } from "./neutral-trade-core-
|
|
1
|
+
import { c as buildBundleRequestWithdrawInstructionWithVault, i as initNeutralTradeCore, n as buildRequestWithdrawInstructionForVaultId, r as getBundleProgramForVault, s as buildBundleDepositInstructionsWithVault, t as buildDepositInstructionsForVaultId } from "./neutral-trade-core-CVl2TjD0.mjs";
|
|
2
2
|
|
|
3
3
|
export { buildBundleDepositInstructionsWithVault, buildBundleRequestWithdrawInstructionWithVault, buildDepositInstructionsForVaultId, buildRequestWithdrawInstructionForVaultId, getBundleProgramForVault, initNeutralTradeCore };
|
|
@@ -18,8 +18,11 @@ function createDummyWallet() {
|
|
|
18
18
|
payer: Keypair.generate()
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function createConnection(rpcUrl) {
|
|
22
|
-
return new Connection(rpcUrl,
|
|
21
|
+
function createConnection(rpcUrl, wsRpcUrl) {
|
|
22
|
+
return new Connection(rpcUrl, {
|
|
23
|
+
commitment: "confirmed",
|
|
24
|
+
...wsRpcUrl ? { wsEndpoint: wsRpcUrl } : {}
|
|
25
|
+
});
|
|
23
26
|
}
|
|
24
27
|
function createAnchorProvider(connection, wallet) {
|
|
25
28
|
return new AnchorProvider(connection, wallet ?? createDummyWallet(), AnchorProvider.defaultOptions());
|
|
@@ -11640,6 +11643,16 @@ var vaults_devnet_default = [{
|
|
|
11640
11643
|
//#endregion
|
|
11641
11644
|
//#region src/registry/vaults.json
|
|
11642
11645
|
var vaults_default = [
|
|
11646
|
+
{
|
|
11647
|
+
"vaultId": 80,
|
|
11648
|
+
"name": "Options-MM-Z",
|
|
11649
|
+
"type": "Bundle",
|
|
11650
|
+
"category": "Market Neutral",
|
|
11651
|
+
"vaultAddress": "3vZKAcd74bzwNYZmsJndYExkGj6ABQwrUoiMtdNfzLZe",
|
|
11652
|
+
"depositToken": "USDC",
|
|
11653
|
+
"pointsMultiplier": 1,
|
|
11654
|
+
"pointsEnabled": false
|
|
11655
|
+
},
|
|
11643
11656
|
{
|
|
11644
11657
|
"vaultId": 79,
|
|
11645
11658
|
"name": "Thirdeye-Flagship-USDC-Bundle",
|
|
@@ -12980,7 +12993,7 @@ async function initializePrices(fallbackPrices) {
|
|
|
12980
12993
|
//#endregion
|
|
12981
12994
|
//#region src/neutral-trade-core.ts
|
|
12982
12995
|
async function initNeutralTradeCore(config) {
|
|
12983
|
-
const connection = createConnection(config.rpcUrl);
|
|
12996
|
+
const connection = createConnection(config.rpcUrl, config.wsRpcUrl);
|
|
12984
12997
|
const provider = createAnchorProvider(connection);
|
|
12985
12998
|
const cluster = config.bundleCluster ?? "mainnet";
|
|
12986
12999
|
const vaults$1 = { ...getVaultRegistry(cluster) };
|
|
@@ -3148,6 +3148,11 @@ declare function getVaultById(vaultId: number, cluster?: BundleCluster): VaultRe
|
|
|
3148
3148
|
//#region src/NeutralTrade.d.ts
|
|
3149
3149
|
interface NeutralTradeConfig {
|
|
3150
3150
|
rpcUrl: string;
|
|
3151
|
+
/**
|
|
3152
|
+
* Optional WebSocket RPC for account subscriptions.
|
|
3153
|
+
* HTTP JSON-RPC always uses `rpcUrl`; when set, avoids deriving WS from the HTTP proxy URL.
|
|
3154
|
+
*/
|
|
3155
|
+
wsRpcUrl?: string;
|
|
3151
3156
|
/** Bundle program cluster selector. Defaults to 'mainnet'. */
|
|
3152
3157
|
bundleCluster?: BundleCluster;
|
|
3153
3158
|
/** Optional fallback prices map. Prices are fetched from Pyth Network first; fallback is used only if Pyth returns incomplete data */
|