@ape.swap/bonds-sdk 4.1.1-test.8 → 4.1.1-test.9
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 +1777 -1774
- package/dist/styles.css +0 -341
- package/dist/views/YourBondsModal/components/Actions/Actions.d.ts +6 -0
- package/dist/views/YourBondsModal/components/Actions/ActionsSolana.d.ts +6 -0
- package/dist/views/YourBondsModal/components/NFTImage/NFTImage.d.ts +8 -0
- package/dist/views/YourBondsModal/components/YourBondModalHeader/YourBondModalHeader.d.ts +7 -0
- package/package.json +1 -1
- package/dist/views/YourBondsModal/YourBondsModalSolana.d.ts +0 -7
- package/dist/views/YourBondsModal/components/Recommendations/CardRecommendationsMobile.d.ts +0 -6
package/dist/main.js
CHANGED
|
@@ -7091,7 +7091,7 @@ const styles$i = {
|
|
|
7091
7091
|
overflow: 'hidden',
|
|
7092
7092
|
transform: 'translate3d(0, 0, 0)',
|
|
7093
7093
|
borderRadius: '',
|
|
7094
|
-
minHeight: '
|
|
7094
|
+
minHeight: '16px',
|
|
7095
7095
|
display: 'block',
|
|
7096
7096
|
backgroundColor: 'white2',
|
|
7097
7097
|
'&:before': {
|
|
@@ -63994,20 +63994,6 @@ const vestingTimeRemaining = (userBill) => {
|
|
|
63994
63994
|
const vestingCliff = (_b = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.vestingCliff) !== null && _b !== void 0 ? _b : 0;
|
|
63995
63995
|
return getTimePeriods(parseInt(userBill.lastBlockTimestamp) + parseInt(userBill.vesting) - vestingCliff - currentTime, true);
|
|
63996
63996
|
};
|
|
63997
|
-
const vestingTimeRemainingString = (userBill) => {
|
|
63998
|
-
var _a, _b, _c;
|
|
63999
|
-
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
64000
|
-
const lastBlockTimestamp = parseInt((_a = userBill === null || userBill === void 0 ? void 0 : userBill.lastBlockTimestamp) !== null && _a !== void 0 ? _a : '0');
|
|
64001
|
-
const vesting = parseInt((_b = userBill === null || userBill === void 0 ? void 0 : userBill.vesting) !== null && _b !== void 0 ? _b : '0');
|
|
64002
|
-
const vestingCliff = (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.vestingCliff;
|
|
64003
|
-
const vestingTime = getTimePeriods(lastBlockTimestamp + vesting - currentTime, true);
|
|
64004
|
-
if (vestingCliff && currentTime - lastBlockTimestamp < vestingCliff) {
|
|
64005
|
-
const linearVesting = getTimePeriods(vesting - vestingCliff, true);
|
|
64006
|
-
const cliffCountdown = getTimePeriods(lastBlockTimestamp + vestingCliff - currentTime, true);
|
|
64007
|
-
return `${cliffCountdown.days !== 0 ? `${cliffCountdown.days}d` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours}hs` : `${cliffCountdown.minutes}mins`} + ${linearVesting.days}d`;
|
|
64008
|
-
}
|
|
64009
|
-
return `${vestingTime.days}d, ${vestingTime.hours}h, ${vestingTime.minutes}m`;
|
|
64010
|
-
};
|
|
64011
63997
|
const getPercentageVested = (bond) => {
|
|
64012
63998
|
var _a;
|
|
64013
63999
|
const vestingTerm = parseInt((_a = bond === null || bond === void 0 ? void 0 : bond.vesting) !== null && _a !== void 0 ? _a : '0');
|
|
@@ -66295,9 +66281,22 @@ const APEBOND = `https://ape.bond`;
|
|
|
66295
66281
|
|
|
66296
66282
|
const TokenImage = ({ symbol, symbol2, size, chain, }) => {
|
|
66297
66283
|
var _a, _b;
|
|
66284
|
+
const [error, setError] = useState(false);
|
|
66298
66285
|
const token1 = symbol === 'USDC.e' ? 'USDC' : symbol;
|
|
66299
66286
|
const token2 = symbol2 === 'USDC.e' ? 'USDC' : symbol2;
|
|
66300
|
-
return
|
|
66287
|
+
return error || !token1 ? (jsx$2(Flex, { sx: {
|
|
66288
|
+
width: size - 2,
|
|
66289
|
+
height: size - 2,
|
|
66290
|
+
justifyContent: 'center',
|
|
66291
|
+
alignItems: 'center',
|
|
66292
|
+
borderRadius: '55px',
|
|
66293
|
+
position: 'relative',
|
|
66294
|
+
}, children: jsx$2(Skeleton, { animation: "waves", sx: {
|
|
66295
|
+
width: size - 2,
|
|
66296
|
+
height: size - 2,
|
|
66297
|
+
borderRadius: '55px',
|
|
66298
|
+
mb: '5px',
|
|
66299
|
+
} }) })) : token2 ? (jsxs(Flex, { sx: {
|
|
66301
66300
|
minWidth: size * 1.5 - 2,
|
|
66302
66301
|
height: size - 2,
|
|
66303
66302
|
justifyContent: 'center',
|
|
@@ -66318,7 +66317,7 @@ const TokenImage = ({ symbol, symbol2, size, chain, }) => {
|
|
|
66318
66317
|
alignItems: 'center',
|
|
66319
66318
|
borderRadius: '55px',
|
|
66320
66319
|
position: 'relative',
|
|
66321
|
-
}, children: [jsx$2("img", { src: `${APEBOND}/tokenImages/${token1 === null || token1 === void 0 ? void 0 : token1.toUpperCase()}.png`, alt: `tokenImgFor:${token1}`, width: size, height: token1 === 'BNB-ICHI' ? 19 : size }), chain && (jsx$2(Flex, { sx: {
|
|
66320
|
+
}, children: [jsx$2("img", { src: `${APEBOND}/tokenImages/${token1 === null || token1 === void 0 ? void 0 : token1.toUpperCase()}.png`, alt: `tokenImgFor:${token1}`, width: size, height: token1 === 'BNB-ICHI' ? 19 : size, onError: () => setError(true) }), chain && (jsx$2(Flex, { sx: {
|
|
66322
66321
|
zIndex: 5,
|
|
66323
66322
|
position: 'absolute',
|
|
66324
66323
|
top: '-2px',
|
|
@@ -67915,7 +67914,7 @@ const ClaimAll = () => {
|
|
|
67915
67914
|
|
|
67916
67915
|
const YourBondsMenu = ({ chainFilterOption, setChainFilterOption, filterOptions, filterOption, setFilterOption, setInputValue, inputValue, handleSort, }) => {
|
|
67917
67916
|
const SDKConfig = useSDKConfig();
|
|
67918
|
-
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setInputValue('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsx$2(Flex$1, { sx: { width: '100%', maxWidth: '300px' }, children: jsx$2(Input, { className: "search-input", value: inputValue, onChange: (event) => setInputValue(event.target.value), variant: "search", sx: { fontWeight: 600, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }) }), jsxs("div", { className: "headers-container", sx: { pr: ['0', '0', '0', '20px'] }, children: [jsx$2(Flex$1, { sx: { display: ['none', 'none', 'none', '
|
|
67917
|
+
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setInputValue('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsx$2(Flex$1, { sx: { width: '100%', maxWidth: '300px' }, children: jsx$2(Input, { className: "search-input", value: inputValue, onChange: (event) => setInputValue(event.target.value), variant: "search", sx: { fontWeight: 600, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }) }), jsxs("div", { className: "headers-container", sx: { pr: ['0', '0', '0', '20px'] }, children: [jsx$2(Flex$1, { sx: { display: ['none', 'none', 'none', 'flex'], width: '125px' } }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('claimable'), children: ["CLAIMABLE", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('pending'), children: ["PENDING", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('terms'), children: ["VESTING PROGRESS", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2(Flex$1, { className: "claim-all-button-container", children: SDKConfig.referenceId === 'apebond' && jsx$2(ClaimAll, {}) })] })] })] }));
|
|
67919
67918
|
};
|
|
67920
67919
|
|
|
67921
67920
|
const colors$1 = {
|
|
@@ -68166,1159 +68165,32 @@ const UserBillTooltipText = {
|
|
|
68166
68165
|
FullyVested: 'This is the time remaining until all tokens from the bond are available to claim.',
|
|
68167
68166
|
Pending: 'This is the amount of unvested tokens that cannot be claimed yet.',
|
|
68168
68167
|
Claimable: 'This is the amount of tokens that have vested and are available to claim.',
|
|
68169
|
-
YouSpent: 'This is the dollar amount you spent on the bond at the time of purchase.',
|
|
68170
68168
|
Claimed: 'This is the amount of tokens that you have already claimed.',
|
|
68171
68169
|
};
|
|
68172
68170
|
|
|
68173
|
-
|
|
68174
|
-
|
|
68175
|
-
|
|
68176
|
-
|
|
68177
|
-
|
|
68178
|
-
|
|
68179
|
-
|
|
68180
|
-
|
|
68181
|
-
|
|
68182
|
-
|
|
68183
|
-
|
|
68184
|
-
|
|
68185
|
-
|
|
68186
|
-
|
|
68187
|
-
|
|
68188
|
-
},
|
|
68189
|
-
{
|
|
68190
|
-
indexed: true,
|
|
68191
|
-
internalType: "uint256",
|
|
68192
|
-
name: "tokenId",
|
|
68193
|
-
type: "uint256"
|
|
68194
|
-
}
|
|
68195
|
-
],
|
|
68196
|
-
name: "Approval",
|
|
68197
|
-
type: "event"
|
|
68198
|
-
},
|
|
68199
|
-
{
|
|
68200
|
-
anonymous: false,
|
|
68201
|
-
inputs: [
|
|
68202
|
-
{
|
|
68203
|
-
indexed: true,
|
|
68204
|
-
internalType: "address",
|
|
68205
|
-
name: "owner",
|
|
68206
|
-
type: "address"
|
|
68207
|
-
},
|
|
68208
|
-
{
|
|
68209
|
-
indexed: true,
|
|
68210
|
-
internalType: "address",
|
|
68211
|
-
name: "operator",
|
|
68212
|
-
type: "address"
|
|
68213
|
-
},
|
|
68214
|
-
{
|
|
68215
|
-
indexed: false,
|
|
68216
|
-
internalType: "bool",
|
|
68217
|
-
name: "approved",
|
|
68218
|
-
type: "bool"
|
|
68219
|
-
}
|
|
68220
|
-
],
|
|
68221
|
-
name: "ApprovalForAll",
|
|
68222
|
-
type: "event"
|
|
68223
|
-
},
|
|
68224
|
-
{
|
|
68225
|
-
anonymous: false,
|
|
68226
|
-
inputs: [
|
|
68227
|
-
{
|
|
68228
|
-
indexed: false,
|
|
68229
|
-
internalType: "string",
|
|
68230
|
-
name: "newUri",
|
|
68231
|
-
type: "string"
|
|
68232
|
-
}
|
|
68233
|
-
],
|
|
68234
|
-
name: "BaseTokenUriChanged",
|
|
68235
|
-
type: "event"
|
|
68236
|
-
},
|
|
68237
|
-
{
|
|
68238
|
-
anonymous: false,
|
|
68239
|
-
inputs: [
|
|
68240
|
-
{
|
|
68241
|
-
indexed: true,
|
|
68242
|
-
internalType: "bytes32",
|
|
68243
|
-
name: "role",
|
|
68244
|
-
type: "bytes32"
|
|
68245
|
-
},
|
|
68246
|
-
{
|
|
68247
|
-
indexed: true,
|
|
68248
|
-
internalType: "bytes32",
|
|
68249
|
-
name: "previousAdminRole",
|
|
68250
|
-
type: "bytes32"
|
|
68251
|
-
},
|
|
68252
|
-
{
|
|
68253
|
-
indexed: true,
|
|
68254
|
-
internalType: "bytes32",
|
|
68255
|
-
name: "newAdminRole",
|
|
68256
|
-
type: "bytes32"
|
|
68257
|
-
}
|
|
68258
|
-
],
|
|
68259
|
-
name: "RoleAdminChanged",
|
|
68260
|
-
type: "event"
|
|
68261
|
-
},
|
|
68262
|
-
{
|
|
68263
|
-
anonymous: false,
|
|
68264
|
-
inputs: [
|
|
68265
|
-
{
|
|
68266
|
-
indexed: true,
|
|
68267
|
-
internalType: "bytes32",
|
|
68268
|
-
name: "role",
|
|
68269
|
-
type: "bytes32"
|
|
68270
|
-
},
|
|
68271
|
-
{
|
|
68272
|
-
indexed: true,
|
|
68273
|
-
internalType: "address",
|
|
68274
|
-
name: "account",
|
|
68275
|
-
type: "address"
|
|
68276
|
-
},
|
|
68277
|
-
{
|
|
68278
|
-
indexed: true,
|
|
68279
|
-
internalType: "address",
|
|
68280
|
-
name: "sender",
|
|
68281
|
-
type: "address"
|
|
68282
|
-
}
|
|
68283
|
-
],
|
|
68284
|
-
name: "RoleGranted",
|
|
68285
|
-
type: "event"
|
|
68286
|
-
},
|
|
68287
|
-
{
|
|
68288
|
-
anonymous: false,
|
|
68289
|
-
inputs: [
|
|
68290
|
-
{
|
|
68291
|
-
indexed: true,
|
|
68292
|
-
internalType: "bytes32",
|
|
68293
|
-
name: "role",
|
|
68294
|
-
type: "bytes32"
|
|
68295
|
-
},
|
|
68296
|
-
{
|
|
68297
|
-
indexed: true,
|
|
68298
|
-
internalType: "address",
|
|
68299
|
-
name: "account",
|
|
68300
|
-
type: "address"
|
|
68301
|
-
},
|
|
68302
|
-
{
|
|
68303
|
-
indexed: true,
|
|
68304
|
-
internalType: "address",
|
|
68305
|
-
name: "sender",
|
|
68306
|
-
type: "address"
|
|
68307
|
-
}
|
|
68308
|
-
],
|
|
68309
|
-
name: "RoleRevoked",
|
|
68310
|
-
type: "event"
|
|
68311
|
-
},
|
|
68312
|
-
{
|
|
68313
|
-
anonymous: false,
|
|
68314
|
-
inputs: [
|
|
68315
|
-
{
|
|
68316
|
-
indexed: true,
|
|
68317
|
-
internalType: "address",
|
|
68318
|
-
name: "from",
|
|
68319
|
-
type: "address"
|
|
68320
|
-
},
|
|
68321
|
-
{
|
|
68322
|
-
indexed: true,
|
|
68323
|
-
internalType: "address",
|
|
68324
|
-
name: "to",
|
|
68325
|
-
type: "address"
|
|
68326
|
-
},
|
|
68327
|
-
{
|
|
68328
|
-
indexed: true,
|
|
68329
|
-
internalType: "uint256",
|
|
68330
|
-
name: "tokenId",
|
|
68331
|
-
type: "uint256"
|
|
68332
|
-
}
|
|
68333
|
-
],
|
|
68334
|
-
name: "Transfer",
|
|
68335
|
-
type: "event"
|
|
68336
|
-
},
|
|
68337
|
-
{
|
|
68338
|
-
anonymous: false,
|
|
68339
|
-
inputs: [
|
|
68340
|
-
{
|
|
68341
|
-
indexed: false,
|
|
68342
|
-
internalType: "bool",
|
|
68343
|
-
name: "locked",
|
|
68344
|
-
type: "bool"
|
|
68345
|
-
}
|
|
68346
|
-
],
|
|
68347
|
-
name: "UriLocked",
|
|
68348
|
-
type: "event"
|
|
68349
|
-
},
|
|
68350
|
-
{
|
|
68351
|
-
inputs: [
|
|
68352
|
-
],
|
|
68353
|
-
name: "DEFAULT_ADMIN_ROLE",
|
|
68354
|
-
outputs: [
|
|
68355
|
-
{
|
|
68356
|
-
internalType: "bytes32",
|
|
68357
|
-
name: "",
|
|
68358
|
-
type: "bytes32"
|
|
68359
|
-
}
|
|
68360
|
-
],
|
|
68361
|
-
stateMutability: "view",
|
|
68362
|
-
type: "function"
|
|
68363
|
-
},
|
|
68364
|
-
{
|
|
68365
|
-
inputs: [
|
|
68366
|
-
],
|
|
68367
|
-
name: "FACTORY_ROLE",
|
|
68368
|
-
outputs: [
|
|
68369
|
-
{
|
|
68370
|
-
internalType: "bytes32",
|
|
68371
|
-
name: "",
|
|
68372
|
-
type: "bytes32"
|
|
68373
|
-
}
|
|
68374
|
-
],
|
|
68375
|
-
stateMutability: "view",
|
|
68376
|
-
type: "function"
|
|
68377
|
-
},
|
|
68378
|
-
{
|
|
68379
|
-
inputs: [
|
|
68380
|
-
],
|
|
68381
|
-
name: "MINTER_ROLE",
|
|
68382
|
-
outputs: [
|
|
68383
|
-
{
|
|
68384
|
-
internalType: "bytes32",
|
|
68385
|
-
name: "",
|
|
68386
|
-
type: "bytes32"
|
|
68387
|
-
}
|
|
68388
|
-
],
|
|
68389
|
-
stateMutability: "view",
|
|
68390
|
-
type: "function"
|
|
68391
|
-
},
|
|
68392
|
-
{
|
|
68393
|
-
inputs: [
|
|
68394
|
-
],
|
|
68395
|
-
name: "URI_SETTER_ROLE",
|
|
68396
|
-
outputs: [
|
|
68397
|
-
{
|
|
68398
|
-
internalType: "bytes32",
|
|
68399
|
-
name: "",
|
|
68400
|
-
type: "bytes32"
|
|
68401
|
-
}
|
|
68402
|
-
],
|
|
68403
|
-
stateMutability: "view",
|
|
68404
|
-
type: "function"
|
|
68405
|
-
},
|
|
68406
|
-
{
|
|
68407
|
-
inputs: [
|
|
68408
|
-
{
|
|
68409
|
-
internalType: "address",
|
|
68410
|
-
name: "minter",
|
|
68411
|
-
type: "address"
|
|
68412
|
-
}
|
|
68413
|
-
],
|
|
68414
|
-
name: "addMinter",
|
|
68415
|
-
outputs: [
|
|
68416
|
-
],
|
|
68417
|
-
stateMutability: "nonpayable",
|
|
68418
|
-
type: "function"
|
|
68419
|
-
},
|
|
68420
|
-
{
|
|
68421
|
-
inputs: [
|
|
68422
|
-
{
|
|
68423
|
-
internalType: "address",
|
|
68424
|
-
name: "owner",
|
|
68425
|
-
type: "address"
|
|
68426
|
-
}
|
|
68427
|
-
],
|
|
68428
|
-
name: "allTokensDataOfOwner",
|
|
68429
|
-
outputs: [
|
|
68430
|
-
{
|
|
68431
|
-
components: [
|
|
68432
|
-
{
|
|
68433
|
-
internalType: "uint256",
|
|
68434
|
-
name: "tokenId",
|
|
68435
|
-
type: "uint256"
|
|
68436
|
-
},
|
|
68437
|
-
{
|
|
68438
|
-
internalType: "address",
|
|
68439
|
-
name: "billAddress",
|
|
68440
|
-
type: "address"
|
|
68441
|
-
}
|
|
68442
|
-
],
|
|
68443
|
-
internalType: "struct BillNft.TokenData[]",
|
|
68444
|
-
name: "",
|
|
68445
|
-
type: "tuple[]"
|
|
68446
|
-
}
|
|
68447
|
-
],
|
|
68448
|
-
stateMutability: "view",
|
|
68449
|
-
type: "function"
|
|
68450
|
-
},
|
|
68451
|
-
{
|
|
68452
|
-
inputs: [
|
|
68453
|
-
{
|
|
68454
|
-
internalType: "address",
|
|
68455
|
-
name: "to",
|
|
68456
|
-
type: "address"
|
|
68457
|
-
},
|
|
68458
|
-
{
|
|
68459
|
-
internalType: "uint256",
|
|
68460
|
-
name: "tokenId",
|
|
68461
|
-
type: "uint256"
|
|
68462
|
-
}
|
|
68463
|
-
],
|
|
68464
|
-
name: "approve",
|
|
68465
|
-
outputs: [
|
|
68466
|
-
],
|
|
68467
|
-
stateMutability: "nonpayable",
|
|
68468
|
-
type: "function"
|
|
68469
|
-
},
|
|
68470
|
-
{
|
|
68471
|
-
inputs: [
|
|
68472
|
-
{
|
|
68473
|
-
internalType: "address",
|
|
68474
|
-
name: "owner",
|
|
68475
|
-
type: "address"
|
|
68476
|
-
}
|
|
68477
|
-
],
|
|
68478
|
-
name: "balanceOf",
|
|
68479
|
-
outputs: [
|
|
68480
|
-
{
|
|
68481
|
-
internalType: "uint256",
|
|
68482
|
-
name: "",
|
|
68483
|
-
type: "uint256"
|
|
68484
|
-
}
|
|
68485
|
-
],
|
|
68486
|
-
stateMutability: "view",
|
|
68487
|
-
type: "function"
|
|
68488
|
-
},
|
|
68489
|
-
{
|
|
68490
|
-
inputs: [
|
|
68491
|
-
{
|
|
68492
|
-
internalType: "uint256",
|
|
68493
|
-
name: "",
|
|
68494
|
-
type: "uint256"
|
|
68495
|
-
}
|
|
68496
|
-
],
|
|
68497
|
-
name: "billAddresses",
|
|
68498
|
-
outputs: [
|
|
68499
|
-
{
|
|
68500
|
-
internalType: "address",
|
|
68501
|
-
name: "",
|
|
68502
|
-
type: "address"
|
|
68503
|
-
}
|
|
68504
|
-
],
|
|
68505
|
-
stateMutability: "view",
|
|
68506
|
-
type: "function"
|
|
68507
|
-
},
|
|
68508
|
-
{
|
|
68509
|
-
inputs: [
|
|
68510
|
-
{
|
|
68511
|
-
internalType: "uint256",
|
|
68512
|
-
name: "tokenId",
|
|
68513
|
-
type: "uint256"
|
|
68514
|
-
}
|
|
68515
|
-
],
|
|
68516
|
-
name: "getApproved",
|
|
68517
|
-
outputs: [
|
|
68518
|
-
{
|
|
68519
|
-
internalType: "address",
|
|
68520
|
-
name: "",
|
|
68521
|
-
type: "address"
|
|
68522
|
-
}
|
|
68523
|
-
],
|
|
68524
|
-
stateMutability: "view",
|
|
68525
|
-
type: "function"
|
|
68526
|
-
},
|
|
68527
|
-
{
|
|
68528
|
-
inputs: [
|
|
68529
|
-
{
|
|
68530
|
-
internalType: "bytes32",
|
|
68531
|
-
name: "role",
|
|
68532
|
-
type: "bytes32"
|
|
68533
|
-
}
|
|
68534
|
-
],
|
|
68535
|
-
name: "getRoleAdmin",
|
|
68536
|
-
outputs: [
|
|
68537
|
-
{
|
|
68538
|
-
internalType: "bytes32",
|
|
68539
|
-
name: "",
|
|
68540
|
-
type: "bytes32"
|
|
68541
|
-
}
|
|
68542
|
-
],
|
|
68543
|
-
stateMutability: "view",
|
|
68544
|
-
type: "function"
|
|
68545
|
-
},
|
|
68546
|
-
{
|
|
68547
|
-
inputs: [
|
|
68548
|
-
{
|
|
68549
|
-
internalType: "bytes32",
|
|
68550
|
-
name: "role",
|
|
68551
|
-
type: "bytes32"
|
|
68552
|
-
},
|
|
68553
|
-
{
|
|
68554
|
-
internalType: "uint256",
|
|
68555
|
-
name: "index",
|
|
68556
|
-
type: "uint256"
|
|
68557
|
-
}
|
|
68558
|
-
],
|
|
68559
|
-
name: "getRoleMember",
|
|
68560
|
-
outputs: [
|
|
68561
|
-
{
|
|
68562
|
-
internalType: "address",
|
|
68563
|
-
name: "",
|
|
68564
|
-
type: "address"
|
|
68565
|
-
}
|
|
68566
|
-
],
|
|
68567
|
-
stateMutability: "view",
|
|
68568
|
-
type: "function"
|
|
68569
|
-
},
|
|
68570
|
-
{
|
|
68571
|
-
inputs: [
|
|
68572
|
-
{
|
|
68573
|
-
internalType: "bytes32",
|
|
68574
|
-
name: "role",
|
|
68575
|
-
type: "bytes32"
|
|
68576
|
-
}
|
|
68577
|
-
],
|
|
68578
|
-
name: "getRoleMemberCount",
|
|
68579
|
-
outputs: [
|
|
68580
|
-
{
|
|
68581
|
-
internalType: "uint256",
|
|
68582
|
-
name: "",
|
|
68583
|
-
type: "uint256"
|
|
68584
|
-
}
|
|
68585
|
-
],
|
|
68586
|
-
stateMutability: "view",
|
|
68587
|
-
type: "function"
|
|
68588
|
-
},
|
|
68589
|
-
{
|
|
68590
|
-
inputs: [
|
|
68591
|
-
{
|
|
68592
|
-
internalType: "address",
|
|
68593
|
-
name: "owner",
|
|
68594
|
-
type: "address"
|
|
68595
|
-
},
|
|
68596
|
-
{
|
|
68597
|
-
internalType: "uint256",
|
|
68598
|
-
name: "start",
|
|
68599
|
-
type: "uint256"
|
|
68600
|
-
},
|
|
68601
|
-
{
|
|
68602
|
-
internalType: "uint256",
|
|
68603
|
-
name: "end",
|
|
68604
|
-
type: "uint256"
|
|
68605
|
-
}
|
|
68606
|
-
],
|
|
68607
|
-
name: "getTokensOfOwnerByIndexes",
|
|
68608
|
-
outputs: [
|
|
68609
|
-
{
|
|
68610
|
-
components: [
|
|
68611
|
-
{
|
|
68612
|
-
internalType: "uint256",
|
|
68613
|
-
name: "tokenId",
|
|
68614
|
-
type: "uint256"
|
|
68615
|
-
},
|
|
68616
|
-
{
|
|
68617
|
-
internalType: "address",
|
|
68618
|
-
name: "billAddress",
|
|
68619
|
-
type: "address"
|
|
68620
|
-
}
|
|
68621
|
-
],
|
|
68622
|
-
internalType: "struct BillNft.TokenData[]",
|
|
68623
|
-
name: "",
|
|
68624
|
-
type: "tuple[]"
|
|
68625
|
-
}
|
|
68626
|
-
],
|
|
68627
|
-
stateMutability: "view",
|
|
68628
|
-
type: "function"
|
|
68629
|
-
},
|
|
68630
|
-
{
|
|
68631
|
-
inputs: [
|
|
68632
|
-
{
|
|
68633
|
-
internalType: "bytes32",
|
|
68634
|
-
name: "role",
|
|
68635
|
-
type: "bytes32"
|
|
68636
|
-
},
|
|
68637
|
-
{
|
|
68638
|
-
internalType: "address",
|
|
68639
|
-
name: "account",
|
|
68640
|
-
type: "address"
|
|
68641
|
-
}
|
|
68642
|
-
],
|
|
68643
|
-
name: "grantRole",
|
|
68644
|
-
outputs: [
|
|
68645
|
-
],
|
|
68646
|
-
stateMutability: "nonpayable",
|
|
68647
|
-
type: "function"
|
|
68648
|
-
},
|
|
68649
|
-
{
|
|
68650
|
-
inputs: [
|
|
68651
|
-
{
|
|
68652
|
-
internalType: "bytes32",
|
|
68653
|
-
name: "role",
|
|
68654
|
-
type: "bytes32"
|
|
68655
|
-
},
|
|
68656
|
-
{
|
|
68657
|
-
internalType: "address",
|
|
68658
|
-
name: "account",
|
|
68659
|
-
type: "address"
|
|
68660
|
-
}
|
|
68661
|
-
],
|
|
68662
|
-
name: "hasRole",
|
|
68663
|
-
outputs: [
|
|
68664
|
-
{
|
|
68665
|
-
internalType: "bool",
|
|
68666
|
-
name: "",
|
|
68667
|
-
type: "bool"
|
|
68668
|
-
}
|
|
68669
|
-
],
|
|
68670
|
-
stateMutability: "view",
|
|
68671
|
-
type: "function"
|
|
68672
|
-
},
|
|
68673
|
-
{
|
|
68674
|
-
inputs: [
|
|
68675
|
-
{
|
|
68676
|
-
internalType: "string",
|
|
68677
|
-
name: "name",
|
|
68678
|
-
type: "string"
|
|
68679
|
-
},
|
|
68680
|
-
{
|
|
68681
|
-
internalType: "string",
|
|
68682
|
-
name: "symbol",
|
|
68683
|
-
type: "string"
|
|
68684
|
-
},
|
|
68685
|
-
{
|
|
68686
|
-
internalType: "string",
|
|
68687
|
-
name: "baseTokenURI",
|
|
68688
|
-
type: "string"
|
|
68689
|
-
},
|
|
68690
|
-
{
|
|
68691
|
-
internalType: "address",
|
|
68692
|
-
name: "factory",
|
|
68693
|
-
type: "address"
|
|
68694
|
-
},
|
|
68695
|
-
{
|
|
68696
|
-
internalType: "address",
|
|
68697
|
-
name: "owner",
|
|
68698
|
-
type: "address"
|
|
68699
|
-
}
|
|
68700
|
-
],
|
|
68701
|
-
name: "initialize",
|
|
68702
|
-
outputs: [
|
|
68703
|
-
],
|
|
68704
|
-
stateMutability: "nonpayable",
|
|
68705
|
-
type: "function"
|
|
68706
|
-
},
|
|
68707
|
-
{
|
|
68708
|
-
inputs: [
|
|
68709
|
-
{
|
|
68710
|
-
internalType: "address",
|
|
68711
|
-
name: "owner",
|
|
68712
|
-
type: "address"
|
|
68713
|
-
},
|
|
68714
|
-
{
|
|
68715
|
-
internalType: "address",
|
|
68716
|
-
name: "operator",
|
|
68717
|
-
type: "address"
|
|
68718
|
-
}
|
|
68719
|
-
],
|
|
68720
|
-
name: "isApprovedForAll",
|
|
68721
|
-
outputs: [
|
|
68722
|
-
{
|
|
68723
|
-
internalType: "bool",
|
|
68724
|
-
name: "",
|
|
68725
|
-
type: "bool"
|
|
68726
|
-
}
|
|
68727
|
-
],
|
|
68728
|
-
stateMutability: "view",
|
|
68729
|
-
type: "function"
|
|
68730
|
-
},
|
|
68731
|
-
{
|
|
68732
|
-
inputs: [
|
|
68733
|
-
],
|
|
68734
|
-
name: "lockURI",
|
|
68735
|
-
outputs: [
|
|
68736
|
-
],
|
|
68737
|
-
stateMutability: "nonpayable",
|
|
68738
|
-
type: "function"
|
|
68739
|
-
},
|
|
68740
|
-
{
|
|
68741
|
-
inputs: [
|
|
68742
|
-
{
|
|
68743
|
-
internalType: "address",
|
|
68744
|
-
name: "to",
|
|
68745
|
-
type: "address"
|
|
68746
|
-
},
|
|
68747
|
-
{
|
|
68748
|
-
internalType: "address",
|
|
68749
|
-
name: "billAddress",
|
|
68750
|
-
type: "address"
|
|
68751
|
-
}
|
|
68752
|
-
],
|
|
68753
|
-
name: "mint",
|
|
68754
|
-
outputs: [
|
|
68755
|
-
{
|
|
68756
|
-
internalType: "uint256",
|
|
68757
|
-
name: "newTokenId",
|
|
68758
|
-
type: "uint256"
|
|
68759
|
-
}
|
|
68760
|
-
],
|
|
68761
|
-
stateMutability: "nonpayable",
|
|
68762
|
-
type: "function"
|
|
68763
|
-
},
|
|
68764
|
-
{
|
|
68765
|
-
inputs: [
|
|
68766
|
-
{
|
|
68767
|
-
internalType: "uint256",
|
|
68768
|
-
name: "amount",
|
|
68769
|
-
type: "uint256"
|
|
68770
|
-
},
|
|
68771
|
-
{
|
|
68772
|
-
internalType: "address",
|
|
68773
|
-
name: "to",
|
|
68774
|
-
type: "address"
|
|
68775
|
-
},
|
|
68776
|
-
{
|
|
68777
|
-
internalType: "address",
|
|
68778
|
-
name: "billAddress",
|
|
68779
|
-
type: "address"
|
|
68780
|
-
}
|
|
68781
|
-
],
|
|
68782
|
-
name: "mintMany",
|
|
68783
|
-
outputs: [
|
|
68784
|
-
],
|
|
68785
|
-
stateMutability: "nonpayable",
|
|
68786
|
-
type: "function"
|
|
68787
|
-
},
|
|
68788
|
-
{
|
|
68789
|
-
inputs: [
|
|
68790
|
-
],
|
|
68791
|
-
name: "name",
|
|
68792
|
-
outputs: [
|
|
68793
|
-
{
|
|
68794
|
-
internalType: "string",
|
|
68795
|
-
name: "",
|
|
68796
|
-
type: "string"
|
|
68797
|
-
}
|
|
68798
|
-
],
|
|
68799
|
-
stateMutability: "view",
|
|
68800
|
-
type: "function"
|
|
68801
|
-
},
|
|
68802
|
-
{
|
|
68803
|
-
inputs: [
|
|
68804
|
-
{
|
|
68805
|
-
internalType: "uint256",
|
|
68806
|
-
name: "tokenId",
|
|
68807
|
-
type: "uint256"
|
|
68808
|
-
}
|
|
68809
|
-
],
|
|
68810
|
-
name: "ownerOf",
|
|
68811
|
-
outputs: [
|
|
68812
|
-
{
|
|
68813
|
-
internalType: "address",
|
|
68814
|
-
name: "",
|
|
68815
|
-
type: "address"
|
|
68816
|
-
}
|
|
68817
|
-
],
|
|
68818
|
-
stateMutability: "view",
|
|
68819
|
-
type: "function"
|
|
68820
|
-
},
|
|
68821
|
-
{
|
|
68822
|
-
inputs: [
|
|
68823
|
-
{
|
|
68824
|
-
internalType: "bytes32",
|
|
68825
|
-
name: "role",
|
|
68826
|
-
type: "bytes32"
|
|
68827
|
-
},
|
|
68828
|
-
{
|
|
68829
|
-
internalType: "address",
|
|
68830
|
-
name: "account",
|
|
68831
|
-
type: "address"
|
|
68832
|
-
}
|
|
68833
|
-
],
|
|
68834
|
-
name: "renounceRole",
|
|
68835
|
-
outputs: [
|
|
68836
|
-
],
|
|
68837
|
-
stateMutability: "nonpayable",
|
|
68838
|
-
type: "function"
|
|
68839
|
-
},
|
|
68840
|
-
{
|
|
68841
|
-
inputs: [
|
|
68842
|
-
{
|
|
68843
|
-
internalType: "bytes32",
|
|
68844
|
-
name: "role",
|
|
68845
|
-
type: "bytes32"
|
|
68846
|
-
},
|
|
68847
|
-
{
|
|
68848
|
-
internalType: "address",
|
|
68849
|
-
name: "account",
|
|
68850
|
-
type: "address"
|
|
68851
|
-
}
|
|
68852
|
-
],
|
|
68853
|
-
name: "revokeRole",
|
|
68854
|
-
outputs: [
|
|
68855
|
-
],
|
|
68856
|
-
stateMutability: "nonpayable",
|
|
68857
|
-
type: "function"
|
|
68858
|
-
},
|
|
68859
|
-
{
|
|
68860
|
-
inputs: [
|
|
68861
|
-
{
|
|
68862
|
-
internalType: "address",
|
|
68863
|
-
name: "from",
|
|
68864
|
-
type: "address"
|
|
68865
|
-
},
|
|
68866
|
-
{
|
|
68867
|
-
internalType: "address",
|
|
68868
|
-
name: "to",
|
|
68869
|
-
type: "address"
|
|
68870
|
-
},
|
|
68871
|
-
{
|
|
68872
|
-
internalType: "uint256",
|
|
68873
|
-
name: "tokenId",
|
|
68874
|
-
type: "uint256"
|
|
68875
|
-
}
|
|
68876
|
-
],
|
|
68877
|
-
name: "safeTransferFrom",
|
|
68878
|
-
outputs: [
|
|
68879
|
-
],
|
|
68880
|
-
stateMutability: "nonpayable",
|
|
68881
|
-
type: "function"
|
|
68882
|
-
},
|
|
68883
|
-
{
|
|
68884
|
-
inputs: [
|
|
68885
|
-
{
|
|
68886
|
-
internalType: "address",
|
|
68887
|
-
name: "from",
|
|
68888
|
-
type: "address"
|
|
68889
|
-
},
|
|
68890
|
-
{
|
|
68891
|
-
internalType: "address",
|
|
68892
|
-
name: "to",
|
|
68893
|
-
type: "address"
|
|
68894
|
-
},
|
|
68895
|
-
{
|
|
68896
|
-
internalType: "uint256",
|
|
68897
|
-
name: "tokenId",
|
|
68898
|
-
type: "uint256"
|
|
68899
|
-
},
|
|
68900
|
-
{
|
|
68901
|
-
internalType: "bytes",
|
|
68902
|
-
name: "_data",
|
|
68903
|
-
type: "bytes"
|
|
68904
|
-
}
|
|
68905
|
-
],
|
|
68906
|
-
name: "safeTransferFrom",
|
|
68907
|
-
outputs: [
|
|
68908
|
-
],
|
|
68909
|
-
stateMutability: "nonpayable",
|
|
68910
|
-
type: "function"
|
|
68911
|
-
},
|
|
68912
|
-
{
|
|
68913
|
-
inputs: [
|
|
68914
|
-
{
|
|
68915
|
-
internalType: "address",
|
|
68916
|
-
name: "operator",
|
|
68917
|
-
type: "address"
|
|
68918
|
-
},
|
|
68919
|
-
{
|
|
68920
|
-
internalType: "bool",
|
|
68921
|
-
name: "approved",
|
|
68922
|
-
type: "bool"
|
|
68923
|
-
}
|
|
68924
|
-
],
|
|
68925
|
-
name: "setApprovalForAll",
|
|
68926
|
-
outputs: [
|
|
68927
|
-
],
|
|
68928
|
-
stateMutability: "nonpayable",
|
|
68929
|
-
type: "function"
|
|
68930
|
-
},
|
|
68931
|
-
{
|
|
68932
|
-
inputs: [
|
|
68933
|
-
{
|
|
68934
|
-
internalType: "string",
|
|
68935
|
-
name: "baseTokenURI",
|
|
68936
|
-
type: "string"
|
|
68937
|
-
}
|
|
68938
|
-
],
|
|
68939
|
-
name: "setBaseURI",
|
|
68940
|
-
outputs: [
|
|
68941
|
-
],
|
|
68942
|
-
stateMutability: "nonpayable",
|
|
68943
|
-
type: "function"
|
|
68944
|
-
},
|
|
68945
|
-
{
|
|
68946
|
-
inputs: [
|
|
68947
|
-
{
|
|
68948
|
-
internalType: "bytes4",
|
|
68949
|
-
name: "interfaceId",
|
|
68950
|
-
type: "bytes4"
|
|
68951
|
-
}
|
|
68952
|
-
],
|
|
68953
|
-
name: "supportsInterface",
|
|
68954
|
-
outputs: [
|
|
68955
|
-
{
|
|
68956
|
-
internalType: "bool",
|
|
68957
|
-
name: "",
|
|
68958
|
-
type: "bool"
|
|
68959
|
-
}
|
|
68960
|
-
],
|
|
68961
|
-
stateMutability: "view",
|
|
68962
|
-
type: "function"
|
|
68963
|
-
},
|
|
68964
|
-
{
|
|
68965
|
-
inputs: [
|
|
68966
|
-
],
|
|
68967
|
-
name: "symbol",
|
|
68968
|
-
outputs: [
|
|
68969
|
-
{
|
|
68970
|
-
internalType: "string",
|
|
68971
|
-
name: "",
|
|
68972
|
-
type: "string"
|
|
68973
|
-
}
|
|
68974
|
-
],
|
|
68975
|
-
stateMutability: "view",
|
|
68976
|
-
type: "function"
|
|
68977
|
-
},
|
|
68978
|
-
{
|
|
68979
|
-
inputs: [
|
|
68980
|
-
{
|
|
68981
|
-
internalType: "uint256",
|
|
68982
|
-
name: "index",
|
|
68983
|
-
type: "uint256"
|
|
68984
|
-
}
|
|
68985
|
-
],
|
|
68986
|
-
name: "tokenByIndex",
|
|
68987
|
-
outputs: [
|
|
68988
|
-
{
|
|
68989
|
-
internalType: "uint256",
|
|
68990
|
-
name: "",
|
|
68991
|
-
type: "uint256"
|
|
68992
|
-
}
|
|
68993
|
-
],
|
|
68994
|
-
stateMutability: "view",
|
|
68995
|
-
type: "function"
|
|
68996
|
-
},
|
|
68997
|
-
{
|
|
68998
|
-
inputs: [
|
|
68999
|
-
{
|
|
69000
|
-
internalType: "address",
|
|
69001
|
-
name: "owner",
|
|
69002
|
-
type: "address"
|
|
69003
|
-
},
|
|
69004
|
-
{
|
|
69005
|
-
internalType: "uint256",
|
|
69006
|
-
name: "index",
|
|
69007
|
-
type: "uint256"
|
|
69008
|
-
}
|
|
69009
|
-
],
|
|
69010
|
-
name: "tokenDataOfOwnerByIndex",
|
|
69011
|
-
outputs: [
|
|
69012
|
-
{
|
|
69013
|
-
components: [
|
|
69014
|
-
{
|
|
69015
|
-
internalType: "uint256",
|
|
69016
|
-
name: "tokenId",
|
|
69017
|
-
type: "uint256"
|
|
69018
|
-
},
|
|
69019
|
-
{
|
|
69020
|
-
internalType: "address",
|
|
69021
|
-
name: "billAddress",
|
|
69022
|
-
type: "address"
|
|
69023
|
-
}
|
|
69024
|
-
],
|
|
69025
|
-
internalType: "struct BillNft.TokenData",
|
|
69026
|
-
name: "tokenData",
|
|
69027
|
-
type: "tuple"
|
|
69028
|
-
}
|
|
69029
|
-
],
|
|
69030
|
-
stateMutability: "view",
|
|
69031
|
-
type: "function"
|
|
69032
|
-
},
|
|
69033
|
-
{
|
|
69034
|
-
inputs: [
|
|
69035
|
-
{
|
|
69036
|
-
internalType: "address",
|
|
69037
|
-
name: "owner",
|
|
69038
|
-
type: "address"
|
|
69039
|
-
},
|
|
69040
|
-
{
|
|
69041
|
-
internalType: "uint256",
|
|
69042
|
-
name: "index",
|
|
69043
|
-
type: "uint256"
|
|
69044
|
-
}
|
|
69045
|
-
],
|
|
69046
|
-
name: "tokenOfOwnerByIndex",
|
|
69047
|
-
outputs: [
|
|
69048
|
-
{
|
|
69049
|
-
internalType: "uint256",
|
|
69050
|
-
name: "",
|
|
69051
|
-
type: "uint256"
|
|
69052
|
-
}
|
|
69053
|
-
],
|
|
69054
|
-
stateMutability: "view",
|
|
69055
|
-
type: "function"
|
|
69056
|
-
},
|
|
69057
|
-
{
|
|
69058
|
-
inputs: [
|
|
69059
|
-
{
|
|
69060
|
-
internalType: "uint256",
|
|
69061
|
-
name: "tokenId",
|
|
69062
|
-
type: "uint256"
|
|
69063
|
-
}
|
|
69064
|
-
],
|
|
69065
|
-
name: "tokenURI",
|
|
69066
|
-
outputs: [
|
|
69067
|
-
{
|
|
69068
|
-
internalType: "string",
|
|
69069
|
-
name: "",
|
|
69070
|
-
type: "string"
|
|
69071
|
-
}
|
|
69072
|
-
],
|
|
69073
|
-
stateMutability: "view",
|
|
69074
|
-
type: "function"
|
|
69075
|
-
},
|
|
69076
|
-
{
|
|
69077
|
-
inputs: [
|
|
69078
|
-
],
|
|
69079
|
-
name: "totalSupply",
|
|
69080
|
-
outputs: [
|
|
69081
|
-
{
|
|
69082
|
-
internalType: "uint256",
|
|
69083
|
-
name: "",
|
|
69084
|
-
type: "uint256"
|
|
69085
|
-
}
|
|
69086
|
-
],
|
|
69087
|
-
stateMutability: "view",
|
|
69088
|
-
type: "function"
|
|
69089
|
-
},
|
|
69090
|
-
{
|
|
69091
|
-
inputs: [
|
|
69092
|
-
{
|
|
69093
|
-
internalType: "address",
|
|
69094
|
-
name: "from",
|
|
69095
|
-
type: "address"
|
|
69096
|
-
},
|
|
69097
|
-
{
|
|
69098
|
-
internalType: "address",
|
|
69099
|
-
name: "to",
|
|
69100
|
-
type: "address"
|
|
69101
|
-
},
|
|
69102
|
-
{
|
|
69103
|
-
internalType: "uint256",
|
|
69104
|
-
name: "tokenId",
|
|
69105
|
-
type: "uint256"
|
|
69106
|
-
}
|
|
69107
|
-
],
|
|
69108
|
-
name: "transferFrom",
|
|
69109
|
-
outputs: [
|
|
69110
|
-
],
|
|
69111
|
-
stateMutability: "nonpayable",
|
|
69112
|
-
type: "function"
|
|
69113
|
-
},
|
|
69114
|
-
{
|
|
69115
|
-
inputs: [
|
|
69116
|
-
],
|
|
69117
|
-
name: "uriLocked",
|
|
69118
|
-
outputs: [
|
|
69119
|
-
{
|
|
69120
|
-
internalType: "bool",
|
|
69121
|
-
name: "",
|
|
69122
|
-
type: "bool"
|
|
69123
|
-
}
|
|
69124
|
-
],
|
|
69125
|
-
stateMutability: "view",
|
|
69126
|
-
type: "function"
|
|
69127
|
-
}
|
|
69128
|
-
];
|
|
69129
|
-
|
|
69130
|
-
const useMonitorTx = (txHash, chainId) => {
|
|
69131
|
-
const { addToastError, addToastSuccess } = usePopups();
|
|
69132
|
-
const transactionReceipt = useWaitForTransactionReceipt({
|
|
69133
|
-
confirmations: 0,
|
|
69134
|
-
chainId: chainId,
|
|
69135
|
-
hash: txHash,
|
|
69136
|
-
});
|
|
69137
|
-
const { isLoading, isSuccess: isConfirmed, error, isError, data } = transactionReceipt !== null && transactionReceipt !== void 0 ? transactionReceipt : {};
|
|
69138
|
-
useEffect(() => {
|
|
69139
|
-
if (txHash && isError) {
|
|
69140
|
-
addToastError(error.message, txHash, chainId);
|
|
69141
|
-
}
|
|
69142
|
-
if (txHash && isConfirmed) {
|
|
69143
|
-
addToastSuccess(txHash, chainId);
|
|
69144
|
-
}
|
|
69145
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
69146
|
-
}, [txHash, isError, isConfirmed, isLoading]);
|
|
69147
|
-
return { isLoading, isSuccess: isConfirmed, data };
|
|
68171
|
+
const CardRecommendation = ({ cardIndex, bond, handleBuyBondClick, }) => {
|
|
68172
|
+
return (jsxs(Flex, { sx: {
|
|
68173
|
+
flexDirection: 'column',
|
|
68174
|
+
width: ['100%', '100%', '100%', '50%'],
|
|
68175
|
+
gap: '10px',
|
|
68176
|
+
background: 'white3',
|
|
68177
|
+
p: '10px',
|
|
68178
|
+
borderRadius: '10px',
|
|
68179
|
+
}, children: [jsx$2(Flex, { sx: {
|
|
68180
|
+
flexDirection: 'column',
|
|
68181
|
+
width: '100%',
|
|
68182
|
+
borderRadius: '10px',
|
|
68183
|
+
justifyContent: 'space-between',
|
|
68184
|
+
gap: '14px',
|
|
68185
|
+
}, children: jsxs(Flex, { sx: { alignItems: 'center', justifyContent: 'space-between', gap: '10px' }, children: [jsxs(Flex, { sx: { gap: '5px', justifyContent: 'center', alignItems: 'center' }, children: [jsx$2(TokenImage, { symbol: bond.payoutTokenName, chain: bond.chainId, size: 25 }), jsx$2(Text, { sx: { fontSize: '14px' }, children: bond.payoutTokenName }), jsx$2(Text, { sx: { fontSize: '14px', fontWeight: 400, opacity: 0.6 }, children: getVestingTermsString(bond) })] }), jsx$2(Flex, { sx: { flexDirection: 'column', gap: '1px', alignItems: 'end' }, children: jsxs(Text, { sx: { color: 'success', fontSize: '12px', fontWeight: 700 }, children: [bond.bonus.toFixed(2), "%"] }) })] }) }), jsx$2(Button, { onClick: () => handleBuyBondClick(bond.chainId, bond.billAddress, cardIndex), sx: { width: '100%', lineHeight: '20px', height: '30px', fontSize: '14px' }, children: "Buy" })] }));
|
|
69148
68186
|
};
|
|
69149
68187
|
|
|
69150
|
-
const
|
|
69151
|
-
|
|
69152
|
-
|
|
69153
|
-
|
|
69154
|
-
|
|
69155
|
-
const
|
|
69156
|
-
const { switchChain } = useSwitchChain();
|
|
69157
|
-
// State
|
|
69158
|
-
const [transferTxHash, setTransferTxHash] = useState(null);
|
|
69159
|
-
const [loadingTx, setLoadingTx] = useState(false);
|
|
69160
|
-
const { writeContractAsync } = useWriteContract();
|
|
69161
|
-
const { isLoading, isSuccess: isConfirmed } = useMonitorTx(transferTxHash, (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId);
|
|
69162
|
-
const { addToastError } = usePopups();
|
|
69163
|
-
const load = loadingTx || (isLoading && !isConfirmed);
|
|
69164
|
-
const handleTransfer = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69165
|
-
var _a, _b, _c, _d;
|
|
69166
|
-
const address = userBill === null || userBill === void 0 ? void 0 : userBill.billNftAddress;
|
|
69167
|
-
try {
|
|
69168
|
-
setLoadingTx(true);
|
|
69169
|
-
const tx = yield writeContractAsync({
|
|
69170
|
-
address: address,
|
|
69171
|
-
abi: BOND_NFT_ABI,
|
|
69172
|
-
functionName: 'safeTransferFrom',
|
|
69173
|
-
args: [account, toAddress, userBill === null || userBill === void 0 ? void 0 : userBill.id],
|
|
69174
|
-
chain: userChainId,
|
|
69175
|
-
account: account,
|
|
69176
|
-
});
|
|
69177
|
-
if (tx) {
|
|
69178
|
-
setTransferTxHash(tx);
|
|
69179
|
-
track({
|
|
69180
|
-
event: 'bond',
|
|
69181
|
-
chain: userChainId,
|
|
69182
|
-
data: {
|
|
69183
|
-
cat: 'transfer',
|
|
69184
|
-
type: (_b = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.billType) !== null && _b !== void 0 ? _b : '',
|
|
69185
|
-
id: userBill === null || userBill === void 0 ? void 0 : userBill.id,
|
|
69186
|
-
from: account,
|
|
69187
|
-
to: toAddress,
|
|
69188
|
-
earnToken: (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.earnToken.symbol,
|
|
69189
|
-
},
|
|
69190
|
-
});
|
|
69191
|
-
}
|
|
69192
|
-
setLoadingTx(false);
|
|
69193
|
-
}
|
|
69194
|
-
catch (error) {
|
|
69195
|
-
console.error('Transfer failed:', error);
|
|
69196
|
-
setLoadingTx(false);
|
|
69197
|
-
addToastError(error.shortMessage);
|
|
69198
|
-
reportError$1({
|
|
69199
|
-
apiUrl: (_d = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _d === void 0 ? void 0 : _d.apiV2,
|
|
69200
|
-
error,
|
|
69201
|
-
extraInfo: { type: 'transfer', userBill, error },
|
|
69202
|
-
chainId: userChainId,
|
|
69203
|
-
account,
|
|
69204
|
-
});
|
|
69205
|
-
}
|
|
69206
|
-
});
|
|
69207
|
-
return (jsx$2(Fragment$1, { children: userChainId !== ((_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.chainId) ? (jsxs(Button, { onClick: () => { var _a; return switchChain({ chainId: (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId }); }, children: ["Switch to ", NETWORK_LABEL[(_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.chainId]] })) : (jsx$2(Button, { onClick: handleTransfer, load: load, disabled: load || disabled, fullWidth: true, children: "transfer" })) }));
|
|
69208
|
-
};
|
|
69209
|
-
|
|
69210
|
-
const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
69211
|
-
var _a;
|
|
69212
|
-
// Hooks
|
|
69213
|
-
const wallet = useSOLAccount();
|
|
69214
|
-
const { setVisible } = useWalletModal();
|
|
69215
|
-
const { refetch } = useUserBonds();
|
|
69216
|
-
// State
|
|
69217
|
-
const [loadingTx, setLoadingTx] = useState(false);
|
|
69218
|
-
const { addToastError, addToastSuccess } = usePopups();
|
|
69219
|
-
const load = loadingTx;
|
|
69220
|
-
const handleTransfer = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69221
|
-
var _a;
|
|
69222
|
-
try {
|
|
69223
|
-
if (!wallet.publicKey || !wallet.signTransaction) {
|
|
69224
|
-
throw new Error('Wallet not connected');
|
|
69225
|
-
}
|
|
69226
|
-
setLoadingTx(true);
|
|
69227
|
-
const connection = new Connection(getRPC(types$1.ChainId.SOL));
|
|
69228
|
-
// MPL Core program ID
|
|
69229
|
-
if (!(userBill === null || userBill === void 0 ? void 0 : userBill.id) || !toAddress || !userBill || !(userBill === null || userBill === void 0 ? void 0 : userBill.asset))
|
|
69230
|
-
return;
|
|
69231
|
-
const asset = new PublicKey(userBill === null || userBill === void 0 ? void 0 : userBill.asset);
|
|
69232
|
-
const newOwner = new PublicKey(toAddress);
|
|
69233
|
-
const collection = new PublicKey(userBill.billNftAddress);
|
|
69234
|
-
// Create instruction data with discriminator (14) + null compression_proof
|
|
69235
|
-
// Since compression_proof is null, we just need discriminator + 1 byte for None option
|
|
69236
|
-
const discriminator = buffer.Buffer.from([14]);
|
|
69237
|
-
const nullOption = buffer.Buffer.from([0]); // 0 = None for Option<CompressionProof>
|
|
69238
|
-
const data = buffer.Buffer.concat([discriminator, nullOption]);
|
|
69239
|
-
// Build the accounts array according to MPL Core transfer instruction
|
|
69240
|
-
const accounts = [
|
|
69241
|
-
{ pubkey: asset, isSigner: false, isWritable: true }, // asset
|
|
69242
|
-
{ pubkey: collection, isSigner: false, isWritable: false }, // collection
|
|
69243
|
-
{ pubkey: wallet.publicKey, isSigner: true, isWritable: true }, // payer
|
|
69244
|
-
{ pubkey: wallet.publicKey, isSigner: true, isWritable: false }, // authority
|
|
69245
|
-
{ pubkey: newOwner, isSigner: false, isWritable: false }, // new_owner
|
|
69246
|
-
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, // system_program
|
|
69247
|
-
{ pubkey: new PublicKey('noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV'), isSigner: false, isWritable: false }, // log_wrapper (SPL Noop Program)
|
|
69248
|
-
];
|
|
69249
|
-
const transferInstruction = new TransactionInstruction({
|
|
69250
|
-
keys: accounts,
|
|
69251
|
-
programId: MPL_CORE_PROGRAM_ID,
|
|
69252
|
-
data,
|
|
69253
|
-
});
|
|
69254
|
-
const transaction = new Transaction().add(transferInstruction);
|
|
69255
|
-
// Get recent blockhash
|
|
69256
|
-
const { blockhash, lastValidBlockHeight } = yield connection.getLatestBlockhash();
|
|
69257
|
-
transaction.recentBlockhash = blockhash;
|
|
69258
|
-
transaction.feePayer = wallet.publicKey;
|
|
69259
|
-
// Sign and send transaction
|
|
69260
|
-
const signedTransaction = yield wallet.signTransaction(transaction);
|
|
69261
|
-
const signature = yield connection.sendRawTransaction(signedTransaction.serialize());
|
|
69262
|
-
// Confirm transaction
|
|
69263
|
-
yield connection.confirmTransaction({
|
|
69264
|
-
signature,
|
|
69265
|
-
blockhash,
|
|
69266
|
-
lastValidBlockHeight,
|
|
69267
|
-
}, 'confirmed');
|
|
69268
|
-
refetch();
|
|
69269
|
-
addToastSuccess(signature, (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId);
|
|
69270
|
-
}
|
|
69271
|
-
catch (error) {
|
|
69272
|
-
console.error('Error during NFT transfer:', error);
|
|
69273
|
-
addToastError((error === null || error === void 0 ? void 0 : error.message) || 'Unknown error');
|
|
69274
|
-
}
|
|
69275
|
-
finally {
|
|
69276
|
-
setLoadingTx(false);
|
|
69277
|
-
}
|
|
69278
|
-
});
|
|
69279
|
-
return (jsx$2(Fragment$1, { children: !wallet.publicKey ? (jsxs(Button, { onClick: () => setVisible(true), children: ["Connect to ", NETWORK_LABEL[(_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId]] })) : (jsx$2(Button, { onClick: handleTransfer, load: load, disabled: load || disabled, fullWidth: true, children: "transfer" })) }));
|
|
69280
|
-
};
|
|
69281
|
-
|
|
69282
|
-
const TransferModal = ({ onDismiss, userBill }) => {
|
|
69283
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
69284
|
-
// State
|
|
69285
|
-
const [confirmSend, setConfirmSend] = useState(false);
|
|
69286
|
-
const [toAddress, setToAddress] = useState('');
|
|
69287
|
-
// Data
|
|
69288
|
-
const bond = userBill === null || userBill === void 0 ? void 0 : userBill.bond;
|
|
69289
|
-
const chainId = bond === null || bond === void 0 ? void 0 : bond.chainId;
|
|
69290
|
-
const pending = chainId &&
|
|
69291
|
-
((_e = getBalanceNumber(new BigNumber$1((_a = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _a !== void 0 ? _a : 0), (_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _b === void 0 ? void 0 : _b.decimals) === null || _c === void 0 ? void 0 : _c[chainId]) !== null && _d !== void 0 ? _d : 18)) === null || _e === void 0 ? void 0 : _e.toFixed(4));
|
|
69292
|
-
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond", children: [jsx$2(Flex, { sx: { mt: '20px' }, children: jsx$2(Text, { sx: { fontWeight: 700 }, children: " Transferring: " }) }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', mt: '30px', mr: '10px' }, children: [jsxs(Text, { sx: { fontWeight: 700, fontSize: '25px' }, children: [(_f = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _f === void 0 ? void 0 : _f.symbol, " Bond - ID # ", userBill === null || userBill === void 0 ? void 0 : userBill.id] }), jsxs(Flex, { sx: { mt: '5px' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', mr: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Vesting time" }), getTimeLeftForFullyVested(userBill) > 0 ? `Ends in ${getPendingVestingString(userBill)}` : `Fully Vested`] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Pending" }), jsxs(Flex, { children: [jsx$2(TokenImage, { symbol: (_h = (_g = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _g === void 0 ? void 0 : _g.showcaseTokenName) !== null && _h !== void 0 ? _h : (_k = (_j = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _j === void 0 ? void 0 : _j.earnToken) === null || _k === void 0 ? void 0 : _k.symbol, size: 20, chain: (_l = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _l === void 0 ? void 0 : _l.chainId }), jsx$2(Text, { sx: { fontWeight: 700, ml: '5px' }, children: pending })] })] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', mt: '30px' }, children: [jsx$2(Text, { sx: { fontWeight: 700 }, children: "Receiving Address:" }), jsx$2(Input, { mt: "10px", size: "lg", placeholder: 'Paste the address here', value: toAddress, onChange: (e) => setToAddress(e.target.value), style: { width: '345px', border: 'none' } })] }), jsx$2(Flex, { sx: { mt: '15px' }, children: jsxs(Text, { sx: { lineHeight: '18px', fontSize: '12px', color: 'rgba(223, 65, 65, 1)' }, children: [jsx$2(Text, { sx: { display: 'block', width: '100%', fontWeight: 700, fontSize: '13px', color: 'rgba(223, 65, 65, 1)' }, children: "WARNING" }), "When transfering the NFT all pending rewards will also be transfered to the receiver address."] }) }), jsxs(Flex, { onClick: () => setConfirmSend(!confirmSend), sx: { mt: '20px', cursor: 'pointer', alignItems: 'center' }, children: [jsx$2(Checkbox, { checked: confirmSend, onChange: (event) => {
|
|
69293
|
-
setConfirmSend(!confirmSend);
|
|
69294
|
-
event.stopPropagation();
|
|
69295
|
-
} }), jsx$2(Text, { sx: { ml: '10px', fontSize: '12px', fontWeight: 500, lineHeight: '18px' }, children: "I understand the new wallet gains ownership of all unclaimed assets." })] }), jsx$2(Flex, { sx: { justifyContent: 'center', mt: '15px' }, children: chainId === types$1.ChainId.SOL ? (jsx$2(TransferAction, { userBill: userBill, toAddress: toAddress, disabled: !confirmSend || !toAddress })) : (jsx$2(TransferAction$1, { userBill: userBill, toAddress: toAddress, disabled: !confirmSend || !toAddress })) })] }));
|
|
69296
|
-
};
|
|
69297
|
-
var TransferBondModal = React__default.memo(TransferModal);
|
|
69298
|
-
|
|
69299
|
-
const CardRecommendation = ({ cardIndex, bond, handleBuyBondClick, }) => {
|
|
69300
|
-
return (jsxs(Flex, { sx: {
|
|
69301
|
-
flexDirection: 'column',
|
|
69302
|
-
width: ['100%', '100%', '100%', '50%'],
|
|
69303
|
-
gap: '10px',
|
|
69304
|
-
background: 'white3',
|
|
69305
|
-
p: '10px',
|
|
69306
|
-
borderRadius: '10px',
|
|
69307
|
-
}, children: [jsx$2(Flex, { sx: {
|
|
69308
|
-
flexDirection: 'column',
|
|
69309
|
-
width: '100%',
|
|
69310
|
-
borderRadius: '10px',
|
|
69311
|
-
justifyContent: 'space-between',
|
|
69312
|
-
gap: '14px',
|
|
69313
|
-
}, children: jsxs(Flex, { sx: { alignItems: 'center', justifyContent: 'space-between', gap: '10px' }, children: [jsxs(Flex, { sx: { gap: '5px', justifyContent: 'center', alignItems: 'center' }, children: [jsx$2(TokenImage, { symbol: bond.payoutTokenName, chain: bond.chainId, size: 25 }), jsx$2(Text, { sx: { fontSize: '14px' }, children: bond.payoutTokenName }), jsx$2(Text, { sx: { fontSize: '14px', fontWeight: 400, opacity: 0.6 }, children: getVestingTermsString(bond) })] }), jsx$2(Flex, { sx: { flexDirection: 'column', gap: '1px', alignItems: 'end' }, children: jsxs(Text, { sx: { color: 'success', fontSize: '12px', fontWeight: 700 }, children: [bond.bonus.toFixed(2), "%"] }) })] }) }), jsx$2(Button, { onClick: () => handleBuyBondClick(bond.chainId, bond.billAddress, cardIndex), sx: { width: '100%', lineHeight: '20px', height: '30px', fontSize: '14px' }, children: "Buy" })] }));
|
|
69314
|
-
};
|
|
69315
|
-
|
|
69316
|
-
const getBondRecommendations = (apiV2URL, user, contract, limit, chains) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69317
|
-
const { data } = yield axios.get(`${apiV2URL}/recommendations/bonds?user=${user}&contract=${contract}&limit=${limit}&chains=${chains}`);
|
|
69318
|
-
return data === null || data === void 0 ? void 0 : data.bonds;
|
|
69319
|
-
});
|
|
69320
|
-
function useGetBondRecommendations(user, contract, limit = '3') {
|
|
69321
|
-
const apiV2URL = useURLByEnvironment('apiV2');
|
|
68188
|
+
const getBondRecommendations = (apiV2URL, user, contract, limit, chains) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
68189
|
+
const { data } = yield axios.get(`${apiV2URL}/recommendations/bonds?user=${user}&contract=${contract}&limit=${limit}&chains=${chains}`);
|
|
68190
|
+
return data === null || data === void 0 ? void 0 : data.bonds;
|
|
68191
|
+
});
|
|
68192
|
+
function useGetBondRecommendations(user, contract, limit = '3') {
|
|
68193
|
+
const apiV2URL = useURLByEnvironment('apiV2');
|
|
69322
68194
|
const SDKConfig = useSDKConfig();
|
|
69323
68195
|
return useQuery({
|
|
69324
68196
|
queryKey: [`${QUERY_KEYS.BOND_RECOMMENDATIONS}-${contract}-${limit}-${SDKConfig.chains}`],
|
|
@@ -69353,12 +68225,12 @@ const RecSkeleton = () => {
|
|
|
69353
68225
|
height: '70px',
|
|
69354
68226
|
borderRadius: 'normal',
|
|
69355
68227
|
mb: '5px',
|
|
69356
|
-
} }
|
|
68228
|
+
} }), jsx$2(Skeleton, { animation: "waves", sx: {
|
|
69357
68229
|
width: '100%',
|
|
69358
68230
|
height: '70px',
|
|
69359
68231
|
borderRadius: 'normal',
|
|
69360
68232
|
mb: '5px',
|
|
69361
|
-
} }
|
|
68233
|
+
} })] }));
|
|
69362
68234
|
};
|
|
69363
68235
|
|
|
69364
68236
|
const Recommendations = ({ billAddress }) => {
|
|
@@ -69383,13 +68255,6 @@ const Recommendations = ({ billAddress }) => {
|
|
|
69383
68255
|
} }, `${bond.billAddress}-${index}`)))) : (jsx$2(RecSkeleton, {})) })] }));
|
|
69384
68256
|
};
|
|
69385
68257
|
|
|
69386
|
-
const remove0xPrefix = (str) => {
|
|
69387
|
-
if (str && str.startsWith('0x')) {
|
|
69388
|
-
return str.slice(2);
|
|
69389
|
-
}
|
|
69390
|
-
return str;
|
|
69391
|
-
};
|
|
69392
|
-
|
|
69393
68258
|
// Custom HTML sanitizer
|
|
69394
68259
|
function sanitizeHTML(html) {
|
|
69395
68260
|
var _a;
|
|
@@ -69417,29 +68282,29 @@ const SafeHTMLComponent = ({ html }) => {
|
|
|
69417
68282
|
return jsx$2("div", { dangerouslySetInnerHTML: { __html: sanitizedHTML } });
|
|
69418
68283
|
};
|
|
69419
68284
|
|
|
69420
|
-
const
|
|
69421
|
-
|
|
69422
|
-
|
|
69423
|
-
|
|
69424
|
-
|
|
69425
|
-
|
|
69426
|
-
|
|
69427
|
-
|
|
69428
|
-
|
|
69429
|
-
|
|
69430
|
-
|
|
69431
|
-
|
|
69432
|
-
|
|
69433
|
-
|
|
69434
|
-
|
|
69435
|
-
|
|
69436
|
-
|
|
69437
|
-
|
|
69438
|
-
|
|
69439
|
-
|
|
69440
|
-
|
|
69441
|
-
} })] }));
|
|
68285
|
+
const ProgressBar = ({ value }) => {
|
|
68286
|
+
return (jsx$2(Flex$1, { sx: { width: ['100px', '100px', '100px', '100%'], alignItems: 'center', flexDirection: 'row' }, children: jsx$2(Box$1, { className: "progressbar-background", children: jsx$2(Box$1, { className: "progressbar-completed", style: {
|
|
68287
|
+
width: `${value <= 3 ? 3 : value}%`,
|
|
68288
|
+
} }) }) }));
|
|
68289
|
+
};
|
|
68290
|
+
|
|
68291
|
+
const styles$c = {
|
|
68292
|
+
titleText: {
|
|
68293
|
+
opacity: 0.6,
|
|
68294
|
+
fontSize: '12px',
|
|
68295
|
+
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
68296
|
+
fontWeight: 400,
|
|
68297
|
+
},
|
|
68298
|
+
skeleton: {
|
|
68299
|
+
width: ['45px', '45px', '60px'],
|
|
68300
|
+
maxHeight: '18px',
|
|
68301
|
+
minHeight: '18px',
|
|
68302
|
+
}};
|
|
68303
|
+
|
|
68304
|
+
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
68305
|
+
return (jsxs(Flex, { sx: style, children: [jsx$2(Flex, { sx: { alignItems: 'center' }, children: jsx$2(Text, { sx: styles$c.titleText, children: `${title}` }) }), showTooltip ? (jsx$2(Flex, { sx: { alignItems: 'center', width: '100%' }, children: jsx$2(TooltipBubble, { placement: toolTipPlacement, transformTip: toolTipTransform, body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: toolTip }), width: "250px", children: jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', width: '127px' }, children: value ? value : jsx$2(Skeleton, { sx: styles$c.skeleton }) }) }) })) : (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center' }, children: value ? value : jsx$2(Skeleton, { sx: styles$c.skeleton }) }))] }));
|
|
69442
68306
|
};
|
|
68307
|
+
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
69443
68308
|
|
|
69444
68309
|
var domToImage = {exports: {}};
|
|
69445
68310
|
|
|
@@ -70211,222 +69076,1530 @@ var domToImage = {exports: {}};
|
|
|
70211
69076
|
})();
|
|
70212
69077
|
} (domToImage));
|
|
70213
69078
|
|
|
70214
|
-
var domToImageExports = domToImage.exports;
|
|
70215
|
-
var domtoimage = /*@__PURE__*/getDefaultExportFromCjs(domToImageExports);
|
|
69079
|
+
var domToImageExports = domToImage.exports;
|
|
69080
|
+
var domtoimage = /*@__PURE__*/getDefaultExportFromCjs(domToImageExports);
|
|
69081
|
+
|
|
69082
|
+
function getTemplateHTML(data) {
|
|
69083
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
69084
|
+
//@ts-ignore
|
|
69085
|
+
const isProfit = +((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.payout) * +((_b = data === null || data === void 0 ? void 0 : data.data) === null || _b === void 0 ? void 0 : _b.payoutTokenPrice) - ((_c = data === null || data === void 0 ? void 0 : data.data) === null || _c === void 0 ? void 0 : _c.dollarValue) > 0;
|
|
69086
|
+
const getTokenImage = (symbol) => {
|
|
69087
|
+
return `${APEBOND}/assets/${symbol.toUpperCase()}.png`;
|
|
69088
|
+
};
|
|
69089
|
+
const getPrincipalToken = () => {
|
|
69090
|
+
var _a, _b, _c, _d;
|
|
69091
|
+
if (((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.payoutTokenData.address.toLowerCase()) !== ((_b = data === null || data === void 0 ? void 0 : data.data) === null || _b === void 0 ? void 0 : _b.token0.address.toLowerCase()))
|
|
69092
|
+
return (_c = data === null || data === void 0 ? void 0 : data.data) === null || _c === void 0 ? void 0 : _c.token0.symbol;
|
|
69093
|
+
return (_d = data === null || data === void 0 ? void 0 : data.data) === null || _d === void 0 ? void 0 : _d.token1.symbol;
|
|
69094
|
+
};
|
|
69095
|
+
const getCalculateOff = () => {
|
|
69096
|
+
if (!data || !data.data)
|
|
69097
|
+
return 0;
|
|
69098
|
+
return 100 - (data.data.dollarValue / (data.data.payout * +data.data.payoutTokenPrice)) * 100;
|
|
69099
|
+
};
|
|
69100
|
+
const getCalculatePriceDiscount = () => {
|
|
69101
|
+
if (!data || !data.data)
|
|
69102
|
+
return 0;
|
|
69103
|
+
return +data.data.payoutTokenPrice - (+data.data.payoutTokenPrice * getCalculateOff()) / 100;
|
|
69104
|
+
};
|
|
69105
|
+
return `
|
|
69106
|
+
<div id="template-card" class="sharebondimage-card">
|
|
69107
|
+
<img src="/images/bills/title.png" alt="title" style="width: 169px; height: 52px;" />
|
|
69108
|
+
<div class="sharebondimage-nft">
|
|
69109
|
+
<div style="position: relative">
|
|
69110
|
+
<div class="sharebondimage-nft-id">
|
|
69111
|
+
<span>#${data.tokenId}</span>
|
|
69112
|
+
</div>
|
|
69113
|
+
<img src="${data.image}" alt="bill-nft" />
|
|
69114
|
+
</div>
|
|
69115
|
+
</div>
|
|
69116
|
+
<div class="sharebondimage-container-info">
|
|
69117
|
+
<div class="sharebondimage-container-discount">
|
|
69118
|
+
<img src="${getTokenImage((_e = (_d = data === null || data === void 0 ? void 0 : data.data) === null || _d === void 0 ? void 0 : _d.payoutTokenData) === null || _e === void 0 ? void 0 : _e.symbol)}" alt="payout-token-symbol" style="width: 59px; height: 59px;" />
|
|
69119
|
+
<div class="sharebondimage-container-discount-price">
|
|
69120
|
+
<div class="sharebondimage-container-discount-token">
|
|
69121
|
+
<span>${(_f = data.data) === null || _f === void 0 ? void 0 : _f.payoutTokenData.symbol}</span>
|
|
69122
|
+
<span style="text-decoration: line-through">
|
|
69123
|
+
$${formatTransactionAmount(+((_g = data === null || data === void 0 ? void 0 : data.data) === null || _g === void 0 ? void 0 : _g.payoutTokenPrice))}
|
|
69124
|
+
</span>
|
|
69125
|
+
</div>
|
|
69126
|
+
<span class="sharebondimage-container-discount-price-discount">
|
|
69127
|
+
$${formatTransactionAmount(getCalculatePriceDiscount())}
|
|
69128
|
+
</span>
|
|
69129
|
+
</div>
|
|
69130
|
+
<div class="sharebondimage-container-off">
|
|
69131
|
+
<span>
|
|
69132
|
+
${localeFormat(getCalculateOff())}% OFF
|
|
69133
|
+
</span>
|
|
69134
|
+
</div>
|
|
69135
|
+
</div>
|
|
69136
|
+
<div class="sharebondimage-container-tokens">
|
|
69137
|
+
<div class="sharebondimage-container-token">
|
|
69138
|
+
<img src="${getTokenImage((_h = getPrincipalToken()) !== null && _h !== void 0 ? _h : '')}" alt="principal-symbol" />
|
|
69139
|
+
<div class="sharebondimage-amount-deposit">
|
|
69140
|
+
${formatTransactionAmount((_j = data === null || data === void 0 ? void 0 : data.data) === null || _j === void 0 ? void 0 : _j.deposit)}
|
|
69141
|
+
</div>
|
|
69142
|
+
<div class="sharebondimage-dollarvalue">
|
|
69143
|
+
$${localeFormat((_k = data === null || data === void 0 ? void 0 : data.data) === null || _k === void 0 ? void 0 : _k.dollarValue)}
|
|
69144
|
+
</div>
|
|
69145
|
+
</div>
|
|
69146
|
+
<div class="sharebondimage-container-token">
|
|
69147
|
+
<img src="${getTokenImage((_m = (_l = data === null || data === void 0 ? void 0 : data.data) === null || _l === void 0 ? void 0 : _l.payoutTokenData) === null || _m === void 0 ? void 0 : _m.symbol)}" alt="payout-token2-symbol" />
|
|
69148
|
+
<div class="sharebondimage-container-earntoken">
|
|
69149
|
+
<div class="sharebondimage-amount-earntoken">
|
|
69150
|
+
<div class="sharebondimage-amount-payout">
|
|
69151
|
+
${localeFormat((_o = data === null || data === void 0 ? void 0 : data.data) === null || _o === void 0 ? void 0 : _o.payout)}
|
|
69152
|
+
</div>
|
|
69153
|
+
<div class="sharebondimage-amount-dollarvalue">
|
|
69154
|
+
$${localeFormat(((_p = data === null || data === void 0 ? void 0 : data.data) === null || _p === void 0 ? void 0 : _p.payout) * +((_q = data === null || data === void 0 ? void 0 : data.data) === null || _q === void 0 ? void 0 : _q.payoutTokenPrice))}
|
|
69155
|
+
</div>
|
|
69156
|
+
</div>
|
|
69157
|
+
<div class="sharebondimage-profit" style="${!isProfit ? 'display: none' : ''}">
|
|
69158
|
+
<span>
|
|
69159
|
+
+${localeFormat(((_r = data === null || data === void 0 ? void 0 : data.data) === null || _r === void 0 ? void 0 : _r.payout) * +((_s = data === null || data === void 0 ? void 0 : data.data) === null || _s === void 0 ? void 0 : _s.payoutTokenPrice) - ((_t = data === null || data === void 0 ? void 0 : data.data) === null || _t === void 0 ? void 0 : _t.dollarValue))}
|
|
69160
|
+
profit!
|
|
69161
|
+
</span>
|
|
69162
|
+
</div>
|
|
69163
|
+
</div>
|
|
69164
|
+
</div>
|
|
69165
|
+
</div>
|
|
69166
|
+
</div>
|
|
69167
|
+
</div>
|
|
69168
|
+
`;
|
|
69169
|
+
}
|
|
69170
|
+
|
|
69171
|
+
function generateImageFromTemplate(bondNFTData, link, apiUrl) {
|
|
69172
|
+
return __awaiter$9(this, void 0, void 0, function* () {
|
|
69173
|
+
var _a;
|
|
69174
|
+
if (bondNFTData && bondNFTData.data) {
|
|
69175
|
+
const container = document.createElement('div');
|
|
69176
|
+
container.style.position = 'absolute';
|
|
69177
|
+
container.style.top = '-9999px';
|
|
69178
|
+
container.innerHTML = getTemplateHTML(bondNFTData);
|
|
69179
|
+
document.body.appendChild(container);
|
|
69180
|
+
const templateElement = container.querySelector('#template-card');
|
|
69181
|
+
if (!templateElement)
|
|
69182
|
+
return;
|
|
69183
|
+
const fileName = `bond_share_${(_a = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data.billNftAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()}_${bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.chainId}_${bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.tokenId}`;
|
|
69184
|
+
const existingImage = yield checkImageExists(fileName);
|
|
69185
|
+
if (existingImage) {
|
|
69186
|
+
share(link);
|
|
69187
|
+
}
|
|
69188
|
+
else {
|
|
69189
|
+
try {
|
|
69190
|
+
const dataImage = yield domtoimage.toJpeg(templateElement, { quality: 0.85 });
|
|
69191
|
+
const response = yield fetch(dataImage);
|
|
69192
|
+
const blob = yield response.blob();
|
|
69193
|
+
const formData = new FormData();
|
|
69194
|
+
formData.append('file', blob, fileName);
|
|
69195
|
+
yield axios.post(`${apiUrl}/cloudinary/uploadFile`, formData, {
|
|
69196
|
+
headers: { 'Content-Type': 'multipart/form-data' },
|
|
69197
|
+
});
|
|
69198
|
+
}
|
|
69199
|
+
catch (error) {
|
|
69200
|
+
console.error('Error upload file to cloudinary', error);
|
|
69201
|
+
}
|
|
69202
|
+
share(link);
|
|
69203
|
+
}
|
|
69204
|
+
}
|
|
69205
|
+
});
|
|
69206
|
+
}
|
|
69207
|
+
function share(link) {
|
|
69208
|
+
const linkElement = document.createElement('a');
|
|
69209
|
+
linkElement.href = link;
|
|
69210
|
+
linkElement.target = '_blank';
|
|
69211
|
+
linkElement.click();
|
|
69212
|
+
}
|
|
69213
|
+
function checkImageExists(fileName) {
|
|
69214
|
+
return __awaiter$9(this, void 0, void 0, function* () {
|
|
69215
|
+
let existImg = true;
|
|
69216
|
+
try {
|
|
69217
|
+
yield axios.get(`https://res.cloudinary.com/dswmrqgwy/image/upload/v1/bond_share/${fileName}.jpg`);
|
|
69218
|
+
}
|
|
69219
|
+
catch (_a) {
|
|
69220
|
+
existImg = false;
|
|
69221
|
+
}
|
|
69222
|
+
return existImg;
|
|
69223
|
+
});
|
|
69224
|
+
}
|
|
69225
|
+
|
|
69226
|
+
const LinkShare = ({ userBill }) => {
|
|
69227
|
+
var _a, _b, _c, _d, _e, _f;
|
|
69228
|
+
// State
|
|
69229
|
+
const [isLoading, setIsLoading] = useState([false, false]);
|
|
69230
|
+
// Static data
|
|
69231
|
+
const bondNFTData = userBill === null || userBill === void 0 ? void 0 : userBill.nftData;
|
|
69232
|
+
const chainId = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId;
|
|
69233
|
+
// Hooks
|
|
69234
|
+
const mainUrl = useURLByEnvironment('mainUrl');
|
|
69235
|
+
const apiUrl = (_b = useURLByEnvironment('apiV2')) !== null && _b !== void 0 ? _b : '';
|
|
69236
|
+
const shareUrl = `${mainUrl}/bond-nft?bondAddress=${(_d = (_c = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _c === void 0 ? void 0 : _c.billNftAddress) === null || _d === void 0 ? void 0 : _d.toLowerCase()}%26bondChain=${bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.chainId}%26tokenId=${userBill === null || userBill === void 0 ? void 0 : userBill.id}%26af=${(_e = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _e === void 0 ? void 0 : _e.createdAddressOwner}`;
|
|
69237
|
+
const text = `I've filled my bags with $${(_f = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _f === void 0 ? void 0 : _f.earnToken.symbol} at a discount, thanks to Bonds-only on @apebond! Check it out: `;
|
|
69238
|
+
const handleShare = (url, social) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69239
|
+
var _a;
|
|
69240
|
+
if (isLoading[0] || isLoading[1]) {
|
|
69241
|
+
console.log('something is off');
|
|
69242
|
+
return;
|
|
69243
|
+
}
|
|
69244
|
+
track({
|
|
69245
|
+
event: 'referral',
|
|
69246
|
+
chain: chainId,
|
|
69247
|
+
data: {
|
|
69248
|
+
cat: `${social.toUpperCase()} Share Bond`,
|
|
69249
|
+
bond: (_a = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _a === void 0 ? void 0 : _a.payoutTokenData.symbol,
|
|
69250
|
+
},
|
|
69251
|
+
});
|
|
69252
|
+
setIsLoading([true, false] );
|
|
69253
|
+
yield generateImageFromTemplate(bondNFTData, url, apiUrl);
|
|
69254
|
+
setIsLoading([false, false]);
|
|
69255
|
+
});
|
|
69256
|
+
return (jsxs(Flex, { sx: {
|
|
69257
|
+
background: ['white3', 'white3', 'white3', 'white4'],
|
|
69258
|
+
borderRadius: 'normal',
|
|
69259
|
+
justifyContent: 'center',
|
|
69260
|
+
alignItems: 'center',
|
|
69261
|
+
p: '2px 10px 2px 5px',
|
|
69262
|
+
fontWeight: 600,
|
|
69263
|
+
fontSize: '12px',
|
|
69264
|
+
height: '22px',
|
|
69265
|
+
cursor: 'pointer',
|
|
69266
|
+
'&:hover': {
|
|
69267
|
+
background: 'white5',
|
|
69268
|
+
},
|
|
69269
|
+
}, onClick: () => handleShare(`https://twitter.com/intent/tweet?text=${text}&url=${shareUrl}`, 'x'), children: [jsx$2(Flex, { children: isLoading[0] ? jsx$2(Spinner, { size: 16 }) : jsx$2(Svg, { icon: "twitter", width: 20 }) }), jsx$2(Flex, { children: "SHARE" })] }));
|
|
69270
|
+
};
|
|
69271
|
+
|
|
69272
|
+
const ProgressiveImage = ({ src, alt = 'bluredImg', blurSrc }) => {
|
|
69273
|
+
const [loaded, setLoaded] = useState(false);
|
|
69274
|
+
return (jsxs(Fragment$1, { children: [jsx$2(Flex, { src: blurSrc, alt: alt, sx: {
|
|
69275
|
+
position: 'absolute',
|
|
69276
|
+
width: '100%',
|
|
69277
|
+
height: '100%',
|
|
69278
|
+
backgroundSize: 'cover',
|
|
69279
|
+
zIndex: 0,
|
|
69280
|
+
objectFit: 'cover',
|
|
69281
|
+
transition: 'opacity 1.5s ease',
|
|
69282
|
+
borderRadius: 'normal',
|
|
69283
|
+
backgroundImage: `url(${blurSrc})`,
|
|
69284
|
+
filter: 'blur(1px)',
|
|
69285
|
+
opacity: loaded ? 0 : 1,
|
|
69286
|
+
} }), jsx$2(Image$1, { src: src, alt: `${alt}-${blurSrc}`, onLoad: () => setLoaded(true), sx: {
|
|
69287
|
+
width: '100%',
|
|
69288
|
+
height: '100%',
|
|
69289
|
+
objectFit: 'cover',
|
|
69290
|
+
transition: 'opacity 0.5s ease',
|
|
69291
|
+
borderRadius: 'normal',
|
|
69292
|
+
opacity: loaded ? 1 : 0,
|
|
69293
|
+
} })] }));
|
|
69294
|
+
};
|
|
69295
|
+
|
|
69296
|
+
const NftImage = ({ userBill, showNFTImg, setShowNFTImg, }) => {
|
|
69297
|
+
var _a;
|
|
69298
|
+
// Hooks
|
|
69299
|
+
const controls = useAnimation();
|
|
69300
|
+
const isMobile = useIsMobile();
|
|
69301
|
+
// State
|
|
69302
|
+
const [isOpenTraits, setIsOpenTraits] = useState(false);
|
|
69303
|
+
//Static Data
|
|
69304
|
+
const bondNFTData = userBill === null || userBill === void 0 ? void 0 : userBill.nftData;
|
|
69305
|
+
const BILL_ATTRIBUTES = ['The Legend', 'The Location', 'The Moment', 'The Trend', 'The Innovation'];
|
|
69306
|
+
const attributes = (_a = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.attributes) === null || _a === void 0 ? void 0 : _a.filter((attrib) => BILL_ATTRIBUTES.includes(attrib.trait_type));
|
|
69307
|
+
const openAnimation = () => {
|
|
69308
|
+
controls.start({
|
|
69309
|
+
scale: isMobile ? [1, 2] : [1, 3],
|
|
69310
|
+
zIndex: 1000,
|
|
69311
|
+
transition: { duration: 0.2 },
|
|
69312
|
+
});
|
|
69313
|
+
};
|
|
69314
|
+
const closeAnimation = () => {
|
|
69315
|
+
controls.start({
|
|
69316
|
+
scale: isMobile ? [2, 1] : [2, 1],
|
|
69317
|
+
zIndex: -1,
|
|
69318
|
+
transition: { duration: 0.3 },
|
|
69319
|
+
});
|
|
69320
|
+
setShowNFTImg(false);
|
|
69321
|
+
setIsOpenTraits(false);
|
|
69322
|
+
};
|
|
69323
|
+
return (jsxs(Fragment$1, { children: [jsx$2(AnimatePresence, { children: showNFTImg && (jsx$2(motion.div, { animate: { opacity: 1 }, transition: { duration: 1, delay: 0.3 }, sx: {
|
|
69324
|
+
position: 'absolute',
|
|
69325
|
+
display: ['flex'],
|
|
69326
|
+
top: ['-180px', '-180px', '-240px'],
|
|
69327
|
+
right: ['50%', '50%', '50%', '-13%'],
|
|
69328
|
+
transform: ['translateX(50%)', 'translateX(50%)', 'translateX(50%)', 'unset'],
|
|
69329
|
+
opacity: 0,
|
|
69330
|
+
zIndex: 5000,
|
|
69331
|
+
}, children: jsx$2(LinkShare, { userBill: userBill }) })) }), jsx$2(AnimatePresence, { children: (bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.image) && (jsxs(motion.div, { animate: controls, onClick: () => {
|
|
69332
|
+
if (showNFTImg) {
|
|
69333
|
+
closeAnimation();
|
|
69334
|
+
}
|
|
69335
|
+
else {
|
|
69336
|
+
openAnimation();
|
|
69337
|
+
}
|
|
69338
|
+
}, onAnimationStart: () => {
|
|
69339
|
+
setShowNFTImg(true);
|
|
69340
|
+
}, sx: {
|
|
69341
|
+
display: 'flex',
|
|
69342
|
+
zIndex: -1,
|
|
69343
|
+
position: showNFTImg ? 'fixed' : 'absolute',
|
|
69344
|
+
bottom: 'calc(100% - 10px)',
|
|
69345
|
+
left: '25%',
|
|
69346
|
+
width: '50%',
|
|
69347
|
+
aspectRatio: '1 / 0.56',
|
|
69348
|
+
cursor: 'pointer',
|
|
69349
|
+
borderRadius: 'normal',
|
|
69350
|
+
flexDirection: 'column',
|
|
69351
|
+
'&: hover': {
|
|
69352
|
+
zIndex: [1000, 1000, 1000, '1000 !important'],
|
|
69353
|
+
},
|
|
69354
|
+
}, children: [jsxs(Flex, { sx: {
|
|
69355
|
+
display: showNFTImg ? 'none' : 'flex',
|
|
69356
|
+
position: 'absolute',
|
|
69357
|
+
zIndex: 121,
|
|
69358
|
+
width: '100%',
|
|
69359
|
+
height: '100%',
|
|
69360
|
+
opacity: 0,
|
|
69361
|
+
alignItems: 'center',
|
|
69362
|
+
justifyContent: 'center',
|
|
69363
|
+
fontWeight: 700,
|
|
69364
|
+
borderRadius: 'normal',
|
|
69365
|
+
'&: hover': {
|
|
69366
|
+
zIndex: 1000,
|
|
69367
|
+
opacity: 0.8,
|
|
69368
|
+
background: 'linear-gradient(90deg, rgba(49, 46, 122, 0.70) 0%, rgba(92, 79, 174, 0.70) 100%)',
|
|
69369
|
+
backdropFilter: ' blur(2px)',
|
|
69370
|
+
},
|
|
69371
|
+
}, children: ["View NFT ", '>'] }), showNFTImg && (jsx$2(Flex, { sx: {
|
|
69372
|
+
position: 'absolute',
|
|
69373
|
+
top: '5px',
|
|
69374
|
+
right: '5px',
|
|
69375
|
+
background: 'grey',
|
|
69376
|
+
opacity: 0.9,
|
|
69377
|
+
p: '2px',
|
|
69378
|
+
borderRadius: '50%',
|
|
69379
|
+
alignItems: 'center',
|
|
69380
|
+
justifyContent: 'center',
|
|
69381
|
+
}, children: jsx$2(Flex, { sx: { width: '6px' }, children: jsx$2(Svg, { icon: "close" }) }) })), jsx$2(ProgressiveImage, { src: `${bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.image}`, blurSrc: `https://ape.bond/images/bills/bluredNFT.png` }), showNFTImg && (jsx$2(Flex, { sx: {
|
|
69382
|
+
position: 'absolute',
|
|
69383
|
+
bottom: ['calc(-35% + 1px)', 'calc(-35% + 1px)', 'calc(-26% + 1px)'],
|
|
69384
|
+
width: '100%',
|
|
69385
|
+
justifyContent: 'center',
|
|
69386
|
+
}, children: jsxs(Flex, { sx: {
|
|
69387
|
+
flexDirection: 'column',
|
|
69388
|
+
width: '100%',
|
|
69389
|
+
minWidth: '250px',
|
|
69390
|
+
pb: '10px',
|
|
69391
|
+
alignItems: 'center',
|
|
69392
|
+
transform: [
|
|
69393
|
+
'scale(0.5) translateY(-50%)',
|
|
69394
|
+
'scale(0.5) translateY(-50%)',
|
|
69395
|
+
'scale(0.5) translateY(-50%)',
|
|
69396
|
+
'scale(0.4) translateY(-75%)',
|
|
69397
|
+
],
|
|
69398
|
+
}, children: [jsxs(Flex, { sx: {
|
|
69399
|
+
justifyContent: 'space-between',
|
|
69400
|
+
height: '24px',
|
|
69401
|
+
backgroundColor: 'white3',
|
|
69402
|
+
px: '15px',
|
|
69403
|
+
width: '100%',
|
|
69404
|
+
borderRadius: `${isOpenTraits ? '6px 6px 0px 0px' : 'normal'}`,
|
|
69405
|
+
}, onClick: (event) => {
|
|
69406
|
+
event.stopPropagation();
|
|
69407
|
+
setIsOpenTraits(!isOpenTraits);
|
|
69408
|
+
}, children: [jsxs(Flex, { sx: { gap: '10px', alignItems: 'center' }, children: [jsx$2(Svg, { icon: "tag", direction: "down" }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'text', opacity: '0.6' }, children: "Traits" })] }), jsx$2(Svg, { icon: "caret", direction: isOpenTraits ? 'up' : 'down' })] }), jsx$2(AnimatePresence, { children: isOpenTraits && (jsx$2(motion.div, { initial: { height: 0 }, animate: { height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { height: 0 }, sx: {
|
|
69409
|
+
overflow: 'hidden',
|
|
69410
|
+
width: '100%',
|
|
69411
|
+
position: 'absolute',
|
|
69412
|
+
top: '24px',
|
|
69413
|
+
borderRadius: '0 0 10px 10px',
|
|
69414
|
+
}, onClick: (event) => {
|
|
69415
|
+
event.stopPropagation();
|
|
69416
|
+
setIsOpenTraits(!isOpenTraits);
|
|
69417
|
+
}, children: jsx$2(Flex, { sx: { flexDirection: 'column' }, children: attributes
|
|
69418
|
+
? attributes.map((a) => (jsxs(Flex, { sx: { background: 'white4', width: '100%', padding: '2px 8px', height: '22px' }, 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)))
|
|
69419
|
+
: BILL_ATTRIBUTES.map((attrib) => {
|
|
69420
|
+
return (jsxs(Flex, { sx: { background: 'white4', width: '100%', padding: '2px 8px', height: '22px' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: attrib }), jsx$2(Skeleton, { width: "150px" })] }, attrib));
|
|
69421
|
+
}) }) })) })] }) }))] })) })] }));
|
|
69422
|
+
};
|
|
69423
|
+
|
|
69424
|
+
const ProfitCard = ({ userBond }) => {
|
|
69425
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
69426
|
+
const totalPayout = getBalanceNumber((_a = userBond === null || userBond === void 0 ? void 0 : userBond.totalPayout) !== null && _a !== void 0 ? _a : '0', (_e = (_c = (_b = userBond === null || userBond === void 0 ? void 0 : userBond.bond) === null || _b === void 0 ? void 0 : _b.earnToken) === null || _c === void 0 ? void 0 : _c.decimals[(_d = userBond.bond) === null || _d === void 0 ? void 0 : _d.chainId]) !== null && _e !== void 0 ? _e : 18);
|
|
69427
|
+
const payoutTokenPrice = (_g = (_f = userBond === null || userBond === void 0 ? void 0 : userBond.bond) === null || _f === void 0 ? void 0 : _f.payoutTokenPrice) !== null && _g !== void 0 ? _g : '0';
|
|
69428
|
+
const totalPayoutUSD = totalPayout * parseFloat(payoutTokenPrice);
|
|
69429
|
+
const depositAmountUSD = (_k = (_j = (_h = userBond === null || userBond === void 0 ? void 0 : userBond.nftData) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.dollarValue) !== null && _k !== void 0 ? _k : 0;
|
|
69430
|
+
const profit = !depositAmountUSD ? 0 : totalPayoutUSD - depositAmountUSD;
|
|
69431
|
+
return (jsx$2(Flex$1, { sx: {
|
|
69432
|
+
display: ['none', 'none', 'none', 'none', 'none', 'none', 'flex'],
|
|
69433
|
+
}, children: profit > 0.01 && (jsxs(Flex$1, { sx: {
|
|
69434
|
+
border: '1px solid rgb(56, 166, 17, 0.20)',
|
|
69435
|
+
p: '2px 6px',
|
|
69436
|
+
color: 'success',
|
|
69437
|
+
borderRadius: '5px',
|
|
69438
|
+
background: '#38A6110D',
|
|
69439
|
+
fontWeight: 700,
|
|
69440
|
+
fontSize: '14px',
|
|
69441
|
+
width: '100%',
|
|
69442
|
+
justifyContent: 'center',
|
|
69443
|
+
}, children: ["+$", formatNumberSI(profit, profit > 100 ? 0 : 2), " Profit!"] })) }));
|
|
69444
|
+
};
|
|
69445
|
+
|
|
69446
|
+
var BOND_NFT_ABI = [
|
|
69447
|
+
{
|
|
69448
|
+
anonymous: false,
|
|
69449
|
+
inputs: [
|
|
69450
|
+
{
|
|
69451
|
+
indexed: true,
|
|
69452
|
+
internalType: "address",
|
|
69453
|
+
name: "owner",
|
|
69454
|
+
type: "address"
|
|
69455
|
+
},
|
|
69456
|
+
{
|
|
69457
|
+
indexed: true,
|
|
69458
|
+
internalType: "address",
|
|
69459
|
+
name: "approved",
|
|
69460
|
+
type: "address"
|
|
69461
|
+
},
|
|
69462
|
+
{
|
|
69463
|
+
indexed: true,
|
|
69464
|
+
internalType: "uint256",
|
|
69465
|
+
name: "tokenId",
|
|
69466
|
+
type: "uint256"
|
|
69467
|
+
}
|
|
69468
|
+
],
|
|
69469
|
+
name: "Approval",
|
|
69470
|
+
type: "event"
|
|
69471
|
+
},
|
|
69472
|
+
{
|
|
69473
|
+
anonymous: false,
|
|
69474
|
+
inputs: [
|
|
69475
|
+
{
|
|
69476
|
+
indexed: true,
|
|
69477
|
+
internalType: "address",
|
|
69478
|
+
name: "owner",
|
|
69479
|
+
type: "address"
|
|
69480
|
+
},
|
|
69481
|
+
{
|
|
69482
|
+
indexed: true,
|
|
69483
|
+
internalType: "address",
|
|
69484
|
+
name: "operator",
|
|
69485
|
+
type: "address"
|
|
69486
|
+
},
|
|
69487
|
+
{
|
|
69488
|
+
indexed: false,
|
|
69489
|
+
internalType: "bool",
|
|
69490
|
+
name: "approved",
|
|
69491
|
+
type: "bool"
|
|
69492
|
+
}
|
|
69493
|
+
],
|
|
69494
|
+
name: "ApprovalForAll",
|
|
69495
|
+
type: "event"
|
|
69496
|
+
},
|
|
69497
|
+
{
|
|
69498
|
+
anonymous: false,
|
|
69499
|
+
inputs: [
|
|
69500
|
+
{
|
|
69501
|
+
indexed: false,
|
|
69502
|
+
internalType: "string",
|
|
69503
|
+
name: "newUri",
|
|
69504
|
+
type: "string"
|
|
69505
|
+
}
|
|
69506
|
+
],
|
|
69507
|
+
name: "BaseTokenUriChanged",
|
|
69508
|
+
type: "event"
|
|
69509
|
+
},
|
|
69510
|
+
{
|
|
69511
|
+
anonymous: false,
|
|
69512
|
+
inputs: [
|
|
69513
|
+
{
|
|
69514
|
+
indexed: true,
|
|
69515
|
+
internalType: "bytes32",
|
|
69516
|
+
name: "role",
|
|
69517
|
+
type: "bytes32"
|
|
69518
|
+
},
|
|
69519
|
+
{
|
|
69520
|
+
indexed: true,
|
|
69521
|
+
internalType: "bytes32",
|
|
69522
|
+
name: "previousAdminRole",
|
|
69523
|
+
type: "bytes32"
|
|
69524
|
+
},
|
|
69525
|
+
{
|
|
69526
|
+
indexed: true,
|
|
69527
|
+
internalType: "bytes32",
|
|
69528
|
+
name: "newAdminRole",
|
|
69529
|
+
type: "bytes32"
|
|
69530
|
+
}
|
|
69531
|
+
],
|
|
69532
|
+
name: "RoleAdminChanged",
|
|
69533
|
+
type: "event"
|
|
69534
|
+
},
|
|
69535
|
+
{
|
|
69536
|
+
anonymous: false,
|
|
69537
|
+
inputs: [
|
|
69538
|
+
{
|
|
69539
|
+
indexed: true,
|
|
69540
|
+
internalType: "bytes32",
|
|
69541
|
+
name: "role",
|
|
69542
|
+
type: "bytes32"
|
|
69543
|
+
},
|
|
69544
|
+
{
|
|
69545
|
+
indexed: true,
|
|
69546
|
+
internalType: "address",
|
|
69547
|
+
name: "account",
|
|
69548
|
+
type: "address"
|
|
69549
|
+
},
|
|
69550
|
+
{
|
|
69551
|
+
indexed: true,
|
|
69552
|
+
internalType: "address",
|
|
69553
|
+
name: "sender",
|
|
69554
|
+
type: "address"
|
|
69555
|
+
}
|
|
69556
|
+
],
|
|
69557
|
+
name: "RoleGranted",
|
|
69558
|
+
type: "event"
|
|
69559
|
+
},
|
|
69560
|
+
{
|
|
69561
|
+
anonymous: false,
|
|
69562
|
+
inputs: [
|
|
69563
|
+
{
|
|
69564
|
+
indexed: true,
|
|
69565
|
+
internalType: "bytes32",
|
|
69566
|
+
name: "role",
|
|
69567
|
+
type: "bytes32"
|
|
69568
|
+
},
|
|
69569
|
+
{
|
|
69570
|
+
indexed: true,
|
|
69571
|
+
internalType: "address",
|
|
69572
|
+
name: "account",
|
|
69573
|
+
type: "address"
|
|
69574
|
+
},
|
|
69575
|
+
{
|
|
69576
|
+
indexed: true,
|
|
69577
|
+
internalType: "address",
|
|
69578
|
+
name: "sender",
|
|
69579
|
+
type: "address"
|
|
69580
|
+
}
|
|
69581
|
+
],
|
|
69582
|
+
name: "RoleRevoked",
|
|
69583
|
+
type: "event"
|
|
69584
|
+
},
|
|
69585
|
+
{
|
|
69586
|
+
anonymous: false,
|
|
69587
|
+
inputs: [
|
|
69588
|
+
{
|
|
69589
|
+
indexed: true,
|
|
69590
|
+
internalType: "address",
|
|
69591
|
+
name: "from",
|
|
69592
|
+
type: "address"
|
|
69593
|
+
},
|
|
69594
|
+
{
|
|
69595
|
+
indexed: true,
|
|
69596
|
+
internalType: "address",
|
|
69597
|
+
name: "to",
|
|
69598
|
+
type: "address"
|
|
69599
|
+
},
|
|
69600
|
+
{
|
|
69601
|
+
indexed: true,
|
|
69602
|
+
internalType: "uint256",
|
|
69603
|
+
name: "tokenId",
|
|
69604
|
+
type: "uint256"
|
|
69605
|
+
}
|
|
69606
|
+
],
|
|
69607
|
+
name: "Transfer",
|
|
69608
|
+
type: "event"
|
|
69609
|
+
},
|
|
69610
|
+
{
|
|
69611
|
+
anonymous: false,
|
|
69612
|
+
inputs: [
|
|
69613
|
+
{
|
|
69614
|
+
indexed: false,
|
|
69615
|
+
internalType: "bool",
|
|
69616
|
+
name: "locked",
|
|
69617
|
+
type: "bool"
|
|
69618
|
+
}
|
|
69619
|
+
],
|
|
69620
|
+
name: "UriLocked",
|
|
69621
|
+
type: "event"
|
|
69622
|
+
},
|
|
69623
|
+
{
|
|
69624
|
+
inputs: [
|
|
69625
|
+
],
|
|
69626
|
+
name: "DEFAULT_ADMIN_ROLE",
|
|
69627
|
+
outputs: [
|
|
69628
|
+
{
|
|
69629
|
+
internalType: "bytes32",
|
|
69630
|
+
name: "",
|
|
69631
|
+
type: "bytes32"
|
|
69632
|
+
}
|
|
69633
|
+
],
|
|
69634
|
+
stateMutability: "view",
|
|
69635
|
+
type: "function"
|
|
69636
|
+
},
|
|
69637
|
+
{
|
|
69638
|
+
inputs: [
|
|
69639
|
+
],
|
|
69640
|
+
name: "FACTORY_ROLE",
|
|
69641
|
+
outputs: [
|
|
69642
|
+
{
|
|
69643
|
+
internalType: "bytes32",
|
|
69644
|
+
name: "",
|
|
69645
|
+
type: "bytes32"
|
|
69646
|
+
}
|
|
69647
|
+
],
|
|
69648
|
+
stateMutability: "view",
|
|
69649
|
+
type: "function"
|
|
69650
|
+
},
|
|
69651
|
+
{
|
|
69652
|
+
inputs: [
|
|
69653
|
+
],
|
|
69654
|
+
name: "MINTER_ROLE",
|
|
69655
|
+
outputs: [
|
|
69656
|
+
{
|
|
69657
|
+
internalType: "bytes32",
|
|
69658
|
+
name: "",
|
|
69659
|
+
type: "bytes32"
|
|
69660
|
+
}
|
|
69661
|
+
],
|
|
69662
|
+
stateMutability: "view",
|
|
69663
|
+
type: "function"
|
|
69664
|
+
},
|
|
69665
|
+
{
|
|
69666
|
+
inputs: [
|
|
69667
|
+
],
|
|
69668
|
+
name: "URI_SETTER_ROLE",
|
|
69669
|
+
outputs: [
|
|
69670
|
+
{
|
|
69671
|
+
internalType: "bytes32",
|
|
69672
|
+
name: "",
|
|
69673
|
+
type: "bytes32"
|
|
69674
|
+
}
|
|
69675
|
+
],
|
|
69676
|
+
stateMutability: "view",
|
|
69677
|
+
type: "function"
|
|
69678
|
+
},
|
|
69679
|
+
{
|
|
69680
|
+
inputs: [
|
|
69681
|
+
{
|
|
69682
|
+
internalType: "address",
|
|
69683
|
+
name: "minter",
|
|
69684
|
+
type: "address"
|
|
69685
|
+
}
|
|
69686
|
+
],
|
|
69687
|
+
name: "addMinter",
|
|
69688
|
+
outputs: [
|
|
69689
|
+
],
|
|
69690
|
+
stateMutability: "nonpayable",
|
|
69691
|
+
type: "function"
|
|
69692
|
+
},
|
|
69693
|
+
{
|
|
69694
|
+
inputs: [
|
|
69695
|
+
{
|
|
69696
|
+
internalType: "address",
|
|
69697
|
+
name: "owner",
|
|
69698
|
+
type: "address"
|
|
69699
|
+
}
|
|
69700
|
+
],
|
|
69701
|
+
name: "allTokensDataOfOwner",
|
|
69702
|
+
outputs: [
|
|
69703
|
+
{
|
|
69704
|
+
components: [
|
|
69705
|
+
{
|
|
69706
|
+
internalType: "uint256",
|
|
69707
|
+
name: "tokenId",
|
|
69708
|
+
type: "uint256"
|
|
69709
|
+
},
|
|
69710
|
+
{
|
|
69711
|
+
internalType: "address",
|
|
69712
|
+
name: "billAddress",
|
|
69713
|
+
type: "address"
|
|
69714
|
+
}
|
|
69715
|
+
],
|
|
69716
|
+
internalType: "struct BillNft.TokenData[]",
|
|
69717
|
+
name: "",
|
|
69718
|
+
type: "tuple[]"
|
|
69719
|
+
}
|
|
69720
|
+
],
|
|
69721
|
+
stateMutability: "view",
|
|
69722
|
+
type: "function"
|
|
69723
|
+
},
|
|
69724
|
+
{
|
|
69725
|
+
inputs: [
|
|
69726
|
+
{
|
|
69727
|
+
internalType: "address",
|
|
69728
|
+
name: "to",
|
|
69729
|
+
type: "address"
|
|
69730
|
+
},
|
|
69731
|
+
{
|
|
69732
|
+
internalType: "uint256",
|
|
69733
|
+
name: "tokenId",
|
|
69734
|
+
type: "uint256"
|
|
69735
|
+
}
|
|
69736
|
+
],
|
|
69737
|
+
name: "approve",
|
|
69738
|
+
outputs: [
|
|
69739
|
+
],
|
|
69740
|
+
stateMutability: "nonpayable",
|
|
69741
|
+
type: "function"
|
|
69742
|
+
},
|
|
69743
|
+
{
|
|
69744
|
+
inputs: [
|
|
69745
|
+
{
|
|
69746
|
+
internalType: "address",
|
|
69747
|
+
name: "owner",
|
|
69748
|
+
type: "address"
|
|
69749
|
+
}
|
|
69750
|
+
],
|
|
69751
|
+
name: "balanceOf",
|
|
69752
|
+
outputs: [
|
|
69753
|
+
{
|
|
69754
|
+
internalType: "uint256",
|
|
69755
|
+
name: "",
|
|
69756
|
+
type: "uint256"
|
|
69757
|
+
}
|
|
69758
|
+
],
|
|
69759
|
+
stateMutability: "view",
|
|
69760
|
+
type: "function"
|
|
69761
|
+
},
|
|
69762
|
+
{
|
|
69763
|
+
inputs: [
|
|
69764
|
+
{
|
|
69765
|
+
internalType: "uint256",
|
|
69766
|
+
name: "",
|
|
69767
|
+
type: "uint256"
|
|
69768
|
+
}
|
|
69769
|
+
],
|
|
69770
|
+
name: "billAddresses",
|
|
69771
|
+
outputs: [
|
|
69772
|
+
{
|
|
69773
|
+
internalType: "address",
|
|
69774
|
+
name: "",
|
|
69775
|
+
type: "address"
|
|
69776
|
+
}
|
|
69777
|
+
],
|
|
69778
|
+
stateMutability: "view",
|
|
69779
|
+
type: "function"
|
|
69780
|
+
},
|
|
69781
|
+
{
|
|
69782
|
+
inputs: [
|
|
69783
|
+
{
|
|
69784
|
+
internalType: "uint256",
|
|
69785
|
+
name: "tokenId",
|
|
69786
|
+
type: "uint256"
|
|
69787
|
+
}
|
|
69788
|
+
],
|
|
69789
|
+
name: "getApproved",
|
|
69790
|
+
outputs: [
|
|
69791
|
+
{
|
|
69792
|
+
internalType: "address",
|
|
69793
|
+
name: "",
|
|
69794
|
+
type: "address"
|
|
69795
|
+
}
|
|
69796
|
+
],
|
|
69797
|
+
stateMutability: "view",
|
|
69798
|
+
type: "function"
|
|
69799
|
+
},
|
|
69800
|
+
{
|
|
69801
|
+
inputs: [
|
|
69802
|
+
{
|
|
69803
|
+
internalType: "bytes32",
|
|
69804
|
+
name: "role",
|
|
69805
|
+
type: "bytes32"
|
|
69806
|
+
}
|
|
69807
|
+
],
|
|
69808
|
+
name: "getRoleAdmin",
|
|
69809
|
+
outputs: [
|
|
69810
|
+
{
|
|
69811
|
+
internalType: "bytes32",
|
|
69812
|
+
name: "",
|
|
69813
|
+
type: "bytes32"
|
|
69814
|
+
}
|
|
69815
|
+
],
|
|
69816
|
+
stateMutability: "view",
|
|
69817
|
+
type: "function"
|
|
69818
|
+
},
|
|
69819
|
+
{
|
|
69820
|
+
inputs: [
|
|
69821
|
+
{
|
|
69822
|
+
internalType: "bytes32",
|
|
69823
|
+
name: "role",
|
|
69824
|
+
type: "bytes32"
|
|
69825
|
+
},
|
|
69826
|
+
{
|
|
69827
|
+
internalType: "uint256",
|
|
69828
|
+
name: "index",
|
|
69829
|
+
type: "uint256"
|
|
69830
|
+
}
|
|
69831
|
+
],
|
|
69832
|
+
name: "getRoleMember",
|
|
69833
|
+
outputs: [
|
|
69834
|
+
{
|
|
69835
|
+
internalType: "address",
|
|
69836
|
+
name: "",
|
|
69837
|
+
type: "address"
|
|
69838
|
+
}
|
|
69839
|
+
],
|
|
69840
|
+
stateMutability: "view",
|
|
69841
|
+
type: "function"
|
|
69842
|
+
},
|
|
69843
|
+
{
|
|
69844
|
+
inputs: [
|
|
69845
|
+
{
|
|
69846
|
+
internalType: "bytes32",
|
|
69847
|
+
name: "role",
|
|
69848
|
+
type: "bytes32"
|
|
69849
|
+
}
|
|
69850
|
+
],
|
|
69851
|
+
name: "getRoleMemberCount",
|
|
69852
|
+
outputs: [
|
|
69853
|
+
{
|
|
69854
|
+
internalType: "uint256",
|
|
69855
|
+
name: "",
|
|
69856
|
+
type: "uint256"
|
|
69857
|
+
}
|
|
69858
|
+
],
|
|
69859
|
+
stateMutability: "view",
|
|
69860
|
+
type: "function"
|
|
69861
|
+
},
|
|
69862
|
+
{
|
|
69863
|
+
inputs: [
|
|
69864
|
+
{
|
|
69865
|
+
internalType: "address",
|
|
69866
|
+
name: "owner",
|
|
69867
|
+
type: "address"
|
|
69868
|
+
},
|
|
69869
|
+
{
|
|
69870
|
+
internalType: "uint256",
|
|
69871
|
+
name: "start",
|
|
69872
|
+
type: "uint256"
|
|
69873
|
+
},
|
|
69874
|
+
{
|
|
69875
|
+
internalType: "uint256",
|
|
69876
|
+
name: "end",
|
|
69877
|
+
type: "uint256"
|
|
69878
|
+
}
|
|
69879
|
+
],
|
|
69880
|
+
name: "getTokensOfOwnerByIndexes",
|
|
69881
|
+
outputs: [
|
|
69882
|
+
{
|
|
69883
|
+
components: [
|
|
69884
|
+
{
|
|
69885
|
+
internalType: "uint256",
|
|
69886
|
+
name: "tokenId",
|
|
69887
|
+
type: "uint256"
|
|
69888
|
+
},
|
|
69889
|
+
{
|
|
69890
|
+
internalType: "address",
|
|
69891
|
+
name: "billAddress",
|
|
69892
|
+
type: "address"
|
|
69893
|
+
}
|
|
69894
|
+
],
|
|
69895
|
+
internalType: "struct BillNft.TokenData[]",
|
|
69896
|
+
name: "",
|
|
69897
|
+
type: "tuple[]"
|
|
69898
|
+
}
|
|
69899
|
+
],
|
|
69900
|
+
stateMutability: "view",
|
|
69901
|
+
type: "function"
|
|
69902
|
+
},
|
|
69903
|
+
{
|
|
69904
|
+
inputs: [
|
|
69905
|
+
{
|
|
69906
|
+
internalType: "bytes32",
|
|
69907
|
+
name: "role",
|
|
69908
|
+
type: "bytes32"
|
|
69909
|
+
},
|
|
69910
|
+
{
|
|
69911
|
+
internalType: "address",
|
|
69912
|
+
name: "account",
|
|
69913
|
+
type: "address"
|
|
69914
|
+
}
|
|
69915
|
+
],
|
|
69916
|
+
name: "grantRole",
|
|
69917
|
+
outputs: [
|
|
69918
|
+
],
|
|
69919
|
+
stateMutability: "nonpayable",
|
|
69920
|
+
type: "function"
|
|
69921
|
+
},
|
|
69922
|
+
{
|
|
69923
|
+
inputs: [
|
|
69924
|
+
{
|
|
69925
|
+
internalType: "bytes32",
|
|
69926
|
+
name: "role",
|
|
69927
|
+
type: "bytes32"
|
|
69928
|
+
},
|
|
69929
|
+
{
|
|
69930
|
+
internalType: "address",
|
|
69931
|
+
name: "account",
|
|
69932
|
+
type: "address"
|
|
69933
|
+
}
|
|
69934
|
+
],
|
|
69935
|
+
name: "hasRole",
|
|
69936
|
+
outputs: [
|
|
69937
|
+
{
|
|
69938
|
+
internalType: "bool",
|
|
69939
|
+
name: "",
|
|
69940
|
+
type: "bool"
|
|
69941
|
+
}
|
|
69942
|
+
],
|
|
69943
|
+
stateMutability: "view",
|
|
69944
|
+
type: "function"
|
|
69945
|
+
},
|
|
69946
|
+
{
|
|
69947
|
+
inputs: [
|
|
69948
|
+
{
|
|
69949
|
+
internalType: "string",
|
|
69950
|
+
name: "name",
|
|
69951
|
+
type: "string"
|
|
69952
|
+
},
|
|
69953
|
+
{
|
|
69954
|
+
internalType: "string",
|
|
69955
|
+
name: "symbol",
|
|
69956
|
+
type: "string"
|
|
69957
|
+
},
|
|
69958
|
+
{
|
|
69959
|
+
internalType: "string",
|
|
69960
|
+
name: "baseTokenURI",
|
|
69961
|
+
type: "string"
|
|
69962
|
+
},
|
|
69963
|
+
{
|
|
69964
|
+
internalType: "address",
|
|
69965
|
+
name: "factory",
|
|
69966
|
+
type: "address"
|
|
69967
|
+
},
|
|
69968
|
+
{
|
|
69969
|
+
internalType: "address",
|
|
69970
|
+
name: "owner",
|
|
69971
|
+
type: "address"
|
|
69972
|
+
}
|
|
69973
|
+
],
|
|
69974
|
+
name: "initialize",
|
|
69975
|
+
outputs: [
|
|
69976
|
+
],
|
|
69977
|
+
stateMutability: "nonpayable",
|
|
69978
|
+
type: "function"
|
|
69979
|
+
},
|
|
69980
|
+
{
|
|
69981
|
+
inputs: [
|
|
69982
|
+
{
|
|
69983
|
+
internalType: "address",
|
|
69984
|
+
name: "owner",
|
|
69985
|
+
type: "address"
|
|
69986
|
+
},
|
|
69987
|
+
{
|
|
69988
|
+
internalType: "address",
|
|
69989
|
+
name: "operator",
|
|
69990
|
+
type: "address"
|
|
69991
|
+
}
|
|
69992
|
+
],
|
|
69993
|
+
name: "isApprovedForAll",
|
|
69994
|
+
outputs: [
|
|
69995
|
+
{
|
|
69996
|
+
internalType: "bool",
|
|
69997
|
+
name: "",
|
|
69998
|
+
type: "bool"
|
|
69999
|
+
}
|
|
70000
|
+
],
|
|
70001
|
+
stateMutability: "view",
|
|
70002
|
+
type: "function"
|
|
70003
|
+
},
|
|
70004
|
+
{
|
|
70005
|
+
inputs: [
|
|
70006
|
+
],
|
|
70007
|
+
name: "lockURI",
|
|
70008
|
+
outputs: [
|
|
70009
|
+
],
|
|
70010
|
+
stateMutability: "nonpayable",
|
|
70011
|
+
type: "function"
|
|
70012
|
+
},
|
|
70013
|
+
{
|
|
70014
|
+
inputs: [
|
|
70015
|
+
{
|
|
70016
|
+
internalType: "address",
|
|
70017
|
+
name: "to",
|
|
70018
|
+
type: "address"
|
|
70019
|
+
},
|
|
70020
|
+
{
|
|
70021
|
+
internalType: "address",
|
|
70022
|
+
name: "billAddress",
|
|
70023
|
+
type: "address"
|
|
70024
|
+
}
|
|
70025
|
+
],
|
|
70026
|
+
name: "mint",
|
|
70027
|
+
outputs: [
|
|
70028
|
+
{
|
|
70029
|
+
internalType: "uint256",
|
|
70030
|
+
name: "newTokenId",
|
|
70031
|
+
type: "uint256"
|
|
70032
|
+
}
|
|
70033
|
+
],
|
|
70034
|
+
stateMutability: "nonpayable",
|
|
70035
|
+
type: "function"
|
|
70036
|
+
},
|
|
70037
|
+
{
|
|
70038
|
+
inputs: [
|
|
70039
|
+
{
|
|
70040
|
+
internalType: "uint256",
|
|
70041
|
+
name: "amount",
|
|
70042
|
+
type: "uint256"
|
|
70043
|
+
},
|
|
70044
|
+
{
|
|
70045
|
+
internalType: "address",
|
|
70046
|
+
name: "to",
|
|
70047
|
+
type: "address"
|
|
70048
|
+
},
|
|
70049
|
+
{
|
|
70050
|
+
internalType: "address",
|
|
70051
|
+
name: "billAddress",
|
|
70052
|
+
type: "address"
|
|
70053
|
+
}
|
|
70054
|
+
],
|
|
70055
|
+
name: "mintMany",
|
|
70056
|
+
outputs: [
|
|
70057
|
+
],
|
|
70058
|
+
stateMutability: "nonpayable",
|
|
70059
|
+
type: "function"
|
|
70060
|
+
},
|
|
70061
|
+
{
|
|
70062
|
+
inputs: [
|
|
70063
|
+
],
|
|
70064
|
+
name: "name",
|
|
70065
|
+
outputs: [
|
|
70066
|
+
{
|
|
70067
|
+
internalType: "string",
|
|
70068
|
+
name: "",
|
|
70069
|
+
type: "string"
|
|
70070
|
+
}
|
|
70071
|
+
],
|
|
70072
|
+
stateMutability: "view",
|
|
70073
|
+
type: "function"
|
|
70074
|
+
},
|
|
70075
|
+
{
|
|
70076
|
+
inputs: [
|
|
70077
|
+
{
|
|
70078
|
+
internalType: "uint256",
|
|
70079
|
+
name: "tokenId",
|
|
70080
|
+
type: "uint256"
|
|
70081
|
+
}
|
|
70082
|
+
],
|
|
70083
|
+
name: "ownerOf",
|
|
70084
|
+
outputs: [
|
|
70085
|
+
{
|
|
70086
|
+
internalType: "address",
|
|
70087
|
+
name: "",
|
|
70088
|
+
type: "address"
|
|
70089
|
+
}
|
|
70090
|
+
],
|
|
70091
|
+
stateMutability: "view",
|
|
70092
|
+
type: "function"
|
|
70093
|
+
},
|
|
70094
|
+
{
|
|
70095
|
+
inputs: [
|
|
70096
|
+
{
|
|
70097
|
+
internalType: "bytes32",
|
|
70098
|
+
name: "role",
|
|
70099
|
+
type: "bytes32"
|
|
70100
|
+
},
|
|
70101
|
+
{
|
|
70102
|
+
internalType: "address",
|
|
70103
|
+
name: "account",
|
|
70104
|
+
type: "address"
|
|
70105
|
+
}
|
|
70106
|
+
],
|
|
70107
|
+
name: "renounceRole",
|
|
70108
|
+
outputs: [
|
|
70109
|
+
],
|
|
70110
|
+
stateMutability: "nonpayable",
|
|
70111
|
+
type: "function"
|
|
70112
|
+
},
|
|
70113
|
+
{
|
|
70114
|
+
inputs: [
|
|
70115
|
+
{
|
|
70116
|
+
internalType: "bytes32",
|
|
70117
|
+
name: "role",
|
|
70118
|
+
type: "bytes32"
|
|
70119
|
+
},
|
|
70120
|
+
{
|
|
70121
|
+
internalType: "address",
|
|
70122
|
+
name: "account",
|
|
70123
|
+
type: "address"
|
|
70124
|
+
}
|
|
70125
|
+
],
|
|
70126
|
+
name: "revokeRole",
|
|
70127
|
+
outputs: [
|
|
70128
|
+
],
|
|
70129
|
+
stateMutability: "nonpayable",
|
|
70130
|
+
type: "function"
|
|
70131
|
+
},
|
|
70132
|
+
{
|
|
70133
|
+
inputs: [
|
|
70134
|
+
{
|
|
70135
|
+
internalType: "address",
|
|
70136
|
+
name: "from",
|
|
70137
|
+
type: "address"
|
|
70138
|
+
},
|
|
70139
|
+
{
|
|
70140
|
+
internalType: "address",
|
|
70141
|
+
name: "to",
|
|
70142
|
+
type: "address"
|
|
70143
|
+
},
|
|
70144
|
+
{
|
|
70145
|
+
internalType: "uint256",
|
|
70146
|
+
name: "tokenId",
|
|
70147
|
+
type: "uint256"
|
|
70148
|
+
}
|
|
70149
|
+
],
|
|
70150
|
+
name: "safeTransferFrom",
|
|
70151
|
+
outputs: [
|
|
70152
|
+
],
|
|
70153
|
+
stateMutability: "nonpayable",
|
|
70154
|
+
type: "function"
|
|
70155
|
+
},
|
|
70156
|
+
{
|
|
70157
|
+
inputs: [
|
|
70158
|
+
{
|
|
70159
|
+
internalType: "address",
|
|
70160
|
+
name: "from",
|
|
70161
|
+
type: "address"
|
|
70162
|
+
},
|
|
70163
|
+
{
|
|
70164
|
+
internalType: "address",
|
|
70165
|
+
name: "to",
|
|
70166
|
+
type: "address"
|
|
70167
|
+
},
|
|
70168
|
+
{
|
|
70169
|
+
internalType: "uint256",
|
|
70170
|
+
name: "tokenId",
|
|
70171
|
+
type: "uint256"
|
|
70172
|
+
},
|
|
70173
|
+
{
|
|
70174
|
+
internalType: "bytes",
|
|
70175
|
+
name: "_data",
|
|
70176
|
+
type: "bytes"
|
|
70177
|
+
}
|
|
70178
|
+
],
|
|
70179
|
+
name: "safeTransferFrom",
|
|
70180
|
+
outputs: [
|
|
70181
|
+
],
|
|
70182
|
+
stateMutability: "nonpayable",
|
|
70183
|
+
type: "function"
|
|
70184
|
+
},
|
|
70185
|
+
{
|
|
70186
|
+
inputs: [
|
|
70187
|
+
{
|
|
70188
|
+
internalType: "address",
|
|
70189
|
+
name: "operator",
|
|
70190
|
+
type: "address"
|
|
70191
|
+
},
|
|
70192
|
+
{
|
|
70193
|
+
internalType: "bool",
|
|
70194
|
+
name: "approved",
|
|
70195
|
+
type: "bool"
|
|
70196
|
+
}
|
|
70197
|
+
],
|
|
70198
|
+
name: "setApprovalForAll",
|
|
70199
|
+
outputs: [
|
|
70200
|
+
],
|
|
70201
|
+
stateMutability: "nonpayable",
|
|
70202
|
+
type: "function"
|
|
70203
|
+
},
|
|
70204
|
+
{
|
|
70205
|
+
inputs: [
|
|
70206
|
+
{
|
|
70207
|
+
internalType: "string",
|
|
70208
|
+
name: "baseTokenURI",
|
|
70209
|
+
type: "string"
|
|
70210
|
+
}
|
|
70211
|
+
],
|
|
70212
|
+
name: "setBaseURI",
|
|
70213
|
+
outputs: [
|
|
70214
|
+
],
|
|
70215
|
+
stateMutability: "nonpayable",
|
|
70216
|
+
type: "function"
|
|
70217
|
+
},
|
|
70218
|
+
{
|
|
70219
|
+
inputs: [
|
|
70220
|
+
{
|
|
70221
|
+
internalType: "bytes4",
|
|
70222
|
+
name: "interfaceId",
|
|
70223
|
+
type: "bytes4"
|
|
70224
|
+
}
|
|
70225
|
+
],
|
|
70226
|
+
name: "supportsInterface",
|
|
70227
|
+
outputs: [
|
|
70228
|
+
{
|
|
70229
|
+
internalType: "bool",
|
|
70230
|
+
name: "",
|
|
70231
|
+
type: "bool"
|
|
70232
|
+
}
|
|
70233
|
+
],
|
|
70234
|
+
stateMutability: "view",
|
|
70235
|
+
type: "function"
|
|
70236
|
+
},
|
|
70237
|
+
{
|
|
70238
|
+
inputs: [
|
|
70239
|
+
],
|
|
70240
|
+
name: "symbol",
|
|
70241
|
+
outputs: [
|
|
70242
|
+
{
|
|
70243
|
+
internalType: "string",
|
|
70244
|
+
name: "",
|
|
70245
|
+
type: "string"
|
|
70246
|
+
}
|
|
70247
|
+
],
|
|
70248
|
+
stateMutability: "view",
|
|
70249
|
+
type: "function"
|
|
70250
|
+
},
|
|
70251
|
+
{
|
|
70252
|
+
inputs: [
|
|
70253
|
+
{
|
|
70254
|
+
internalType: "uint256",
|
|
70255
|
+
name: "index",
|
|
70256
|
+
type: "uint256"
|
|
70257
|
+
}
|
|
70258
|
+
],
|
|
70259
|
+
name: "tokenByIndex",
|
|
70260
|
+
outputs: [
|
|
70261
|
+
{
|
|
70262
|
+
internalType: "uint256",
|
|
70263
|
+
name: "",
|
|
70264
|
+
type: "uint256"
|
|
70265
|
+
}
|
|
70266
|
+
],
|
|
70267
|
+
stateMutability: "view",
|
|
70268
|
+
type: "function"
|
|
70269
|
+
},
|
|
70270
|
+
{
|
|
70271
|
+
inputs: [
|
|
70272
|
+
{
|
|
70273
|
+
internalType: "address",
|
|
70274
|
+
name: "owner",
|
|
70275
|
+
type: "address"
|
|
70276
|
+
},
|
|
70277
|
+
{
|
|
70278
|
+
internalType: "uint256",
|
|
70279
|
+
name: "index",
|
|
70280
|
+
type: "uint256"
|
|
70281
|
+
}
|
|
70282
|
+
],
|
|
70283
|
+
name: "tokenDataOfOwnerByIndex",
|
|
70284
|
+
outputs: [
|
|
70285
|
+
{
|
|
70286
|
+
components: [
|
|
70287
|
+
{
|
|
70288
|
+
internalType: "uint256",
|
|
70289
|
+
name: "tokenId",
|
|
70290
|
+
type: "uint256"
|
|
70291
|
+
},
|
|
70292
|
+
{
|
|
70293
|
+
internalType: "address",
|
|
70294
|
+
name: "billAddress",
|
|
70295
|
+
type: "address"
|
|
70296
|
+
}
|
|
70297
|
+
],
|
|
70298
|
+
internalType: "struct BillNft.TokenData",
|
|
70299
|
+
name: "tokenData",
|
|
70300
|
+
type: "tuple"
|
|
70301
|
+
}
|
|
70302
|
+
],
|
|
70303
|
+
stateMutability: "view",
|
|
70304
|
+
type: "function"
|
|
70305
|
+
},
|
|
70306
|
+
{
|
|
70307
|
+
inputs: [
|
|
70308
|
+
{
|
|
70309
|
+
internalType: "address",
|
|
70310
|
+
name: "owner",
|
|
70311
|
+
type: "address"
|
|
70312
|
+
},
|
|
70313
|
+
{
|
|
70314
|
+
internalType: "uint256",
|
|
70315
|
+
name: "index",
|
|
70316
|
+
type: "uint256"
|
|
70317
|
+
}
|
|
70318
|
+
],
|
|
70319
|
+
name: "tokenOfOwnerByIndex",
|
|
70320
|
+
outputs: [
|
|
70321
|
+
{
|
|
70322
|
+
internalType: "uint256",
|
|
70323
|
+
name: "",
|
|
70324
|
+
type: "uint256"
|
|
70325
|
+
}
|
|
70326
|
+
],
|
|
70327
|
+
stateMutability: "view",
|
|
70328
|
+
type: "function"
|
|
70329
|
+
},
|
|
70330
|
+
{
|
|
70331
|
+
inputs: [
|
|
70332
|
+
{
|
|
70333
|
+
internalType: "uint256",
|
|
70334
|
+
name: "tokenId",
|
|
70335
|
+
type: "uint256"
|
|
70336
|
+
}
|
|
70337
|
+
],
|
|
70338
|
+
name: "tokenURI",
|
|
70339
|
+
outputs: [
|
|
70340
|
+
{
|
|
70341
|
+
internalType: "string",
|
|
70342
|
+
name: "",
|
|
70343
|
+
type: "string"
|
|
70344
|
+
}
|
|
70345
|
+
],
|
|
70346
|
+
stateMutability: "view",
|
|
70347
|
+
type: "function"
|
|
70348
|
+
},
|
|
70349
|
+
{
|
|
70350
|
+
inputs: [
|
|
70351
|
+
],
|
|
70352
|
+
name: "totalSupply",
|
|
70353
|
+
outputs: [
|
|
70354
|
+
{
|
|
70355
|
+
internalType: "uint256",
|
|
70356
|
+
name: "",
|
|
70357
|
+
type: "uint256"
|
|
70358
|
+
}
|
|
70359
|
+
],
|
|
70360
|
+
stateMutability: "view",
|
|
70361
|
+
type: "function"
|
|
70362
|
+
},
|
|
70363
|
+
{
|
|
70364
|
+
inputs: [
|
|
70365
|
+
{
|
|
70366
|
+
internalType: "address",
|
|
70367
|
+
name: "from",
|
|
70368
|
+
type: "address"
|
|
70369
|
+
},
|
|
70370
|
+
{
|
|
70371
|
+
internalType: "address",
|
|
70372
|
+
name: "to",
|
|
70373
|
+
type: "address"
|
|
70374
|
+
},
|
|
70375
|
+
{
|
|
70376
|
+
internalType: "uint256",
|
|
70377
|
+
name: "tokenId",
|
|
70378
|
+
type: "uint256"
|
|
70379
|
+
}
|
|
70380
|
+
],
|
|
70381
|
+
name: "transferFrom",
|
|
70382
|
+
outputs: [
|
|
70383
|
+
],
|
|
70384
|
+
stateMutability: "nonpayable",
|
|
70385
|
+
type: "function"
|
|
70386
|
+
},
|
|
70387
|
+
{
|
|
70388
|
+
inputs: [
|
|
70389
|
+
],
|
|
70390
|
+
name: "uriLocked",
|
|
70391
|
+
outputs: [
|
|
70392
|
+
{
|
|
70393
|
+
internalType: "bool",
|
|
70394
|
+
name: "",
|
|
70395
|
+
type: "bool"
|
|
70396
|
+
}
|
|
70397
|
+
],
|
|
70398
|
+
stateMutability: "view",
|
|
70399
|
+
type: "function"
|
|
70400
|
+
}
|
|
70401
|
+
];
|
|
70402
|
+
|
|
70403
|
+
const useMonitorTx = (txHash, chainId) => {
|
|
70404
|
+
const { addToastError, addToastSuccess } = usePopups();
|
|
70405
|
+
const transactionReceipt = useWaitForTransactionReceipt({
|
|
70406
|
+
confirmations: 0,
|
|
70407
|
+
chainId: chainId,
|
|
70408
|
+
hash: txHash,
|
|
70409
|
+
});
|
|
70410
|
+
const { isLoading, isSuccess: isConfirmed, error, isError, data } = transactionReceipt !== null && transactionReceipt !== void 0 ? transactionReceipt : {};
|
|
70411
|
+
useEffect(() => {
|
|
70412
|
+
if (txHash && isError) {
|
|
70413
|
+
addToastError(error.message, txHash, chainId);
|
|
70414
|
+
}
|
|
70415
|
+
if (txHash && isConfirmed) {
|
|
70416
|
+
addToastSuccess(txHash, chainId);
|
|
70417
|
+
}
|
|
70418
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
70419
|
+
}, [txHash, isError, isConfirmed, isLoading]);
|
|
70420
|
+
return { isLoading, isSuccess: isConfirmed, data };
|
|
70421
|
+
};
|
|
70216
70422
|
|
|
70217
|
-
|
|
70218
|
-
var _a, _b, _c
|
|
70219
|
-
|
|
70220
|
-
const
|
|
70221
|
-
const
|
|
70222
|
-
|
|
70223
|
-
};
|
|
70224
|
-
|
|
70423
|
+
const TransferAction$1 = ({ userBill, toAddress, disabled, }) => {
|
|
70424
|
+
var _a, _b, _c;
|
|
70425
|
+
// Hooks
|
|
70426
|
+
const SDKConfig = useSDKConfig();
|
|
70427
|
+
const userChainId = useChainId();
|
|
70428
|
+
const { address: account } = useEVMAccount();
|
|
70429
|
+
const { switchChain } = useSwitchChain();
|
|
70430
|
+
// State
|
|
70431
|
+
const [transferTxHash, setTransferTxHash] = useState(null);
|
|
70432
|
+
const [loadingTx, setLoadingTx] = useState(false);
|
|
70433
|
+
const { writeContractAsync } = useWriteContract();
|
|
70434
|
+
const { isLoading, isSuccess: isConfirmed } = useMonitorTx(transferTxHash, (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId);
|
|
70435
|
+
const { addToastError } = usePopups();
|
|
70436
|
+
const load = loadingTx || (isLoading && !isConfirmed);
|
|
70437
|
+
const handleTransfer = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70225
70438
|
var _a, _b, _c, _d;
|
|
70226
|
-
|
|
70227
|
-
return (_c = data === null || data === void 0 ? void 0 : data.data) === null || _c === void 0 ? void 0 : _c.token0.symbol;
|
|
70228
|
-
return (_d = data === null || data === void 0 ? void 0 : data.data) === null || _d === void 0 ? void 0 : _d.token1.symbol;
|
|
70229
|
-
};
|
|
70230
|
-
const getCalculateOff = () => {
|
|
70231
|
-
if (!data || !data.data)
|
|
70232
|
-
return 0;
|
|
70233
|
-
return 100 - (data.data.dollarValue / (data.data.payout * +data.data.payoutTokenPrice)) * 100;
|
|
70234
|
-
};
|
|
70235
|
-
const getCalculatePriceDiscount = () => {
|
|
70236
|
-
if (!data || !data.data)
|
|
70237
|
-
return 0;
|
|
70238
|
-
return +data.data.payoutTokenPrice - (+data.data.payoutTokenPrice * getCalculateOff()) / 100;
|
|
70239
|
-
};
|
|
70240
|
-
return `
|
|
70241
|
-
<div id="template-card" class="sharebondimage-card">
|
|
70242
|
-
<img src="/images/bills/title.png" alt="title" style="width: 169px; height: 52px;" />
|
|
70243
|
-
<div class="sharebondimage-nft">
|
|
70244
|
-
<div style="position: relative">
|
|
70245
|
-
<div class="sharebondimage-nft-id">
|
|
70246
|
-
<span>#${data.tokenId}</span>
|
|
70247
|
-
</div>
|
|
70248
|
-
<img src="${data.image}" alt="bill-nft" />
|
|
70249
|
-
</div>
|
|
70250
|
-
</div>
|
|
70251
|
-
<div class="sharebondimage-container-info">
|
|
70252
|
-
<div class="sharebondimage-container-discount">
|
|
70253
|
-
<img src="${getTokenImage((_e = (_d = data === null || data === void 0 ? void 0 : data.data) === null || _d === void 0 ? void 0 : _d.payoutTokenData) === null || _e === void 0 ? void 0 : _e.symbol)}" alt="payout-token-symbol" style="width: 59px; height: 59px;" />
|
|
70254
|
-
<div class="sharebondimage-container-discount-price">
|
|
70255
|
-
<div class="sharebondimage-container-discount-token">
|
|
70256
|
-
<span>${(_f = data.data) === null || _f === void 0 ? void 0 : _f.payoutTokenData.symbol}</span>
|
|
70257
|
-
<span style="text-decoration: line-through">
|
|
70258
|
-
$${formatTransactionAmount(+((_g = data === null || data === void 0 ? void 0 : data.data) === null || _g === void 0 ? void 0 : _g.payoutTokenPrice))}
|
|
70259
|
-
</span>
|
|
70260
|
-
</div>
|
|
70261
|
-
<span class="sharebondimage-container-discount-price-discount">
|
|
70262
|
-
$${formatTransactionAmount(getCalculatePriceDiscount())}
|
|
70263
|
-
</span>
|
|
70264
|
-
</div>
|
|
70265
|
-
<div class="sharebondimage-container-off">
|
|
70266
|
-
<span>
|
|
70267
|
-
${localeFormat(getCalculateOff())}% OFF
|
|
70268
|
-
</span>
|
|
70269
|
-
</div>
|
|
70270
|
-
</div>
|
|
70271
|
-
<div class="sharebondimage-container-tokens">
|
|
70272
|
-
<div class="sharebondimage-container-token">
|
|
70273
|
-
<img src="${getTokenImage((_h = getPrincipalToken()) !== null && _h !== void 0 ? _h : '')}" alt="principal-symbol" />
|
|
70274
|
-
<div class="sharebondimage-amount-deposit">
|
|
70275
|
-
${formatTransactionAmount((_j = data === null || data === void 0 ? void 0 : data.data) === null || _j === void 0 ? void 0 : _j.deposit)}
|
|
70276
|
-
</div>
|
|
70277
|
-
<div class="sharebondimage-dollarvalue">
|
|
70278
|
-
$${localeFormat((_k = data === null || data === void 0 ? void 0 : data.data) === null || _k === void 0 ? void 0 : _k.dollarValue)}
|
|
70279
|
-
</div>
|
|
70280
|
-
</div>
|
|
70281
|
-
<div class="sharebondimage-container-token">
|
|
70282
|
-
<img src="${getTokenImage((_m = (_l = data === null || data === void 0 ? void 0 : data.data) === null || _l === void 0 ? void 0 : _l.payoutTokenData) === null || _m === void 0 ? void 0 : _m.symbol)}" alt="payout-token2-symbol" />
|
|
70283
|
-
<div class="sharebondimage-container-earntoken">
|
|
70284
|
-
<div class="sharebondimage-amount-earntoken">
|
|
70285
|
-
<div class="sharebondimage-amount-payout">
|
|
70286
|
-
${localeFormat((_o = data === null || data === void 0 ? void 0 : data.data) === null || _o === void 0 ? void 0 : _o.payout)}
|
|
70287
|
-
</div>
|
|
70288
|
-
<div class="sharebondimage-amount-dollarvalue">
|
|
70289
|
-
$${localeFormat(((_p = data === null || data === void 0 ? void 0 : data.data) === null || _p === void 0 ? void 0 : _p.payout) * +((_q = data === null || data === void 0 ? void 0 : data.data) === null || _q === void 0 ? void 0 : _q.payoutTokenPrice))}
|
|
70290
|
-
</div>
|
|
70291
|
-
</div>
|
|
70292
|
-
<div class="sharebondimage-profit" style="${!isProfit ? 'display: none' : ''}">
|
|
70293
|
-
<span>
|
|
70294
|
-
+${localeFormat(((_r = data === null || data === void 0 ? void 0 : data.data) === null || _r === void 0 ? void 0 : _r.payout) * +((_s = data === null || data === void 0 ? void 0 : data.data) === null || _s === void 0 ? void 0 : _s.payoutTokenPrice) - ((_t = data === null || data === void 0 ? void 0 : data.data) === null || _t === void 0 ? void 0 : _t.dollarValue))}
|
|
70295
|
-
profit!
|
|
70296
|
-
</span>
|
|
70297
|
-
</div>
|
|
70298
|
-
</div>
|
|
70299
|
-
</div>
|
|
70300
|
-
</div>
|
|
70301
|
-
</div>
|
|
70302
|
-
</div>
|
|
70303
|
-
`;
|
|
70304
|
-
}
|
|
70305
|
-
|
|
70306
|
-
function generateImageFromTemplate(bondNFTData, link, apiUrl) {
|
|
70307
|
-
return __awaiter$9(this, void 0, void 0, function* () {
|
|
70308
|
-
var _a;
|
|
70309
|
-
if (bondNFTData && bondNFTData.data) {
|
|
70310
|
-
const container = document.createElement('div');
|
|
70311
|
-
container.style.position = 'absolute';
|
|
70312
|
-
container.style.top = '-9999px';
|
|
70313
|
-
container.innerHTML = getTemplateHTML(bondNFTData);
|
|
70314
|
-
document.body.appendChild(container);
|
|
70315
|
-
const templateElement = container.querySelector('#template-card');
|
|
70316
|
-
if (!templateElement)
|
|
70317
|
-
return;
|
|
70318
|
-
const fileName = `bond_share_${(_a = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data.billNftAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()}_${bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.chainId}_${bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.tokenId}`;
|
|
70319
|
-
const existingImage = yield checkImageExists(fileName);
|
|
70320
|
-
if (existingImage) {
|
|
70321
|
-
share(link);
|
|
70322
|
-
}
|
|
70323
|
-
else {
|
|
70324
|
-
try {
|
|
70325
|
-
const dataImage = yield domtoimage.toJpeg(templateElement, { quality: 0.85 });
|
|
70326
|
-
const response = yield fetch(dataImage);
|
|
70327
|
-
const blob = yield response.blob();
|
|
70328
|
-
const formData = new FormData();
|
|
70329
|
-
formData.append('file', blob, fileName);
|
|
70330
|
-
yield axios.post(`${apiUrl}/cloudinary/uploadFile`, formData, {
|
|
70331
|
-
headers: { 'Content-Type': 'multipart/form-data' },
|
|
70332
|
-
});
|
|
70333
|
-
}
|
|
70334
|
-
catch (error) {
|
|
70335
|
-
console.error('Error upload file to cloudinary', error);
|
|
70336
|
-
}
|
|
70337
|
-
share(link);
|
|
70338
|
-
}
|
|
70339
|
-
}
|
|
70340
|
-
});
|
|
70341
|
-
}
|
|
70342
|
-
function share(link) {
|
|
70343
|
-
const linkElement = document.createElement('a');
|
|
70344
|
-
linkElement.href = link;
|
|
70345
|
-
linkElement.target = '_blank';
|
|
70346
|
-
linkElement.click();
|
|
70347
|
-
}
|
|
70348
|
-
function checkImageExists(fileName) {
|
|
70349
|
-
return __awaiter$9(this, void 0, void 0, function* () {
|
|
70350
|
-
let existImg = true;
|
|
70439
|
+
const address = userBill === null || userBill === void 0 ? void 0 : userBill.billNftAddress;
|
|
70351
70440
|
try {
|
|
70352
|
-
|
|
70441
|
+
setLoadingTx(true);
|
|
70442
|
+
const tx = yield writeContractAsync({
|
|
70443
|
+
address: address,
|
|
70444
|
+
abi: BOND_NFT_ABI,
|
|
70445
|
+
functionName: 'safeTransferFrom',
|
|
70446
|
+
args: [account, toAddress, userBill === null || userBill === void 0 ? void 0 : userBill.id],
|
|
70447
|
+
chain: userChainId,
|
|
70448
|
+
account: account,
|
|
70449
|
+
});
|
|
70450
|
+
if (tx) {
|
|
70451
|
+
setTransferTxHash(tx);
|
|
70452
|
+
track({
|
|
70453
|
+
event: 'bond',
|
|
70454
|
+
chain: userChainId,
|
|
70455
|
+
data: {
|
|
70456
|
+
cat: 'transfer',
|
|
70457
|
+
type: (_b = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.billType) !== null && _b !== void 0 ? _b : '',
|
|
70458
|
+
id: userBill === null || userBill === void 0 ? void 0 : userBill.id,
|
|
70459
|
+
from: account,
|
|
70460
|
+
to: toAddress,
|
|
70461
|
+
earnToken: (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.earnToken.symbol,
|
|
70462
|
+
},
|
|
70463
|
+
});
|
|
70464
|
+
}
|
|
70465
|
+
setLoadingTx(false);
|
|
70353
70466
|
}
|
|
70354
|
-
catch (
|
|
70355
|
-
|
|
70467
|
+
catch (error) {
|
|
70468
|
+
console.error('Transfer failed:', error);
|
|
70469
|
+
setLoadingTx(false);
|
|
70470
|
+
addToastError(error.shortMessage);
|
|
70471
|
+
reportError$1({
|
|
70472
|
+
apiUrl: (_d = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _d === void 0 ? void 0 : _d.apiV2,
|
|
70473
|
+
error,
|
|
70474
|
+
extraInfo: { type: 'transfer', userBill, error },
|
|
70475
|
+
chainId: userChainId,
|
|
70476
|
+
account,
|
|
70477
|
+
});
|
|
70356
70478
|
}
|
|
70357
|
-
return existImg;
|
|
70358
70479
|
});
|
|
70359
|
-
}
|
|
70480
|
+
return (jsx$2(Fragment$1, { children: userChainId !== ((_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.chainId) ? (jsxs(Button, { onClick: () => { var _a; return switchChain({ chainId: (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId }); }, children: ["Switch to ", NETWORK_LABEL[(_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.chainId]] })) : (jsx$2(Button, { onClick: handleTransfer, load: load, disabled: load || disabled, fullWidth: true, children: "transfer" })) }));
|
|
70481
|
+
};
|
|
70360
70482
|
|
|
70361
|
-
const
|
|
70362
|
-
var _a
|
|
70363
|
-
// State
|
|
70364
|
-
const [isLoading, setIsLoading] = useState([false, false]);
|
|
70365
|
-
// Static data
|
|
70366
|
-
const bondNFTData = userBill === null || userBill === void 0 ? void 0 : userBill.nftData;
|
|
70367
|
-
const chainId = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId;
|
|
70483
|
+
const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
70484
|
+
var _a;
|
|
70368
70485
|
// Hooks
|
|
70369
|
-
const
|
|
70370
|
-
const
|
|
70371
|
-
const
|
|
70372
|
-
|
|
70373
|
-
const
|
|
70486
|
+
const wallet = useSOLAccount();
|
|
70487
|
+
const { setVisible } = useWalletModal();
|
|
70488
|
+
const { refetch } = useUserBonds();
|
|
70489
|
+
// State
|
|
70490
|
+
const [loadingTx, setLoadingTx] = useState(false);
|
|
70491
|
+
const { addToastError, addToastSuccess } = usePopups();
|
|
70492
|
+
const load = loadingTx;
|
|
70493
|
+
const handleTransfer = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70374
70494
|
var _a;
|
|
70375
|
-
|
|
70376
|
-
|
|
70377
|
-
|
|
70495
|
+
try {
|
|
70496
|
+
if (!wallet.publicKey || !wallet.signTransaction) {
|
|
70497
|
+
throw new Error('Wallet not connected');
|
|
70498
|
+
}
|
|
70499
|
+
setLoadingTx(true);
|
|
70500
|
+
const connection = new Connection(getRPC(types$1.ChainId.SOL));
|
|
70501
|
+
// MPL Core program ID
|
|
70502
|
+
if (!(userBill === null || userBill === void 0 ? void 0 : userBill.id) || !toAddress || !userBill || !(userBill === null || userBill === void 0 ? void 0 : userBill.asset))
|
|
70503
|
+
return;
|
|
70504
|
+
const asset = new PublicKey(userBill === null || userBill === void 0 ? void 0 : userBill.asset);
|
|
70505
|
+
const newOwner = new PublicKey(toAddress);
|
|
70506
|
+
const collection = new PublicKey(userBill.billNftAddress);
|
|
70507
|
+
// Create instruction data with discriminator (14) + null compression_proof
|
|
70508
|
+
// Since compression_proof is null, we just need discriminator + 1 byte for None option
|
|
70509
|
+
const discriminator = buffer.Buffer.from([14]);
|
|
70510
|
+
const nullOption = buffer.Buffer.from([0]); // 0 = None for Option<CompressionProof>
|
|
70511
|
+
const data = buffer.Buffer.concat([discriminator, nullOption]);
|
|
70512
|
+
// Build the accounts array according to MPL Core transfer instruction
|
|
70513
|
+
const accounts = [
|
|
70514
|
+
{ pubkey: asset, isSigner: false, isWritable: true }, // asset
|
|
70515
|
+
{ pubkey: collection, isSigner: false, isWritable: false }, // collection
|
|
70516
|
+
{ pubkey: wallet.publicKey, isSigner: true, isWritable: true }, // payer
|
|
70517
|
+
{ pubkey: wallet.publicKey, isSigner: true, isWritable: false }, // authority
|
|
70518
|
+
{ pubkey: newOwner, isSigner: false, isWritable: false }, // new_owner
|
|
70519
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, // system_program
|
|
70520
|
+
{ pubkey: new PublicKey('noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV'), isSigner: false, isWritable: false }, // log_wrapper (SPL Noop Program)
|
|
70521
|
+
];
|
|
70522
|
+
const transferInstruction = new TransactionInstruction({
|
|
70523
|
+
keys: accounts,
|
|
70524
|
+
programId: MPL_CORE_PROGRAM_ID,
|
|
70525
|
+
data,
|
|
70526
|
+
});
|
|
70527
|
+
const transaction = new Transaction().add(transferInstruction);
|
|
70528
|
+
// Get recent blockhash
|
|
70529
|
+
const { blockhash, lastValidBlockHeight } = yield connection.getLatestBlockhash();
|
|
70530
|
+
transaction.recentBlockhash = blockhash;
|
|
70531
|
+
transaction.feePayer = wallet.publicKey;
|
|
70532
|
+
// Sign and send transaction
|
|
70533
|
+
const signedTransaction = yield wallet.signTransaction(transaction);
|
|
70534
|
+
const signature = yield connection.sendRawTransaction(signedTransaction.serialize());
|
|
70535
|
+
// Confirm transaction
|
|
70536
|
+
yield connection.confirmTransaction({
|
|
70537
|
+
signature,
|
|
70538
|
+
blockhash,
|
|
70539
|
+
lastValidBlockHeight,
|
|
70540
|
+
}, 'confirmed');
|
|
70541
|
+
refetch();
|
|
70542
|
+
addToastSuccess(signature, (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId);
|
|
70543
|
+
}
|
|
70544
|
+
catch (error) {
|
|
70545
|
+
console.error('Error during NFT transfer:', error);
|
|
70546
|
+
addToastError((error === null || error === void 0 ? void 0 : error.message) || 'Unknown error');
|
|
70547
|
+
}
|
|
70548
|
+
finally {
|
|
70549
|
+
setLoadingTx(false);
|
|
70378
70550
|
}
|
|
70379
|
-
track({
|
|
70380
|
-
event: 'referral',
|
|
70381
|
-
chain: chainId,
|
|
70382
|
-
data: {
|
|
70383
|
-
cat: `${social.toUpperCase()} Share Bond`,
|
|
70384
|
-
bond: (_a = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _a === void 0 ? void 0 : _a.payoutTokenData.symbol,
|
|
70385
|
-
},
|
|
70386
|
-
});
|
|
70387
|
-
setIsLoading([true, false] );
|
|
70388
|
-
yield generateImageFromTemplate(bondNFTData, url, apiUrl);
|
|
70389
|
-
setIsLoading([false, false]);
|
|
70390
70551
|
});
|
|
70391
|
-
return (jsxs(
|
|
70392
|
-
background: ['white3', 'white3', 'white3', 'white4'],
|
|
70393
|
-
borderRadius: 'normal',
|
|
70394
|
-
justifyContent: 'center',
|
|
70395
|
-
alignItems: 'center',
|
|
70396
|
-
p: '2px 10px 2px 5px',
|
|
70397
|
-
fontWeight: 600,
|
|
70398
|
-
fontSize: '12px',
|
|
70399
|
-
height: '22px',
|
|
70400
|
-
cursor: 'pointer',
|
|
70401
|
-
'&:hover': {
|
|
70402
|
-
background: 'white5',
|
|
70403
|
-
},
|
|
70404
|
-
}, onClick: () => handleShare(`https://twitter.com/intent/tweet?text=${text}&url=${shareUrl}`, 'x'), children: [jsx$2(Flex, { children: isLoading[0] ? jsx$2(Spinner, { size: 16 }) : jsx$2(Svg, { icon: "twitter", width: 20 }) }), jsx$2(Flex, { children: "SHARE" })] }));
|
|
70552
|
+
return (jsx$2(Fragment$1, { children: !wallet.publicKey ? (jsxs(Button, { onClick: () => setVisible(true), children: ["Connect to ", NETWORK_LABEL[(_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId]] })) : (jsx$2(Button, { onClick: handleTransfer, load: load, disabled: load || disabled, fullWidth: true, children: "transfer" })) }));
|
|
70405
70553
|
};
|
|
70406
70554
|
|
|
70407
|
-
const
|
|
70408
|
-
|
|
70409
|
-
|
|
70410
|
-
|
|
70555
|
+
const TransferModal = ({ onDismiss, userBill }) => {
|
|
70556
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
70557
|
+
// State
|
|
70558
|
+
const [confirmSend, setConfirmSend] = useState(false);
|
|
70559
|
+
const [toAddress, setToAddress] = useState('');
|
|
70560
|
+
// Data
|
|
70561
|
+
const bond = userBill === null || userBill === void 0 ? void 0 : userBill.bond;
|
|
70562
|
+
const chainId = bond === null || bond === void 0 ? void 0 : bond.chainId;
|
|
70563
|
+
const pending = chainId &&
|
|
70564
|
+
((_e = getBalanceNumber(new BigNumber$1((_a = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _a !== void 0 ? _a : 0), (_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _b === void 0 ? void 0 : _b.decimals) === null || _c === void 0 ? void 0 : _c[chainId]) !== null && _d !== void 0 ? _d : 18)) === null || _e === void 0 ? void 0 : _e.toFixed(4));
|
|
70565
|
+
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond", children: [jsx$2(Flex, { sx: { mt: '20px' }, children: jsx$2(Text, { sx: { fontWeight: 700 }, children: " Transferring: " }) }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', mt: '30px', mr: '10px' }, children: [jsxs(Text, { sx: { fontWeight: 700, fontSize: '25px' }, children: [(_f = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _f === void 0 ? void 0 : _f.symbol, " Bond - ID # ", userBill === null || userBill === void 0 ? void 0 : userBill.id] }), jsxs(Flex, { sx: { mt: '5px' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', mr: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Vesting time" }), getTimeLeftForFullyVested(userBill) > 0 ? `Ends in ${getPendingVestingString(userBill)}` : `Fully Vested`] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Pending" }), jsxs(Flex, { children: [jsx$2(TokenImage, { symbol: (_h = (_g = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _g === void 0 ? void 0 : _g.showcaseTokenName) !== null && _h !== void 0 ? _h : (_k = (_j = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _j === void 0 ? void 0 : _j.earnToken) === null || _k === void 0 ? void 0 : _k.symbol, size: 20, chain: (_l = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _l === void 0 ? void 0 : _l.chainId }), jsx$2(Text, { sx: { fontWeight: 700, ml: '5px' }, children: pending })] })] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', mt: '30px' }, children: [jsx$2(Text, { sx: { fontWeight: 700 }, children: "Receiving Address:" }), jsx$2(Input, { mt: "10px", size: "lg", placeholder: 'Paste the address here', value: toAddress, onChange: (e) => setToAddress(e.target.value), style: { width: '345px', border: 'none' } })] }), jsx$2(Flex, { sx: { mt: '15px' }, children: jsxs(Text, { sx: { lineHeight: '18px', fontSize: '12px', color: 'rgba(223, 65, 65, 1)' }, children: [jsx$2(Text, { sx: { display: 'block', width: '100%', fontWeight: 700, fontSize: '13px', color: 'rgba(223, 65, 65, 1)' }, children: "WARNING" }), "When transfering the NFT all pending rewards will also be transfered to the receiver address."] }) }), jsxs(Flex, { onClick: () => setConfirmSend(!confirmSend), sx: { mt: '20px', cursor: 'pointer', alignItems: 'center' }, children: [jsx$2(Checkbox, { checked: confirmSend, onChange: (event) => {
|
|
70566
|
+
setConfirmSend(!confirmSend);
|
|
70567
|
+
event.stopPropagation();
|
|
70568
|
+
} }), jsx$2(Text, { sx: { ml: '10px', fontSize: '12px', fontWeight: 500, lineHeight: '18px' }, children: "I understand the new wallet gains ownership of all unclaimed assets." })] }), jsx$2(Flex, { sx: { justifyContent: 'center', mt: '15px' }, children: chainId === types$1.ChainId.SOL ? (jsx$2(TransferAction, { userBill: userBill, toAddress: toAddress, disabled: !confirmSend || !toAddress })) : (jsx$2(TransferAction$1, { userBill: userBill, toAddress: toAddress, disabled: !confirmSend || !toAddress })) })] }));
|
|
70411
70569
|
};
|
|
70570
|
+
var TransferBondModal = React__default.memo(TransferModal);
|
|
70412
70571
|
|
|
70413
|
-
const
|
|
70414
|
-
|
|
70415
|
-
|
|
70416
|
-
|
|
70417
|
-
|
|
70418
|
-
|
|
70419
|
-
|
|
70420
|
-
|
|
70421
|
-
|
|
70422
|
-
|
|
70423
|
-
|
|
70424
|
-
|
|
70425
|
-
|
|
70426
|
-
|
|
70427
|
-
|
|
70572
|
+
const YourBondModalHeader = ({ userBill, onDismiss }) => {
|
|
70573
|
+
var _a, _b, _c, _d;
|
|
70574
|
+
// Hooks
|
|
70575
|
+
const isMobile = useIsMobile();
|
|
70576
|
+
// Static Data
|
|
70577
|
+
const payoutTokenSymbol = (_b = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.showcaseTokenName) !== null && _b !== void 0 ? _b : (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.earnToken.symbol;
|
|
70578
|
+
// Modals
|
|
70579
|
+
const [onTransferBondModal] = useModal(jsx$2(TransferBondModal, { userBill: userBill }), true, true, `transferModal${userBill === null || userBill === void 0 ? void 0 : userBill.id}}`);
|
|
70580
|
+
return (jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { sx: { alignItems: 'center', gap: '7px' }, children: [payoutTokenSymbol ? (jsxs(Fragment$1, { children: [jsx$2(TokenImage, { symbol: payoutTokenSymbol, size: 30, chain: (_d = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _d === void 0 ? void 0 : _d.chainId }), jsx$2(Box$1, { sx: {
|
|
70581
|
+
fontSize: ['16px', '16px', '16px', '18px'],
|
|
70582
|
+
fontWeight: 700,
|
|
70583
|
+
opacity: 0.7,
|
|
70584
|
+
overflow: 'hidden',
|
|
70585
|
+
whiteSpace: 'nowrap',
|
|
70586
|
+
textOverflow: 'ellipsis',
|
|
70587
|
+
maxWidth: '100px',
|
|
70588
|
+
}, children: payoutTokenSymbol })] })) : (jsxs(Fragment$1, { children: [jsx$2(Skeleton, { animation: "waves", sx: {
|
|
70589
|
+
width: '30px',
|
|
70590
|
+
height: '30px',
|
|
70591
|
+
borderRadius: '55px',
|
|
70592
|
+
mr: '10px',
|
|
70593
|
+
} }), jsx$2(Skeleton, { animation: "waves", sx: {
|
|
70594
|
+
width: '100px',
|
|
70595
|
+
borderRadius: 'normal',
|
|
70596
|
+
} })] })), jsx$2(ProfitCard, { userBond: userBill }), jsx$2(Text, { sx: {
|
|
70597
|
+
color: 'text',
|
|
70598
|
+
opacity: '0.6',
|
|
70599
|
+
fontSize: ['11px', '11px', '11px', '14px'],
|
|
70600
|
+
display: ['none', 'none', 'none', 'flex'],
|
|
70601
|
+
}, children: (userBill === null || userBill === void 0 ? void 0 : userBill.id) && `#${userBill.id}` })] }), jsxs(Flex, { sx: { gap: '7px' }, children: [jsx$2(Button, { onClick: onTransferBondModal, disabled: !userBill, sx: { height: '22px', fontSize: '12px', fontWeight: 600, p: '2px 6px' }, children: "TRANSFER" }), jsx$2(Flex, { className: "svg-close", onClick: onDismiss, sx: { cursor: 'pointer', p: '2px 5px' }, children: jsx$2(Svg, { icon: "close", width: isMobile ? '12px' : '18px' }) })] })] }));
|
|
70428
70602
|
};
|
|
70429
|
-
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
70430
70603
|
|
|
70431
70604
|
function useBondsListPreTGE() {
|
|
70432
70605
|
var _a, _b;
|
|
@@ -75904,22 +76077,29 @@ const calculateBondsData = (queryClient) => __awaiter$9(void 0, void 0, void 0,
|
|
|
75904
76077
|
}
|
|
75905
76078
|
});
|
|
75906
76079
|
|
|
75907
|
-
const
|
|
75908
|
-
|
|
76080
|
+
const remove0xPrefix = (str) => {
|
|
76081
|
+
if (str && str.startsWith('0x')) {
|
|
76082
|
+
return str.slice(2);
|
|
76083
|
+
}
|
|
76084
|
+
return str;
|
|
76085
|
+
};
|
|
76086
|
+
|
|
76087
|
+
const Actions = ({ userBill }) => {
|
|
76088
|
+
var _a, _b, _c;
|
|
75909
76089
|
// Hooks
|
|
76090
|
+
const { switchChainAsync } = useSwitchChain();
|
|
76091
|
+
const { data: liveBonds } = useBondsData();
|
|
75910
76092
|
const SDKConfig = useSDKConfig();
|
|
75911
76093
|
const chainId = useChainId();
|
|
75912
|
-
const { switchChainAsync } = useSwitchChain();
|
|
75913
76094
|
const { writeContractAsync } = useWriteContract();
|
|
75914
76095
|
const { address: account } = useEVMAccount();
|
|
75915
76096
|
const { addToastError } = usePopups();
|
|
75916
76097
|
const { refetch: refetchUserBonds } = useUserBonds();
|
|
75917
|
-
const { data: liveBonds } = useBondsData();
|
|
75918
76098
|
// State
|
|
75919
|
-
const [isOpenTraits, setIsOpenTraits] = useState(false);
|
|
75920
76099
|
const [claimTxHash, setClaimTxHash] = useState(null);
|
|
75921
76100
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
75922
76101
|
const { isLoading, isSuccess: isConfirmed } = useMonitorTx(claimTxHash, (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId);
|
|
76102
|
+
// Static Data
|
|
75923
76103
|
const load = loadingTx || (isLoading && !isConfirmed);
|
|
75924
76104
|
const similarLiveBond = liveBonds === null || liveBonds === void 0 ? void 0 : liveBonds.find((bond) => {
|
|
75925
76105
|
var _a, _b, _c, _d, _e;
|
|
@@ -75928,18 +76108,9 @@ const YourBondsModal = ({ userBill, onDismiss }) => {
|
|
|
75928
76108
|
((_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.symbol) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === ((_e = (_d = (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) === null || _e === void 0 ? void 0 : _e.toLowerCase());
|
|
75929
76109
|
});
|
|
75930
76110
|
const canPurchaseAgain = !!similarLiveBond;
|
|
75931
|
-
|
|
75932
|
-
const bondNFTData = userBill === null || userBill === void 0 ? void 0 : userBill.nftData;
|
|
75933
|
-
const depositUSD = (_c = (_b = userBill === null || userBill === void 0 ? void 0 : userBill.nftData) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.dollarValue;
|
|
75934
|
-
const payout = (_e = (_d = userBill === null || userBill === void 0 ? void 0 : userBill.nftData) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.payout;
|
|
75935
|
-
const payoutTokenPrice = parseFloat((_h = (_g = (_f = userBill === null || userBill === void 0 ? void 0 : userBill.nftData) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.payoutTokenPrice) !== null && _h !== void 0 ? _h : '0');
|
|
75936
|
-
const payoutUSD = payout && payoutTokenPrice ? payout * payoutTokenPrice : 0;
|
|
75937
|
-
const bonusPercentage = depositUSD && payoutUSD ? (payoutUSD / depositUSD - 1) * 100 : 0;
|
|
75938
|
-
const payoutTokenSymbol = (_k = (_j = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _j === void 0 ? void 0 : _j.showcaseTokenName) !== null && _k !== void 0 ? _k : (_l = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _l === void 0 ? void 0 : _l.earnToken.symbol;
|
|
75939
|
-
// Cliff display info:
|
|
75940
|
-
const vestingCliff = (_m = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _m === void 0 ? void 0 : _m.vestingCliff;
|
|
76111
|
+
const vestingCliff = (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.vestingCliff;
|
|
75941
76112
|
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
75942
|
-
const lastBlockTimestamp = parseInt((
|
|
76113
|
+
const lastBlockTimestamp = parseInt((_c = userBill === null || userBill === void 0 ? void 0 : userBill.lastBlockTimestamp) !== null && _c !== void 0 ? _c : '0');
|
|
75943
76114
|
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
75944
76115
|
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
75945
76116
|
const handleClaim = (billId, billAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
@@ -75983,165 +76154,204 @@ const YourBondsModal = ({ userBill, onDismiss }) => {
|
|
|
75983
76154
|
});
|
|
75984
76155
|
}
|
|
75985
76156
|
});
|
|
75986
|
-
const BILL_ATTRIBUTES = ['The Legend', 'The Location', 'The Moment', 'The Trend', 'The Innovation'];
|
|
75987
|
-
const attributes = (_p = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.attributes) === null || _p === void 0 ? void 0 : _p.filter((attrib) => BILL_ATTRIBUTES.includes(attrib.trait_type));
|
|
75988
|
-
const [onTransferBondModal] = useModal(jsx$2(TransferBondModal, { userBill: userBill }), true, true, `transferModal${userBill === null || userBill === void 0 ? void 0 : userBill.id}}`);
|
|
75989
76157
|
useEffect(() => {
|
|
75990
76158
|
if (isConfirmed) {
|
|
75991
76159
|
refetchUserBonds();
|
|
75992
76160
|
}
|
|
75993
76161
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
75994
76162
|
}, [isConfirmed]);
|
|
75995
|
-
|
|
75996
|
-
|
|
75997
|
-
|
|
75998
|
-
|
|
75999
|
-
|
|
76000
|
-
|
|
76001
|
-
|
|
76002
|
-
|
|
76003
|
-
|
|
76004
|
-
|
|
76005
|
-
|
|
76006
|
-
|
|
76007
|
-
|
|
76008
|
-
|
|
76009
|
-
|
|
76010
|
-
|
|
76011
|
-
|
|
76012
|
-
|
|
76013
|
-
|
|
76163
|
+
return (jsxs(Fragment$1, { children: [jsx$2(Button, { variant: "secondary", disabled: claimable(userBill) === 0 || load || !userBill || isPendingCliff, load: load, onClick: (event) => {
|
|
76164
|
+
var _a, _b;
|
|
76165
|
+
event.stopPropagation();
|
|
76166
|
+
if (chainId !== ((_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId)) {
|
|
76167
|
+
switchChainAsync({ chainId: (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.chainId })
|
|
76168
|
+
.then(() => {
|
|
76169
|
+
handleClaim(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.address);
|
|
76170
|
+
})
|
|
76171
|
+
.catch();
|
|
76172
|
+
}
|
|
76173
|
+
else {
|
|
76174
|
+
handleClaim(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.address);
|
|
76175
|
+
}
|
|
76176
|
+
}, sx: { fontSize: '14px', width: '100%' }, children: isPendingCliff
|
|
76177
|
+
? `Claimable in ${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`
|
|
76178
|
+
: 'Claim' }), jsx$2(Button, { sx: { fontSize: '14px', width: '100%' }, onClick: () => canPurchaseAgain
|
|
76179
|
+
? (window.location.href = `https://ape.bond/bonds?bondAddress=${similarLiveBond.contractAddress[similarLiveBond.chainId]}&bondChain=${similarLiveBond.chainId}`)
|
|
76180
|
+
: null, disabled: !canPurchaseAgain, children: canPurchaseAgain ? 'Buy again' : 'sold out' })] }));
|
|
76181
|
+
};
|
|
76182
|
+
|
|
76183
|
+
const ActionsSolana = ({ userBill }) => {
|
|
76184
|
+
var _a, _b;
|
|
76185
|
+
// Hooks
|
|
76186
|
+
const SDKConfig = useSDKConfig();
|
|
76187
|
+
const { publicKey: accountSolana, signTransaction } = useSOLAccount();
|
|
76188
|
+
const { refetch } = useUserBonds();
|
|
76189
|
+
const { addToastError, addToastSuccess } = usePopups();
|
|
76190
|
+
const { data: liveBonds } = useBondsData();
|
|
76191
|
+
// State
|
|
76192
|
+
const [loadingTx, setLoadingTx] = useState(false);
|
|
76193
|
+
// Static Data
|
|
76194
|
+
const similarLiveBond = liveBonds === null || liveBonds === void 0 ? void 0 : liveBonds.find((bond) => {
|
|
76195
|
+
var _a, _b, _c, _d, _e;
|
|
76196
|
+
return !(bond === null || bond === void 0 ? void 0 : bond.soldOut) &&
|
|
76197
|
+
!(bond === null || bond === void 0 ? void 0 : bond.hide) &&
|
|
76198
|
+
((_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.symbol) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === ((_e = (_d = (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) === null || _e === void 0 ? void 0 : _e.toLowerCase());
|
|
76199
|
+
});
|
|
76200
|
+
const canPurchaseAgain = !!similarLiveBond;
|
|
76201
|
+
const connection = new Connection(getRPC(types$1.ChainId.SOL), 'confirmed');
|
|
76202
|
+
const vestingCliff = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.vestingCliff;
|
|
76203
|
+
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
76204
|
+
const lastBlockTimestamp = parseInt((_b = userBill === null || userBill === void 0 ? void 0 : userBill.lastBlockTimestamp) !== null && _b !== void 0 ? _b : '0');
|
|
76205
|
+
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
76206
|
+
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
76207
|
+
// Handlers
|
|
76208
|
+
const ensureUserPayoutAtaExists = (_a) => __awaiter$9(void 0, [_a], void 0, function* ({ connection, payer, payoutMint, user, }) {
|
|
76209
|
+
const userPayoutAta = yield getAssociatedTokenAddress(payoutMint, user);
|
|
76210
|
+
try {
|
|
76211
|
+
yield getAccount(connection, userPayoutAta);
|
|
76212
|
+
}
|
|
76213
|
+
catch (_b) {
|
|
76214
|
+
const ataIx = createAssociatedTokenAccountInstruction(payer, // fee payer
|
|
76215
|
+
userPayoutAta, // ATA to create
|
|
76216
|
+
user, // owner of ATA
|
|
76217
|
+
payoutMint);
|
|
76218
|
+
const tx = new Transaction().add(ataIx);
|
|
76219
|
+
const latestBlockhash = yield connection.getLatestBlockhash('confirmed');
|
|
76220
|
+
tx.recentBlockhash = latestBlockhash.blockhash;
|
|
76221
|
+
tx.feePayer = payer;
|
|
76222
|
+
if (!signTransaction)
|
|
76223
|
+
return;
|
|
76224
|
+
const signed = yield signTransaction(tx);
|
|
76225
|
+
const txid = yield connection.sendRawTransaction(signed.serialize(), {
|
|
76226
|
+
skipPreflight: false,
|
|
76227
|
+
preflightCommitment: 'confirmed',
|
|
76228
|
+
});
|
|
76229
|
+
yield connection.confirmTransaction({
|
|
76230
|
+
signature: txid,
|
|
76231
|
+
blockhash: latestBlockhash.blockhash,
|
|
76232
|
+
lastValidBlockHeight: latestBlockhash.lastValidBlockHeight,
|
|
76233
|
+
}, 'confirmed');
|
|
76234
|
+
}
|
|
76235
|
+
return userPayoutAta;
|
|
76236
|
+
});
|
|
76237
|
+
const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
76238
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
76239
|
+
try {
|
|
76240
|
+
setLoadingTx(true);
|
|
76241
|
+
const earnTokenAddress = (_c = (_b = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[(_d = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _d === void 0 ? void 0 : _d.chainId];
|
|
76242
|
+
const contractAddress = (_f = (_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.contractAddress) === 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];
|
|
76243
|
+
if (!earnTokenAddress || !userBill.asset || !contractAddress)
|
|
76244
|
+
return;
|
|
76245
|
+
const payoutMint = new PublicKey(earnTokenAddress);
|
|
76246
|
+
const bondIssuancePda = new PublicKey(contractAddress);
|
|
76247
|
+
const nftMint = new PublicKey(userBill.asset);
|
|
76248
|
+
const [bondTermPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond_term'), bondIssuancePda.toBuffer()], PROGRAM_ID);
|
|
76249
|
+
const [bondPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond'), bondIssuancePda.toBuffer(), nftMint.toBuffer()], PROGRAM_ID);
|
|
76250
|
+
const userPayoutAta = yield ensureUserPayoutAtaExists({
|
|
76251
|
+
connection,
|
|
76252
|
+
payer: accountSolana,
|
|
76253
|
+
payoutMint,
|
|
76254
|
+
user: accountSolana,
|
|
76255
|
+
});
|
|
76256
|
+
// treasury_ata = PDA
|
|
76257
|
+
const [treasuryAta] = PublicKey.findProgramAddressSync([bondIssuancePda.toBuffer(), COMMON_CONST_SEED, payoutMint.toBuffer()], COMMON_PDA_PROGRAM);
|
|
76258
|
+
// Build keys list
|
|
76259
|
+
const keys = [
|
|
76260
|
+
{ pubkey: bondPda, isSigner: false, isWritable: true },
|
|
76261
|
+
{ pubkey: bondTermPda, isSigner: false, isWritable: false },
|
|
76262
|
+
{ pubkey: bondIssuancePda, isSigner: false, isWritable: false },
|
|
76263
|
+
{ pubkey: accountSolana, isSigner: true, isWritable: true }, // user
|
|
76264
|
+
{ pubkey: nftMint, isSigner: false, isWritable: true },
|
|
76265
|
+
{ pubkey: userPayoutAta, isSigner: false, isWritable: true },
|
|
76266
|
+
{ pubkey: treasuryAta, isSigner: false, isWritable: true },
|
|
76267
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
76268
|
+
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
76269
|
+
{ pubkey: new PublicKey('CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d'), isSigner: false, isWritable: false }, // mplCoreProgram
|
|
76270
|
+
{ pubkey: PROGRAM_ID, isSigner: false, isWritable: false }, // passing programId is the same as passing null
|
|
76271
|
+
];
|
|
76272
|
+
// Build Instruction (no args → just discriminator)
|
|
76273
|
+
const instruction = new TransactionInstruction({
|
|
76274
|
+
keys,
|
|
76275
|
+
programId: PROGRAM_ID,
|
|
76276
|
+
data: CLAIM_DISCRIMINATOR,
|
|
76277
|
+
});
|
|
76278
|
+
// Build Transaction
|
|
76279
|
+
const transaction = new Transaction().add(instruction);
|
|
76280
|
+
transaction.feePayer = accountSolana;
|
|
76281
|
+
const { blockhash, lastValidBlockHeight } = yield connection.getLatestBlockhash('confirmed');
|
|
76282
|
+
transaction.recentBlockhash = blockhash;
|
|
76283
|
+
if (!signTransaction)
|
|
76284
|
+
return;
|
|
76285
|
+
const signedTx = yield signTransaction(transaction);
|
|
76286
|
+
const txHash = yield connection.sendRawTransaction(signedTx.serialize(), {
|
|
76287
|
+
skipPreflight: false,
|
|
76288
|
+
preflightCommitment: 'confirmed',
|
|
76289
|
+
});
|
|
76290
|
+
yield connection.confirmTransaction({
|
|
76291
|
+
signature: txHash,
|
|
76292
|
+
blockhash,
|
|
76293
|
+
lastValidBlockHeight,
|
|
76294
|
+
}, 'confirmed');
|
|
76295
|
+
const txStatus = yield connection.getSignatureStatus(txHash, { searchTransactionHistory: true });
|
|
76296
|
+
if (((_h = txStatus === null || txStatus === void 0 ? void 0 : txStatus.value) === null || _h === void 0 ? void 0 : _h.confirmationStatus) === 'confirmed' || ((_j = txStatus === null || txStatus === void 0 ? void 0 : txStatus.value) === null || _j === void 0 ? void 0 : _j.confirmationStatus) === 'finalized') {
|
|
76297
|
+
console.log('Tx confirmed on-chain, refetching bonds');
|
|
76298
|
+
refetch();
|
|
76299
|
+
addToastSuccess(txHash, types$1.ChainId.SOL);
|
|
76300
|
+
}
|
|
76301
|
+
setLoadingTx(false);
|
|
76302
|
+
}
|
|
76303
|
+
catch (error) {
|
|
76304
|
+
console.error('Claim failed:', error);
|
|
76305
|
+
addToastError((_k = error === null || error === void 0 ? void 0 : error.message) !== null && _k !== void 0 ? _k : 'Unknown error');
|
|
76306
|
+
reportError({
|
|
76307
|
+
apiUrl: (_l = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _l === void 0 ? void 0 : _l.apiV2,
|
|
76308
|
+
error,
|
|
76309
|
+
extraInfo: { type: 'claim', userBill, error },
|
|
76310
|
+
});
|
|
76311
|
+
}
|
|
76312
|
+
finally {
|
|
76313
|
+
setLoadingTx(false);
|
|
76314
|
+
}
|
|
76315
|
+
});
|
|
76316
|
+
return (jsxs(Fragment$1, { children: [jsx$2(Button, { variant: "secondary", disabled: claimable(userBill) === 0 || loadingTx || !userBill || isPendingCliff, load: loadingTx, onClick: (event) => {
|
|
76317
|
+
event.stopPropagation();
|
|
76318
|
+
handleClaim();
|
|
76319
|
+
}, sx: { fontSize: '14px', width: '100%' }, children: isPendingCliff
|
|
76320
|
+
? `Claimable in ${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`
|
|
76321
|
+
: 'Claim' }), jsx$2(Button, { sx: { fontSize: '14px', width: '100%' }, onClick: () => canPurchaseAgain
|
|
76322
|
+
? (window.location.href = `https://ape.bond/bonds?bondAddress=${similarLiveBond.contractAddress[similarLiveBond.chainId]}&bondChain=${similarLiveBond.chainId}`)
|
|
76323
|
+
: null, disabled: !canPurchaseAgain, children: canPurchaseAgain ? 'Buy again' : 'sold out' })] }));
|
|
76324
|
+
};
|
|
76325
|
+
|
|
76326
|
+
const YourBondsModal = ({ userBill, onDismiss }) => {
|
|
76327
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
76328
|
+
// State
|
|
76329
|
+
const [showNFTImg, setShowNFTImg] = useState(false);
|
|
76330
|
+
// Static Data
|
|
76331
|
+
const depositUSD = (_b = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.nftData) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.dollarValue;
|
|
76332
|
+
const payout = (_d = (_c = userBill === null || userBill === void 0 ? void 0 : userBill.nftData) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.payout;
|
|
76333
|
+
const payoutTokenPrice = parseFloat((_f = (_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.payoutTokenPrice) !== null && _f !== void 0 ? _f : '0');
|
|
76334
|
+
const payoutUSD = payout && payoutTokenPrice ? payout * payoutTokenPrice : 0;
|
|
76335
|
+
const payoutTokenSymbol = (_h = (_g = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _g === void 0 ? void 0 : _g.showcaseTokenName) !== null && _h !== void 0 ? _h : (_j = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _j === void 0 ? void 0 : _j.earnToken.symbol;
|
|
76336
|
+
// Cliff display info:
|
|
76337
|
+
const vestingCliff = (_k = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _k === void 0 ? void 0 : _k.vestingCliff;
|
|
76338
|
+
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
76339
|
+
const lastBlockTimestamp = parseInt((_l = userBill === null || userBill === void 0 ? void 0 : userBill.lastBlockTimestamp) !== null && _l !== void 0 ? _l : '0');
|
|
76340
|
+
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
76341
|
+
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
76014
76342
|
return (jsx$2(Modal, { sx: {
|
|
76015
76343
|
width: '480px',
|
|
76016
76344
|
overflowY: 'unset !important',
|
|
76017
|
-
background:
|
|
76345
|
+
background: showNFTImg ? 'transparent !important' : 'white2',
|
|
76018
76346
|
p: '0px',
|
|
76019
76347
|
top: '56%',
|
|
76020
76348
|
}, children: jsxs(Flex, { sx: {
|
|
76021
76349
|
flexDirection: 'column',
|
|
76022
76350
|
borderRadius: 'normal',
|
|
76023
76351
|
position: 'relative',
|
|
76024
|
-
background:
|
|
76352
|
+
background: showNFTImg ? 'transparent !important' : 'white2',
|
|
76025
76353
|
p: '20px',
|
|
76026
|
-
}, children: [jsx$2(
|
|
76027
|
-
position: 'absolute',
|
|
76028
|
-
display: ['flex'],
|
|
76029
|
-
top: ['-180px', '-180px', '-240px'],
|
|
76030
|
-
right: ['50%', '50%', '50%', '-13%'],
|
|
76031
|
-
transform: ['translateX(50%)', 'translateX(50%)', 'translateX(50%)', 'unset'],
|
|
76032
|
-
opacity: 0,
|
|
76033
|
-
zIndex: 5000,
|
|
76034
|
-
}, children: jsx$2(LinkShare, { userBill: userBill }) })) }), jsx$2(AnimatePresence, { children: (bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.image) && (jsxs(motion.div, { animate: controls, onClick: () => {
|
|
76035
|
-
if (hide) {
|
|
76036
|
-
closeAnimation();
|
|
76037
|
-
}
|
|
76038
|
-
else {
|
|
76039
|
-
openAnimation();
|
|
76040
|
-
}
|
|
76041
|
-
}, onAnimationStart: () => {
|
|
76042
|
-
setHide(true);
|
|
76043
|
-
}, sx: {
|
|
76044
|
-
display: 'flex',
|
|
76045
|
-
zIndex: -1,
|
|
76046
|
-
position: hide ? 'fixed' : 'absolute',
|
|
76047
|
-
bottom: 'calc(100% - 10px)',
|
|
76048
|
-
left: '25%',
|
|
76049
|
-
width: '50%',
|
|
76050
|
-
aspectRatio: '1 / 0.56',
|
|
76051
|
-
cursor: 'pointer',
|
|
76052
|
-
borderRadius: 'normal',
|
|
76053
|
-
flexDirection: 'column',
|
|
76054
|
-
'&: hover': {
|
|
76055
|
-
zIndex: [1000, 1000, 1000, '1000 !important'],
|
|
76056
|
-
},
|
|
76057
|
-
}, children: [jsxs(Flex, { sx: {
|
|
76058
|
-
display: hide ? 'none' : 'flex',
|
|
76059
|
-
position: 'absolute',
|
|
76060
|
-
zIndex: 121,
|
|
76061
|
-
width: '100%',
|
|
76062
|
-
height: '100%',
|
|
76063
|
-
opacity: 0,
|
|
76064
|
-
alignItems: 'center',
|
|
76065
|
-
justifyContent: 'center',
|
|
76066
|
-
fontWeight: 700,
|
|
76067
|
-
borderRadius: 'normal',
|
|
76068
|
-
'&: hover': {
|
|
76069
|
-
zIndex: 1000,
|
|
76070
|
-
opacity: 0.8,
|
|
76071
|
-
background: 'linear-gradient(90deg, rgba(49, 46, 122, 0.70) 0%, rgba(92, 79, 174, 0.70) 100%)',
|
|
76072
|
-
backdropFilter: ' blur(2px)',
|
|
76073
|
-
},
|
|
76074
|
-
}, children: ["View NFT ", '>'] }), hide && (jsx$2(Flex, { sx: {
|
|
76075
|
-
position: 'absolute',
|
|
76076
|
-
top: '5px',
|
|
76077
|
-
right: '5px',
|
|
76078
|
-
background: 'grey',
|
|
76079
|
-
opacity: 0.9,
|
|
76080
|
-
p: '2px',
|
|
76081
|
-
borderRadius: '50%',
|
|
76082
|
-
alignItems: 'center',
|
|
76083
|
-
justifyContent: 'center',
|
|
76084
|
-
}, children: jsx$2(Flex, { sx: { width: '6px' }, children: jsx$2(Svg, { icon: "close" }) }) })), jsx$2(ProgressiveImage, { src: `${bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.image}`, blurSrc: `https://ape.bond/images/bills/bluredNFT.png` }), hide && (jsx$2(Flex, { sx: {
|
|
76085
|
-
position: 'absolute',
|
|
76086
|
-
bottom: ['calc(-35% + 1px)', 'calc(-35% + 1px)', 'calc(-26% + 1px)'],
|
|
76087
|
-
width: '100%',
|
|
76088
|
-
justifyContent: 'center',
|
|
76089
|
-
}, children: jsxs(Flex, { sx: {
|
|
76090
|
-
flexDirection: 'column',
|
|
76091
|
-
width: '100%',
|
|
76092
|
-
minWidth: '250px',
|
|
76093
|
-
pb: '10px',
|
|
76094
|
-
alignItems: 'center',
|
|
76095
|
-
transform: [
|
|
76096
|
-
'scale(0.5) translateY(-50%)',
|
|
76097
|
-
'scale(0.5) translateY(-50%)',
|
|
76098
|
-
'scale(0.5) translateY(-50%)',
|
|
76099
|
-
'scale(0.4) translateY(-75%)',
|
|
76100
|
-
],
|
|
76101
|
-
}, children: [jsxs(Flex, { sx: {
|
|
76102
|
-
justifyContent: 'space-between',
|
|
76103
|
-
height: '24px',
|
|
76104
|
-
backgroundColor: 'white3',
|
|
76105
|
-
px: '15px',
|
|
76106
|
-
width: '100%',
|
|
76107
|
-
borderRadius: `${isOpenTraits ? '6px 6px 0px 0px' : 'normal'}`,
|
|
76108
|
-
}, onClick: (event) => {
|
|
76109
|
-
event.stopPropagation();
|
|
76110
|
-
setIsOpenTraits(!isOpenTraits);
|
|
76111
|
-
}, children: [jsxs(Flex, { sx: { gap: '10px', alignItems: 'center' }, children: [jsx$2(Svg, { icon: "tag", direction: "down" }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'text', opacity: '0.6' }, children: "Traits" })] }), jsx$2(Svg, { icon: "caret", direction: isOpenTraits ? 'up' : 'down' })] }), jsx$2(AnimatePresence, { children: isOpenTraits && (jsx$2(motion.div, { initial: { height: 0 }, animate: { height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { height: 0 }, sx: {
|
|
76112
|
-
overflow: 'hidden',
|
|
76113
|
-
width: '100%',
|
|
76114
|
-
position: 'absolute',
|
|
76115
|
-
top: '24px',
|
|
76116
|
-
borderRadius: '0 0 10px 10px',
|
|
76117
|
-
}, onClick: (event) => {
|
|
76118
|
-
event.stopPropagation();
|
|
76119
|
-
setIsOpenTraits(!isOpenTraits);
|
|
76120
|
-
}, children: jsx$2(Flex, { sx: { flexDirection: 'column' }, children: attributes
|
|
76121
|
-
? attributes.map((a) => (jsxs(Flex, { sx: { background: 'white4', width: '100%', padding: '2px 8px', height: '22px' }, 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)))
|
|
76122
|
-
: BILL_ATTRIBUTES.map((attrib) => {
|
|
76123
|
-
return (jsxs(Flex, { sx: { background: 'white4', width: '100%', padding: '2px 8px', height: '22px' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: attrib }), jsx$2(Skeleton, { width: "150px" })] }, attrib));
|
|
76124
|
-
}) }) })) })] }) }))] })) }), !hide && (jsxs(Flex, { sx: { flexDirection: 'column' }, children: [jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { sx: { alignItems: 'center', gap: '7px' }, children: [userBill && (jsx$2(TokenImage, { symbol: (_r = (_q = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _q === void 0 ? void 0 : _q.showcaseTokenName) !== null && _r !== void 0 ? _r : (_t = (_s = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _s === void 0 ? void 0 : _s.earnToken) === null || _t === void 0 ? void 0 : _t.symbol, size: 30, chain: (_u = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _u === void 0 ? void 0 : _u.chainId })), jsx$2(Box$1, { sx: {
|
|
76125
|
-
fontSize: ['16px', '16px', '16px', '18px'],
|
|
76126
|
-
fontWeight: 700,
|
|
76127
|
-
opacity: 0.7,
|
|
76128
|
-
overflow: 'hidden',
|
|
76129
|
-
whiteSpace: 'nowrap',
|
|
76130
|
-
textOverflow: 'ellipsis',
|
|
76131
|
-
maxWidth: '100px',
|
|
76132
|
-
}, children: (_w = (_v = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _v === void 0 ? void 0 : _v.showcaseTokenName) !== null && _w !== void 0 ? _w : (_x = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _x === void 0 ? void 0 : _x.earnToken.symbol }), jsxs(Flex, { sx: {
|
|
76133
|
-
p: '2px 6px',
|
|
76134
|
-
background: 'rgba(56, 166, 17, 0.05)',
|
|
76135
|
-
border: '1px solid rgba(56, 166, 17, 0.20)',
|
|
76136
|
-
borderRadius: 'normal',
|
|
76137
|
-
color: 'success',
|
|
76138
|
-
fontSize: ['14px', '14px', '14px', '16px'],
|
|
76139
|
-
}, children: [bonusPercentage.toFixed(), "% Bonus"] }), jsxs(Text, { sx: {
|
|
76140
|
-
color: 'text',
|
|
76141
|
-
opacity: '0.6',
|
|
76142
|
-
fontSize: ['11px', '11px', '11px', '14px'],
|
|
76143
|
-
display: ['none', 'none', 'none', 'flex'],
|
|
76144
|
-
}, children: ["#", userBill === null || userBill === void 0 ? void 0 : userBill.id] })] }), jsxs(Flex, { sx: { gap: '7px' }, children: [jsx$2(Button, { onClick: onTransferBondModal, disabled: !userBill, sx: { height: '22px', fontSize: '12px', fontWeight: 600, p: '2px 6px' }, children: "TRANSFER" }), jsx$2(Flex, { className: "svg-close", onClick: onDismiss, sx: { cursor: 'pointer', p: '2px 5px' }, children: jsx$2(Svg, { icon: "close", width: isMobile ? '12px' : '18px' }) })] })] }), jsxs(Flex, { sx: { mt: '10px', flexDirection: 'column', gap: '10px' }, children: [jsxs(Flex, { sx: { width: '100%', gap: '15px', position: 'relative' }, children: [jsxs(Flex, { sx: {
|
|
76354
|
+
}, children: [jsx$2(NftImage, { userBill: userBill, showNFTImg: showNFTImg, setShowNFTImg: setShowNFTImg }), !showNFTImg && (jsxs(Flex, { sx: { flexDirection: 'column' }, children: [jsx$2(YourBondModalHeader, { userBill: userBill, onDismiss: onDismiss }), jsxs(Flex, { sx: { mt: '10px', flexDirection: 'column', gap: '10px' }, children: [jsxs(Flex, { sx: { width: '100%', gap: '15px', position: 'relative' }, children: [jsxs(Flex, { sx: {
|
|
76145
76355
|
background: 'white3',
|
|
76146
76356
|
borderRadius: 'normal',
|
|
76147
76357
|
justifyContent: 'space-between',
|
|
@@ -76211,34 +76421,17 @@ const YourBondsModal = ({ userBill, onDismiss }) => {
|
|
|
76211
76421
|
fontWeight: 400,
|
|
76212
76422
|
ml: '10px',
|
|
76213
76423
|
opacity: 0.6,
|
|
76214
|
-
}, children: ["($", formatNumberSI(claimedUSD(userBill)), ")"] })] })] })] }), ((
|
|
76424
|
+
}, children: ["($", formatNumberSI(claimedUSD(userBill)), ")"] })] })] })] }), ((_m = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _m === void 0 ? void 0 : _m.warningCard) && (jsx$2(Flex, { sx: {
|
|
76215
76425
|
width: '100%',
|
|
76216
76426
|
background: '#DE62F366',
|
|
76217
76427
|
justifyContent: 'center',
|
|
76218
76428
|
borderRadius: 'normal',
|
|
76219
|
-
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '4px 10px', lineHeight: '16px' }, children: jsx$2(SafeHTMLComponent, { html: (
|
|
76429
|
+
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '4px 10px', lineHeight: '16px' }, children: jsx$2(SafeHTMLComponent, { html: (_o = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _o === void 0 ? void 0 : _o.warningCard }) }) })), jsx$2(Flex, { sx: {
|
|
76220
76430
|
width: '100%',
|
|
76221
76431
|
justifyContent: 'space-between',
|
|
76222
76432
|
gap: ['10px', '10px', '10px', '15px'],
|
|
76223
76433
|
height: '40px',
|
|
76224
|
-
}, children:
|
|
76225
|
-
var _a, _b;
|
|
76226
|
-
event.stopPropagation();
|
|
76227
|
-
if (chainId !== ((_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId)) {
|
|
76228
|
-
switchChainAsync({ chainId: (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.chainId })
|
|
76229
|
-
.then(() => {
|
|
76230
|
-
handleClaim(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.address);
|
|
76231
|
-
})
|
|
76232
|
-
.catch();
|
|
76233
|
-
}
|
|
76234
|
-
else {
|
|
76235
|
-
handleClaim(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.address);
|
|
76236
|
-
}
|
|
76237
|
-
}, sx: { fontSize: '14px', width: '100%' }, children: isPendingCliff
|
|
76238
|
-
? `Claimable in ${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`
|
|
76239
|
-
: 'Claim' }), jsx$2(Button, { sx: { width: '100%', fontSize: '14px' }, onClick: () => canPurchaseAgain
|
|
76240
|
-
? (window.location.href = `https://ape.bond/bonds?bondAddress=${similarLiveBond.contractAddress[similarLiveBond.chainId]}&bondChain=${similarLiveBond.chainId}`)
|
|
76241
|
-
: null, disabled: !canPurchaseAgain, children: canPurchaseAgain ? 'Buy again' : 'sold out' })] }), jsx$2(Recommendations, { billAddress: userBill === null || userBill === void 0 ? void 0 : userBill.address })] })] }))] }) }));
|
|
76434
|
+
}, children: ((_p = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _p === void 0 ? void 0 : _p.chainId) === types$1.ChainId.SOL ? (jsx$2(ActionsSolana, { userBill: userBill })) : (jsx$2(Actions, { userBill: userBill })) }), jsx$2(Recommendations, { billAddress: userBill === null || userBill === void 0 ? void 0 : userBill.address })] })] }))] }) }));
|
|
76242
76435
|
};
|
|
76243
76436
|
|
|
76244
76437
|
const styles$b = {
|
|
@@ -76324,27 +76517,6 @@ const BondInfoTooltip = ({ earnTokenContract, earnTokenSymbol, bondContract, pro
|
|
|
76324
76517
|
return (jsxs(Flex, { sx: { flexDirection: 'column', flexWrap: 'wrap' }, children: [jsx$2(ButtonsRow, { twitter: twitter, projectLink: projectLink, bubble: earnTokenContract, audit: audit, chain: chain }), (config === null || config === void 0 ? void 0 : config.referenceId) === 'apebond' && !isSoldOut && billType !== 'fcfs' && chain !== types$1.ChainId.SOL && (jsx$2(Flex, { sx: { width: '100%', my: '5px', justifyContent: 'center', position: 'relative', height: '25px' }, children: jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation, rightPos: '-5px' }) })), jsx$2(Flex, { sx: { justifyContent: 'center' }, children: jsxs(Flex, { sx: { width: '144px', flexDirection: 'column' }, children: [jsx$2(Flex, { sx: styles$b.linkRow, children: tokenLink && (jsxs(Link, { href: tokenLink, sx: styles$b.link, target: "_blank", children: ["View Token Contract", jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] })) }), jsx$2(Flex, { sx: styles$b.linkRow, children: bondLink && (jsxs(Link, { href: bondLink, sx: styles$b.link, target: "_blank", children: ["View Bond Contract", jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] })) }), jsx$2(Flex, { sx: styles$b.linkRow, children: billType !== 'fcfs' && chain !== types$1.ChainId.SOL && (jsxs(Link, { href: bondDashboard, sx: styles$b.link, target: "_blank", children: ["View Bond Insights", jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] })) })] }) })] }));
|
|
76325
76518
|
};
|
|
76326
76519
|
|
|
76327
|
-
const ProfitCard = ({ userBond }) => {
|
|
76328
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
76329
|
-
const totalPayout = getBalanceNumber((_a = userBond === null || userBond === void 0 ? void 0 : userBond.totalPayout) !== null && _a !== void 0 ? _a : '0', (_e = (_c = (_b = userBond === null || userBond === void 0 ? void 0 : userBond.bond) === null || _b === void 0 ? void 0 : _b.earnToken) === null || _c === void 0 ? void 0 : _c.decimals[(_d = userBond.bond) === null || _d === void 0 ? void 0 : _d.chainId]) !== null && _e !== void 0 ? _e : 18);
|
|
76330
|
-
const payoutTokenPrice = (_g = (_f = userBond === null || userBond === void 0 ? void 0 : userBond.bond) === null || _f === void 0 ? void 0 : _f.payoutTokenPrice) !== null && _g !== void 0 ? _g : '0';
|
|
76331
|
-
const totalPayoutUSD = totalPayout * parseFloat(payoutTokenPrice);
|
|
76332
|
-
const depositAmountUSD = (_k = (_j = (_h = userBond === null || userBond === void 0 ? void 0 : userBond.nftData) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.dollarValue) !== null && _k !== void 0 ? _k : 0;
|
|
76333
|
-
const profit = !depositAmountUSD ? 0 : totalPayoutUSD - depositAmountUSD;
|
|
76334
|
-
return (jsx$2(Flex$1, { sx: { display: ['none', 'none', 'none', 'none', 'none', 'none', 'flex'], width: '125px' }, children: profit > 0.01 ? (jsxs(Flex$1, { sx: {
|
|
76335
|
-
border: '1px solid rgb(56, 166, 17, 0.20)',
|
|
76336
|
-
p: '2px 6px',
|
|
76337
|
-
color: 'success',
|
|
76338
|
-
borderRadius: '5px',
|
|
76339
|
-
background: '#38A6110D',
|
|
76340
|
-
fontWeight: 700,
|
|
76341
|
-
fontSize: '14px',
|
|
76342
|
-
width: '100%',
|
|
76343
|
-
justifyContent: 'center',
|
|
76344
|
-
// I want a background with 5% opacity of this color
|
|
76345
|
-
}, children: ["+$", formatNumberSI(profit, profit > 100 ? 0 : 2), " Profit!"] })) : (jsx$2(Flex$1, { sx: { width: '125px' } })) }));
|
|
76346
|
-
};
|
|
76347
|
-
|
|
76348
76520
|
const UserBondRow = ({ bill }) => {
|
|
76349
76521
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
76350
76522
|
// Hooks
|
|
@@ -76423,7 +76595,7 @@ const UserBondRow = ({ bill }) => {
|
|
|
76423
76595
|
// }, [bill?.id])
|
|
76424
76596
|
return (jsxs("div", { className: "your-bonds", onClick: onOpenPurchasedBond, children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: (_g = (_f = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _f === void 0 ? void 0 : _f.earnToken) === null || _g === void 0 ? void 0 : _g.symbol, chain: (_h = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _h === void 0 ? void 0 : _h.chainId, tag: (_k = (_j = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _j === void 0 ? void 0 : _j.tags) === null || _k === void 0 ? void 0 : _k[0], vestEnds: getTimeLeftForFullyVested(bill) > 0 ? `Ends in ${getPendingVestingString(bill)}` : `Fully Vested`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: ((_l = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _l === void 0 ? void 0 : _l.earnToken.address[bill === null || bill === void 0 ? void 0 : bill.bond.chainId]) || '', earnTokenSymbol: ((_m = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _m === void 0 ? void 0 : _m.earnToken.symbol) || '', bondContract: (_o = bill === null || bill === void 0 ? void 0 : bill.address) !== null && _o !== void 0 ? _o : '', projectLink: (_p = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _p === void 0 ? void 0 : _p.projectLink, twitter: (_q = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _q === void 0 ? void 0 : _q.twitter, audit: (_r = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _r === void 0 ? void 0 : _r.audit, chain: (_s = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _s === void 0 ? void 0 : _s.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex$1, { sx: {
|
|
76425
76597
|
opacity: 0.8,
|
|
76426
|
-
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsx$2(ProfitCard, { userBond: bill }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimable(bill), 3), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pending(bill), 3), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(pending(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: getPercentageVested(bill) }), style: {
|
|
76598
|
+
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsx$2(Flex$1, { sx: { width: '125px' }, children: jsx$2(ProfitCard, { userBond: bill }) }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimable(bill), 3), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pending(bill), 3), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(pending(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: getPercentageVested(bill) }), style: {
|
|
76427
76599
|
width: '127px',
|
|
76428
76600
|
height: '25px',
|
|
76429
76601
|
flexDirection: 'column',
|
|
@@ -76444,175 +76616,6 @@ const UserBondRow = ({ bill }) => {
|
|
|
76444
76616
|
: 'Claim' })) })] })] }));
|
|
76445
76617
|
};
|
|
76446
76618
|
|
|
76447
|
-
const YourBondsModalSolana = ({ userBill, onDismiss }) => {
|
|
76448
|
-
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;
|
|
76449
|
-
// Hooks
|
|
76450
|
-
const SDKConfig = useSDKConfig();
|
|
76451
|
-
const { publicKey: accountSolana, signTransaction } = useSOLAccount();
|
|
76452
|
-
const { setVisible } = useWalletModal();
|
|
76453
|
-
const { addToastError, addToastSuccess } = usePopups();
|
|
76454
|
-
const { refetch } = useUserBonds();
|
|
76455
|
-
const connection = new Connection(getRPC(types$1.ChainId.SOL), 'confirmed');
|
|
76456
|
-
// State
|
|
76457
|
-
const [imgLoaded, setImgLoaded] = useState(false);
|
|
76458
|
-
const [loadingTx, setLoadingTx] = useState(false);
|
|
76459
|
-
// Static Data
|
|
76460
|
-
const bondNFTData = userBill === null || userBill === void 0 ? void 0 : userBill.nftData;
|
|
76461
|
-
// Cliff display info:
|
|
76462
|
-
const vestingCliff = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.vestingCliff;
|
|
76463
|
-
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
76464
|
-
const lastBlockTimestamp = parseInt((_b = userBill === null || userBill === void 0 ? void 0 : userBill.lastBlockTimestamp) !== null && _b !== void 0 ? _b : '0');
|
|
76465
|
-
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
76466
|
-
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
76467
|
-
const ensureUserPayoutAtaExists = (_a) => __awaiter$9(void 0, [_a], void 0, function* ({ connection, payer, payoutMint, user, }) {
|
|
76468
|
-
const userPayoutAta = yield getAssociatedTokenAddress(payoutMint, user);
|
|
76469
|
-
try {
|
|
76470
|
-
yield getAccount(connection, userPayoutAta);
|
|
76471
|
-
}
|
|
76472
|
-
catch (_b) {
|
|
76473
|
-
const ataIx = createAssociatedTokenAccountInstruction(payer, // fee payer
|
|
76474
|
-
userPayoutAta, // ATA to create
|
|
76475
|
-
user, // owner of ATA
|
|
76476
|
-
payoutMint);
|
|
76477
|
-
const tx = new Transaction().add(ataIx);
|
|
76478
|
-
const latestBlockhash = yield connection.getLatestBlockhash('confirmed');
|
|
76479
|
-
tx.recentBlockhash = latestBlockhash.blockhash;
|
|
76480
|
-
tx.feePayer = payer;
|
|
76481
|
-
if (!signTransaction)
|
|
76482
|
-
return;
|
|
76483
|
-
const signed = yield signTransaction(tx);
|
|
76484
|
-
const txid = yield connection.sendRawTransaction(signed.serialize(), {
|
|
76485
|
-
skipPreflight: false,
|
|
76486
|
-
preflightCommitment: 'confirmed',
|
|
76487
|
-
});
|
|
76488
|
-
yield connection.confirmTransaction({
|
|
76489
|
-
signature: txid,
|
|
76490
|
-
blockhash: latestBlockhash.blockhash,
|
|
76491
|
-
lastValidBlockHeight: latestBlockhash.lastValidBlockHeight,
|
|
76492
|
-
}, 'confirmed');
|
|
76493
|
-
}
|
|
76494
|
-
return userPayoutAta;
|
|
76495
|
-
});
|
|
76496
|
-
const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
76497
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
76498
|
-
try {
|
|
76499
|
-
setLoadingTx(true);
|
|
76500
|
-
const earnTokenAddress = (_c = (_b = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[(_d = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _d === void 0 ? void 0 : _d.chainId];
|
|
76501
|
-
const contractAddress = (_f = (_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.contractAddress) === 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];
|
|
76502
|
-
if (!earnTokenAddress || !userBill.asset || !contractAddress)
|
|
76503
|
-
return;
|
|
76504
|
-
const payoutMint = new PublicKey(earnTokenAddress);
|
|
76505
|
-
const bondIssuancePda = new PublicKey(contractAddress);
|
|
76506
|
-
const nftMint = new PublicKey(userBill.asset);
|
|
76507
|
-
const [bondTermPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond_term'), bondIssuancePda.toBuffer()], PROGRAM_ID);
|
|
76508
|
-
const [bondPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond'), bondIssuancePda.toBuffer(), nftMint.toBuffer()], PROGRAM_ID);
|
|
76509
|
-
const userPayoutAta = yield ensureUserPayoutAtaExists({
|
|
76510
|
-
connection,
|
|
76511
|
-
payer: accountSolana,
|
|
76512
|
-
payoutMint,
|
|
76513
|
-
user: accountSolana,
|
|
76514
|
-
});
|
|
76515
|
-
// treasury_ata = PDA
|
|
76516
|
-
const [treasuryAta] = PublicKey.findProgramAddressSync([bondIssuancePda.toBuffer(), COMMON_CONST_SEED, payoutMint.toBuffer()], COMMON_PDA_PROGRAM);
|
|
76517
|
-
// Build keys list
|
|
76518
|
-
const keys = [
|
|
76519
|
-
{ pubkey: bondPda, isSigner: false, isWritable: true },
|
|
76520
|
-
{ pubkey: bondTermPda, isSigner: false, isWritable: false },
|
|
76521
|
-
{ pubkey: bondIssuancePda, isSigner: false, isWritable: false },
|
|
76522
|
-
{ pubkey: accountSolana, isSigner: true, isWritable: true }, // user
|
|
76523
|
-
{ pubkey: nftMint, isSigner: false, isWritable: true },
|
|
76524
|
-
{ pubkey: userPayoutAta, isSigner: false, isWritable: true },
|
|
76525
|
-
{ pubkey: treasuryAta, isSigner: false, isWritable: true },
|
|
76526
|
-
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
76527
|
-
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
76528
|
-
{ pubkey: new PublicKey('CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d'), isSigner: false, isWritable: false }, // mplCoreProgram
|
|
76529
|
-
{ pubkey: PROGRAM_ID, isSigner: false, isWritable: false }, // passing programId is the same as passing null
|
|
76530
|
-
];
|
|
76531
|
-
// Build Instruction (no args → just discriminator)
|
|
76532
|
-
const instruction = new TransactionInstruction({
|
|
76533
|
-
keys,
|
|
76534
|
-
programId: PROGRAM_ID,
|
|
76535
|
-
data: CLAIM_DISCRIMINATOR,
|
|
76536
|
-
});
|
|
76537
|
-
// Build Transaction
|
|
76538
|
-
const transaction = new Transaction().add(instruction);
|
|
76539
|
-
transaction.feePayer = accountSolana;
|
|
76540
|
-
const { blockhash, lastValidBlockHeight } = yield connection.getLatestBlockhash('confirmed');
|
|
76541
|
-
transaction.recentBlockhash = blockhash;
|
|
76542
|
-
if (!signTransaction)
|
|
76543
|
-
return;
|
|
76544
|
-
const signedTx = yield signTransaction(transaction);
|
|
76545
|
-
const txHash = yield connection.sendRawTransaction(signedTx.serialize(), {
|
|
76546
|
-
skipPreflight: false,
|
|
76547
|
-
preflightCommitment: 'confirmed',
|
|
76548
|
-
});
|
|
76549
|
-
yield connection.confirmTransaction({
|
|
76550
|
-
signature: txHash,
|
|
76551
|
-
blockhash,
|
|
76552
|
-
lastValidBlockHeight,
|
|
76553
|
-
}, 'confirmed');
|
|
76554
|
-
const txStatus = yield connection.getSignatureStatus(txHash, { searchTransactionHistory: true });
|
|
76555
|
-
if (((_h = txStatus === null || txStatus === void 0 ? void 0 : txStatus.value) === null || _h === void 0 ? void 0 : _h.confirmationStatus) === 'confirmed' || ((_j = txStatus === null || txStatus === void 0 ? void 0 : txStatus.value) === null || _j === void 0 ? void 0 : _j.confirmationStatus) === 'finalized') {
|
|
76556
|
-
console.log('Tx confirmed on-chain, refetching bonds');
|
|
76557
|
-
refetch();
|
|
76558
|
-
addToastSuccess(txHash, types$1.ChainId.SOL);
|
|
76559
|
-
}
|
|
76560
|
-
setLoadingTx(false);
|
|
76561
|
-
}
|
|
76562
|
-
catch (error) {
|
|
76563
|
-
console.error('Claim failed:', error);
|
|
76564
|
-
addToastError((_k = error === null || error === void 0 ? void 0 : error.message) !== null && _k !== void 0 ? _k : 'Unknown error');
|
|
76565
|
-
reportError({
|
|
76566
|
-
apiUrl: (_l = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _l === void 0 ? void 0 : _l.apiV2,
|
|
76567
|
-
error,
|
|
76568
|
-
extraInfo: { type: 'claim', userBill, error },
|
|
76569
|
-
});
|
|
76570
|
-
}
|
|
76571
|
-
finally {
|
|
76572
|
-
setLoadingTx(false);
|
|
76573
|
-
}
|
|
76574
|
-
});
|
|
76575
|
-
const handleImageLoad = () => {
|
|
76576
|
-
setImgLoaded(true);
|
|
76577
|
-
};
|
|
76578
|
-
const [onTransferBondModal] = useModal(jsx$2(TransferBondModal, { userBill: userBill }), true, true, `transferModal${userBill === null || userBill === void 0 ? void 0 : userBill.id}}`);
|
|
76579
|
-
return (jsx$2(Modal, { className: "modal", children: jsxs(Flex$1, { className: "yourbondsmodal-content", children: [jsx$2(Flex$1, { className: "yourbondsmodal-header", children: jsx$2(Flex$1, { className: "svg-close", onClick: onDismiss, children: jsx$2(Svg, { icon: "close" }) }) }), jsxs(Flex$1, { className: "yourbondsmodal table-container", children: [jsxs(Flex$1, { className: "yourbondsmodal bondimage", children: [(bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.image) ? (jsx$2("img", { src: `${bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.image}?img-width=720`, onLoad: handleImageLoad, alt: "solana-NFT", style: { zIndex: 2, width: '100%', height: '100%' } })) : (userBill && (jsx$2("img", { src: `https://ape.bond/solBonds/${(_e = (_d = (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) === null || _e === void 0 ? void 0 : _e.toLowerCase()}.png`, alt: "Solana Bonds Banner", onLoad: handleImageLoad, style: { zIndex: 2, width: '100%', height: '100%' } }))), (!imgLoaded || !userBill) && (jsx$2(Flex$1, { sx: {
|
|
76580
|
-
position: 'absolute',
|
|
76581
|
-
top: 'calc(50% - 24px)',
|
|
76582
|
-
right: 'calc(50% - 50px)',
|
|
76583
|
-
justifyContent: 'center',
|
|
76584
|
-
alignItems: 'center',
|
|
76585
|
-
zIndex: 1,
|
|
76586
|
-
}, children: jsx$2(Spinner, { width: 100 }) }))] }), jsxs(Flex$1, { className: "yourbondsmodal yourbondinfo", children: [jsxs(Flex$1, { className: "yourbondinfo title-container", children: [jsx$2(Flex$1, { className: "title-container bondicon", children: userBill && (jsx$2(TokenImage, { symbol: (_g = (_f = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _f === void 0 ? void 0 : _f.showcaseTokenName) !== null && _g !== void 0 ? _g : (_j = (_h = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _h === void 0 ? void 0 : _h.earnToken) === null || _j === void 0 ? void 0 : _j.symbol, size: 40, chain: (_k = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _k === void 0 ? void 0 : _k.chainId })) }), jsx$2(Flex$1, { className: "title-container tokenname", children: (_m = (_l = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _l === void 0 ? void 0 : _l.showcaseTokenName) !== null && _m !== void 0 ? _m : (_o = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _o === void 0 ? void 0 : _o.earnToken.symbol }), jsx$2(Flex$1, { className: "title-container tokentags", children: (_q = (_p = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _p === void 0 ? void 0 : _p.tags) === null || _q === void 0 ? void 0 : _q.slice(0, 1).map((tag) => {
|
|
76587
|
-
return (jsx$2(Flex$1, { sx: { marginRight: '10px' }, children: jsx$2(ListTag, { text: tag === null || tag === void 0 ? void 0 : tag.toUpperCase() }) }, tag));
|
|
76588
|
-
}) }), jsxs(Text, { sx: { color: 'text', opacity: '0.6', fontSize: ['12px', '12px', '12px', '16px'] }, children: ["ID # ", userBill === null || userBill === void 0 ? void 0 : userBill.id] })] }), jsxs(Flex$1, { className: "yourbondinfo blocks-container", children: [((_r = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _r === void 0 ? void 0 : _r.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" }) }) }) })] }), jsx$2(Flex$1, { className: "yourbondinfo-block info", children: jsx$2(Flex$1, { className: "block-info text", children: jsxs(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: ["$", (_s = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _s === void 0 ? void 0 : _s.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: (_u = (_t = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _t === void 0 ? void 0 : _t.showcaseTokenName) !== null && _u !== void 0 ? _u : (_w = (_v = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _v === void 0 ? void 0 : _v.earnToken) === null || _w === void 0 ? void 0 : _w.symbol, size: 25, chain: (_x = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _x === void 0 ? void 0 : _x.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(pending(userBill), 4) }), jsx$2(Text, { sx: {
|
|
76589
|
-
fontSize: ['10px', '10px', '10px', '12px'],
|
|
76590
|
-
fontWeight: [500, 500, 500, 400],
|
|
76591
|
-
paddingLeft: '10px',
|
|
76592
|
-
}, children: `($${pendingUSD(userBill).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: (_z = (_y = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _y === void 0 ? void 0 : _y.showcaseTokenName) !== null && _z !== void 0 ? _z : (_1 = (_0 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _0 === void 0 ? void 0 : _0.earnToken) === null || _1 === void 0 ? void 0 : _1.symbol, size: 25, chain: (_2 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _2 === void 0 ? void 0 : _2.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(claimable(userBill), 4) }), jsx$2(Text, { sx: {
|
|
76593
|
-
fontSize: ['10px', '10px', '10px', '12px'],
|
|
76594
|
-
fontWeight: [500, 500, 500, 400],
|
|
76595
|
-
paddingLeft: '10px',
|
|
76596
|
-
}, children: `($${claimableUSD(userBill).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: (_4 = (_3 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _3 === void 0 ? void 0 : _3.showcaseTokenName) !== null && _4 !== void 0 ? _4 : (_6 = (_5 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _5 === void 0 ? void 0 : _5.earnToken) === null || _6 === void 0 ? void 0 : _6.symbol, size: 25, chain: (_7 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _7 === void 0 ? void 0 : _7.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(claimed(userBill), 4) }), jsx$2(Text, { sx: {
|
|
76597
|
-
fontSize: ['10px', '10px', '10px', '12px'],
|
|
76598
|
-
fontWeight: [500, 500, 500, 400],
|
|
76599
|
-
paddingLeft: '10px',
|
|
76600
|
-
}, children: `($${claimedUSD(userBill).toFixed(2)})` })] })] })] })] }), ((_8 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _8 === void 0 ? void 0 : _8.warningCard) && (jsx$2(Flex$1, { sx: {
|
|
76601
|
-
width: '100%',
|
|
76602
|
-
background: '#DE62F366',
|
|
76603
|
-
justifyContent: 'center',
|
|
76604
|
-
borderRadius: 'normal',
|
|
76605
|
-
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (_9 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _9 === void 0 ? void 0 : _9.warningCard }) }) })), jsxs(Flex$1, { className: "yourbondinfo button-container", children: [jsx$2(Flex$1, { className: "button-container claim", children: userBill && !accountSolana ? (jsxs(Button, { className: "switch-button", disabled: claimable(userBill) === 0 || loadingTx, onClick: (event) => {
|
|
76606
|
-
event.stopPropagation();
|
|
76607
|
-
setVisible(true);
|
|
76608
|
-
}, children: ["Switch to ", NETWORK_LABEL[(_10 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _10 === void 0 ? void 0 : _10.chainId]] })) : (jsx$2(Button, { className: "claim-button", disabled: claimable(userBill) === 0 || loadingTx || !userBill || isPendingCliff, load: loadingTx, onClick: (event) => {
|
|
76609
|
-
event.stopPropagation();
|
|
76610
|
-
handleClaim();
|
|
76611
|
-
}, children: isPendingCliff
|
|
76612
|
-
? `Claimable in ${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`
|
|
76613
|
-
: 'Claim' })) }), jsx$2(Flex$1, { className: "button-container transfer", children: jsx$2(Button, { className: "transfer-button", variant: "secondary", onClick: onTransferBondModal, disabled: !userBill, children: "TRANSFER" }) })] })] })] }), jsx$2(Recommendations, { onDismiss: onDismiss, billAddress: userBill === null || userBill === void 0 ? void 0 : userBill.address })] }) }));
|
|
76614
|
-
};
|
|
76615
|
-
|
|
76616
76619
|
const UserBondRowSolana = ({ bill }) => {
|
|
76617
76620
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
76618
76621
|
// Hooks
|
|
@@ -76631,7 +76634,7 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
76631
76634
|
const lastBlockTimestamp = parseInt((_d = bill === null || bill === void 0 ? void 0 : bill.lastBlockTimestamp) !== null && _d !== void 0 ? _d : '0');
|
|
76632
76635
|
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
76633
76636
|
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
76634
|
-
const [onOpenPurchasedBond] = useModal(jsx$2(
|
|
76637
|
+
const [onOpenPurchasedBond] = useModal(jsx$2(YourBondsModal, { userBill: bill }));
|
|
76635
76638
|
const ensureUserPayoutAtaExists = (_a) => __awaiter$9(void 0, [_a], void 0, function* ({ connection, payer, payoutMint, user, }) {
|
|
76636
76639
|
const userPayoutAta = yield getAssociatedTokenAddress(payoutMint, user);
|
|
76637
76640
|
try {
|
|
@@ -76742,7 +76745,7 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
76742
76745
|
});
|
|
76743
76746
|
return (jsxs("div", { className: "your-bonds", onClick: () => onOpenPurchasedBond(), children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: (_e = bill.bond) === null || _e === void 0 ? void 0 : _e.earnToken.symbol, chain: (_f = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _f === void 0 ? void 0 : _f.chainId, vestEnds: getTimeLeftForFullyVested(bill) > 0 ? `Ends in ${getPendingVestingString(bill)}` : `Fully Vested`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: ((_g = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _g === void 0 ? void 0 : _g.earnToken.address[bill === null || bill === void 0 ? void 0 : bill.bond.chainId]) || '', earnTokenSymbol: ((_h = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _h === void 0 ? void 0 : _h.earnToken.symbol) || '', bondContract: (_j = bill === null || bill === void 0 ? void 0 : bill.address) !== null && _j !== void 0 ? _j : '', projectLink: (_k = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _k === void 0 ? void 0 : _k.projectLink, twitter: (_l = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _l === void 0 ? void 0 : _l.twitter, audit: (_m = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _m === void 0 ? void 0 : _m.audit, chain: (_o = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _o === void 0 ? void 0 : _o.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex, { sx: {
|
|
76744
76747
|
opacity: 0.8,
|
|
76745
|
-
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsx$2(ProfitCard, { userBond: bill }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimable(bill), 4), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pending(bill), 4), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(pending(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: getPercentageVested(bill) }), style: {
|
|
76748
|
+
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsx$2(Flex, { sx: { width: '125px' }, children: jsx$2(ProfitCard, { userBond: bill }) }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimable(bill), 4), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pending(bill), 4), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(pending(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: getPercentageVested(bill) }), style: {
|
|
76746
76749
|
width: '127px',
|
|
76747
76750
|
height: '25px',
|
|
76748
76751
|
flexDirection: 'column',
|
|
@@ -77012,7 +77015,7 @@ const UserBondRowPreTGE = ({ userBond }) => {
|
|
|
77012
77015
|
const pendingUSD = pendingAmount * ((_x = userBond === null || userBond === void 0 ? void 0 : userBond.earnTokenPrice) !== null && _x !== void 0 ? _x : 0);
|
|
77013
77016
|
return (jsxs("div", { className: "your-bonds", onClick: () => null, children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: userBond.earnToken.symbol, chain: userBond.chainId, tag: (_y = userBond.tags) === null || _y === void 0 ? void 0 : _y[0], vestEnds: isRedeemable ? 'Claim now!' : !hasRedeemed ? `Claim in ${redeemableIn}` : `Ends in ${vestingString}`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (userBond === null || userBond === void 0 ? void 0 : userBond.earnToken.address[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]) || '', earnTokenSymbol: (userBond === null || userBond === void 0 ? void 0 : userBond.earnToken.symbol) || '', bondContract: ((_z = userBond === null || userBond === void 0 ? void 0 : userBond.contractAddress) === null || _z === void 0 ? void 0 : _z[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]) || '', projectLink: userBond === null || userBond === void 0 ? void 0 : userBond.projectLink, twitter: userBond === null || userBond === void 0 ? void 0 : userBond.twitter, audit: userBond === null || userBond === void 0 ? void 0 : userBond.audit, chain: userBond === null || userBond === void 0 ? void 0 : userBond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex$1, { sx: {
|
|
77014
77017
|
opacity: 0.8,
|
|
77015
|
-
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsx$2(Flex$1, { sx: { display: ['none', 'none', 'none', '
|
|
77018
|
+
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsx$2(Flex$1, { sx: { display: ['none', 'none', 'none', 'flex'], width: '125px' } }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimableAmount, 3), jsxs("div", { className: "your-bonds-content-tokens-usd-amount", children: ["($", formatUSDNumber$1(claimableUSD), ")"] })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pendingAmount, 3), jsxs("div", { className: "your-bonds-content-tokens-usd-amount", children: ["($", formatUSDNumber$1(pendingUSD), ")"] })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: vestingString }), jsx$2("div", { className: "your-bonds-column-button", children: jsx$2(PreTgeActions, { userBond: userBond }) })] })] }));
|
|
77016
77019
|
};
|
|
77017
77020
|
|
|
77018
77021
|
const YourBonds = ({ showOnly }) => {
|
|
@@ -80975,9 +80978,9 @@ const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView,
|
|
|
80975
80978
|
usdAmount: parseFloat(inputValue) * ((_h = inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) !== null && _h !== void 0 ? _h : 0),
|
|
80976
80979
|
},
|
|
80977
80980
|
});
|
|
80978
|
-
// waits
|
|
80979
|
-
yield new Promise((resolve) => setTimeout(resolve,
|
|
80980
|
-
console.timeEnd('
|
|
80981
|
+
// waits 3 seconds before triggering after-purchase flow
|
|
80982
|
+
yield new Promise((resolve) => setTimeout(resolve, 3000));
|
|
80983
|
+
console.timeEnd('3 seconds elapsed. trigger bonds refetch');
|
|
80981
80984
|
addToastSuccess(txId, bondChain);
|
|
80982
80985
|
setBillId === null || setBillId === void 0 ? void 0 : setBillId(nftMint.publicKey.toString());
|
|
80983
80986
|
}
|
|
@@ -81128,7 +81131,7 @@ const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
|
81128
81131
|
}
|
|
81129
81132
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
81130
81133
|
}, [billId]);
|
|
81131
|
-
return billId ? (
|
|
81134
|
+
return billId ? (jsx$2(YourBondsModal, { userBill: userBill, onDismiss: onDismiss })) : (jsx$2(BuyBondModal, { bondAddress: bondAddress, bondChain: bondChain, handlePurchasedBond: setBuyTxHash, setBillId: setBillId, onDismiss: () => {
|
|
81132
81135
|
window.history.pushState({}, '', `${locationPath !== '/bonds' ? locationPath : '/bonds'}`);
|
|
81133
81136
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
81134
81137
|
} }));
|