@neutral-trade/sdk 0.2.1 → 0.2.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
@@ -5250,6 +5250,13 @@ interface NeutralTradeConfig {
5250
5250
  /** Optional fallback prices map. Prices are fetched from Pyth Network first; fallback is used only if Pyth returns incomplete data */
5251
5251
  fallbackPrices?: Partial<Record<SupportedToken, number>>;
5252
5252
  }
5253
+ interface NeutralTradeCoreContext {
5254
+ connection: Connection;
5255
+ bundleProgramV1: Program<NtbundleV1>;
5256
+ bundleProgramV2: Program$1<NtbundleV2>;
5257
+ vaults: VaultRegistry;
5258
+ priceMap: Map<SupportedToken, number>;
5259
+ }
5253
5260
  declare class NeutralTrade {
5254
5261
  readonly connection: Connection;
5255
5262
  readonly bundleProgramV1: Program<NtbundleV1>;
@@ -5258,11 +5265,12 @@ declare class NeutralTrade {
5258
5265
  readonly vaults: VaultRegistry;
5259
5266
  /** Price map for deposit tokens */
5260
5267
  readonly priceMap: Map<SupportedToken, number>;
5261
- private constructor();
5268
+ protected constructor(connection: Connection, bundleProgramV1: Program<NtbundleV1>, bundleProgramV2: Program$1<NtbundleV2>, vaults: VaultRegistry, priceMap: Map<SupportedToken, number>);
5262
5269
  /**
5263
5270
  * Create a new NeutralTrade instance
5264
5271
  * @throws Error if registryUrl is provided but fetch fails or validation fails
5265
5272
  */
5273
+ protected static initCore(config: NeutralTradeConfig): Promise<NeutralTradeCoreContext>;
5266
5274
  static create(config: NeutralTradeConfig): Promise<NeutralTrade>;
5267
5275
  /**
5268
5276
  * Fetch vault configurations from a remote registry URL
@@ -5316,4 +5324,4 @@ declare function deriveUserPDA(userKey: PublicKey, bundlePDA: PublicKey, program
5316
5324
  */
5317
5325
  declare function getVaultDepositorAddressSync(programId: PublicKey, vault: PublicKey, authority: PublicKey): PublicKey;
5318
5326
  //#endregion
5319
- export { type BundleAccount, BundleProgramId, NeutralTrade, type NeutralTradeConfig, type OracleData, type PointsVaultEntry, SupportedChain, SupportedToken, type Token, type UserBalanceResult, type UserBundleAccount, type UserBundleTempData, type VaultBalanceData, VaultCategory, type VaultRegistryEntry as VaultConfig, type VaultRegistry as VaultConfigRecord, VaultId, VaultType, createAnchorProviderV29, createAnchorProviderV32, createBundleProgramV1, createBundleProgramV2, createBundlePrograms, createConnection, createDummyWallet, deriveOraclePDA, deriveUserPDA, estimatePendingBundleFeeToken, getBundleProgramId, getPointsVaults, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, isValidVaultAddress, tokens, vaults$1 as vaults };
5327
+ export { type BundleAccount, BundleProgramId, NeutralTrade, type NeutralTradeConfig, type NeutralTradeCoreContext, type OracleData, type PointsVaultEntry, SupportedChain, SupportedToken, type Token, type UserBalanceResult, type UserBundleAccount, type UserBundleTempData, type VaultBalanceData, VaultCategory, type VaultRegistryEntry as VaultConfig, type VaultRegistry as VaultConfigRecord, VaultId, VaultType, createAnchorProviderV29, createAnchorProviderV32, createBundleProgramV1, createBundleProgramV2, createBundlePrograms, createConnection, createDummyWallet, deriveOraclePDA, deriveUserPDA, estimatePendingBundleFeeToken, getBundleProgramId, getPointsVaults, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, isValidVaultAddress, tokens, vaults$1 as vaults };
package/dist/index.mjs CHANGED
@@ -9634,7 +9634,7 @@ var NeutralTrade = class NeutralTrade {
9634
9634
  * Create a new NeutralTrade instance
9635
9635
  * @throws Error if registryUrl is provided but fetch fails or validation fails
9636
9636
  */
9637
- static async create(config) {
9637
+ static async initCore(config) {
9638
9638
  const connection = createConnection(config.rpcUrl);
9639
9639
  const providerV29 = createAnchorProviderV29(connection);
9640
9640
  const providerV32 = createAnchorProviderV32(connection);
@@ -9649,7 +9649,17 @@ var NeutralTrade = class NeutralTrade {
9649
9649
  };
9650
9650
  }
9651
9651
  const priceMap = await initializePrices(config.fallbackPrices);
9652
- return new NeutralTrade(connection, bundleProgramV1, bundleProgramV2, vaults$1, priceMap);
9652
+ return {
9653
+ connection,
9654
+ bundleProgramV1,
9655
+ bundleProgramV2,
9656
+ vaults: vaults$1,
9657
+ priceMap
9658
+ };
9659
+ }
9660
+ static async create(config) {
9661
+ const core = await this.initCore(config);
9662
+ return new NeutralTrade(core.connection, core.bundleProgramV1, core.bundleProgramV2, core.vaults, core.priceMap);
9653
9663
  }
9654
9664
  /**
9655
9665
  * Fetch vault configurations from a remote registry URL
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neutral-trade/sdk",
3
3
  "type": "module",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "description": "SDK for Neutral Trade vaults",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/neutral-trade/sdk#readme",