@xyo-network/uniswap-crypto-market-plugin 2.42.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/LICENSE +165 -0
- package/README.md +81 -0
- package/dist/cjs/Config.d.ts +7 -0
- package/dist/cjs/Config.d.ts.map +1 -0
- package/dist/cjs/Config.js +3 -0
- package/dist/cjs/Config.js.map +1 -0
- package/dist/cjs/Plugin.d.ts +4 -0
- package/dist/cjs/Plugin.d.ts.map +1 -0
- package/dist/cjs/Plugin.js +16 -0
- package/dist/cjs/Plugin.js.map +1 -0
- package/dist/cjs/Witness.d.ts +19 -0
- package/dist/cjs/Witness.d.ts.map +1 -0
- package/dist/cjs/Witness.js +51 -0
- package/dist/cjs/Witness.js.map +1 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/Ethers/UniSwap3Pair.d.ts +29 -0
- package/dist/cjs/lib/Ethers/UniSwap3Pair.d.ts.map +1 -0
- package/dist/cjs/lib/Ethers/UniSwap3Pair.js +103 -0
- package/dist/cjs/lib/Ethers/UniSwap3Pair.js.map +1 -0
- package/dist/cjs/lib/Ethers/Uniswap3PoolSlot0Wrapper.d.ts +13 -0
- package/dist/cjs/lib/Ethers/Uniswap3PoolSlot0Wrapper.d.ts.map +1 -0
- package/dist/cjs/lib/Ethers/Uniswap3PoolSlot0Wrapper.js +31 -0
- package/dist/cjs/lib/Ethers/Uniswap3PoolSlot0Wrapper.js.map +1 -0
- package/dist/cjs/lib/Ethers/UniswapV3Slot0Fields.d.ts +3 -0
- package/dist/cjs/lib/Ethers/UniswapV3Slot0Fields.d.ts.map +1 -0
- package/dist/cjs/lib/Ethers/UniswapV3Slot0Fields.js +3 -0
- package/dist/cjs/lib/Ethers/UniswapV3Slot0Fields.js.map +1 -0
- package/dist/cjs/lib/Ethers/createUniswapPoolContracts.d.ts +4 -0
- package/dist/cjs/lib/Ethers/createUniswapPoolContracts.d.ts.map +1 -0
- package/dist/cjs/lib/Ethers/createUniswapPoolContracts.js +12 -0
- package/dist/cjs/lib/Ethers/createUniswapPoolContracts.js.map +1 -0
- package/dist/cjs/lib/Ethers/index.d.ts +5 -0
- package/dist/cjs/lib/Ethers/index.d.ts.map +1 -0
- package/dist/cjs/lib/Ethers/index.js +8 -0
- package/dist/cjs/lib/Ethers/index.js.map +1 -0
- package/dist/cjs/lib/UniswapPoolContracts.d.ts +2 -0
- package/dist/cjs/lib/UniswapPoolContracts.d.ts.map +1 -0
- package/dist/cjs/lib/UniswapPoolContracts.js +19 -0
- package/dist/cjs/lib/UniswapPoolContracts.js.map +1 -0
- package/dist/cjs/lib/UniswapV3Slot0Fields.d.ts +3 -0
- package/dist/cjs/lib/UniswapV3Slot0Fields.d.ts.map +1 -0
- package/dist/cjs/lib/UniswapV3Slot0Fields.js +3 -0
- package/dist/cjs/lib/UniswapV3Slot0Fields.js.map +1 -0
- package/dist/cjs/lib/index.d.ts +4 -0
- package/dist/cjs/lib/index.d.ts.map +1 -0
- package/dist/cjs/lib/index.js +7 -0
- package/dist/cjs/lib/index.js.map +1 -0
- package/dist/cjs/lib/logErrors.d.ts +3 -0
- package/dist/cjs/lib/logErrors.d.ts.map +1 -0
- package/dist/cjs/lib/logErrors.js +25 -0
- package/dist/cjs/lib/logErrors.js.map +1 -0
- package/dist/cjs/lib/pricesFromUniswap3.d.ts +4 -0
- package/dist/cjs/lib/pricesFromUniswap3.d.ts.map +1 -0
- package/dist/cjs/lib/pricesFromUniswap3.js +16 -0
- package/dist/cjs/lib/pricesFromUniswap3.js.map +1 -0
- package/dist/docs.json +5480 -0
- package/dist/esm/Config.d.ts +7 -0
- package/dist/esm/Config.d.ts.map +1 -0
- package/dist/esm/Config.js +2 -0
- package/dist/esm/Config.js.map +1 -0
- package/dist/esm/Plugin.d.ts +4 -0
- package/dist/esm/Plugin.d.ts.map +1 -0
- package/dist/esm/Plugin.js +11 -0
- package/dist/esm/Plugin.js.map +1 -0
- package/dist/esm/Witness.d.ts +19 -0
- package/dist/esm/Witness.d.ts.map +1 -0
- package/dist/esm/Witness.js +32 -0
- package/dist/esm/Witness.js.map +1 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/Ethers/UniSwap3Pair.d.ts +29 -0
- package/dist/esm/lib/Ethers/UniSwap3Pair.d.ts.map +1 -0
- package/dist/esm/lib/Ethers/UniSwap3Pair.js +91 -0
- package/dist/esm/lib/Ethers/UniSwap3Pair.js.map +1 -0
- package/dist/esm/lib/Ethers/Uniswap3PoolSlot0Wrapper.d.ts +13 -0
- package/dist/esm/lib/Ethers/Uniswap3PoolSlot0Wrapper.d.ts.map +1 -0
- package/dist/esm/lib/Ethers/Uniswap3PoolSlot0Wrapper.js +28 -0
- package/dist/esm/lib/Ethers/Uniswap3PoolSlot0Wrapper.js.map +1 -0
- package/dist/esm/lib/Ethers/UniswapV3Slot0Fields.d.ts +3 -0
- package/dist/esm/lib/Ethers/UniswapV3Slot0Fields.d.ts.map +1 -0
- package/dist/esm/lib/Ethers/UniswapV3Slot0Fields.js +2 -0
- package/dist/esm/lib/Ethers/UniswapV3Slot0Fields.js.map +1 -0
- package/dist/esm/lib/Ethers/createUniswapPoolContracts.d.ts +4 -0
- package/dist/esm/lib/Ethers/createUniswapPoolContracts.d.ts.map +1 -0
- package/dist/esm/lib/Ethers/createUniswapPoolContracts.js +8 -0
- package/dist/esm/lib/Ethers/createUniswapPoolContracts.js.map +1 -0
- package/dist/esm/lib/Ethers/index.d.ts +5 -0
- package/dist/esm/lib/Ethers/index.d.ts.map +1 -0
- package/dist/esm/lib/Ethers/index.js +5 -0
- package/dist/esm/lib/Ethers/index.js.map +1 -0
- package/dist/esm/lib/UniswapPoolContracts.d.ts +2 -0
- package/dist/esm/lib/UniswapPoolContracts.d.ts.map +1 -0
- package/dist/esm/lib/UniswapPoolContracts.js +16 -0
- package/dist/esm/lib/UniswapPoolContracts.js.map +1 -0
- package/dist/esm/lib/UniswapV3Slot0Fields.d.ts +3 -0
- package/dist/esm/lib/UniswapV3Slot0Fields.d.ts.map +1 -0
- package/dist/esm/lib/UniswapV3Slot0Fields.js +2 -0
- package/dist/esm/lib/UniswapV3Slot0Fields.js.map +1 -0
- package/dist/esm/lib/index.d.ts +4 -0
- package/dist/esm/lib/index.d.ts.map +1 -0
- package/dist/esm/lib/index.js +4 -0
- package/dist/esm/lib/index.js.map +1 -0
- package/dist/esm/lib/logErrors.d.ts +3 -0
- package/dist/esm/lib/logErrors.d.ts.map +1 -0
- package/dist/esm/lib/logErrors.js +19 -0
- package/dist/esm/lib/logErrors.js.map +1 -0
- package/dist/esm/lib/pricesFromUniswap3.d.ts +4 -0
- package/dist/esm/lib/pricesFromUniswap3.d.ts.map +1 -0
- package/dist/esm/lib/pricesFromUniswap3.js +11 -0
- package/dist/esm/lib/pricesFromUniswap3.js.map +1 -0
- package/package.json +77 -0
- package/src/Config.ts +7 -0
- package/src/Plugin.spec.ts +11 -0
- package/src/Plugin.ts +16 -0
- package/src/Witness.spec.ts +56 -0
- package/src/Witness.ts +51 -0
- package/src/index.ts +10 -0
- package/src/lib/Ethers/UniSwap3Pair.ts +109 -0
- package/src/lib/Ethers/Uniswap3PoolSlot0Wrapper.ts +36 -0
- package/src/lib/Ethers/UniswapV3Slot0Fields.ts +3 -0
- package/src/lib/Ethers/createUniswapPoolContracts.ts +10 -0
- package/src/lib/Ethers/index.ts +4 -0
- package/src/lib/UniswapPoolContracts.ts +15 -0
- package/src/lib/UniswapV3Slot0Fields.ts +4 -0
- package/src/lib/index.ts +3 -0
- package/src/lib/logErrors.ts +17 -0
- package/src/lib/pricesFromUniswap3.spec.ts +13 -0
- package/src/lib/pricesFromUniswap3.ts +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
[![logo][]](https://xyo.network)
|
|
2
|
+
|
|
3
|
+
# sdk-xyo-client-js
|
|
4
|
+
|
|
5
|
+
[![main-build][]][main-build-link]
|
|
6
|
+
[![beta-build][]][beta-build-link]
|
|
7
|
+
[![npm-badge][]][npm-link]
|
|
8
|
+
[![bch-badge][]][bch-link]
|
|
9
|
+
[![codacy-badge][]][codacy-link]
|
|
10
|
+
[![codeclimate-badge][]][codeclimate-link]
|
|
11
|
+
[![snyk-badge][]][snyk-link]
|
|
12
|
+
|
|
13
|
+
> The XYO Foundation provides this source code available in our efforts to
|
|
14
|
+
> advance the understanding of the XYO Protocol and its possible uses.
|
|
15
|
+
> We continue to maintain this software in the interest of developer education.
|
|
16
|
+
> Usage of this source code is not intended for production.
|
|
17
|
+
|
|
18
|
+
## Table of Contents
|
|
19
|
+
- [Title](#sdk-xyo-client-js)
|
|
20
|
+
- [Table of Contents](#table-of-contents)
|
|
21
|
+
- [Description](#description)
|
|
22
|
+
- [Install](#install)
|
|
23
|
+
- [Maintainers](#maintainers)
|
|
24
|
+
- [License](#license)
|
|
25
|
+
- [Credits](#credits)
|
|
26
|
+
|
|
27
|
+
## Description
|
|
28
|
+
|
|
29
|
+
> Primary SDK for using the XYO Protocol 2.0 from TypeScript/JavaScript.
|
|
30
|
+
> Designed to work in both browser based and Node JS based solutions.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
Using npm:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npm i --save @xyo-network/sdk-xyo-client-js
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Using yarn:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
yarn add @xyo-network/sdk-xyo-client-js
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Maintainers
|
|
47
|
+
|
|
48
|
+
- [Arie Trouw](https://github.com/arietrouw) [(arietrouw.com)](https://arietrouw.com)
|
|
49
|
+
- [Matt Jones](https://github.com/jonesmac)
|
|
50
|
+
- [Joel Carter](https://github.com/JoelBCarter)
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
> See the [LICENSE](LICENSE) file for license details
|
|
55
|
+
|
|
56
|
+
## Credits
|
|
57
|
+
|
|
58
|
+
[Made with 🔥 and ❄️ by XYO](https://xyo.network)
|
|
59
|
+
|
|
60
|
+
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
61
|
+
|
|
62
|
+
[main-build]: https://github.com/XYOracleNetwork/sdk-xyo-client-js/actions/workflows/build-main.yml/badge.svg
|
|
63
|
+
[main-build-link]: https://github.com/XYOracleNetwork/sdk-xyo-client-js/actions/workflows/build-main.yml
|
|
64
|
+
|
|
65
|
+
[beta-build]: https://github.com/XYOracleNetwork/sdk-xyo-client-js/actions/workflows/build-beta.yml/badge.svg
|
|
66
|
+
[beta-build-link]: https://github.com/XYOracleNetwork/sdk-xyo-client-js/actions/workflows/build-beta.yml
|
|
67
|
+
|
|
68
|
+
[npm-badge]: https://img.shields.io/npm/v/@xyo-network/sdk-xyo-client-js.svg
|
|
69
|
+
[npm-link]: https://www.npmjs.com/package/@xyo-network/sdk-xyo-client-js
|
|
70
|
+
|
|
71
|
+
[bch-badge]: https://bettercodehub.com/edge/badge/XYOracleNetwork/sdk-xyo-client-js?branch=main
|
|
72
|
+
[bch-link]: https://bettercodehub.com/results/XYOracleNetwork/sdk-xyo-client-js
|
|
73
|
+
|
|
74
|
+
[codacy-badge]: https://app.codacy.com/project/badge/Grade/ba1f344ae34e4bfe999331cf4e27b9f5
|
|
75
|
+
[codacy-link]: https://www.codacy.com/gh/XYOracleNetwork/sdk-xyo-client-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=XYOracleNetwork/sdk-xyo-client-js&utm_campaign=Badge_Grade
|
|
76
|
+
|
|
77
|
+
[codeclimate-badge]: https://api.codeclimate.com/v1/badges/0e76349c9541f3866948/maintainability
|
|
78
|
+
[codeclimate-link]: https://codeclimate.com/github/XYOracleNetwork/sdk-xyo-client-js/maintainability
|
|
79
|
+
|
|
80
|
+
[snyk-badge]: https://snyk.io/test/github/XYOracleNetwork/sdk-xyo-client-js/badge.svg?targetFile=package.json
|
|
81
|
+
[snyk-link]: https://snyk.io/test/github/XYOracleNetwork/sdk-xyo-client-js?targetFile=package.json
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { XyoUniswapCryptoMarketWitnessConfigSchema } from '@xyo-network/uniswap-crypto-market-payload-plugin';
|
|
2
|
+
import { XyoWitnessConfig } from '@xyo-network/witness';
|
|
3
|
+
export type XyoUniswapCryptoMarketWitnessConfig = XyoWitnessConfig<{
|
|
4
|
+
pools: string[];
|
|
5
|
+
schema: XyoUniswapCryptoMarketWitnessConfigSchema;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=Config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yCAAyC,EAAE,MAAM,mDAAmD,CAAA;AAC7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,MAAM,mCAAmC,GAAG,gBAAgB,CAAC;IACjE,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,MAAM,EAAE,yCAAyC,CAAA;CAClD,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin';
|
|
2
|
+
import { XyoUniswapCryptoMarketWitnessParams } from './Witness';
|
|
3
|
+
export declare const XyoUniswapCryptoMarketPlugin: () => PayloadSetWitnessPlugin<XyoUniswapCryptoMarketWitnessParams>;
|
|
4
|
+
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AAGhG,OAAO,EAAiC,mCAAmC,EAAE,MAAM,WAAW,CAAA;AAE9F,eAAO,MAAM,4BAA4B,oEAStC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XyoUniswapCryptoMarketPlugin = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const payload_1 = require("@xyo-network/payload");
|
|
6
|
+
const payloadset_plugin_1 = require("@xyo-network/payloadset-plugin");
|
|
7
|
+
const uniswap_crypto_market_payload_plugin_1 = require("@xyo-network/uniswap-crypto-market-payload-plugin");
|
|
8
|
+
const Witness_1 = require("./Witness");
|
|
9
|
+
const XyoUniswapCryptoMarketPlugin = () => (0, payloadset_plugin_1.createPayloadSetPlugin)({ required: { [uniswap_crypto_market_payload_plugin_1.XyoUniswapCryptoMarketSchema]: 1 }, schema: payload_1.PayloadSetSchema }, {
|
|
10
|
+
witness: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
const result = yield Witness_1.XyoUniswapCryptoMarketWitness.create(params);
|
|
12
|
+
return result;
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
exports.XyoUniswapCryptoMarketPlugin = XyoUniswapCryptoMarketPlugin;
|
|
16
|
+
//# sourceMappingURL=Plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":";;;;AAAA,kDAAuD;AACvD,sEAAgG;AAChG,4GAAgG;AAEhG,uCAA8F;AAEvF,MAAM,4BAA4B,GAAG,GAAG,EAAE,CAC/C,IAAA,0CAAsB,EACpB,EAAE,QAAQ,EAAE,EAAE,CAAC,mEAA4B,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,0BAAgB,EAAE,EAC7E;IACE,OAAO,EAAE,CAAO,MAAM,EAAE,EAAE;QACxB,MAAM,MAAM,GAAG,MAAM,uCAA6B,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACjE,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;CACF,CACF,CAAA;AATU,QAAA,4BAA4B,gCAStC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Provider } from '@ethersproject/providers';
|
|
2
|
+
import { XyoModuleParams } from '@xyo-network/module';
|
|
3
|
+
import { XyoPayload } from '@xyo-network/payload';
|
|
4
|
+
import { AbstractWitness } from '@xyo-network/witness';
|
|
5
|
+
import { XyoUniswapCryptoMarketWitnessConfig } from './Config';
|
|
6
|
+
import { EthersUniSwap3Pair } from './lib';
|
|
7
|
+
export interface XyoUniswapCryptoMarketWitnessParams extends XyoModuleParams<XyoUniswapCryptoMarketWitnessConfig> {
|
|
8
|
+
provider: Provider;
|
|
9
|
+
}
|
|
10
|
+
export declare class XyoUniswapCryptoMarketWitness extends AbstractWitness<XyoUniswapCryptoMarketWitnessConfig> {
|
|
11
|
+
static configSchema: "network.xyo.crypto.market.uniswap.witness.config";
|
|
12
|
+
protected pairs?: EthersUniSwap3Pair[];
|
|
13
|
+
protected provider?: Provider;
|
|
14
|
+
protected constructor(params: XyoUniswapCryptoMarketWitnessParams);
|
|
15
|
+
static create(params?: XyoUniswapCryptoMarketWitnessParams): Promise<XyoUniswapCryptoMarketWitness>;
|
|
16
|
+
observe(): Promise<XyoPayload[]>;
|
|
17
|
+
start(): Promise<this>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=Witness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAMjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,mCAAmC,EAAE,MAAM,UAAU,CAAA;AAC9D,OAAO,EAA8B,kBAAkB,EAA4C,MAAM,OAAO,CAAA;AAEhH,MAAM,WAAW,mCAAoC,SAAQ,eAAe,CAAC,mCAAmC,CAAC;IAC/G,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,qBAAa,6BAA8B,SAAQ,eAAe,CAAC,mCAAmC,CAAC;IACrG,OAAgB,YAAY,qDAA4C;IAExE,SAAS,CAAC,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAA;IACtC,SAAS,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAC7B,SAAS,aAAa,MAAM,EAAE,mCAAmC;WAK3C,MAAM,CAAC,MAAM,CAAC,EAAE,mCAAmC,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAInG,OAAO,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAchC,KAAK;CAIrB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XyoUniswapCryptoMarketWitness = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const assert_1 = require("@xylabs/assert");
|
|
6
|
+
const uniswap_crypto_market_payload_plugin_1 = require("@xyo-network/uniswap-crypto-market-payload-plugin");
|
|
7
|
+
const witness_1 = require("@xyo-network/witness");
|
|
8
|
+
const lib_1 = require("./lib");
|
|
9
|
+
class XyoUniswapCryptoMarketWitness extends witness_1.AbstractWitness {
|
|
10
|
+
constructor(params) {
|
|
11
|
+
super(params);
|
|
12
|
+
this.provider = params === null || params === void 0 ? void 0 : params.provider;
|
|
13
|
+
}
|
|
14
|
+
static create(params) {
|
|
15
|
+
const _super = Object.create(null, {
|
|
16
|
+
create: { get: () => super.create }
|
|
17
|
+
});
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
return (yield _super.create.call(this, params));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
observe() {
|
|
23
|
+
const _super = Object.create(null, {
|
|
24
|
+
observe: { get: () => super.observe }
|
|
25
|
+
});
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
this.started('throw');
|
|
28
|
+
const pairs = yield (0, lib_1.pricesFromUniswap3)((0, assert_1.assertEx)(this.pairs));
|
|
29
|
+
const timestamp = Date.now();
|
|
30
|
+
const payload = {
|
|
31
|
+
pairs,
|
|
32
|
+
schema: uniswap_crypto_market_payload_plugin_1.XyoUniswapCryptoMarketSchema,
|
|
33
|
+
timestamp,
|
|
34
|
+
};
|
|
35
|
+
return _super.observe.call(this, [payload]);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
start() {
|
|
39
|
+
const _super = Object.create(null, {
|
|
40
|
+
start: { get: () => super.start }
|
|
41
|
+
});
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
this.pairs = (0, lib_1.createUniswapPoolContracts)((0, assert_1.assertEx)(this.provider, 'Provider Required'), (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.pools) !== null && _b !== void 0 ? _b : lib_1.UniswapPoolContracts);
|
|
45
|
+
return yield _super.start.call(this);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.XyoUniswapCryptoMarketWitness = XyoUniswapCryptoMarketWitness;
|
|
50
|
+
XyoUniswapCryptoMarketWitness.configSchema = uniswap_crypto_market_payload_plugin_1.XyoUniswapCryptoMarketWitnessConfigSchema;
|
|
51
|
+
//# sourceMappingURL=Witness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Witness.js","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":";;;;AACA,2CAAyC;AAGzC,4GAI0D;AAC1D,kDAAsD;AAGtD,+BAAgH;AAMhH,MAAa,6BAA8B,SAAQ,y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A4B,EAAE,CAAA;AAGvC,eAAe,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XyoUniswapCryptoMarketPlugin = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Plugin_1 = require("./Plugin");
|
|
6
|
+
Object.defineProperty(exports, "XyoUniswapCryptoMarketPlugin", { enumerable: true, get: function () { return Plugin_1.XyoUniswapCryptoMarketPlugin; } });
|
|
7
|
+
tslib_1.__exportStar(require("./Config"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./Witness"), exports);
|
|
10
|
+
// eslint-disable-next-line import/no-default-export
|
|
11
|
+
exports.default = Plugin_1.XyoUniswapCryptoMarketPlugin;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qCAAuD;AAM9C,6GANA,qCAA4B,OAMA;AAJrC,mDAAwB;AACxB,gDAAqB;AACrB,oDAAyB;AAIzB,oDAAoD;AACpD,kBAAe,qCAA4B,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Provider } from '@ethersproject/providers';
|
|
2
|
+
import { Token } from '@uniswap/sdk-core';
|
|
3
|
+
import { Pool } from '@uniswap/v3-sdk';
|
|
4
|
+
import { IERC20Metadata } from '@xyo-network/typechain';
|
|
5
|
+
import { IUniswapV3Pool } from '@xyo-network/uniswap-typechain';
|
|
6
|
+
import { EthersUniswap3PoolSlot0Wrapper } from './Uniswap3PoolSlot0Wrapper';
|
|
7
|
+
export declare class EthersUniSwap3Pair {
|
|
8
|
+
protected address: string;
|
|
9
|
+
protected provider: Provider;
|
|
10
|
+
private _pool?;
|
|
11
|
+
private _poolContract?;
|
|
12
|
+
private _slot0?;
|
|
13
|
+
private _tokenContracts;
|
|
14
|
+
private _tokens;
|
|
15
|
+
constructor(address: string, provider: Provider);
|
|
16
|
+
pool(): Promise<Pool>;
|
|
17
|
+
poolContract(): IUniswapV3Pool;
|
|
18
|
+
price(): Promise<{
|
|
19
|
+
tokens: {
|
|
20
|
+
address: string;
|
|
21
|
+
symbol: string;
|
|
22
|
+
value: number;
|
|
23
|
+
}[];
|
|
24
|
+
}>;
|
|
25
|
+
slot0(): Promise<EthersUniswap3PoolSlot0Wrapper>;
|
|
26
|
+
token(index: 0 | 1): Promise<Token>;
|
|
27
|
+
tokenContract(index: 0 | 1): Promise<IERC20Metadata>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=UniSwap3Pair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniSwap3Pair.d.ts","sourceRoot":"","sources":["../../../../src/lib/Ethers/UniSwap3Pair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAGtC,OAAO,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAA;AAChF,OAAO,EAAE,cAAc,EAA2B,MAAM,gCAAgC,CAAA;AAGxF,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAA;AAS3E,qBAAa,kBAAkB;IAC7B,SAAS,CAAC,OAAO,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAE5B,OAAO,CAAC,KAAK,CAAC,CAAa;IAC3B,OAAO,CAAC,aAAa,CAAC,CAAgB;IACtC,OAAO,CAAC,MAAM,CAAC,CAAuC;IACtD,OAAO,CAAC,eAAe,CAAgE;IACvF,OAAO,CAAC,OAAO,CAAuD;gBAE1D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAKlC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB3B,YAAY,IAAI,cAAc;IAOxB,KAAK;;;;;;;IAiBL,KAAK,IAAI,OAAO,CAAC,8BAA8B,CAAC;IAShD,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;IAYnC,aAAa,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;CAUlE"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EthersUniSwap3Pair = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const sdk_1 = require("@uniswap/sdk");
|
|
6
|
+
const sdk_core_1 = require("@uniswap/sdk-core");
|
|
7
|
+
const v3_sdk_1 = require("@uniswap/v3-sdk");
|
|
8
|
+
const assert_1 = require("@xylabs/assert");
|
|
9
|
+
const delay_1 = require("@xylabs/delay");
|
|
10
|
+
const typechain_1 = require("@xyo-network/typechain");
|
|
11
|
+
const uniswap_typechain_1 = require("@xyo-network/uniswap-typechain");
|
|
12
|
+
const logErrors_1 = require("../logErrors");
|
|
13
|
+
const Uniswap3PoolSlot0Wrapper_1 = require("./Uniswap3PoolSlot0Wrapper");
|
|
14
|
+
//null is used as 'in-progress'
|
|
15
|
+
const waitNotNull = (closure) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
while (closure() === null) {
|
|
17
|
+
yield (0, delay_1.delay)(10);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
class EthersUniSwap3Pair {
|
|
21
|
+
constructor(address, provider) {
|
|
22
|
+
this._tokenContracts = [undefined, undefined];
|
|
23
|
+
this._tokens = [undefined, undefined];
|
|
24
|
+
this.address = address;
|
|
25
|
+
this.provider = provider;
|
|
26
|
+
}
|
|
27
|
+
pool() {
|
|
28
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return yield (0, logErrors_1.logErrorsAsync)(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
var _a;
|
|
31
|
+
yield waitNotNull(() => this._pool);
|
|
32
|
+
this._pool = this._pool || null;
|
|
33
|
+
const slot0 = yield this.slot0();
|
|
34
|
+
this._pool =
|
|
35
|
+
(_a = this._pool) !== null && _a !== void 0 ? _a : new v3_sdk_1.Pool(yield this.token(0), yield this.token(1), slot0.feeProtocol, slot0.sqrtPriceX96.toHexString(), (yield this.poolContract().liquidity()).toHexString(), slot0.tick);
|
|
36
|
+
return (0, assert_1.assertEx)(this._pool);
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
poolContract() {
|
|
41
|
+
return (0, logErrors_1.logErrors)(() => {
|
|
42
|
+
var _a;
|
|
43
|
+
this._poolContract = (_a = this._poolContract) !== null && _a !== void 0 ? _a : uniswap_typechain_1.IUniswapV3Pool__factory.connect(this.address, this.provider);
|
|
44
|
+
return (0, assert_1.assertEx)(this._poolContract);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
price() {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
return yield (0, logErrors_1.logErrorsAsync)(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const tokenIndexes = [0, 1];
|
|
51
|
+
const pool = yield this.pool();
|
|
52
|
+
const tokens = yield Promise.all(tokenIndexes.map((value) => this.token(value)));
|
|
53
|
+
const tokenContracts = yield Promise.all(tokenIndexes.map((value) => this.tokenContract(value)));
|
|
54
|
+
const tokenPrices = tokens.map((token) => parseFloat(pool.priceOf(token).toSignificant()));
|
|
55
|
+
const tokenSymbols = tokens.map((token, index) => (0, assert_1.assertEx)(token.symbol, `Token[${index}] Missing Symbols`).toLowerCase());
|
|
56
|
+
const result = {
|
|
57
|
+
tokens: tokenIndexes.map((value) => {
|
|
58
|
+
return { address: tokenContracts[value].address, symbol: tokenSymbols[value], value: tokenPrices[value] };
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
return result;
|
|
62
|
+
}));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
slot0() {
|
|
66
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
return yield (0, logErrors_1.logErrorsAsync)(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
var _a;
|
|
69
|
+
yield waitNotNull(() => this._slot0);
|
|
70
|
+
this._slot0 = this._slot0 || null;
|
|
71
|
+
this._slot0 = (_a = this._slot0) !== null && _a !== void 0 ? _a : new Uniswap3PoolSlot0Wrapper_1.EthersUniswap3PoolSlot0Wrapper(yield this.poolContract().slot0());
|
|
72
|
+
return (0, assert_1.assertEx)(this._slot0);
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
token(index) {
|
|
77
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
return yield (0, logErrors_1.logErrorsAsync)(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
var _a;
|
|
80
|
+
yield waitNotNull(() => this._tokens[index]);
|
|
81
|
+
this._tokens[index] = this._tokens[index] || null;
|
|
82
|
+
const tokenContract = yield this.tokenContract(index);
|
|
83
|
+
this._tokens[index] =
|
|
84
|
+
(_a = this._tokens[index]) !== null && _a !== void 0 ? _a : new sdk_core_1.Token(sdk_1.ChainId.MAINNET, tokenContract.address, yield tokenContract.decimals(), yield tokenContract.symbol(), yield tokenContract.name());
|
|
85
|
+
return (0, assert_1.assertEx)(this._tokens[index]);
|
|
86
|
+
}));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
tokenContract(index) {
|
|
90
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
return yield (0, logErrors_1.logErrorsAsync)(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
var _a;
|
|
93
|
+
yield waitNotNull(() => this._tokenContracts[index]);
|
|
94
|
+
this._tokenContracts[index] = this._tokenContracts[index] || null;
|
|
95
|
+
this._tokenContracts[index] =
|
|
96
|
+
(_a = this._tokenContracts[index]) !== null && _a !== void 0 ? _a : typechain_1.IERC20Metadata__factory.connect(yield (index === 0 ? this.poolContract().token0() : this.poolContract().token1()), this.provider);
|
|
97
|
+
return (0, assert_1.assertEx)(this._tokenContracts[index]);
|
|
98
|
+
}));
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.EthersUniSwap3Pair = EthersUniSwap3Pair;
|
|
103
|
+
//# sourceMappingURL=UniSwap3Pair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniSwap3Pair.js","sourceRoot":"","sources":["../../../../src/lib/Ethers/UniSwap3Pair.ts"],"names":[],"mappings":";;;;AACA,sCAAsC;AACtC,gDAAyC;AACzC,4CAAsC;AACtC,2CAAyC;AACzC,yCAAqC;AACrC,sDAAgF;AAChF,sEAAwF;AAExF,4CAAwD;AACxD,yEAA2E;AAE3E,+BAA+B;AAC/B,MAAM,WAAW,GAAG,CAAO,OAAsB,EAAE,EAAE;IACnD,OAAO,OAAO,EAAE,KAAK,IAAI,EAAE;QACzB,MAAM,IAAA,aAAK,EAAC,EAAE,CAAC,CAAA;KAChB;AACH,CAAC,CAAA,CAAA;AAED,MAAa,kBAAkB;IAU7B,YAAY,OAAe,EAAE,QAAkB;QAHvC,oBAAe,GAA0C,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QAC/E,YAAO,GAAiC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QAGpE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAEY,IAAI;;YACf,OAAO,MAAM,IAAA,0BA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AAI,IAAI,CAAA;gBACjE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;oBACzB,MAAA,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,mCAC3B,mCAAuB,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;gBACnI,OAAO,IAAA,iBAAQ,EAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAA;YAC9C,CAAC,CAAA,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AAzFD,gDAyFC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EthersUniswapV3Slot0Fields } from './UniswapV3Slot0Fields';
|
|
2
|
+
export declare class EthersUniswap3PoolSlot0Wrapper {
|
|
3
|
+
protected values: EthersUniswapV3Slot0Fields;
|
|
4
|
+
constructor(values: EthersUniswapV3Slot0Fields);
|
|
5
|
+
get feeProtocol(): number;
|
|
6
|
+
get observationCardinality(): number;
|
|
7
|
+
get observationCardinalityNext(): number;
|
|
8
|
+
get observationIndex(): number;
|
|
9
|
+
get sqrtPriceX96(): import("ethers").BigNumber;
|
|
10
|
+
get tick(): number;
|
|
11
|
+
get unlocked(): boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=Uniswap3PoolSlot0Wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Uniswap3PoolSlot0Wrapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/Ethers/Uniswap3PoolSlot0Wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAEnE,qBAAa,8BAA8B;IACzC,SAAS,CAAC,MAAM,EAAE,0BAA0B,CAAA;gBAChC,MAAM,EAAE,0BAA0B;IAI9C,IAAI,WAAW,WAEd;IAED,IAAI,sBAAsB,WAEzB;IAED,IAAI,0BAA0B,WAE7B;IAED,IAAI,gBAAgB,WAEnB;IAED,IAAI,YAAY,+BAEf;IAED,IAAI,IAAI,WAEP;IAED,IAAI,QAAQ,YAEX;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EthersUniswap3PoolSlot0Wrapper = void 0;
|
|
4
|
+
class EthersUniswap3PoolSlot0Wrapper {
|
|
5
|
+
constructor(values) {
|
|
6
|
+
this.values = values;
|
|
7
|
+
}
|
|
8
|
+
get feeProtocol() {
|
|
9
|
+
return this.values[5];
|
|
10
|
+
}
|
|
11
|
+
get observationCardinality() {
|
|
12
|
+
return this.values[3];
|
|
13
|
+
}
|
|
14
|
+
get observationCardinalityNext() {
|
|
15
|
+
return this.values[4];
|
|
16
|
+
}
|
|
17
|
+
get observationIndex() {
|
|
18
|
+
return this.values[2];
|
|
19
|
+
}
|
|
20
|
+
get sqrtPriceX96() {
|
|
21
|
+
return this.values[0];
|
|
22
|
+
}
|
|
23
|
+
get tick() {
|
|
24
|
+
return this.values[1];
|
|
25
|
+
}
|
|
26
|
+
get unlocked() {
|
|
27
|
+
return this.values[6];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.EthersUniswap3PoolSlot0Wrapper = EthersUniswap3PoolSlot0Wrapper;
|
|
31
|
+
//# sourceMappingURL=Uniswap3PoolSlot0Wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Uniswap3PoolSlot0Wrapper.js","sourceRoot":"","sources":["../../../../src/lib/Ethers/Uniswap3PoolSlot0Wrapper.ts"],"names":[],"mappings":";;;AAEA,MAAa,8BAA8B;IAEzC,YAAY,MAAkC;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;IAED,IAAI,sBAAsB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;IAED,IAAI,0BAA0B;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;CACF;AAjCD,wEAiCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniswapV3Slot0Fields.d.ts","sourceRoot":"","sources":["../../../../src/lib/Ethers/UniswapV3Slot0Fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,MAAM,MAAM,0BAA0B,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniswapV3Slot0Fields.js","sourceRoot":"","sources":["../../../../src/lib/Ethers/UniswapV3Slot0Fields.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Provider } from '@ethersproject/providers';
|
|
2
|
+
import { EthersUniSwap3Pair } from './UniSwap3Pair';
|
|
3
|
+
export declare const createUniswapPoolContracts: (provider: Provider, contracts: string[]) => EthersUniSwap3Pair[];
|
|
4
|
+
//# sourceMappingURL=createUniswapPoolContracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createUniswapPoolContracts.d.ts","sourceRoot":"","sources":["../../../../src/lib/Ethers/createUniswapPoolContracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAGnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEnD,eAAO,MAAM,0BAA0B,aAAc,QAAQ,aAAa,MAAM,EAAE,yBAIjF,CAAA"}
|