@goodaofi/bonds-sdk 3.0.135 → 3.0.136

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 CHANGED
@@ -95159,8 +95159,8 @@ const transformPrivatePartnerData = (rawData, isFake) => {
95159
95159
  };
95160
95160
 
95161
95161
  const stepDelay = 1000;
95162
- const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, bondData, inputToken, inputValue, depositAmount, buyTxHash, rateChanged, }) => {
95163
- var _a, _b, _c;
95162
+ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, inputToken, inputValue, buyTxHash, rateChanged, }) => {
95163
+ var _a;
95164
95164
  // Hooks
95165
95165
  const { chain } = useAccount();
95166
95166
  const inputTokenPrice = useCurrencyPrice(inputToken !== null && inputToken !== void 0 ? inputToken : null, txChain);
@@ -95176,8 +95176,6 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
95176
95176
  // Loading state
95177
95177
  const [loadingSwitchChain, setLoadingSwitchChain] = useState(false);
95178
95178
  const [approveLoading, setApproveLoading] = useState(false);
95179
- // Values for regular bonds
95180
- getGooSaleOutputAmount(depositAmount, Number((_a = bondData === null || bondData === void 0 ? void 0 : bondData.initPrice) !== null && _a !== void 0 ? _a : 0));
95181
95179
  const handleSwitchChain = () => {
95182
95180
  setLoadingSwitchChain(true);
95183
95181
  switchChainAsync({ chainId: txChain })
@@ -95254,7 +95252,6 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
95254
95252
  /* eslint-disable react-hooks/exhaustive-deps */
95255
95253
  }, [buyTxHash, txReceipt, isSuccess]);
95256
95254
  const currentStep = showSwitchChainFlow ? (hasToSwitchChain ? 1 : hasToApprove ? 2 : 3) : hasToApprove ? 1 : 2;
95257
- typeof inputToken !== 'string' ? (_b = inputToken === null || inputToken === void 0 ? void 0 : inputToken.symbol) === null || _b === void 0 ? void 0 : _b.split('-') : undefined;
95258
95255
  return (jsxs(Modal, { children: [jsx$2(ModalHeader, { onDismiss: onDismiss, hideDivider: true }), jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsxs(Flex, { sx: { width: '100%', alignItems: 'center', p: '10px' }, children: [showSwitchChainFlow && (jsx$2(StepBubble, { number: 1, title: 'Switch Chain', currentStep: currentStep, loading: loadingSwitchChain })), jsx$2(StepBubble, { number: showSwitchChainFlow ? 2 : 1, title: 'Approve', currentStep: currentStep, loading: approveLoading || approvalState === ApprovalState.PENDING }), jsx$2(StepBubble, { number: showSwitchChainFlow ? 3 : 2, title: 'Deposit', currentStep: currentStep, loading: loadingTx || verifyingTx, hideBar: true })] }), jsx$2(Flex, { sx: { width: '100%', mt: '40px', justifyContent: 'center' }, children: jsx$2(LoadingSpinner, { isLoading: loadingSwitchChain ||
95259
95256
  approveLoading ||
95260
95257
  loadingTx ||
@@ -95269,12 +95266,12 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
95269
95266
  : 'Approve Contract'
95270
95267
  : loadingTx || verifyingTx
95271
95268
  ? 'Depositing...'
95272
- : 'Deposit' }), jsx$2(Flex, { sx: { width: '100%', flexDirection: 'column', alignItems: 'center', mt: '20px' }, children: jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [jsx$2(TokenImage, { symbol: getSymbol(inputToken, txChain), size: 20, chain: txChain }), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: (_c = formatNumber$1(inputValue)) !== null && _c !== void 0 ? _c : '0' }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["(", (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) && inputValue
95269
+ : 'Deposit' }), jsx$2(Flex, { sx: { width: '100%', flexDirection: 'column', alignItems: 'center', mt: '20px' }, children: jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [jsx$2(TokenImage, { symbol: getSymbol(inputToken, txChain), size: 20, chain: txChain }), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: (_a = formatNumber$1(inputValue)) !== null && _a !== void 0 ? _a : '0' }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["(", (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) && inputValue
95273
95270
  ? `$${formatUSDNumber(((inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) * parseFloat(inputValue)).toFixed(2))}`
95274
95271
  : '0.00', ")"] })] }) }), jsx$2(Flex, { sx: { mt: '20px' }, children: hasToSwitchChain ? (jsxs(Button, { load: loadingSwitchChain, disabled: loadingSwitchChain, onClick: handleSwitchChain, fullWidth: true, children: ["switch to ", NETWORK_LABEL[txChain]] })) : !hasToApprove ? (jsx$2(Button, { load: loadingTx || verifyingTx, disabled: loadingTx || verifyingTx, onClick: txCallback, fullWidth: true, children: "Deposit" })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING || approveLoading, disabled: approvalState === ApprovalState.PENDING || approveLoading, onClick: handleApprove, fullWidth: true, children: "Approve" })) })] })] }));
