@rabby-wallet/staking-sdk 0.1.0-alpha.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/README.md +25 -0
- package/dist/addresses/deployments.d.ts +200 -0
- package/dist/addresses/deployments.d.ts.map +1 -0
- package/dist/addresses/deployments.js +223 -0
- package/dist/addresses/deployments.js.map +1 -0
- package/dist/addresses/erc4626.d.ts +74 -0
- package/dist/addresses/erc4626.d.ts.map +1 -0
- package/dist/addresses/erc4626.js +83 -0
- package/dist/addresses/erc4626.js.map +1 -0
- package/dist/addresses/index.d.ts +78 -0
- package/dist/addresses/index.d.ts.map +1 -0
- package/dist/addresses/index.js +13 -0
- package/dist/addresses/index.js.map +1 -0
- package/dist/addresses/univ2.d.ts +2 -0
- package/dist/addresses/univ2.d.ts.map +1 -0
- package/dist/addresses/univ2.js +2 -0
- package/dist/addresses/univ2.js.map +1 -0
- package/dist/addresses/univ3.d.ts +2 -0
- package/dist/addresses/univ3.d.ts.map +1 -0
- package/dist/addresses/univ3.js +2 -0
- package/dist/addresses/univ3.js.map +1 -0
- package/dist/core/abi/erc20.d.ts +13 -0
- package/dist/core/abi/erc20.d.ts.map +1 -0
- package/dist/core/abi/erc20.js +15 -0
- package/dist/core/abi/erc20.js.map +1 -0
- package/dist/core/abi/erc4626.d.ts +194 -0
- package/dist/core/abi/erc4626.d.ts.map +1 -0
- package/dist/core/abi/erc4626.js +191 -0
- package/dist/core/abi/erc4626.js.map +1 -0
- package/dist/core/abi/univ2.d.ts +181 -0
- package/dist/core/abi/univ2.d.ts.map +1 -0
- package/dist/core/abi/univ2.js +161 -0
- package/dist/core/abi/univ2.js.map +1 -0
- package/dist/core/abi/univ3.d.ts +369 -0
- package/dist/core/abi/univ3.d.ts.map +1 -0
- package/dist/core/abi/univ3.js +319 -0
- package/dist/core/abi/univ3.js.map +1 -0
- package/dist/core/chains.d.ts +3 -0
- package/dist/core/chains.d.ts.map +1 -0
- package/dist/core/chains.js +19 -0
- package/dist/core/chains.js.map +1 -0
- package/dist/core/errors.d.ts +30 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +49 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/read/erc20.d.ts +7 -0
- package/dist/core/read/erc20.d.ts.map +1 -0
- package/dist/core/read/erc20.js +7 -0
- package/dist/core/read/erc20.js.map +1 -0
- package/dist/core/types.d.ts +172 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/utils/abi.d.ts +9 -0
- package/dist/core/utils/abi.d.ts.map +1 -0
- package/dist/core/utils/abi.js +70 -0
- package/dist/core/utils/abi.js.map +1 -0
- package/dist/core/utils/address.d.ts +7 -0
- package/dist/core/utils/address.d.ts.map +1 -0
- package/dist/core/utils/address.js +17 -0
- package/dist/core/utils/address.js.map +1 -0
- package/dist/core/validation/allowlist.d.ts +18 -0
- package/dist/core/validation/allowlist.d.ts.map +1 -0
- package/dist/core/validation/allowlist.js +42 -0
- package/dist/core/validation/allowlist.js.map +1 -0
- package/dist/core/validation/deployments.d.ts +16 -0
- package/dist/core/validation/deployments.d.ts.map +1 -0
- package/dist/core/validation/deployments.js +65 -0
- package/dist/core/validation/deployments.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/protocols/erc4626/builders.d.ts +23 -0
- package/dist/protocols/erc4626/builders.d.ts.map +1 -0
- package/dist/protocols/erc4626/builders.js +94 -0
- package/dist/protocols/erc4626/builders.js.map +1 -0
- package/dist/protocols/erc4626/index.d.ts +3 -0
- package/dist/protocols/erc4626/index.d.ts.map +1 -0
- package/dist/protocols/erc4626/index.js +3 -0
- package/dist/protocols/erc4626/index.js.map +1 -0
- package/dist/protocols/erc4626/read.d.ts +17 -0
- package/dist/protocols/erc4626/read.d.ts.map +1 -0
- package/dist/protocols/erc4626/read.js +46 -0
- package/dist/protocols/erc4626/read.js.map +1 -0
- package/dist/protocols/univ2/builders.d.ts +24 -0
- package/dist/protocols/univ2/builders.d.ts.map +1 -0
- package/dist/protocols/univ2/builders.js +94 -0
- package/dist/protocols/univ2/builders.js.map +1 -0
- package/dist/protocols/univ2/index.d.ts +5 -0
- package/dist/protocols/univ2/index.d.ts.map +1 -0
- package/dist/protocols/univ2/index.js +5 -0
- package/dist/protocols/univ2/index.js.map +1 -0
- package/dist/protocols/univ2/math.d.ts +24 -0
- package/dist/protocols/univ2/math.d.ts.map +1 -0
- package/dist/protocols/univ2/math.js +70 -0
- package/dist/protocols/univ2/math.js.map +1 -0
- package/dist/protocols/univ2/read.d.ts +22 -0
- package/dist/protocols/univ2/read.d.ts.map +1 -0
- package/dist/protocols/univ2/read.js +52 -0
- package/dist/protocols/univ2/read.js.map +1 -0
- package/dist/protocols/univ2/resolve.d.ts +34 -0
- package/dist/protocols/univ2/resolve.d.ts.map +1 -0
- package/dist/protocols/univ2/resolve.js +130 -0
- package/dist/protocols/univ2/resolve.js.map +1 -0
- package/dist/protocols/univ3/builders.d.ts +56 -0
- package/dist/protocols/univ3/builders.d.ts.map +1 -0
- package/dist/protocols/univ3/builders.js +197 -0
- package/dist/protocols/univ3/builders.js.map +1 -0
- package/dist/protocols/univ3/index.d.ts +7 -0
- package/dist/protocols/univ3/index.d.ts.map +1 -0
- package/dist/protocols/univ3/index.js +7 -0
- package/dist/protocols/univ3/index.js.map +1 -0
- package/dist/protocols/univ3/math.d.ts +45 -0
- package/dist/protocols/univ3/math.d.ts.map +1 -0
- package/dist/protocols/univ3/math.js +219 -0
- package/dist/protocols/univ3/math.js.map +1 -0
- package/dist/protocols/univ3/quote.d.ts +117 -0
- package/dist/protocols/univ3/quote.d.ts.map +1 -0
- package/dist/protocols/univ3/quote.js +315 -0
- package/dist/protocols/univ3/quote.js.map +1 -0
- package/dist/protocols/univ3/read.d.ts +28 -0
- package/dist/protocols/univ3/read.d.ts.map +1 -0
- package/dist/protocols/univ3/read.js +73 -0
- package/dist/protocols/univ3/read.js.map +1 -0
- package/dist/protocols/univ3/resolve.d.ts +38 -0
- package/dist/protocols/univ3/resolve.d.ts.map +1 -0
- package/dist/protocols/univ3/resolve.js +166 -0
- package/dist/protocols/univ3/resolve.js.map +1 -0
- package/dist/protocols/univ3/ticks.d.ts +15 -0
- package/dist/protocols/univ3/ticks.d.ts.map +1 -0
- package/dist/protocols/univ3/ticks.js +61 -0
- package/dist/protocols/univ3/ticks.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { Hex } from '../types.js';
|
|
2
|
+
export declare const UNIV2_PAIR_ABI: readonly [{
|
|
3
|
+
readonly type: "function";
|
|
4
|
+
readonly name: "factory";
|
|
5
|
+
readonly stateMutability: "view";
|
|
6
|
+
readonly inputs: readonly [];
|
|
7
|
+
readonly outputs: readonly [{
|
|
8
|
+
readonly name: "factory";
|
|
9
|
+
readonly type: "address";
|
|
10
|
+
}];
|
|
11
|
+
}, {
|
|
12
|
+
readonly type: "function";
|
|
13
|
+
readonly name: "token0";
|
|
14
|
+
readonly stateMutability: "view";
|
|
15
|
+
readonly inputs: readonly [];
|
|
16
|
+
readonly outputs: readonly [{
|
|
17
|
+
readonly name: "token0";
|
|
18
|
+
readonly type: "address";
|
|
19
|
+
}];
|
|
20
|
+
}, {
|
|
21
|
+
readonly type: "function";
|
|
22
|
+
readonly name: "token1";
|
|
23
|
+
readonly stateMutability: "view";
|
|
24
|
+
readonly inputs: readonly [];
|
|
25
|
+
readonly outputs: readonly [{
|
|
26
|
+
readonly name: "token1";
|
|
27
|
+
readonly type: "address";
|
|
28
|
+
}];
|
|
29
|
+
}, {
|
|
30
|
+
readonly type: "function";
|
|
31
|
+
readonly name: "getReserves";
|
|
32
|
+
readonly stateMutability: "view";
|
|
33
|
+
readonly inputs: readonly [];
|
|
34
|
+
readonly outputs: readonly [{
|
|
35
|
+
readonly name: "reserve0";
|
|
36
|
+
readonly type: "uint112";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "reserve1";
|
|
39
|
+
readonly type: "uint112";
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "blockTimestampLast";
|
|
42
|
+
readonly type: "uint32";
|
|
43
|
+
}];
|
|
44
|
+
}, {
|
|
45
|
+
readonly type: "function";
|
|
46
|
+
readonly name: "totalSupply";
|
|
47
|
+
readonly stateMutability: "view";
|
|
48
|
+
readonly inputs: readonly [];
|
|
49
|
+
readonly outputs: readonly [{
|
|
50
|
+
readonly name: "totalSupply";
|
|
51
|
+
readonly type: "uint256";
|
|
52
|
+
}];
|
|
53
|
+
}, {
|
|
54
|
+
readonly type: "function";
|
|
55
|
+
readonly name: "balanceOf";
|
|
56
|
+
readonly stateMutability: "view";
|
|
57
|
+
readonly inputs: readonly [{
|
|
58
|
+
readonly name: "owner";
|
|
59
|
+
readonly type: "address";
|
|
60
|
+
}];
|
|
61
|
+
readonly outputs: readonly [{
|
|
62
|
+
readonly name: "balance";
|
|
63
|
+
readonly type: "uint256";
|
|
64
|
+
}];
|
|
65
|
+
}];
|
|
66
|
+
export declare const UNIV2_FACTORY_ABI: readonly [{
|
|
67
|
+
readonly type: "function";
|
|
68
|
+
readonly name: "getPair";
|
|
69
|
+
readonly stateMutability: "view";
|
|
70
|
+
readonly inputs: readonly [{
|
|
71
|
+
readonly name: "tokenA";
|
|
72
|
+
readonly type: "address";
|
|
73
|
+
}, {
|
|
74
|
+
readonly name: "tokenB";
|
|
75
|
+
readonly type: "address";
|
|
76
|
+
}];
|
|
77
|
+
readonly outputs: readonly [{
|
|
78
|
+
readonly name: "pair";
|
|
79
|
+
readonly type: "address";
|
|
80
|
+
}];
|
|
81
|
+
}];
|
|
82
|
+
export declare const UNIV2_ROUTER_ABI: readonly [{
|
|
83
|
+
readonly type: "function";
|
|
84
|
+
readonly name: "addLiquidity";
|
|
85
|
+
readonly stateMutability: "nonpayable";
|
|
86
|
+
readonly inputs: readonly [{
|
|
87
|
+
readonly name: "tokenA";
|
|
88
|
+
readonly type: "address";
|
|
89
|
+
}, {
|
|
90
|
+
readonly name: "tokenB";
|
|
91
|
+
readonly type: "address";
|
|
92
|
+
}, {
|
|
93
|
+
readonly name: "amountADesired";
|
|
94
|
+
readonly type: "uint256";
|
|
95
|
+
}, {
|
|
96
|
+
readonly name: "amountBDesired";
|
|
97
|
+
readonly type: "uint256";
|
|
98
|
+
}, {
|
|
99
|
+
readonly name: "amountAMin";
|
|
100
|
+
readonly type: "uint256";
|
|
101
|
+
}, {
|
|
102
|
+
readonly name: "amountBMin";
|
|
103
|
+
readonly type: "uint256";
|
|
104
|
+
}, {
|
|
105
|
+
readonly name: "to";
|
|
106
|
+
readonly type: "address";
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "deadline";
|
|
109
|
+
readonly type: "uint256";
|
|
110
|
+
}];
|
|
111
|
+
readonly outputs: readonly [{
|
|
112
|
+
readonly name: "amountA";
|
|
113
|
+
readonly type: "uint256";
|
|
114
|
+
}, {
|
|
115
|
+
readonly name: "amountB";
|
|
116
|
+
readonly type: "uint256";
|
|
117
|
+
}, {
|
|
118
|
+
readonly name: "liquidity";
|
|
119
|
+
readonly type: "uint256";
|
|
120
|
+
}];
|
|
121
|
+
}, {
|
|
122
|
+
readonly type: "function";
|
|
123
|
+
readonly name: "removeLiquidity";
|
|
124
|
+
readonly stateMutability: "nonpayable";
|
|
125
|
+
readonly inputs: readonly [{
|
|
126
|
+
readonly name: "tokenA";
|
|
127
|
+
readonly type: "address";
|
|
128
|
+
}, {
|
|
129
|
+
readonly name: "tokenB";
|
|
130
|
+
readonly type: "address";
|
|
131
|
+
}, {
|
|
132
|
+
readonly name: "liquidity";
|
|
133
|
+
readonly type: "uint256";
|
|
134
|
+
}, {
|
|
135
|
+
readonly name: "amountAMin";
|
|
136
|
+
readonly type: "uint256";
|
|
137
|
+
}, {
|
|
138
|
+
readonly name: "amountBMin";
|
|
139
|
+
readonly type: "uint256";
|
|
140
|
+
}, {
|
|
141
|
+
readonly name: "to";
|
|
142
|
+
readonly type: "address";
|
|
143
|
+
}, {
|
|
144
|
+
readonly name: "deadline";
|
|
145
|
+
readonly type: "uint256";
|
|
146
|
+
}];
|
|
147
|
+
readonly outputs: readonly [{
|
|
148
|
+
readonly name: "amountA";
|
|
149
|
+
readonly type: "uint256";
|
|
150
|
+
}, {
|
|
151
|
+
readonly name: "amountB";
|
|
152
|
+
readonly type: "uint256";
|
|
153
|
+
}];
|
|
154
|
+
}];
|
|
155
|
+
export declare const encodeUniv2PairFactory: () => Hex;
|
|
156
|
+
export declare const encodeUniv2PairToken0: () => Hex;
|
|
157
|
+
export declare const encodeUniv2PairToken1: () => Hex;
|
|
158
|
+
export declare const encodeUniv2PairGetReserves: () => Hex;
|
|
159
|
+
export declare const encodeUniv2PairTotalSupply: () => Hex;
|
|
160
|
+
export declare const encodeUniv2PairBalanceOf: (owner: string) => Hex;
|
|
161
|
+
export declare const encodeUniv2FactoryGetPair: (tokenA: string, tokenB: string) => Hex;
|
|
162
|
+
export declare const encodeUniv2AddLiquidity: ({ tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, receiver, deadline, }: {
|
|
163
|
+
tokenA: string;
|
|
164
|
+
tokenB: string;
|
|
165
|
+
amountADesired: string | bigint;
|
|
166
|
+
amountBDesired: string | bigint;
|
|
167
|
+
amountAMin: string | bigint;
|
|
168
|
+
amountBMin: string | bigint;
|
|
169
|
+
receiver: string;
|
|
170
|
+
deadline: string | bigint;
|
|
171
|
+
}) => Hex;
|
|
172
|
+
export declare const encodeUniv2RemoveLiquidity: ({ tokenA, tokenB, liquidity, amountAMin, amountBMin, receiver, deadline, }: {
|
|
173
|
+
tokenA: string;
|
|
174
|
+
tokenB: string;
|
|
175
|
+
liquidity: string | bigint;
|
|
176
|
+
amountAMin: string | bigint;
|
|
177
|
+
amountBMin: string | bigint;
|
|
178
|
+
receiver: string;
|
|
179
|
+
deadline: string | bigint;
|
|
180
|
+
}) => Hex;
|
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GAcO,CAAC;AAEZ,eAAO,MAAM,0BAA0B,GAAI,4EAQxC;IACD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B,KAAG,GAaO,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { encodeFunctionData } from 'viem';
|
|
2
|
+
import { parseRawUint256 } from '../utils/abi.js';
|
|
3
|
+
import { normalizeAddress } from '../utils/address.js';
|
|
4
|
+
export const UNIV2_PAIR_ABI = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'factory',
|
|
8
|
+
stateMutability: 'view',
|
|
9
|
+
inputs: [],
|
|
10
|
+
outputs: [{ name: 'factory', type: 'address' }],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: 'function',
|
|
14
|
+
name: 'token0',
|
|
15
|
+
stateMutability: 'view',
|
|
16
|
+
inputs: [],
|
|
17
|
+
outputs: [{ name: 'token0', type: 'address' }],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'function',
|
|
21
|
+
name: 'token1',
|
|
22
|
+
stateMutability: 'view',
|
|
23
|
+
inputs: [],
|
|
24
|
+
outputs: [{ name: 'token1', type: 'address' }],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'function',
|
|
28
|
+
name: 'getReserves',
|
|
29
|
+
stateMutability: 'view',
|
|
30
|
+
inputs: [],
|
|
31
|
+
outputs: [
|
|
32
|
+
{ name: 'reserve0', type: 'uint112' },
|
|
33
|
+
{ name: 'reserve1', type: 'uint112' },
|
|
34
|
+
{ name: 'blockTimestampLast', type: 'uint32' },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'function',
|
|
39
|
+
name: 'totalSupply',
|
|
40
|
+
stateMutability: 'view',
|
|
41
|
+
inputs: [],
|
|
42
|
+
outputs: [{ name: 'totalSupply', type: 'uint256' }],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'function',
|
|
46
|
+
name: 'balanceOf',
|
|
47
|
+
stateMutability: 'view',
|
|
48
|
+
inputs: [{ name: 'owner', type: 'address' }],
|
|
49
|
+
outputs: [{ name: 'balance', type: 'uint256' }],
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
export const UNIV2_FACTORY_ABI = [
|
|
53
|
+
{
|
|
54
|
+
type: 'function',
|
|
55
|
+
name: 'getPair',
|
|
56
|
+
stateMutability: 'view',
|
|
57
|
+
inputs: [
|
|
58
|
+
{ name: 'tokenA', type: 'address' },
|
|
59
|
+
{ name: 'tokenB', type: 'address' },
|
|
60
|
+
],
|
|
61
|
+
outputs: [{ name: 'pair', type: 'address' }],
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
export const UNIV2_ROUTER_ABI = [
|
|
65
|
+
{
|
|
66
|
+
type: 'function',
|
|
67
|
+
name: 'addLiquidity',
|
|
68
|
+
stateMutability: 'nonpayable',
|
|
69
|
+
inputs: [
|
|
70
|
+
{ name: 'tokenA', type: 'address' },
|
|
71
|
+
{ name: 'tokenB', type: 'address' },
|
|
72
|
+
{ name: 'amountADesired', type: 'uint256' },
|
|
73
|
+
{ name: 'amountBDesired', type: 'uint256' },
|
|
74
|
+
{ name: 'amountAMin', type: 'uint256' },
|
|
75
|
+
{ name: 'amountBMin', type: 'uint256' },
|
|
76
|
+
{ name: 'to', type: 'address' },
|
|
77
|
+
{ name: 'deadline', type: 'uint256' },
|
|
78
|
+
],
|
|
79
|
+
outputs: [
|
|
80
|
+
{ name: 'amountA', type: 'uint256' },
|
|
81
|
+
{ name: 'amountB', type: 'uint256' },
|
|
82
|
+
{ name: 'liquidity', type: 'uint256' },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: 'function',
|
|
87
|
+
name: 'removeLiquidity',
|
|
88
|
+
stateMutability: 'nonpayable',
|
|
89
|
+
inputs: [
|
|
90
|
+
{ name: 'tokenA', type: 'address' },
|
|
91
|
+
{ name: 'tokenB', type: 'address' },
|
|
92
|
+
{ name: 'liquidity', type: 'uint256' },
|
|
93
|
+
{ name: 'amountAMin', type: 'uint256' },
|
|
94
|
+
{ name: 'amountBMin', type: 'uint256' },
|
|
95
|
+
{ name: 'to', type: 'address' },
|
|
96
|
+
{ name: 'deadline', type: 'uint256' },
|
|
97
|
+
],
|
|
98
|
+
outputs: [
|
|
99
|
+
{ name: 'amountA', type: 'uint256' },
|
|
100
|
+
{ name: 'amountB', type: 'uint256' },
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
export const encodeUniv2PairFactory = () => encodeFunctionData({
|
|
105
|
+
abi: UNIV2_PAIR_ABI,
|
|
106
|
+
functionName: 'factory',
|
|
107
|
+
});
|
|
108
|
+
export const encodeUniv2PairToken0 = () => encodeFunctionData({
|
|
109
|
+
abi: UNIV2_PAIR_ABI,
|
|
110
|
+
functionName: 'token0',
|
|
111
|
+
});
|
|
112
|
+
export const encodeUniv2PairToken1 = () => encodeFunctionData({
|
|
113
|
+
abi: UNIV2_PAIR_ABI,
|
|
114
|
+
functionName: 'token1',
|
|
115
|
+
});
|
|
116
|
+
export const encodeUniv2PairGetReserves = () => encodeFunctionData({
|
|
117
|
+
abi: UNIV2_PAIR_ABI,
|
|
118
|
+
functionName: 'getReserves',
|
|
119
|
+
});
|
|
120
|
+
export const encodeUniv2PairTotalSupply = () => encodeFunctionData({
|
|
121
|
+
abi: UNIV2_PAIR_ABI,
|
|
122
|
+
functionName: 'totalSupply',
|
|
123
|
+
});
|
|
124
|
+
export const encodeUniv2PairBalanceOf = (owner) => encodeFunctionData({
|
|
125
|
+
abi: UNIV2_PAIR_ABI,
|
|
126
|
+
functionName: 'balanceOf',
|
|
127
|
+
args: [normalizeAddress('owner', owner)],
|
|
128
|
+
});
|
|
129
|
+
export const encodeUniv2FactoryGetPair = (tokenA, tokenB) => encodeFunctionData({
|
|
130
|
+
abi: UNIV2_FACTORY_ABI,
|
|
131
|
+
functionName: 'getPair',
|
|
132
|
+
args: [normalizeAddress('tokenA', tokenA), normalizeAddress('tokenB', tokenB)],
|
|
133
|
+
});
|
|
134
|
+
export const encodeUniv2AddLiquidity = ({ tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, receiver, deadline, }) => encodeFunctionData({
|
|
135
|
+
abi: UNIV2_ROUTER_ABI,
|
|
136
|
+
functionName: 'addLiquidity',
|
|
137
|
+
args: [
|
|
138
|
+
normalizeAddress('tokenA', tokenA),
|
|
139
|
+
normalizeAddress('tokenB', tokenB),
|
|
140
|
+
parseRawUint256(amountADesired),
|
|
141
|
+
parseRawUint256(amountBDesired),
|
|
142
|
+
parseRawUint256(amountAMin),
|
|
143
|
+
parseRawUint256(amountBMin),
|
|
144
|
+
normalizeAddress('receiver', receiver),
|
|
145
|
+
parseRawUint256(deadline),
|
|
146
|
+
],
|
|
147
|
+
});
|
|
148
|
+
export const encodeUniv2RemoveLiquidity = ({ tokenA, tokenB, liquidity, amountAMin, amountBMin, receiver, deadline, }) => encodeFunctionData({
|
|
149
|
+
abi: UNIV2_ROUTER_ABI,
|
|
150
|
+
functionName: 'removeLiquidity',
|
|
151
|
+
args: [
|
|
152
|
+
normalizeAddress('tokenA', tokenA),
|
|
153
|
+
normalizeAddress('tokenB', tokenB),
|
|
154
|
+
parseRawUint256(liquidity),
|
|
155
|
+
parseRawUint256(amountAMin),
|
|
156
|
+
parseRawUint256(amountBMin),
|
|
157
|
+
normalizeAddress('receiver', receiver),
|
|
158
|
+
parseRawUint256(deadline),
|
|
159
|
+
],
|
|
160
|
+
});
|
|
161
|
+
//# sourceMappingURL=univ2.js.map
|
|
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