@lifi/types 1.1.1 → 1.2.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/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
+ ## [1.2.0](https://github.com/lifinance/types/compare/v1.1.1...v1.2.0) (2022-07-21)
6
+
7
+
8
+ ### Features
9
+
10
+ * add custom step and contract call endpoints ([#85](https://github.com/lifinance/types/issues/85)) ([bd49fae](https://github.com/lifinance/types/commit/bd49faefc924d7a06818ab6cb3589db633c58e9c))
11
+
5
12
  ### [1.1.1](https://github.com/lifinance/types/compare/v1.1.0...v1.1.1) (2022-07-21)
6
13
 
7
14
 
package/dist/api.d.ts CHANGED
@@ -69,7 +69,7 @@ export interface GetTokenRequest {
69
69
  chain: number | string;
70
70
  token: string;
71
71
  }
72
- interface ToolConfiguration {
72
+ export interface ToolConfiguration {
73
73
  allowBridges?: string[];
74
74
  denyBridges?: string[];
75
75
  preferBridges?: string[];
@@ -90,6 +90,43 @@ export interface QuoteRequest extends ToolConfiguration {
90
90
  integrator?: string;
91
91
  referrer?: string;
92
92
  }
93
+ export interface ContractCallQuoteRequest extends ToolConfiguration {
94
+ fromChain: number | string;
95
+ fromToken: string;
96
+ fromAddress: string;
97
+ toChain: number | string;
98
+ toToken: string;
99
+ toAmount: string;
100
+ toContractAddress: string;
101
+ toContractCallData: string;
102
+ toContractGasLimit: string;
103
+ toApprovalAddress?: string;
104
+ toFallbackAddress?: string;
105
+ contractOutputsToken?: string;
106
+ slippage?: number | string;
107
+ integrator?: string;
108
+ referrer?: string;
109
+ }
110
+ export interface ContractCallQuotesRequest extends ToolConfiguration {
111
+ fromChain: number | string;
112
+ fromToken: string;
113
+ fromAddress: string;
114
+ toChain: number | string;
115
+ toFallbackAddress?: string;
116
+ toContractCalls: {
117
+ sendingAmount: string;
118
+ sendingToken: string;
119
+ receivingToken: string;
120
+ contractAddress: string;
121
+ approvalAddress?: string;
122
+ callData: string;
123
+ gasLimit: string;
124
+ }[];
125
+ order?: Order;
126
+ slippage?: number | string;
127
+ integrator?: string;
128
+ referrer?: string;
129
+ }
93
130
  export interface ConnectionsRequest extends ToolConfiguration {
94
131
  fromChain?: number | string;
95
132
  fromToken?: string;
@@ -168,6 +205,8 @@ export declare class LifiAPI {
168
205
  getToken(request: GetTokenRequest): Promise<Token>;
169
206
  getTokens(request: TokensRequest): Promise<TokensResponse>;
170
207
  getQuote(request: QuoteRequest): Promise<Step>;
208
+ getContractCallQuote(request: ContractCallQuoteRequest): Promise<Step>;
209
+ getContractCallQuotes(request: ContractCallQuotesRequest): Promise<Step>;
171
210
  getStatus(request: GetStatusRequest): Promise<StatusResponse>;
172
211
  getTools(request: ToolsRequest): Promise<ToolsResponse>;
173
212
  getChains(): ChainsResponse;
package/dist/step.d.ts CHANGED
@@ -67,7 +67,7 @@ export interface Execution {
67
67
  toToken?: Token;
68
68
  }
69
69
  export declare const emptyExecution: Execution;
70
- export declare type StepType = 'swap' | 'cross' | 'lifi';
70
+ export declare type StepType = 'swap' | 'cross' | 'lifi' | 'custom';
71
71
  export declare type StepTool = string;
72
72
  export interface StepBase {
73
73
  id: string;
@@ -100,4 +100,16 @@ export interface LifiStep extends StepBase {
100
100
  includedSteps: Step[];
101
101
  }
102
102
  export declare function isLifiStep(step: Step): step is LifiStep;
103
- export declare type Step = SwapStep | CrossStep | LifiStep;
103
+ export interface CustomStep extends StepBase {
104
+ type: 'custom';
105
+ action: Action;
106
+ estimate: Estimate;
107
+ destinationCallInfo: {
108
+ toContractAddress: string;
109
+ toContractCallData: string;
110
+ toFallbackAddress: string;
111
+ callDataGasLimit: string;
112
+ };
113
+ }
114
+ export declare function isCustomStep(step: Step): step is CustomStep;
115
+ export declare type Step = SwapStep | CrossStep | LifiStep | CustomStep;
package/dist/step.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isLifiStep = exports.isCrossStep = exports.isSwapStep = exports.emptyExecution = void 0;
3
+ exports.isCustomStep = exports.isLifiStep = exports.isCrossStep = exports.isSwapStep = exports.emptyExecution = void 0;
4
4
  exports.emptyExecution = {
5
5
  status: 'NOT_STARTED',
6
6
  process: [],
@@ -17,3 +17,7 @@ function isLifiStep(step) {
17
17
  return step.type === 'lifi';
18
18
  }
19
19
  exports.isLifiStep = isLifiStep;
20
+ function isCustomStep(step) {
21
+ return step.type === 'custom';
22
+ }
23
+ exports.isCustomStep = isCustomStep;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/types",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Types for the LI.FI stack",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",