@openocean.finance/openocean-sdk 0.1.99 → 0.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/package.json +1 -1
- package/lib/utils/limit-order-sdk/README.md +0 -124
- package/lib/utils/limit-order-sdk/abi/ERC20ABI.json +0 -222
- package/lib/utils/limit-order-sdk/abi/LimitOrderProtocol.json +0 -1506
- package/lib/utils/limit-order-sdk/connector/private-key-provider.connector.d.ts +0 -13
- package/lib/utils/limit-order-sdk/connector/private-key-provider.connector.js +0 -34
- package/lib/utils/limit-order-sdk/connector/private-key-provider.connector.js.map +0 -1
- package/lib/utils/limit-order-sdk/connector/provider.connector.d.ts +0 -8
- package/lib/utils/limit-order-sdk/connector/provider.connector.js +0 -3
- package/lib/utils/limit-order-sdk/connector/provider.connector.js.map +0 -1
- package/lib/utils/limit-order-sdk/connector/web3-provider.connector.d.ts +0 -12
- package/lib/utils/limit-order-sdk/connector/web3-provider.connector.js +0 -37
- package/lib/utils/limit-order-sdk/connector/web3-provider.connector.js.map +0 -1
- package/lib/utils/limit-order-sdk/docs/about.md +0 -51
- package/lib/utils/limit-order-sdk/docs/cancel-all-limit-orders.md +0 -41
- package/lib/utils/limit-order-sdk/docs/cancel-limit-order-rfq.md +0 -68
- package/lib/utils/limit-order-sdk/docs/cancel-limit-order.md +0 -38
- package/lib/utils/limit-order-sdk/docs/create-limit-order-rfq.md +0 -82
- package/lib/utils/limit-order-sdk/docs/create-limit-order.md +0 -110
- package/lib/utils/limit-order-sdk/docs/domain-separator.md +0 -22
- package/lib/utils/limit-order-sdk/docs/fill-limit-order-rfq.md +0 -103
- package/lib/utils/limit-order-sdk/docs/fill-limit-order.md +0 -57
- package/lib/utils/limit-order-sdk/docs/limit-order-rfq-structure.md +0 -24
- package/lib/utils/limit-order-sdk/docs/limit-order-structure.md +0 -14
- package/lib/utils/limit-order-sdk/docs/nonce.md +0 -54
- package/lib/utils/limit-order-sdk/docs/predicate.md +0 -90
- package/lib/utils/limit-order-sdk/docs/quick-start.md +0 -78
- package/lib/utils/limit-order-sdk/docs/remaining.md +0 -51
- package/lib/utils/limit-order-sdk/docs/validate-limit-order.md +0 -38
- package/lib/utils/limit-order-sdk/erc20.facade.d.ts +0 -10
- package/lib/utils/limit-order-sdk/erc20.facade.js +0 -19
- package/lib/utils/limit-order-sdk/erc20.facade.js.map +0 -1
- package/lib/utils/limit-order-sdk/index.d.ts +0 -11
- package/lib/utils/limit-order-sdk/index.js +0 -15
- package/lib/utils/limit-order-sdk/index.js.map +0 -1
- package/lib/utils/limit-order-sdk/limit-order-predicate.builder.d.ts +0 -13
- package/lib/utils/limit-order-sdk/limit-order-predicate.builder.js +0 -51
- package/lib/utils/limit-order-sdk/limit-order-predicate.builder.js.map +0 -1
- package/lib/utils/limit-order-sdk/limit-order-protocol.const.d.ts +0 -20
- package/lib/utils/limit-order-sdk/limit-order-protocol.const.js +0 -46
- package/lib/utils/limit-order-sdk/limit-order-protocol.const.js.map +0 -1
- package/lib/utils/limit-order-sdk/limit-order-protocol.facade.d.ts +0 -35
- package/lib/utils/limit-order-sdk/limit-order-protocol.facade.js +0 -177
- package/lib/utils/limit-order-sdk/limit-order-protocol.facade.js.map +0 -1
- package/lib/utils/limit-order-sdk/limit-order.builder.d.ts +0 -20
- package/lib/utils/limit-order-sdk/limit-order.builder.js +0 -113
- package/lib/utils/limit-order-sdk/limit-order.builder.js.map +0 -1
- package/lib/utils/limit-order-sdk/model/abi.model.d.ts +0 -21
- package/lib/utils/limit-order-sdk/model/abi.model.js +0 -3
- package/lib/utils/limit-order-sdk/model/abi.model.js.map +0 -1
- package/lib/utils/limit-order-sdk/model/eip712.model.d.ts +0 -25
- package/lib/utils/limit-order-sdk/model/eip712.model.js +0 -3
- package/lib/utils/limit-order-sdk/model/eip712.model.js.map +0 -1
- package/lib/utils/limit-order-sdk/model/limit-order-protocol.model.d.ts +0 -87
- package/lib/utils/limit-order-sdk/model/limit-order-protocol.model.js +0 -39
- package/lib/utils/limit-order-sdk/model/limit-order-protocol.model.js.map +0 -1
- package/lib/utils/limit-order-sdk/package.json +0 -80
- package/lib/utils/limit-order-sdk/utils/get-rpc-code.d.ts +0 -1
- package/lib/utils/limit-order-sdk/utils/get-rpc-code.js +0 -29
- package/lib/utils/limit-order-sdk/utils/get-rpc-code.js.map +0 -1
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.const.d.ts +0 -15
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.const.js +0 -134
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.const.js.map +0 -1
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.helpers.d.ts +0 -13
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.helpers.js +0 -154
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.helpers.js.map +0 -1
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.model.d.ts +0 -29
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.model.js +0 -3
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.model.js.map +0 -1
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.utils.d.ts +0 -2
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.utils.js +0 -39
- package/lib/utils/limit-order-sdk/utils/limit-order-rfq.utils.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="https://app.1inch.io/assets/images/logo.svg" width="200" alt="1inch network" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
# Utils library for 1inch Limit Orders Protocol V2
|
|
6
|
-
|
|
7
|
-
This is the package of utilities for working with the `1inch Limit Orders Protocol`
|
|
8
|
-
|
|
9
|
-
You can find general overview and docs on 1inch limit orders protocol [here](https://docs.1inch.io/limit-order-protocol/).
|
|
10
|
-
|
|
11
|
-
#### Smart contract addresses
|
|
12
|
-
|
|
13
|
-
- Ethereum mainnet: `0x119c71d3bbac22029622cbaec24854d3d32d2828`
|
|
14
|
-
- BSC mainnet: `0x1e38eff998df9d3669e32f4ff400031385bf6362`
|
|
15
|
-
- Polygon mainnet: `0x94bc2a1c732bcad7343b25af48385fe76e08734f`
|
|
16
|
-
- Optimism mainnet: `0x11431a89893025d2a48dca4eddc396f8c8117187`
|
|
17
|
-
- Arbitrum mainnet: `0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9`
|
|
18
|
-
- Smart contracts source code repository is available [here](https://github.com/1inch/limit-order-protocol)
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Test coverage
|
|
23
|
-
|
|
24
|
-
| Statements | Branches | Functions | Lines |
|
|
25
|
-
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
26
|
-
|  |  |  |  |
|
|
27
|
-
|
|
28
|
-
## Installation
|
|
29
|
-
|
|
30
|
-
### Node
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
npm install @1inch/limit-order-protocol
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Yarn
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
yarn add @1inch/limit-order-protocol
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Contributing
|
|
45
|
-
|
|
46
|
-
See [CONTRIBUTING.md](https://github.com/1inch/limit-order-protocol-utils/blob/master/CONTRIBUTING.md)
|
|
47
|
-
|
|
48
|
-
## Changelog
|
|
49
|
-
|
|
50
|
-
See [CHANGELOG.md](https://github.com/1inch/limit-order-protocol-utils/blob/master/CHANGELOG.md)
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## About
|
|
55
|
-
|
|
56
|
-
Contract allows users to place limit orders, that later could be filled on-chain. Limit order itself is a data structure created off-chain and signed according to EIP-712.
|
|
57
|
-
|
|
58
|
-
Most probably you would need use following classes:
|
|
59
|
-
|
|
60
|
-
[LimitOrderBuilder](https://github.com/1inch/limit-order-protocol-utils/blob/master/src/limit-order.builder.ts) - to create a limit order
|
|
61
|
-
[LimitOrderPredicateBuilder](https://github.com/1inch/limit-order-protocol-utils/blob/master/src/limit-order-predicate.builder.ts) - to create a predicate for limit order
|
|
62
|
-
[LimitOrderProtocolFacade](https://github.com/1inch/limit-order-protocol-utils/blob/master/src/limit-order-protocol.facade.ts) - to interact with the protocol on the blockchain
|
|
63
|
-
|
|
64
|
-
Key features of the protocol is extreme flexibility and high gas efficiency that achieved by using following order types.
|
|
65
|
-
|
|
66
|
-
## I. Limit order
|
|
67
|
-
|
|
68
|
-
A limit order is a financial instrument with which you can put up an ERC-20 token for sale at a fixed price.
|
|
69
|
-
For example, you can put up for sale 2 WBTC tokens at the price of 82415 DAI tokens.
|
|
70
|
-
|
|
71
|
-
1inch limit orders protocol has many tools for flexible trade management:
|
|
72
|
-
|
|
73
|
-
- Partial fill
|
|
74
|
-
- Predicates
|
|
75
|
-
- Single cancellation
|
|
76
|
-
- Bunch cancellation
|
|
77
|
-
- Fullness check
|
|
78
|
-
- Validation
|
|
79
|
-
|
|
80
|
-
> **Note:** You can create a limit order even if your balance is insufficient to execute the limit order right now. However you must have an allowance for the maker asset.
|
|
81
|
-
|
|
82
|
-
For market making, there are **RFQ orders** that have special optimization that does not require a large amount of gas for execution.
|
|
83
|
-
|
|
84
|
-
### Limit orders in the 1inch aggregation protocol
|
|
85
|
-
|
|
86
|
-
[**1inch aggregation protocol**](https://1inch.io/aggregation-protocol/) - the protocol sources liquidity from various exchanges and is capable of splitting a single trade transaction across multiple DEXes to ensure the best rates.
|
|
87
|
-
You can send your limit orders to the 1inch database and then your order will participate in the 1inch aggregation protocol.
|
|
88
|
-
|
|
89
|
-
### REST API (swagger):
|
|
90
|
-
|
|
91
|
-
- [Ethereum Endpoint](https://limit-orders.1inch.io/swagger/ethereum/)
|
|
92
|
-
- [Binance Smart Chain Endpoint](https://limit-orders.1inch.io/swagger/binance/)
|
|
93
|
-
- [Polygon Endpoint](https://limit-orders.1inch.io/swagger/polygon/)
|
|
94
|
-
- [Optimism Endpoint](https://limit-orders.1inch.io/swagger/optimism/)
|
|
95
|
-
- [Arbitrum Endpoint](https://limit-orders.1inch.io/swagger/arbitrum/)
|
|
96
|
-
|
|
97
|
-
### Docs
|
|
98
|
-
|
|
99
|
-
1. [Quick start](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/quick-start.md)
|
|
100
|
-
2. [Create a limit order](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/create-limit-order.md)
|
|
101
|
-
3. [Limit order structure](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/limit-order-structure.md)
|
|
102
|
-
4. [Limit order remaining](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/remaining.md)
|
|
103
|
-
5. [Nonce](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/nonce.md)
|
|
104
|
-
6. [Validate a limit order](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/validate-limit-order.md)
|
|
105
|
-
7. [Predicate](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/predicate.md)
|
|
106
|
-
8. [Fill a limit order](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/fill-limit-order.md)
|
|
107
|
-
9. [Cancel a limit order](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/cancel-limit-order.md)
|
|
108
|
-
10. [Cancel all limit orders](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/cancel-all-limit-orders.md)
|
|
109
|
-
11. [Domain separator](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/domain-separator.md)
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## II. RFQ order
|
|
114
|
-
|
|
115
|
-
**A request for quotation (RFQ)** is a business process in which a customer requests a quote from a supplier (market maker) for the purchase of some tokens.
|
|
116
|
-
|
|
117
|
-
> Technically, RFQ orders are a stripped-down version of standard orders, which contains less data and tools to manage, which in turn allows to spend significantly less gas for their execution.
|
|
118
|
-
|
|
119
|
-
### Docs:
|
|
120
|
-
|
|
121
|
-
1. [Creating an RFQ order](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/create-limit-order-rfq.md)
|
|
122
|
-
2. [RFQ order structure](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/limit-order-rfq-structure.md)
|
|
123
|
-
3. [Canceling an RFQ order](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/cancel-limit-order-rfq.md)
|
|
124
|
-
4. [Filling an RFQ order](https://github.com/1inch/limit-order-protocol-utils/blob/master/docs/fill-limit-order-rfq.md)
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"constant": true,
|
|
4
|
-
"inputs": [],
|
|
5
|
-
"name": "name",
|
|
6
|
-
"outputs": [
|
|
7
|
-
{
|
|
8
|
-
"name": "",
|
|
9
|
-
"type": "string"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"payable": false,
|
|
13
|
-
"stateMutability": "view",
|
|
14
|
-
"type": "function"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"constant": false,
|
|
18
|
-
"inputs": [
|
|
19
|
-
{
|
|
20
|
-
"name": "_spender",
|
|
21
|
-
"type": "address"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"name": "_value",
|
|
25
|
-
"type": "uint256"
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"name": "approve",
|
|
29
|
-
"outputs": [
|
|
30
|
-
{
|
|
31
|
-
"name": "",
|
|
32
|
-
"type": "bool"
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
"payable": false,
|
|
36
|
-
"stateMutability": "nonpayable",
|
|
37
|
-
"type": "function"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"constant": true,
|
|
41
|
-
"inputs": [],
|
|
42
|
-
"name": "totalSupply",
|
|
43
|
-
"outputs": [
|
|
44
|
-
{
|
|
45
|
-
"name": "",
|
|
46
|
-
"type": "uint256"
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
"payable": false,
|
|
50
|
-
"stateMutability": "view",
|
|
51
|
-
"type": "function"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"constant": false,
|
|
55
|
-
"inputs": [
|
|
56
|
-
{
|
|
57
|
-
"name": "_from",
|
|
58
|
-
"type": "address"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"name": "_to",
|
|
62
|
-
"type": "address"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"name": "_value",
|
|
66
|
-
"type": "uint256"
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
"name": "transferFrom",
|
|
70
|
-
"outputs": [
|
|
71
|
-
{
|
|
72
|
-
"name": "",
|
|
73
|
-
"type": "bool"
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
"payable": false,
|
|
77
|
-
"stateMutability": "nonpayable",
|
|
78
|
-
"type": "function"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"constant": true,
|
|
82
|
-
"inputs": [],
|
|
83
|
-
"name": "decimals",
|
|
84
|
-
"outputs": [
|
|
85
|
-
{
|
|
86
|
-
"name": "",
|
|
87
|
-
"type": "uint8"
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
"payable": false,
|
|
91
|
-
"stateMutability": "view",
|
|
92
|
-
"type": "function"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"constant": true,
|
|
96
|
-
"inputs": [
|
|
97
|
-
{
|
|
98
|
-
"name": "_owner",
|
|
99
|
-
"type": "address"
|
|
100
|
-
}
|
|
101
|
-
],
|
|
102
|
-
"name": "balanceOf",
|
|
103
|
-
"outputs": [
|
|
104
|
-
{
|
|
105
|
-
"name": "balance",
|
|
106
|
-
"type": "uint256"
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
"payable": false,
|
|
110
|
-
"stateMutability": "view",
|
|
111
|
-
"type": "function"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"constant": true,
|
|
115
|
-
"inputs": [],
|
|
116
|
-
"name": "symbol",
|
|
117
|
-
"outputs": [
|
|
118
|
-
{
|
|
119
|
-
"name": "",
|
|
120
|
-
"type": "string"
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
"payable": false,
|
|
124
|
-
"stateMutability": "view",
|
|
125
|
-
"type": "function"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"constant": false,
|
|
129
|
-
"inputs": [
|
|
130
|
-
{
|
|
131
|
-
"name": "_to",
|
|
132
|
-
"type": "address"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"name": "_value",
|
|
136
|
-
"type": "uint256"
|
|
137
|
-
}
|
|
138
|
-
],
|
|
139
|
-
"name": "transfer",
|
|
140
|
-
"outputs": [
|
|
141
|
-
{
|
|
142
|
-
"name": "",
|
|
143
|
-
"type": "bool"
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
"payable": false,
|
|
147
|
-
"stateMutability": "nonpayable",
|
|
148
|
-
"type": "function"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"constant": true,
|
|
152
|
-
"inputs": [
|
|
153
|
-
{
|
|
154
|
-
"name": "_owner",
|
|
155
|
-
"type": "address"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"name": "_spender",
|
|
159
|
-
"type": "address"
|
|
160
|
-
}
|
|
161
|
-
],
|
|
162
|
-
"name": "allowance",
|
|
163
|
-
"outputs": [
|
|
164
|
-
{
|
|
165
|
-
"name": "",
|
|
166
|
-
"type": "uint256"
|
|
167
|
-
}
|
|
168
|
-
],
|
|
169
|
-
"payable": false,
|
|
170
|
-
"stateMutability": "view",
|
|
171
|
-
"type": "function"
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
"payable": true,
|
|
175
|
-
"stateMutability": "payable",
|
|
176
|
-
"type": "fallback"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"anonymous": false,
|
|
180
|
-
"inputs": [
|
|
181
|
-
{
|
|
182
|
-
"indexed": true,
|
|
183
|
-
"name": "owner",
|
|
184
|
-
"type": "address"
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"indexed": true,
|
|
188
|
-
"name": "spender",
|
|
189
|
-
"type": "address"
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
"indexed": false,
|
|
193
|
-
"name": "value",
|
|
194
|
-
"type": "uint256"
|
|
195
|
-
}
|
|
196
|
-
],
|
|
197
|
-
"name": "Approval",
|
|
198
|
-
"type": "event"
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
"anonymous": false,
|
|
202
|
-
"inputs": [
|
|
203
|
-
{
|
|
204
|
-
"indexed": true,
|
|
205
|
-
"name": "from",
|
|
206
|
-
"type": "address"
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
"indexed": true,
|
|
210
|
-
"name": "to",
|
|
211
|
-
"type": "address"
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
"indexed": false,
|
|
215
|
-
"name": "value",
|
|
216
|
-
"type": "uint256"
|
|
217
|
-
}
|
|
218
|
-
],
|
|
219
|
-
"name": "Transfer",
|
|
220
|
-
"type": "event"
|
|
221
|
-
}
|
|
222
|
-
]
|