@ape.swap/bonds-sdk 3.0.81 → 3.0.82
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/main.js +18 -15
- package/dist/types/yourbonds.d.ts +1 -0
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -70109,7 +70109,7 @@ const fetchUserOwnedBillsDataAsync = (chainId, account, bondData, tokenPrices) =
|
|
|
70109
70109
|
});
|
|
70110
70110
|
/* MODIFIED FUNCTION FROM FRONTEND SPECIFICALLY FOR THE SDK */
|
|
70111
70111
|
const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70112
|
-
var _a, _b, _c, _d, _e, _f;
|
|
70112
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
70113
70113
|
// Maps all the bills in the list repo to make a call to each of them to get Bills Id, meaning purchased bill ids
|
|
70114
70114
|
const billIdCalls = bonds.map((b) => {
|
|
70115
70115
|
var _a;
|
|
@@ -70159,16 +70159,18 @@ const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices) => __awaiter$
|
|
|
70159
70159
|
payout: new BigNumber$1((_b = billData[billPos][0]) === null || _b === void 0 ? void 0 : _b.payout.toString())
|
|
70160
70160
|
.minus((_c = billData[billPos][0]) === null || _c === void 0 ? void 0 : _c.payoutClaimed.toString())
|
|
70161
70161
|
.toString(),
|
|
70162
|
+
payoutClaimed: (_d = billData[billPos][0]) === null || _d === void 0 ? void 0 : _d.payoutClaimed.toString(),
|
|
70162
70163
|
billNftAddress: bond.billNnftAddress[bond.chainId],
|
|
70163
|
-
vesting: (
|
|
70164
|
-
lastBlockTimestamp: (
|
|
70165
|
-
truePricePaid: (
|
|
70164
|
+
vesting: (_e = billData[billPos][0]) === null || _e === void 0 ? void 0 : _e.vesting.toString(),
|
|
70165
|
+
lastBlockTimestamp: (_f = billData[billPos][0]) === null || _f === void 0 ? void 0 : _f.lastClaimTimestamp.toString(),
|
|
70166
|
+
truePricePaid: (_g = billData[billPos][0]) === null || _g === void 0 ? void 0 : _g.truePricePaid.toString(),
|
|
70166
70167
|
pendingRewards: billData[billPos + 1][0].toString(),
|
|
70167
70168
|
bond,
|
|
70168
70169
|
}
|
|
70169
70170
|
: {
|
|
70170
70171
|
address: billDataCalls[billPos].address,
|
|
70171
70172
|
id: billDataCalls[billPos].params[0].toString(),
|
|
70173
|
+
payoutClaimed: (_k = (_j = (_h = billData === null || billData === void 0 ? void 0 : billData[billPos]) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.payoutClaimed) === null || _k === void 0 ? void 0 : _k.toString(),
|
|
70172
70174
|
payout: billData[billPos][0].toString(),
|
|
70173
70175
|
billNftAddress: bond.billNnftAddress[bond.chainId],
|
|
70174
70176
|
vesting: billData[billPos][1].toString(),
|
|
@@ -70242,7 +70244,7 @@ const getUserBonds = (account, bondList, chains, tokenPrices, apiUrl) => __await
|
|
|
70242
70244
|
});
|
|
70243
70245
|
|
|
70244
70246
|
const YourBondsModal = ({ onDismiss, bill }) => {
|
|
70245
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20;
|
|
70247
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
|
|
70246
70248
|
// Hooks
|
|
70247
70249
|
const SDKConfig = useSDKConfig();
|
|
70248
70250
|
const chainId = useChainId();
|
|
@@ -70317,9 +70319,8 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
70317
70319
|
return getBalanceNumber(new BigNumber$1((_a = userBill === null || userBill === void 0 ? void 0 : userBill.pendingRewards) !== null && _a !== void 0 ? _a : '0'), (_f = (_d = (_c = (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.earnToken) === null || _c === void 0 ? void 0 : _c.decimals) === null || _d === void 0 ? void 0 : _d[(_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.chainId]) !== null && _f !== void 0 ? _f : 18);
|
|
70318
70320
|
};
|
|
70319
70321
|
const claimed = (userBill) => {
|
|
70320
|
-
var _a, _b, _c, _d, _e, _f
|
|
70321
|
-
return (((_b = (
|
|
70322
|
-
getBalanceNumber(new BigNumber$1((_c = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _c !== void 0 ? _c : '0'), (_h = (_f = (_e = (_d = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _d === void 0 ? void 0 : _d.earnToken) === null || _e === void 0 ? void 0 : _e.decimals) === null || _f === void 0 ? void 0 : _f[(_g = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _g === void 0 ? void 0 : _g.chainId]) !== null && _h !== void 0 ? _h : 18));
|
|
70322
|
+
var _a, _b, _c, _d, _e, _f;
|
|
70323
|
+
return getBalanceNumber(new BigNumber$1((_a = userBill === null || userBill === void 0 ? void 0 : userBill.payoutClaimed) !== null && _a !== void 0 ? _a : '0'), (_f = (_d = (_c = (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.earnToken) === null || _c === void 0 ? void 0 : _c.decimals) === null || _d === void 0 ? void 0 : _d[(_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.chainId]) !== null && _f !== void 0 ? _f : 18);
|
|
70323
70324
|
};
|
|
70324
70325
|
const earnTokenPrice = useCurrencyPrice((_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond.earnToken) !== null && _e !== void 0 ? _e : null, (_g = (_f = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _f === void 0 ? void 0 : _f.chainId) !== null && _g !== void 0 ? _g : null);
|
|
70325
70326
|
const BILL_ATTRIBUTES = ['The Legend', 'The Location', 'The Moment', 'The Trend', 'The Innovation'];
|
|
@@ -70359,32 +70360,34 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
70359
70360
|
? attributes.map((a) => (jsxs(Flex$1, { sx: { background: 'white4', width: '100%', padding: '2px 8px' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: a === null || a === void 0 ? void 0 : a.trait_type }), jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: a === null || a === void 0 ? void 0 : a.value })] }, a.value)))
|
|
70360
70361
|
: BILL_ATTRIBUTES.map((attrib) => {
|
|
70361
70362
|
return (jsxs(Flex$1, { sx: { background: 'white4', width: '100%', padding: '2px 8px' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: attrib }), jsx$2(Skeleton, { width: "150px" })] }, attrib));
|
|
70362
|
-
}) }) })) })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "You Spent" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.YouSpent }), width: "270px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (
|
|
70363
|
+
}) }) })) })] }), ((_t = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _t === void 0 ? void 0 : _t.deposit) && (jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "You Spent" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.YouSpent }), width: "270px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (_v = (_u = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _u === void 0 ? void 0 : _u.lpToken) === null || _v === void 0 ? void 0 : _v.symbol, size: 25, chain: (_w = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _w === void 0 ? void 0 : _w.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: ((_x = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _x === void 0 ? void 0 : _x.deposit)
|
|
70364
|
+
? formatNumberSI((_z = (_y = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _y === void 0 ? void 0 : _y.deposit) === null || _z === void 0 ? void 0 : _z.toFixed(4), 4)
|
|
70365
|
+
: '----' }), jsxs(Text, { sx: {
|
|
70363
70366
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
70364
70367
|
fontWeight: [500, 500, 500, 400],
|
|
70365
70368
|
paddingLeft: '10px',
|
|
70366
|
-
}, children: ["($", (
|
|
70369
|
+
}, children: ["($", (_0 = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _0 === void 0 ? void 0 : _0.dollarValue.toFixed(2), ")"] })] })] })] })), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Fully Vested" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.FullyVested }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon" }), jsx$2(Flex$1, { className: "block-info text", children: jsxs(Flex$1, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: [vestingTimeRemainingString(userBill), isPendingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex$1, { children: ["Bond will be claimable in", ' ', `${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`, "."] }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex$1, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }) })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-pending", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Pending" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Pending }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (_2 = (_1 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _1 === void 0 ? void 0 : _1.showcaseTokenName) !== null && _2 !== void 0 ? _2 : (_4 = (_3 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _3 === void 0 ? void 0 : _3.earnToken) === null || _4 === void 0 ? void 0 : _4.symbol, size: 25, chain: (_5 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _5 === void 0 ? void 0 : _5.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(parseFloat(totalPending(userBill).toFixed(4)), 4) }), jsx$2(Text, { sx: {
|
|
70367
70370
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
70368
70371
|
fontWeight: [500, 500, 500, 400],
|
|
70369
70372
|
paddingLeft: '10px',
|
|
70370
|
-
}, children: `($${(totalPending(userBill) * ((
|
|
70373
|
+
}, children: `($${(totalPending(userBill) * ((_6 = earnTokenPrice === null || earnTokenPrice === void 0 ? void 0 : earnTokenPrice.price) !== null && _6 !== void 0 ? _6 : 0)).toFixed(2)})` })] })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-claimable", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Claimable" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Claimable }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (_8 = (_7 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _7 === void 0 ? void 0 : _7.showcaseTokenName) !== null && _8 !== void 0 ? _8 : (_10 = (_9 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _9 === void 0 ? void 0 : _9.earnToken) === null || _10 === void 0 ? void 0 : _10.symbol, size: 25, chain: (_11 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _11 === void 0 ? void 0 : _11.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(parseFloat(claimable(userBill).toFixed(4)), 4) }), jsx$2(Text, { sx: {
|
|
70371
70374
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
70372
70375
|
fontWeight: [500, 500, 500, 400],
|
|
70373
70376
|
paddingLeft: '10px',
|
|
70374
|
-
}, children: `($${(claimable(userBill) * ((
|
|
70377
|
+
}, children: `($${(claimable(userBill) * ((_12 = earnTokenPrice === null || earnTokenPrice === void 0 ? void 0 : earnTokenPrice.price) !== null && _12 !== void 0 ? _12 : 0)).toFixed(2)})` })] })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Claimed" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Claimed }), width: "250px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (_14 = (_13 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _13 === void 0 ? void 0 : _13.showcaseTokenName) !== null && _14 !== void 0 ? _14 : (_16 = (_15 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _15 === void 0 ? void 0 : _15.earnToken) === null || _16 === void 0 ? void 0 : _16.symbol, size: 25, chain: (_17 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _17 === void 0 ? void 0 : _17.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(parseFloat(claimed(userBill).toFixed(4)), 4) }), jsx$2(Text, { sx: {
|
|
70375
70378
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
70376
70379
|
fontWeight: [500, 500, 500, 400],
|
|
70377
70380
|
paddingLeft: '10px',
|
|
70378
|
-
}, children: `($${(claimed(userBill) * ((
|
|
70381
|
+
}, children: `($${(claimed(userBill) * ((_18 = earnTokenPrice === null || earnTokenPrice === void 0 ? void 0 : earnTokenPrice.price) !== null && _18 !== void 0 ? _18 : 0)).toFixed(2)})` })] })] })] })] }), ((_19 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _19 === void 0 ? void 0 : _19.warningCard) && (jsx$2(Flex$1, { sx: {
|
|
70379
70382
|
width: '100%',
|
|
70380
70383
|
background: '#DE62F366',
|
|
70381
70384
|
justifyContent: 'center',
|
|
70382
70385
|
borderRadius: 'normal',
|
|
70383
|
-
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (
|
|
70386
|
+
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (_20 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _20 === void 0 ? void 0 : _20.warningCard }) }) })), jsxs(Flex$1, { className: "yourbondinfo button-container", children: [jsx$2(Flex$1, { className: "button-container claim", children: userBill && chainId !== (userBill === null || userBill === void 0 ? void 0 : userBill.bond.chainId) ? (jsxs(Button, { className: "switch-button", disabled: claimable(userBill) === 0 || load, onClick: (event) => {
|
|
70384
70387
|
var _a;
|
|
70385
70388
|
event.stopPropagation();
|
|
70386
70389
|
switchChain({ chainId: (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId });
|
|
70387
|
-
}, children: ["Switch to ", NETWORK_LABEL[(
|
|
70390
|
+
}, children: ["Switch to ", NETWORK_LABEL[(_21 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _21 === void 0 ? void 0 : _21.chainId]] })) : (jsx$2(Button, { className: "claim-button", disabled: claimable(userBill) === 0 || load || !userBill || isPendingCliff, load: load, onClick: (event) => {
|
|
70388
70391
|
event.stopPropagation();
|
|
70389
70392
|
handleClaim(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.address);
|
|
70390
70393
|
}, children: isPendingCliff
|