95275
95272
  };
95276
95273
 
95277
- const GooPrivatePartners = ({ tokenSymbol }) => {
95274
+ const GooPrivatePartners = () => {
95278
95275
  var _a;
95279
95276
  const { address: account } = useAccount();
95280
95277
  const currentChainId = useChainId();
@@ -95368,8 +95365,7 @@ const GooPrivatePartners = ({ tokenSymbol }) => {
95368
95365
  setLoadingTx(false);
95369
95366
  }
95370
95367
  });
95371
- const depositAmount = inputValue ? inputValue : '0';
95372
- const [openTxModal] = useModal(jsx$2(TransactionModal, { txChain: chainId, approvalState: approvalState, approveCallback: handleApprove, loadingTx: loadingTx, txCallback: handleDeposit, bondData: bondData, inputToken: depositToken, inputValue: inputValue, depositAmount: depositAmount, buyTxHash: buyTxHash, rateChanged: false, onDismiss: () => { } }), false, true, 'transactionModal');
95368
+ const [openTxModal] = useModal(jsx$2(TransactionModal, { txChain: chainId, approvalState: approvalState, approveCallback: handleApprove, loadingTx: loadingTx, txCallback: handleDeposit, inputToken: depositToken, inputValue: inputValue, buyTxHash: buyTxHash, rateChanged: false, onDismiss: () => { } }), false, true, 'transactionModal');
95373
95369
  const exceedsBalance = new BigNumber$1(tokenBalance).lt(inputValue);
95374
95370
  const isValidAmount = inputValue && parseFloat(inputValue) > 0;
95375
95371
  return (jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', alignItems: 'center' }, children: jsxs(Flex, { sx: {
@@ -95430,7 +95426,7 @@ const GooPrivatePartners = ({ tokenSymbol }) => {
95430
95426
 
95431
95427
  const GooPrivatePartnersWithProviders = (props) => {
95432
95428
  useSDKConfig(props);
95433
- return (jsx$2(Providers, { theme: props.theme, children: jsx$2(GooPrivatePartners, Object.assign({}, props)) }));
95429
+ return (jsx$2(Providers, { theme: props.theme, children: jsx$2(GooPrivatePartners, {}) }));
95434
95430
  };
95435
95431
 
95436
95432
  var ChainId = types.ChainId;
@@ -1,6 +1,3 @@
1
1
  import React from 'react';
2
- export interface GooPrivatePartnersProps {
3
- tokenSymbol?: string[];
4
- }
5
- declare const GooPrivatePartners: ({ tokenSymbol }: GooPrivatePartnersProps) => React.JSX.Element;
2
+ declare const GooPrivatePartners: () => React.JSX.Element;
6
3
  export default GooPrivatePartners;
@@ -1,18 +1,15 @@
1
1
  import React from 'react';
2
2
  import { ApprovalState } from '../../state/allowance/useAllowance';
3
3
  import { Token } from '@ape.swap/apeswap-lists';
4
- import { GooSaleBondData } from '../GooSale/components/BuyBond/BuyBond';
5
- declare const TransactionModal: ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, bondData, inputToken, inputValue, depositAmount, buyTxHash, rateChanged, }: {
4
+ declare const TransactionModal: ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, inputToken, inputValue, buyTxHash, rateChanged, }: {
6
5
  onDismiss?: () => void;
7
6
  txChain?: number;
8
7
  approvalState?: ApprovalState;
9
8
  approveCallback?: () => Promise<void>;
10
9
  loadingTx?: boolean;
11
10
  txCallback?: () => void;
12
- bondData: GooSaleBondData | undefined;
13
11
  inputToken: Token | "NATIVE" | undefined;
14
12
  inputValue: string;
15
- depositAmount: string;
16
13
  buyTxHash?: string;
17
14
  rateChanged: boolean;
18
15
  }) => React.JSX.Element;
@@ -1,7 +1,4 @@
1
1
  import React from 'react';
2
2
  import { SDKPropsDTO } from '../../state/useSDKConfig';
3
- import { GooPrivatePartnersProps } from './GooPrivatePartners';
4
- interface Props extends SDKPropsDTO, GooPrivatePartnersProps {
5
- }
6
- declare const GooPrivatePartnersWithProviders: React.FC<Props>;
3
+ declare const GooPrivatePartnersWithProviders: React.FC<SDKPropsDTO>;
7
4
  export default GooPrivatePartnersWithProviders;
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.135",
6
+ "version": "3.0.136",
7
7
  "proxy": "https://realtime-api-pr-99.herokuapp.com",
8
8
  "module": "dist/main.js",
9
9
  "type": "module",