@huma-finance/widgets 0.0.76 → 0.0.77-beta.1008
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
|
@@ -59818,12 +59818,13 @@ const MILLISECONDS = 1e3, DAY_SECONDS = 24 * 60 * 60, TIME_FORMAT_LL = "ll", tim
|
|
|
59818
59818
|
} catch {
|
|
59819
59819
|
return 0;
|
|
59820
59820
|
}
|
|
59821
|
-
}, sleep$3 = (ar) => new Promise((or) => setTimeout(or, ar)), timeUtil = {
|
|
59821
|
+
}, formatDate = (ar, or = "MMM D, YYYY") => hooks$1(ar).format(or), sleep$3 = (ar) => new Promise((or) => setTimeout(or, ar)), timeUtil = {
|
|
59822
59822
|
timestampToStr,
|
|
59823
59823
|
timestampToLL,
|
|
59824
59824
|
getUnixTimestamp,
|
|
59825
59825
|
secondsToDays,
|
|
59826
|
-
sleep: sleep$3
|
|
59826
|
+
sleep: sleep$3,
|
|
59827
|
+
formatDate
|
|
59827
59828
|
};
|
|
59828
59829
|
var TxStateType;
|
|
59829
59830
|
(function(ar) {
|
|
@@ -70286,6 +70287,39 @@ function getHumaAccountPoints(ar, or) {
|
|
|
70286
70287
|
throw console.error(fr), new Error(COMMON_ERROR_MESSAGE);
|
|
70287
70288
|
});
|
|
70288
70289
|
}
|
|
70290
|
+
function getSeasonPoints(ar, or) {
|
|
70291
|
+
const ur = configUtil.getCampaignAPIUrl(ar, or), cr = gql$1`
|
|
70292
|
+
query {
|
|
70293
|
+
seasonPoints {
|
|
70294
|
+
... on SeasonPointsResult {
|
|
70295
|
+
data {
|
|
70296
|
+
seasonName
|
|
70297
|
+
endsAt
|
|
70298
|
+
totalPoints
|
|
70299
|
+
basePoints
|
|
70300
|
+
liquidityPoints
|
|
70301
|
+
referralPoints
|
|
70302
|
+
bonusPoints
|
|
70303
|
+
}
|
|
70304
|
+
}
|
|
70305
|
+
... on PointServiceError {
|
|
70306
|
+
errMessage
|
|
70307
|
+
}
|
|
70308
|
+
}
|
|
70309
|
+
}
|
|
70310
|
+
`;
|
|
70311
|
+
return requestPost(ur, JSON.stringify({ query: cr })).then((fr) => {
|
|
70312
|
+
var lr, dr, pr;
|
|
70313
|
+
if (fr.errors)
|
|
70314
|
+
throw console.log(fr.errors), new Error(COMMON_ERROR_MESSAGE);
|
|
70315
|
+
const hr = (dr = (lr = fr.data) === null || lr === void 0 ? void 0 : lr.seasonPoints) === null || dr === void 0 ? void 0 : dr.errMessage;
|
|
70316
|
+
if (hr)
|
|
70317
|
+
throw console.error(hr), new Error(hr);
|
|
70318
|
+
return (pr = fr.data) === null || pr === void 0 ? void 0 : pr.seasonPoints.data;
|
|
70319
|
+
}).catch((fr) => {
|
|
70320
|
+
throw console.error(fr), new Error(COMMON_ERROR_MESSAGE);
|
|
70321
|
+
});
|
|
70322
|
+
}
|
|
70289
70323
|
function getEstimatedPoints(ar, or, ur, cr) {
|
|
70290
70324
|
const fr = configUtil.getCampaignAPIUrl(ur, cr), lr = gql$1`
|
|
70291
70325
|
query {
|
|
@@ -70353,7 +70387,8 @@ const CampaignService = {
|
|
|
70353
70387
|
getLeaderboard,
|
|
70354
70388
|
getHumaAccountRanking,
|
|
70355
70389
|
getHumaAccountPoints,
|
|
70356
|
-
updateHumaAccountPoints
|
|
70390
|
+
updateHumaAccountPoints,
|
|
70391
|
+
getSeasonPoints
|
|
70357
70392
|
}, isRejection = (ar) => ar !== null && typeof ar == "object" && Array.isArray(ar.reasons), approve = async (ar, or, ur = !1) => {
|
|
70358
70393
|
const cr = await requestPost(`${configUtil.getEAVerseUrl(or, ur)}/underwriter/underwrite`, ar), { result: fr } = cr;
|
|
70359
70394
|
if (isRejection(fr))
|
|
@@ -182864,6 +182899,7 @@ function Transfer$9({
|
|
|
182864
182899
|
if (!cr || pr || !lr)
|
|
182865
182900
|
return;
|
|
182866
182901
|
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;
|
|
182902
|
+
let Pr = !1;
|
|
182867
182903
|
try {
|
|
182868
182904
|
await getAccount(
|
|
182869
182905
|
lr,
|
|
@@ -182871,8 +182907,8 @@ function Transfer$9({
|
|
|
182871
182907
|
void 0,
|
|
182872
182908
|
TOKEN_PROGRAM_ID
|
|
182873
182909
|
);
|
|
182874
|
-
} catch (
|
|
182875
|
-
(
|
|
182910
|
+
} catch (Mr) {
|
|
182911
|
+
(Mr instanceof TokenAccountNotFoundError || Mr instanceof TokenInvalidAccountOwnerError) && (Pr = !0, yr.add(
|
|
182876
182912
|
createAssociatedTokenAccountInstruction(
|
|
182877
182913
|
cr,
|
|
182878
182914
|
Sr,
|
|
@@ -182881,10 +182917,10 @@ function Transfer$9({
|
|
|
182881
182917
|
TOKEN_PROGRAM_ID,
|
|
182882
182918
|
ASSOCIATED_TOKEN_PROGRAM_ID
|
|
182883
182919
|
)
|
|
182884
|
-
);
|
|
182920
|
+
));
|
|
182885
182921
|
}
|
|
182886
182922
|
if (ur) {
|
|
182887
|
-
const
|
|
182923
|
+
const Mr = await dr.methods.withdrawAfterPoolClosure().accountsPartial({
|
|
182888
182924
|
lender: cr,
|
|
182889
182925
|
humaConfig: ar.humaConfig,
|
|
182890
182926
|
poolConfig: ar.poolConfig,
|
|
@@ -182896,9 +182932,13 @@ function Transfer$9({
|
|
|
182896
182932
|
underlyingTokenProgram: TOKEN_PROGRAM_ID,
|
|
182897
182933
|
trancheTokenProgram: TOKEN_2022_PROGRAM_ID
|
|
182898
182934
|
}).transaction();
|
|
182899
|
-
yr.add(
|
|
182935
|
+
yr.add(Mr), yr.instructions.unshift(
|
|
182936
|
+
ComputeBudgetProgram$1.setComputeUnitLimit({
|
|
182937
|
+
units: Pr ? 145e3 : 12e4
|
|
182938
|
+
})
|
|
182939
|
+
);
|
|
182900
182940
|
} else {
|
|
182901
|
-
const
|
|
182941
|
+
const Mr = await dr.methods.disburse().accountsPartial({
|
|
182902
182942
|
lender: cr,
|
|
182903
182943
|
humaConfig: ar.humaConfig,
|
|
182904
182944
|
poolConfig: ar.poolConfig,
|
|
@@ -182908,9 +182948,9 @@ function Transfer$9({
|
|
|
182908
182948
|
lenderUnderlyingToken: Sr,
|
|
182909
182949
|
tokenProgram: TOKEN_PROGRAM_ID
|
|
182910
182950
|
}).transaction();
|
|
182911
|
-
yr.add(
|
|
182951
|
+
yr.add(Mr), yr.instructions.unshift(
|
|
182912
182952
|
ComputeBudgetProgram$1.setComputeUnitLimit({
|
|
182913
|
-
units: 6e4
|
|
182953
|
+
units: Pr ? 85e3 : 6e4
|
|
182914
182954
|
})
|
|
182915
182955
|
);
|
|
182916
182956
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huma-finance/widgets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.77-beta.1008+fe452c1",
|
|
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.
|
|
26
|
-
"@huma-finance/shared": "^0.0.
|
|
27
|
-
"@huma-finance/web-shared": "^0.0.
|
|
25
|
+
"@huma-finance/sdk": "^0.0.77-beta.1008+fe452c1",
|
|
26
|
+
"@huma-finance/shared": "^0.0.77-beta.1008+fe452c1",
|
|
27
|
+
"@huma-finance/web-shared": "^0.0.77-beta.1008+fe452c1",
|
|
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": "fe452c146b76f4d39cf253ba50b8b098a3ed6fd3"
|
|
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)
|