@shapeshiftoss/unchained-client 9.3.0 → 9.4.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.
Files changed (64) hide show
  1. package/dist/bitcoin/parser/index.js +1 -1
  2. package/dist/cosmos/parser/index.js +1 -1
  3. package/dist/evm/avalanche/parser/index.d.ts +2 -2
  4. package/dist/evm/ethereum/parser/constants.d.ts +1 -0
  5. package/dist/evm/ethereum/parser/constants.js +2 -1
  6. package/dist/evm/ethereum/parser/cowswap.d.ts +5 -0
  7. package/dist/evm/ethereum/parser/cowswap.js +27 -0
  8. package/dist/evm/ethereum/parser/foxy.d.ts +3 -3
  9. package/dist/evm/ethereum/parser/index.d.ts +2 -2
  10. package/dist/evm/ethereum/parser/index.js +3 -1
  11. package/dist/evm/ethereum/parser/thor.d.ts +3 -3
  12. package/dist/evm/ethereum/parser/uniV2.d.ts +5 -5
  13. package/dist/evm/ethereum/parser/weth.d.ts +3 -3
  14. package/dist/evm/ethereum/parser/yearn.d.ts +3 -3
  15. package/dist/evm/ethereum/parser/zrx.d.ts +3 -3
  16. package/dist/evm/index.d.ts +2 -0
  17. package/dist/evm/index.js +3 -1
  18. package/dist/evm/parser/index.js +4 -4
  19. package/dist/evm/parser/types.d.ts +2 -3
  20. package/dist/generated/avalanche/api.d.ts +121 -152
  21. package/dist/generated/avalanche/api.js +5 -5
  22. package/dist/generated/avalanche/base.d.ts +1 -1
  23. package/dist/generated/avalanche/base.js +1 -1
  24. package/dist/generated/avalanche/common.d.ts +1 -1
  25. package/dist/generated/avalanche/common.js +1 -1
  26. package/dist/generated/avalanche/configuration.d.ts +1 -1
  27. package/dist/generated/avalanche/configuration.js +1 -1
  28. package/dist/generated/avalanche/index.d.ts +1 -1
  29. package/dist/generated/avalanche/index.js +1 -1
  30. package/dist/generated/bitcoin/api.d.ts +45 -76
  31. package/dist/generated/bitcoin/api.js +1 -1
  32. package/dist/generated/bitcoin/base.d.ts +1 -1
  33. package/dist/generated/bitcoin/base.js +1 -1
  34. package/dist/generated/bitcoin/common.d.ts +1 -1
  35. package/dist/generated/bitcoin/common.js +1 -1
  36. package/dist/generated/bitcoin/configuration.d.ts +1 -1
  37. package/dist/generated/bitcoin/configuration.js +1 -1
  38. package/dist/generated/bitcoin/index.d.ts +1 -1
  39. package/dist/generated/bitcoin/index.js +1 -1
  40. package/dist/generated/dogecoin/api.d.ts +45 -76
  41. package/dist/generated/dogecoin/api.js +1 -1
  42. package/dist/generated/dogecoin/base.d.ts +1 -1
  43. package/dist/generated/dogecoin/base.js +1 -1
  44. package/dist/generated/dogecoin/common.d.ts +1 -1
  45. package/dist/generated/dogecoin/common.js +1 -1
  46. package/dist/generated/dogecoin/configuration.d.ts +1 -1
  47. package/dist/generated/dogecoin/configuration.js +1 -1
  48. package/dist/generated/dogecoin/index.d.ts +1 -1
  49. package/dist/generated/dogecoin/index.js +1 -1
  50. package/dist/generated/ethereum/api.d.ts +117 -148
  51. package/dist/generated/ethereum/api.js +1 -1
  52. package/dist/generated/ethereum/base.d.ts +1 -1
  53. package/dist/generated/ethereum/base.js +1 -1
  54. package/dist/generated/ethereum/common.d.ts +1 -1
  55. package/dist/generated/ethereum/common.js +1 -1
  56. package/dist/generated/ethereum/configuration.d.ts +1 -1
  57. package/dist/generated/ethereum/configuration.js +1 -1
  58. package/dist/generated/ethereum/index.d.ts +1 -1
  59. package/dist/generated/ethereum/index.js +1 -1
  60. package/dist/index.d.ts +3 -1
  61. package/dist/index.js +4 -2
  62. package/dist/types.d.ts +16 -13
  63. package/dist/types.js +21 -14
  64. package/package.json +4 -4
