@shapeshiftoss/unchained-client 7.0.0 → 8.1.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/dist/bitcoin/parser/index.js +2 -2
- package/dist/cosmos/parser/index.js +2 -2
- package/dist/ethereum/parser/abi/uniV2StakingRewards.d.ts +3 -0
- package/dist/ethereum/parser/abi/uniV2StakingRewards.js +414 -0
- package/dist/ethereum/parser/constants.d.ts +1 -0
- package/dist/ethereum/parser/constants.js +2 -1
- package/dist/ethereum/parser/index.js +5 -5
- package/dist/ethereum/parser/uniV2.d.ts +7 -0
- package/dist/ethereum/parser/uniV2.js +36 -5
- package/dist/ethereum/parser/weth.js +1 -1
- package/package.json +3 -3
|
@@ -10,8 +10,8 @@ class TransactionParser {
|
|
|
10
10
|
this.chainId = args.chainId;
|
|
11
11
|
this.assetId = (0, caip_1.toAssetId)({
|
|
12
12
|
...(0, caip_1.fromChainId)(this.chainId),
|
|
13
|
-
assetNamespace:
|
|
14
|
-
assetReference: caip_1.
|
|
13
|
+
assetNamespace: 'slip44',
|
|
14
|
+
assetReference: caip_1.ASSET_REFERENCE.Bitcoin
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
async parse(tx, address) {
|
|
@@ -10,8 +10,8 @@ class TransactionParser {
|
|
|
10
10
|
this.chainId = args.chainId;
|
|
11
11
|
this.assetId = (0, caip_1.toAssetId)({
|
|
12
12
|
...(0, caip_1.fromChainId)(this.chainId),
|
|
13
|
-
assetNamespace:
|
|
14
|
-
assetReference: caip_1.
|
|
13
|
+
assetNamespace: 'slip44',
|
|
14
|
+
assetReference: caip_1.ASSET_REFERENCE.Cosmos
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
async parse(tx, address) {
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const uniV2StakingRewards = [
|
|
4
|
+
{
|
|
5
|
+
inputs: [
|
|
6
|
+
{
|
|
7
|
+
internalType: 'address',
|
|
8
|
+
name: '_rewardsDistribution',
|
|
9
|
+
type: 'address'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
internalType: 'address',
|
|
13
|
+
name: '_rewardsToken',
|
|
14
|
+
type: 'address'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
internalType: 'address',
|
|
18
|
+
name: '_stakingToken',
|
|
19
|
+
type: 'address'
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
stateMutability: 'nonpayable',
|
|
23
|
+
type: 'constructor'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
anonymous: false,
|
|
27
|
+
inputs: [
|
|
28
|
+
{
|
|
29
|
+
indexed: false,
|
|
30
|
+
internalType: 'uint256',
|
|
31
|
+
name: 'reward',
|
|
32
|
+
type: 'uint256'
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
name: 'RewardAdded',
|
|
36
|
+
type: 'event'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
anonymous: false,
|
|
40
|
+
inputs: [
|
|
41
|
+
{
|
|
42
|
+
indexed: true,
|
|
43
|
+
internalType: 'address',
|
|
44
|
+
name: 'user',
|
|
45
|
+
type: 'address'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
indexed: false,
|
|
49
|
+
internalType: 'uint256',
|
|
50
|
+
name: 'reward',
|
|
51
|
+
type: 'uint256'
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
name: 'RewardPaid',
|
|
55
|
+
type: 'event'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
anonymous: false,
|
|
59
|
+
inputs: [
|
|
60
|
+
{
|
|
61
|
+
indexed: true,
|
|
62
|
+
internalType: 'address',
|
|
63
|
+
name: 'user',
|
|
64
|
+
type: 'address'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
indexed: false,
|
|
68
|
+
internalType: 'uint256',
|
|
69
|
+
name: 'amount',
|
|
70
|
+
type: 'uint256'
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
name: 'Staked',
|
|
74
|
+
type: 'event'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
anonymous: false,
|
|
78
|
+
inputs: [
|
|
79
|
+
{
|
|
80
|
+
indexed: true,
|
|
81
|
+
internalType: 'address',
|
|
82
|
+
name: 'user',
|
|
83
|
+
type: 'address'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
indexed: false,
|
|
87
|
+
internalType: 'uint256',
|
|
88
|
+
name: 'amount',
|
|
89
|
+
type: 'uint256'
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
name: 'Withdrawn',
|
|
93
|
+
type: 'event'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
inputs: [
|
|
97
|
+
{
|
|
98
|
+
internalType: 'address',
|
|
99
|
+
name: 'account',
|
|
100
|
+
type: 'address'
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
name: 'balanceOf',
|
|
104
|
+
outputs: [
|
|
105
|
+
{
|
|
106
|
+
internalType: 'uint256',
|
|
107
|
+
name: '',
|
|
108
|
+
type: 'uint256'
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
stateMutability: 'view',
|
|
112
|
+
type: 'function'
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
inputs: [
|
|
116
|
+
{
|
|
117
|
+
internalType: 'address',
|
|
118
|
+
name: 'account',
|
|
119
|
+
type: 'address'
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
name: 'earned',
|
|
123
|
+
outputs: [
|
|
124
|
+
{
|
|
125
|
+
internalType: 'uint256',
|
|
126
|
+
name: '',
|
|
127
|
+
type: 'uint256'
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
stateMutability: 'view',
|
|
131
|
+
type: 'function'
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
inputs: [],
|
|
135
|
+
name: 'exit',
|
|
136
|
+
outputs: [],
|
|
137
|
+
stateMutability: 'nonpayable',
|
|
138
|
+
type: 'function'
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
inputs: [],
|
|
142
|
+
name: 'getReward',
|
|
143
|
+
outputs: [],
|
|
144
|
+
stateMutability: 'nonpayable',
|
|
145
|
+
type: 'function'
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
inputs: [],
|
|
149
|
+
name: 'getRewardForDuration',
|
|
150
|
+
outputs: [
|
|
151
|
+
{
|
|
152
|
+
internalType: 'uint256',
|
|
153
|
+
name: '',
|
|
154
|
+
type: 'uint256'
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
stateMutability: 'view',
|
|
158
|
+
type: 'function'
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
inputs: [],
|
|
162
|
+
name: 'lastTimeRewardApplicable',
|
|
163
|
+
outputs: [
|
|
164
|
+
{
|
|
165
|
+
internalType: 'uint256',
|
|
166
|
+
name: '',
|
|
167
|
+
type: 'uint256'
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
stateMutability: 'view',
|
|
171
|
+
type: 'function'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
inputs: [],
|
|
175
|
+
name: 'lastUpdateTime',
|
|
176
|
+
outputs: [
|
|
177
|
+
{
|
|
178
|
+
internalType: 'uint256',
|
|
179
|
+
name: '',
|
|
180
|
+
type: 'uint256'
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
stateMutability: 'view',
|
|
184
|
+
type: 'function'
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
inputs: [
|
|
188
|
+
{
|
|
189
|
+
internalType: 'uint256',
|
|
190
|
+
name: 'reward',
|
|
191
|
+
type: 'uint256'
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
name: 'notifyRewardAmount',
|
|
195
|
+
outputs: [],
|
|
196
|
+
stateMutability: 'nonpayable',
|
|
197
|
+
type: 'function'
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
inputs: [],
|
|
201
|
+
name: 'periodFinish',
|
|
202
|
+
outputs: [
|
|
203
|
+
{
|
|
204
|
+
internalType: 'uint256',
|
|
205
|
+
name: '',
|
|
206
|
+
type: 'uint256'
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
stateMutability: 'view',
|
|
210
|
+
type: 'function'
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
inputs: [],
|
|
214
|
+
name: 'rewardPerToken',
|
|
215
|
+
outputs: [
|
|
216
|
+
{
|
|
217
|
+
internalType: 'uint256',
|
|
218
|
+
name: '',
|
|
219
|
+
type: 'uint256'
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
stateMutability: 'view',
|
|
223
|
+
type: 'function'
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
inputs: [],
|
|
227
|
+
name: 'rewardPerTokenStored',
|
|
228
|
+
outputs: [
|
|
229
|
+
{
|
|
230
|
+
internalType: 'uint256',
|
|
231
|
+
name: '',
|
|
232
|
+
type: 'uint256'
|
|
233
|
+
}
|
|
234
|
+
],
|
|
235
|
+
stateMutability: 'view',
|
|
236
|
+
type: 'function'
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
inputs: [],
|
|
240
|
+
name: 'rewardRate',
|
|
241
|
+
outputs: [
|
|
242
|
+
{
|
|
243
|
+
internalType: 'uint256',
|
|
244
|
+
name: '',
|
|
245
|
+
type: 'uint256'
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
stateMutability: 'view',
|
|
249
|
+
type: 'function'
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
inputs: [
|
|
253
|
+
{
|
|
254
|
+
internalType: 'address',
|
|
255
|
+
name: '',
|
|
256
|
+
type: 'address'
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
name: 'rewards',
|
|
260
|
+
outputs: [
|
|
261
|
+
{
|
|
262
|
+
internalType: 'uint256',
|
|
263
|
+
name: '',
|
|
264
|
+
type: 'uint256'
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
stateMutability: 'view',
|
|
268
|
+
type: 'function'
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
inputs: [],
|
|
272
|
+
name: 'rewardsDistribution',
|
|
273
|
+
outputs: [
|
|
274
|
+
{
|
|
275
|
+
internalType: 'address',
|
|
276
|
+
name: '',
|
|
277
|
+
type: 'address'
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
stateMutability: 'view',
|
|
281
|
+
type: 'function'
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
inputs: [],
|
|
285
|
+
name: 'rewardsDuration',
|
|
286
|
+
outputs: [
|
|
287
|
+
{
|
|
288
|
+
internalType: 'uint256',
|
|
289
|
+
name: '',
|
|
290
|
+
type: 'uint256'
|
|
291
|
+
}
|
|
292
|
+
],
|
|
293
|
+
stateMutability: 'view',
|
|
294
|
+
type: 'function'
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
inputs: [],
|
|
298
|
+
name: 'rewardsToken',
|
|
299
|
+
outputs: [
|
|
300
|
+
{
|
|
301
|
+
internalType: 'contract IERC20',
|
|
302
|
+
name: '',
|
|
303
|
+
type: 'address'
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
stateMutability: 'view',
|
|
307
|
+
type: 'function'
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
inputs: [
|
|
311
|
+
{
|
|
312
|
+
internalType: 'uint256',
|
|
313
|
+
name: 'amount',
|
|
314
|
+
type: 'uint256'
|
|
315
|
+
}
|
|
316
|
+
],
|
|
317
|
+
name: 'stake',
|
|
318
|
+
outputs: [],
|
|
319
|
+
stateMutability: 'nonpayable',
|
|
320
|
+
type: 'function'
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
inputs: [
|
|
324
|
+
{
|
|
325
|
+
internalType: 'uint256',
|
|
326
|
+
name: 'amount',
|
|
327
|
+
type: 'uint256'
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
internalType: 'uint256',
|
|
331
|
+
name: 'deadline',
|
|
332
|
+
type: 'uint256'
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
internalType: 'uint8',
|
|
336
|
+
name: 'v',
|
|
337
|
+
type: 'uint8'
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
internalType: 'bytes32',
|
|
341
|
+
name: 'r',
|
|
342
|
+
type: 'bytes32'
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
internalType: 'bytes32',
|
|
346
|
+
name: 's',
|
|
347
|
+
type: 'bytes32'
|
|
348
|
+
}
|
|
349
|
+
],
|
|
350
|
+
name: 'stakeWithPermit',
|
|
351
|
+
outputs: [],
|
|
352
|
+
stateMutability: 'nonpayable',
|
|
353
|
+
type: 'function'
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
inputs: [],
|
|
357
|
+
name: 'stakingToken',
|
|
358
|
+
outputs: [
|
|
359
|
+
{
|
|
360
|
+
internalType: 'contract IERC20',
|
|
361
|
+
name: '',
|
|
362
|
+
type: 'address'
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
stateMutability: 'view',
|
|
366
|
+
type: 'function'
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
inputs: [],
|
|
370
|
+
name: 'totalSupply',
|
|
371
|
+
outputs: [
|
|
372
|
+
{
|
|
373
|
+
internalType: 'uint256',
|
|
374
|
+
name: '',
|
|
375
|
+
type: 'uint256'
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
stateMutability: 'view',
|
|
379
|
+
type: 'function'
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
inputs: [
|
|
383
|
+
{
|
|
384
|
+
internalType: 'address',
|
|
385
|
+
name: '',
|
|
386
|
+
type: 'address'
|
|
387
|
+
}
|
|
388
|
+
],
|
|
389
|
+
name: 'userRewardPerTokenPaid',
|
|
390
|
+
outputs: [
|
|
391
|
+
{
|
|
392
|
+
internalType: 'uint256',
|
|
393
|
+
name: '',
|
|
394
|
+
type: 'uint256'
|
|
395
|
+
}
|
|
396
|
+
],
|
|
397
|
+
stateMutability: 'view',
|
|
398
|
+
type: 'function'
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
inputs: [
|
|
402
|
+
{
|
|
403
|
+
internalType: 'uint256',
|
|
404
|
+
name: 'amount',
|
|
405
|
+
type: 'uint256'
|
|
406
|
+
}
|
|
407
|
+
],
|
|
408
|
+
name: 'withdraw',
|
|
409
|
+
outputs: [],
|
|
410
|
+
stateMutability: 'nonpayable',
|
|
411
|
+
type: 'function'
|
|
412
|
+
}
|
|
413
|
+
];
|
|
414
|
+
exports.default = uniV2StakingRewards;
|
|
@@ -6,3 +6,4 @@ export declare const THOR_ROUTER_CONTRACT_ROPSTEN = "0xefA28233838f46a80AaaC8c30
|
|
|
6
6
|
export declare const FOXY_STAKING_CONTRACT = "0xee77aa3Fd23BbeBaf94386dD44b548e9a785ea4b";
|
|
7
7
|
export declare const WETH_CONTRACT_MAINNET = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
|
8
8
|
export declare const WETH_CONTRACT_ROPSTEN = "0xc778417E063141139Fce010982780140Aa0cD5Ab";
|
|
9
|
+
export declare const UNI_V2_FOX_STAKING_REWARDS_V3 = "0x212ebf9FD3c10F371557b08E993eAaB385c3932b";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WETH_CONTRACT_ROPSTEN = exports.WETH_CONTRACT_MAINNET = exports.FOXY_STAKING_CONTRACT = exports.THOR_ROUTER_CONTRACT_ROPSTEN = exports.THOR_ROUTER_CONTRACT_MAINNET = exports.ZRX_PROXY_CONTRACT = exports.UNI_V2_ROUTER_CONTRACT = exports.SHAPE_SHIFT_ROUTER_CONTRACT = void 0;
|
|
3
|
+
exports.UNI_V2_FOX_STAKING_REWARDS_V3 = exports.WETH_CONTRACT_ROPSTEN = exports.WETH_CONTRACT_MAINNET = exports.FOXY_STAKING_CONTRACT = exports.THOR_ROUTER_CONTRACT_ROPSTEN = exports.THOR_ROUTER_CONTRACT_MAINNET = exports.ZRX_PROXY_CONTRACT = exports.UNI_V2_ROUTER_CONTRACT = exports.SHAPE_SHIFT_ROUTER_CONTRACT = void 0;
|
|
4
4
|
exports.SHAPE_SHIFT_ROUTER_CONTRACT = '0x6a1e73f12018D8e5f966ce794aa2921941feB17E';
|
|
5
5
|
exports.UNI_V2_ROUTER_CONTRACT = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D';
|
|
6
6
|
exports.ZRX_PROXY_CONTRACT = '0xDef1C0ded9bec7F1a1670819833240f027b25EfF';
|
|
@@ -9,3 +9,4 @@ exports.THOR_ROUTER_CONTRACT_ROPSTEN = '0xefA28233838f46a80AaaC8c309077a9ba70D12
|
|
|
9
9
|
exports.FOXY_STAKING_CONTRACT = '0xee77aa3Fd23BbeBaf94386dD44b548e9a785ea4b';
|
|
10
10
|
exports.WETH_CONTRACT_MAINNET = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2';
|
|
11
11
|
exports.WETH_CONTRACT_ROPSTEN = '0xc778417E063141139Fce010982780140Aa0cD5Ab';
|
|
12
|
+
exports.UNI_V2_FOX_STAKING_REWARDS_V3 = '0x212ebf9FD3c10F371557b08E993eAaB385c3932b';
|
|
@@ -41,8 +41,8 @@ class TransactionParser {
|
|
|
41
41
|
this.chainId = args.chainId;
|
|
42
42
|
this.assetId = (0, caip_1.toAssetId)({
|
|
43
43
|
...(0, caip_1.fromChainId)(this.chainId),
|
|
44
|
-
assetNamespace:
|
|
45
|
-
assetReference: caip_1.
|
|
44
|
+
assetNamespace: 'slip44',
|
|
45
|
+
assetReference: caip_1.ASSET_REFERENCE.Ethereum
|
|
46
46
|
});
|
|
47
47
|
const provider = new ethers_1.ethers.providers.JsonRpcProvider(args.rpcUrl);
|
|
48
48
|
this.thor = new thor.Parser({ chainId: this.chainId, rpcUrl: args.rpcUrl });
|
|
@@ -132,7 +132,7 @@ class TransactionParser {
|
|
|
132
132
|
const transferArgs = [
|
|
133
133
|
(0, caip_1.toAssetId)({
|
|
134
134
|
...(0, caip_1.fromChainId)(this.chainId),
|
|
135
|
-
assetNamespace:
|
|
135
|
+
assetNamespace: 'erc20',
|
|
136
136
|
assetReference: transfer.token
|
|
137
137
|
}),
|
|
138
138
|
transfer.from,
|
|
@@ -153,8 +153,8 @@ class TransactionParser {
|
|
|
153
153
|
const transferArgs = [
|
|
154
154
|
(0, caip_1.toAssetId)({
|
|
155
155
|
...(0, caip_1.fromChainId)(this.chainId),
|
|
156
|
-
assetNamespace:
|
|
157
|
-
assetReference: caip_1.
|
|
156
|
+
assetNamespace: 'slip44',
|
|
157
|
+
assetReference: caip_1.ASSET_REFERENCE.Ethereum
|
|
158
158
|
}),
|
|
159
159
|
internalTx.from,
|
|
160
160
|
internalTx.to,
|
|
@@ -11,11 +11,18 @@ export declare class Parser implements SubParser {
|
|
|
11
11
|
readonly chainId: ChainId;
|
|
12
12
|
readonly wethContract: string;
|
|
13
13
|
readonly abiInterface: ethers.utils.Interface;
|
|
14
|
+
readonly stakingRewardsInterface: ethers.utils.Interface;
|
|
14
15
|
readonly supportedFunctions: {
|
|
15
16
|
addLiquidityEthSigHash: string;
|
|
16
17
|
removeLiquidityEthSigHash: string;
|
|
17
18
|
};
|
|
19
|
+
readonly supportedStakingRewardsFunctions: {
|
|
20
|
+
stakeSigHash: string;
|
|
21
|
+
exitSigHash: string;
|
|
22
|
+
};
|
|
18
23
|
constructor(args: ParserArgs);
|
|
24
|
+
parseUniV2(tx: BlockbookTx): Promise<TxSpecific | undefined>;
|
|
25
|
+
parseStakingRewards(tx: BlockbookTx): Promise<TxSpecific | undefined>;
|
|
19
26
|
parse(tx: BlockbookTx): Promise<TxSpecific | undefined>;
|
|
20
27
|
private static pairFor;
|
|
21
28
|
}
|
|
@@ -9,15 +9,21 @@ const ethers_1 = require("ethers");
|
|
|
9
9
|
const types_1 = require("../../types");
|
|
10
10
|
const erc20_1 = __importDefault(require("./abi/erc20"));
|
|
11
11
|
const uniV2_1 = __importDefault(require("./abi/uniV2"));
|
|
12
|
+
const uniV2StakingRewards_1 = __importDefault(require("./abi/uniV2StakingRewards"));
|
|
12
13
|
const constants_1 = require("./constants");
|
|
13
14
|
const utils_1 = require("./utils");
|
|
14
15
|
class Parser {
|
|
15
16
|
constructor(args) {
|
|
16
17
|
this.abiInterface = new ethers_1.ethers.utils.Interface(uniV2_1.default);
|
|
18
|
+
this.stakingRewardsInterface = new ethers_1.ethers.utils.Interface(uniV2StakingRewards_1.default);
|
|
17
19
|
this.supportedFunctions = {
|
|
18
20
|
addLiquidityEthSigHash: this.abiInterface.getSighash('addLiquidityETH'),
|
|
19
21
|
removeLiquidityEthSigHash: this.abiInterface.getSighash('removeLiquidityETH')
|
|
20
22
|
};
|
|
23
|
+
this.supportedStakingRewardsFunctions = {
|
|
24
|
+
stakeSigHash: this.stakingRewardsInterface.getSighash('stake'),
|
|
25
|
+
exitSigHash: this.stakingRewardsInterface.getSighash('exit')
|
|
26
|
+
};
|
|
21
27
|
this.chainId = args.chainId;
|
|
22
28
|
this.provider = args.provider;
|
|
23
29
|
switch (args.chainId) {
|
|
@@ -31,11 +37,9 @@ class Parser {
|
|
|
31
37
|
throw new Error('chainId is not supported. (supported chainIds: eip155:1, eip155:3)');
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
|
-
async
|
|
40
|
+
async parseUniV2(tx) {
|
|
35
41
|
var _a, _b, _c;
|
|
36
42
|
const txData = (_a = tx.ethereumSpecific) === null || _a === void 0 ? void 0 : _a.data;
|
|
37
|
-
if (!(0, utils_1.txInteractsWithContract)(tx, constants_1.UNI_V2_ROUTER_CONTRACT))
|
|
38
|
-
return;
|
|
39
43
|
if (!txData)
|
|
40
44
|
return;
|
|
41
45
|
if (tx.confirmations)
|
|
@@ -60,7 +64,7 @@ class Parser {
|
|
|
60
64
|
const value = decoded.args.amountTokenDesired.toString();
|
|
61
65
|
const assetId = (0, caip_1.toAssetId)({
|
|
62
66
|
...(0, caip_1.fromChainId)(this.chainId),
|
|
63
|
-
assetNamespace:
|
|
67
|
+
assetNamespace: 'erc20',
|
|
64
68
|
assetReference: tokenAddress
|
|
65
69
|
});
|
|
66
70
|
return [
|
|
@@ -83,7 +87,7 @@ class Parser {
|
|
|
83
87
|
const value = decoded.args.liquidity.toString();
|
|
84
88
|
const assetId = (0, caip_1.toAssetId)({
|
|
85
89
|
...(0, caip_1.fromChainId)(this.chainId),
|
|
86
|
-
assetNamespace:
|
|
90
|
+
assetNamespace: 'erc20',
|
|
87
91
|
assetReference: lpTokenAddress
|
|
88
92
|
});
|
|
89
93
|
return [
|
|
@@ -113,6 +117,33 @@ class Parser {
|
|
|
113
117
|
}
|
|
114
118
|
};
|
|
115
119
|
}
|
|
120
|
+
async parseStakingRewards(tx) {
|
|
121
|
+
var _a;
|
|
122
|
+
const txData = (_a = tx.ethereumSpecific) === null || _a === void 0 ? void 0 : _a.data;
|
|
123
|
+
if (!txData)
|
|
124
|
+
return;
|
|
125
|
+
const txSigHash = (0, utils_1.getSigHash)(txData);
|
|
126
|
+
if (!Object.values(this.supportedStakingRewardsFunctions).some((hash) => hash === txSigHash))
|
|
127
|
+
return;
|
|
128
|
+
const decoded = this.stakingRewardsInterface.parseTransaction({ data: txData });
|
|
129
|
+
// failed to decode input data
|
|
130
|
+
if (!decoded)
|
|
131
|
+
return;
|
|
132
|
+
return {
|
|
133
|
+
data: {
|
|
134
|
+
parser: types_1.TxParser.UniV2,
|
|
135
|
+
method: decoded.name
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
async parse(tx) {
|
|
140
|
+
if ((0, utils_1.txInteractsWithContract)(tx, constants_1.UNI_V2_ROUTER_CONTRACT))
|
|
141
|
+
return this.parseUniV2(tx);
|
|
142
|
+
// TODO: parse any transaction that has input data that is able to be decoded using the `stakingRewardsInterface`
|
|
143
|
+
if ((0, utils_1.txInteractsWithContract)(tx, constants_1.UNI_V2_FOX_STAKING_REWARDS_V3))
|
|
144
|
+
return this.parseStakingRewards(tx);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
116
147
|
static pairFor(tokenA, tokenB) {
|
|
117
148
|
const [token0, token1] = tokenA < tokenB ? [tokenA, tokenB] : [tokenB, tokenA];
|
|
118
149
|
const factoryContract = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f';
|
|
@@ -49,7 +49,7 @@ class Parser {
|
|
|
49
49
|
const contract = new ethers_1.ethers.Contract(this.wethContract, erc20_1.default, this.provider);
|
|
50
50
|
const assetId = (0, caip_1.toAssetId)({
|
|
51
51
|
...(0, caip_1.fromChainId)(this.chainId),
|
|
52
|
-
assetNamespace:
|
|
52
|
+
assetNamespace: 'erc20',
|
|
53
53
|
assetReference: this.wethContract
|
|
54
54
|
});
|
|
55
55
|
const token = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/unchained-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"ws": "^8.3.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@shapeshiftoss/caip": "^
|
|
31
|
+
"@shapeshiftoss/caip": "^4.0.0",
|
|
32
32
|
"@shapeshiftoss/logger": "^1.1.2",
|
|
33
33
|
"@shapeshiftoss/types": "^4.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@shapeshiftoss/caip": "^
|
|
36
|
+
"@shapeshiftoss/caip": "^4.0.0",
|
|
37
37
|
"@shapeshiftoss/common-api": "^6.11.0",
|
|
38
38
|
"@shapeshiftoss/logger": "^1.1.2",
|
|
39
39
|
"@shapeshiftoss/types": "^4.0.0",
|