@goodaofi/bonds-sdk 3.0.166 → 3.0.168
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 +67 -7
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -70808,8 +70808,32 @@ const VESTING_NFT_ABI = [
|
|
|
70808
70808
|
type: 'function',
|
|
70809
70809
|
},
|
|
70810
70810
|
];
|
|
70811
|
+
// Minimal ERC20 ABI for fetching token metadata
|
|
70812
|
+
const ERC20_ABI = [
|
|
70813
|
+
{
|
|
70814
|
+
inputs: [],
|
|
70815
|
+
name: 'name',
|
|
70816
|
+
outputs: [{ internalType: 'string', name: '', type: 'string' }],
|
|
70817
|
+
stateMutability: 'view',
|
|
70818
|
+
type: 'function',
|
|
70819
|
+
},
|
|
70820
|
+
{
|
|
70821
|
+
inputs: [],
|
|
70822
|
+
name: 'symbol',
|
|
70823
|
+
outputs: [{ internalType: 'string', name: '', type: 'string' }],
|
|
70824
|
+
stateMutability: 'view',
|
|
70825
|
+
type: 'function',
|
|
70826
|
+
},
|
|
70827
|
+
{
|
|
70828
|
+
inputs: [],
|
|
70829
|
+
name: 'decimals',
|
|
70830
|
+
outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
|
|
70831
|
+
stateMutability: 'view',
|
|
70832
|
+
type: 'function',
|
|
70833
|
+
},
|
|
70834
|
+
];
|
|
70811
70835
|
// Hardcoded vesting NFT contract address
|
|
70812
|
-
const VESTING_NFT_ADDRESS$1 = '
|
|
70836
|
+
const VESTING_NFT_ADDRESS$1 = '0x1d792892823306D15C9c65938f9385fC2dA97271';
|
|
70813
70837
|
const VESTING_NFT_CHAIN_ID = main.ChainId.BASE;
|
|
70814
70838
|
const fetchVestingNftBills = (account) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70815
70839
|
try {
|
|
@@ -70848,6 +70872,33 @@ const fetchVestingNftBills = (account) => __awaiter$9(void 0, void 0, void 0, fu
|
|
|
70848
70872
|
]);
|
|
70849
70873
|
const detailResults = yield multicall(VESTING_NFT_CHAIN_ID, VESTING_NFT_ABI, detailCalls);
|
|
70850
70874
|
const result = [];
|
|
70875
|
+
// Collect unique payout token addresses to fetch their metadata
|
|
70876
|
+
const payoutTokenAddresses = new Set();
|
|
70877
|
+
for (let i = 0; i < tokenIds.length; i++) {
|
|
70878
|
+
const schedule = detailResults[i * 2][0];
|
|
70879
|
+
payoutTokenAddresses.add(schedule.payoutToken);
|
|
70880
|
+
}
|
|
70881
|
+
// Fetch ERC20 metadata (name, symbol, decimals) for each unique payout token
|
|
70882
|
+
const tokenMetadata = {};
|
|
70883
|
+
for (const tokenAddress of payoutTokenAddresses) {
|
|
70884
|
+
try {
|
|
70885
|
+
const erc20Calls = [
|
|
70886
|
+
{ address: tokenAddress, name: 'name', params: [] },
|
|
70887
|
+
{ address: tokenAddress, name: 'symbol', params: [] },
|
|
70888
|
+
{ address: tokenAddress, name: 'decimals', params: [] },
|
|
70889
|
+
];
|
|
70890
|
+
const erc20Results = yield multicall(VESTING_NFT_CHAIN_ID, ERC20_ABI, erc20Calls);
|
|
70891
|
+
tokenMetadata[tokenAddress] = {
|
|
70892
|
+
name: erc20Results[0][0],
|
|
70893
|
+
symbol: erc20Results[1][0],
|
|
70894
|
+
decimals: Number(erc20Results[2][0]),
|
|
70895
|
+
};
|
|
70896
|
+
}
|
|
70897
|
+
catch (e) {
|
|
70898
|
+
console.error(`Error fetching ERC20 metadata for ${tokenAddress}:`, e);
|
|
70899
|
+
tokenMetadata[tokenAddress] = { name: 'Unknown', symbol: 'UNKNOWN', decimals: 18 };
|
|
70900
|
+
}
|
|
70901
|
+
}
|
|
70851
70902
|
for (let i = 0; i < tokenIds.length; i++) {
|
|
70852
70903
|
const scheduleResult = detailResults[i * 2];
|
|
70853
70904
|
const claimableResult = detailResults[i * 2 + 1];
|
|
@@ -70861,6 +70912,8 @@ const fetchVestingNftBills = (account) => __awaiter$9(void 0, void 0, void 0, fu
|
|
|
70861
70912
|
// Calculate durations in seconds (expected by displayHelpers)
|
|
70862
70913
|
const vestingDuration = vestingEnd - vestingStart;
|
|
70863
70914
|
const vestingCliff = cliffEnd - vestingStart;
|
|
70915
|
+
const payoutTokenAddress = schedule.payoutToken;
|
|
70916
|
+
const tokenMeta = tokenMetadata[payoutTokenAddress];
|
|
70864
70917
|
// Map to UserBill format
|
|
70865
70918
|
result.push({
|
|
70866
70919
|
address: VESTING_NFT_ADDRESS$1,
|
|
@@ -70880,10 +70933,10 @@ const fetchVestingNftBills = (account) => __awaiter$9(void 0, void 0, void 0, fu
|
|
|
70880
70933
|
billNnftAddress: { [VESTING_NFT_CHAIN_ID]: VESTING_NFT_ADDRESS$1 },
|
|
70881
70934
|
vestingCliff: vestingCliff > 0 ? vestingCliff : undefined,
|
|
70882
70935
|
earnToken: {
|
|
70883
|
-
symbol:
|
|
70884
|
-
name:
|
|
70885
|
-
address: { [VESTING_NFT_CHAIN_ID]:
|
|
70886
|
-
decimals: { [VESTING_NFT_CHAIN_ID]:
|
|
70936
|
+
symbol: tokenMeta.symbol,
|
|
70937
|
+
name: tokenMeta.name,
|
|
70938
|
+
address: { [VESTING_NFT_CHAIN_ID]: payoutTokenAddress },
|
|
70939
|
+
decimals: { [VESTING_NFT_CHAIN_ID]: tokenMeta.decimals },
|
|
70887
70940
|
},
|
|
70888
70941
|
},
|
|
70889
70942
|
});
|
|
@@ -74511,7 +74564,7 @@ const YourBonds = ({ showOnly, isGooSale }) => {
|
|
|
74511
74564
|
const [inputValue, setInputValue] = useState('');
|
|
74512
74565
|
const filterOptions = ['CLAIMABLE', 'ALL'];
|
|
74513
74566
|
const [filterOption, setFilterOption] = useState(filterOptions[0]);
|
|
74514
|
-
const VESTING_NFT_ADDRESS = '
|
|
74567
|
+
const VESTING_NFT_ADDRESS = '0x1d792892823306D15C9c65938f9385fC2dA97271';
|
|
74515
74568
|
const handleSort = (key) => {
|
|
74516
74569
|
let direction = 'desc';
|
|
74517
74570
|
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'desc') {
|
|
@@ -100876,7 +100929,14 @@ const GooSale = () => {
|
|
|
100876
100929
|
p: '20px',
|
|
100877
100930
|
m: '20px',
|
|
100878
100931
|
borderRadius: 'normal',
|
|
100879
|
-
}, children: cbBTCBalanceChecked && (jsx$2(Flex, { sx: { flexDirection: 'column', alignItems: 'center', gap: '10px', mt: '10px' }, children: isCbBTCBalanceLoading ? (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Checking BTC balance across all chains..." })) : cbBTCBalance ? (jsxs(Fragment$1, { children: [cbBTCBalance.isEligible ? (addToWhitelistSuccess ? (jsx$2(Text, { color: "primaryButton", sx: { fontSize: '12px', fontWeight: 700 }, children: "\u2713 Successfully added to whitelist! Please refresh to see your tier." })) : addToWhitelistError ? (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'error' }, children: "Failed to add to whitelist. Please try again." })) : (jsx$2(Fragment$1, { children: jsx$2(Flex, { sx: { flexDirection: 'row', alignItems: 'center' }, children: jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You ", jsx$2("span", { sx: { fontWeight: 700 }, children: "ARE" }), " eligible for the sale"] }) }) }))) : (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', gap: '10px' }, children: [jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You are ", jsx$2("span", { sx: { fontWeight: 700 }, children: "NOT" }), " eligible for the sale"] }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'error' }, children: "You need at least 0.001 BTC to be whitelisted" })] })), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Total BTC Balance: ", cbBTCBalance.balance] }), cbBTCBalance.chainsWithBalance && cbBTCBalance.chainsWithBalance.length > 0 && (jsx$2(Flex, { sx: { flexDirection: 'column', gap: '5px', mt: '5px' }, children: cbBTCBalance.chainsWithBalance.map((chain) => (jsxs(Flex, { sx: { flexDirection: 'row', alignItems: 'center', gap: '10px' }, children: [jsx$2(TokenImage, { symbol: chain.symbol, size: 25, chain: chain.chainId }), jsxs(Text, { sx: { fontSize: '10px', fontWeight: 400, opacity: 0.7 }, children: [chain.balance, " ", chain.symbol] })] }, chain.chainId))) })), cbBTCBalance.isEligible && (jsx$2(Button, { sx: { width: '100%' }, onClick: () => addToWhitelist(), disabled: isAddingToWhitelist, children: isAddingToWhitelist ? 'ADDING TO WHITELIST...' : 'ADD ME TO WHITELIST' }))] })) : (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Unable to fetch BTC balance. Please try again." })) })) }))] })) : (jsx$2(Fragment$1, {}))] })),
|
|
100932
|
+
}, children: cbBTCBalanceChecked && (jsx$2(Flex, { sx: { flexDirection: 'column', alignItems: 'center', gap: '10px', mt: '10px' }, children: isCbBTCBalanceLoading ? (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Checking BTC balance across all chains..." })) : cbBTCBalance ? (jsxs(Fragment$1, { children: [cbBTCBalance.isEligible ? (addToWhitelistSuccess ? (jsx$2(Text, { color: "primaryButton", sx: { fontSize: '12px', fontWeight: 700 }, children: "\u2713 Successfully added to whitelist! Please refresh to see your tier." })) : addToWhitelistError ? (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'error' }, children: "Failed to add to whitelist. Please try again." })) : (jsx$2(Fragment$1, { children: jsx$2(Flex, { sx: { flexDirection: 'row', alignItems: 'center' }, children: jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You ", jsx$2("span", { sx: { fontWeight: 700 }, children: "ARE" }), " eligible for the sale"] }) }) }))) : (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', gap: '10px' }, children: [jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You are ", jsx$2("span", { sx: { fontWeight: 700 }, children: "NOT" }), " eligible for the sale"] }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'error' }, children: "You need at least 0.001 BTC to be whitelisted" })] })), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Total BTC Balance: ", cbBTCBalance.balance] }), cbBTCBalance.chainsWithBalance && cbBTCBalance.chainsWithBalance.length > 0 && (jsx$2(Flex, { sx: { flexDirection: 'column', gap: '5px', mt: '5px' }, children: cbBTCBalance.chainsWithBalance.map((chain) => (jsxs(Flex, { sx: { flexDirection: 'row', alignItems: 'center', gap: '10px' }, children: [jsx$2(TokenImage, { symbol: chain.symbol, size: 25, chain: chain.chainId }), jsxs(Text, { sx: { fontSize: '10px', fontWeight: 400, opacity: 0.7 }, children: [chain.balance, " ", chain.symbol] })] }, chain.chainId))) })), cbBTCBalance.isEligible && (jsx$2(Button, { sx: { width: '100%' }, onClick: () => addToWhitelist(), disabled: isAddingToWhitelist, children: isAddingToWhitelist ? 'ADDING TO WHITELIST...' : 'ADD ME TO WHITELIST' }))] })) : (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Unable to fetch BTC balance. Please try again." })) })) }))] })) : (jsx$2(Fragment$1, {}))] })), (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.isSaleEnded) && (jsx$2(Flex, { sx: {
|
|
100933
|
+
display: 'flex',
|
|
100934
|
+
flexDirection: 'column',
|
|
100935
|
+
alignItems: 'center',
|
|
100936
|
+
justifyContent: 'center',
|
|
100937
|
+
width: '100%',
|
|
100938
|
+
p: '6%',
|
|
100939
|
+
}, children: jsx$2(Button, { sx: { width: '230px' }, onClick: () => (window.location.href = `${window.location.origin}/bonds`), children: "Start Bonding" }) })), jsxs(Flex, { sx: {
|
|
100880
100940
|
width: '100%',
|
|
100881
100941
|
alignItems: 'center',
|
|
100882
100942
|
px: '12%',
|