@naviprotocol/lending 1.4.1 → 1.4.2
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.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +18 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/reward.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -129,9 +129,9 @@ const z = m.bytes(32).transform({
|
|
|
129
129
|
borrow_balance: m.u256(),
|
|
130
130
|
/** User's current supply balance */
|
|
131
131
|
supply_balance: m.u256()
|
|
132
|
-
}), ye = "1.4.1",
|
|
132
|
+
}), ye = "1.4.2-beta.1", S = {
|
|
133
133
|
version: ye
|
|
134
|
-
}, ge =
|
|
134
|
+
}, ge = S.version, he = () => {
|
|
135
135
|
if (typeof process < "u" && process.versions && process.versions.node)
|
|
136
136
|
try {
|
|
137
137
|
const e = require("os"), n = process.version, o = e.type(), r = e.arch();
|
|
@@ -256,7 +256,7 @@ var F = /* @__PURE__ */ ((e) => (e[e.Supply = 1] = "Supply", e[e.Withdraw = 2] =
|
|
|
256
256
|
const R = $(
|
|
257
257
|
B(
|
|
258
258
|
async (e) => {
|
|
259
|
-
const n = (e?.markets || [E.main]).map((t) => j(t)), o = `https://open-api.naviprotocol.io/api/navi/pools?env=${e?.env || "prod"}&sdk=${
|
|
259
|
+
const n = (e?.markets || [E.main]).map((t) => j(t)), o = `https://open-api.naviprotocol.io/api/navi/pools?env=${e?.env || "prod"}&sdk=${S.version}&market=${n.map(
|
|
260
260
|
(t) => t.key
|
|
261
261
|
)}`, r = await fetch(o, { headers: M }).then((t) => t.json());
|
|
262
262
|
return r.data.forEach((t) => {
|
|
@@ -294,13 +294,13 @@ async function A(e, n) {
|
|
|
294
294
|
}
|
|
295
295
|
const Je = $(
|
|
296
296
|
B(async (e) => {
|
|
297
|
-
const n = `https://open-api.naviprotocol.io/api/navi/stats?sdk=${
|
|
297
|
+
const n = `https://open-api.naviprotocol.io/api/navi/stats?sdk=${S.version}`;
|
|
298
298
|
return (await fetch(n, { headers: M }).then((r) => r.json())).data;
|
|
299
299
|
})
|
|
300
300
|
), Ze = $(
|
|
301
301
|
B(
|
|
302
302
|
async (e) => {
|
|
303
|
-
const n = `https://open-api.naviprotocol.io/api/navi/fee?sdk=${
|
|
303
|
+
const n = `https://open-api.naviprotocol.io/api/navi/fee?sdk=${S.version}`;
|
|
304
304
|
return await fetch(n, { headers: M }).then((r) => r.json());
|
|
305
305
|
}
|
|
306
306
|
)
|
|
@@ -711,7 +711,7 @@ const j = (e) => {
|
|
|
711
711
|
), _ = $(
|
|
712
712
|
B(
|
|
713
713
|
async (e) => {
|
|
714
|
-
const n = j(e?.market || D), o = `https://open-api.naviprotocol.io/api/navi/config?env=${e?.env || "prod"}&sdk=${
|
|
714
|
+
const n = j(e?.market || D), o = `https://open-api.naviprotocol.io/api/navi/config?env=${e?.env || "prod"}&sdk=${S.version}&market=${n.key}`;
|
|
715
715
|
return (await fetch(o, { headers: M }).then((t) => t.json())).data;
|
|
716
716
|
}
|
|
717
717
|
)
|
|
@@ -947,7 +947,7 @@ const ut = B(
|
|
|
947
947
|
async (e, n) => {
|
|
948
948
|
const o = new URLSearchParams();
|
|
949
949
|
n?.cursor && o.set("cursor", n.cursor), o.set("userAddress", e);
|
|
950
|
-
const r = `https://open-api.naviprotocol.io/api/navi/user/transactions?${o.toString()}&sdk=${
|
|
950
|
+
const r = `https://open-api.naviprotocol.io/api/navi/user/transactions?${o.toString()}&sdk=${S.version}`;
|
|
951
951
|
return (await fetch(r, { headers: M }).then((a) => a.json())).data;
|
|
952
952
|
}
|
|
953
953
|
);
|
|
@@ -1530,7 +1530,7 @@ async function mt(e, n, o, r) {
|
|
|
1530
1530
|
const G = $(
|
|
1531
1531
|
B(
|
|
1532
1532
|
async (e) => {
|
|
1533
|
-
const n = `https://open-api.naviprotocol.io/api/navi/flashloan?env=${e?.env || "prod"}&sdk=${
|
|
1533
|
+
const n = `https://open-api.naviprotocol.io/api/navi/flashloan?env=${e?.env || "prod"}&sdk=${S.version}&market=${e?.market || D}`, o = await fetch(n, { headers: M }).then((r) => r.json());
|
|
1534
1534
|
return Object.keys(o.data).map((r) => ({
|
|
1535
1535
|
...o.data[r],
|
|
1536
1536
|
coinType: r
|
|
@@ -1806,12 +1806,12 @@ function wt(e) {
|
|
|
1806
1806
|
}
|
|
1807
1807
|
const bt = B(
|
|
1808
1808
|
async (e, n) => {
|
|
1809
|
-
const o = `https://open-api.naviprotocol.io/api/navi/user/total_claimed_reward?userAddress=${e}&sdk=${
|
|
1809
|
+
const o = `https://open-api.naviprotocol.io/api/navi/user/total_claimed_reward?userAddress=${e}&sdk=${S.version}&market=${n?.market || D}`;
|
|
1810
1810
|
return (await fetch(o, { headers: M }).then((t) => t.json())).data;
|
|
1811
1811
|
}
|
|
1812
1812
|
), kt = B(
|
|
1813
1813
|
async (e, n) => {
|
|
1814
|
-
const o = `https://open-api.naviprotocol.io/api/navi/user/rewards?userAddress=${e}&page=${n?.page || 1}&pageSize=${n?.size || 400}&sdk=${
|
|
1814
|
+
const o = `https://open-api.naviprotocol.io/api/navi/user/rewards?userAddress=${e}&page=${n?.page || 1}&pageSize=${n?.size || 400}&sdk=${S.version}&market=${n?.market || D}`, r = await fetch(o, { headers: M }).then((t) => t.json());
|
|
1815
1815
|
return W({
|
|
1816
1816
|
data: r.data.rewards
|
|
1817
1817
|
});
|
|
@@ -1849,7 +1849,7 @@ async function _t(e, n, o) {
|
|
|
1849
1849
|
cacheTime: b,
|
|
1850
1850
|
market: d
|
|
1851
1851
|
}), f = c.split("___")[0], w = r.find(
|
|
1852
|
-
(
|
|
1852
|
+
(V) => k(V.suiCoinType) === k(f)
|
|
1853
1853
|
);
|
|
1854
1854
|
if (!w || !w.contract.rewardFundId)
|
|
1855
1855
|
throw new Error(`No matching rewardFund found for reward coin: ${f} ${d}`);
|
|
@@ -1857,8 +1857,8 @@ async function _t(e, n, o) {
|
|
|
1857
1857
|
if (o?.accountCap && !o.customCoinReceive)
|
|
1858
1858
|
throw new Error("customCoinReceive is required when accountCap is provided");
|
|
1859
1859
|
if (o?.customCoinReceive) {
|
|
1860
|
-
let
|
|
1861
|
-
o.accountCap ?
|
|
1860
|
+
let V;
|
|
1861
|
+
o.accountCap ? V = e.moveCall({
|
|
1862
1862
|
target: `${l.package}::incentive_v3::claim_reward_with_account_cap`,
|
|
1863
1863
|
arguments: [
|
|
1864
1864
|
e.object("0x06"),
|
|
@@ -1877,7 +1877,7 @@ async function _t(e, n, o) {
|
|
|
1877
1877
|
// Account capability
|
|
1878
1878
|
],
|
|
1879
1879
|
typeArguments: [f]
|
|
1880
|
-
}) : g ?
|
|
1880
|
+
}) : g ? V = e.moveCall({
|
|
1881
1881
|
target: `${l.package}::incentive_v3::claim_reward_with_account_cap`,
|
|
1882
1882
|
arguments: [
|
|
1883
1883
|
e.object("0x06"),
|
|
@@ -1896,7 +1896,7 @@ async function _t(e, n, o) {
|
|
|
1896
1896
|
// Account capability
|
|
1897
1897
|
],
|
|
1898
1898
|
typeArguments: [f]
|
|
1899
|
-
}) :
|
|
1899
|
+
}) : V = e.moveCall({
|
|
1900
1900
|
target: `${l.package}::incentive_v3::claim_reward`,
|
|
1901
1901
|
arguments: [
|
|
1902
1902
|
e.object("0x06"),
|
|
@@ -1916,7 +1916,7 @@ async function _t(e, n, o) {
|
|
|
1916
1916
|
});
|
|
1917
1917
|
const [U] = e.moveCall({
|
|
1918
1918
|
target: "0x2::coin::from_balance",
|
|
1919
|
-
arguments: [
|
|
1919
|
+
arguments: [V],
|
|
1920
1920
|
typeArguments: [f]
|
|
1921
1921
|
});
|
|
1922
1922
|
if (o?.customCoinReceive.type === "transfer") {
|
|
@@ -1941,7 +1941,7 @@ async function _t(e, n, o) {
|
|
|
1941
1941
|
isEMode: g
|
|
1942
1942
|
});
|
|
1943
1943
|
} else if (o?.accountCap || g) {
|
|
1944
|
-
const
|
|
1944
|
+
const V = e.moveCall({
|
|
1945
1945
|
target: `${l.package}::incentive_v3::claim_reward_with_account_cap`,
|
|
1946
1946
|
arguments: [
|
|
1947
1947
|
e.object("0x06"),
|
|
@@ -1962,7 +1962,7 @@ async function _t(e, n, o) {
|
|
|
1962
1962
|
typeArguments: [f]
|
|
1963
1963
|
}), [U] = e.moveCall({
|
|
1964
1964
|
target: "0x2::coin::from_balance",
|
|
1965
|
-
arguments: [
|
|
1965
|
+
arguments: [V],
|
|
1966
1966
|
typeArguments: [f]
|
|
1967
1967
|
});
|
|
1968
1968
|
e.transferObjects(
|