@0dotxyz/p0-ts-sdk 2.1.3 → 2.2.0-alpha.1

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/vendor.cjs CHANGED
@@ -510,12 +510,36 @@ function createMemoInstruction(memo, signerPubkeys) {
510
510
  });
511
511
  }
512
512
  var TokenInstruction = /* @__PURE__ */ ((TokenInstruction2) => {
513
+ TokenInstruction2[TokenInstruction2["Approve"] = 4] = "Approve";
513
514
  TokenInstruction2[TokenInstruction2["InitializeAccount"] = 1] = "InitializeAccount";
514
515
  TokenInstruction2[TokenInstruction2["TransferChecked"] = 12] = "TransferChecked";
515
516
  TokenInstruction2[TokenInstruction2["CloseAccount"] = 9] = "CloseAccount";
516
517
  TokenInstruction2[TokenInstruction2["SyncNative"] = 17] = "SyncNative";
517
518
  return TokenInstruction2;
518
519
  })(TokenInstruction || {});
520
+ var approveInstructionData = bufferLayout.struct([
521
+ bufferLayout.u8("instruction"),
522
+ bufferLayoutUtils.u64("amount")
523
+ ]);
524
+ function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {
525
+ const keys = addSigners(
526
+ [
527
+ { pubkey: account, isSigner: false, isWritable: true },
528
+ { pubkey: delegate, isSigner: false, isWritable: false }
529
+ ],
530
+ owner,
531
+ multiSigners
532
+ );
533
+ const data = buffer.Buffer.alloc(approveInstructionData.span);
534
+ approveInstructionData.encode(
535
+ {
536
+ instruction: 4 /* Approve */,
537
+ amount: BigInt(amount)
538
+ },
539
+ data
540
+ );
541
+ return new web3_js.TransactionInstruction({ keys, programId, data });
542
+ }
519
543
  var initializeAccountInstructionData = bufferLayout.struct([
520
544
  bufferLayout.u8("instruction")
521
545
  ]);
@@ -28841,7 +28865,7 @@ var SEED_RATE_MODEL = "rate_model";
28841
28865
  var SEED_USER_SUPPLY_POSITION = "user_supply_position";
28842
28866
  var SEED_USER_CLAIM = "user_claim";
28843
28867
  var SEED_LENDING_REWARDS_RATE_MODEL = "lending_rewards_rate_model";
28844
- function getAllDerivedJupLendAccounts(mint, tokenProgram) {
28868
+ function getAllDerivedJupLendAccounts(mint) {
28845
28869
  const [fTokenMint] = deriveJupLendFTokenMint(mint);
28846
28870
  const [lending] = deriveJupLendLending(mint, fTokenMint);
28847
28871
  const [liquidity] = deriveJupLendLiquidity();
@@ -28851,7 +28875,7 @@ function getAllDerivedJupLendAccounts(mint, tokenProgram) {
28851
28875
  supplyTokenReservesLiquidity: deriveJupLendTokenReserve(mint)[0],
28852
28876
  lendingSupplyPositionOnLiquidity: deriveJupLendLiquiditySupplyPositionPda(mint, lending)[0],
28853
28877
  rateModel: deriveJupLendRateModel(mint)[0],
28854
- vault: deriveJupLendLiquidityVaultAta(mint, liquidity, tokenProgram),
28878
+ vault: deriveJupLendLiquidityVaultAta(mint, liquidity),
28855
28879
  liquidity,
28856
28880
  rewardsRateModel: deriveJupLendLendingRewardsRateModel(mint)[0]
28857
28881
  };
@@ -29261,6 +29285,7 @@ exports.TokenOwnerOffCurveError = TokenOwnerOffCurveError;
29261
29285
  exports.TokenUnsupportedInstructionError = TokenUnsupportedInstructionError;
29262
29286
  exports.ZERO = ZERO;
29263
29287
  exports.addSigners = addSigners;
29288
+ exports.approveInstructionData = approveInstructionData;
29264
29289
  exports.calculateAPYFromAPR = calculateAPYFromAPR;
29265
29290
  exports.calculateDriftBorrowAPR = calculateDriftBorrowAPR;
29266
29291
  exports.calculateDriftBorrowAPY = calculateDriftBorrowAPY;
@@ -29286,6 +29311,7 @@ exports.calculateSlotAdjustmentFactor = calculateSlotAdjustmentFactor;
29286
29311
  exports.calculateUtilizationRatio = calculateUtilizationRatio;
29287
29312
  exports.closeAccountInstructionData = closeAccountInstructionData;
29288
29313
  exports.createAccountIx = createAccountIx;
29314
+ exports.createApproveInstruction = createApproveInstruction;
29289
29315
  exports.createAssociatedTokenAccountIdempotentInstruction = createAssociatedTokenAccountIdempotentInstruction;
29290
29316
  exports.createAssociatedTokenAccountInstruction = createAssociatedTokenAccountInstruction;
29291
29317
  exports.createCloseAccountInstruction = createCloseAccountInstruction;