@huma-finance/widgets 0.0.75-beta.981 → 0.0.75-beta.984
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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Aa = (ar, or, ur) =>
|
|
1
|
+
var p8 = Object.defineProperty;
|
|
2
|
+
var h8 = (ar, or, ur) => or in ar ? p8(ar, or, { enumerable: !0, configurable: !0, writable: !0, value: ur }) : ar[or] = ur;
|
|
3
|
+
var Aa = (ar, or, ur) => h8(ar, typeof or != "symbol" ? or + "" : or, ur);
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import React__default, { forwardRef, useContext, Children, isValidElement, cloneElement, useState, useEffect, useRef, createElement, createContext, useReducer, useDebugValue, useCallback, useMemo, useLayoutEffect } from "react";
|
|
6
6
|
import { txAtom, useMQ, LoggingContextHelper, sendTxAtom, usePoolUnderlyingTokenContract, useMount, usePoolInfo, useAccountStats, usePoolInfoV2, usePoolUnderlyingTokenInfoV2, usePoolSafeAllowanceV2, useAuthErrorHandling, checkIsDev, useCLFeeManager, useCLPoolAllowance, usePoolContract, useCreditContractV2, useCreditStatsV2, useForceRefresh, useHumaProgram, useBorrowerAccounts, useFirstLossCoverContractV2, useFirstLossCoverRequirementV2, useFirstLossCoverAllowanceV2, useFeeManager, useInvoiceNFTContract, useRFPoolAllowance, useLenderDepositRecordV2, useLPConfigV2, useNextEpochStartTimeV2, useTrancheVaultContractV2, useCancellableRedemptionInfoV2, useTrancheMintAccounts, useTrancheTokenAccounts, useLenderAccounts, notEnabledAutoRedeem, getLenderLockupDates, AUTH_ERROR_TYPE, useChainInfo, useTokenAccount, StellarConnectionContext, getClientCommonParams, useStellarLender, useStellarTokenBalance, useParamsSearch, usePoolAllowance, useLenderApproved, useLenderPosition, useWithdrawlLockoutInSeconds, usePoolUnderlyingTokenBalance, usePoolUnderlyingTokenBalanceV2, useLenderApprovedV2, useTrancheVaultAssetsV2, useLastDepositTime, usePoolBalance, useReceivableInfoV2, useReceivableContractV2, useERC2612Permit, useMultiSendContract, useFactoring, fetchStellarPoolSentinel, useStellarBorrower } from "@huma-finance/web-shared";
|
|
@@ -19083,11 +19083,11 @@ See https://reactjs.org/link/refs-must-have-owner for more information.`);
|
|
|
19083
19083
|
var Fg = uu(Bv, iu, np, qp.value, Uu);
|
|
19084
19084
|
Fg !== null && (Or && Fg.alternate !== null && Bv.delete(Fg.key === null ? np : Fg.key), vp = Li(Fg, vp, np), wl === null ? nd = Fg : wl.sibling = Fg, wl = Fg);
|
|
19085
19085
|
}
|
|
19086
|
-
if (Or && Bv.forEach(function(
|
|
19087
|
-
return $r(iu,
|
|
19086
|
+
if (Or && Bv.forEach(function(d8) {
|
|
19087
|
+
return $r(iu, d8);
|
|
19088
19088
|
}), Yd()) {
|
|
19089
|
-
var
|
|
19090
|
-
_A(iu,
|
|
19089
|
+
var f8 = np;
|
|
19090
|
+
_A(iu, f8);
|
|
19091
19091
|
}
|
|
19092
19092
|
return nd;
|
|
19093
19093
|
}
|
|
@@ -19535,9 +19535,9 @@ Incoming: %s`, Tu, "[" + $r.join(", ") + "]", "[" + Or.join(", ") + "]");
|
|
|
19535
19535
|
}
|
|
19536
19536
|
return [Io, Li];
|
|
19537
19537
|
}
|
|
19538
|
-
function
|
|
19538
|
+
function y8(Or, $r, ti) {
|
|
19539
19539
|
}
|
|
19540
|
-
function
|
|
19540
|
+
function g8(Or, $r, ti) {
|
|
19541
19541
|
}
|
|
19542
19542
|
function US(Or, $r, ti) {
|
|
19543
19543
|
var di = Fl, Si = Pg(), Li, oo = Yd();
|
|
@@ -24947,7 +24947,7 @@ Check the render method of %s.`, Lu(Ro) || "Unknown"));
|
|
|
24947
24947
|
}
|
|
24948
24948
|
return Or == null ? null : Or.nodeType === ol ? Or : D4(Or, "findDOMNode");
|
|
24949
24949
|
}
|
|
24950
|
-
function
|
|
24950
|
+
function e8(Or, $r, ti) {
|
|
24951
24951
|
if (dr("ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"), !xv($r))
|
|
24952
24952
|
throw new Error("Target container is not a DOM element.");
|
|
24953
24953
|
{
|
|
@@ -24956,7 +24956,7 @@ Check the render method of %s.`, Lu(Ro) || "Unknown"));
|
|
|
24956
24956
|
}
|
|
24957
24957
|
return u2(null, Or, $r, !0, ti);
|
|
24958
24958
|
}
|
|
24959
|
-
function
|
|
24959
|
+
function t8(Or, $r, ti) {
|
|
24960
24960
|
if (dr("ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"), !xv($r))
|
|
24961
24961
|
throw new Error("Target container is not a DOM element.");
|
|
24962
24962
|
{
|
|
@@ -24965,14 +24965,14 @@ Check the render method of %s.`, Lu(Ro) || "Unknown"));
|
|
|
24965
24965
|
}
|
|
24966
24966
|
return u2(null, Or, $r, !1, ti);
|
|
24967
24967
|
}
|
|
24968
|
-
function
|
|
24968
|
+
function r8(Or, $r, ti, di) {
|
|
24969
24969
|
if (dr("ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18. Consider using a portal instead. Until you switch to the createRoot API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"), !xv(ti))
|
|
24970
24970
|
throw new Error("Target container is not a DOM element.");
|
|
24971
24971
|
if (Or == null || !sg(Or))
|
|
24972
24972
|
throw new Error("parentComponent must be a valid React Component");
|
|
24973
24973
|
return u2(Or, $r, ti, !1, di);
|
|
24974
24974
|
}
|
|
24975
|
-
function
|
|
24975
|
+
function n8(Or) {
|
|
24976
24976
|
if (!xv(Or))
|
|
24977
24977
|
throw new Error("unmountComponentAtNode(...): Target container is not a DOM element.");
|
|
24978
24978
|
{
|
|
@@ -25000,14 +25000,14 @@ Check the render method of %s.`, Lu(Ro) || "Unknown"));
|
|
|
25000
25000
|
hp(L4), fc(F4), aA(U4), um(Ll), cm(iA), (typeof Map != "function" || // $FlowIssue Flow incorrectly thinks Map has no prototype
|
|
25001
25001
|
Map.prototype == null || typeof Map.prototype.forEach != "function" || typeof Set != "function" || // $FlowIssue Flow incorrectly thinks Set has no prototype
|
|
25002
25002
|
Set.prototype == null || typeof Set.prototype.clear != "function" || typeof Set.prototype.forEach != "function") && dr("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"), wy(q2), hb(LI, GR, Pm);
|
|
25003
|
-
function
|
|
25003
|
+
function i8(Or, $r) {
|
|
25004
25004
|
var ti = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
|
|
25005
25005
|
if (!s2($r))
|
|
25006
25006
|
throw new Error("Target container is not a DOM element.");
|
|
25007
25007
|
return N4(Or, $r, null, ti);
|
|
25008
25008
|
}
|
|
25009
|
-
function
|
|
25010
|
-
return
|
|
25009
|
+
function o8(Or, $r, ti, di) {
|
|
25010
|
+
return r8(Or, $r, ti, di);
|
|
25011
25011
|
}
|
|
25012
25012
|
var sT = {
|
|
25013
25013
|
usingClientEntryPoint: !1,
|
|
@@ -25015,27 +25015,27 @@ Check the render method of %s.`, Lu(Ro) || "Unknown"));
|
|
|
25015
25015
|
// This is an array for better minification.
|
|
25016
25016
|
Events: [wu, Iu, ku, sh, $m, LI]
|
|
25017
25017
|
};
|
|
25018
|
-
function
|
|
25018
|
+
function a8(Or, $r) {
|
|
25019
25019
|
return sT.usingClientEntryPoint || dr('You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".'), G4(Or, $r);
|
|
25020
25020
|
}
|
|
25021
|
-
function
|
|
25021
|
+
function s8(Or, $r, ti) {
|
|
25022
25022
|
return sT.usingClientEntryPoint || dr('You are importing hydrateRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".'), W4(Or, $r, ti);
|
|
25023
25023
|
}
|
|
25024
|
-
function
|
|
25024
|
+
function c8(Or) {
|
|
25025
25025
|
return K3() && dr("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task."), Pm(Or);
|
|
25026
25026
|
}
|
|
25027
|
-
var
|
|
25027
|
+
var l8 = H4({
|
|
25028
25028
|
findFiberByHostInstance: Qs,
|
|
25029
25029
|
bundleType: 1,
|
|
25030
25030
|
version: eT,
|
|
25031
25031
|
rendererPackageName: "react-dom"
|
|
25032
25032
|
});
|
|
25033
|
-
if (!
|
|
25033
|
+
if (!l8 && mi && window.top === window.self && (navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge") === -1 || navigator.userAgent.indexOf("Firefox") > -1)) {
|
|
25034
25034
|
var Lx = window.location.protocol;
|
|
25035
25035
|
/^(https?|file):$/.test(Lx) && console.info("%cDownload the React DevTools for a better development experience: https://reactjs.org/link/react-devtools" + (Lx === "file:" ? `
|
|
25036
25036
|
You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq` : ""), "font-weight:bold");
|
|
25037
25037
|
}
|
|
25038
|
-
reactDom_development.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = sT, reactDom_development.createPortal =
|
|
25038
|
+
reactDom_development.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = sT, reactDom_development.createPortal = i8, reactDom_development.createRoot = a8, reactDom_development.findDOMNode = X4, reactDom_development.flushSync = c8, reactDom_development.hydrate = e8, reactDom_development.hydrateRoot = s8, reactDom_development.render = t8, reactDom_development.unmountComponentAtNode = n8, reactDom_development.unstable_batchedUpdates = LI, reactDom_development.unstable_renderSubtreeIntoContainer = o8, reactDom_development.version = eT, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
25039
25039
|
}()), reactDom_development;
|
|
25040
25040
|
}
|
|
25041
25041
|
var hasRequiredReactDom;
|
|
@@ -145634,52 +145634,36 @@ function extractWritableAccounts(ar) {
|
|
|
145634
145634
|
}), Array.from(or);
|
|
145635
145635
|
}
|
|
145636
145636
|
async function getPriorityFeeEstimate(ar, or, ur, cr, fr) {
|
|
145637
|
-
|
|
145638
|
-
|
|
145639
|
-
|
|
145640
|
-
|
|
145641
|
-
return (await (await fetch(lr, {
|
|
145642
|
-
method: "POST",
|
|
145643
|
-
headers: { "Content-Type": "application/json" },
|
|
145644
|
-
body: JSON.stringify({
|
|
145645
|
-
jsonrpc: "2.0",
|
|
145646
|
-
id: "1",
|
|
145647
|
-
method: "getPriorityFeeEstimate",
|
|
145648
|
-
params: [
|
|
145649
|
-
{
|
|
145650
|
-
accountKeys: ur,
|
|
145651
|
-
options: {
|
|
145652
|
-
priorityLevel: ar,
|
|
145653
|
-
evaluateEmptySlotAsZero: !0
|
|
145654
|
-
}
|
|
145655
|
-
}
|
|
145656
|
-
]
|
|
145657
|
-
})
|
|
145658
|
-
})).json()).result;
|
|
145659
|
-
} catch (dr) {
|
|
145660
|
-
return console.warn(dr), null;
|
|
145661
|
-
}
|
|
145637
|
+
return null;
|
|
145638
|
+
}
|
|
145639
|
+
function isSetComputeLimitInstruction(ar) {
|
|
145640
|
+
return ar.programId.equals(ComputeBudgetProgram$1.programId) && ar.data[0] === 2;
|
|
145662
145641
|
}
|
|
145663
145642
|
async function buildOptimalTransactionImpl(ar, or, ur, cr, fr, lr = "Medium", dr) {
|
|
145664
|
-
|
|
145665
|
-
|
|
145666
|
-
|
|
145667
|
-
|
|
145668
|
-
|
|
145669
|
-
|
|
145670
|
-
|
|
145671
|
-
|
|
145672
|
-
|
|
145673
|
-
|
|
145674
|
-
|
|
145675
|
-
|
|
145676
|
-
|
|
145643
|
+
let pr;
|
|
145644
|
+
if (ar.instructions.findIndex(isSetComputeLimitInstruction) === -1) {
|
|
145645
|
+
const Sr = [
|
|
145646
|
+
ComputeBudgetProgram$1.setComputeUnitLimit({ units: 14e5 }),
|
|
145647
|
+
...ar.instructions
|
|
145648
|
+
], Ir = new VersionedTransaction(new TransactionMessage({
|
|
145649
|
+
instructions: Sr,
|
|
145650
|
+
payerKey: fr,
|
|
145651
|
+
recentBlockhash: (await ur.getLatestBlockhash()).blockhash
|
|
145652
|
+
}).compileToV0Message([]));
|
|
145653
|
+
pr = (await ur.simulateTransaction(Ir, {
|
|
145654
|
+
replaceRecentBlockhash: !0,
|
|
145655
|
+
sigVerify: !1
|
|
145656
|
+
})).value.unitsConsumed, pr && ar.instructions.unshift(ComputeBudgetProgram$1.setComputeUnitLimit({
|
|
145657
|
+
units: pr * 1.2
|
|
145658
|
+
}));
|
|
145659
|
+
}
|
|
145660
|
+
const Ar = await getPriorityFeeEstimate(), gr = Ar == null ? void 0 : Ar.priorityFeeEstimate, yr = gr ?? 5e5;
|
|
145677
145661
|
return ar.instructions.unshift(ComputeBudgetProgram$1.setComputeUnitPrice({
|
|
145678
|
-
microLamports:
|
|
145679
|
-
})), ar;
|
|
145662
|
+
microLamports: yr
|
|
145663
|
+
})), { tx: ar, unitsConsumed: pr, fee: yr };
|
|
145680
145664
|
}
|
|
145681
145665
|
async function buildOptimalTransactionFromConnection(ar, or, ur, cr, fr, lr, dr) {
|
|
145682
|
-
return buildOptimalTransactionImpl(ar, or, ur, cr, fr, lr
|
|
145666
|
+
return buildOptimalTransactionImpl(ar, or, ur, cr, fr, lr);
|
|
145683
145667
|
}
|
|
145684
145668
|
function getRealWorldReceivableContract(ar, or) {
|
|
145685
145669
|
var ur;
|
|
@@ -178136,39 +178120,43 @@ function SolanaTxSendModal({
|
|
|
178136
178120
|
zr.instructions = [...or.instructions];
|
|
178137
178121
|
const Vr = await hr.getLatestBlockhash("confirmed");
|
|
178138
178122
|
zr.recentBlockhash = Vr.blockhash, zr.lastValidBlockHeight = Vr.lastValidBlockHeight, zr.feePayer = lr;
|
|
178139
|
-
const Yr = extractWritableAccounts(zr),
|
|
178123
|
+
const Yr = extractWritableAccounts(zr), {
|
|
178124
|
+
tx: Dr,
|
|
178125
|
+
unitsConsumed: br,
|
|
178126
|
+
fee: wr
|
|
178127
|
+
} = await buildOptimalTransactionFromConnection(
|
|
178140
178128
|
zr,
|
|
178141
178129
|
Yr,
|
|
178142
178130
|
hr,
|
|
178143
178131
|
ar,
|
|
178144
178132
|
lr,
|
|
178145
178133
|
Ir ? "High" : void 0,
|
|
178146
|
-
|
|
178134
|
+
void 0
|
|
178147
178135
|
);
|
|
178148
178136
|
Cr.logAction("SigningTransaction", {
|
|
178149
|
-
|
|
178150
|
-
|
|
178137
|
+
priorityFee: wr,
|
|
178138
|
+
computeUnitLimit: br,
|
|
178151
178139
|
recentBlockhash: Dr.recentBlockhash,
|
|
178152
178140
|
lastValidBlockHeight: Dr.lastValidBlockHeight
|
|
178153
178141
|
});
|
|
178154
|
-
const
|
|
178142
|
+
const Er = await dr(Dr);
|
|
178155
178143
|
Cr.logAction("SendingTransaction", {});
|
|
178156
|
-
const
|
|
178157
|
-
|
|
178144
|
+
const Tr = await hr.sendRawTransaction(
|
|
178145
|
+
Er.serialize(),
|
|
178158
178146
|
{
|
|
178159
178147
|
preflightCommitment: "confirmed",
|
|
178160
178148
|
skipPreflight: !0,
|
|
178161
178149
|
maxRetries: 0
|
|
178162
178150
|
}
|
|
178163
178151
|
);
|
|
178164
|
-
for (gr(
|
|
178165
|
-
const
|
|
178152
|
+
for (gr(Tr), fr(setSolanaSignature(Tr)); ; ) {
|
|
178153
|
+
const Rr = await hr.getSignatureStatus(Tr, {
|
|
178166
178154
|
searchTransactionHistory: !0
|
|
178167
178155
|
});
|
|
178168
|
-
if (((qr =
|
|
178169
|
-
if ((Jr =
|
|
178156
|
+
if (((qr = Rr == null ? void 0 : Rr.value) == null ? void 0 : qr.confirmationStatus) === "finalized" || ((Hr = Rr == null ? void 0 : Rr.value) == null ? void 0 : Hr.confirmationStatus) === "confirmed") {
|
|
178157
|
+
if ((Jr = Rr == null ? void 0 : Rr.value) != null && Jr.err) {
|
|
178170
178158
|
Cr.logAction("TransactionError", {
|
|
178171
|
-
signature:
|
|
178159
|
+
signature: Tr
|
|
178172
178160
|
}), fr(
|
|
178173
178161
|
setError({
|
|
178174
178162
|
errorMessage: "Your transaction was confirmed but had errors. Please check the transaction details on the explorer for more information."
|
|
@@ -178177,15 +178165,15 @@ function SolanaTxSendModal({
|
|
|
178177
178165
|
return;
|
|
178178
178166
|
}
|
|
178179
178167
|
Cr.logAction("TransactionSuccess", {
|
|
178180
|
-
signature:
|
|
178181
|
-
}), ur({ signature:
|
|
178168
|
+
signature: Tr
|
|
178169
|
+
}), ur({ signature: Tr });
|
|
178182
178170
|
return;
|
|
178183
178171
|
}
|
|
178184
178172
|
if ((await hr.getLatestBlockhash(
|
|
178185
178173
|
"confirmed"
|
|
178186
178174
|
)).lastValidBlockHeight - Dr.lastValidBlockHeight > 100) {
|
|
178187
178175
|
Cr.logAction("ShowRetryScreenDueToExpiration", {
|
|
178188
|
-
signature:
|
|
178176
|
+
signature: Tr
|
|
178189
178177
|
}), Sr(!0);
|
|
178190
178178
|
return;
|
|
178191
178179
|
}
|
|
@@ -182494,8 +182482,10 @@ function Transfer$a({
|
|
|
182494
182482
|
if (!dr || gr || Mr || qr)
|
|
182495
182483
|
return;
|
|
182496
182484
|
const Vr = new Transaction$3(), { underlyingTokenATA: Yr, seniorTrancheATA: Dr, juniorTrancheATA: br } = getTokenAccounts(ar, dr), wr = ur === "senior" ? Ir : Sr;
|
|
182485
|
+
let Er = !1;
|
|
182497
182486
|
if (ur === "senior" && !xr || ur === "junior" && !Cr) {
|
|
182498
|
-
|
|
182487
|
+
Er = !0;
|
|
182488
|
+
const Fr = await Hr.methods.createLenderAccounts().accountsPartial({
|
|
182499
182489
|
lender: dr,
|
|
182500
182490
|
humaConfig: ar.humaConfig,
|
|
182501
182491
|
poolConfig: ar.poolConfig,
|
|
@@ -182504,13 +182494,13 @@ function Transfer$a({
|
|
|
182504
182494
|
lenderTrancheToken: ur === "senior" ? Dr : br,
|
|
182505
182495
|
tokenProgram: TOKEN_2022_PROGRAM_ID
|
|
182506
182496
|
}).transaction();
|
|
182507
|
-
Vr.add(
|
|
182497
|
+
Vr.add(Fr);
|
|
182508
182498
|
}
|
|
182509
|
-
const
|
|
182499
|
+
const Tr = convertToShares(
|
|
182510
182500
|
BigInt(ur === "senior" ? or.seniorTrancheAssets ?? 0 : or.juniorTrancheAssets ?? 0),
|
|
182511
182501
|
BigInt(ur === "senior" ? (Br == null ? void 0 : Br.toString()) ?? 0 : (Pr == null ? void 0 : Pr.toString()) ?? 0),
|
|
182512
182502
|
BigInt(Ar.toString())
|
|
182513
|
-
),
|
|
182503
|
+
), Rr = convertToShares(
|
|
182514
182504
|
BigInt(ur === "senior" ? or.seniorTrancheAssets ?? 0 : or.juniorTrancheAssets ?? 0),
|
|
182515
182505
|
BigInt(ur === "senior" ? (Br == null ? void 0 : Br.toString()) ?? 0 : (Pr == null ? void 0 : Pr.toString()) ?? 0),
|
|
182516
182506
|
BigInt(ur === "senior" ? (Ur == null ? void 0 : Ur.amount.toString()) ?? "0" : (Qr == null ? void 0 : Qr.amount.toString()) ?? "0")
|
|
@@ -182525,7 +182515,7 @@ function Transfer$a({
|
|
|
182525
182515
|
// delegate
|
|
182526
182516
|
dr,
|
|
182527
182517
|
// owner of the wallet
|
|
182528
|
-
|
|
182518
|
+
Tr * BigInt(11) / BigInt(10) + Rr,
|
|
182529
182519
|
// amount
|
|
182530
182520
|
ar.trancheDecimals,
|
|
182531
182521
|
void 0,
|
|
@@ -182533,7 +182523,7 @@ function Transfer$a({
|
|
|
182533
182523
|
TOKEN_2022_PROGRAM_ID
|
|
182534
182524
|
)
|
|
182535
182525
|
);
|
|
182536
|
-
const
|
|
182526
|
+
const Nr = await Hr.methods.deposit(Ar).accountsPartial({
|
|
182537
182527
|
approvedLender: wr,
|
|
182538
182528
|
depositor: dr,
|
|
182539
182529
|
poolConfig: ar.poolConfig,
|
|
@@ -182545,7 +182535,11 @@ function Transfer$a({
|
|
|
182545
182535
|
humaConfig: ar.humaConfig,
|
|
182546
182536
|
underlyingTokenProgram: TOKEN_PROGRAM_ID
|
|
182547
182537
|
}).transaction();
|
|
182548
|
-
Vr.add(
|
|
182538
|
+
Vr.add(Nr), Vr.instructions.unshift(
|
|
182539
|
+
ComputeBudgetProgram$1.setComputeUnitLimit({
|
|
182540
|
+
units: Er ? 15e4 : 8e4
|
|
182541
|
+
})
|
|
182542
|
+
), yr(Vr);
|
|
182549
182543
|
}
|
|
182550
182544
|
zr();
|
|
182551
182545
|
}, [
|
|
@@ -182889,7 +182883,11 @@ function Transfer$9({
|
|
|
182889
182883
|
lenderUnderlyingToken: Sr,
|
|
182890
182884
|
tokenProgram: TOKEN_PROGRAM_ID
|
|
182891
182885
|
}).transaction();
|
|
182892
|
-
yr.add(Pr)
|
|
182886
|
+
yr.add(Pr), yr.instructions.unshift(
|
|
182887
|
+
ComputeBudgetProgram$1.setComputeUnitLimit({
|
|
182888
|
+
units: 6e4
|
|
182889
|
+
})
|
|
182890
|
+
);
|
|
182893
182891
|
}
|
|
182894
182892
|
hr(yr);
|
|
182895
182893
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huma-finance/widgets",
|
|
3
|
-
"version": "0.0.75-beta.
|
|
3
|
+
"version": "0.0.75-beta.984+6489f74",
|
|
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.75-beta.
|
|
26
|
-
"@huma-finance/shared": "^0.0.75-beta.
|
|
27
|
-
"@huma-finance/web-shared": "^0.0.75-beta.
|
|
25
|
+
"@huma-finance/sdk": "^0.0.75-beta.984+6489f74",
|
|
26
|
+
"@huma-finance/shared": "^0.0.75-beta.984+6489f74",
|
|
27
|
+
"@huma-finance/web-shared": "^0.0.75-beta.984+6489f74",
|
|
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": "
|
|
193
|
+
"gitHead": "6489f7486bb63b2bc021539cd339260b601e1c49"
|
|
194
194
|
}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
TOKEN_PROGRAM_ID,
|
|
21
21
|
} from '@solana/spl-token'
|
|
22
22
|
import { useWallet } from '@solana/wallet-adapter-react'
|
|
23
|
-
import { PublicKey, Transaction } from '@solana/web3.js'
|
|
23
|
+
import { ComputeBudgetProgram, PublicKey, Transaction } from '@solana/web3.js'
|
|
24
24
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
25
25
|
import { useAppDispatch, useAppSelector } from '../../../hooks/useRedux'
|
|
26
26
|
import { setPointsAccumulated, setStep } from '../../../store/widgets.reducers'
|
|
@@ -119,10 +119,12 @@ export function Transfer({
|
|
|
119
119
|
? seniorLenderApprovedAccountPDA!
|
|
120
120
|
: juniorLenderApprovedAccountPDA!
|
|
121
121
|
|
|
122
|
+
let createdLenderAccounts = false
|
|
122
123
|
if (
|
|
123
124
|
(selectedTranche === 'senior' && !seniorLenderStateAccount) ||
|
|
124
125
|
(selectedTranche === 'junior' && !juniorLenderStateAccount)
|
|
125
126
|
) {
|
|
127
|
+
createdLenderAccounts = true
|
|
126
128
|
const createLenderAccountsTx = await program.methods
|
|
127
129
|
.createLenderAccounts()
|
|
128
130
|
.accountsPartial({
|
|
@@ -203,6 +205,14 @@ export function Transfer({
|
|
|
203
205
|
.transaction()
|
|
204
206
|
tx.add(depositTx)
|
|
205
207
|
|
|
208
|
+
// Hardcode the limit here due to a race condition where CreateLenderAccounts aren't available
|
|
209
|
+
// when simulating the Deposit instruction, so simulated transaction CUs are not computed correctly
|
|
210
|
+
tx.instructions.unshift(
|
|
211
|
+
ComputeBudgetProgram.setComputeUnitLimit({
|
|
212
|
+
units: createdLenderAccounts ? 150_000 : 80_000,
|
|
213
|
+
}),
|
|
214
|
+
)
|
|
215
|
+
|
|
206
216
|
setTransaction(tx)
|
|
207
217
|
}
|
|
208
218
|
getTx()
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
TokenInvalidAccountOwnerError,
|
|
15
15
|
} from '@solana/spl-token'
|
|
16
16
|
import { useConnection, useWallet } from '@solana/wallet-adapter-react'
|
|
17
|
-
import { PublicKey, Transaction } from '@solana/web3.js'
|
|
17
|
+
import { ComputeBudgetProgram, PublicKey, Transaction } from '@solana/web3.js'
|
|
18
18
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
19
19
|
import useLogOnFirstMount from '../../../hooks/useLogOnFirstMount'
|
|
20
20
|
import { useAppDispatch } from '../../../hooks/useRedux'
|
|
@@ -102,6 +102,12 @@ export function Transfer({
|
|
|
102
102
|
})
|
|
103
103
|
.transaction()
|
|
104
104
|
tx.add(disburseTx)
|
|
105
|
+
|
|
106
|
+
tx.instructions.unshift(
|
|
107
|
+
ComputeBudgetProgram.setComputeUnitLimit({
|
|
108
|
+
units: 60_000,
|
|
109
|
+
}),
|
|
110
|
+
)
|
|
105
111
|
} else {
|
|
106
112
|
const withdrawAfterPoolClosureTx = await program.methods
|
|
107
113
|
.withdrawAfterPoolClosure()
|
|
@@ -91,18 +91,22 @@ export function SolanaTxSendModal({
|
|
|
91
91
|
// Extract writable accounts
|
|
92
92
|
const txAccounts = extractWritableAccounts(txCopy)
|
|
93
93
|
// Add on compute unit limit + price instructions
|
|
94
|
-
const
|
|
94
|
+
const {
|
|
95
|
+
tx: optimizedTx,
|
|
96
|
+
unitsConsumed,
|
|
97
|
+
fee,
|
|
98
|
+
} = await buildOptimalTransactionFromConnection(
|
|
95
99
|
txCopy,
|
|
96
100
|
txAccounts,
|
|
97
101
|
connection,
|
|
98
102
|
chainId,
|
|
99
103
|
publicKey,
|
|
100
104
|
useHighPriority ? 'High' : undefined,
|
|
101
|
-
|
|
105
|
+
import.meta.env.REACT_APP_HELIUS_API_KEY,
|
|
102
106
|
)
|
|
103
107
|
loggingHelper.logAction('SigningTransaction', {
|
|
104
|
-
|
|
105
|
-
|
|
108
|
+
priorityFee: fee,
|
|
109
|
+
computeUnitLimit: unitsConsumed,
|
|
106
110
|
recentBlockhash: optimizedTx.recentBlockhash,
|
|
107
111
|
lastValidBlockHeight: optimizedTx.lastValidBlockHeight,
|
|
108
112
|
})
|