@pancakeswap/pools 4.0.9 → 4.0.11

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 (64) hide show
  1. package/dist/constants/contracts.d.ts +9 -0
  2. package/dist/constants/contracts.d.ts.map +1 -1
  3. package/dist/constants/pools/1.d.ts.map +1 -1
  4. package/dist/constants/pools/1101.d.ts +5 -0
  5. package/dist/constants/pools/1101.d.ts.map +1 -0
  6. package/dist/constants/pools/1442.d.ts +5 -0
  7. package/dist/constants/pools/1442.d.ts.map +1 -0
  8. package/dist/constants/pools/56.d.ts.map +1 -1
  9. package/dist/constants/pools/59140.d.ts +5 -0
  10. package/dist/constants/pools/59140.d.ts.map +1 -0
  11. package/dist/constants/pools/59144.d.ts +5 -0
  12. package/dist/constants/pools/59144.d.ts.map +1 -0
  13. package/dist/constants/pools/8453.d.ts +5 -0
  14. package/dist/constants/pools/8453.d.ts.map +1 -0
  15. package/dist/constants/pools/84531.d.ts +5 -0
  16. package/dist/constants/pools/84531.d.ts.map +1 -0
  17. package/dist/constants/pools/index.d.ts +2 -2
  18. package/dist/constants/pools/index.d.ts.map +1 -1
  19. package/dist/constants/supportedChains.d.ts +1 -1
  20. package/dist/constants/supportedChains.d.ts.map +1 -1
  21. package/dist/index.js +216 -16
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +217 -17
  24. package/dist/index.mjs.map +1 -1
  25. package/package.json +8 -5
  26. package/.turbo/turbo-build.log +0 -18
  27. package/CHANGELOG.md +0 -140
  28. package/src/abis/ICake.ts +0 -59
  29. package/src/abis/ICakeFlexibleSideVaultV2.ts +0 -487
  30. package/src/abis/ICakeVaultV2.ts +0 -487
  31. package/src/abis/ISmartChef.ts +0 -326
  32. package/src/abis/ISousChef.ts +0 -122
  33. package/src/abis/ISousChefBNB.ts +0 -166
  34. package/src/abis/ISousChefV2.ts +0 -341
  35. package/src/abis/ISousChefV3.ts +0 -326
  36. package/src/constants/contracts.ts +0 -38
  37. package/src/constants/index.ts +0 -10
  38. package/src/constants/pools/1.ts +0 -80
  39. package/src/constants/pools/280.ts +0 -53
  40. package/src/constants/pools/324.ts +0 -26
  41. package/src/constants/pools/42161.ts +0 -26
  42. package/src/constants/pools/421613.ts +0 -69
  43. package/src/constants/pools/56.ts +0 -2951
  44. package/src/constants/pools/97.ts +0 -74
  45. package/src/constants/pools/index.ts +0 -56
  46. package/src/constants/supportedChains.ts +0 -13
  47. package/src/index.ts +0 -14
  48. package/src/queries/fetchPools.ts +0 -350
  49. package/src/queries/fetchUserIfo.ts +0 -53
  50. package/src/queries/fetchUserPoolsData.ts +0 -143
  51. package/src/queries/fetchVaultPublic.ts +0 -175
  52. package/src/queries/fetchVaultUser.ts +0 -106
  53. package/src/queries/getAddresses.ts +0 -12
  54. package/src/queries/index.ts +0 -6
  55. package/src/types.ts +0 -207
  56. package/src/utils/apr.ts +0 -35
  57. package/src/utils/getContractAddress.ts +0 -11
  58. package/src/utils/getPoolContractBySousId.ts +0 -111
  59. package/src/utils/index.ts +0 -5
  60. package/src/utils/isLegacyPool.ts +0 -15
  61. package/src/utils/isPoolsSupported.ts +0 -5
  62. package/tsconfig.json +0 -14
  63. package/tsup.config.ts +0 -26
  64. package/vitest.config.ts +0 -9
