@huma-finance/widgets 0.0.76 → 0.0.77-beta.1006

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.js CHANGED
@@ -182864,6 +182864,7 @@ function Transfer$9({
182864
182864
  if (!cr || pr || !lr)
182865
182865
  return;
182866
182866
  const yr = new Transaction$3(), { underlyingTokenATA: Sr, seniorTrancheATA: Ir, juniorTrancheATA: xr } = getTokenAccounts(ar, cr), Cr = or === "senior" ? ar.seniorTrancheMint : ar.juniorTrancheMint, Br = or === "senior" ? Ir : xr;
182867
+ let Pr = !1;
182867
182868
  try {
182868
182869
  await getAccount(
182869
182870
  lr,
@@ -182871,8 +182872,8 @@ function Transfer$9({
182871
182872
  void 0,
182872
182873
  TOKEN_PROGRAM_ID
182873
182874
  );
182874
- } catch (Pr) {
182875
- (Pr instanceof TokenAccountNotFoundError || Pr instanceof TokenInvalidAccountOwnerError) && yr.add(
182875
+ } catch (Mr) {
182876
+ (Mr instanceof TokenAccountNotFoundError || Mr instanceof TokenInvalidAccountOwnerError) && (Pr = !0, yr.add(
182876
182877
  createAssociatedTokenAccountInstruction(
182877
182878
  cr,
182878
182879
  Sr,
@@ -182881,10 +182882,10 @@ function Transfer$9({
182881
182882
  TOKEN_PROGRAM_ID,
182882
182883
  ASSOCIATED_TOKEN_PROGRAM_ID
182883
182884
  )
182884
- );
182885
+ ));
182885
182886
  }
182886
182887
  if (ur) {
182887
- const Pr = await dr.methods.withdrawAfterPoolClosure().accountsPartial({
182888
+ const Mr = await dr.methods.withdrawAfterPoolClosure().accountsPartial({
182888
182889
  lender: cr,
182889
182890
  humaConfig: ar.humaConfig,
182890
182891
  poolConfig: ar.poolConfig,
@@ -182896,9 +182897,13 @@ function Transfer$9({
182896
182897
  underlyingTokenProgram: TOKEN_PROGRAM_ID,
182897
182898
  trancheTokenProgram: TOKEN_2022_PROGRAM_ID
182898
182899
  }).transaction();
182899
- yr.add(Pr);
182900
+ yr.add(Mr), yr.instructions.unshift(
182901
+ ComputeBudgetProgram$1.setComputeUnitLimit({
182902
+ units: Pr ? 145e3 : 12e4
182903
+ })
182904
+ );
182900
182905
  } else {
182901
- const Pr = await dr.methods.disburse().accountsPartial({
182906
+ const Mr = await dr.methods.disburse().accountsPartial({
182902
182907
  lender: cr,
182903
182908
  humaConfig: ar.humaConfig,
182904
182909
  poolConfig: ar.poolConfig,
@@ -182908,9 +182913,9 @@ function Transfer$9({
182908
182913
  lenderUnderlyingToken: Sr,
182909
182914
  tokenProgram: TOKEN_PROGRAM_ID
182910
182915
  }).transaction();
182911
- yr.add(Pr), yr.instructions.unshift(
182916
+ yr.add(Mr), yr.instructions.unshift(
182912
182917
  ComputeBudgetProgram$1.setComputeUnitLimit({
182913
- units: 6e4
182918
+ units: Pr ? 85e3 : 6e4
182914
182919
  })
182915
182920
  );
182916
182921
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.76",
3
+ "version": "0.0.77-beta.1006+ec60cbc",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -22,9 +22,9 @@
22
22
  "@ethersproject/contracts": "^5.7.0",
23
23
  "@ethersproject/experimental": "^5.7.0",
24
24
  "@ethersproject/units": "^5.6.0",
25
- "@huma-finance/sdk": "^0.0.76",
26
- "@huma-finance/shared": "^0.0.76",
27
- "@huma-finance/web-shared": "^0.0.76",
25
+ "@huma-finance/sdk": "^0.0.77-beta.1006+ec60cbc",
26
+ "@huma-finance/shared": "^0.0.77-beta.1006+ec60cbc",
27
+ "@huma-finance/web-shared": "^0.0.77-beta.1006+ec60cbc",
28
28
  "@mui/x-date-pickers": "^5.0.7",
29
29
  "@notifi-network/notifi-frontend-client": "^1.1.2",
30
30
  "@notifi-network/notifi-react": "^1.1.2",
@@ -190,5 +190,5 @@
190
190
  "optionalDependencies": {
191
191
  "encoding": "^0.1.13"
192
192
  },
193
- "gitHead": "b1ebf21ca6181b00eccf378bc35f53eaea2d9a09"
193
+ "gitHead": "ec60cbc7be95cd34132898dd55f4dccd91c50297"
194
194
  }
@@ -57,6 +57,7 @@ export function Transfer({
57
57
  selectedTranche === 'senior' ? seniorTrancheATA : juniorTrancheATA
58
58
 
59
59
  // Create user token account if it doesn't exist
60
+ let createdAccounts = false
60
61
  try {
61
62
  await getAccount(
62
63
  connection,
@@ -74,6 +75,7 @@ export function Transfer({
74
75
  error instanceof TokenInvalidAccountOwnerError
75
76
  ) {
76
77
  // As this isn't atomic, it's possible others can create associated accounts meanwhile.
78
+ createdAccounts = true
77
79
  tx.add(
78
80
  createAssociatedTokenAccountInstruction(
79
81
  publicKey,
@@ -105,7 +107,7 @@ export function Transfer({
105
107
 
106
108
  tx.instructions.unshift(
107
109
  ComputeBudgetProgram.setComputeUnitLimit({
108
- units: 60_000,
110
+ units: createdAccounts ? 85_000 : 60_000,
109
111
  }),
110
112
  )
111
113
  } else {
@@ -125,6 +127,12 @@ export function Transfer({
125
127
  })
126
128
  .transaction()
127
129
  tx.add(withdrawAfterPoolClosureTx)
130
+
131
+ tx.instructions.unshift(
132
+ ComputeBudgetProgram.setComputeUnitLimit({
133
+ units: createdAccounts ? 145_000 : 120_000,
134
+ }),
135
+ )
128
136
  }
129
137
 
130
138
  setTransaction(tx)