@neutral-trade/sdk 0.4.1 → 0.4.2

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 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-CqhZMPWM.mjs";
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";
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-CnZjPsze.mjs";
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-DfFrzwPf.mjs";
2
2
  import { PublicKey } from "@solana/web3.js";
3
3
 
4
4
  //#region src/constants/vault-ids.ts
@@ -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-CqhZMPWM.mjs";
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-CnZjPsze.mjs";
1
+ import { c as buildBundleRequestWithdrawInstructionWithVault, i as initNeutralTradeCore, n as buildRequestWithdrawInstructionForVaultId, r as getBundleProgramForVault, s as buildBundleDepositInstructionsWithVault, t as buildDepositInstructionsForVaultId } from "./neutral-trade-core-DfFrzwPf.mjs";
2
2
 
3
3
  export { buildBundleDepositInstructionsWithVault, buildBundleRequestWithdrawInstructionWithVault, buildDepositInstructionsForVaultId, buildRequestWithdrawInstructionForVaultId, getBundleProgramForVault, initNeutralTradeCore };
@@ -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 */
@@ -18,8 +18,11 @@ function createDummyWallet() {
18
18
  payer: Keypair.generate()
19
19
  };
20
20
  }
21
- function createConnection(rpcUrl) {
22
- return new Connection(rpcUrl, "confirmed");
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());
@@ -12980,7 +12983,7 @@ async function initializePrices(fallbackPrices) {
12980
12983
  //#endregion
12981
12984
  //#region src/neutral-trade-core.ts
12982
12985
  async function initNeutralTradeCore(config) {
12983
- const connection = createConnection(config.rpcUrl);
12986
+ const connection = createConnection(config.rpcUrl, config.wsRpcUrl);
12984
12987
  const provider = createAnchorProvider(connection);
12985
12988
  const cluster = config.bundleCluster ?? "mainnet";
12986
12989
  const vaults$1 = { ...getVaultRegistry(cluster) };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neutral-trade/sdk",
3
3
  "type": "module",
4
- "version": "0.4.1",
4
+ "version": "0.4.2",
5
5
  "description": "SDK for Neutral Trade vaults",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/neutral-trade/sdk#readme",