@lifi/types 3.2.0 → 3.2.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [3.2.1](https://github.com/lifinance/types/compare/v3.2.0...v3.2.1) (2023-04-11)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * step types cleanup ([#155](https://github.com/lifinance/types/issues/155)) ([8d3caed](https://github.com/lifinance/types/commit/8d3caedc417bdcc3e4fedba575f1438092be8f23))
11
+
5
12
  ## [3.2.0](https://github.com/lifinance/types/compare/v3.1.1...v3.2.0) (2023-04-05)
6
13
 
7
14
 
@@ -75,7 +75,8 @@ export interface Execution {
75
75
  gasAmountUSD?: string;
76
76
  }
77
77
  export declare const emptyExecution: Execution;
78
- export type StepType = 'swap' | 'cross' | 'lifi' | 'custom' | 'protocol';
78
+ export declare const _StepType: readonly ["lifi", "swap", "cross", "protocol", "custom"];
79
+ export type StepType = (typeof _StepType)[number];
79
80
  export type StepTool = string;
80
81
  export interface StepBase {
81
82
  id: string;
@@ -89,12 +90,18 @@ export interface StepBase {
89
90
  execution?: Execution;
90
91
  transactionRequest?: providers.TransactionRequest;
91
92
  }
93
+ export interface DestinationCallInfo {
94
+ toContractAddress: string;
95
+ toContractCallData: string;
96
+ toFallbackAddress: string;
97
+ callDataGasLimit: string;
98
+ }
99
+ export type CallAction = Action & DestinationCallInfo;
92
100
  export interface SwapStep extends StepBase {
93
101
  type: 'swap';
94
102
  action: Action;
95
103
  estimate: Estimate;
96
104
  }
97
- export declare function isSwapStep(step: Step): step is SwapStep;
98
105
  export interface CrossStep extends StepBase {
99
106
  type: 'cross';
100
107
  action: Action;
@@ -105,24 +112,17 @@ export interface ProtocolStep extends StepBase {
105
112
  action: Action;
106
113
  estimate: Estimate;
107
114
  }
108
- export declare function isCrossStep(step: Step): step is CrossStep;
109
- export interface DestinationCallInfo {
110
- toContractAddress: string;
111
- toContractCallData: string;
112
- toFallbackAddress: string;
113
- callDataGasLimit: string;
114
- }
115
- export type CallAction = Action & DestinationCallInfo;
116
115
  export interface CustomStep extends StepBase {
117
116
  type: 'custom';
118
117
  action: CallAction;
119
118
  estimate: Estimate;
120
119
  }
121
- export declare function isCustomStep(step: Step): step is CustomStep;
122
- export declare function isProtocolStep(step: Step): step is ProtocolStep;
123
120
  export type Step = SwapStep | CrossStep | CustomStep | ProtocolStep;
124
- export type LifiStep = Omit<Step, 'type'> & {
125
- includedSteps: Step[];
126
- } & {
121
+ export interface LifiStep extends Omit<Step, 'type'> {
127
122
  type: 'lifi';
128
- };
123
+ includedSteps: Step[];
124
+ }
125
+ export declare function isSwapStep(step: Step): step is SwapStep;
126
+ export declare function isCrossStep(step: Step): step is CrossStep;
127
+ export declare function isProtocolStep(step: Step): step is ProtocolStep;
128
+ export declare function isCustomStep(step: Step): step is CustomStep;
package/dist/cjs/step.js CHANGED
@@ -1,10 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isProtocolStep = exports.isCustomStep = exports.isCrossStep = exports.isSwapStep = exports.emptyExecution = void 0;
3
+ exports.isCustomStep = exports.isProtocolStep = exports.isCrossStep = exports.isSwapStep = exports._StepType = exports.emptyExecution = void 0;
4
4
  exports.emptyExecution = {
5
5
  status: 'NOT_STARTED',
6
6
  process: [],
7
7
  };
8
+ // STEP
9
+ exports._StepType = [
10
+ 'lifi',
11
+ 'swap',
12
+ 'cross',
13
+ 'protocol',
14
+ 'custom',
15
+ ];
8
16
  function isSwapStep(step) {
9
17
  return step.type === 'swap';
10
18
  }
@@ -13,11 +21,11 @@ function isCrossStep(step) {
13
21
  return step.type === 'cross';
14
22
  }
15
23
  exports.isCrossStep = isCrossStep;
16
- function isCustomStep(step) {
17
- return step.type === 'custom';
18
- }
19
- exports.isCustomStep = isCustomStep;
20
24
  function isProtocolStep(step) {
21
25
  return step.type === 'protocol';
22
26
  }
23
27
  exports.isProtocolStep = isProtocolStep;
28
+ function isCustomStep(step) {
29
+ return step.type === 'custom';
30
+ }
31
+ exports.isCustomStep = isCustomStep;
package/dist/step.d.ts CHANGED
@@ -75,7 +75,8 @@ export interface Execution {
75
75
  gasAmountUSD?: string;
76
76
  }
77
77
  export declare const emptyExecution: Execution;
78
- export type StepType = 'swap' | 'cross' | 'lifi' | 'custom' | 'protocol';
78
+ export declare const _StepType: readonly ["lifi", "swap", "cross", "protocol", "custom"];
79
+ export type StepType = (typeof _StepType)[number];
79
80
  export type StepTool = string;
80
81
  export interface StepBase {
81
82
  id: string;
@@ -89,12 +90,18 @@ export interface StepBase {
89
90
  execution?: Execution;
90
91
  transactionRequest?: providers.TransactionRequest;
91
92
  }
93
+ export interface DestinationCallInfo {
94
+ toContractAddress: string;
95
+ toContractCallData: string;
96
+ toFallbackAddress: string;
97
+ callDataGasLimit: string;
98
+ }
99
+ export type CallAction = Action & DestinationCallInfo;
92
100
  export interface SwapStep extends StepBase {
93
101
  type: 'swap';
94
102
  action: Action;
95
103
  estimate: Estimate;
96
104
  }
97
- export declare function isSwapStep(step: Step): step is SwapStep;
98
105
  export interface CrossStep extends StepBase {
99
106
  type: 'cross';
100
107
  action: Action;
@@ -105,24 +112,17 @@ export interface ProtocolStep extends StepBase {
105
112
  action: Action;
106
113
  estimate: Estimate;
107
114
  }
108
- export declare function isCrossStep(step: Step): step is CrossStep;
109
- export interface DestinationCallInfo {
110
- toContractAddress: string;
111
- toContractCallData: string;
112
- toFallbackAddress: string;
113
- callDataGasLimit: string;
114
- }
115
- export type CallAction = Action & DestinationCallInfo;
116
115
  export interface CustomStep extends StepBase {
117
116
  type: 'custom';
118
117
  action: CallAction;
119
118
  estimate: Estimate;
120
119
  }
121
- export declare function isCustomStep(step: Step): step is CustomStep;
122
- export declare function isProtocolStep(step: Step): step is ProtocolStep;
123
120
  export type Step = SwapStep | CrossStep | CustomStep | ProtocolStep;
124
- export type LifiStep = Omit<Step, 'type'> & {
125
- includedSteps: Step[];
126
- } & {
121
+ export interface LifiStep extends Omit<Step, 'type'> {
127
122
  type: 'lifi';
128
- };
123
+ includedSteps: Step[];
124
+ }
125
+ export declare function isSwapStep(step: Step): step is SwapStep;
126
+ export declare function isCrossStep(step: Step): step is CrossStep;
127
+ export declare function isProtocolStep(step: Step): step is ProtocolStep;
128
+ export declare function isCustomStep(step: Step): step is CustomStep;
package/dist/step.js CHANGED
@@ -2,15 +2,23 @@ export const emptyExecution = {
2
2
  status: 'NOT_STARTED',
3
3
  process: [],
4
4
  };
5
+ // STEP
6
+ export const _StepType = [
7
+ 'lifi',
8
+ 'swap',
9
+ 'cross',
10
+ 'protocol',
11
+ 'custom',
12
+ ];
5
13
  export function isSwapStep(step) {
6
14
  return step.type === 'swap';
7
15
  }
8
16
  export function isCrossStep(step) {
9
17
  return step.type === 'cross';
10
18
  }
11
- export function isCustomStep(step) {
12
- return step.type === 'custom';
13
- }
14
19
  export function isProtocolStep(step) {
15
20
  return step.type === 'protocol';
16
21
  }
22
+ export function isCustomStep(step) {
23
+ return step.type === 'custom';
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/types",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "Types for the LI.FI stack",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/index.js",
@@ -73,23 +73,23 @@
73
73
  "ethers": "^5.7.2"
74
74
  },
75
75
  "devDependencies": {
76
- "@commitlint/cli": "^17.4.4",
76
+ "@commitlint/cli": "^17.5.1",
77
77
  "@commitlint/config-conventional": "^17.4.4",
78
78
  "@types/jest": "^29.5.0",
79
- "@typescript-eslint/eslint-plugin": "^5.55.0",
80
- "@typescript-eslint/parser": "^5.55.0",
81
- "eslint": "^8.36.0",
82
- "eslint-config-prettier": "^8.7.0",
79
+ "@typescript-eslint/eslint-plugin": "^5.58.0",
80
+ "@typescript-eslint/parser": "^5.58.0",
81
+ "eslint": "^8.38.0",
82
+ "eslint-config-prettier": "^8.8.0",
83
83
  "eslint-plugin-prettier": "^4.2.1",
84
84
  "husky": "^8.0.3",
85
85
  "jest": "^29.5.0",
86
- "lint-staged": "^13.2.0",
86
+ "lint-staged": "^13.2.1",
87
87
  "npm-run-all": "^4.1.5",
88
88
  "pinst": "^3.0.0",
89
- "prettier": "^2.8.4",
89
+ "prettier": "^2.8.7",
90
90
  "standard-version": "^9.5.0",
91
- "ts-jest": "^29.0.5",
92
- "typescript": "^5.0.2"
91
+ "ts-jest": "^29.1.0",
92
+ "typescript": "^5.0.4"
93
93
  },
94
94
  "directories": {
95
95
  "test": "test"