@naviprotocol/lending 1.3.5 → 1.3.6
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/flashloan.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +96 -90
- package/dist/index.esm.js.map +1 -1
- package/dist/pool.d.ts.map +1 -1
- package/dist/reward.d.ts.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Transaction as
|
|
1
|
+
import { Transaction as P } from "@mysten/sui/transactions";
|
|
2
2
|
import { bcs as i, toHex as z, fromHex as W } from "@mysten/bcs";
|
|
3
3
|
import { SuiClient as J, getFullnodeUrl as K } from "@mysten/sui/client";
|
|
4
4
|
import Y from "lodash.camelcase";
|
|
5
5
|
import { normalizeStructTag as Q } from "@mysten/sui/utils";
|
|
6
|
-
import { SuiPriceServiceConnection as
|
|
7
|
-
import
|
|
6
|
+
import { SuiPriceServiceConnection as U, SuiPythClient as X } from "@pythnetwork/pyth-sui-js";
|
|
7
|
+
import A from "bignumber.js";
|
|
8
8
|
import { bcs as w } from "@mysten/sui/bcs";
|
|
9
|
-
const
|
|
9
|
+
const N = i.bytes(32).transform({
|
|
10
10
|
// To change the input type, you need to provide a type definition for the input
|
|
11
11
|
input: (e) => W(e),
|
|
12
12
|
output: (e) => z(e)
|
|
@@ -19,9 +19,9 @@ const R = i.bytes(32).transform({
|
|
|
19
19
|
coin_types: i.vector(i.string())
|
|
20
20
|
}), Z = i.struct("IncentivePoolInfo", {
|
|
21
21
|
/** Unique pool identifier */
|
|
22
|
-
pool_id:
|
|
22
|
+
pool_id: N,
|
|
23
23
|
/** Address holding the incentive funds */
|
|
24
|
-
funds:
|
|
24
|
+
funds: N,
|
|
25
25
|
/** Current phase of the incentive program */
|
|
26
26
|
phase: i.u64(),
|
|
27
27
|
/** Timestamp when the incentive started */
|
|
@@ -129,9 +129,9 @@ const R = i.bytes(32).transform({
|
|
|
129
129
|
borrow_balance: i.u256(),
|
|
130
130
|
/** User's current supply balance */
|
|
131
131
|
supply_balance: i.u256()
|
|
132
|
-
}), ee = "1.3.
|
|
132
|
+
}), ee = "1.3.6", j = {
|
|
133
133
|
version: ee
|
|
134
|
-
}, te =
|
|
134
|
+
}, te = j.version, re = () => {
|
|
135
135
|
if (typeof process != "undefined" && process.versions && process.versions.node)
|
|
136
136
|
try {
|
|
137
137
|
const e = require("os"), r = process.version, c = e.type(), t = e.arch();
|
|
@@ -143,7 +143,7 @@ const R = i.bytes(32).transform({
|
|
|
143
143
|
}, ae = () => {
|
|
144
144
|
let e = "";
|
|
145
145
|
return typeof process != "undefined" && process.versions && process.versions.node && (e = `lending/${te} (${re()})`), e;
|
|
146
|
-
},
|
|
146
|
+
}, E = ae(), $ = new J({
|
|
147
147
|
url: K("mainnet")
|
|
148
148
|
});
|
|
149
149
|
function L(e) {
|
|
@@ -157,7 +157,7 @@ function L(e) {
|
|
|
157
157
|
r.push(c);
|
|
158
158
|
}), JSON.stringify(r);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function _(e) {
|
|
161
161
|
const r = {};
|
|
162
162
|
return (...c) => {
|
|
163
163
|
const t = L(c);
|
|
@@ -166,7 +166,7 @@ function j(e) {
|
|
|
166
166
|
})), r[t];
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function k(e) {
|
|
170
170
|
let r = {};
|
|
171
171
|
return (...c) => {
|
|
172
172
|
const t = c[c.length - 1], a = L(c), n = r[a];
|
|
@@ -176,11 +176,11 @@ function $(e) {
|
|
|
176
176
|
}, o));
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
return Array.isArray(e) ? e.map((r) =>
|
|
179
|
+
function S(e) {
|
|
180
|
+
return Array.isArray(e) ? e.map((r) => S(r)) : e != null && typeof e == "object" ? Object.keys(e).reduce(
|
|
181
181
|
(r, c) => ({
|
|
182
182
|
...r,
|
|
183
|
-
[Y(c)]:
|
|
183
|
+
[Y(c)]: S(e[c])
|
|
184
184
|
}),
|
|
185
185
|
{}
|
|
186
186
|
) : e;
|
|
@@ -191,7 +191,7 @@ function d(e, r) {
|
|
|
191
191
|
function ce(e, r) {
|
|
192
192
|
return typeof r == "string" ? e.object(r) : typeof r == "object" && r.$kind ? r : e.object(r.contract.pool);
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function V(e, r, c) {
|
|
195
195
|
if (e.results && e.results.length > 0) {
|
|
196
196
|
if (e.results[0].returnValues && e.results[0].returnValues.length > 0)
|
|
197
197
|
return e.results[0].returnValues.map((t, a) => (r[a] || r[0]).parse(Uint8Array.from(t[0])));
|
|
@@ -206,30 +206,30 @@ function M(e) {
|
|
|
206
206
|
const r = (e || 0) / Math.pow(10, 27);
|
|
207
207
|
return r > Math.pow(10, 5) ? 1 / 0 : r;
|
|
208
208
|
}
|
|
209
|
-
new
|
|
209
|
+
new U("https://hermes.pyth.network", {
|
|
210
210
|
timeout: 2e4
|
|
211
211
|
});
|
|
212
|
-
const ne = 27,
|
|
213
|
-
if (!Number(e) || !Number(r)) return new
|
|
214
|
-
const c = new
|
|
215
|
-
return new
|
|
216
|
-
}, I =
|
|
217
|
-
"User-Agent":
|
|
218
|
-
} : {}, b =
|
|
219
|
-
|
|
220
|
-
const r = `https://open-api.naviprotocol.io/api/navi/config?env=${(e == null ? void 0 : e.env) || "prod"}&sdk=${
|
|
212
|
+
const ne = 27, D = (e, r) => {
|
|
213
|
+
if (!Number(e) || !Number(r)) return new A(0);
|
|
214
|
+
const c = new A(1).shiftedBy(1 * ne), t = c.multipliedBy(new A(0.5));
|
|
215
|
+
return new A(e).multipliedBy(new A(r)).plus(t).dividedBy(c).integerValue(A.ROUND_DOWN);
|
|
216
|
+
}, I = E ? {
|
|
217
|
+
"User-Agent": E
|
|
218
|
+
} : {}, b = k(
|
|
219
|
+
_(async (e) => {
|
|
220
|
+
const r = `https://open-api.naviprotocol.io/api/navi/config?env=${(e == null ? void 0 : e.env) || "prod"}&sdk=${j.version}`;
|
|
221
221
|
return (await fetch(r, { headers: I }).then((t) => t.json())).data;
|
|
222
222
|
})
|
|
223
223
|
), g = 1e3 * 60 * 5;
|
|
224
|
-
var
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
const r = `https://open-api.naviprotocol.io/api/navi/pools?env=${(e == null ? void 0 : e.env) || "prod"}`;
|
|
224
|
+
var B = /* @__PURE__ */ ((e) => (e[e.Supply = 1] = "Supply", e[e.Withdraw = 2] = "Withdraw", e[e.Borrow = 3] = "Borrow", e[e.Repay = 4] = "Repay", e))(B || {});
|
|
225
|
+
const F = k(
|
|
226
|
+
_(async (e) => {
|
|
227
|
+
const r = `https://open-api.naviprotocol.io/api/navi/pools?env=${(e == null ? void 0 : e.env) || "prod"}&sdk=${j.version}`;
|
|
228
228
|
return (await fetch(r, { headers: I }).then((t) => t.json())).data;
|
|
229
229
|
})
|
|
230
230
|
);
|
|
231
231
|
async function v(e, r) {
|
|
232
|
-
const c = await
|
|
232
|
+
const c = await F({
|
|
233
233
|
...r,
|
|
234
234
|
cacheTime: g
|
|
235
235
|
});
|
|
@@ -240,11 +240,17 @@ async function v(e, r) {
|
|
|
240
240
|
throw new Error("Pool not found");
|
|
241
241
|
return t.isDeprecated && console.log(`The lending pool for coinType ${t.suiCoinType} is going to be deprecated.`), t;
|
|
242
242
|
}
|
|
243
|
-
const Te =
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
const Te = k(
|
|
244
|
+
_(async (e) => {
|
|
245
|
+
const r = `https://open-api.naviprotocol.io/api/navi/stats?sdk=${j.version}`;
|
|
246
|
+
return (await fetch(r, { headers: I }).then((t) => t.json())).data;
|
|
247
|
+
})
|
|
248
|
+
), Ae = k(
|
|
249
|
+
_(
|
|
250
|
+
async (e) => {
|
|
251
|
+
const r = `https://open-api.naviprotocol.io/api/navi/fee?sdk=${j.version}`;
|
|
252
|
+
return await fetch(r, { headers: I }).then((t) => t.json());
|
|
253
|
+
}
|
|
248
254
|
)
|
|
249
255
|
);
|
|
250
256
|
async function oe(e, r, c, t) {
|
|
@@ -296,7 +302,7 @@ async function oe(e, r, c, t) {
|
|
|
296
302
|
arguments: [e.object(n.contract.pool), e.object("0x05")]
|
|
297
303
|
}), e;
|
|
298
304
|
}
|
|
299
|
-
async function
|
|
305
|
+
async function $e(e, r, c, t) {
|
|
300
306
|
const a = await b({
|
|
301
307
|
...t,
|
|
302
308
|
cacheTime: g
|
|
@@ -379,7 +385,7 @@ async function Ie(e, r, c, t) {
|
|
|
379
385
|
typeArguments: [n.suiCoinType]
|
|
380
386
|
});
|
|
381
387
|
}
|
|
382
|
-
async function
|
|
388
|
+
async function Ie(e, r, c, t) {
|
|
383
389
|
const a = await b({
|
|
384
390
|
...t,
|
|
385
391
|
cacheTime: g
|
|
@@ -518,8 +524,8 @@ async function ke(e, r, c, t) {
|
|
|
518
524
|
typeArguments: [n.suiCoinType]
|
|
519
525
|
}), e;
|
|
520
526
|
}
|
|
521
|
-
const Be =
|
|
522
|
-
|
|
527
|
+
const Be = k(
|
|
528
|
+
_(
|
|
523
529
|
async (e) => {
|
|
524
530
|
var a;
|
|
525
531
|
const r = await b({
|
|
@@ -527,7 +533,7 @@ const Be = $(
|
|
|
527
533
|
});
|
|
528
534
|
if (e != null && e.address && typeof (e == null ? void 0 : e.asset) != "undefined")
|
|
529
535
|
try {
|
|
530
|
-
const n = await v(e.asset, e), o = (a = e == null ? void 0 : e.client) != null ? a :
|
|
536
|
+
const n = await v(e.asset, e), o = (a = e == null ? void 0 : e.client) != null ? a : $, s = new P();
|
|
531
537
|
s.moveCall({
|
|
532
538
|
target: `${r.package}::incentive_v3::get_borrow_fee_v2`,
|
|
533
539
|
arguments: [
|
|
@@ -541,12 +547,12 @@ const Be = $(
|
|
|
541
547
|
const u = await o.devInspectTransactionBlock({
|
|
542
548
|
transactionBlock: s,
|
|
543
549
|
sender: e.address
|
|
544
|
-
}), l =
|
|
550
|
+
}), l = V(u, [w.u64()]);
|
|
545
551
|
return (Number(l[0]) || 0) / 100;
|
|
546
552
|
} catch (n) {
|
|
547
553
|
console.error(n);
|
|
548
554
|
}
|
|
549
|
-
const t = (await
|
|
555
|
+
const t = (await $.getObject({
|
|
550
556
|
id: r.incentiveV3,
|
|
551
557
|
options: { showType: !0, showOwner: !0, showContent: !0 }
|
|
552
558
|
})).data.content.fields.borrow_fee_rate;
|
|
@@ -600,13 +606,13 @@ async function O(e, r, c, t, a, n, o) {
|
|
|
600
606
|
async function se(e, r, c) {
|
|
601
607
|
return O(e, r, 0, 0, 0, !1, c);
|
|
602
608
|
}
|
|
603
|
-
const Ve =
|
|
609
|
+
const Ve = k(
|
|
604
610
|
async (e, r) => {
|
|
605
611
|
var l;
|
|
606
612
|
const c = await b({
|
|
607
613
|
...r,
|
|
608
614
|
cacheTime: g
|
|
609
|
-
}), t = new
|
|
615
|
+
}), t = new P(), a = (l = r == null ? void 0 : r.client) != null ? l : $, n = await F(r);
|
|
610
616
|
t.moveCall({
|
|
611
617
|
target: `${c.uiGetter}::getter_unchecked::get_user_state`,
|
|
612
618
|
arguments: [t.object(c.storage), t.pure.address(e)]
|
|
@@ -614,14 +620,14 @@ const Ve = $(
|
|
|
614
620
|
const o = await a.devInspectTransactionBlock({
|
|
615
621
|
transactionBlock: t,
|
|
616
622
|
sender: e
|
|
617
|
-
}), s =
|
|
618
|
-
return
|
|
623
|
+
}), s = V(o, [w.vector(x)]);
|
|
624
|
+
return S(
|
|
619
625
|
s[0].filter((p) => p.supply_balance !== "0" || p.borrow_balance !== "0")
|
|
620
626
|
).map((p) => {
|
|
621
|
-
const h = n.find((C) => C.id === p.assetId), f =
|
|
627
|
+
const h = n.find((C) => C.id === p.assetId), f = D(
|
|
622
628
|
p.supplyBalance,
|
|
623
629
|
h.currentSupplyIndex
|
|
624
|
-
).toString(), y =
|
|
630
|
+
).toString(), y = D(
|
|
625
631
|
p.borrowBalance,
|
|
626
632
|
h.currentBorrowIndex
|
|
627
633
|
).toString();
|
|
@@ -636,21 +642,21 @@ const Ve = $(
|
|
|
636
642
|
);
|
|
637
643
|
async function Se(e, r) {
|
|
638
644
|
var o;
|
|
639
|
-
const c = (o = r == null ? void 0 : r.client) != null ? o :
|
|
645
|
+
const c = (o = r == null ? void 0 : r.client) != null ? o : $, t = new P();
|
|
640
646
|
await se(t, e, r);
|
|
641
647
|
const a = await c.devInspectTransactionBlock({
|
|
642
648
|
transactionBlock: t,
|
|
643
649
|
sender: e
|
|
644
|
-
}), n =
|
|
650
|
+
}), n = V(a, [w.u256()]);
|
|
645
651
|
return M(Number(n[0]) || 0);
|
|
646
652
|
}
|
|
647
653
|
async function Fe(e, r, c, t) {
|
|
648
654
|
var f;
|
|
649
|
-
const a = (f = t == null ? void 0 : t.client) != null ? f :
|
|
655
|
+
const a = (f = t == null ? void 0 : t.client) != null ? f : $, n = new P();
|
|
650
656
|
let o = 0, s = 0;
|
|
651
657
|
const u = await v(r, t);
|
|
652
658
|
if (c.forEach((y) => {
|
|
653
|
-
y.type ===
|
|
659
|
+
y.type === B.Supply ? o += y.amount : y.type === B.Withdraw ? o -= y.amount : y.type === B.Borrow ? s += y.amount : y.type === B.Repay && (s -= y.amount);
|
|
654
660
|
}), o * s < 0)
|
|
655
661
|
throw new Error("Invalid operations");
|
|
656
662
|
const l = o > 0 || s > 0;
|
|
@@ -666,21 +672,21 @@ async function Fe(e, r, c, t) {
|
|
|
666
672
|
const p = await a.devInspectTransactionBlock({
|
|
667
673
|
transactionBlock: n,
|
|
668
674
|
sender: e
|
|
669
|
-
}), h =
|
|
675
|
+
}), h = V(p, [w.u256()]);
|
|
670
676
|
return M(Number(h[0]) || 0);
|
|
671
677
|
}
|
|
672
|
-
const Re =
|
|
678
|
+
const Re = _(
|
|
673
679
|
async (e, r) => {
|
|
674
680
|
const c = new URLSearchParams();
|
|
675
681
|
r != null && r.cursor && c.set("cursor", r.cursor), c.set("userAddress", e);
|
|
676
|
-
const t = `https://open-api.naviprotocol.io/api/navi/user/transactions?${c.toString()}`;
|
|
682
|
+
const t = `https://open-api.naviprotocol.io/api/navi/user/transactions?${c.toString()}&sdk=${j.version}`;
|
|
677
683
|
return (await fetch(t, { headers: I }).then((n) => n.json())).data;
|
|
678
684
|
}
|
|
679
685
|
);
|
|
680
686
|
async function Ne(e, r) {
|
|
681
687
|
var n;
|
|
682
688
|
let c = null;
|
|
683
|
-
const t = [], a = (n = r == null ? void 0 : r.client) != null ? n :
|
|
689
|
+
const t = [], a = (n = r == null ? void 0 : r.client) != null ? n : $;
|
|
684
690
|
do {
|
|
685
691
|
let o;
|
|
686
692
|
if (r != null && r.coinType ? o = await a.getCoins({
|
|
@@ -698,7 +704,7 @@ async function Ne(e, r) {
|
|
|
698
704
|
} while (c);
|
|
699
705
|
return t;
|
|
700
706
|
}
|
|
701
|
-
const q = new
|
|
707
|
+
const q = new U("https://hermes.pyth.network", {
|
|
702
708
|
timeout: 1e4
|
|
703
709
|
});
|
|
704
710
|
async function ie(e) {
|
|
@@ -725,7 +731,7 @@ async function ie(e) {
|
|
|
725
731
|
}
|
|
726
732
|
async function ue(e, r, c) {
|
|
727
733
|
var n;
|
|
728
|
-
const t = (n = c == null ? void 0 : c.client) != null ? n :
|
|
734
|
+
const t = (n = c == null ? void 0 : c.client) != null ? n : $, a = await b({
|
|
729
735
|
...c,
|
|
730
736
|
cacheTime: g
|
|
731
737
|
});
|
|
@@ -782,9 +788,9 @@ async function le(e) {
|
|
|
782
788
|
function De(e, r) {
|
|
783
789
|
return e.filter((c) => !!(r != null && r.lendingState && r.lendingState.find((a) => a.assetId === c.assetId) || r != null && r.pools && r.pools.find((a) => a.id === c.assetId)));
|
|
784
790
|
}
|
|
785
|
-
const
|
|
786
|
-
|
|
787
|
-
const r = `https://open-api.naviprotocol.io/api/navi/flashloan?env=${(e == null ? void 0 : e.env) || "prod"}`, c = await fetch(r, { headers: I }).then((t) => t.json());
|
|
791
|
+
const R = k(
|
|
792
|
+
_(async (e) => {
|
|
793
|
+
const r = `https://open-api.naviprotocol.io/api/navi/flashloan?env=${(e == null ? void 0 : e.env) || "prod"}&sdk=${j.version}`, c = await fetch(r, { headers: I }).then((t) => t.json());
|
|
788
794
|
return Object.keys(c.data).map((t) => ({
|
|
789
795
|
...c.data[t],
|
|
790
796
|
coinType: t
|
|
@@ -792,14 +798,14 @@ const F = $(
|
|
|
792
798
|
})
|
|
793
799
|
);
|
|
794
800
|
async function Ue(e, r) {
|
|
795
|
-
return (await
|
|
801
|
+
return (await R(r)).find((t) => typeof e == "string" ? m(t.coinType) === m(e) : typeof e == "number" ? t.assetId === e : t.assetId === e.id) || null;
|
|
796
802
|
}
|
|
797
803
|
async function Le(e, r, c, t) {
|
|
798
804
|
const a = await b({
|
|
799
805
|
...t,
|
|
800
806
|
cacheTime: g
|
|
801
807
|
}), n = await v(r, t);
|
|
802
|
-
if (!(await
|
|
808
|
+
if (!(await R({
|
|
803
809
|
...t,
|
|
804
810
|
cacheTime: g
|
|
805
811
|
})).some(
|
|
@@ -836,7 +842,7 @@ async function Me(e, r, c, t, a) {
|
|
|
836
842
|
...a,
|
|
837
843
|
cacheTime: g
|
|
838
844
|
}), o = await v(r, a);
|
|
839
|
-
if (!(await
|
|
845
|
+
if (!(await R({
|
|
840
846
|
...a,
|
|
841
847
|
cacheTime: g
|
|
842
848
|
})).some(
|
|
@@ -927,13 +933,13 @@ async function Oe(e, r, c, t, a, n) {
|
|
|
927
933
|
}
|
|
928
934
|
async function qe(e, r) {
|
|
929
935
|
var p;
|
|
930
|
-
const c = await le(r), t = await
|
|
936
|
+
const c = await le(r), t = await F({
|
|
931
937
|
...r,
|
|
932
938
|
cacheTime: g
|
|
933
|
-
}), a = (p = r == null ? void 0 : r.client) != null ? p :
|
|
939
|
+
}), a = (p = r == null ? void 0 : r.client) != null ? p : $, n = await b({
|
|
934
940
|
...r,
|
|
935
941
|
cacheTime: g
|
|
936
|
-
}), o = new
|
|
942
|
+
}), o = new P();
|
|
937
943
|
o.moveCall({
|
|
938
944
|
target: `${n.uiGetter}::incentive_v3_getter::get_user_atomic_claimable_rewards`,
|
|
939
945
|
arguments: [
|
|
@@ -950,7 +956,7 @@ async function qe(e, r) {
|
|
|
950
956
|
const s = await a.devInspectTransactionBlock({
|
|
951
957
|
transactionBlock: o,
|
|
952
958
|
sender: e
|
|
953
|
-
}), u =
|
|
959
|
+
}), u = V(
|
|
954
960
|
s,
|
|
955
961
|
[
|
|
956
962
|
w.vector(w.string()),
|
|
@@ -969,9 +975,9 @@ async function qe(e, r) {
|
|
|
969
975
|
const h = u[0].length;
|
|
970
976
|
for (let f = 0; f < h; f++) {
|
|
971
977
|
const y = c.find(
|
|
972
|
-
(
|
|
978
|
+
(T) => m(T.coinType) === m(u[1][f])
|
|
973
979
|
), C = t.find(
|
|
974
|
-
(
|
|
980
|
+
(T) => m(T.coinType) === m(u[0][f])
|
|
975
981
|
);
|
|
976
982
|
!y || !C || l.push({
|
|
977
983
|
assetId: C.id,
|
|
@@ -1012,15 +1018,15 @@ function He(e) {
|
|
|
1012
1018
|
}))
|
|
1013
1019
|
}));
|
|
1014
1020
|
}
|
|
1015
|
-
const Ge =
|
|
1021
|
+
const Ge = _(
|
|
1016
1022
|
async (e) => {
|
|
1017
|
-
const r = `https://open-api.naviprotocol.io/api/navi/user/total_claimed_reward?userAddress=${e}`;
|
|
1023
|
+
const r = `https://open-api.naviprotocol.io/api/navi/user/total_claimed_reward?userAddress=${e}&sdk=${j.version}`;
|
|
1018
1024
|
return (await fetch(r, { headers: I }).then((t) => t.json())).data;
|
|
1019
1025
|
}
|
|
1020
|
-
), ze =
|
|
1026
|
+
), ze = _(
|
|
1021
1027
|
async (e, r) => {
|
|
1022
|
-
const c = `https://open-api.naviprotocol.io/api/navi/user/rewards?userAddress=${e}&page=${(r == null ? void 0 : r.page) || 1}&pageSize=${(r == null ? void 0 : r.size) || 400}`, t = await fetch(c, { headers: I }).then((a) => a.json());
|
|
1023
|
-
return
|
|
1028
|
+
const c = `https://open-api.naviprotocol.io/api/navi/user/rewards?userAddress=${e}&page=${(r == null ? void 0 : r.page) || 1}&pageSize=${(r == null ? void 0 : r.size) || 400}&sdk=${j.version}`, t = await fetch(c, { headers: I }).then((a) => a.json());
|
|
1029
|
+
return S({
|
|
1024
1030
|
data: t.data.rewards
|
|
1025
1031
|
});
|
|
1026
1032
|
}
|
|
@@ -1030,7 +1036,7 @@ async function We(e, r, c) {
|
|
|
1030
1036
|
const t = await b({
|
|
1031
1037
|
...c,
|
|
1032
1038
|
cacheTime: g
|
|
1033
|
-
}), a = await
|
|
1039
|
+
}), a = await F({
|
|
1034
1040
|
...c,
|
|
1035
1041
|
cacheTime: g
|
|
1036
1042
|
}), n = /* @__PURE__ */ new Map();
|
|
@@ -1091,7 +1097,7 @@ async function We(e, r, c) {
|
|
|
1091
1097
|
],
|
|
1092
1098
|
typeArguments: [u]
|
|
1093
1099
|
});
|
|
1094
|
-
const [
|
|
1100
|
+
const [T] = e.moveCall({
|
|
1095
1101
|
target: "0x2::coin::from_balance",
|
|
1096
1102
|
arguments: [C],
|
|
1097
1103
|
typeArguments: [u]
|
|
@@ -1100,19 +1106,19 @@ async function We(e, r, c) {
|
|
|
1100
1106
|
if (!c.customCoinReceive.transfer)
|
|
1101
1107
|
throw new Error("customCoinReceive.transfer is required");
|
|
1102
1108
|
e.transferObjects(
|
|
1103
|
-
[
|
|
1109
|
+
[T],
|
|
1104
1110
|
d(c.customCoinReceive.transfer, e.pure.address)
|
|
1105
1111
|
);
|
|
1106
1112
|
}
|
|
1107
1113
|
if ((c == null ? void 0 : c.customCoinReceive.type) === "depositNAVI") {
|
|
1108
|
-
const H =
|
|
1114
|
+
const H = A(f.totalSupplyAmount).shiftedBy(-9), G = A(f.supplyCapCeiling).shiftedBy(-27);
|
|
1109
1115
|
H.plus(h).isGreaterThan(G) && ((s = c == null ? void 0 : c.customCoinReceive.depositNAVI) != null && s.fallbackReceiveAddress) ? e.transferObjects(
|
|
1110
|
-
[
|
|
1116
|
+
[T],
|
|
1111
1117
|
e.pure.address(c.customCoinReceive.depositNAVI.fallbackReceiveAddress)
|
|
1112
|
-
) : await oe(e, f,
|
|
1118
|
+
) : await oe(e, f, T, c);
|
|
1113
1119
|
} else
|
|
1114
1120
|
o.push({
|
|
1115
|
-
coin:
|
|
1121
|
+
coin: T,
|
|
1116
1122
|
identifier: f
|
|
1117
1123
|
});
|
|
1118
1124
|
} else
|
|
@@ -1147,23 +1153,23 @@ async function Je(e, r) {
|
|
|
1147
1153
|
});
|
|
1148
1154
|
}
|
|
1149
1155
|
export {
|
|
1150
|
-
|
|
1156
|
+
N as Address,
|
|
1151
1157
|
g as DEFAULT_CACHE_TIME,
|
|
1152
1158
|
je as FlashLoanAssetConfig,
|
|
1153
1159
|
we as IncentiveAPYInfo,
|
|
1154
1160
|
Z as IncentivePoolInfo,
|
|
1155
1161
|
ve as IncentivePoolInfoByPhase,
|
|
1156
1162
|
Ce as OracleInfo,
|
|
1157
|
-
|
|
1163
|
+
B as PoolOperator,
|
|
1158
1164
|
_e as ReserveDataInfo,
|
|
1159
1165
|
x as UserStateInfo,
|
|
1160
|
-
|
|
1166
|
+
Ie as borrowCoinPTB,
|
|
1161
1167
|
We as claimLendingRewardsPTB,
|
|
1162
1168
|
Je as createAccountCapPTB,
|
|
1163
1169
|
oe as depositCoinPTB,
|
|
1164
1170
|
De as filterPriceFeeds,
|
|
1165
1171
|
Le as flashloanPTB,
|
|
1166
|
-
|
|
1172
|
+
R as getAllFlashLoanAssets,
|
|
1167
1173
|
Be as getBorrowFee,
|
|
1168
1174
|
Ne as getCoins,
|
|
1169
1175
|
b as getConfig,
|
|
@@ -1173,7 +1179,7 @@ export {
|
|
|
1173
1179
|
se as getHealthFactorPTB,
|
|
1174
1180
|
Ve as getLendingState,
|
|
1175
1181
|
v as getPool,
|
|
1176
|
-
|
|
1182
|
+
F as getPools,
|
|
1177
1183
|
le as getPriceFeeds,
|
|
1178
1184
|
ie as getPythStalePriceFeedId,
|
|
1179
1185
|
Fe as getSimulatedHealthFactor,
|
|
@@ -1192,8 +1198,8 @@ export {
|
|
|
1192
1198
|
He as summaryLendingRewards,
|
|
1193
1199
|
Ee as updateOraclePricesPTB,
|
|
1194
1200
|
ue as updatePythPriceFeeds,
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1201
|
+
k as withCache,
|
|
1202
|
+
_ as withSingleton,
|
|
1203
|
+
$e as withdrawCoinPTB
|
|
1198
1204
|
};
|
|
1199
1205
|
//# sourceMappingURL=index.esm.js.map
|