@naviprotocol/lending 2.0.0-beta.1 → 2.0.0
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/account.d.ts.map +1 -1
- package/dist/index.esm.js +204 -195
- package/dist/index.esm.js.map +1 -1
- package/dist/oracle.d.ts.map +1 -1
- package/dist/pool.d.ts.map +1 -1
- package/dist/pyth.d.ts.map +1 -1
- package/dist/reward.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +4 -3
package/dist/index.esm.js
CHANGED
|
@@ -4,8 +4,8 @@ import { toHex as $e, fromHex as Oe, normalizeStructTag as K, SUI_CLOCK_OBJECT_I
|
|
|
4
4
|
import Ve from "lodash.camelcase";
|
|
5
5
|
import p from "bignumber.js";
|
|
6
6
|
import { SuiJsonRpcClient as Me } from "@mysten/sui/jsonRpc";
|
|
7
|
-
import { SuiGraphQLClient as
|
|
8
|
-
import { GrpcWebFetchTransport as
|
|
7
|
+
import { SuiGraphQLClient as De } from "@mysten/sui/graphql";
|
|
8
|
+
import { GrpcWebFetchTransport as Ue, SuiGrpcClient as Fe } from "@mysten/sui/grpc";
|
|
9
9
|
const ne = u.bytes(32).transform({
|
|
10
10
|
// To change the input type, you need to provide a type definition for the input
|
|
11
11
|
input: (e) => Oe(e),
|
|
@@ -129,7 +129,7 @@ const ne = u.bytes(32).transform({
|
|
|
129
129
|
borrow_balance: u.u256(),
|
|
130
130
|
/** User's current supply balance */
|
|
131
131
|
supply_balance: u.u256()
|
|
132
|
-
}), qe = "2.0.0
|
|
132
|
+
}), qe = "2.0.0", O = {
|
|
133
133
|
version: qe
|
|
134
134
|
}, ze = O.version, Ge = () => {
|
|
135
135
|
if (typeof process < "u" && process.versions && process.versions.node) {
|
|
@@ -192,7 +192,7 @@ async function Ht(e, t) {
|
|
|
192
192
|
function Qe(e, t) {
|
|
193
193
|
if ("client" in t)
|
|
194
194
|
return t.client;
|
|
195
|
-
const r = new
|
|
195
|
+
const r = new Ue({
|
|
196
196
|
baseUrl: t.url,
|
|
197
197
|
meta: t.headers,
|
|
198
198
|
fetchInit: t.fetchInit,
|
|
@@ -204,7 +204,7 @@ function Qe(e, t) {
|
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
function Ye(e, t) {
|
|
207
|
-
return "client" in t ? t.client : new
|
|
207
|
+
return "client" in t ? t.client : new De({
|
|
208
208
|
network: e,
|
|
209
209
|
url: t.url,
|
|
210
210
|
headers: t.headers,
|
|
@@ -444,8 +444,11 @@ class ct {
|
|
|
444
444
|
const r = await this.getMoveObjectJson(t);
|
|
445
445
|
if (r?.fields) {
|
|
446
446
|
const o = r.fields;
|
|
447
|
-
if ("upgrade_cap" in o)
|
|
448
|
-
|
|
447
|
+
if ("upgrade_cap" in o) {
|
|
448
|
+
const n = o.upgrade_cap, a = n?.package ?? n?.fields?.package;
|
|
449
|
+
if (a)
|
|
450
|
+
return a;
|
|
451
|
+
}
|
|
449
452
|
}
|
|
450
453
|
throw new Error(`Cannot fetch package id for object ${t}`);
|
|
451
454
|
}
|
|
@@ -545,7 +548,7 @@ class ct {
|
|
|
545
548
|
}
|
|
546
549
|
}
|
|
547
550
|
const st = "https://open-api.naviprotocol.io/api";
|
|
548
|
-
let J = {},
|
|
551
|
+
let J = {}, we = 0;
|
|
549
552
|
function lt(e) {
|
|
550
553
|
return e.replace(/\/+$/, "");
|
|
551
554
|
}
|
|
@@ -557,10 +560,10 @@ function Kt(e) {
|
|
|
557
560
|
...J.services,
|
|
558
561
|
...e.services
|
|
559
562
|
}
|
|
560
|
-
},
|
|
563
|
+
}, we += 1;
|
|
561
564
|
}
|
|
562
565
|
function se() {
|
|
563
|
-
return
|
|
566
|
+
return we;
|
|
564
567
|
}
|
|
565
568
|
function E(e) {
|
|
566
569
|
const t = e?.services?.naviOpenApi ?? J.services?.naviOpenApi;
|
|
@@ -582,7 +585,7 @@ function ut(e) {
|
|
|
582
585
|
}
|
|
583
586
|
return Array.isArray(e) ? Object.fromEntries(e) : e;
|
|
584
587
|
}
|
|
585
|
-
function
|
|
588
|
+
function D(e, t) {
|
|
586
589
|
return {
|
|
587
590
|
...ut(e),
|
|
588
591
|
...t?.headers ?? {}
|
|
@@ -594,7 +597,7 @@ function le(e) {
|
|
|
594
597
|
}
|
|
595
598
|
function dt(e) {
|
|
596
599
|
const t = e?.commandResults ?? [], r = e?.Transaction ?? e?.FailedTransaction ?? {}, o = r.effects?.errors?.[0] ?? r.effects?.status?.error ?? r.status?.error ?? r.status?.errors?.[0];
|
|
597
|
-
return {
|
|
600
|
+
return o && console.warn("[lending] devInspect(core simulate) returned error:", o), {
|
|
598
601
|
effects: r.effects,
|
|
599
602
|
events: r.events,
|
|
600
603
|
error: o,
|
|
@@ -629,7 +632,7 @@ async function q(e, t) {
|
|
|
629
632
|
sender: t.sender
|
|
630
633
|
});
|
|
631
634
|
}
|
|
632
|
-
function
|
|
635
|
+
function be(e) {
|
|
633
636
|
return {
|
|
634
637
|
json: !!e?.showContent,
|
|
635
638
|
display: !!e?.showDisplay,
|
|
@@ -662,7 +665,7 @@ async function pt(e, t) {
|
|
|
662
665
|
if (typeof r?.getObject == "function") {
|
|
663
666
|
const { object: o } = await r.getObject({
|
|
664
667
|
objectId: t.id,
|
|
665
|
-
include:
|
|
668
|
+
include: be(t.options)
|
|
666
669
|
});
|
|
667
670
|
return ve(o);
|
|
668
671
|
}
|
|
@@ -673,7 +676,7 @@ async function mt(e, t) {
|
|
|
673
676
|
if (typeof r?.getObjects == "function") {
|
|
674
677
|
const { objects: o } = await r.getObjects({
|
|
675
678
|
objectIds: t.ids,
|
|
676
|
-
include:
|
|
679
|
+
include: be(t.options)
|
|
677
680
|
});
|
|
678
681
|
return o.map(ve);
|
|
679
682
|
}
|
|
@@ -751,7 +754,7 @@ const yt = 27, ue = (e, t) => {
|
|
|
751
754
|
if (!Number(e) || !Number(t)) return new p(0);
|
|
752
755
|
const r = new p(1).shiftedBy(1 * yt), o = r.multipliedBy(new p(0.5));
|
|
753
756
|
return new p(e).multipliedBy(new p(t)).plus(o).dividedBy(r).integerValue(p.ROUND_DOWN);
|
|
754
|
-
},
|
|
757
|
+
}, U = oe ? {
|
|
755
758
|
"User-Agent": oe
|
|
756
759
|
} : {};
|
|
757
760
|
function ee(e, t = "uniqueId") {
|
|
@@ -799,20 +802,20 @@ const G = $(
|
|
|
799
802
|
(a) => a.key
|
|
800
803
|
)}`,
|
|
801
804
|
e
|
|
802
|
-
), n = await fetch(o, { headers: U
|
|
805
|
+
), n = await fetch(o, { headers: D(U, r) }).then(
|
|
803
806
|
(a) => a.json()
|
|
804
807
|
);
|
|
805
808
|
return n.data.forEach((a) => {
|
|
806
|
-
const i = n.meta.emodes.filter((
|
|
807
|
-
const k = _(
|
|
808
|
-
return a.market === k.key &&
|
|
809
|
-
}).filter((
|
|
809
|
+
const i = n.meta.emodes.filter((b) => {
|
|
810
|
+
const k = _(b.marketId);
|
|
811
|
+
return a.market === k.key && b.isActive;
|
|
812
|
+
}).filter((b) => !!b.assets.find((k) => k.assetId === a.id));
|
|
810
813
|
a.emodes = i;
|
|
811
|
-
const s = p(a.totalSupplyAmount).div(Math.pow(10, 9)).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), l = p(a.borrowedAmount).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), m = p(s).multipliedBy(a.oracle.price).toString(),
|
|
814
|
+
const s = p(a.totalSupplyAmount).div(Math.pow(10, 9)).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), l = p(a.borrowedAmount).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), m = p(s).multipliedBy(a.oracle.price).toString(), w = p(l).multipliedBy(a.oracle.price).toString(), y = p(a.supplyCapCeiling).shiftedBy(-27).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), g = p.max(
|
|
812
815
|
p(a.borrowedAmount),
|
|
813
816
|
p(a.validBorrowAmount)
|
|
814
|
-
).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), d = p(
|
|
815
|
-
a.poolSupplyAmount = s, a.poolBorrowAmount = l, a.poolSupplyValue = m, a.poolBorrowValue =
|
|
817
|
+
).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), d = p(y).multipliedBy(a.oracle.price).toString(), f = p(g).multipliedBy(a.oracle.price).toString();
|
|
818
|
+
a.poolSupplyAmount = s, a.poolBorrowAmount = l, a.poolSupplyValue = m, a.poolBorrowValue = w, a.poolSupplyCapAmount = y, a.poolBorrowCapAmount = g, a.poolSupplyCapValue = d, a.poolBorrowCapValue = f;
|
|
816
819
|
}), n.data;
|
|
817
820
|
}
|
|
818
821
|
)
|
|
@@ -839,7 +842,7 @@ const Qt = $(
|
|
|
839
842
|
A(async (e) => {
|
|
840
843
|
const t = E(e), r = M(`/navi/stats?sdk=${O.version}`, e);
|
|
841
844
|
return (await fetch(r, {
|
|
842
|
-
headers: U
|
|
845
|
+
headers: D(U, t)
|
|
843
846
|
}).then((n) => n.json())).data;
|
|
844
847
|
})
|
|
845
848
|
), Yt = $(
|
|
@@ -847,7 +850,7 @@ const Qt = $(
|
|
|
847
850
|
async (e) => {
|
|
848
851
|
const t = E(e), r = M(`/navi/fee?sdk=${O.version}`, e);
|
|
849
852
|
return await fetch(r, {
|
|
850
|
-
headers: U
|
|
853
|
+
headers: D(U, t)
|
|
851
854
|
}).then((n) => n.json());
|
|
852
855
|
}
|
|
853
856
|
)
|
|
@@ -1147,7 +1150,10 @@ const er = $(
|
|
|
1147
1150
|
}), s = Q(i, [u.u64()]);
|
|
1148
1151
|
return (Number(s[0]) || 0) / 100;
|
|
1149
1152
|
} catch (a) {
|
|
1150
|
-
console.error(
|
|
1153
|
+
console.error(
|
|
1154
|
+
"[lending] getBorrowFee per-user query failed, falling back to global rate:",
|
|
1155
|
+
a
|
|
1156
|
+
);
|
|
1151
1157
|
}
|
|
1152
1158
|
const n = (await pt(r, {
|
|
1153
1159
|
id: t.incentiveV3,
|
|
@@ -1178,7 +1184,7 @@ const er = $(
|
|
|
1178
1184
|
name: "Sui Eco Market"
|
|
1179
1185
|
}
|
|
1180
1186
|
};
|
|
1181
|
-
class
|
|
1187
|
+
class wt {
|
|
1182
1188
|
constructor(t, r) {
|
|
1183
1189
|
this.poolMap = {}, this.emodeMap = {}, this.pools = [], this.emodes = [], this.emodePools = [], this.emodeBorrowablePools = [], this.emodeSupplyablePools = [], this._overview = {
|
|
1184
1190
|
marketTotalSupplyValue: "0",
|
|
@@ -1197,10 +1203,10 @@ class bt {
|
|
|
1197
1203
|
return;
|
|
1198
1204
|
}
|
|
1199
1205
|
r[s.uniqueId] || this.pools.push(s), s?.emodes?.forEach((m) => {
|
|
1200
|
-
o[m.uniqueId] || this.emodes.push(m), m.assets.forEach((
|
|
1201
|
-
|
|
1202
|
-
(
|
|
1203
|
-
) && n.add(s.uniqueId),
|
|
1206
|
+
o[m.uniqueId] || this.emodes.push(m), m.assets.forEach((w) => {
|
|
1207
|
+
w.isDebt && m.assets.find(
|
|
1208
|
+
(g) => g.isCollateral && g.ltv > 0 && g.assetId !== s.id
|
|
1209
|
+
) && n.add(s.uniqueId), w.isCollateral && m.assets.find((g) => g.isDebt && g.assetId !== s.id) && a.add(s.uniqueId);
|
|
1204
1210
|
});
|
|
1205
1211
|
}), i = i.plus(s.poolBorrowValue), c = c.plus(s.poolSupplyValue);
|
|
1206
1212
|
}), this.poolMap = ee(this.pools, "id"), this.emodeMap = de(this.emodes, "emodeId"), this.emodes.forEach((s) => {
|
|
@@ -1246,7 +1252,7 @@ const _ = (e) => {
|
|
|
1246
1252
|
if (!r)
|
|
1247
1253
|
throw new Error("Market not found");
|
|
1248
1254
|
return r;
|
|
1249
|
-
},
|
|
1255
|
+
}, bt = $(
|
|
1250
1256
|
A(
|
|
1251
1257
|
async (e, t) => {
|
|
1252
1258
|
const r = await G({
|
|
@@ -1256,13 +1262,13 @@ const _ = (e) => {
|
|
|
1256
1262
|
});
|
|
1257
1263
|
return e.map((o) => {
|
|
1258
1264
|
const n = _(o), a = r.filter((c) => c.market === n.key);
|
|
1259
|
-
return new
|
|
1265
|
+
return new wt(o, a);
|
|
1260
1266
|
});
|
|
1261
1267
|
}
|
|
1262
1268
|
)
|
|
1263
1269
|
), tr = $(
|
|
1264
1270
|
A(
|
|
1265
|
-
async (e, t) => (await
|
|
1271
|
+
async (e, t) => (await bt([e], t))[0]
|
|
1266
1272
|
)
|
|
1267
1273
|
), j = $(
|
|
1268
1274
|
A(
|
|
@@ -1272,7 +1278,7 @@ const _ = (e) => {
|
|
|
1272
1278
|
e
|
|
1273
1279
|
);
|
|
1274
1280
|
return (await fetch(o, {
|
|
1275
|
-
headers: U
|
|
1281
|
+
headers: D(U, r)
|
|
1276
1282
|
}).then((a) => a.json())).data;
|
|
1277
1283
|
}
|
|
1278
1284
|
)
|
|
@@ -1362,10 +1368,10 @@ const ke = $(
|
|
|
1362
1368
|
transactionBlock: o,
|
|
1363
1369
|
sender: e
|
|
1364
1370
|
})).results[0].returnValues, i = u.vector(u.u64()).parse(Uint8Array.from(c[0][0])), s = u.vector(u.u64()).parse(Uint8Array.from(c[1][0])), l = u.vector(u.Address).parse(Uint8Array.from(c[2][0]));
|
|
1365
|
-
return i.map((m,
|
|
1371
|
+
return i.map((m, w) => ({
|
|
1366
1372
|
marketId: Number(m),
|
|
1367
|
-
emodeId: Number(s[
|
|
1368
|
-
accountCap: l[
|
|
1373
|
+
emodeId: Number(s[w]),
|
|
1374
|
+
accountCap: l[w].toString()
|
|
1369
1375
|
}));
|
|
1370
1376
|
}
|
|
1371
1377
|
)
|
|
@@ -1457,43 +1463,43 @@ async function _e(e, t, r) {
|
|
|
1457
1463
|
const m = (await q(n, {
|
|
1458
1464
|
transactionBlock: o,
|
|
1459
1465
|
sender: e
|
|
1460
|
-
})).results || [],
|
|
1466
|
+
})).results || [], w = {};
|
|
1461
1467
|
s.forEach((d, f) => {
|
|
1462
1468
|
try {
|
|
1463
|
-
const
|
|
1464
|
-
for (const T of
|
|
1469
|
+
const b = m[f]?.returnValues?.map((T) => u.vector(Re).parse(Uint8Array.from(T[0])))[0] || [], k = {};
|
|
1470
|
+
for (const T of b)
|
|
1465
1471
|
k[T.id] = {
|
|
1466
1472
|
supplyIndex: T.supply_index,
|
|
1467
1473
|
borrowIndex: T.borrow_index
|
|
1468
1474
|
};
|
|
1469
|
-
|
|
1470
|
-
} catch (
|
|
1475
|
+
w[d.key] = k;
|
|
1476
|
+
} catch (b) {
|
|
1471
1477
|
console.warn(
|
|
1472
1478
|
`[@naviprotocol/lending] Failed to decode reserve data for market "${d.key}", falling back to open-api pool indices`,
|
|
1473
|
-
|
|
1479
|
+
b
|
|
1474
1480
|
);
|
|
1475
1481
|
}
|
|
1476
1482
|
});
|
|
1477
|
-
const
|
|
1478
|
-
return
|
|
1479
|
-
const
|
|
1483
|
+
const y = m.slice(s.length).map((d) => d.returnValues?.map((f) => u.vector(Le).parse(Uint8Array.from(f[0])))[0] || []), g = [];
|
|
1484
|
+
return y.forEach((d, f) => {
|
|
1485
|
+
const b = t[f], k = _(b.market), T = w[k.key] || {};
|
|
1480
1486
|
d.forEach((I) => {
|
|
1481
|
-
if (I.supply_balance === "0" && I.borrow_balance === "0" && (
|
|
1487
|
+
if (I.supply_balance === "0" && I.borrow_balance === "0" && (b.emodeId === void 0 || !r?.includeZeroBalanceEmodePositions))
|
|
1482
1488
|
return;
|
|
1483
1489
|
const B = c[`${k.key}-${I.asset_id}`];
|
|
1484
1490
|
if (!B)
|
|
1485
1491
|
return;
|
|
1486
1492
|
const W = T[I.asset_id], Y = W?.supplyIndex ?? B.currentSupplyIndex, Pe = W?.borrowIndex ?? B.currentBorrowIndex, Ae = ue(I.supply_balance, Y).toString(), Se = ue(I.borrow_balance, Pe).toString();
|
|
1487
|
-
|
|
1493
|
+
g.push({
|
|
1488
1494
|
supplyBalance: Ae,
|
|
1489
1495
|
borrowBalance: Se,
|
|
1490
1496
|
assetId: I.asset_id,
|
|
1491
1497
|
market: k.key,
|
|
1492
1498
|
pool: B,
|
|
1493
|
-
emodeId:
|
|
1499
|
+
emodeId: b.emodeId
|
|
1494
1500
|
});
|
|
1495
1501
|
});
|
|
1496
|
-
}),
|
|
1502
|
+
}), g;
|
|
1497
1503
|
}
|
|
1498
1504
|
const ir = $(
|
|
1499
1505
|
async (e, t) => {
|
|
@@ -1517,8 +1523,8 @@ async function sr(e, t, r, o) {
|
|
|
1517
1523
|
const n = o?.client ?? V, a = new N();
|
|
1518
1524
|
let c = 0, i = 0;
|
|
1519
1525
|
const s = await S(t, o);
|
|
1520
|
-
if (r.forEach((
|
|
1521
|
-
|
|
1526
|
+
if (r.forEach((y) => {
|
|
1527
|
+
y.type === z.Supply ? c += y.amount : y.type === z.Withdraw ? c -= y.amount : y.type === z.Borrow ? i += y.amount : y.type === z.Repay && (i -= y.amount);
|
|
1522
1528
|
}), c * i < 0)
|
|
1523
1529
|
throw new Error("Invalid operations");
|
|
1524
1530
|
const l = c > 0 || i > 0;
|
|
@@ -1534,8 +1540,8 @@ async function sr(e, t, r, o) {
|
|
|
1534
1540
|
const m = await q(n, {
|
|
1535
1541
|
transactionBlock: a,
|
|
1536
1542
|
sender: e
|
|
1537
|
-
}),
|
|
1538
|
-
return je(Number(
|
|
1543
|
+
}), w = Q(m, [u.u256()]);
|
|
1544
|
+
return je(Number(w[0]) || 0);
|
|
1539
1545
|
}
|
|
1540
1546
|
const lr = A(
|
|
1541
1547
|
async (e, t) => {
|
|
@@ -1546,7 +1552,7 @@ const lr = A(
|
|
|
1546
1552
|
t
|
|
1547
1553
|
);
|
|
1548
1554
|
return (await fetch(n, {
|
|
1549
|
-
headers: U
|
|
1555
|
+
headers: D(U, o)
|
|
1550
1556
|
}).then((c) => c.json())).data;
|
|
1551
1557
|
}
|
|
1552
1558
|
);
|
|
@@ -1579,7 +1585,7 @@ async function ur(e, t) {
|
|
|
1579
1585
|
});
|
|
1580
1586
|
}
|
|
1581
1587
|
else if (typeof a?.listBalances == "function" && typeof a?.listCoins == "function") {
|
|
1582
|
-
const i =
|
|
1588
|
+
const i = /* @__PURE__ */ new Set();
|
|
1583
1589
|
let s = null;
|
|
1584
1590
|
do {
|
|
1585
1591
|
const l = await a.listBalances({
|
|
@@ -1587,22 +1593,22 @@ async function ur(e, t) {
|
|
|
1587
1593
|
cursor: s,
|
|
1588
1594
|
limit: 100
|
|
1589
1595
|
});
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1596
|
+
for (const m of l.balances ?? [])
|
|
1597
|
+
m?.coinType && i.add(m.coinType);
|
|
1598
|
+
s = l.cursor ?? l.nextCursor ?? null;
|
|
1593
1599
|
} while (s);
|
|
1594
1600
|
for (const l of i) {
|
|
1595
1601
|
let m = null;
|
|
1596
1602
|
do {
|
|
1597
|
-
const
|
|
1603
|
+
const w = await a.listCoins({
|
|
1598
1604
|
owner: e,
|
|
1599
1605
|
coinType: l,
|
|
1600
1606
|
cursor: m,
|
|
1601
1607
|
limit: 100
|
|
1602
1608
|
});
|
|
1603
1609
|
o.push(
|
|
1604
|
-
...(
|
|
1605
|
-
), m =
|
|
1610
|
+
...(w.objects ?? w.data ?? []).map((y) => pe(y, l)).filter(Boolean)
|
|
1611
|
+
), m = w.cursor ?? w.nextCursor ?? null;
|
|
1606
1612
|
} while (m);
|
|
1607
1613
|
}
|
|
1608
1614
|
break;
|
|
@@ -1651,8 +1657,8 @@ const _t = $(
|
|
|
1651
1657
|
if (!i.pool.emodes.find((m) => m.emodeId === s.emodeId))
|
|
1652
1658
|
return;
|
|
1653
1659
|
if (p(i.supplyBalance).gte(0)) {
|
|
1654
|
-
const m = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN),
|
|
1655
|
-
if (m.gt(0) ||
|
|
1660
|
+
const m = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = H(i.pool, s);
|
|
1661
|
+
if (m.gt(0) || w.emode.isCollateral)
|
|
1656
1662
|
try {
|
|
1657
1663
|
r.push({
|
|
1658
1664
|
id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-supply-${P()}`,
|
|
@@ -1668,13 +1674,13 @@ const _t = $(
|
|
|
1668
1674
|
emodeCap: s
|
|
1669
1675
|
}
|
|
1670
1676
|
});
|
|
1671
|
-
} catch (
|
|
1672
|
-
console.error(
|
|
1677
|
+
} catch (y) {
|
|
1678
|
+
console.error(y);
|
|
1673
1679
|
}
|
|
1674
1680
|
}
|
|
1675
1681
|
if (p(i.borrowBalance).gte(0)) {
|
|
1676
|
-
const m = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN),
|
|
1677
|
-
if (m.gt(0) ||
|
|
1682
|
+
const m = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = H(i.pool, s);
|
|
1683
|
+
if (m.gt(0) || w.emode.isDebt)
|
|
1678
1684
|
try {
|
|
1679
1685
|
r.push({
|
|
1680
1686
|
id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-borrow-${P()}`,
|
|
@@ -1690,8 +1696,8 @@ const _t = $(
|
|
|
1690
1696
|
emodeCap: s
|
|
1691
1697
|
}
|
|
1692
1698
|
});
|
|
1693
|
-
} catch (
|
|
1694
|
-
console.error(
|
|
1699
|
+
} catch (y) {
|
|
1700
|
+
console.error(y);
|
|
1695
1701
|
}
|
|
1696
1702
|
}
|
|
1697
1703
|
} else {
|
|
@@ -1905,58 +1911,58 @@ class L {
|
|
|
1905
1911
|
getPositionsOverview(t) {
|
|
1906
1912
|
const r = {}, o = {};
|
|
1907
1913
|
let n = new p(0), a = new p(0), c = new p(0), i = new p(0), s = new p(0), l = new p(0);
|
|
1908
|
-
t.forEach((
|
|
1909
|
-
if (
|
|
1910
|
-
const d =
|
|
1914
|
+
t.forEach((g) => {
|
|
1915
|
+
if (g.type === "navi-lending-supply") {
|
|
1916
|
+
const d = g["navi-lending-supply"], f = this.resolveValueUSD(d);
|
|
1911
1917
|
n = n.plus(f), s = s.plus(
|
|
1912
1918
|
new p(f).multipliedBy(d.pool.liquidationFactor.threshold)
|
|
1913
1919
|
), l = l.plus(
|
|
1914
1920
|
new p(f).multipliedBy(d.pool.ltvValue)
|
|
1915
1921
|
);
|
|
1916
|
-
} else if (
|
|
1917
|
-
const d =
|
|
1922
|
+
} else if (g.type === "navi-lending-borrow") {
|
|
1923
|
+
const d = g["navi-lending-borrow"];
|
|
1918
1924
|
a = a.plus(this.resolveValueUSD(d));
|
|
1919
|
-
} else if (
|
|
1920
|
-
const d =
|
|
1925
|
+
} else if (g.type === "navi-lending-emode-supply") {
|
|
1926
|
+
const d = g["navi-lending-emode-supply"], f = this.resolveValueUSD(d);
|
|
1921
1927
|
n = n.plus(f);
|
|
1922
|
-
const
|
|
1928
|
+
const b = d.pool.emode;
|
|
1923
1929
|
s = s.plus(
|
|
1924
|
-
new p(f).multipliedBy(
|
|
1930
|
+
new p(f).multipliedBy(b.lt)
|
|
1925
1931
|
), l = l.plus(
|
|
1926
|
-
new p(f).multipliedBy(
|
|
1932
|
+
new p(f).multipliedBy(b.ltv)
|
|
1927
1933
|
);
|
|
1928
|
-
} else if (
|
|
1929
|
-
const d =
|
|
1934
|
+
} else if (g.type === "navi-lending-emode-borrow") {
|
|
1935
|
+
const d = g["navi-lending-emode-borrow"];
|
|
1930
1936
|
a = a.plus(this.resolveValueUSD(d));
|
|
1931
1937
|
}
|
|
1932
|
-
}), a = p.max(a, 0), n = p.max(n, 0), s = p.max(s, 0), l = p.max(l, 0), t.forEach((
|
|
1933
|
-
if (
|
|
1934
|
-
const d =
|
|
1938
|
+
}), a = p.max(a, 0), n = p.max(n, 0), s = p.max(s, 0), l = p.max(l, 0), t.forEach((g) => {
|
|
1939
|
+
if (g.type === "navi-lending-supply") {
|
|
1940
|
+
const d = g["navi-lending-supply"], f = this.resolveValueUSD(d), b = d.pool.supplyIncentiveApyInfo.apy;
|
|
1935
1941
|
n.gt(0) && (c = c.plus(
|
|
1936
|
-
new p(f).dividedBy(n).multipliedBy(new p(
|
|
1942
|
+
new p(f).dividedBy(n).multipliedBy(new p(b).dividedBy(100))
|
|
1937
1943
|
)), r[d.pool.suiCoinType] = p(r[d.pool.suiCoinType] || 0).plus(d.amount).toString();
|
|
1938
|
-
} else if (
|
|
1939
|
-
const d =
|
|
1944
|
+
} else if (g.type === "navi-lending-borrow") {
|
|
1945
|
+
const d = g["navi-lending-borrow"], f = this.resolveValueUSD(d), b = d.pool.borrowIncentiveApyInfo.apy;
|
|
1940
1946
|
a.gt(0) && (i = i.plus(
|
|
1941
|
-
new p(f).dividedBy(a).multipliedBy(new p(
|
|
1947
|
+
new p(f).dividedBy(a).multipliedBy(new p(b).dividedBy(100))
|
|
1942
1948
|
)), o[d.pool.suiCoinType] = p(o[d.pool.suiCoinType] || 0).plus(d.amount).toString();
|
|
1943
|
-
} else if (
|
|
1944
|
-
const d =
|
|
1949
|
+
} else if (g.type === "navi-lending-emode-supply") {
|
|
1950
|
+
const d = g["navi-lending-emode-supply"], f = this.resolveValueUSD(d), b = d.pool.supplyIncentiveApyInfo.apy;
|
|
1945
1951
|
n.gt(0) && (c = c.plus(
|
|
1946
|
-
new p(f).dividedBy(n).multipliedBy(new p(
|
|
1952
|
+
new p(f).dividedBy(n).multipliedBy(new p(b).dividedBy(100))
|
|
1947
1953
|
)), r[d.pool.suiCoinType] = p(r[d.pool.suiCoinType] || 0).plus(d.amount).toString();
|
|
1948
|
-
} else if (
|
|
1949
|
-
const d =
|
|
1954
|
+
} else if (g.type === "navi-lending-emode-borrow") {
|
|
1955
|
+
const d = g["navi-lending-emode-borrow"], f = this.resolveValueUSD(d), b = d.pool.borrowIncentiveApyInfo.apy;
|
|
1950
1956
|
a.gt(0) && (i = i.plus(
|
|
1951
|
-
new p(f).dividedBy(a).multipliedBy(new p(
|
|
1957
|
+
new p(f).dividedBy(a).multipliedBy(new p(b).dividedBy(100))
|
|
1952
1958
|
)), o[d.pool.suiCoinType] = p(o[d.pool.suiCoinType] || 0).plus(d.amount).toString();
|
|
1953
1959
|
}
|
|
1954
1960
|
});
|
|
1955
|
-
const m = n.minus(a),
|
|
1961
|
+
const m = n.minus(a), w = n.minus(a).eq(0) ? new p(0) : n.multipliedBy(c).minus(a.multipliedBy(i)).div(n.minus(a));
|
|
1956
1962
|
return {
|
|
1957
1963
|
hf: a.toNumber() !== 0 ? s.dividedBy(a).toNumber() : 1 / 0,
|
|
1958
1964
|
netVaule: m.toString(),
|
|
1959
|
-
netWorthApr:
|
|
1965
|
+
netWorthApr: w.toString(),
|
|
1960
1966
|
totalSupplyValue: n.toString(),
|
|
1961
1967
|
totalBorrowValue: a.toString(),
|
|
1962
1968
|
totalsupplyApy: c.toString(),
|
|
@@ -2021,18 +2027,23 @@ async function Tt(e, t) {
|
|
|
2021
2027
|
console.warn(`fetched object ${i?.objectId} datatype should be moveObject`);
|
|
2022
2028
|
continue;
|
|
2023
2029
|
}
|
|
2024
|
-
const s = e.find((
|
|
2030
|
+
const s = e.find((f) => f.priceInfoObject == i.objectId);
|
|
2025
2031
|
if (!s) {
|
|
2026
2032
|
console.warn(`unable to find pyth info from array, priceInfoObject: ${i.objectId}`);
|
|
2027
2033
|
continue;
|
|
2028
2034
|
}
|
|
2029
|
-
const l = i.content.fields
|
|
2035
|
+
const l = i.content.fields?.price_info?.price_feed?.price, m = l?.price;
|
|
2036
|
+
if (!m) {
|
|
2037
|
+
console.warn(`unexpected pyth price struct, priceInfoObject: ${i.objectId}`);
|
|
2038
|
+
continue;
|
|
2039
|
+
}
|
|
2040
|
+
const { magnitude: w, negative: y } = m, g = l.conf, d = l.timestamp;
|
|
2030
2041
|
r.push({
|
|
2031
2042
|
priceFeedId: s.priceFeedId,
|
|
2032
2043
|
priceInfoObject: s.priceInfoObject,
|
|
2033
|
-
price:
|
|
2034
|
-
conf:
|
|
2035
|
-
publishTime: Number(
|
|
2044
|
+
price: y ? "-" + w : w,
|
|
2045
|
+
conf: g,
|
|
2046
|
+
publishTime: Number(d),
|
|
2036
2047
|
expiration: s.expiration
|
|
2037
2048
|
});
|
|
2038
2049
|
}
|
|
@@ -2186,7 +2197,7 @@ const re = $(
|
|
|
2186
2197
|
`/navi/flashloan?env=${e?.env || "prod"}&sdk=${O.version}&market=${e?.market || R}`,
|
|
2187
2198
|
e
|
|
2188
2199
|
), o = await fetch(r, {
|
|
2189
|
-
headers: U
|
|
2200
|
+
headers: D(U, t)
|
|
2190
2201
|
}).then((n) => n.json());
|
|
2191
2202
|
return Object.keys(o.data).map((n) => ({
|
|
2192
2203
|
...o.data[n],
|
|
@@ -2266,7 +2277,7 @@ async function hr(e, t, r, o, n, a) {
|
|
|
2266
2277
|
cacheTime: v
|
|
2267
2278
|
}, i = await j(c), s = await S(t, c), l = await S(o, c);
|
|
2268
2279
|
if (i.version === 1) {
|
|
2269
|
-
const [m,
|
|
2280
|
+
const [m, w] = e.moveCall({
|
|
2270
2281
|
target: `${i.package}::incentive_v3::liquidation`,
|
|
2271
2282
|
arguments: [
|
|
2272
2283
|
e.object("0x06"),
|
|
@@ -2294,9 +2305,9 @@ async function hr(e, t, r, o, n, a) {
|
|
|
2294
2305
|
],
|
|
2295
2306
|
typeArguments: [s.suiCoinType, l.suiCoinType]
|
|
2296
2307
|
});
|
|
2297
|
-
return [m,
|
|
2308
|
+
return [m, w];
|
|
2298
2309
|
} else {
|
|
2299
|
-
const [m,
|
|
2310
|
+
const [m, w] = e.moveCall({
|
|
2300
2311
|
target: `${i.package}::incentive_v3::liquidation_v2`,
|
|
2301
2312
|
arguments: [
|
|
2302
2313
|
e.object("0x06"),
|
|
@@ -2326,46 +2337,43 @@ async function hr(e, t, r, o, n, a) {
|
|
|
2326
2337
|
],
|
|
2327
2338
|
typeArguments: [s.suiCoinType, l.suiCoinType]
|
|
2328
2339
|
});
|
|
2329
|
-
return [m,
|
|
2340
|
+
return [m, w];
|
|
2330
2341
|
}
|
|
2331
2342
|
}
|
|
2332
2343
|
async function $t(e, t, r) {
|
|
2333
|
-
const o = r?.client ?? V, n =
|
|
2344
|
+
const o = r?.client ?? V, n = await G({
|
|
2334
2345
|
...r,
|
|
2335
2346
|
markets: Object.values(F),
|
|
2336
2347
|
cacheTime: v
|
|
2337
|
-
}),
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
{
|
|
2366
|
-
results: [m]
|
|
2367
|
-
},
|
|
2368
|
-
[
|
|
2348
|
+
}), a = await Be(r), c = [];
|
|
2349
|
+
return await Promise.all(
|
|
2350
|
+
t.map(async (i) => {
|
|
2351
|
+
try {
|
|
2352
|
+
const s = await j({
|
|
2353
|
+
...r,
|
|
2354
|
+
cacheTime: v,
|
|
2355
|
+
market: i.market
|
|
2356
|
+
}), l = new N();
|
|
2357
|
+
l.moveCall({
|
|
2358
|
+
target: `${s.uiGetter}::incentive_v3_getter::get_user_atomic_claimable_rewards`,
|
|
2359
|
+
arguments: [
|
|
2360
|
+
l.object("0x06"),
|
|
2361
|
+
// Clock object
|
|
2362
|
+
l.object(s.storage),
|
|
2363
|
+
// Protocol storage
|
|
2364
|
+
l.object(s.incentiveV3),
|
|
2365
|
+
// Incentive V3 contract
|
|
2366
|
+
l.pure.address(i.address)
|
|
2367
|
+
// User address
|
|
2368
|
+
]
|
|
2369
|
+
});
|
|
2370
|
+
const w = (await q(o, {
|
|
2371
|
+
transactionBlock: l,
|
|
2372
|
+
sender: e
|
|
2373
|
+
}))?.results?.[0];
|
|
2374
|
+
if (!w)
|
|
2375
|
+
return;
|
|
2376
|
+
const y = Q({ results: [w] }, [
|
|
2369
2377
|
u.vector(u.string()),
|
|
2370
2378
|
// Asset coin types
|
|
2371
2379
|
u.vector(u.string()),
|
|
@@ -2376,38 +2384,39 @@ async function $t(e, t, r) {
|
|
|
2376
2384
|
// Rule IDs
|
|
2377
2385
|
u.vector(u.u256())
|
|
2378
2386
|
// Claimable amounts
|
|
2379
|
-
]
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2387
|
+
]);
|
|
2388
|
+
if (y.length === 5 && Array.isArray(y[0])) {
|
|
2389
|
+
const g = y[0].length;
|
|
2390
|
+
for (let d = 0; d < g; d++) {
|
|
2391
|
+
const f = a.find(
|
|
2392
|
+
(k) => C(k.coinType) === C(y[1][d])
|
|
2393
|
+
), b = n.find(
|
|
2394
|
+
(k) => C(k.coinType) === C(y[0][d]) && k.market === i.market
|
|
2395
|
+
);
|
|
2396
|
+
!f || !b || c.push({
|
|
2397
|
+
assetId: b.id,
|
|
2398
|
+
assetCoinType: C(y[0][d]),
|
|
2399
|
+
rewardCoinType: C(y[1][d]),
|
|
2400
|
+
option: Number(y[2][d]),
|
|
2401
|
+
userClaimableReward: Number(y[4][d]) / Math.pow(10, f.priceDecimal),
|
|
2402
|
+
ruleIds: Array.isArray(y[3][d]) ? y[3][d] : [y[3][d]],
|
|
2403
|
+
market: i.market,
|
|
2404
|
+
owner: i.owner,
|
|
2405
|
+
address: i.address,
|
|
2406
|
+
emodeId: i.emodeId
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
} catch (s) {
|
|
2411
|
+
console.error(
|
|
2412
|
+
`[lending] getLendingRewardsBatch task failed (market=${i.market}, address=${i.address}):`,
|
|
2413
|
+
s
|
|
2393
2414
|
);
|
|
2394
|
-
!f || !w || l.push({
|
|
2395
|
-
assetId: w.id,
|
|
2396
|
-
assetCoinType: C(m[0][d]),
|
|
2397
|
-
rewardCoinType: C(m[1][d]),
|
|
2398
|
-
option: Number(m[2][d]),
|
|
2399
|
-
userClaimableReward: Number(m[4][d]) / Math.pow(10, f.priceDecimal),
|
|
2400
|
-
ruleIds: Array.isArray(m[3][d]) ? m[3][d] : [m[3][d]],
|
|
2401
|
-
market: b.market,
|
|
2402
|
-
owner: b.owner,
|
|
2403
|
-
address: b.address,
|
|
2404
|
-
emodeId: b.emodeId
|
|
2405
|
-
});
|
|
2406
2415
|
}
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2416
|
+
})
|
|
2417
|
+
), c;
|
|
2409
2418
|
}
|
|
2410
|
-
async function
|
|
2419
|
+
async function wr(e, t) {
|
|
2411
2420
|
const r = (t?.markets || [F.main]).map((a) => _(a));
|
|
2412
2421
|
let o = [];
|
|
2413
2422
|
try {
|
|
@@ -2432,7 +2441,7 @@ async function br(e, t) {
|
|
|
2432
2441
|
);
|
|
2433
2442
|
return await $t(e, n, t);
|
|
2434
2443
|
}
|
|
2435
|
-
function
|
|
2444
|
+
function br(e) {
|
|
2436
2445
|
const t = /* @__PURE__ */ new Map();
|
|
2437
2446
|
e.forEach((o) => {
|
|
2438
2447
|
const n = o.assetId, a = o.option, c = `${n}-${a}-${o.rewardCoinType}-${o.market}`;
|
|
@@ -2468,7 +2477,7 @@ const vr = A(
|
|
|
2468
2477
|
t
|
|
2469
2478
|
);
|
|
2470
2479
|
return (await fetch(o, {
|
|
2471
|
-
headers: U
|
|
2480
|
+
headers: D(U, r)
|
|
2472
2481
|
}).then((a) => a.json())).data;
|
|
2473
2482
|
}
|
|
2474
2483
|
), Cr = A(
|
|
@@ -2477,7 +2486,7 @@ const vr = A(
|
|
|
2477
2486
|
`/navi/user/rewards?userAddress=${e}&page=${t?.page || 1}&pageSize=${t?.size || 400}&sdk=${O.version}&market=${t?.market || R}`,
|
|
2478
2487
|
t
|
|
2479
2488
|
), n = await fetch(o, {
|
|
2480
|
-
headers: U
|
|
2489
|
+
headers: D(U, r)
|
|
2481
2490
|
}).then((a) => a.json());
|
|
2482
2491
|
return x({
|
|
2483
2492
|
data: n.data.rewards
|
|
@@ -2491,35 +2500,35 @@ async function jr(e, t, r) {
|
|
|
2491
2500
|
cacheTime: v
|
|
2492
2501
|
}), n = /* @__PURE__ */ new Map();
|
|
2493
2502
|
for (const c of t) {
|
|
2494
|
-
const { rewardCoinType: i, ruleIds: s, market: l, owner: m, address:
|
|
2503
|
+
const { rewardCoinType: i, ruleIds: s, market: l, owner: m, address: w, emodeId: y } = c, g = `${i}___${w}__${l}`;
|
|
2495
2504
|
for (const d of s) {
|
|
2496
|
-
n.has(
|
|
2505
|
+
n.has(g) || n.set(g, {
|
|
2497
2506
|
assetIds: [],
|
|
2498
2507
|
ruleIds: [],
|
|
2499
2508
|
amount: 0,
|
|
2500
2509
|
market: l,
|
|
2501
2510
|
owner: m,
|
|
2502
|
-
address:
|
|
2503
|
-
isEMode: typeof
|
|
2511
|
+
address: w,
|
|
2512
|
+
isEMode: typeof y < "u"
|
|
2504
2513
|
});
|
|
2505
|
-
const f = n.get(
|
|
2514
|
+
const f = n.get(g);
|
|
2506
2515
|
f.assetIds.push(c.assetCoinType.replace("0x", "")), f.ruleIds.push(d), f.amount += c.userClaimableReward;
|
|
2507
2516
|
}
|
|
2508
2517
|
}
|
|
2509
2518
|
const a = [];
|
|
2510
2519
|
for (const [
|
|
2511
2520
|
c,
|
|
2512
|
-
{ assetIds: i, ruleIds: s, amount: l, market: m, owner:
|
|
2521
|
+
{ assetIds: i, ruleIds: s, amount: l, market: m, owner: w, address: y, isEMode: g }
|
|
2513
2522
|
] of n) {
|
|
2514
2523
|
const d = await j({
|
|
2515
2524
|
...r,
|
|
2516
2525
|
cacheTime: v,
|
|
2517
2526
|
market: m
|
|
2518
|
-
}), f = c.split("___")[0],
|
|
2527
|
+
}), f = c.split("___")[0], b = o.filter(
|
|
2519
2528
|
(I) => C(I.suiCoinType) === C(f)
|
|
2520
2529
|
);
|
|
2521
|
-
|
|
2522
|
-
const k =
|
|
2530
|
+
b.sort((I, B) => I.market === m ? -1 : 1);
|
|
2531
|
+
const k = b[0], T = d.rewardFunds[C(f)];
|
|
2523
2532
|
if (!T)
|
|
2524
2533
|
throw new Error(`No matching rewardFund found for reward coin: ${f} ${m}`);
|
|
2525
2534
|
if (r?.accountCap && !r.customCoinReceive)
|
|
@@ -2545,7 +2554,7 @@ async function jr(e, t, r) {
|
|
|
2545
2554
|
// Account capability
|
|
2546
2555
|
],
|
|
2547
2556
|
typeArguments: [f]
|
|
2548
|
-
}) :
|
|
2557
|
+
}) : g ? I = e.moveCall({
|
|
2549
2558
|
target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
|
|
2550
2559
|
arguments: [
|
|
2551
2560
|
e.object("0x06"),
|
|
@@ -2560,7 +2569,7 @@ async function jr(e, t, r) {
|
|
|
2560
2569
|
// Asset IDs
|
|
2561
2570
|
e.pure.vector("address", s),
|
|
2562
2571
|
// Rule IDs
|
|
2563
|
-
h(
|
|
2572
|
+
h(y, e.object)
|
|
2564
2573
|
// Account capability
|
|
2565
2574
|
],
|
|
2566
2575
|
typeArguments: [f]
|
|
@@ -2608,10 +2617,10 @@ async function jr(e, t, r) {
|
|
|
2608
2617
|
a.push({
|
|
2609
2618
|
coin: B,
|
|
2610
2619
|
identifier: k,
|
|
2611
|
-
owner:
|
|
2612
|
-
isEMode:
|
|
2620
|
+
owner: w,
|
|
2621
|
+
isEMode: g
|
|
2613
2622
|
});
|
|
2614
|
-
} else if (r?.accountCap ||
|
|
2623
|
+
} else if (r?.accountCap || g) {
|
|
2615
2624
|
const I = e.moveCall({
|
|
2616
2625
|
target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
|
|
2617
2626
|
arguments: [
|
|
@@ -2627,7 +2636,7 @@ async function jr(e, t, r) {
|
|
|
2627
2636
|
// Asset IDs
|
|
2628
2637
|
e.pure.vector("address", s),
|
|
2629
2638
|
// Rule IDs
|
|
2630
|
-
h(r?.accountCap ||
|
|
2639
|
+
h(r?.accountCap || y, e.object)
|
|
2631
2640
|
// Account capability
|
|
2632
2641
|
],
|
|
2633
2642
|
typeArguments: [f]
|
|
@@ -2638,7 +2647,7 @@ async function jr(e, t, r) {
|
|
|
2638
2647
|
});
|
|
2639
2648
|
e.transferObjects(
|
|
2640
2649
|
[B],
|
|
2641
|
-
h(r?.accountCap ||
|
|
2650
|
+
h(r?.accountCap || w, e.pure.address)
|
|
2642
2651
|
);
|
|
2643
2652
|
} else
|
|
2644
2653
|
e.moveCall({
|
|
@@ -2671,7 +2680,7 @@ export {
|
|
|
2671
2680
|
Ne as IncentivePoolInfo,
|
|
2672
2681
|
Lt as IncentivePoolInfoByPhase,
|
|
2673
2682
|
F as MARKETS,
|
|
2674
|
-
|
|
2683
|
+
wt as Market,
|
|
2675
2684
|
He as NaviMissingGraphQLClientError,
|
|
2676
2685
|
qt as OracleInfo,
|
|
2677
2686
|
z as PoolOperator,
|
|
@@ -2710,7 +2719,7 @@ export {
|
|
|
2710
2719
|
ir as getLendingState,
|
|
2711
2720
|
tr as getMarket,
|
|
2712
2721
|
_ as getMarketConfig,
|
|
2713
|
-
|
|
2722
|
+
bt as getMarkets,
|
|
2714
2723
|
S as getPool,
|
|
2715
2724
|
G as getPools,
|
|
2716
2725
|
Be as getPriceFeeds,
|
|
@@ -2720,14 +2729,14 @@ export {
|
|
|
2720
2729
|
Ie as getSimulatedHealthFactorPTB,
|
|
2721
2730
|
Qt as getStats,
|
|
2722
2731
|
lr as getTransactions,
|
|
2723
|
-
|
|
2732
|
+
wr as getUserAvailableLendingRewards,
|
|
2724
2733
|
Cr as getUserClaimedRewardHistory,
|
|
2725
2734
|
ke as getUserEModeCaps,
|
|
2726
2735
|
vr as getUserTotalClaimedReward,
|
|
2727
2736
|
hr as liquidatePTB,
|
|
2728
2737
|
Ht as listAddressBalances,
|
|
2729
2738
|
ar as mergeCoinsPTB,
|
|
2730
|
-
|
|
2739
|
+
D as mergeServiceHeaders,
|
|
2731
2740
|
ye as normalizeAddressBalance,
|
|
2732
2741
|
C as normalizeCoinType,
|
|
2733
2742
|
gt as parsePoolUID,
|
|
@@ -2736,7 +2745,7 @@ export {
|
|
|
2736
2745
|
gr as repayFlashLoanPTB,
|
|
2737
2746
|
Jt as requireNaviGraphQLClient,
|
|
2738
2747
|
E as resolveNaviOpenApiEndpoint,
|
|
2739
|
-
|
|
2748
|
+
br as summaryLendingRewards,
|
|
2740
2749
|
mr as updateOraclePriceBeforeUserOperationPTB,
|
|
2741
2750
|
At as updateOraclePricesPTB,
|
|
2742
2751
|
Pt as updatePythPriceFeeds,
|