@pickhooks/sdk 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +309 -3
- package/dist/abis/any3.d.ts +2123 -0
- package/dist/abis/any3.js +3 -0
- package/dist/abis/anytax.d.ts +1786 -0
- package/dist/abis/anytax.js +3 -0
- package/dist/abis/calls.d.ts +2515 -0
- package/dist/abis/calls.js +4 -0
- package/dist/abis/common.d.ts +449 -0
- package/dist/abis/common.js +91 -0
- package/dist/abis/dips.d.ts +897 -0
- package/dist/abis/dips.js +2 -0
- package/dist/abis/index.d.ts +12 -0
- package/dist/abis/index.js +12 -0
- package/dist/abis/infra.d.ts +701 -0
- package/dist/abis/infra.js +4 -0
- package/dist/abis/lever.d.ts +1710 -0
- package/dist/abis/lever.js +5 -0
- package/dist/abis/lever2.d.ts +2710 -0
- package/dist/abis/lever2.js +5 -0
- package/dist/abis/pools.d.ts +1898 -0
- package/dist/abis/pools.js +4 -0
- package/dist/abis/sticky.d.ts +953 -0
- package/dist/abis/sticky.js +4 -0
- package/dist/abis/v1.d.ts +1627 -0
- package/dist/abis/v1.js +5 -0
- package/dist/abis/v2.d.ts +3264 -0
- package/dist/abis/v2.js +8 -0
- package/dist/addresses.d.ts +87 -0
- package/dist/addresses.js +62 -0
- package/dist/any.d.ts +447 -0
- package/dist/any.js +729 -0
- package/dist/api.d.ts +62 -0
- package/dist/api.js +30 -0
- package/dist/blocks.d.ts +107 -0
- package/dist/blocks.js +126 -0
- package/dist/coin-rules-config.d.ts +8 -0
- package/dist/coin-rules-config.js +13 -0
- package/dist/coin-rules.d.ts +383 -0
- package/dist/coin-rules.js +878 -0
- package/dist/coins.d.ts +217 -0
- package/dist/coins.js +520 -0
- package/dist/dips.d.ts +133 -0
- package/dist/dips.js +148 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.js +347 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +58 -0
- package/dist/infinity.d.ts +63 -0
- package/dist/infinity.js +96 -0
- package/dist/infra.d.ts +112 -0
- package/dist/infra.js +114 -0
- package/dist/lever.d.ts +391 -0
- package/dist/lever.js +419 -0
- package/dist/pools.d.ts +274 -0
- package/dist/pools.js +405 -0
- package/dist/sticky-rules.d.ts +179 -0
- package/dist/sticky-rules.js +580 -0
- package/dist/sticky.d.ts +216 -0
- package/dist/sticky.js +292 -0
- package/dist/tx.d.ts +70 -0
- package/dist/tx.js +69 -0
- package/dist/v3.d.ts +42 -0
- package/dist/v3.js +98 -0
- package/package.json +58 -4
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { parseAbi } from "viem";
|
|
2
|
+
/** The ERC20 functions the SDK calls on coins. */
|
|
3
|
+
export const erc20Abi = parseAbi([
|
|
4
|
+
"function name() view returns (string)",
|
|
5
|
+
"function symbol() view returns (string)",
|
|
6
|
+
"function decimals() view returns (uint8)",
|
|
7
|
+
"function totalSupply() view returns (uint256)",
|
|
8
|
+
"function balanceOf(address) view returns (uint256)",
|
|
9
|
+
"function allowance(address owner, address spender) view returns (uint256)",
|
|
10
|
+
"function approve(address spender, uint256 amount) returns (bool)",
|
|
11
|
+
"function owner() view returns (address)",
|
|
12
|
+
]);
|
|
13
|
+
/** Permit2: PancakeSwap's UniversalRouter pulls a seller's coins through it. */
|
|
14
|
+
export const permit2Abi = parseAbi([
|
|
15
|
+
"function approve(address token, address spender, uint160 amount, uint48 expiration)",
|
|
16
|
+
"function allowance(address owner, address token, address spender) view returns (uint160 amount, uint48 expiration, uint48 nonce)",
|
|
17
|
+
]);
|
|
18
|
+
/** PancakeSwap's UniversalRouter: wallets and terminals trade Infinity pools through it. */
|
|
19
|
+
export const universalRouterAbi = parseAbi(["function execute(bytes commands, bytes[] inputs, uint256 deadline) payable"]);
|
|
20
|
+
/** An Infinity CL pool key, as the pool manager, the router and the quoter take it. */
|
|
21
|
+
export const POOL_KEY = {
|
|
22
|
+
type: "tuple",
|
|
23
|
+
components: [
|
|
24
|
+
{ name: "currency0", type: "address" },
|
|
25
|
+
{ name: "currency1", type: "address" },
|
|
26
|
+
{ name: "hooks", type: "address" },
|
|
27
|
+
{ name: "poolManager", type: "address" },
|
|
28
|
+
{ name: "fee", type: "uint24" },
|
|
29
|
+
{ name: "parameters", type: "bytes32" },
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
/** The UniversalRouter's CL_SWAP_EXACT_IN_SINGLE parameters. */
|
|
33
|
+
export const SWAP_EXACT_IN_SINGLE = [
|
|
34
|
+
{
|
|
35
|
+
type: "tuple",
|
|
36
|
+
components: [
|
|
37
|
+
{ name: "poolKey", ...POOL_KEY },
|
|
38
|
+
{ name: "zeroForOne", type: "bool" },
|
|
39
|
+
{ name: "amountIn", type: "uint128" },
|
|
40
|
+
{ name: "amountOutMinimum", type: "uint128" },
|
|
41
|
+
{ name: "hookData", type: "bytes" },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
/** PancakeSwap Infinity's CL quoter: runs the real swap in an eth_call and reverts with the result. */
|
|
46
|
+
export const clQuoterAbi = [
|
|
47
|
+
{
|
|
48
|
+
type: "function",
|
|
49
|
+
name: "quoteExactInputSingle",
|
|
50
|
+
stateMutability: "nonpayable",
|
|
51
|
+
inputs: [
|
|
52
|
+
{
|
|
53
|
+
name: "params",
|
|
54
|
+
type: "tuple",
|
|
55
|
+
components: [
|
|
56
|
+
{ name: "poolKey", ...POOL_KEY },
|
|
57
|
+
{ name: "zeroForOne", type: "bool" },
|
|
58
|
+
{ name: "exactAmount", type: "uint128" },
|
|
59
|
+
{ name: "hookData", type: "bytes" },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
outputs: [
|
|
64
|
+
{ name: "amountOut", type: "uint256" },
|
|
65
|
+
{ name: "gasEstimate", type: "uint256" },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
/** PancakeSwap Infinity's CL pool manager: the price of a pool. */
|
|
70
|
+
export const clPoolManagerAbi = parseAbi([
|
|
71
|
+
"function getSlot0(bytes32 id) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)",
|
|
72
|
+
"function getLiquidity(bytes32 id) view returns (uint128 liquidity)",
|
|
73
|
+
]);
|
|
74
|
+
/** PancakeSwap V3's SwapRouter (sticky coins trade in a V3 pool of 1 %). */
|
|
75
|
+
export const v3RouterAbi = parseAbi([
|
|
76
|
+
"function exactInputSingle((address tokenIn, address tokenOut, uint24 fee, address recipient, uint256 deadline, uint256 amountIn, uint256 amountOutMinimum, uint160 sqrtPriceLimitX96)) payable returns (uint256 amountOut)",
|
|
77
|
+
"function unwrapWETH9(uint256 amountMinimum, address recipient) payable",
|
|
78
|
+
"function multicall(bytes[] data) payable returns (bytes[] results)",
|
|
79
|
+
]);
|
|
80
|
+
/** PancakeSwap V3's QuoterV2. */
|
|
81
|
+
export const v3QuoterAbi = parseAbi([
|
|
82
|
+
"function quoteExactInputSingle((address tokenIn, address tokenOut, uint256 amountIn, uint24 fee, uint160 sqrtPriceLimitX96)) returns (uint256 amountOut, uint160 sqrtPriceX96After, uint32 initializedTicksCrossed, uint256 gasEstimate)",
|
|
83
|
+
]);
|
|
84
|
+
/** A PancakeSwap V3 pool's price. */
|
|
85
|
+
export const v3PoolAbi = parseAbi(["function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16, uint16, uint16, uint32, bool)"]);
|
|
86
|
+
/** PancakeSwap V2. */
|
|
87
|
+
export const pancakeV2FactoryAbi = parseAbi(["function getPair(address, address) view returns (address)"]);
|
|
88
|
+
export const v2PairAbi = parseAbi([
|
|
89
|
+
"function token0() view returns (address)",
|
|
90
|
+
"function getReserves() view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)",
|
|
91
|
+
]);
|