@pancakeswap/pools 4.0.9 → 4.0.10
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/constants/contracts.d.ts +9 -0
- package/dist/constants/contracts.d.ts.map +1 -1
- package/dist/constants/pools/1101.d.ts +5 -0
- package/dist/constants/pools/1101.d.ts.map +1 -0
- package/dist/constants/pools/1442.d.ts +5 -0
- package/dist/constants/pools/1442.d.ts.map +1 -0
- package/dist/constants/pools/56.d.ts.map +1 -1
- package/dist/constants/pools/59140.d.ts +5 -0
- package/dist/constants/pools/59140.d.ts.map +1 -0
- package/dist/constants/pools/59144.d.ts +5 -0
- package/dist/constants/pools/59144.d.ts.map +1 -0
- package/dist/constants/pools/8453.d.ts +5 -0
- package/dist/constants/pools/8453.d.ts.map +1 -0
- package/dist/constants/pools/84531.d.ts +5 -0
- package/dist/constants/pools/84531.d.ts.map +1 -0
- package/dist/constants/pools/index.d.ts +2 -2
- package/dist/constants/pools/index.d.ts.map +1 -1
- package/dist/constants/supportedChains.d.ts +1 -1
- package/dist/constants/supportedChains.d.ts.map +1 -1
- package/dist/index.js +208 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +209 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -3
- package/.turbo/turbo-build.log +0 -18
- package/CHANGELOG.md +0 -140
- package/src/abis/ICake.ts +0 -59
- package/src/abis/ICakeFlexibleSideVaultV2.ts +0 -487
- package/src/abis/ICakeVaultV2.ts +0 -487
- package/src/abis/ISmartChef.ts +0 -326
- package/src/abis/ISousChef.ts +0 -122
- package/src/abis/ISousChefBNB.ts +0 -166
- package/src/abis/ISousChefV2.ts +0 -341
- package/src/abis/ISousChefV3.ts +0 -326
- package/src/constants/contracts.ts +0 -38
- package/src/constants/index.ts +0 -10
- package/src/constants/pools/1.ts +0 -80
- package/src/constants/pools/280.ts +0 -53
- package/src/constants/pools/324.ts +0 -26
- package/src/constants/pools/42161.ts +0 -26
- package/src/constants/pools/421613.ts +0 -69
- package/src/constants/pools/56.ts +0 -2951
- package/src/constants/pools/97.ts +0 -74
- package/src/constants/pools/index.ts +0 -56
- package/src/constants/supportedChains.ts +0 -13
- package/src/index.ts +0 -14
- package/src/queries/fetchPools.ts +0 -350
- package/src/queries/fetchUserIfo.ts +0 -53
- package/src/queries/fetchUserPoolsData.ts +0 -143
- package/src/queries/fetchVaultPublic.ts +0 -175
- package/src/queries/fetchVaultUser.ts +0 -106
- package/src/queries/getAddresses.ts +0 -12
- package/src/queries/index.ts +0 -6
- package/src/types.ts +0 -207
- package/src/utils/apr.ts +0 -35
- package/src/utils/getContractAddress.ts +0 -11
- package/src/utils/getPoolContractBySousId.ts +0 -111
- package/src/utils/index.ts +0 -5
- package/src/utils/isLegacyPool.ts +0 -15
- package/src/utils/isPoolsSupported.ts +0 -5
- package/tsconfig.json +0 -14
- package/tsup.config.ts +0 -26
- 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
|
-
}
|
package/src/utils/index.ts
DELETED
|
@@ -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
|
-
}
|
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
|
-
}))
|