@@ -1,111 +0,0 @@
1
- import { ChainId } from '@pancakeswap/sdk'
2
- import { WalletClient, getContract, PublicClient, Address, GetContractReturnType, Account, Chain } from 'viem'
3
-
4
- import { getPoolsConfig } from '../constants'
5
- import { isLegacyPool } from './isLegacyPool'
6
- import { smartChefABI } from '../abis/ISmartChef'
7
- import { PoolCategory } from '../types'
8
- import { sousChefV2ABI } from '../abis/ISousChefV2'
9
- import { sousChefBnbABI } from '../abis/ISousChefBNB'
10
-
11
- interface Params {
12
- chainId?: ChainId
13
- sousId: number
14
- signer?: any
15
- publicClient?: any
16
- }
17
-
18
- type GetContractReturnType_<TAbi extends readonly unknown[]> = GetContractReturnType<TAbi, any, any> & {
19
- abi: TAbi
20
- address: Address
21
- account?: Account
22
- chain?: Chain
23
- }
24
-
25
- export function getSousChefBNBContract({
26
- address,
27
- signer,
28
- publicClient,
29
- }: {
30
- address: Address
31
- signer?: WalletClient
32
- publicClient?: PublicClient
33
- }): GetContractReturnType_<typeof sousChefBnbABI> {
34
- return {
35
- ...getContract({
36
- abi: sousChefBnbABI,
37
- address,
38
- walletClient: signer,
39
- publicClient,
40
- }),
41
- abi: sousChefBnbABI,
42
- address,
43
- account: signer?.account,
44
- chain: signer?.chain,
45
- }
46
- }
47
-
48
- export function getSousChefV2Contract({
49
- address,
50
- signer,
51
- publicClient,
52
- }: {
53
- address: Address
54
- signer?: WalletClient
55
- publicClient?: PublicClient
56
- }): GetContractReturnType_<typeof sousChefV2ABI> {
57
- return {
58
- ...getContract({
59
- abi: sousChefV2ABI,
60
- address,
61
- walletClient: signer,
62
- publicClient,
63
- }),
64
- abi: sousChefV2ABI,
65
- address,
66
- account: signer?.account,
67
- chain: signer?.chain,
68
- }
69
- }
70
-
71
- export function getSmartChefChefV2Contract({
72
- address,
73
- signer,
74
- publicClient,
75
- }: {
76
- address: Address
77
- signer?: WalletClient
78
- publicClient?: PublicClient
79
- }): GetContractReturnType_<typeof smartChefABI> {
80
- return {
81
- ...getContract({
82
- abi: smartChefABI,
83
- address,
84
- walletClient: signer,
85
- publicClient,
86
- }),
87
- abi: smartChefABI,
88
- address,
89
- account: signer?.account,
90
- chain: signer?.chain,
91
- }
92
- }
93
-
94
- export function getPoolContractBySousId({ chainId, sousId, signer, publicClient }: Params): any | null {
95
- if (!chainId) {
96
- return null
97
- }
98
- const pools = getPoolsConfig(chainId)
99
- const pool = pools?.find((p) => p.sousId === Number(sousId))
100
- if (!pool) {
101
- return null
102
- }
103
- const { contractAddress } = pool
104
- if (isLegacyPool(pool)) {
105
- if (pool.poolCategory === PoolCategory.BINANCE) {
106
- return getSousChefBNBContract({ address: contractAddress, signer, publicClient })
107
- }
108
- return getSousChefV2Contract({ address: contractAddress, signer, publicClient })
109
- }
110
- return getSmartChefChefV2Contract({ address: contractAddress, signer, publicClient })
111
- }
@@ -1,5 +0,0 @@
1
- export * from './getContractAddress'
2
- export * from './isPoolsSupported'
3
- export * from './isLegacyPool'
4
- export * from './apr'
5
- export * from './getPoolContractBySousId'
@@ -1,15 +0,0 @@
1
- import { LegacySerializedPool, SerializedPool, UpgradedSerializedPool } from '../types'
2
-
3
- export function isLegacyPool(pool: SerializedPool): pool is LegacySerializedPool {
4
- if ((pool as any).tokenPerBlock) {
5
- return true
6
- }
7
- return false
8
- }
9
-
10
- export function isUpgradedPool(pool: SerializedPool): pool is UpgradedSerializedPool {
11
- if ((pool as any).tokenPerSecond) {
12
- return true
13
- }
14
- return false
15
- }
@@ -1,5 +0,0 @@
1
- import { SupportedChainId, SUPPORTED_CHAIN_IDS } from '../constants/supportedChains'
2
-
3
- export function isPoolsSupported(chainId: number): chainId is SupportedChainId {
4
- return SUPPORTED_CHAIN_IDS.includes(chainId)
5
- }
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "@pancakeswap/tsconfig/base",
3
- "include": ["./src"],
4
- "exclude": ["**/*.test.ts", "./dist/**"],
5
- "compilerOptions": {
6
- "rootDir": "./src",
7
- "outDir": "./dist",
8
- "target": "es2020",
9
- "esModuleInterop": true,
10
- "resolveJsonModule": true,
11
- "isolatedModules": true,
12
- "skipLibCheck": true
13
- }
14
- }
package/tsup.config.ts DELETED
@@ -1,26 +0,0 @@
1
- import { defineConfig } from 'tsup'
2
- import { exec } from 'child_process'
3
-
4
- export default defineConfig((options) => ({
5
- entry: {
6
- index: './src/index.ts',
7
- },
8
- sourcemap: true,
9
- noExternal: ['@pancakeswap/utils'],
10
- skipNodeModulesBundle: true,
11
- format: ['esm', 'cjs'],
12
- dts: false,
13
- clean: !options.watch,
14
- treeshake: true,
15
- splitting: true,
16
- onSuccess: async () => {
17
- exec('tsc --emitDeclarationOnly --declaration', (err, stdout) => {
18
- if (err) {
19
- console.error(stdout)
20
- if (!options.watch) {
21
- process.exit(1)
22
- }
23
- }
24
- })
25
- },
26
- }))
package/vitest.config.ts DELETED
@@ -1,9 +0,0 @@
1
- import { defineConfig } from 'vitest/config'
2
-
3
- export default defineConfig({
4
- test: {
5
- environment: 'node',
6
- globals: true,
7
- passWithNoTests: true,
8
- },
9
- })