@shapeshiftoss/unchained-client 9.0.1 → 9.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/evm/avalanche/index.d.ts +2 -0
- package/dist/{ethereum → evm/avalanche}/index.js +1 -2
- package/dist/evm/avalanche/parser/index.d.ts +5 -0
- package/dist/evm/avalanche/parser/index.js +16 -0
- package/dist/evm/ethereum/index.d.ts +2 -0
- package/dist/evm/ethereum/index.js +18 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/foxyStaking.d.ts +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/foxyStaking.js +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/shapeShiftRouter.d.ts +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/shapeShiftRouter.js +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/thor.d.ts +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/thor.js +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/uniV2.d.ts +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/uniV2.js +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/uniV2StakingRewards.d.ts +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/uniV2StakingRewards.js +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/weth.d.ts +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/weth.js +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/yearnVault.d.ts +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/abi/yearnVault.js +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/constants.d.ts +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/constants.js +0 -0
- package/dist/{ethereum → evm/ethereum}/parser/foxy.d.ts +3 -3
- package/dist/{ethereum → evm/ethereum}/parser/foxy.js +4 -4
- package/dist/evm/ethereum/parser/index.d.ts +5 -0
- package/dist/evm/ethereum/parser/index.js +55 -0
- package/dist/{ethereum → evm/ethereum}/parser/thor.d.ts +3 -3
- package/dist/{ethereum → evm/ethereum}/parser/thor.js +4 -4
- package/dist/{ethereum → evm/ethereum}/parser/uniV2.d.ts +3 -3
- package/dist/{ethereum → evm/ethereum}/parser/uniV2.js +8 -8
- package/dist/{ethereum → evm/ethereum}/parser/weth.d.ts +3 -3
- package/dist/{ethereum → evm/ethereum}/parser/weth.js +4 -4
- package/dist/{ethereum → evm/ethereum}/parser/yearn.d.ts +3 -3
- package/dist/{ethereum → evm/ethereum}/parser/yearn.js +3 -3
- package/dist/evm/ethereum/parser/zrx.d.ts +5 -0
- package/dist/{ethereum → evm/ethereum}/parser/zrx.js +3 -3
- package/dist/evm/index.d.ts +2 -0
- package/dist/evm/index.js +28 -0
- package/dist/{ethereum → evm}/parser/abi/erc20.d.ts +0 -0
- package/dist/{ethereum → evm}/parser/abi/erc20.js +0 -0
- package/dist/{ethereum → evm}/parser/erc20.d.ts +3 -4
- package/dist/{ethereum → evm}/parser/erc20.js +1 -1
- package/dist/evm/parser/index.d.ts +26 -0
- package/dist/{ethereum → evm}/parser/index.js +28 -38
- package/dist/{ethereum → evm/parser}/types.d.ts +6 -4
- package/dist/{ethereum → evm/parser}/types.js +0 -0
- package/dist/evm/parser/utils.d.ts +4 -0
- package/dist/{ethereum → evm}/parser/utils.js +0 -0
- package/dist/generated/avalanche/api.d.ts +766 -0
- package/dist/generated/avalanche/api.js +490 -0
- package/dist/generated/avalanche/base.d.ts +55 -0
- package/dist/generated/avalanche/base.js +64 -0
- package/dist/generated/avalanche/common.d.ts +65 -0
- package/dist/generated/avalanche/common.js +137 -0
- package/dist/generated/avalanche/configuration.d.ts +83 -0
- package/dist/generated/avalanche/configuration.js +42 -0
- package/dist/generated/avalanche/index.d.ts +13 -0
- package/dist/generated/avalanche/index.js +31 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -7
- package/package.json +5 -5
- package/dist/ethereum/index.d.ts +0 -3
- package/dist/ethereum/parser/index.d.ts +0 -23
- package/dist/ethereum/parser/utils.d.ts +0 -3
- package/dist/ethereum/parser/zrx.d.ts +0 -5
|
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("
|
|
17
|
+
__exportStar(require("../../generated/avalanche"), exports);
|
|
18
18
|
__exportStar(require("./parser"), exports);
|
|
19
|
-
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AvalancheTx } from '../../../generated/avalanche';
|
|
2
|
+
import { BaseTransactionParser, TransactionParserArgs } from '../../parser';
|
|
3
|
+
export declare class TransactionParser extends BaseTransactionParser<AvalancheTx> {
|
|
4
|
+
constructor(args: TransactionParserArgs);
|
|
5
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionParser = void 0;
|
|
4
|
+
const caip_1 = require("@shapeshiftoss/caip");
|
|
5
|
+
const parser_1 = require("../../parser");
|
|
6
|
+
class TransactionParser extends parser_1.BaseTransactionParser {
|
|
7
|
+
constructor(args) {
|
|
8
|
+
super(args);
|
|
9
|
+
this.assetId = (0, caip_1.toAssetId)({
|
|
10
|
+
chainId: this.chainId,
|
|
11
|
+
assetNamespace: 'slip44',
|
|
12
|
+
assetReference: caip_1.ASSET_REFERENCE.AvalancheC
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.TransactionParser = TransactionParser;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../../generated/ethereum"), exports);
|
|
18
|
+
__exportStar(require("./parser"), exports);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
|
-
import { EthereumTx } from '
|
|
3
|
-
import { SubParser, TxSpecific } from '
|
|
4
|
-
export declare class Parser implements SubParser {
|
|
2
|
+
import { EthereumTx } from '../../../generated/ethereum';
|
|
3
|
+
import { SubParser, TxSpecific } from '../../parser';
|
|
4
|
+
export declare class Parser implements SubParser<EthereumTx> {
|
|
5
5
|
readonly abiInterface: ethers.utils.Interface;
|
|
6
6
|
readonly supportedFunctions: {
|
|
7
7
|
stakeSigHash: string;
|
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Parser = void 0;
|
|
7
7
|
const ethers_1 = require("ethers");
|
|
8
|
-
const types_1 = require("
|
|
8
|
+
const types_1 = require("../../../types");
|
|
9
|
+
const parser_1 = require("../../parser");
|
|
9
10
|
const foxyStaking_1 = __importDefault(require("./abi/foxyStaking"));
|
|
10
11
|
const constants_1 = require("./constants");
|
|
11
|
-
const utils_1 = require("./utils");
|
|
12
12
|
class Parser {
|
|
13
13
|
constructor() {
|
|
14
14
|
this.abiInterface = new ethers_1.ethers.utils.Interface(foxyStaking_1.default);
|
|
@@ -20,11 +20,11 @@ class Parser {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
async parse(tx) {
|
|
23
|
-
if (!(0,
|
|
23
|
+
if (!(0, parser_1.txInteractsWithContract)(tx, constants_1.FOXY_STAKING_CONTRACT))
|
|
24
24
|
return;
|
|
25
25
|
if (!tx.inputData)
|
|
26
26
|
return;
|
|
27
|
-
const txSigHash = (0,
|
|
27
|
+
const txSigHash = (0, parser_1.getSigHash)(tx.inputData);
|
|
28
28
|
if (!Object.values(this.supportedFunctions).some((hash) => hash === txSigHash))
|
|
29
29
|
return;
|
|
30
30
|
const decoded = this.abiInterface.parseTransaction({ data: tx.inputData });
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TransactionParser = void 0;
|
|
27
|
+
const caip_1 = require("@shapeshiftoss/caip");
|
|
28
|
+
const parser_1 = require("../../parser");
|
|
29
|
+
const foxy = __importStar(require("./foxy"));
|
|
30
|
+
const thor = __importStar(require("./thor"));
|
|
31
|
+
const uniV2 = __importStar(require("./uniV2"));
|
|
32
|
+
const weth = __importStar(require("./weth"));
|
|
33
|
+
const yearn = __importStar(require("./yearn"));
|
|
34
|
+
const zrx = __importStar(require("./zrx"));
|
|
35
|
+
class TransactionParser extends parser_1.BaseTransactionParser {
|
|
36
|
+
constructor(args) {
|
|
37
|
+
super(args);
|
|
38
|
+
this.assetId = (0, caip_1.toAssetId)({
|
|
39
|
+
chainId: this.chainId,
|
|
40
|
+
assetNamespace: 'slip44',
|
|
41
|
+
assetReference: caip_1.ASSET_REFERENCE.Ethereum
|
|
42
|
+
});
|
|
43
|
+
// due to the current parser logic, order here matters (register most generic first to most specific last)
|
|
44
|
+
// weth and yearn have the same sigHash for deposit(), but the weth parser is stricter resulting in faster processing times
|
|
45
|
+
this.registerParsers([
|
|
46
|
+
new yearn.Parser({ chainId: this.chainId, provider: this.provider }),
|
|
47
|
+
new foxy.Parser(),
|
|
48
|
+
new weth.Parser({ chainId: this.chainId, provider: this.provider }),
|
|
49
|
+
new uniV2.Parser({ chainId: this.chainId, provider: this.provider }),
|
|
50
|
+
new thor.Parser({ chainId: this.chainId, rpcUrl: args.rpcUrl }),
|
|
51
|
+
new zrx.Parser()
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.TransactionParser = TransactionParser;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
|
-
import { EthereumTx } from '
|
|
4
|
-
import { SubParser, TxSpecific } from '
|
|
3
|
+
import { EthereumTx } from '../../../generated/ethereum';
|
|
4
|
+
import { SubParser, TxSpecific } from '../../parser';
|
|
5
5
|
export interface ParserArgs {
|
|
6
6
|
chainId: ChainId;
|
|
7
7
|
rpcUrl: string;
|
|
8
8
|
}
|
|
9
|
-
export declare class Parser implements SubParser {
|
|
9
|
+
export declare class Parser implements SubParser<EthereumTx> {
|
|
10
10
|
readonly routerContract: string;
|
|
11
11
|
readonly abiInterface: ethers.utils.Interface;
|
|
12
12
|
readonly supportedFunctions: {
|
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Parser = void 0;
|
|
7
7
|
const ethers_1 = require("ethers");
|
|
8
|
-
const types_1 = require("
|
|
8
|
+
const types_1 = require("../../../types");
|
|
9
|
+
const parser_1 = require("../../parser");
|
|
9
10
|
const thor_1 = __importDefault(require("./abi/thor"));
|
|
10
11
|
const constants_1 = require("./constants");
|
|
11
|
-
const utils_1 = require("./utils");
|
|
12
12
|
const SWAP_TYPES = ['SWAP', '=', 's'];
|
|
13
13
|
class Parser {
|
|
14
14
|
constructor(args) {
|
|
@@ -31,11 +31,11 @@ class Parser {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
async parse(tx) {
|
|
34
|
-
if (!(0,
|
|
34
|
+
if (!(0, parser_1.txInteractsWithContract)(tx, this.routerContract))
|
|
35
35
|
return;
|
|
36
36
|
if (!tx.inputData)
|
|
37
37
|
return;
|
|
38
|
-
const txSigHash = (0,
|
|
38
|
+
const txSigHash = (0, parser_1.getSigHash)(tx.inputData);
|
|
39
39
|
if (!Object.values(this.supportedFunctions).some((hash) => hash === txSigHash))
|
|
40
40
|
return;
|
|
41
41
|
const decoded = this.abiInterface.parseTransaction({ data: tx.inputData });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
|
-
import { EthereumTx } from '
|
|
4
|
-
import { SubParser, TxSpecific } from '
|
|
3
|
+
import { EthereumTx } from '../../../generated/ethereum';
|
|
4
|
+
import { SubParser, TxSpecific } from '../../parser';
|
|
5
5
|
export interface ParserArgs {
|
|
6
6
|
chainId: ChainId;
|
|
7
7
|
provider: ethers.providers.JsonRpcProvider;
|
|
8
8
|
}
|
|
9
|
-
export declare class Parser implements SubParser {
|
|
9
|
+
export declare class Parser implements SubParser<EthereumTx> {
|
|
10
10
|
provider: ethers.providers.JsonRpcProvider;
|
|
11
11
|
readonly chainId: ChainId;
|
|
12
12
|
readonly wethContract: string;
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Parser = void 0;
|
|
7
7
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
8
8
|
const ethers_1 = require("ethers");
|
|
9
|
-
const types_1 = require("
|
|
10
|
-
const
|
|
9
|
+
const types_1 = require("../../../types");
|
|
10
|
+
const parser_1 = require("../../parser");
|
|
11
|
+
const erc20_1 = __importDefault(require("../../parser/abi/erc20"));
|
|
11
12
|
const uniV2_1 = __importDefault(require("./abi/uniV2"));
|
|
12
13
|
const uniV2StakingRewards_1 = __importDefault(require("./abi/uniV2StakingRewards"));
|
|
13
14
|
const constants_1 = require("./constants");
|
|
14
|
-
const utils_1 = require("./utils");
|
|
15
15
|
class Parser {
|
|
16
16
|
constructor(args) {
|
|
17
17
|
this.abiInterface = new ethers_1.ethers.utils.Interface(uniV2_1.default);
|
|
@@ -42,7 +42,7 @@ class Parser {
|
|
|
42
42
|
return;
|
|
43
43
|
if (tx.confirmations)
|
|
44
44
|
return;
|
|
45
|
-
const txSigHash = (0,
|
|
45
|
+
const txSigHash = (0, parser_1.getSigHash)(tx.inputData);
|
|
46
46
|
if (!Object.values(this.supportedFunctions).some((hash) => hash === txSigHash))
|
|
47
47
|
return;
|
|
48
48
|
const decoded = this.abiInterface.parseTransaction({ data: tx.inputData });
|
|
@@ -52,7 +52,7 @@ class Parser {
|
|
|
52
52
|
const tokenAddress = ethers_1.ethers.utils.getAddress(decoded.args.token.toLowerCase());
|
|
53
53
|
const lpTokenAddress = Parser.pairFor(tokenAddress, this.wethContract);
|
|
54
54
|
const transfers = await (async () => {
|
|
55
|
-
switch ((0,
|
|
55
|
+
switch ((0, parser_1.getSigHash)(tx.inputData)) {
|
|
56
56
|
case this.supportedFunctions.addLiquidityEthSigHash: {
|
|
57
57
|
const contract = new ethers_1.ethers.Contract(tokenAddress, erc20_1.default, this.provider);
|
|
58
58
|
const decimals = await contract.decimals();
|
|
@@ -117,7 +117,7 @@ class Parser {
|
|
|
117
117
|
async parseStakingRewards(tx) {
|
|
118
118
|
if (!tx.inputData)
|
|
119
119
|
return;
|
|
120
|
-
const txSigHash = (0,
|
|
120
|
+
const txSigHash = (0, parser_1.getSigHash)(tx.inputData);
|
|
121
121
|
if (!Object.values(this.supportedStakingRewardsFunctions).some((hash) => hash === txSigHash))
|
|
122
122
|
return;
|
|
123
123
|
const decoded = this.stakingRewardsInterface.parseTransaction({ data: tx.inputData });
|
|
@@ -132,10 +132,10 @@ class Parser {
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
async parse(tx) {
|
|
135
|
-
if ((0,
|
|
135
|
+
if ((0, parser_1.txInteractsWithContract)(tx, constants_1.UNI_V2_ROUTER_CONTRACT))
|
|
136
136
|
return this.parseUniV2(tx);
|
|
137
137
|
// TODO: parse any transaction that has input data that is able to be decoded using the `stakingRewardsInterface`
|
|
138
|
-
if ((0,
|
|
138
|
+
if ((0, parser_1.txInteractsWithContract)(tx, constants_1.UNI_V2_FOX_STAKING_REWARDS_V3))
|
|
139
139
|
return this.parseStakingRewards(tx);
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
|
-
import { EthereumTx } from '
|
|
4
|
-
import { SubParser, TxSpecific } from '
|
|
3
|
+
import { EthereumTx } from '../../../generated/ethereum';
|
|
4
|
+
import { SubParser, TxSpecific } from '../../parser';
|
|
5
5
|
export interface ParserArgs {
|
|
6
6
|
chainId: ChainId;
|
|
7
7
|
provider: ethers.providers.JsonRpcProvider;
|
|
8
8
|
}
|
|
9
|
-
export declare class Parser implements SubParser {
|
|
9
|
+
export declare class Parser implements SubParser<EthereumTx> {
|
|
10
10
|
provider: ethers.providers.JsonRpcProvider;
|
|
11
11
|
readonly chainId: ChainId;
|
|
12
12
|
readonly wethContract: string;
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Parser = void 0;
|
|
7
7
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
8
8
|
const ethers_1 = require("ethers");
|
|
9
|
-
const types_1 = require("
|
|
9
|
+
const types_1 = require("../../../types");
|
|
10
|
+
const parser_1 = require("../../parser");
|
|
10
11
|
const weth_1 = __importDefault(require("./abi/weth"));
|
|
11
12
|
const constants_1 = require("./constants");
|
|
12
|
-
const utils_1 = require("./utils");
|
|
13
13
|
class Parser {
|
|
14
14
|
constructor(args) {
|
|
15
15
|
this.abiInterface = new ethers_1.ethers.utils.Interface(weth_1.default);
|
|
@@ -31,11 +31,11 @@ class Parser {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
async parse(tx) {
|
|
34
|
-
if (!(0,
|
|
34
|
+
if (!(0, parser_1.txInteractsWithContract)(tx, this.wethContract))
|
|
35
35
|
return;
|
|
36
36
|
if (!tx.inputData)
|
|
37
37
|
return;
|
|
38
|
-
const txSigHash = (0,
|
|
38
|
+
const txSigHash = (0, parser_1.getSigHash)(tx.inputData);
|
|
39
39
|
if (!Object.values(this.supportedFunctions).some((hash) => hash === txSigHash))
|
|
40
40
|
return;
|
|
41
41
|
const decoded = this.abiInterface.parseTransaction({ data: tx.inputData });
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { ChainId as YearnChainId, Yearn } from '@yfi/sdk';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
|
-
import { EthereumTx } from '
|
|
5
|
-
import { SubParser, TxSpecific } from '
|
|
4
|
+
import { EthereumTx } from '../../../generated/ethereum';
|
|
5
|
+
import { SubParser, TxSpecific } from '../../parser';
|
|
6
6
|
interface ParserArgs {
|
|
7
7
|
chainId: ChainId;
|
|
8
8
|
provider: ethers.providers.JsonRpcProvider;
|
|
9
9
|
}
|
|
10
|
-
export declare class Parser implements SubParser {
|
|
10
|
+
export declare class Parser implements SubParser<EthereumTx> {
|
|
11
11
|
provider: ethers.providers.JsonRpcProvider;
|
|
12
12
|
yearnSdk: Yearn<YearnChainId> | undefined;
|
|
13
13
|
yearnTokenVaultAddresses: string[] | undefined;
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Parser = void 0;
|
|
7
7
|
const sdk_1 = require("@yfi/sdk");
|
|
8
8
|
const ethers_1 = require("ethers");
|
|
9
|
-
const types_1 = require("
|
|
9
|
+
const types_1 = require("../../../types");
|
|
10
|
+
const parser_1 = require("../../parser");
|
|
10
11
|
const shapeShiftRouter_1 = __importDefault(require("./abi/shapeShiftRouter"));
|
|
11
12
|
const yearnVault_1 = __importDefault(require("./abi/yearnVault"));
|
|
12
13
|
const constants_1 = require("./constants");
|
|
13
|
-
const utils_1 = require("./utils");
|
|
14
14
|
class Parser {
|
|
15
15
|
constructor(args) {
|
|
16
16
|
this.shapeShiftInterface = new ethers_1.ethers.utils.Interface(shapeShiftRouter_1.default);
|
|
@@ -36,7 +36,7 @@ class Parser {
|
|
|
36
36
|
var _a, _b;
|
|
37
37
|
if (!tx.inputData)
|
|
38
38
|
return;
|
|
39
|
-
const txSigHash = (0,
|
|
39
|
+
const txSigHash = (0, parser_1.getSigHash)(tx.inputData);
|
|
40
40
|
const abiInterface = this.getAbiInterface(txSigHash);
|
|
41
41
|
if (!abiInterface)
|
|
42
42
|
return;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Parser = void 0;
|
|
4
|
-
const types_1 = require("
|
|
4
|
+
const types_1 = require("../../../types");
|
|
5
|
+
const parser_1 = require("../../parser");
|
|
5
6
|
const constants_1 = require("./constants");
|
|
6
|
-
const utils_1 = require("./utils");
|
|
7
7
|
class Parser {
|
|
8
8
|
async parse(tx) {
|
|
9
|
-
if (!(0,
|
|
9
|
+
if (!(0, parser_1.txInteractsWithContract)(tx, constants_1.ZRX_PROXY_CONTRACT))
|
|
10
10
|
return;
|
|
11
11
|
if (!(tx.tokenTransfers && tx.tokenTransfers.length))
|
|
12
12
|
return;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.avalanche = exports.ethereum = void 0;
|
|
27
|
+
exports.ethereum = __importStar(require("./ethereum"));
|
|
28
|
+
exports.avalanche = __importStar(require("./avalanche"));
|
|
File without changes
|
|
File without changes
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { ChainId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
|
-
import {
|
|
4
|
-
import { SubParser, TxSpecific } from '../types';
|
|
3
|
+
import { SubParser, Tx, TxSpecific } from './types';
|
|
5
4
|
interface ParserArgs {
|
|
6
5
|
chainId: ChainId;
|
|
7
6
|
provider: ethers.providers.JsonRpcProvider;
|
|
8
7
|
}
|
|
9
|
-
export declare class Parser implements SubParser {
|
|
8
|
+
export declare class Parser<T extends Tx> implements SubParser<T> {
|
|
10
9
|
provider: ethers.providers.JsonRpcProvider;
|
|
11
10
|
readonly chainId: ChainId;
|
|
12
11
|
readonly abiInterface: ethers.utils.Interface;
|
|
@@ -14,6 +13,6 @@ export declare class Parser implements SubParser {
|
|
|
14
13
|
approveSigHash: string;
|
|
15
14
|
};
|
|
16
15
|
constructor(args: ParserArgs);
|
|
17
|
-
parse(tx:
|
|
16
|
+
parse(tx: T): Promise<TxSpecific | undefined>;
|
|
18
17
|
}
|
|
19
18
|
export {};
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Parser = void 0;
|
|
7
7
|
const caip_1 = require("@shapeshiftoss/caip");
|
|
8
8
|
const ethers_1 = require("ethers");
|
|
9
|
-
const types_1 = require("../types");
|
|
10
9
|
const erc20_1 = __importDefault(require("./abi/erc20"));
|
|
10
|
+
const types_1 = require("./types");
|
|
11
11
|
const utils_1 = require("./utils");
|
|
12
12
|
class Parser {
|
|
13
13
|
constructor(args) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AssetId, ChainId } from '@shapeshiftoss/caip';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
import { ParsedTx, SubParser, Tx } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './utils';
|
|
6
|
+
export interface TransactionParserArgs {
|
|
7
|
+
chainId: ChainId;
|
|
8
|
+
rpcUrl: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class BaseTransactionParser<T extends Tx> {
|
|
11
|
+
chainId: ChainId;
|
|
12
|
+
assetId: AssetId;
|
|
13
|
+
protected readonly provider: ethers.providers.JsonRpcProvider;
|
|
14
|
+
private parsers;
|
|
15
|
+
constructor(args: TransactionParserArgs);
|
|
16
|
+
/**
|
|
17
|
+
* Register custom transaction sub parser to extract contract specific data
|
|
18
|
+
*
|
|
19
|
+
* _parsers should be registered from most generic first to most specific last_
|
|
20
|
+
*/
|
|
21
|
+
registerParser(parser: SubParser<T>): void;
|
|
22
|
+
protected registerParsers(parsers: Array<SubParser<T>>): void;
|
|
23
|
+
parse(tx: T, address: string): Promise<ParsedTx>;
|
|
24
|
+
private getStatus;
|
|
25
|
+
private getParsedTxWithTransfers;
|
|
26
|
+
}
|