@ape.swap/bonds-sdk 1.0.28 → 1.0.30

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 (51) hide show
  1. package/dist/asset-manifest.json +15 -0
  2. package/dist/index.html +1 -0
  3. package/dist/static/css/main.f855e6bc.css +2 -0
  4. package/dist/static/css/main.f855e6bc.css.map +1 -0
  5. package/dist/static/js/453.31959e28.chunk.js +2 -0
  6. package/dist/static/js/453.31959e28.chunk.js.map +1 -0
  7. package/dist/static/js/main.8166fa54.js +3 -0
  8. package/dist/static/js/main.8166fa54.js.LICENSE.txt +101 -0
  9. package/dist/static/js/main.8166fa54.js.map +1 -0
  10. package/package.json +5 -2
  11. package/.idea/bonds-app.iml +0 -12
  12. package/.idea/inspectionProfiles/Project_Default.xml +0 -16
  13. package/.idea/modules.xml +0 -8
  14. package/.idea/vcs.xml +0 -6
  15. package/public/index.html +0 -43
  16. package/src/App.css +0 -38
  17. package/src/App.test.tsx +0 -9
  18. package/src/App.tsx +0 -30
  19. package/src/index.css +0 -22
  20. package/src/index.tsx +0 -20
  21. package/src/logo.svg +0 -1
  22. package/src/react-app-env.d.ts +0 -1
  23. package/src/reportWebVitals.ts +0 -15
  24. package/src/setupTests.ts +0 -5
  25. package/src/theme/base.ts +0 -127
  26. package/src/theme/colors.ts +0 -93
  27. package/src/theme/components.ts +0 -385
  28. package/src/theme/display.ts +0 -2
  29. package/src/theme/index.ts +0 -10
  30. package/src/theme/types.ts +0 -10
  31. package/src/views/Bonds/Bonds.tsx +0 -77
  32. package/src/views/Bonds/index.ts +0 -2
  33. package/src/views/Bonds/styles.scss +0 -24
  34. package/src/views/Bonds/styles.ts +0 -91
  35. package/src/views/Bonds/type.ts +0 -34
  36. package/src/views/index.ts +0 -1
  37. package/src/wallet/ConnectionOptions.tsx +0 -59
  38. package/src/wallet/Option.tsx +0 -44
  39. package/src/wallet/config.ts +0 -23
  40. package/src/wallet/connections.ts +0 -92
  41. package/src/wallet/constants.ts +0 -43
  42. package/src/wallet/injected.ts +0 -17
  43. package/src/wallet/network.ts +0 -23
  44. package/src/wallet/provider.tsx +0 -35
  45. package/src/wallet/wallet-connect.ts +0 -25
  46. package/tsconfig.json +0 -27
  47. /package/{public → dist}/favicon.ico +0 -0
  48. /package/{public → dist}/logo192.png +0 -0
  49. /package/{public → dist}/logo512.png +0 -0
  50. /package/{public → dist}/manifest.json +0 -0
  51. /package/{public → dist}/robots.txt +0 -0
