@lavarage/sdk 8.0.6 → 8.0.8

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/crossbar.ts CHANGED
@@ -15,12 +15,12 @@ export type ApiKeys = {
15
15
  export const SURGE_FEEDS = [
16
16
  {
17
17
  address: NATIVE_MINT.toBase58(),
18
- feedId: '822512ee9add93518eca1c105a38422841a76c590db079eebb283deb2c14caa9',
18
+ feedId: '0x822512ee9add93518eca1c105a38422841a76c590db079eebb283deb2c14caa9',
19
19
  label: 'SOL-USD',
20
20
  },
21
21
  {
22
22
  address: USDC_MINT.toBase58(),
23
- feedId: '883ea8295f70ae506e894679d124196bb07064ea530cefd835b58c33a5ab6549',
23
+ feedId: '0x883ea8295f70ae506e894679d124196bb07064ea530cefd835b58c33a5ab6549',
24
24
  label: 'USDC-USD',
25
25
  },
26
26
  ];
package/dist/index.js CHANGED
@@ -7647,12 +7647,12 @@ function isSolProgram(program) {
7647
7647
  var SURGE_FEEDS = [
7648
7648
  {
7649
7649
  address: import_spl_token.NATIVE_MINT.toBase58(),
7650
- feedId: "822512ee9add93518eca1c105a38422841a76c590db079eebb283deb2c14caa9",
7650
+ feedId: "0x822512ee9add93518eca1c105a38422841a76c590db079eebb283deb2c14caa9",
7651
7651
  label: "SOL-USD"
7652
7652
  },
7653
7653
  {
7654
7654
  address: USDC_MINT.toBase58(),
7655
- feedId: "883ea8295f70ae506e894679d124196bb07064ea530cefd835b58c33a5ab6549",
7655
+ feedId: "0x883ea8295f70ae506e894679d124196bb07064ea530cefd835b58c33a5ab6549",
7656
7656
  label: "USDC-USD"
7657
7657
  }
7658
7658
  ];
@@ -9261,26 +9261,6 @@ function getPda(seed, programId) {
9261
9261
  const seedsBuffer = Array.isArray(seed) ? seed : [seed];
9262
9262
  return import_web33.PublicKey.findProgramAddressSync(seedsBuffer, programId)[0];
9263
9263
  }
9264
- function idlAccountNamesToCamelCase(idl) {
9265
- if (idl === null || idl === void 0) return idl;
9266
- if (Array.isArray(idl)) return idl.map(idlAccountNamesToCamelCase);
9267
- if (typeof idl === "string") return idl;
9268
- if (typeof idl === "object") {
9269
- const out = {};
9270
- for (const [k, v] of Object.entries(idl)) {
9271
- let newV = idlAccountNamesToCamelCase(v);
9272
- if ((k === "name" || k === "path") && typeof newV === "string" && newV.includes("_")) {
9273
- newV = newV.split(".").map((s) => s.replace(/_([a-z])/g, (_, c) => c.toUpperCase())).join(".");
9274
- }
9275
- out[k] = newV;
9276
- }
9277
- return out;
9278
- }
9279
- return idl;
9280
- }
9281
- var LAVARAGE_USDC_IDL_CAMEL = idlAccountNamesToCamelCase(
9282
- lavarageUSDC_default
9283
- );
9284
9264
  function getPositionAccountPDA(lavarageProgram, offer, seed) {
9285
9265
  return getPda(
9286
9266
  [
@@ -9661,7 +9641,9 @@ var borrowV2 = (lavarageProgram, offer, marginSOL, leverage, randomSeed, quoteTo
9661
9641
  ] : []
9662
9642
  ).instruction() : yield lavarageProgram.methods.tradingOpenBorrow(
9663
9643
  new import_anchor2.BN((marginSOL.toNumber() * leverage).toFixed(0)),
9664
- marginSOL
9644
+ marginSOL,
9645
+ null,
9646
+ null
9665
9647
  ).accountsStrict({
9666
9648
  nodeWallet: offer.account.nodeWallet,
9667
9649
  instructions: import_web33.SYSVAR_INSTRUCTIONS_PUBKEY,
@@ -9990,7 +9972,7 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
9990
9972
  var _a;
9991
9973
  let partnerFeeMarkupAsPkey;
9992
9974
  const referralVaultProgram = new import_anchor2.Program(userVault_default, lavarageProgram.provider);
9993
- const program = new import_anchor2.Program(LAVARAGE_USDC_IDL_CAMEL, lavarageProgram.provider);
9975
+ const program = new import_anchor2.Program(lavarageUSDC_default, lavarageProgram.provider);
9994
9976
  if (partnerFeeMarkup) {
9995
9977
  const feeBuffer = Buffer.alloc(8);
9996
9978
  feeBuffer.writeBigUInt64LE(BigInt(partnerFeeMarkup));
@@ -10003,7 +9985,6 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
10003
9985
  offer,
10004
9986
  randomSeed.publicKey
10005
9987
  );
10006
- console.log("SDK: positionAccount", positionAccount.toBase58());
10007
9988
  const quoteMintAccount = (_a = optionalRPCResults == null ? void 0 : optionalRPCResults.quoteMintAccountInfo) != null ? _a : yield program.provider.connection.getAccountInfo(quoteToken);
10008
9989
  const quoteTokenProgram = quoteMintAccount == null ? void 0 : quoteMintAccount.owner;
10009
9990
  const fromTokenAccount = yield getTokenAccountOrCreateIfNotExists(
@@ -10141,41 +10122,6 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
10141
10122
  );
10142
10123
  }
10143
10124
  }
10144
- console.log("SDK: tradingOpenBorrowInstruction accounts", {
10145
- nodeWallet: offer.account.nodeWallet,
10146
- instructions: import_web33.SYSVAR_INSTRUCTIONS_PUBKEY,
10147
- tradingPool: offer.publicKey,
10148
- positionAccount,
10149
- trader: program.provider.publicKey,
10150
- systemProgram: import_web33.SystemProgram.programId,
10151
- clock: import_web33.SYSVAR_CLOCK_PUBKEY,
10152
- randomAccountAsId: randomSeed.publicKey.toBase58(),
10153
- feeTokenAccount: (0, import_spl_token3.getAssociatedTokenAddressSync)(
10154
- quoteToken,
10155
- new import_web33.PublicKey("6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF"),
10156
- true,
10157
- quoteTokenProgram
10158
- ),
10159
- toTokenAccount: (0, import_spl_token3.getAssociatedTokenAddressSync)(
10160
- quoteToken,
10161
- program.provider.publicKey,
10162
- true,
10163
- quoteTokenProgram
10164
- ),
10165
- tokenProgram: quoteTokenProgram,
10166
- fromTokenAccount: (0, import_spl_token3.getAssociatedTokenAddressSync)(
10167
- quoteToken,
10168
- offer.account.nodeWallet,
10169
- true,
10170
- quoteTokenProgram
10171
- ),
10172
- positionTokenAccount: toTokenAccount.account.address,
10173
- collateralTokenProgram: tokenProgram,
10174
- associatedTokenProgram: import_spl_token3.ASSOCIATED_TOKEN_PROGRAM_ID,
10175
- collateralMint: offer.account.collateralType,
10176
- quoteMint: quoteToken,
10177
- feeRecipient: new import_web33.PublicKey("6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF")
10178
- });
10179
10125
  const updateOracleInstructions = yield getUpdateOracleIxs(
10180
10126
  // @ts-expect-error IDL mismatch
10181
10127
  program,
@@ -10238,7 +10184,9 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
10238
10184
  ] : []
10239
10185
  ).instruction() : yield program.methods.tradingOpenBorrow(
10240
10186
  new import_anchor2.BN((marginSOL.toNumber() * leverage).toFixed(0)),
10241
- marginSOL
10187
+ marginSOL,
10188
+ null,
10189
+ null
10242
10190
  ).accountsStrict({
10243
10191
  nodeWallet: offer.account.nodeWallet,
10244
10192
  instructions: import_web33.SYSVAR_INSTRUCTIONS_PUBKEY,
@@ -10347,6 +10295,7 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
10347
10295
  // toTokenAccount.instruction!,
10348
10296
  partnerFeeRecipientVaultCreateIx,
10349
10297
  partnerFeeRecipientTokenAccountCreateIx,
10298
+ ...updateOracleInstructions,
10350
10299
  tradingOpenBorrowInstruction,
10351
10300
  ...jupiterIxs,
10352
10301
  openAddCollateralInstruction,