@neutral-trade/sdk 0.2.8 → 0.2.9
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 +27 -6
- package/dist/index.mjs +67 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3030,8 +3030,8 @@ declare function createBundleProgramById(provider: AnchorProvider, programId: st
|
|
|
3030
3030
|
//#endregion
|
|
3031
3031
|
//#region src/constants/vault-ids.d.ts
|
|
3032
3032
|
/**
|
|
3033
|
-
* Vault ID constants
|
|
3034
|
-
*
|
|
3033
|
+
* Vault ID constants (VaultId)
|
|
3034
|
+
* Auto-generated from the vault registry JSON.
|
|
3035
3035
|
*/
|
|
3036
3036
|
declare enum VaultId {
|
|
3037
3037
|
/** Hyperithm-CTA-USDC-Bundle */
|
|
@@ -3192,6 +3192,16 @@ declare enum VaultId {
|
|
|
3192
3192
|
jlp_delta_neutral_vault_1_0 = 0,
|
|
3193
3193
|
}
|
|
3194
3194
|
//#endregion
|
|
3195
|
+
//#region src/constants/vault-ids.devnet.d.ts
|
|
3196
|
+
/**
|
|
3197
|
+
* Vault ID constants (DevnetVaultId)
|
|
3198
|
+
* Auto-generated from the vault registry JSON.
|
|
3199
|
+
*/
|
|
3200
|
+
declare enum DevnetVaultId {
|
|
3201
|
+
/** Dev1 */
|
|
3202
|
+
dev1_100000001 = 100000001,
|
|
3203
|
+
}
|
|
3204
|
+
//#endregion
|
|
3195
3205
|
//#region src/types/tokens.d.ts
|
|
3196
3206
|
declare enum SupportedChain {
|
|
3197
3207
|
Solana = "Solana",
|
|
@@ -3214,6 +3224,13 @@ interface Token {
|
|
|
3214
3224
|
} | null };
|
|
3215
3225
|
}
|
|
3216
3226
|
declare const tokens: { [name in SupportedToken]: Token };
|
|
3227
|
+
/**
|
|
3228
|
+
* Solana mint address for a supported token, keyed by bundle cluster.
|
|
3229
|
+
* Devnet USDC uses the team mock mint; other tokens use mainnet table until devnet overrides exist.
|
|
3230
|
+
*/
|
|
3231
|
+
declare function getSolanaTokenMint(token: SupportedToken, cluster?: BundleCluster): string;
|
|
3232
|
+
/** SPL decimals for `token` (same on mainnet vs devnet for current overrides). */
|
|
3233
|
+
declare function getSolanaTokenDecimals(token: SupportedToken): number;
|
|
3217
3234
|
//#endregion
|
|
3218
3235
|
//#region src/types/bundle-types.d.ts
|
|
3219
3236
|
type UserBundleAccount = IdlAccounts<Ntbundle>['userBundleAccount'];
|
|
@@ -3293,10 +3310,14 @@ type UserBalanceResult = Record<number, VaultBalanceData | null>;
|
|
|
3293
3310
|
* Uses registry value if present, otherwise falls back to cluster default.
|
|
3294
3311
|
*/
|
|
3295
3312
|
declare function getBundleProgramId(vault: VaultRegistryEntry, cluster?: BundleCluster): string | undefined;
|
|
3313
|
+
/** Mainnet registry (default; backward compatible). */
|
|
3296
3314
|
declare const vaults: VaultRegistry;
|
|
3297
|
-
|
|
3298
|
-
declare
|
|
3299
|
-
declare function
|
|
3315
|
+
/** Devnet-only vault registry (fixtures / local testing). */
|
|
3316
|
+
declare const vaultsDevnet: VaultRegistry;
|
|
3317
|
+
declare function getVaultRegistry(cluster: BundleCluster): VaultRegistry;
|
|
3318
|
+
declare function isValidVaultAddress(address: string, cluster?: BundleCluster): boolean;
|
|
3319
|
+
declare function getVaultByAddress(address: string, cluster?: BundleCluster): VaultRegistryEntry | undefined;
|
|
3320
|
+
declare function getVaultById(vaultId: number, cluster?: BundleCluster): VaultRegistryEntry | undefined;
|
|
3300
3321
|
//#endregion
|
|
3301
3322
|
//#region src/NeutralTrade.d.ts
|
|
3302
3323
|
interface NeutralTradeConfig {
|
|
@@ -3447,4 +3468,4 @@ declare function derivePendingAuthPDA(bundlePDA: PublicKey, programId: PublicKey
|
|
|
3447
3468
|
*/
|
|
3448
3469
|
declare function getVaultDepositorAddressSync(programId: PublicKey, vault: PublicKey, authority: PublicKey): PublicKey;
|
|
3449
3470
|
//#endregion
|
|
3450
|
-
export { BUNDLE_PROGRAM_ID_V2_MAINNET, type BundleAccount, type BundleCluster, type BundleProgram, type BundleProvider, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, 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 VaultBalanceData, VaultCategory, type VaultRegistryEntry as VaultConfig, type VaultRegistry as VaultConfigRecord, VaultId, VaultType, buildBundleDepositInstructions, buildBundleRequestWithdrawInstruction, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, getBundleProgramId, getDefaultBundleProgramIdByCluster, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, isValidVaultAddress, tokens, vaults };
|
|
3471
|
+
export { BUNDLE_PROGRAM_ID_V2_MAINNET, type BundleAccount, type BundleCluster, type BundleProgram, type BundleProvider, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, DevnetVaultId, 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 VaultBalanceData, VaultCategory, type VaultRegistryEntry as VaultConfig, type VaultRegistry as VaultConfigRecord, VaultId, VaultType, buildBundleDepositInstructions, buildBundleRequestWithdrawInstruction, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, getBundleProgramId, getDefaultBundleProgramIdByCluster, getSolanaTokenDecimals, getSolanaTokenMint, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, getVaultRegistry, isValidVaultAddress, tokens, vaults, vaultsDevnet };
|
package/dist/index.mjs
CHANGED
|
@@ -11613,8 +11613,8 @@ function createBundleProgramById(provider, programId) {
|
|
|
11613
11613
|
//#endregion
|
|
11614
11614
|
//#region src/constants/vault-ids.ts
|
|
11615
11615
|
/**
|
|
11616
|
-
* Vault ID constants
|
|
11617
|
-
*
|
|
11616
|
+
* Vault ID constants (VaultId)
|
|
11617
|
+
* Auto-generated from the vault registry JSON.
|
|
11618
11618
|
*/
|
|
11619
11619
|
let VaultId = /* @__PURE__ */ function(VaultId$1) {
|
|
11620
11620
|
/** Hyperithm-CTA-USDC-Bundle */
|
|
@@ -11776,6 +11776,32 @@ let VaultId = /* @__PURE__ */ function(VaultId$1) {
|
|
|
11776
11776
|
return VaultId$1;
|
|
11777
11777
|
}({});
|
|
11778
11778
|
|
|
11779
|
+
//#endregion
|
|
11780
|
+
//#region src/constants/vault-ids.devnet.ts
|
|
11781
|
+
/**
|
|
11782
|
+
* Vault ID constants (DevnetVaultId)
|
|
11783
|
+
* Auto-generated from the vault registry JSON.
|
|
11784
|
+
*/
|
|
11785
|
+
let DevnetVaultId = /* @__PURE__ */ function(DevnetVaultId$1) {
|
|
11786
|
+
/** Dev1 */
|
|
11787
|
+
DevnetVaultId$1[DevnetVaultId$1["dev1_100000001"] = 100000001] = "dev1_100000001";
|
|
11788
|
+
return DevnetVaultId$1;
|
|
11789
|
+
}({});
|
|
11790
|
+
|
|
11791
|
+
//#endregion
|
|
11792
|
+
//#region src/registry/vaults.devnet.json
|
|
11793
|
+
var vaults_devnet_default = [{
|
|
11794
|
+
"vaultId": 100000001,
|
|
11795
|
+
"name": "Dev1",
|
|
11796
|
+
"type": "Bundle",
|
|
11797
|
+
"category": "Market Neutral",
|
|
11798
|
+
"vaultAddress": "EUs1XqK5Fr7DXxS5NTy2yYd3jehfYFJ4WYefesDf6iy3",
|
|
11799
|
+
"depositToken": "USDC",
|
|
11800
|
+
"bundleProgramId": "7trSyt7d1ZRnvfGh9JaQZwZMWtfAXMvMwN3UxgMzVFbv",
|
|
11801
|
+
"pointsMultiplier": 1,
|
|
11802
|
+
"pointsEnabled": false
|
|
11803
|
+
}];
|
|
11804
|
+
|
|
11779
11805
|
//#endregion
|
|
11780
11806
|
//#region src/registry/vaults.json
|
|
11781
11807
|
var vaults_default = [
|
|
@@ -12716,6 +12742,27 @@ const tokens = {
|
|
|
12716
12742
|
}
|
|
12717
12743
|
}
|
|
12718
12744
|
};
|
|
12745
|
+
/** Devnet SPL mint overrides (`depositToken` still uses `SupportedToken`). */
|
|
12746
|
+
const SOLANA_MINT_OVERRIDES_DEVNET = { [SupportedToken.USDC]: "6a8hWCCa2QDQTqzLUapZwZtgHTox8BsgataN6JVLwdo7" };
|
|
12747
|
+
/**
|
|
12748
|
+
* Solana mint address for a supported token, keyed by bundle cluster.
|
|
12749
|
+
* Devnet USDC uses the team mock mint; other tokens use mainnet table until devnet overrides exist.
|
|
12750
|
+
*/
|
|
12751
|
+
function getSolanaTokenMint(token, cluster = "mainnet") {
|
|
12752
|
+
const row = tokens[token].onChain[SupportedChain.Solana];
|
|
12753
|
+
if (!row) throw new Error(`No Solana mint configured for ${token}`);
|
|
12754
|
+
if (cluster === "devnet") {
|
|
12755
|
+
const override = SOLANA_MINT_OVERRIDES_DEVNET[token];
|
|
12756
|
+
if (override) return override;
|
|
12757
|
+
}
|
|
12758
|
+
return row.address;
|
|
12759
|
+
}
|
|
12760
|
+
/** SPL decimals for `token` (same on mainnet vs devnet for current overrides). */
|
|
12761
|
+
function getSolanaTokenDecimals(token) {
|
|
12762
|
+
const row = tokens[token].onChain[SupportedChain.Solana];
|
|
12763
|
+
if (!row) throw new Error(`No Solana decimals configured for ${token}`);
|
|
12764
|
+
return row.decimals;
|
|
12765
|
+
}
|
|
12719
12766
|
|
|
12720
12767
|
//#endregion
|
|
12721
12768
|
//#region src/types/vault-types.ts
|
|
@@ -12803,16 +12850,25 @@ function toVaultConfig(entry) {
|
|
|
12803
12850
|
function toVaultRegistry(entries) {
|
|
12804
12851
|
return Object.fromEntries(entries.map((entry) => [entry.vaultId, toVaultConfig(entry)]));
|
|
12805
12852
|
}
|
|
12806
|
-
const
|
|
12807
|
-
const
|
|
12808
|
-
|
|
12809
|
-
|
|
12853
|
+
const parsedVaultsMainnet = VaultRegistryArraySchema.parse(vaults_default);
|
|
12854
|
+
const parsedVaultsDevnet = VaultRegistryArraySchema.parse(vaults_devnet_default);
|
|
12855
|
+
const vaultsMainnetRegistry = toVaultRegistry(parsedVaultsMainnet);
|
|
12856
|
+
const vaultsDevnetRegistry = toVaultRegistry(parsedVaultsDevnet);
|
|
12857
|
+
/** Mainnet registry (default; backward compatible). */
|
|
12858
|
+
const vaults = vaultsMainnetRegistry;
|
|
12859
|
+
/** Devnet-only vault registry (fixtures / local testing). */
|
|
12860
|
+
const vaultsDevnet = vaultsDevnetRegistry;
|
|
12861
|
+
function getVaultRegistry(cluster) {
|
|
12862
|
+
return cluster === "devnet" ? vaultsDevnetRegistry : vaultsMainnetRegistry;
|
|
12863
|
+
}
|
|
12864
|
+
function isValidVaultAddress(address$2, cluster = "mainnet") {
|
|
12865
|
+
return Object.values(getVaultRegistry(cluster)).map((vault) => vault.vaultAddress).includes(address$2);
|
|
12810
12866
|
}
|
|
12811
|
-
function getVaultByAddress(address$2) {
|
|
12812
|
-
return Object.values(
|
|
12867
|
+
function getVaultByAddress(address$2, cluster = "mainnet") {
|
|
12868
|
+
return Object.values(getVaultRegistry(cluster)).find((v) => v.vaultAddress === address$2);
|
|
12813
12869
|
}
|
|
12814
|
-
function getVaultById(vaultId) {
|
|
12815
|
-
return
|
|
12870
|
+
function getVaultById(vaultId, cluster = "mainnet") {
|
|
12871
|
+
return getVaultRegistry(cluster)[vaultId];
|
|
12816
12872
|
}
|
|
12817
12873
|
|
|
12818
12874
|
//#endregion
|
|
@@ -13320,4 +13376,4 @@ var NeutralTrade = class NeutralTrade {
|
|
|
13320
13376
|
};
|
|
13321
13377
|
|
|
13322
13378
|
//#endregion
|
|
13323
|
-
export { BUNDLE_PROGRAM_ID_V2_MAINNET, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, NeutralTrade, SEED_ORACLE, SEED_PENDING_AUTH, SEED_TEMP, SEED_USER, SupportedChain, SupportedToken, VaultCategory, VaultId, VaultType, buildBundleDepositInstructions, buildBundleRequestWithdrawInstruction, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, getBundleProgramId, getDefaultBundleProgramIdByCluster, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, isValidVaultAddress, tokens, vaults };
|
|
13379
|
+
export { BUNDLE_PROGRAM_ID_V2_MAINNET, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, DevnetVaultId, NeutralTrade, SEED_ORACLE, SEED_PENDING_AUTH, SEED_TEMP, SEED_USER, SupportedChain, SupportedToken, VaultCategory, VaultId, VaultType, buildBundleDepositInstructions, buildBundleRequestWithdrawInstruction, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, getBundleProgramId, getDefaultBundleProgramIdByCluster, getSolanaTokenDecimals, getSolanaTokenMint, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, getVaultRegistry, isValidVaultAddress, tokens, vaults, vaultsDevnet };
|