@huma-finance/widgets 0.0.62-beta.636 → 0.0.62-beta.637

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.
@@ -5526,6 +5526,7 @@ function PersonaEvaluation(_ref) {
5526
5526
  campaign,
5527
5527
  pointsTestnetExperience,
5528
5528
  chainType,
5529
+ chainSpecificData,
5529
5530
  changeTranche,
5530
5531
  handleClose
5531
5532
  } = _ref;
@@ -5566,9 +5567,9 @@ function PersonaEvaluation(_ref) {
5566
5567
  try {
5567
5568
  isActionOngoingRef.current = true;
5568
5569
  setLoadingType('approveLender');
5569
- await shared.IdentityServiceV2.approveLender(account, chainId, poolInfo.juniorTrancheVault, isDev);
5570
+ await shared.IdentityServiceV2.approveLender(account, chainId, poolInfo.juniorTrancheVault, isDev, chainSpecificData);
5570
5571
  if (!isUniTranche) {
5571
- await shared.IdentityServiceV2.approveLender(account, chainId, poolInfo.seniorTrancheVault, isDev);
5572
+ await shared.IdentityServiceV2.approveLender(account, chainId, poolInfo.seniorTrancheVault, isDev, chainSpecificData);
5572
5573
  }
5573
5574
  if (isUniTranche) {
5574
5575
  changeTranche('junior');
@@ -5580,7 +5581,7 @@ function PersonaEvaluation(_ref) {
5580
5581
  isActionOngoingRef.current = false;
5581
5582
  setLoadingType(undefined);
5582
5583
  }
5583
- }, [account, chainId, changeTranche, dispatch, isDev, isUniTranche, poolInfo.juniorTrancheVault, poolInfo.seniorTrancheVault]);
5584
+ }, [account, chainId, chainSpecificData, changeTranche, dispatch, isDev, isUniTranche, poolInfo.juniorTrancheVault, poolInfo.seniorTrancheVault]);
5584
5585
  const checkVerificationStatus = React.useCallback(async () => {
5585
5586
  if (isActionOngoingRef.current || isKYCResumedRef.current) {
5586
5587
  return;
@@ -8599,6 +8600,7 @@ function Evaluation(_ref) {
8599
8600
  handleClose
8600
8601
  } = _ref;
8601
8602
  if ((_poolInfo$KYC = poolInfo.KYC) !== null && _poolInfo$KYC !== void 0 && _poolInfo$KYC.Persona) {
8603
+ const solanChainInfo = shared.SOLANA_CHAIN_INFO[poolInfo.chainId];
8602
8604
  return jsxRuntime.jsx(PersonaEvaluation, {
8603
8605
  poolInfo: {
8604
8606
  KYC: poolInfo.KYC,
@@ -8609,6 +8611,10 @@ function Evaluation(_ref) {
8609
8611
  isUniTranche: isUniTranche,
8610
8612
  pointsTestnetExperience: pointsTestnetExperience,
8611
8613
  campaign: campaign,
8614
+ chainSpecificData: {
8615
+ huma_program_id: solanChainInfo.poolProgram,
8616
+ pool_id: poolInfo.poolId
8617
+ },
8612
8618
  chainType: shared.CHAIN_TYPE.SOLANA,
8613
8619
  changeTranche: changeTranche
8614
8620
  });
@@ -8863,12 +8869,13 @@ function Transfer$4(_ref) {
8863
8869
  seniorTrancheATA,
8864
8870
  juniorTrancheATA
8865
8871
  } = shared.getTokenAccounts(poolInfo, publicKey);
8872
+ const approvedLender = selectedTranche === 'senior' ? seniorLenderApprovedAccountPDA : juniorLenderApprovedAccountPDA;
8866
8873
  if (selectedTranche === 'senior' && !seniorLenderStateAccount || selectedTranche === 'junior' && !juniorLenderStateAccount) {
8867
8874
  const createLenderAccountsTx = await program.methods.createLenderAccounts().accountsPartial({
8868
8875
  lender: publicKey,
8869
8876
  humaConfig: poolInfo.humaConfig,
8870
8877
  poolConfig: poolInfo.poolConfig,
8871
- approvedLender: selectedTranche === 'senior' ? seniorLenderApprovedAccountPDA : juniorLenderApprovedAccountPDA,
8878
+ approvedLender,
8872
8879
  trancheMint: selectedTranche === 'senior' ? poolInfo.seniorTrancheMint : poolInfo.juniorTrancheMint,
8873
8880
  lenderTrancheToken: selectedTranche === 'senior' ? seniorTrancheATA : juniorTrancheATA,
8874
8881
  tokenProgram: splToken.TOKEN_2022_PROGRAM_ID
@@ -8876,6 +8883,7 @@ function Transfer$4(_ref) {
8876
8883
  tx.add(createLenderAccountsTx);
8877
8884
  }
8878
8885
  const depositTx = await program.methods.deposit(supplyBigNumber).accountsPartial({
8886
+ approvedLender,
8879
8887
  depositor: publicKey,
8880
8888
  poolConfig: poolInfo.poolConfig,
8881
8889
  underlyingMint: poolInfo.underlyingMint.address,
@@ -8884,7 +8892,7 @@ function Transfer$4(_ref) {
8884
8892
  depositorUnderlyingToken: underlyingTokenATA,
8885
8893
  depositorTrancheToken: selectedTranche === 'senior' ? seniorTrancheATA : juniorTrancheATA,
8886
8894
  humaConfig: poolInfo.humaConfig,
8887
- tokenProgram: splToken.TOKEN_2022_PROGRAM_ID
8895
+ underlyingTokenProgram: splToken.TOKEN_PROGRAM_ID
8888
8896
  }).transaction();
8889
8897
  tx.add(depositTx);
8890
8898
  setTransaction(tx);
@@ -9852,14 +9860,14 @@ function Transfer$1(_ref) {
9852
9860
  // Create user token account if it doesn't exist
9853
9861
  let tokenAccount;
9854
9862
  try {
9855
- tokenAccount = await splToken.getAccount(connection, underlyingTokenATA, undefined, splToken.TOKEN_2022_PROGRAM_ID);
9863
+ tokenAccount = await splToken.getAccount(connection, underlyingTokenATA, undefined, splToken.TOKEN_PROGRAM_ID);
9856
9864
  } catch (error) {
9857
9865
  // TokenAccountNotFoundError can be possible if the associated address has already received some lamports,
9858
9866
  // becoming a system account. Assuming program derived addressing is safe, this is the only case for the
9859
9867
  // TokenInvalidAccountOwnerError in this code path.
9860
9868
  if (error instanceof splToken.TokenAccountNotFoundError || error instanceof splToken.TokenInvalidAccountOwnerError) {
9861
9869
  // As this isn't atomic, it's possible others can create associated accounts meanwhile.
9862
- tx.add(splToken.createAssociatedTokenAccountInstruction(publicKey, underlyingTokenATA, publicKey, new web3_js.PublicKey(poolInfo.underlyingMint.address), splToken.TOKEN_2022_PROGRAM_ID, splToken.ASSOCIATED_TOKEN_PROGRAM_ID));
9870
+ tx.add(splToken.createAssociatedTokenAccountInstruction(publicKey, underlyingTokenATA, publicKey, new web3_js.PublicKey(poolInfo.underlyingMint.address), splToken.TOKEN_PROGRAM_ID, splToken.ASSOCIATED_TOKEN_PROGRAM_ID));
9863
9871
  }
9864
9872
  }
9865
9873
 
@@ -9876,7 +9884,7 @@ function Transfer$1(_ref) {
9876
9884
  // amount
9877
9885
  poolInfo.underlyingMint.decimals, undefined,
9878
9886
  // multiSigners
9879
- splToken.TOKEN_2022_PROGRAM_ID));
9887
+ splToken.TOKEN_PROGRAM_ID));
9880
9888
  }
9881
9889
  const {
9882
9890
  creditConfigAccount,
@@ -9894,7 +9902,7 @@ function Transfer$1(_ref) {
9894
9902
  underlyingMint: poolInfo.underlyingMint.address,
9895
9903
  poolUnderlyingToken: poolInfo.poolUnderlyingTokenAccount,
9896
9904
  borrowerUnderlyingToken: underlyingTokenATA,
9897
- tokenProgram: splToken.TOKEN_2022_PROGRAM_ID
9905
+ tokenProgram: splToken.TOKEN_PROGRAM_ID
9898
9906
  }).transaction();
9899
9907
  tx.add(programTx);
9900
9908
  setTransaction(tx);
@@ -10074,7 +10082,7 @@ function Transfer(_ref) {
10074
10082
  underlyingMint: poolInfo.underlyingMint.address,
10075
10083
  poolUnderlyingToken: poolInfo.poolUnderlyingTokenAccount,
10076
10084
  borrowerUnderlyingToken: underlyingTokenATA,
10077
- tokenProgram: splToken.TOKEN_2022_PROGRAM_ID
10085
+ tokenProgram: splToken.TOKEN_PROGRAM_ID
10078
10086
  }).transaction();
10079
10087
  setTransaction(tx);
10080
10088
  }