@@ -1,385 +0,0 @@
1
- export const buttonHover = {
2
- '&:not([disabled])': {
3
- borderColor: 'var(--theme-ui-colors-primaryButton)',
4
- background: 'var(--theme-ui-colors-primaryButton)',
5
- opacity: 0.6,
6
- },
7
- '&:disabled': {},
8
- }
9
-
10
- export const textUnderlineHover = {
11
- '::after': {
12
- content: "''",
13
- position: 'absolute',
14
- background: 'text',
15
- left: '0px',
16
- bottom: '0px',
17
- height: '1.5px',
18
- width: '100%',
19
- borderRadius: '10px',
20
- transform: 'scaleX(0)',
21
- transformOrigin: 'bottom right',
22
- transition: 'transform 0.25s ease-out',
23
- backfaceVisibility: 'hidden',
24
- },
25
- ':hover::after': {
26
- transform: 'scaleX(1)',
27
- transformOrigin: 'bottom left',
28
- },
29
- }
30
-
31
- const buttonBaseStyles = {
32
- padding: '10px 20px 10px 19px',
33
- fontSize: '16px',
34
- fontFamily: 'body',
35
- cursor: 'pointer',
36
- fontWeight: 700,
37
- display: 'flex',
38
- alignItems: 'center',
39
- '&&': {
40
- borderRadius: 'normal',
41
- },
42
- }
43
-
44
- const components = {
45
- text: {
46
- heading: {
47
- fontFamily: 'body',
48
- fontWeight: 'bold',
49
- },
50
- lg: { fontSize: 6, lineHeight: '33px' },
51
- md: { fontSize: 3, lineHeight: '24px' },
52
- sm: { fontSize: 1, lineHeight: '18px' },
53
- },
54
- input: {
55
- fontFamily: 'body',
56
- fontWeight: 700,
57
- sm: {
58
- background: 'white3',
59
- borderRadius: 10,
60
- height: '32px',
61
- width: '200px',
62
- },
63
- md: {
64
- background: 'white3',
65
- borderRadius: 10,
66
- height: '36px',
67
- width: '200px',
68
- },
69
- lg: {
70
- background: 'white3',
71
- borderRadius: 14,
72
- height: '48px',
73
- width: '200px',
74
- },
75
- },
76
- textarea: {
77
- padding: '10px 13px 10px 10px',
78
- borderRadius: 'normal',
79
- border: 'none',
80
- fontWeight: 'normal',
81
- background: 'lvl1',
82
- resize: 'none',
83
- color: 'textareaColor',
84
- '&:focus': {
85
- outline: 'none !important',
86
- },
87
- },
88
- checkbox: {
89
- background: 'white2',
90
- borderRadius: '5px',
91
- borderWidth: '2px',
92
- borderStyle: 'solid',
93
- borderColor: 'white3',
94
- boxShadow: 'none',
95
- outline: 'none',
96
- appearance: 'none',
97
- width: 'inherit',
98
- height: 'inherit',
99
- margin: '0px',
100
- cursor: 'pointer',
101
- '& + svg': {
102
- display: 'none',
103
- position: 'absolute',
104
- pointerEvents: 'none',
105
- top: '0',
106
- left: '0',
107
- bottom: '0',
108
- right: '0',
109
- margin: 'auto',
110
- },
111
- '&:checked ': {
112
- background: 'var(--theme-ui-colors-primaryButton)',
113
- borderColor: 'var(--theme-ui-colors-primaryButton)',
114
- '& + svg': {
115
- display: 'block',
116
- },
117
- },
118
- '&:focus:not(:checked)': {
119
- outline: 'none',
120
- boxShadow: 'none',
121
- },
122
- '&:focus': {
123
- outline: 'none',
124
- boxShadow: '0px 0px 0px 1px var(--theme-ui-colors-primaryButton), 0px 0px 0px 4px var(--theme-ui-colors-white3)',
125
- },
126
- '&:hover:not(:disabled):not(:checked)': {
127
- borderColor: 'var(--theme-ui-colors-primaryButton)',
128
- boxShadow: '0px 0px 0px 1px var(--theme-ui-colors-primaryButton), 0px 0px 0px 4px var(--theme-ui-colors-white3)',
129
- },
130
- },
131
- radio: {
132
- background: 'lvl1',
133
- borderRadius: '50px',
134
- borderWidth: '2px',
135
- borderStyle: 'solid',
136
- borderColor: 'lvl2',
137
- boxShadow: 'none',
138
- outline: 'none',
139
- appearance: 'none',
140
- width: 'inherit',
141
- height: 'inherit',
142
- margin: '0px',
143
- cursor: 'pointer',
144
- '& + span': {
145
- display: 'none',
146
- position: 'absolute',
147
- pointerEvents: 'none',
148
- top: '0',
149
- left: '0',
150
- bottom: '0',
151
- right: '0',
152
- margin: 'auto',
153
- backgroundColor: 'radioChecked',
154
- borderRadius: '50px',
155
- },
156
- '&:checked ': {
157
- background: 'var(--theme-ui-colors-yellow)',
158
- borderColor: 'var(--theme-ui-colors-yellow)',
159
- '& + span': {
160
- display: 'block',
161
- },
162
- },
163
- '&:focus': {
164
- outline: 'none',
165
- boxShadow: '0px 0px 0px 1px var(--theme-ui-colors-yellow), 0px 0px 0px 4px rgb(255, 179, 0, .2)',
166
- },
167
- '&:hover:not(:disabled):not(:checked)': {
168
- borderColor: 'var(--theme-ui-colors-yellow)',
169
- },
170
- },
171
- label: {
172
- inline: {
173
- display: 'inline-flex',
174
- alignItems: 'center',
175
- columnGap: 2,
176
- },
177
- },
178
- borders: {
179
- primaryButton: '3px solid var(--theme-ui-colors-primaryButton)',
180
- primaryBtnDisable: '3px solid transparent',
181
- secondaryButton: '3px solid var(--theme-ui-colors-primaryButton)',
182
- secondaryButtonDisable: '3px solid #FDFBF5',
183
- mode: {
184
- dark: {
185
- secondaryButtonDisable: '3px solid #F9F4E7',
186
- },
187
- },
188
- },
189
- buttons: {
190
- primary: {
191
- ...buttonBaseStyles,
192
- background: 'primaryButton',
193
- border: 'primaryButton',
194
- color: 'primaryBright',
195
- '&:disabled': {
196
- cursor: 'not-allowed',
197
- background: 'white3',
198
- color: 'textDisabledButton',
199
- border: 'primaryBtnDisable',
200
- opacity: 0.9,
201
- },
202
- '&:hover': {
203
- '&:not([disabled])': {
204
- borderColor: 'rgba(var(--theme-ui-colors-primaryButton), 0.7)',
205
- background: 'rgba(var(--theme-ui-colors-primaryButton), 0.7)',
206
- },
207
- '&:disabled': {},
208
- },
209
- },
210
- secondary: {
211
- ...buttonBaseStyles,
212
- background: 'transparent',
213
- border: 'secondaryButton',
214
- color: 'var(--theme-ui-colors-primaryButton)',
215
- '&:disabled': {
216
- cursor: 'not-allowed',
217
- background: 'white3',
218
- color: 'primaryButtonDisable',
219
- border: 'primaryBtnDisable',
220
- },
221
- '&&:hover': {
222
- '&:not([disabled])': {
223
- borderColor: 'rgba(var(--theme-ui-colors-primaryButton), 0.7)',
224
- },
225
- '&:disabled': {},
226
- },
227
- },
228
- tertiary: {
229
- ...buttonBaseStyles,
230
- background: 'white3',
231
- border: 'none',
232
- color: 'text',
233
-
234
- '&:disabled': {
235
- cursor: 'not-allowed',
236
- background: 'white3',
237
- color: 'primaryButtonDisable',
238
- },
239
-
240
- '&:hover': {
241
- '&:not([disabled])': {
242
- background: 'white4',
243
- },
244
- '&:disabled': {},
245
- },
246
- },
247
- text: {
248
- ...buttonBaseStyles,
249
- background: 'transparent',
250
- color: 'text',
251
-
252
- '&:hover': {
253
- '&:not([disabled])': {
254
- color: 'var(--theme-ui-colors-yellow)',
255
- },
256
- '&:disabled': {},
257
- },
258
-
259
- '&:disabled': {
260
- cursor: 'not-allowed',
261
- background: 'white3',
262
- color: 'primaryButtonDisable',
263
- },
264
- },
265
- success: {
266
- ...buttonBaseStyles,
267
- background: 'success',
268
- color: 'primaryBright',
269
-
270
- '&:disabled': {
271
- cursor: 'not-allowed',
272
- background: 'white3',
273
- color: 'primaryButtonDisable',
274
- },
275
-
276
- '&:hover': {
277
- '&:not([disabled])': {
278
- background: 'hoveredSuccess',
279
- },
280
- '&:disabled': {},
281
- },
282
- },
283
- danger: {
284
- ...buttonBaseStyles,
285
- background: 'error',
286
- color: 'primaryBright',
287
-
288
- '&:disabled': {
289
- cursor: 'not-allowed',
290
- background: 'white3',
291
- color: 'primaryButtonDisable',
292
- },
293
-
294
- '&:hover': {
295
- '&:not([disabled])': {
296
- background: 'hoveredDanger',
297
- },
298
- '&:disabled': {},
299
- },
300
- },
301
- circular: {
302
- width: '40px',
303
- height: '40px',
304
- background: 'white3',
305
- borderRadius: '50%',
306
- display: 'flex',
307
- justifyContent: 'center',
308
- alignItems: 'center',
309
- overflow: 'hidden',
310
- cursor: 'pointer',
311
- padding: '1px',
312
- transition: 'all .3s linear',
313
-
314
- '&:hover': {
315
- filter: 'brightness(85%)',
316
- },
317
-
318
- '&:active': {
319
- transform: 'scale(0.9)',
320
- },
321
- },
322
- },
323
- cards: {
324
- primary: {
325
- background: 'navbar',
326
- borderRadius: 'normal',
327
- },
328
- },
329
- flex: {
330
- dexContainer: {
331
- width: '100%',
332
- maxWidth: '420px',
333
- height: 'fit-content',
334
- background: 'white2',
335
- padding: ['15px 5px', '15px 10px', '15px'],
336
- borderRadius: '10px',
337
- flexDirection: 'column',
338
- },
339
- v3SubDexContainer: {
340
- width: '100%',
341
- maxWidth: '600px',
342
- height: 'fit-content',
343
- background: 'white2',
344
- padding: ['15px 5px', '15px 10px', '15px'],
345
- borderRadius: '10px',
346
- margin: '0px 10px',
347
- flexDirection: 'column',
348
- },
349
- navContainer: {
350
- height: '35px',
351
- padding: '0px 15px',
352
- background: 'white3',
353
- borderRadius: '10px',
354
- alignItems: 'center',
355
- cursor: 'pointer',
356
- transition: 'all .3s linear',
357
- '&:hover': {
358
- filter: 'brightness(95%)',
359
- },
360
- '&:active': {
361
- transform: 'scale(0.9)',
362
- },
363
- },
364
- link: {
365
- ...textUnderlineHover,
366
- cursor: 'pointer',
367
- textDecoration: 'none',
368
- display: 'inline-block',
369
- },
370
- tag: {
371
- padding: '5px',
372
- borderRadius: '5px',
373
- alignItems: 'center',
374
- justifyContent: 'center',
375
- },
376
- },
377
- switch: {
378
- backgroundColor: 'white4',
379
- 'input:checked ~ &': {
380
- backgroundColor: 'var(--theme-ui-colors-yellow)',
381
- },
382
- },
383
- }
384
-
385
- export default components
@@ -1,2 +0,0 @@
1
- export const MOBILE_DISPLAY = ['flex', 'flex', 'flex', 'none', 'none']
2
- export const DESKTOP_DISPLAY = ['none', 'none', 'none', 'flex', 'flex']
@@ -1,10 +0,0 @@
1
- import type { Theme } from 'theme-ui'
2
- import baseTheme from './base'
3
- import components from './components'
4
- import abondColors from './colors'
5
-
6
- export const defaultTheme: Theme = {
7
- ...baseTheme,
8
- ...components,
9
- colors: { ...abondColors },
10
- }
@@ -1,10 +0,0 @@
1
- export type MediaQueries = {
2
- xs: string
3
- sm: string
4
- md: string
5
- lg: string
6
- xl: string
7
- xxl: string
8
- xxxl: string
9
- nav: string
10
- }
@@ -1,77 +0,0 @@
1
- /** @jsxImportSource theme-ui */
2
- import React, { useEffect, useState } from 'react'
3
-
4
- import { ThemeProvider } from "theme-ui";
5
- import { defaultTheme } from '../../theme'
6
- import axios from "axios";
7
-
8
- import styles, { getColumnDiscountStyle } from './styles';
9
-
10
- import { BondsDataResponse } from './type';
11
- import { ethers } from 'ethers';
12
- import {useWeb3React} from "@web3-react/core";
13
-
14
- interface BondsProps {
15
- connectionString?: string;
16
- }
17
-
18
- const Bonds: React.FC<BondsProps> = ({ connectionString }) => {
19
- // Use connectionType as needed within your Bonds component
20
- const { account, isActive } = useWeb3React();
21
-
22
-
23
- const USDT_ABI = [
24
- // The ERC-20 approve function ABI
25
- "function approve(address spender, uint256 amount) public returns (bool)"
26
- ];
27
-
28
- const USDT_ADDRESS = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; // USDT contract address on Ethereum mainnet
29
-
30
- const handleApprove = async () => {
31
-
32
- if (!window.ethereum) {
33
- console.error("No Ethereum provider found");
34
- alert('No Ethereum provider found');
35
- return;
36
- }
37
-
38
- const provider = new ethers.providers.Web3Provider(window.ethereum)
39
- const signer = provider.getSigner();
40
- const usdtContract = new ethers.Contract(USDT_ADDRESS, USDT_ABI,signer);
41
-
42
- try {
43
- const tx = await usdtContract.approve(
44
- account, // Replace with the actual spender address
45
- ethers.utils.parseUnits("1000.0", 6) // Approve 1000 USDT (USDT has 6 decimals)
46
- );
47
- await tx.wait();
48
- alert('Approval Successful');
49
- } catch (error) {
50
- console.error("Approval error", error);
51
- alert('Approval Failed');
52
- }
53
- };
54
-
55
- const [bondData, setBondData] = useState<BondsDataResponse[]>([])
56
- const [hotBonds, setHotBonds] = useState<string[]>([]);
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
- return (
66
- <ThemeProvider theme={defaultTheme}>
67
- <p>{isActive}-{account}</p>
68
- {isActive && account && (
69
- <button onClick={handleApprove}>Approve USDT</button>
70
- )}
71
- <h1>{connectionString ?? "NEW TEST"}</h1>
72
-
73
- </ThemeProvider>
74
- )
75
- }
76
-
77
- export default Bonds
@@ -1,2 +0,0 @@
1
- export { default } from './Bonds'
2
-
@@ -1,24 +0,0 @@
1
- .table-container {
2
- width: 100vw;
3
- flex-direction: column;
4
- padding: 20px;
5
- }
6
-
7
- .header-container {
8
- display: flex;
9
- justify-content: space-around;
10
- padding: 10px;
11
- font-weight: bold;
12
- }
13
-
14
- .bondrow-container {
15
- display: flex;
16
- flex-direction: row;
17
- width: 100%;
18
- justify-content: space-around;
19
- background-color:#151320;
20
- margin-bottom: 5px;
21
- padding: 20px;
22
- border-radius: 10px;
23
- border: 1px solid #4B4B53
24
- }
@@ -1,91 +0,0 @@
1
- import { ThemeUIStyleObject } from 'theme-ui'
2
-
3
- const getDiscountColorStyle = (discount: number): string => {
4
- return discount < 0 ? '#DF4141' : '#38A611';
5
- }
6
-
7
- export function getColumnDiscountStyle(discount: number): ThemeUIStyleObject {
8
- return {
9
- width: '50px',
10
- flexDirection: 'column',
11
- justifyContent: 'center',
12
- alignItems: 'center',
13
- color: getDiscountColorStyle(discount)
14
- };
15
- }
16
-
17
- export const styles: Record<
18
- | 'tableContainer'
19
- | 'headerContainer'
20
- | 'bondrowContainer'
21
- | 'columnToken'
22
- | 'columnDiscount'
23
- | 'columnArr'
24
- | 'columnTerm'
25
- | 'columnTokensRemaining'
26
- | 'hotBond',
27
- ThemeUIStyleObject
28
- > = {
29
- tableContainer: {
30
- width: '80vw',
31
- flexDirection: 'column',
32
- p: '20px',
33
- marginLeft: 'auto',
34
- marginRight: 'auto'
35
- },
36
- headerContainer: {
37
- display: 'flex',
38
- justifyContent: ['flex-end', 'flex-end', 'flex-end', 'space-around'],
39
- padding: '5px',
40
- fontWeight: 'bold'
41
- },
42
- bondrowContainer: {
43
- display: 'flex',
44
- flexDirection: 'row',
45
- width: '100%',
46
- justifyContent: ['flex-end', 'flex-end', 'flex-end', 'space-around'],
47
- backgroundColor:'#151320',
48
- marginBottom:'10px',
49
- padding: '20px',
50
- borderRadius: '10px',
51
- border: '1px solid #4B4B53',
52
- },
53
- columnToken: {
54
- width: '100px',
55
- flexDirection: 'column',
56
- justifyContent: 'center',
57
- alignItems: 'center',
58
- },
59
- columnDiscount: {
60
- width: '50px',
61
- flexDirection: 'column',
62
- justifyContent: 'center',
63
- alignItems: 'center',
64
- },
65
- columnArr: {
66
- width: '50px',
67
- flexDirection: 'column',
68
- justifyContent: 'center',
69
- alignItems: 'center',
70
- },
71
- columnTerm: {
72
- width: '50px',
73
- flexDirection: 'column',
74
- justifyContent: 'center',
75
- alignItems: 'center',
76
- },
77
- columnTokensRemaining: {
78
- width: '50px',
79
- flexDirection: 'column',
80
- justifyContent: 'center',
81
- alignItems: 'center',
82
- },
83
- hotBond: {
84
- width: '50px',
85
- flexDirection: 'column',
86
- justifyContent: 'center',
87
- alignItems: 'center',
88
- }
89
- }
90
-
91
- export default styles;
@@ -1,34 +0,0 @@
1
- import { ChainId } from "@ape.swap/apeswap-lists"
2
-
3
- export interface BondsDataResponse {
4
- index: number
5
- cmcId?: number
6
- label: string
7
- chainId: ChainId
8
- type: string
9
- principalToken: string
10
- principalTokenName: string
11
- principalTokenDecimals: number
12
- payoutToken: string
13
- payoutTokenName: string
14
- payoutTokenDecimals: number
15
- discount: number
16
- billAddress: string
17
- billNftAddress: string
18
- initTime: number
19
- soldOut: boolean
20
- inactive: boolean
21
- trueBillPrice: string
22
- maxTotalPayout: string
23
- totalPayoutGiven: string
24
- maxPayout: string
25
- tokensRemaining: string
26
- showcaseToken: string
27
- showcaseTokenName: string
28
- vestingTerm: number
29
- principalTokenPrice: string
30
- payoutTokenPrice: string
31
- priceUsd: string
32
- tags?: string[]
33
- arr: string
34
- }
@@ -1 +0,0 @@
1
- export { default as Bonds } from './Bonds'
@@ -1,59 +0,0 @@
1
- import React from 'react'
2
-
3
- import { ConnectionType, getHasMetaMaskExtensionInstalled } from './connections'
4
- import { METAMASK_URL } from './constants'
5
- import { Option } from './Option'
6
-
7
- type ConnectOptionsParams = {
8
- activeConnectionType: ConnectionType | null
9
- isConnectionActive: boolean
10
- onActivate: (connectionType: ConnectionType) => void
11
- onDeactivate: (connectionType: null) => void
12
- }
13
-
14
- export const ConnectionOptions = ({
15
- activeConnectionType,
16
- isConnectionActive,
17
- onActivate,
18
- onDeactivate,
19
- }: ConnectOptionsParams) => {
20
- function getOptions(isActive: boolean) {
21
- const hasMetaMaskExtension = getHasMetaMaskExtensionInstalled()
22
-
23
- const isNoOptionActive = !isActive || (isActive && activeConnectionType === null)
24
-
25
- const metaMaskOption = hasMetaMaskExtension ? (
26
- <Option
27
- isEnabled={isNoOptionActive || activeConnectionType === ConnectionType.INJECTED}
28
- isConnected={activeConnectionType === ConnectionType.INJECTED}
29
- connectionType={ConnectionType.INJECTED}
30
- onActivate={onActivate}
31
- onDeactivate={onDeactivate}
32
- />
33
- ) : (
34
- <a href={METAMASK_URL}>
35
- <button>Install Metamask</button>
36
- </a>
37
- )
38
-
39
-
40
- const walletConnectOption = (
41
- <Option
42
- isEnabled={isNoOptionActive || activeConnectionType === ConnectionType.WALLET_CONNECT}
43
- isConnected={activeConnectionType === ConnectionType.WALLET_CONNECT}
44
- connectionType={ConnectionType.WALLET_CONNECT}
45
- onActivate={onActivate}
46
- onDeactivate={onDeactivate}
47
- />
48
- )
49
-
50
- return (
51
- <>
52
- {metaMaskOption}
53
- {walletConnectOption}
54
- </>
55
- )
56
- }
57
-
58
- return <div className="connectors">{getOptions(isConnectionActive)}</div>
59
- }