@goodaofi/bonds-sdk 3.0.154 → 3.0.156

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.
Files changed (2) hide show
  1. package/dist/main.js +28 -67
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -98768,43 +98768,6 @@ const SingleBondWithProviders = (props) => {
98768
98768
  return (jsx$2(Providers, { theme: props.theme, children: jsx$2(SingleBond, Object.assign({}, props)) }));
98769
98769
  };
98770
98770
 
98771
- var ABI_GOO_SALE_DEPOSIT = [
98772
- {
98773
- inputs: [
98774
- {
98775
- internalType: "uint256",
98776
- name: "_amount",
98777
- type: "uint256"
98778
- },
98779
- {
98780
- internalType: "uint256",
98781
- name: "_maxPrice",
98782
- type: "uint256"
98783
- },
98784
- {
98785
- internalType: "address",
98786
- name: "_depositor",
98787
- type: "address"
98788
- },
98789
- {
98790
- internalType: "bytes",
98791
- name: "_allowListProof",
98792
- type: "bytes"
98793
- }
98794
- ],
98795
- name: "deposit",
98796
- outputs: [
98797
- {
98798
- internalType: "uint256",
98799
- name: "",
98800
- type: "uint256"
98801
- }
98802
- ],
98803
- stateMutability: "nonpayable",
98804
- type: "function"
98805
- }
98806
- ];
98807
-
98808
98771
  const ExpandedViewButton = ({ handleNavigation, rightPos }) => {
98809
98772
  return (jsx$2(Flex, { sx: { justifyContent: 'flex-end', position: 'absolute', top: '6px', right: rightPos !== null && rightPos !== void 0 ? rightPos : '35px', width: '122px' }, children: jsxs(Flex, { sx: {
98810
98773
  fontSize: '12px',
@@ -99314,7 +99277,7 @@ const TransactionModal$1 = ({ onDismiss, txChain, approvalState, approveCallback
99314
99277
  };
99315
99278
 
99316
99279
  const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isProjectView }) => {
99317
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
99280
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
99318
99281
  const SDKConfig = useSDKConfig();
99319
99282
  // Hooks
99320
99283
  const userChainId = useChainId();
@@ -99322,8 +99285,8 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
99322
99285
  const { writeContractAsync } = useWriteContract();
99323
99286
  const { sendTransactionAsync } = useSendTransaction();
99324
99287
  const { data: saleInfo, refetch: refetchSaleInfo, isLoading: isLoadingSaleInfo } = useSaleInfo();
99325
- const { data: userInfo, isLoading: isLoadingUserInfo } = useUserInfo(account);
99326
- const sendReferenceId = useSendReferenceId();
99288
+ const { isLoading: isLoadingUserInfo } = useUserInfo(account);
99289
+ // const sendReferenceId = useSendReferenceId()
99327
99290
  const isLoading = isLoadingSaleInfo || isLoadingUserInfo;
99328
99291
  const contractsByChain = (_a = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _a === void 0 ? void 0 : _a.contractsByChain;
99329
99292
  const saleContracts = contractsByChain === null || contractsByChain === void 0 ? void 0 : contractsByChain[bondChain];
@@ -99332,13 +99295,13 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
99332
99295
  const totalBilledSats = (_c = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) !== null && _c !== void 0 ? _c : 0;
99333
99296
  const totalHardCapSats = (_d = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalHardCap) !== null && _d !== void 0 ? _d : 0;
99334
99297
  const remainingTotalSats = totalHardCapSats - totalBilledSats;
99335
- const availableUserAllowanceSats = (_e = userInfo === null || userInfo === void 0 ? void 0 : userInfo.availableAllowance) !== null && _e !== void 0 ? _e : 0;
99298
+ const availableUserAllowanceSats = 100000000;
99336
99299
  const maxUserBuyBTC = remainingTotalSats > availableUserAllowanceSats
99337
99300
  ? availableUserAllowanceSats / 100000000
99338
99301
  : remainingTotalSats / 100000000; // Convert satoshis to BTC
99339
99302
  // Get BTC price
99340
99303
  const btcPriceData = useCurrencyPrice(saleData === null || saleData === void 0 ? void 0 : saleData.principalToken, bondChain);
99341
- const btcPrice = (_f = btcPriceData === null || btcPriceData === void 0 ? void 0 : btcPriceData.price) !== null && _f !== void 0 ? _f : 0;
99304
+ const btcPrice = (_e = btcPriceData === null || btcPriceData === void 0 ? void 0 : btcPriceData.price) !== null && _e !== void 0 ? _e : 0;
99342
99305
  // Create a properly typed bondData object that matches what the component expects
99343
99306
  const bondData = saleData
99344
99307
  ? {
@@ -99346,7 +99309,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
99346
99309
  type: saleData.type,
99347
99310
  principalToken: saleData.principalToken,
99348
99311
  chainId: bondChain,
99349
- minTier: (_g = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _g === void 0 ? void 0 : _g.minTierAccess,
99312
+ minTier: (_f = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _f === void 0 ? void 0 : _f.minTierAccess,
99350
99313
  initPrice: saleData === null || saleData === void 0 ? void 0 : saleData.salePrice,
99351
99314
  tgePrice: saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.TGEPrice,
99352
99315
  lpToken: saleData.principalToken,
@@ -99378,15 +99341,16 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
99378
99341
  : undefined;
99379
99342
  const isMobile = useIsMobile();
99380
99343
  // Tier Gating
99381
- const userTier = (_h = userInfo === null || userInfo === void 0 ? void 0 : userInfo.tier) !== null && _h !== void 0 ? _h : null;
99382
- const minTier = (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) !== undefined ? bondData.minTier : null;
99344
+ // const userTier = userInfo?.tier ?? null
99345
+ // const minTier = bondData?.minTier !== undefined ? bondData.minTier : null
99383
99346
  // Only restrict if data is loaded and user tier is actually higher than required
99384
- const isUserRestricted = !isLoading && minTier !== null && userTier !== null && userTier > minTier;
99347
+ // const isUserRestricted = !isLoading && minTier !== null && userTier !== null && userTier > minTier
99348
+ const isUserRestricted = false;
99385
99349
  const trueBondPrice = saleData === null || saleData === void 0 ? void 0 : saleData.salePrice.toString();
99386
99350
  // State
99387
99351
  const [buyTxHash, setBuyTxHash] = useState();
99388
99352
  const [inputValue, setInputValue] = useState('0');
99389
- const [inputTokenString, setInputTokenString] = useState((_k = (_j = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _j === void 0 ? void 0 : _j.address) === null || _k === void 0 ? void 0 : _k[bondData.chainId]);
99353
+ const [inputTokenString, setInputTokenString] = useState((_h = (_g = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _g === void 0 ? void 0 : _g.address) === null || _h === void 0 ? void 0 : _h[bondData.chainId]);
99390
99354
  // On-chain Data
99391
99355
  const inputToken = useTokenFromZapList(inputTokenString, bondData === null || bondData === void 0 ? void 0 : bondData.chainId, bondData === null || bondData === void 0 ? void 0 : bondData.lpToken);
99392
99356
  // const isZap = inputTokenString?.toLowerCase() !== bondData?.lpToken?.address?.[bondData?.chainId]?.toLowerCase()
@@ -99409,7 +99373,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
99409
99373
  const youSpendString = `${formatNumber$3(parseFloat(inputValue), 0, 8) === 'NaN' ? '0' : formatNumber$3(parseFloat(inputValue), 0, 8)} ${getSymbol(inputToken, bondData === null || bondData === void 0 ? void 0 : bondData.chainId)} =
99410
99374
  $${formatUSDNumber((parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0)).toString())}`;
99411
99375
  // Validations
99412
- const isGoldRush = ((_l = bondData === null || bondData === void 0 ? void 0 : bondData.billArt) === null || _l === void 0 ? void 0 : _l.collection) === main.BillArtCollection.GoldenTicket_Collection1;
99376
+ const isGoldRush = ((_j = bondData === null || bondData === void 0 ? void 0 : bondData.billArt) === null || _j === void 0 ? void 0 : _j.collection) === main.BillArtCollection.GoldenTicket_Collection1;
99413
99377
  const zapEnabled = false;
99414
99378
  const MINIMUM_PURCHASE_BTC = 0.0001; // 10,000 sats
99415
99379
  const belowMinimum = parseFloat(depositAmount) > 0 && parseFloat(depositAmount) < MINIMUM_PURCHASE_BTC;
@@ -99426,7 +99390,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
99426
99390
  setInputTokenString(newInputToken);
99427
99391
  }, []);
99428
99392
  // Approve & Purchase Functions
99429
- const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (_o = ((_m = bondData === null || bondData === void 0 ? void 0 : bondData.contractAddress) === null || _m === void 0 ? void 0 : _m[bondData.chainId])) !== null && _o !== void 0 ? _o : null, account !== null && account !== void 0 ? account : null, (_p = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _p !== void 0 ? _p : null);
99393
+ const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (_l = ((_k = bondData === null || bondData === void 0 ? void 0 : bondData.contractAddress) === null || _k === void 0 ? void 0 : _k[bondData.chainId])) !== null && _l !== void 0 ? _l : null, account !== null && account !== void 0 ? account : null, (_m = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _m !== void 0 ? _m : null);
99430
99394
  const handleApprove = () => __awaiter$9(void 0, void 0, void 0, function* () {
99431
99395
  return approveCallback().then(() => {
99432
99396
  track({
@@ -99465,17 +99429,11 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
99465
99429
  .toFixed(0);
99466
99430
  const maxPrice = pricePerToken;
99467
99431
  // Fetch allowlist signature with the actual amount
99468
- let allowlistProofSig = null;
99469
- if (!isUserRestricted) {
99470
- allowlistProofSig = yield getAllowListProofSig((_e = (_d = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _d === void 0 ? void 0 : _d.apiV2) !== null && _e !== void 0 ? _e : '', account, bondAddress, bondChain, amount);
99471
- if (!allowlistProofSig) {
99472
- throw new Error('Failed to get allowlist signature. Please check console for details.');
99473
- }
99474
- }
99475
- const args = [amount, maxPrice, account, allowlistProofSig];
99432
+ yield getAllowListProofSig((_e = (_d = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _d === void 0 ? void 0 : _d.apiV2) !== null && _e !== void 0 ? _e : '', account, bondAddress, bondChain, amount);
99433
+ const args = [amount, maxPrice, account];
99476
99434
  const hash = yield writeContractAsync({
99477
99435
  address: billAddress,
99478
- abi: ABI_GOO_SALE_DEPOSIT,
99436
+ abi: ABI_DEPOSIT,
99479
99437
  functionName: 'deposit',
99480
99438
  args: args,
99481
99439
  chain: bondData === null || bondData === void 0 ? void 0 : bondData.chainId,
@@ -99483,7 +99441,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
99483
99441
  });
99484
99442
  if (hash) {
99485
99443
  setBuyTxHash(hash);
99486
- yield sendReferenceId(billAddress, userChainId, hash);
99444
+ // await sendReferenceId(billAddress, userChainId, hash)
99487
99445
  handlePurchasedBond === null || handlePurchasedBond === void 0 ? void 0 : handlePurchasedBond(hash);
99488
99446
  track({
99489
99447
  event: 'bond',
@@ -99559,9 +99517,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
99559
99517
  mt: '10px',
99560
99518
  borderRadius: 'normal',
99561
99519
  p: '2px 10px',
99562
- }, children: jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400, display: 'flex', alignItems: 'center', gap: '10px' }, children: [jsx$2(SafeHTMLComponent, { html: bondData === null || bondData === void 0 ? void 0 : bondData.warningCard }), (bondData === null || bondData === void 0 ? void 0 : bondData.chainId) === main.ChainId.SONIC && (bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol.toLowerCase()) === 'moon' && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Open the 'cog' icon menu in the top right and set the Slippage Tolerance to 5% or more." }), width: "315px", placement: "topRight", transformTip: "translate(9%, -10%)", children: jsx$2(Svg, { icon: "questionCircle", width: 14, color: "textDisabledButton" }) }))] }) })), jsxs(Flex, { className: "modaltable-container button-container", children: [account && (jsx$2(Flex, { className: "button-container get", children: jsx$2(Button, { className: "action-button", onClick: () => isUserRestricted
99563
- ? window.open('https://gmoney.site/whitelist', '_blank')
99564
- : openExternal(), variant: "secondary", fullWidth: true, children: isUserRestricted ? `Get ${!isMobile ? 'your' : ''} Tier` : `Get ${getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)}` }) })), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : isUserRestricted ? (jsx$2(Button, { className: "action-button", disabled: true, children: "INSUFFICIENT TIER" })) : (jsx$2(Button, { className: "action-button", load: load || fetchingZapQuote, disabled: load ||
99520
+ }, children: jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400, display: 'flex', alignItems: 'center', gap: '10px' }, children: [jsx$2(SafeHTMLComponent, { html: bondData === null || bondData === void 0 ? void 0 : bondData.warningCard }), (bondData === null || bondData === void 0 ? void 0 : bondData.chainId) === main.ChainId.SONIC && (bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol.toLowerCase()) === 'moon' && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Open the 'cog' icon menu in the top right and set the Slippage Tolerance to 5% or more." }), width: "315px", placement: "topRight", transformTip: "translate(9%, -10%)", children: jsx$2(Svg, { icon: "questionCircle", width: 14, color: "textDisabledButton" }) }))] }) })), jsxs(Flex, { className: "modaltable-container button-container", children: [account && (jsx$2(Flex, { className: "button-container get", children: jsx$2(Button, { className: "action-button", onClick: () => openExternal(), variant: "secondary", fullWidth: true, children: `Get ${getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)}` }) })), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : (jsx$2(Button, { className: "action-button", load: load || fetchingZapQuote, disabled: load ||
99565
99521
  (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
99566
99522
  !account ||
99567
99523
  !inputValue ||
@@ -99899,10 +99855,10 @@ const ProgressBar = ({ saleInfo }) => {
99899
99855
  const baseAmount = 100 + previousStagesBilled;
99900
99856
  const hardCap = useMemo(() => { var _a; return ((_a = stage === null || stage === void 0 ? void 0 : stage.hardCapSats) !== null && _a !== void 0 ? _a : 0) / 100000000 + baseAmount; }, [stage, baseAmount]);
99901
99857
  const billed = useMemo(() => { var _a; return ((_a = stage === null || stage === void 0 ? void 0 : stage.totalBilledSats) !== null && _a !== void 0 ? _a : 0) / 100000000 + baseAmount; }, [stage, baseAmount]);
99902
- const isTimeProgress = false;
99858
+ const isTimeProgress = true;
99903
99859
  const [timeLeft, setTimeLeft] = useState('');
99904
99860
  const [timeProgress, setTimeProgress] = useState(0);
99905
- const value = useMemo(() => ((billed / hardCap) * 100), [isTimeProgress, timeProgress, billed, hardCap]);
99861
+ const value = useMemo(() => (timeProgress ), [isTimeProgress, timeProgress, billed, hardCap]);
99906
99862
  const stageNumber = useMemo(() => { var _a; return (_a = stage === null || stage === void 0 ? void 0 : stage.stageNumber) !== null && _a !== void 0 ? _a : 1; }, [stage]);
99907
99863
  const contractsByChain = (_c = (_b = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.stages) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.contractsByChain;
99908
99864
  const saleContracts = contractsByChain === null || contractsByChain === void 0 ? void 0 : contractsByChain[main.ChainId.BASE];
@@ -99911,7 +99867,7 @@ const ProgressBar = ({ saleInfo }) => {
99911
99867
  const btcPriceData = useCurrencyPrice(saleData === null || saleData === void 0 ? void 0 : saleData.principalToken, main.ChainId.BASE);
99912
99868
  const btcPrice = (_d = btcPriceData === null || btcPriceData === void 0 ? void 0 : btcPriceData.price) !== null && _d !== void 0 ? _d : 0;
99913
99869
  const totalBilledBTC = ((saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) ? (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) / 100000000 : 0) + 100;
99914
- (totalBilledBTC * btcPrice).toLocaleString('en-US', {
99870
+ const totalBilledUSD = (totalBilledBTC * btcPrice).toLocaleString('en-US', {
99915
99871
  style: 'currency',
99916
99872
  currency: 'USD',
99917
99873
  maximumFractionDigits: 0,
@@ -99971,13 +99927,18 @@ const ProgressBar = ({ saleInfo }) => {
99971
99927
  })
99972
99928
  : 'N/A';
99973
99929
  }, [saleInfo]);
99974
- return (jsxs(Fragment$1, { children: [jsxs(Flex$1, { sx: { alignItems: 'end', justifyContent: 'space-between', flexDirection: 'row', mt: '1rem' }, children: [jsxs(Flex$1, { sx: { flexDirection: 'column', width: '250px', alignItems: 'start' }, children: [isTimeProgress, (jsxs(Fragment$1, { children: [jsx$2(Text, { sx: {
99930
+ return (jsxs(Fragment$1, { children: [jsxs(Flex$1, { sx: { alignItems: 'end', justifyContent: 'space-between', flexDirection: 'row', mt: '1rem' }, children: [jsxs(Flex$1, { sx: { flexDirection: 'column', width: '250px', alignItems: 'start' }, children: [(jsxs(Fragment$1, { children: [jsx$2(Text, { sx: {
99931
+ fontSize: '14px',
99932
+ fontWeight: '700',
99933
+ color: 'var(--theme-ui-colors-textDisabledButton)',
99934
+ mb: '0.2rem',
99935
+ }, children: "Total Raised" }), jsxs(Flex$1, { sx: { flexDirection: 'row', alignItems: 'center' }, children: [jsx$2(Text, { sx: { fontSize: '22px', fontWeight: '700' }, children: `${totalBilledBTC.toFixed(0)} BTC` }), jsx$2(Text, { sx: { fontSize: '14px', fontWeight: '400', ml: '10px' }, children: `(${totalBilledUSD})` })] })] })), (jsxs(Fragment$1, { children: [jsx$2(Text, { sx: {
99975
99936
  fontSize: '14px',
99976
99937
  fontWeight: '700',
99977
99938
  color: 'var(--theme-ui-colors-textDisabledButton)',
99978
99939
  mb: '0.2rem',
99979
99940
  mt: '1rem',
99980
- }, children: 'Raise Progress' }), jsx$2(Text, { sx: { fontSize: '22px', fontWeight: '700' }, children: `${billed.toFixed(2)} BTC/ ${hardCap} BTC` })] }))] }), jsx$2(Text, { sx: {
99941
+ }, children: 'Stage ' + stageNumber + ' Progress' }), jsx$2(Text, { sx: { fontSize: '22px', fontWeight: '700' }, children: `${timeLeft}` })] })) ] }), jsx$2(Text, { sx: {
99981
99942
  fontSize: '12px',
99982
99943
  fontWeight: '400',
99983
99944
  textAlign: 'right',
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Goo Money Bond SDK",
4
4
  "author": "Goo Money",
5
5
  "license": "MIT",
6
- "version": "3.0.154",
6
+ "version": "3.0.156",
7
7
  "proxy": "https://realtime-api-pr-99.herokuapp.com",
8
8
  "module": "dist/main.js",
9
9
  "type": "module",