@neutral-trade/sdk 0.4.9 → 0.4.11
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 +29 -4
- package/dist/index.mjs +8 -4
- package/dist/internal.d.mts +2 -2
- package/dist/internal.mjs +2 -2
- package/dist/{neutral-trade-core-BGjOiCsY.d.mts → neutral-trade-core-7Ob7XfF4.d.mts} +614 -2
- package/dist/{neutral-trade-core-B8iDgu5K.mjs → neutral-trade-core-x0cLp5YE.mjs} +1484 -248
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as UserBundleTempData, B as BundleProgram, C as VaultCategory, D as BundleAccount, E as VaultType, F as getSolanaTokenMint, G as createAllowlistedBundleProgram, H as DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, I as tokens, J as isAllowlistedBundleProgramId, K as createBundleProgramById, L as ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, M as SupportedToken, N as Token, O as OracleData, P as getSolanaTokenDecimals, R as BUNDLE_PROGRAM_ID_V2_MAINNET, S as VaultBalanceData, T as VaultRegistryEntry, U as DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, V as BundleProvider, W as assertAllowlistedBundleProgramId, _ as getVaultRegistry, b as vaultsDevnet, f as NeutralTrade, g as getVaultById, h as getVaultByAddress, j as SupportedChain, k as UserBundleAccount, m as getBundleProgramId, p as NeutralTradeConfig, q as getDefaultBundleProgramIdByCluster, t as NeutralTradeCoreContext, v as isValidVaultAddress, w as VaultRegistry, x as UserBalanceResult, y as vaults$1, z as BundleCluster } from "./neutral-trade-core-7Ob7XfF4.mjs";
|
|
2
2
|
import { AnchorProvider, Program, Wallet } from "@coral-xyz/anchor";
|
|
3
3
|
import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
4
4
|
import BN from "bn.js";
|
|
@@ -182,8 +182,12 @@ declare enum VaultId {
|
|
|
182
182
|
* Auto-generated from the vault registry JSON.
|
|
183
183
|
*/
|
|
184
184
|
declare enum DevnetVaultId {
|
|
185
|
-
/**
|
|
186
|
-
|
|
185
|
+
/** bundle-1 */
|
|
186
|
+
bundle_1_100000002 = 100000002,
|
|
187
|
+
/** bundle-2 */
|
|
188
|
+
bundle_2_100000003 = 100000003,
|
|
189
|
+
/** bundle-4 */
|
|
190
|
+
bundle_4_100000005 = 100000005,
|
|
187
191
|
}
|
|
188
192
|
//#endregion
|
|
189
193
|
//#region src/utils/amount-raw.d.ts
|
|
@@ -320,6 +324,15 @@ interface BuildBundleRequestWithdrawInstructionParams {
|
|
|
320
324
|
/** Smallest token units (decimal string) to request withdrawing. */
|
|
321
325
|
amountRaw: string;
|
|
322
326
|
}
|
|
327
|
+
interface BuildBundleRequestSwitchInstructionParams {
|
|
328
|
+
connection: Connection;
|
|
329
|
+
bundleCluster?: BundleCluster;
|
|
330
|
+
sourceVaultId: number;
|
|
331
|
+
targetVaultId: number;
|
|
332
|
+
user: PublicKey;
|
|
333
|
+
/** Smallest token units (decimal string) to switch out of the source vault. */
|
|
334
|
+
amountRaw: string;
|
|
335
|
+
}
|
|
323
336
|
/**
|
|
324
337
|
* `initializeBundleDepositor` (when needed) + `requestDeposit` for a built-in registry vault.
|
|
325
338
|
*/
|
|
@@ -340,6 +353,18 @@ declare function buildBundleRequestWithdrawInstruction({
|
|
|
340
353
|
user,
|
|
341
354
|
amountRaw
|
|
342
355
|
}: BuildBundleRequestWithdrawInstructionParams): Promise<TransactionInstruction>;
|
|
356
|
+
/**
|
|
357
|
+
* `initializeBundleDepositor` on target (when needed) + `requestBundleSwitch`
|
|
358
|
+
* for built-in registry vaults (source → target, same deposit token).
|
|
359
|
+
*/
|
|
360
|
+
declare function buildBundleRequestSwitchInstruction({
|
|
361
|
+
connection,
|
|
362
|
+
bundleCluster,
|
|
363
|
+
sourceVaultId,
|
|
364
|
+
targetVaultId,
|
|
365
|
+
user,
|
|
366
|
+
amountRaw
|
|
367
|
+
}: BuildBundleRequestSwitchInstructionParams): Promise<TransactionInstruction[]>;
|
|
343
368
|
//#endregion
|
|
344
369
|
//#region src/utils/pda.d.ts
|
|
345
370
|
declare const SEED_ORACLE: NodeJS.NonSharedUint8Array;
|
|
@@ -368,4 +393,4 @@ declare function derivePendingAuthPDA(bundlePDA: PublicKey, programId: PublicKey
|
|
|
368
393
|
*/
|
|
369
394
|
declare function getVaultDepositorAddressSync(programId: PublicKey, vault: PublicKey, authority: PublicKey): PublicKey;
|
|
370
395
|
//#endregion
|
|
371
|
-
export { ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, BUNDLE_PROGRAM_ID_V2_MAINNET, type BuildBundleDepositInstructionsParams, type BuildBundleRequestWithdrawInstructionParams, type BundleAccount, type BundleCluster, type BundleProgram, type BundleProvider, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, DevnetVaultId, type EffectiveFeeBps, type EffectiveVaultFeeDecimals, FEE_OVERRIDE, NeutralTrade, type NeutralTradeConfig, type NeutralTradeCoreContext, type OracleData, SEED_ORACLE, SEED_PENDING_AUTH, SEED_TEMP, SEED_USER, SupportedChain, SupportedToken, type Token, type UserBalanceResult, type UserBundleAccount, type UserBundleTempData, type UserFeeOverrideFields, type VaultBalanceData, VaultCategory, VaultId, type VaultRegistry, type VaultRegistryEntry, VaultType, assertAllowlistedBundleProgramId, bpsToFeeDecimal, bpsToPercentLabel, buildBundleDepositInstructions, buildBundleRequestWithdrawInstruction, buildFeeOverrideMask, computeDepositFeePreview, computeRequestWithdrawalSharesFromAmountRaw, computeWithdrawFeePreview, createAllowlistedBundleProgram, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, effectiveFeeBpsToDecimals, estimatePendingBundleFeeToken, feeDecimalToBps, formatFeeOverrideFlags, getBundleProgramId, getDefaultBundleProgramIdByCluster, getSolanaTokenDecimals, getSolanaTokenMint, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, getVaultRegistry, hasAnyFeeOverride, hasCustomFeeRate, hasFeeOverrideFlag, humanFloatToAmountRawString, isAllowlistedBundleProgramId, isValidVaultAddress, parseAmountRawToBigInt, readUserFeeOverrideFields, resolveEffectiveFeeBps, resolveEffectiveFeeBpsFromDefaults, resolveEffectiveVaultFees, tokens, vaultFeeDecimalsToBps, vaults$1 as vaults, vaultsDevnet };
|
|
396
|
+
export { ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, BUNDLE_PROGRAM_ID_V2_MAINNET, type BuildBundleDepositInstructionsParams, type BuildBundleRequestSwitchInstructionParams, type BuildBundleRequestWithdrawInstructionParams, type BundleAccount, type BundleCluster, type BundleProgram, type BundleProvider, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, DevnetVaultId, type EffectiveFeeBps, type EffectiveVaultFeeDecimals, FEE_OVERRIDE, NeutralTrade, type NeutralTradeConfig, type NeutralTradeCoreContext, type OracleData, SEED_ORACLE, SEED_PENDING_AUTH, SEED_TEMP, SEED_USER, SupportedChain, SupportedToken, type Token, type UserBalanceResult, type UserBundleAccount, type UserBundleTempData, type UserFeeOverrideFields, type VaultBalanceData, VaultCategory, VaultId, type VaultRegistry, type VaultRegistryEntry, VaultType, assertAllowlistedBundleProgramId, bpsToFeeDecimal, bpsToPercentLabel, buildBundleDepositInstructions, buildBundleRequestSwitchInstruction, buildBundleRequestWithdrawInstruction, buildFeeOverrideMask, computeDepositFeePreview, computeRequestWithdrawalSharesFromAmountRaw, computeWithdrawFeePreview, createAllowlistedBundleProgram, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, effectiveFeeBpsToDecimals, estimatePendingBundleFeeToken, feeDecimalToBps, formatFeeOverrideFlags, getBundleProgramId, getDefaultBundleProgramIdByCluster, getSolanaTokenDecimals, getSolanaTokenMint, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, getVaultRegistry, hasAnyFeeOverride, hasCustomFeeRate, hasFeeOverrideFlag, humanFloatToAmountRawString, isAllowlistedBundleProgramId, isValidVaultAddress, parseAmountRawToBigInt, readUserFeeOverrideFields, resolveEffectiveFeeBps, resolveEffectiveFeeBpsFromDefaults, resolveEffectiveVaultFees, tokens, vaultFeeDecimalsToBps, vaults$1 as vaults, vaultsDevnet };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as VaultCategory, B as DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, C as getBundleProgramId, D as isValidVaultAddress, E as getVaultRegistry, F as getSolanaTokenMint, G as isAllowlistedBundleProgramId, H as createAllowlistedBundleProgram, I as tokens, K as createDummyWallet, L as ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, M as SupportedChain, N as SupportedToken, O as vaults, P as getSolanaTokenDecimals, R as BUNDLE_PROGRAM_ID_V2_MAINNET, S as parseAmountRawToBigInt, T as getVaultById, U as createBundleProgramById, V as assertAllowlistedBundleProgramId, W as getDefaultBundleProgramIdByCluster, _ as derivePendingAuthPDA, a as buildBundleDepositInstructions, b as getVaultDepositorAddressSync, d as computeRequestWithdrawalSharesFromAmountRaw, f as SEED_ORACLE, g as deriveOraclePDA, h as SEED_USER, i as initNeutralTradeCore, j as VaultType, k as vaultsDevnet, m as SEED_TEMP, n as buildRequestWithdrawInstructionForVaultId, o as buildBundleRequestSwitchInstruction, p as SEED_PENDING_AUTH, s as buildBundleRequestWithdrawInstruction, t as buildDepositInstructionsForVaultId, v as deriveTempDataPDA, w as getVaultByAddress, x as humanFloatToAmountRawString, y as deriveUserPDA, z as DEFAULT_BUNDLE_PROGRAM_ID_DEVNET } from "./neutral-trade-core-x0cLp5YE.mjs";
|
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
|
3
3
|
|
|
4
4
|
//#region src/constants/vault-ids.ts
|
|
@@ -179,8 +179,12 @@ let VaultId = /* @__PURE__ */ function(VaultId$1) {
|
|
|
179
179
|
* Auto-generated from the vault registry JSON.
|
|
180
180
|
*/
|
|
181
181
|
let DevnetVaultId = /* @__PURE__ */ function(DevnetVaultId$1) {
|
|
182
|
-
/**
|
|
183
|
-
DevnetVaultId$1[DevnetVaultId$1["
|
|
182
|
+
/** bundle-1 */
|
|
183
|
+
DevnetVaultId$1[DevnetVaultId$1["bundle_1_100000002"] = 100000002] = "bundle_1_100000002";
|
|
184
|
+
/** bundle-2 */
|
|
185
|
+
DevnetVaultId$1[DevnetVaultId$1["bundle_2_100000003"] = 100000003] = "bundle_2_100000003";
|
|
186
|
+
/** bundle-4 */
|
|
187
|
+
DevnetVaultId$1[DevnetVaultId$1["bundle_4_100000005"] = 100000005] = "bundle_4_100000005";
|
|
184
188
|
return DevnetVaultId$1;
|
|
185
189
|
}({});
|
|
186
190
|
|
|
@@ -536,4 +540,4 @@ var NeutralTrade = class NeutralTrade {
|
|
|
536
540
|
};
|
|
537
541
|
|
|
538
542
|
//#endregion
|
|
539
|
-
export { ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, BUNDLE_PROGRAM_ID_V2_MAINNET, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, DevnetVaultId, FEE_OVERRIDE, NeutralTrade, SEED_ORACLE, SEED_PENDING_AUTH, SEED_TEMP, SEED_USER, SupportedChain, SupportedToken, VaultCategory, VaultId, VaultType, assertAllowlistedBundleProgramId, bpsToFeeDecimal, bpsToPercentLabel, buildBundleDepositInstructions, buildBundleRequestWithdrawInstruction, buildFeeOverrideMask, computeDepositFeePreview, computeRequestWithdrawalSharesFromAmountRaw, computeWithdrawFeePreview, createAllowlistedBundleProgram, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, effectiveFeeBpsToDecimals, estimatePendingBundleFeeToken, feeDecimalToBps, formatFeeOverrideFlags, getBundleProgramId, getDefaultBundleProgramIdByCluster, getSolanaTokenDecimals, getSolanaTokenMint, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, getVaultRegistry, hasAnyFeeOverride, hasCustomFeeRate, hasFeeOverrideFlag, humanFloatToAmountRawString, isAllowlistedBundleProgramId, isValidVaultAddress, parseAmountRawToBigInt, readUserFeeOverrideFields, resolveEffectiveFeeBps, resolveEffectiveFeeBpsFromDefaults, resolveEffectiveVaultFees, tokens, vaultFeeDecimalsToBps, vaults, vaultsDevnet };
|
|
543
|
+
export { ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, BUNDLE_PROGRAM_ID_V2_MAINNET, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, DevnetVaultId, FEE_OVERRIDE, NeutralTrade, SEED_ORACLE, SEED_PENDING_AUTH, SEED_TEMP, SEED_USER, SupportedChain, SupportedToken, VaultCategory, VaultId, VaultType, assertAllowlistedBundleProgramId, bpsToFeeDecimal, bpsToPercentLabel, buildBundleDepositInstructions, buildBundleRequestSwitchInstruction, buildBundleRequestWithdrawInstruction, buildFeeOverrideMask, computeDepositFeePreview, computeRequestWithdrawalSharesFromAmountRaw, computeWithdrawFeePreview, createAllowlistedBundleProgram, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, effectiveFeeBpsToDecimals, estimatePendingBundleFeeToken, feeDecimalToBps, formatFeeOverrideFlags, getBundleProgramId, getDefaultBundleProgramIdByCluster, getSolanaTokenDecimals, getSolanaTokenMint, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, getVaultRegistry, hasAnyFeeOverride, hasCustomFeeRate, hasFeeOverrideFlag, humanFloatToAmountRawString, isAllowlistedBundleProgramId, isValidVaultAddress, parseAmountRawToBigInt, readUserFeeOverrideFields, resolveEffectiveFeeBps, resolveEffectiveFeeBpsFromDefaults, resolveEffectiveVaultFees, tokens, vaultFeeDecimalsToBps, vaults, vaultsDevnet };
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as initNeutralTradeCore, c as
|
|
2
|
-
export { type BuildBundleDepositInstructionsCoreParams, type BuildBundleRequestWithdrawInstructionCoreParams, type NeutralTradeCoreContext, buildBundleDepositInstructionsWithVault, buildBundleRequestWithdrawInstructionWithVault, buildDepositInstructionsForVaultId, buildRequestWithdrawInstructionForVaultId, getBundleProgramForVault, initNeutralTradeCore };
|
|
1
|
+
import { a as initNeutralTradeCore, c as BuildBundleRequestWithdrawInstructionCoreParams, d as buildBundleRequestWithdrawInstructionWithVault, i as getBundleProgramForVault, l as buildBundleDepositInstructionsWithVault, n as buildDepositInstructionsForVaultId, o as BuildBundleDepositInstructionsCoreParams, r as buildRequestWithdrawInstructionForVaultId, s as BuildBundleRequestSwitchInstructionCoreParams, t as NeutralTradeCoreContext, u as buildBundleRequestSwitchInstructionWithVault } from "./neutral-trade-core-7Ob7XfF4.mjs";
|
|
2
|
+
export { type BuildBundleDepositInstructionsCoreParams, type BuildBundleRequestSwitchInstructionCoreParams, type BuildBundleRequestWithdrawInstructionCoreParams, type NeutralTradeCoreContext, buildBundleDepositInstructionsWithVault, buildBundleRequestSwitchInstructionWithVault, buildBundleRequestWithdrawInstructionWithVault, buildDepositInstructionsForVaultId, buildRequestWithdrawInstructionForVaultId, getBundleProgramForVault, initNeutralTradeCore };
|
package/dist/internal.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as buildBundleDepositInstructionsWithVault, i as initNeutralTradeCore, l as buildBundleRequestSwitchInstructionWithVault, n as buildRequestWithdrawInstructionForVaultId, r as getBundleProgramForVault, t as buildDepositInstructionsForVaultId, u as buildBundleRequestWithdrawInstructionWithVault } from "./neutral-trade-core-x0cLp5YE.mjs";
|
|
2
2
|
|
|
3
|
-
export { buildBundleDepositInstructionsWithVault, buildBundleRequestWithdrawInstructionWithVault, buildDepositInstructionsForVaultId, buildRequestWithdrawInstructionForVaultId, getBundleProgramForVault, initNeutralTradeCore };
|
|
3
|
+
export { buildBundleDepositInstructionsWithVault, buildBundleRequestSwitchInstructionWithVault, buildBundleRequestWithdrawInstructionWithVault, buildDepositInstructionsForVaultId, buildRequestWithdrawInstructionForVaultId, getBundleProgramForVault, initNeutralTradeCore };
|