@jup-ag/lend 0.0.8 → 0.0.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.
@@ -3563,7 +3563,14 @@ type OperateContextParams = {
3563
3563
  recipient?: PublicKey;
3564
3564
  program: Program<Vaults>;
3565
3565
  } & ConnectionParams;
3566
- type OperateParams = OperateContextParams;
3566
+ type OperateParams = {
3567
+ vaultId: number;
3568
+ positionId: number;
3569
+ colAmount: BN;
3570
+ debtAmount: BN;
3571
+ positionOwner?: PublicKey;
3572
+ recipient?: PublicKey;
3573
+ } & ConnectionParams;
3567
3574
  declare function getOperateContext({ vaultId, positionId, program, connection, signer, recipient, positionOwner, colAmount: newCol, debtAmount: newDebt, }: OperateContextParams): Promise<{
3568
3575
  accounts: {
3569
3576
  signer: PublicKey;
@@ -3563,7 +3563,14 @@ type OperateContextParams = {
3563
3563
  recipient?: PublicKey;
3564
3564
  program: Program<Vaults>;
3565
3565
  } & ConnectionParams;
3566
- type OperateParams = OperateContextParams;
3566
+ type OperateParams = {
3567
+ vaultId: number;
3568
+ positionId: number;
3569
+ colAmount: BN;
3570
+ debtAmount: BN;
3571
+ positionOwner?: PublicKey;
3572
+ recipient?: PublicKey;
3573
+ } & ConnectionParams;
3567
3574
  declare function getOperateContext({ vaultId, positionId, program, connection, signer, recipient, positionOwner, colAmount: newCol, debtAmount: newDebt, }: OperateContextParams): Promise<{
3568
3575
  accounts: {
3569
3576
  signer: PublicKey;
@@ -1,7 +1,7 @@
1
1
  import { PublicKey, SystemProgram } from '@solana/web3.js';
2
2
  import BN from 'bn.js';
3
3
  import { BN as BN$1, Program } from '@coral-xyz/anchor';
4
- import { g as getTick, a as getTickIdLiquidation, c as getVaultState, d as getVaultConfig, e as getBranch, f as getTickHasDebt, h as getVaultMetadata, i as getPosition, j as getLiquidity, k as getClaimAccount, l as getRateModel, m as getUserBorrowPosition, n as getUserSupplyPosition, o as getLiquidityReserve, p as getPositionTokenAccount, v as vaults } from '../shared/lend.BDLW8gHu.mjs';
4
+ import { g as getTick, a as getTickIdLiquidation, c as getVaultState, d as getVaultConfig, e as getBranch, f as getTickHasDebt, h as getVaultMetadata, i as getPosition, j as getLiquidity, k as getClaimAccount, l as getRateModel, m as getUserBorrowPosition, n as getUserSupplyPosition, o as getLiquidityReserve, p as getPositionTokenAccount, v as vaults } from '../shared/lend.CzIu1Y5n.mjs';
5
5
  import { l as liquidity } from '../shared/lend.D5fnz2Fg.mjs';
6
6
  import { getMint, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
7
7
 
@@ -1334,6 +1334,10 @@ const getOperateIx = async ({
1334
1334
  connection,
1335
1335
  publicKey: signer
1336
1336
  });
1337
+ console.log(
1338
+ getVaultConfig(vaultId),
1339
+ await program.account.vaultConfig.fetch(getVaultConfig(vaultId))
1340
+ );
1337
1341
  const {
1338
1342
  accounts,
1339
1343
  remainingAccounts,
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  export { l as lendingPda, b as lendingRewardRateModelPda, a as liquidityPda } from './shared/lend.Cbyx-MDB.mjs';
2
- export { b as borrowPda } from './shared/lend.BDLW8gHu.mjs';
2
+ export { b as borrowPda } from './shared/lend.CzIu1Y5n.mjs';
3
3
  import '@solana/web3.js';
4
4
  import './shared/lend.D5fnz2Fg.mjs';
5
5
  import '@solana/spl-token';
6
+ import 'bn.js';
@@ -1,6 +1,7 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
2
  import { l as liquidity } from './lend.D5fnz2Fg.mjs';
3
3
  import { getAssociatedTokenAddressSync } from '@solana/spl-token';
4
+ import BN from 'bn.js';
4
5
 
5
6
  const address = "Ho32sUQ4NzuAQgkPkHuNDG3G18rgHmYtXFA8EBmqQrAu";
6
7
  const metadata = {
@@ -4251,14 +4252,17 @@ const vaults = {
4251
4252
 
4252
4253
  const getVaultConfig = (vaultId) => {
4253
4254
  const [pda] = PublicKey.findProgramAddressSync(
4254
- [Buffer.from("vault_config"), Buffer.from(vaultId.toString())],
4255
+ [Buffer.from("vault_config"), new BN(vaultId).toArrayLike(Buffer, "le", 2)],
4255
4256
  new PublicKey(vaults.address)
4256
4257
  );
4257
4258
  return pda;
4258
4259
  };
4259
4260
  const getVaultMetadata = (vaultId) => {
4260
4261
  const [pda] = PublicKey.findProgramAddressSync(
4261
- [Buffer.from("vault_metadata"), Buffer.from(vaultId.toString())],
4262
+ [
4263
+ Buffer.from("vault_metadata"),
4264
+ new BN(vaultId).toArrayLike(Buffer, "le", 2)
4265
+ ],
4262
4266
  new PublicKey(vaults.address)
4263
4267
  );
4264
4268
  return pda;
@@ -4272,7 +4276,7 @@ const getVaultAdmin = () => {
4272
4276
  };
4273
4277
  const getVaultState = (vaultId) => {
4274
4278
  const [pda] = PublicKey.findProgramAddressSync(
4275
- [Buffer.from("vault_state"), Buffer.from(vaultId.toString())],
4279
+ [Buffer.from("vault_state"), new BN(vaultId).toArrayLike(Buffer, "le", 2)],
4276
4280
  new PublicKey(vaults.address)
4277
4281
  );
4278
4282
  return pda;
@@ -4288,8 +4292,8 @@ const getBranch = (vaultId, branchId) => {
4288
4292
  const [pda] = PublicKey.findProgramAddressSync(
4289
4293
  [
4290
4294
  Buffer.from("branch"),
4291
- Buffer.from(vaultId.toString()),
4292
- Buffer.from(branchId.toString())
4295
+ new BN(vaultId).toArrayLike(Buffer, "le", 2),
4296
+ new BN(branchId).toArrayLike(Buffer, "le", 4)
4293
4297
  ],
4294
4298
  new PublicKey(vaults.address)
4295
4299
  );
@@ -4299,8 +4303,8 @@ const getPosition = (vaultId, positionId) => {
4299
4303
  const [pda] = PublicKey.findProgramAddressSync(
4300
4304
  [
4301
4305
  Buffer.from("position"),
4302
- Buffer.from(vaultId.toString()),
4303
- Buffer.from(positionId.toString())
4306
+ new BN(vaultId).toArrayLike(Buffer, "le", 2),
4307
+ new BN(positionId).toArrayLike(Buffer, "le", 4)
4304
4308
  ],
4305
4309
  new PublicKey(vaults.address)
4306
4310
  );
@@ -4311,8 +4315,8 @@ const getTick = (vaultId, tick) => {
4311
4315
  const [pda] = PublicKey.findProgramAddressSync(
4312
4316
  [
4313
4317
  Buffer.from("tick"),
4314
- Buffer.from(vaultId.toString()),
4315
- Buffer.from((tick + MAX_TICK).toString())
4318
+ new BN(vaultId).toArrayLike(Buffer, "le", 2),
4319
+ new BN(tick + MAX_TICK).toArrayLike(Buffer, "le", 4)
4316
4320
  ],
4317
4321
  new PublicKey(vaults.address)
4318
4322
  );
@@ -4322,9 +4326,9 @@ const getTickIdLiquidation = (vaultId, tick, totalIds) => {
4322
4326
  const [pda] = PublicKey.findProgramAddressSync(
4323
4327
  [
4324
4328
  Buffer.from("tick_id_data"),
4325
- Buffer.from(vaultId.toString()),
4326
- Buffer.from((tick + MAX_TICK).toString()),
4327
- Buffer.from(((totalIds + 2) / 3).toFixed(0))
4329
+ new BN(vaultId).toArrayLike(Buffer, "le", 2),
4330
+ new BN(tick + MAX_TICK).toArrayLike(Buffer, "le", 4),
4331
+ new BN((totalIds + 2) / 3).toArrayLike(Buffer, "le", 4)
4328
4332
  ],
4329
4333
  new PublicKey(vaults.address)
4330
4334
  );
@@ -4334,8 +4338,8 @@ const getPositionMint = (vaultId, positionId) => {
4334
4338
  const [pda] = PublicKey.findProgramAddressSync(
4335
4339
  [
4336
4340
  Buffer.from("position_mint"),
4337
- Buffer.from(vaultId.toString()),
4338
- Buffer.from(positionId.toString())
4341
+ new BN(vaultId).toArrayLike(Buffer, "le", 2),
4342
+ new BN(positionId).toArrayLike(Buffer, "le", 4)
4339
4343
  ],
4340
4344
  new PublicKey(vaults.address)
4341
4345
  );
@@ -4395,8 +4399,8 @@ const getTickHasDebt = (vaultId, index) => {
4395
4399
  const [pda] = PublicKey.findProgramAddressSync(
4396
4400
  [
4397
4401
  Buffer.from("tick_has_debt"),
4398
- Buffer.from(vaultId.toString()),
4399
- Buffer.from(index.toString())
4402
+ new BN(vaultId).toArrayLike(Buffer, "le", 2),
4403
+ new BN(index).toArrayLike(Buffer, "le", 1)
4400
4404
  ],
4401
4405
  new PublicKey(vaults.address)
4402
4406
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jup-ag/lend",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "type": "module",