@@ -23,7 +23,7 @@ class TransactionParser {
23
23
  blockTime: tx.timestamp,
24
24
  chainId: this.chainId,
25
25
  confirmations: tx.confirmations,
26
- status: tx.confirmations > 0 ? types_1.Status.Confirmed : types_1.Status.Pending,
26
+ status: tx.confirmations > 0 ? types_1.TxStatus.Confirmed : types_1.TxStatus.Pending,
27
27
  transfers: [],
28
28
  txid: tx.txid
29
29
  };
@@ -25,7 +25,7 @@ class TransactionParser {
25
25
  blockTime: (_b = tx.timestamp) !== null && _b !== void 0 ? _b : Math.floor(Date.now() / 1000),
26
26
  chainId: this.chainId,
27
27
  confirmations: tx.confirmations,
28
- status: tx.confirmations > 0 ? types_1.Status.Confirmed : types_1.Status.Pending,
28
+ status: tx.confirmations > 0 ? types_1.TxStatus.Confirmed : types_1.TxStatus.Pending,
29
29
  transfers: [],
30
30
  txid: tx.txid
31
31
  };
@@ -1,5 +1,5 @@
1
- import { AvalancheTx } from '../../../generated/avalanche';
1
+ import { Tx } from '../../../generated/avalanche';
2
2
  import { BaseTransactionParser, TransactionParserArgs } from '../../parser';
3
- export declare class TransactionParser extends BaseTransactionParser<AvalancheTx> {
3
+ export declare class TransactionParser extends BaseTransactionParser<Tx> {
4
4
  constructor(args: TransactionParserArgs);
5
5
  }
@@ -7,3 +7,4 @@ export declare const FOXY_STAKING_CONTRACT = "0xee77aa3Fd23BbeBaf94386dD44b548e9
7
7
  export declare const WETH_CONTRACT_MAINNET = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
8
8
  export declare const WETH_CONTRACT_ROPSTEN = "0xc778417E063141139Fce010982780140Aa0cD5Ab";
9
9
  export declare const UNI_V2_FOX_STAKING_REWARDS_V3 = "0x212ebf9FD3c10F371557b08E993eAaB385c3932b";
10
+ export declare const COWSWAP_CONTRACT_MAINNET = "0x9008D19f58AAbD9eD0D60971565AA8510560ab41";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.COWSWAP_CONTRACT_MAINNET = 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';
@@ -10,3 +10,4 @@ exports.FOXY_STAKING_CONTRACT = '0xee77aa3Fd23BbeBaf94386dD44b548e9a785ea4b';
10
10
  exports.WETH_CONTRACT_MAINNET = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2';
11
11
  exports.WETH_CONTRACT_ROPSTEN = '0xc778417E063141139Fce010982780140Aa0cD5Ab';
12
12
  exports.UNI_V2_FOX_STAKING_REWARDS_V3 = '0x212ebf9FD3c10F371557b08E993eAaB385c3932b';
13
+ exports.COWSWAP_CONTRACT_MAINNET = '0x9008D19f58AAbD9eD0D60971565AA8510560ab41';
@@ -0,0 +1,5 @@
1
+ import { Tx } from '../../../generated/ethereum';
2
+ import { SubParser, TxSpecific } from '../../parser';
3
+ export declare class Parser implements SubParser<Tx> {
4
+ parse(tx: Tx): Promise<TxSpecific | undefined>;
5
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Parser = void 0;
4
+ const types_1 = require("../../../types");
5
+ const parser_1 = require("../../parser");
6
+ const constants_1 = require("./constants");
7
+ class Parser {
8
+ async parse(tx) {
9
+ if (!(0, parser_1.txInteractsWithContract)(tx, constants_1.COWSWAP_CONTRACT_MAINNET))
10
+ return;
11
+ if (!(tx.tokenTransfers && tx.tokenTransfers.length))
12
+ return;
13
+ const trade = {
14
+ dexName: types_1.Dex.CowSwap,
15
+ type: types_1.TradeType.Trade
16
+ };
17
+ const data = {
18
+ method: undefined,
19
+ parser: types_1.TxParser.CowSwap
20
+ };
21
+ return {
22
+ trade,
23
+ data
24
+ };
25
+ }
26
+ }
27
+ exports.Parser = Parser;
@@ -1,7 +1,7 @@
1
1
  import { ethers } from 'ethers';
2
- import { EthereumTx } from '../../../generated/ethereum';
2
+ import { Tx } from '../../../generated/ethereum';
3
3
  import { SubParser, TxSpecific } from '../../parser';
4
- export declare class Parser implements SubParser<EthereumTx> {
4
+ export declare class Parser implements SubParser<Tx> {
5
5
  readonly abiInterface: ethers.utils.Interface;
6
6
  readonly supportedFunctions: {
7
7
  stakeSigHash: string;
@@ -9,5 +9,5 @@ export declare class Parser implements SubParser<EthereumTx> {
9
9
  instantUnstakeSigHash: string;
10
10
  claimWithdrawSigHash: string;
11
11
  };
12
- parse(tx: EthereumTx): Promise<TxSpecific | undefined>;
12
+ parse(tx: Tx): Promise<TxSpecific | undefined>;
13
13
  }
@@ -1,5 +1,5 @@
1
- import { EthereumTx } from '../../../generated/ethereum';
1
+ import { Tx } from '../../../generated/ethereum';
2
2
  import { BaseTransactionParser, TransactionParserArgs } from '../../parser';
3
- export declare class TransactionParser extends BaseTransactionParser<EthereumTx> {
3
+ export declare class TransactionParser extends BaseTransactionParser<Tx> {
4
4
  constructor(args: TransactionParserArgs);
5
5
  }
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.TransactionParser = void 0;
27
27
  const caip_1 = require("@shapeshiftoss/caip");
28
28
  const parser_1 = require("../../parser");
29
+ const cowswap = __importStar(require("./cowswap"));
29
30
  const foxy = __importStar(require("./foxy"));
30
31
  const thor = __importStar(require("./thor"));
31
32
  const uniV2 = __importStar(require("./uniV2"));
@@ -48,7 +49,8 @@ class TransactionParser extends parser_1.BaseTransactionParser {
48
49
  new weth.Parser({ chainId: this.chainId, provider: this.provider }),
49
50
  new uniV2.Parser({ chainId: this.chainId, provider: this.provider }),
50
51
  new thor.Parser({ chainId: this.chainId, rpcUrl: args.rpcUrl }),
51
- new zrx.Parser()
52
+ new zrx.Parser(),
53
+ new cowswap.Parser()
52
54
  ]);
53
55
  }
54
56
  }
@@ -1,12 +1,12 @@
1
1
  import { ChainId } from '@shapeshiftoss/caip';
2
2
  import { ethers } from 'ethers';
3
- import { EthereumTx } from '../../../generated/ethereum';
3
+ import { Tx } from '../../../generated/ethereum';
4
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<EthereumTx> {
9
+ export declare class Parser implements SubParser<Tx> {
10
10
  readonly routerContract: string;
11
11
  readonly abiInterface: ethers.utils.Interface;
12
12
  readonly supportedFunctions: {
@@ -14,5 +14,5 @@ export declare class Parser implements SubParser<EthereumTx> {
14
14
  transferOutSigHash: string;
15
15
  };
16
16
  constructor(args: ParserArgs);
17
- parse(tx: EthereumTx): Promise<TxSpecific | undefined>;
17
+ parse(tx: Tx): Promise<TxSpecific | undefined>;
18
18
  }
@@ -1,12 +1,12 @@
1
1
  import { ChainId } from '@shapeshiftoss/caip';
2
2
  import { ethers } from 'ethers';
3
- import { EthereumTx } from '../../../generated/ethereum';
3
+ import { Tx } from '../../../generated/ethereum';
4
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<EthereumTx> {
9
+ export declare class Parser implements SubParser<Tx> {
10
10
  provider: ethers.providers.JsonRpcProvider;
11
11
  readonly chainId: ChainId;
12
12
  readonly wethContract: string;
@@ -21,8 +21,8 @@ export declare class Parser implements SubParser<EthereumTx> {
21
21
  exitSigHash: string;
22
22
  };
23
23
  constructor(args: ParserArgs);
24
- parseUniV2(tx: EthereumTx): Promise<TxSpecific | undefined>;
25
- parseStakingRewards(tx: EthereumTx): Promise<TxSpecific | undefined>;
26
- parse(tx: EthereumTx): Promise<TxSpecific | undefined>;
24
+ parseUniV2(tx: Tx): Promise<TxSpecific | undefined>;
25
+ parseStakingRewards(tx: Tx): Promise<TxSpecific | undefined>;
26
+ parse(tx: Tx): Promise<TxSpecific | undefined>;
27
27
  private static pairFor;
28
28
  }
@@ -1,12 +1,12 @@
1
1
  import { ChainId } from '@shapeshiftoss/caip';
2
2
  import { ethers } from 'ethers';
3
- import { EthereumTx } from '../../../generated/ethereum';
3
+ import { Tx } from '../../../generated/ethereum';
4
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<EthereumTx> {
9
+ export declare class Parser implements SubParser<Tx> {
10
10
  provider: ethers.providers.JsonRpcProvider;
11
11
  readonly chainId: ChainId;
12
12
  readonly wethContract: string;
@@ -16,5 +16,5 @@ export declare class Parser implements SubParser<EthereumTx> {
16
16
  withdrawalSigHash: string;
17
17
  };
18
18
  constructor(args: ParserArgs);
19
- parse(tx: EthereumTx): Promise<TxSpecific | undefined>;
19
+ parse(tx: Tx): Promise<TxSpecific | undefined>;
20
20
  }
@@ -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 '../../../generated/ethereum';
4
+ import { Tx } from '../../../generated/ethereum';
5
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<EthereumTx> {
10
+ export declare class Parser implements SubParser<Tx> {
11
11
  provider: ethers.providers.JsonRpcProvider;
12
12
  yearnSdk: Yearn<YearnChainId> | undefined;
13
13
  yearnTokenVaultAddresses: string[] | undefined;
@@ -24,7 +24,7 @@ export declare class Parser implements SubParser<EthereumTx> {
24
24
  depositSigHash: string;
25
25
  };
26
26
  constructor(args: ParserArgs);
27
- parse(tx: EthereumTx): Promise<TxSpecific | undefined>;
27
+ parse(tx: Tx): Promise<TxSpecific | undefined>;
28
28
  getAbiInterface(txSigHash: string | undefined): ethers.utils.Interface | undefined;
29
29
  }
30
30
  export {};
@@ -1,5 +1,5 @@
1
- import { EthereumTx } from '../../../generated/ethereum';
1
+ import { Tx } from '../../../generated/ethereum';
2
2
  import { SubParser, TxSpecific } from '../../parser';
3
- export declare class Parser implements SubParser<EthereumTx> {
4
- parse(tx: EthereumTx): Promise<TxSpecific | undefined>;
3
+ export declare class Parser implements SubParser<Tx> {
4
+ parse(tx: Tx): Promise<TxSpecific | undefined>;
5
5
  }
@@ -1,2 +1,4 @@
1
+ export type { evm as types } from '@shapeshiftoss/common-api';
2
+ export { BaseTransactionParser } from './parser';
1
3
  export * as ethereum from './ethereum';
2
4
  export * as avalanche from './avalanche';
package/dist/evm/index.js CHANGED
@@ -23,6 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.avalanche = exports.ethereum = void 0;
26
+ exports.avalanche = exports.ethereum = exports.BaseTransactionParser = void 0;
27
+ var parser_1 = require("./parser");
28
+ Object.defineProperty(exports, "BaseTransactionParser", { enumerable: true, get: function () { return parser_1.BaseTransactionParser; } });
27
29
  exports.ethereum = __importStar(require("./ethereum"));
28
30
  exports.avalanche = __importStar(require("./avalanche"));
@@ -76,12 +76,12 @@ class BaseTransactionParser {
76
76
  getStatus(tx) {
77
77
  const status = tx.status;
78
78
  if (status === -1 && tx.confirmations <= 0)
79
- return types_1.Status.Pending;
79
+ return types_1.TxStatus.Pending;
80
80
  if (status === 1 && tx.confirmations > 0)
81
- return types_1.Status.Confirmed;
81
+ return types_1.TxStatus.Confirmed;
82
82
  if (status === 0)
83
- return types_1.Status.Failed;
84
- return types_1.Status.Unknown;
83
+ return types_1.TxStatus.Failed;
84
+ return types_1.TxStatus.Unknown;
85
85
  }
86
86
  getParsedTxWithTransfers(tx, parsedTx, address) {
87
87
  var _a, _b;
@@ -1,7 +1,6 @@
1
- import { AvalancheTx } from '../../generated/avalanche';
2
- import { EthereumTx } from '../../generated/ethereum';
1
+ import type { evm } from '@shapeshiftoss/common-api';
3
2
  import { BaseTxMetadata, StandardTx, StandardTxMetadata } from '../../types';
4
- export declare type Tx = EthereumTx | AvalancheTx;
3
+ export declare type Tx = evm.Tx;
5
4
  export declare enum TxParser {
6
5
  ERC20 = "erc20"
7
6
  }