@clober/v2-sdk 0.0.4 → 0.0.5-0.a.dev

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 (232) hide show
  1. package/README.md +12 -4
  2. package/dist/cjs/abis/core/book-manager-abi.js +112 -0
  3. package/dist/cjs/abis/core/book-manager-abi.js.map +1 -0
  4. package/dist/cjs/abis/core/book-viewer-abi.js +321 -0
  5. package/dist/cjs/abis/core/book-viewer-abi.js.map +1 -0
  6. package/dist/cjs/abis/core/controller-abi.js +29 -24
  7. package/dist/cjs/abis/core/controller-abi.js.map +1 -1
  8. package/dist/cjs/apis/chart-logs.js +154 -0
  9. package/dist/cjs/apis/chart-logs.js.map +1 -0
  10. package/dist/cjs/apis/market.js +61 -32
  11. package/dist/cjs/apis/market.js.map +1 -1
  12. package/dist/cjs/apis/open-order.js +56 -21
  13. package/dist/cjs/apis/open-order.js.map +1 -1
  14. package/dist/cjs/approval.js +77 -30
  15. package/dist/cjs/approval.js.map +1 -1
  16. package/dist/cjs/call.js +358 -207
  17. package/dist/cjs/call.js.map +1 -1
  18. package/dist/cjs/constants/addresses.js +26 -1
  19. package/dist/cjs/constants/addresses.js.map +1 -1
  20. package/dist/cjs/constants/chain.js +19 -1
  21. package/dist/cjs/constants/chain.js.map +1 -1
  22. package/dist/cjs/constants/client.js +4 -0
  23. package/dist/cjs/constants/client.js.map +1 -1
  24. package/dist/cjs/constants/currency.js +28 -2
  25. package/dist/cjs/constants/currency.js.map +1 -1
  26. package/dist/cjs/constants/fee.js +17 -2
  27. package/dist/cjs/constants/fee.js.map +1 -1
  28. package/dist/cjs/constants/subgraph.js +57 -0
  29. package/dist/cjs/constants/subgraph.js.map +1 -0
  30. package/dist/cjs/constants/test-chain.js +27 -0
  31. package/dist/cjs/constants/test-chain.js.map +1 -0
  32. package/dist/cjs/index.js +20 -6
  33. package/dist/cjs/index.js.map +1 -1
  34. package/dist/cjs/model/book.js +63 -29
  35. package/dist/cjs/model/book.js.map +1 -1
  36. package/dist/cjs/model/chart-log.js +3 -0
  37. package/dist/cjs/model/chart-log.js.map +1 -0
  38. package/dist/cjs/model/market.js +45 -182
  39. package/dist/cjs/model/market.js.map +1 -1
  40. package/dist/cjs/signature.js +20 -16
  41. package/dist/cjs/signature.js.map +1 -1
  42. package/dist/cjs/type.js +16 -1
  43. package/dist/cjs/type.js.map +1 -1
  44. package/dist/cjs/utils/allowance.js +40 -0
  45. package/dist/cjs/utils/allowance.js.map +1 -0
  46. package/dist/cjs/utils/bigint.js +9 -0
  47. package/dist/cjs/utils/bigint.js.map +1 -0
  48. package/dist/cjs/utils/book-id.js +7 -7
  49. package/dist/cjs/utils/book-id.js.map +1 -1
  50. package/dist/cjs/utils/build-transaction.js +8 -7
  51. package/dist/cjs/utils/build-transaction.js.map +1 -1
  52. package/dist/cjs/utils/currency.js +166 -0
  53. package/dist/cjs/utils/currency.js.map +1 -0
  54. package/dist/cjs/utils/decorator.js +3 -1
  55. package/dist/cjs/utils/decorator.js.map +1 -1
  56. package/dist/cjs/utils/open.js +36 -0
  57. package/dist/cjs/utils/open.js.map +1 -0
  58. package/dist/cjs/utils/order.js +102 -0
  59. package/dist/cjs/utils/order.js.map +1 -0
  60. package/dist/cjs/utils/prices.js +28 -3
  61. package/dist/cjs/utils/prices.js.map +1 -1
  62. package/dist/cjs/utils/unit-size.js +49 -0
  63. package/dist/cjs/utils/unit-size.js.map +1 -0
  64. package/dist/cjs/utils.js +15 -0
  65. package/dist/cjs/utils.js.map +1 -0
  66. package/dist/cjs/view.js +141 -40
  67. package/dist/cjs/view.js.map +1 -1
  68. package/dist/esm/abis/core/book-manager-abi.js +109 -0
  69. package/dist/esm/abis/core/book-manager-abi.js.map +1 -0
  70. package/dist/esm/abis/core/book-viewer-abi.js +318 -0
  71. package/dist/esm/abis/core/book-viewer-abi.js.map +1 -0
  72. package/dist/esm/abis/core/controller-abi.js +29 -24
  73. package/dist/esm/abis/core/controller-abi.js.map +1 -1
  74. package/dist/esm/apis/chart-logs.js +150 -0
  75. package/dist/esm/apis/chart-logs.js.map +1 -0
  76. package/dist/esm/apis/market.js +61 -32
  77. package/dist/esm/apis/market.js.map +1 -1
  78. package/dist/esm/apis/open-order.js +57 -21
  79. package/dist/esm/apis/open-order.js.map +1 -1
  80. package/dist/esm/approval.js +116 -44
  81. package/dist/esm/approval.js.map +1 -1
  82. package/dist/esm/call.js +478 -311
  83. package/dist/esm/call.js.map +1 -1
  84. package/dist/esm/constants/addresses.js +26 -1
  85. package/dist/esm/constants/addresses.js.map +1 -1
  86. package/dist/esm/constants/chain.js +20 -2
  87. package/dist/esm/constants/chain.js.map +1 -1
  88. package/dist/esm/constants/client.js +5 -1
  89. package/dist/esm/constants/client.js.map +1 -1
  90. package/dist/esm/constants/currency.js +28 -2
  91. package/dist/esm/constants/currency.js.map +1 -1
  92. package/dist/esm/constants/fee.js +17 -2
  93. package/dist/esm/constants/fee.js.map +1 -1
  94. package/dist/esm/constants/subgraph.js +53 -0
  95. package/dist/esm/constants/subgraph.js.map +1 -0
  96. package/dist/esm/constants/test-chain.js +24 -0
  97. package/dist/esm/constants/test-chain.js.map +1 -0
  98. package/dist/esm/index.js +1 -0
  99. package/dist/esm/index.js.map +1 -1
  100. package/dist/esm/model/book.js +63 -29
  101. package/dist/esm/model/book.js.map +1 -1
  102. package/dist/esm/model/chart-log.js +2 -0
  103. package/dist/esm/model/chart-log.js.map +1 -0
  104. package/dist/esm/model/market.js +46 -187
  105. package/dist/esm/model/market.js.map +1 -1
  106. package/dist/esm/signature.js +35 -37
  107. package/dist/esm/signature.js.map +1 -1
  108. package/dist/esm/type.js +15 -0
  109. package/dist/esm/type.js.map +1 -1
  110. package/dist/esm/utils/allowance.js +36 -0
  111. package/dist/esm/utils/allowance.js.map +1 -0
  112. package/dist/esm/utils/bigint.js +5 -0
  113. package/dist/esm/utils/bigint.js.map +1 -0
  114. package/dist/esm/utils/book-id.js +7 -7
  115. package/dist/esm/utils/book-id.js.map +1 -1
  116. package/dist/esm/utils/build-transaction.js +8 -7
  117. package/dist/esm/utils/build-transaction.js.map +1 -1
  118. package/dist/esm/utils/currency.js +161 -0
  119. package/dist/esm/utils/currency.js.map +1 -0
  120. package/dist/esm/utils/decorator.js +3 -1
  121. package/dist/esm/utils/decorator.js.map +1 -1
  122. package/dist/esm/utils/open.js +32 -0
  123. package/dist/esm/utils/open.js.map +1 -0
  124. package/dist/esm/utils/order.js +98 -0
  125. package/dist/esm/utils/order.js.map +1 -0
  126. package/dist/esm/utils/prices.js +27 -2
  127. package/dist/esm/utils/prices.js.map +1 -1
  128. package/dist/esm/utils/unit-size.js +45 -0
  129. package/dist/esm/utils/unit-size.js.map +1 -0
  130. package/dist/esm/utils.js +4 -0
  131. package/dist/esm/utils.js.map +1 -0
  132. package/dist/esm/view.js +254 -68
  133. package/dist/esm/view.js.map +1 -1
  134. package/dist/tsconfig.build.tsbuildinfo +1 -1
  135. package/dist/types/abis/core/book-manager-abi.d.ts +82 -0
  136. package/dist/types/abis/core/book-manager-abi.d.ts.map +1 -0
  137. package/dist/types/abis/core/book-viewer-abi.d.ts +243 -0
  138. package/dist/types/abis/core/book-viewer-abi.d.ts.map +1 -0
  139. package/dist/types/abis/core/controller-abi.d.ts +23 -19
  140. package/dist/types/abis/core/controller-abi.d.ts.map +1 -1
  141. package/dist/types/apis/chart-logs.d.ts +5 -0
  142. package/dist/types/apis/chart-logs.d.ts.map +1 -0
  143. package/dist/types/apis/market.d.ts +1 -1
  144. package/dist/types/apis/market.d.ts.map +1 -1
  145. package/dist/types/apis/open-order.d.ts +3 -2
  146. package/dist/types/apis/open-order.d.ts.map +1 -1
  147. package/dist/types/approval.d.ts +48 -16
  148. package/dist/types/approval.d.ts.map +1 -1
  149. package/dist/types/call.d.ts +181 -109
  150. package/dist/types/call.d.ts.map +1 -1
  151. package/dist/types/constants/addresses.d.ts.map +1 -1
  152. package/dist/types/constants/chain.d.ts +6 -2
  153. package/dist/types/constants/chain.d.ts.map +1 -1
  154. package/dist/types/constants/client.d.ts +1 -1
  155. package/dist/types/constants/client.d.ts.map +1 -1
  156. package/dist/types/constants/currency.d.ts.map +1 -1
  157. package/dist/types/constants/fee.d.ts +7 -2
  158. package/dist/types/constants/fee.d.ts.map +1 -1
  159. package/dist/types/constants/subgraph.d.ts +10 -0
  160. package/dist/types/constants/subgraph.d.ts.map +1 -0
  161. package/dist/types/constants/test-chain.d.ts +3 -0
  162. package/dist/types/constants/test-chain.d.ts.map +1 -0
  163. package/dist/types/index.d.ts +1 -0
  164. package/dist/types/index.d.ts.map +1 -1
  165. package/dist/types/model/book.d.ts +23 -29
  166. package/dist/types/model/book.d.ts.map +1 -1
  167. package/dist/types/model/chart-log.d.ts +9 -0
  168. package/dist/types/model/chart-log.d.ts.map +1 -0
  169. package/dist/types/model/depth.d.ts +4 -5
  170. package/dist/types/model/depth.d.ts.map +1 -1
  171. package/dist/types/model/market.d.ts +25 -19
  172. package/dist/types/model/market.d.ts.map +1 -1
  173. package/dist/types/model/open-order.d.ts +16 -8
  174. package/dist/types/model/open-order.d.ts.map +1 -1
  175. package/dist/types/signature.d.ts +18 -24
  176. package/dist/types/signature.d.ts.map +1 -1
  177. package/dist/types/type.d.ts +52 -8
  178. package/dist/types/type.d.ts.map +1 -1
  179. package/dist/types/utils/allowance.d.ts +3 -0
  180. package/dist/types/utils/allowance.d.ts.map +1 -0
  181. package/dist/types/utils/bigint.d.ts +2 -0
  182. package/dist/types/utils/bigint.d.ts.map +1 -0
  183. package/dist/types/utils/book-id.d.ts +2 -1
  184. package/dist/types/utils/book-id.d.ts.map +1 -1
  185. package/dist/types/utils/build-transaction.d.ts +3 -3
  186. package/dist/types/utils/build-transaction.d.ts.map +1 -1
  187. package/dist/types/{apis → utils}/currency.d.ts +3 -0
  188. package/dist/types/utils/currency.d.ts.map +1 -0
  189. package/dist/types/utils/decorator.d.ts +1 -1
  190. package/dist/types/utils/decorator.d.ts.map +1 -1
  191. package/dist/types/utils/open.d.ts +3 -0
  192. package/dist/types/utils/open.d.ts.map +1 -0
  193. package/dist/types/utils/order.d.ts +8 -0
  194. package/dist/types/utils/order.d.ts.map +1 -0
  195. package/dist/types/utils/prices.d.ts +12 -2
  196. package/dist/types/utils/prices.d.ts.map +1 -1
  197. package/dist/types/utils/unit-size.d.ts +4 -0
  198. package/dist/types/utils/unit-size.d.ts.map +1 -0
  199. package/dist/types/utils.d.ts +4 -0
  200. package/dist/types/utils.d.ts.map +1 -0
  201. package/dist/types/view.d.ts +196 -39
  202. package/dist/types/view.d.ts.map +1 -1
  203. package/package.json +1 -1
  204. package/dist/cjs/abis/core/params-abi.js +0 -62
  205. package/dist/cjs/abis/core/params-abi.js.map +0 -1
  206. package/dist/cjs/apis/currency.js +0 -83
  207. package/dist/cjs/apis/currency.js.map +0 -1
  208. package/dist/cjs/apis/subgraph.js +0 -26
  209. package/dist/cjs/apis/subgraph.js.map +0 -1
  210. package/dist/cjs/constants/subgraph-url.js +0 -8
  211. package/dist/cjs/constants/subgraph-url.js.map +0 -1
  212. package/dist/cjs/utils/unit.js +0 -34
  213. package/dist/cjs/utils/unit.js.map +0 -1
  214. package/dist/esm/abis/core/params-abi.js +0 -59
  215. package/dist/esm/abis/core/params-abi.js.map +0 -1
  216. package/dist/esm/apis/currency.js +0 -79
  217. package/dist/esm/apis/currency.js.map +0 -1
  218. package/dist/esm/apis/subgraph.js +0 -22
  219. package/dist/esm/apis/subgraph.js.map +0 -1
  220. package/dist/esm/constants/subgraph-url.js +0 -5
  221. package/dist/esm/constants/subgraph-url.js.map +0 -1
  222. package/dist/esm/utils/unit.js +0 -30
  223. package/dist/esm/utils/unit.js.map +0 -1
  224. package/dist/types/abis/core/params-abi.d.ts +0 -21
  225. package/dist/types/abis/core/params-abi.d.ts.map +0 -1
  226. package/dist/types/apis/currency.d.ts.map +0 -1
  227. package/dist/types/apis/subgraph.d.ts +0 -3
  228. package/dist/types/apis/subgraph.d.ts.map +0 -1
  229. package/dist/types/constants/subgraph-url.d.ts +0 -5
  230. package/dist/types/constants/subgraph-url.d.ts.map +0 -1
  231. package/dist/types/utils/unit.d.ts +0 -4
  232. package/dist/types/utils/unit.d.ts.map +0 -1
@@ -0,0 +1,82 @@
1
+ export declare const BOOK_MANAGER_ABI: readonly [{
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "OrderId";
4
+ readonly name: "id";
5
+ readonly type: "uint256";
6
+ }];
7
+ readonly name: "getOrder";
8
+ readonly outputs: readonly [{
9
+ readonly components: readonly [{
10
+ readonly internalType: "address";
11
+ readonly name: "provider";
12
+ readonly type: "address";
13
+ }, {
14
+ readonly internalType: "uint64";
15
+ readonly name: "open";
16
+ readonly type: "uint64";
17
+ }, {
18
+ readonly internalType: "uint64";
19
+ readonly name: "claimable";
20
+ readonly type: "uint64";
21
+ }];
22
+ readonly internalType: "struct IBookManager.OrderInfo";
23
+ readonly name: "";
24
+ readonly type: "tuple";
25
+ }];
26
+ readonly stateMutability: "view";
27
+ readonly type: "function";
28
+ }, {
29
+ readonly inputs: readonly [{
30
+ readonly internalType: "uint256";
31
+ readonly name: "tokenId";
32
+ readonly type: "uint256";
33
+ }];
34
+ readonly name: "ownerOf";
35
+ readonly outputs: readonly [{
36
+ readonly internalType: "address";
37
+ readonly name: "";
38
+ readonly type: "address";
39
+ }];
40
+ readonly stateMutability: "view";
41
+ readonly type: "function";
42
+ }, {
43
+ readonly inputs: readonly [{
44
+ readonly internalType: "BookId";
45
+ readonly name: "id";
46
+ readonly type: "uint192";
47
+ }];
48
+ readonly name: "getBookKey";
49
+ readonly outputs: readonly [{
50
+ readonly components: readonly [{
51
+ readonly internalType: "Currency";
52
+ readonly name: "base";
53
+ readonly type: "address";
54
+ }, {
55
+ readonly internalType: "uint64";
56
+ readonly name: "unitSize";
57
+ readonly type: "uint64";
58
+ }, {
59
+ readonly internalType: "Currency";
60
+ readonly name: "quote";
61
+ readonly type: "address";
62
+ }, {
63
+ readonly internalType: "FeePolicy";
64
+ readonly name: "makerPolicy";
65
+ readonly type: "uint24";
66
+ }, {
67
+ readonly internalType: "contract IHooks";
68
+ readonly name: "hooks";
69
+ readonly type: "address";
70
+ }, {
71
+ readonly internalType: "FeePolicy";
72
+ readonly name: "takerPolicy";
73
+ readonly type: "uint24";
74
+ }];
75
+ readonly internalType: "struct IBookManager.BookKey";
76
+ readonly name: "";
77
+ readonly type: "tuple";
78
+ }];
79
+ readonly stateMutability: "view";
80
+ readonly type: "function";
81
+ }];
82
+ //# sourceMappingURL=book-manager-abi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"book-manager-abi.d.ts","sourceRoot":"","sources":["../../../../src/abis/core/book-manager-abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2GnB,CAAA"}
@@ -0,0 +1,243 @@
1
+ export declare const BOOK_VIEWER_ABI: readonly [{
2
+ readonly anonymous: false;
3
+ readonly inputs: readonly [{
4
+ readonly indexed: true;
5
+ readonly internalType: "address";
6
+ readonly name: "previousOwner";
7
+ readonly type: "address";
8
+ }, {
9
+ readonly indexed: true;
10
+ readonly internalType: "address";
11
+ readonly name: "newOwner";
12
+ readonly type: "address";
13
+ }];
14
+ readonly name: "OwnershipTransferred";
15
+ readonly type: "event";
16
+ }, {
17
+ readonly anonymous: false;
18
+ readonly inputs: readonly [{
19
+ readonly indexed: true;
20
+ readonly internalType: "address";
21
+ readonly name: "previousImplementation";
22
+ readonly type: "address";
23
+ }, {
24
+ readonly indexed: true;
25
+ readonly internalType: "address";
26
+ readonly name: "newImplementation";
27
+ readonly type: "address";
28
+ }];
29
+ readonly name: "ProxyImplementationUpdated";
30
+ readonly type: "event";
31
+ }, {
32
+ readonly stateMutability: "payable";
33
+ readonly type: "fallback";
34
+ }, {
35
+ readonly inputs: readonly [];
36
+ readonly name: "owner";
37
+ readonly outputs: readonly [{
38
+ readonly internalType: "address";
39
+ readonly name: "";
40
+ readonly type: "address";
41
+ }];
42
+ readonly stateMutability: "view";
43
+ readonly type: "function";
44
+ }, {
45
+ readonly inputs: readonly [{
46
+ readonly internalType: "bytes4";
47
+ readonly name: "id";
48
+ readonly type: "bytes4";
49
+ }];
50
+ readonly name: "supportsInterface";
51
+ readonly outputs: readonly [{
52
+ readonly internalType: "bool";
53
+ readonly name: "";
54
+ readonly type: "bool";
55
+ }];
56
+ readonly stateMutability: "view";
57
+ readonly type: "function";
58
+ }, {
59
+ readonly inputs: readonly [{
60
+ readonly internalType: "address";
61
+ readonly name: "newOwner";
62
+ readonly type: "address";
63
+ }];
64
+ readonly name: "transferOwnership";
65
+ readonly outputs: readonly [];
66
+ readonly stateMutability: "nonpayable";
67
+ readonly type: "function";
68
+ }, {
69
+ readonly inputs: readonly [{
70
+ readonly internalType: "address";
71
+ readonly name: "newImplementation";
72
+ readonly type: "address";
73
+ }];
74
+ readonly name: "upgradeTo";
75
+ readonly outputs: readonly [];
76
+ readonly stateMutability: "nonpayable";
77
+ readonly type: "function";
78
+ }, {
79
+ readonly inputs: readonly [{
80
+ readonly internalType: "address";
81
+ readonly name: "newImplementation";
82
+ readonly type: "address";
83
+ }, {
84
+ readonly internalType: "bytes";
85
+ readonly name: "data";
86
+ readonly type: "bytes";
87
+ }];
88
+ readonly name: "upgradeToAndCall";
89
+ readonly outputs: readonly [];
90
+ readonly stateMutability: "payable";
91
+ readonly type: "function";
92
+ }, {
93
+ readonly stateMutability: "payable";
94
+ readonly type: "receive";
95
+ }, {
96
+ readonly inputs: readonly [];
97
+ readonly name: "InvalidTick";
98
+ readonly type: "error";
99
+ }, {
100
+ readonly inputs: readonly [{
101
+ readonly internalType: "uint256";
102
+ readonly name: "value";
103
+ readonly type: "uint256";
104
+ }];
105
+ readonly name: "SafeCastOverflowedUintToInt";
106
+ readonly type: "error";
107
+ }, {
108
+ readonly inputs: readonly [];
109
+ readonly name: "bookManager";
110
+ readonly outputs: readonly [{
111
+ readonly internalType: "contract IBookManager";
112
+ readonly name: "";
113
+ readonly type: "address";
114
+ }];
115
+ readonly stateMutability: "view";
116
+ readonly type: "function";
117
+ }, {
118
+ readonly inputs: readonly [{
119
+ readonly components: readonly [{
120
+ readonly internalType: "BookId";
121
+ readonly name: "id";
122
+ readonly type: "uint192";
123
+ }, {
124
+ readonly internalType: "uint256";
125
+ readonly name: "limitPrice";
126
+ readonly type: "uint256";
127
+ }, {
128
+ readonly internalType: "uint256";
129
+ readonly name: "quoteAmount";
130
+ readonly type: "uint256";
131
+ }, {
132
+ readonly internalType: "uint256";
133
+ readonly name: "maxBaseAmount";
134
+ readonly type: "uint256";
135
+ }, {
136
+ readonly internalType: "bytes";
137
+ readonly name: "hookData";
138
+ readonly type: "bytes";
139
+ }];
140
+ readonly internalType: "struct IController.TakeOrderParams";
141
+ readonly name: "params";
142
+ readonly type: "tuple";
143
+ }];
144
+ readonly name: "getExpectedInput";
145
+ readonly outputs: readonly [{
146
+ readonly internalType: "uint256";
147
+ readonly name: "takenQuoteAmount";
148
+ readonly type: "uint256";
149
+ }, {
150
+ readonly internalType: "uint256";
151
+ readonly name: "spentBaseAmount";
152
+ readonly type: "uint256";
153
+ }];
154
+ readonly stateMutability: "view";
155
+ readonly type: "function";
156
+ }, {
157
+ readonly inputs: readonly [{
158
+ readonly components: readonly [{
159
+ readonly internalType: "BookId";
160
+ readonly name: "id";
161
+ readonly type: "uint192";
162
+ }, {
163
+ readonly internalType: "uint256";
164
+ readonly name: "limitPrice";
165
+ readonly type: "uint256";
166
+ }, {
167
+ readonly internalType: "uint256";
168
+ readonly name: "baseAmount";
169
+ readonly type: "uint256";
170
+ }, {
171
+ readonly internalType: "uint256";
172
+ readonly name: "minQuoteAmount";
173
+ readonly type: "uint256";
174
+ }, {
175
+ readonly internalType: "bytes";
176
+ readonly name: "hookData";
177
+ readonly type: "bytes";
178
+ }];
179
+ readonly internalType: "struct IController.SpendOrderParams";
180
+ readonly name: "params";
181
+ readonly type: "tuple";
182
+ }];
183
+ readonly name: "getExpectedOutput";
184
+ readonly outputs: readonly [{
185
+ readonly internalType: "uint256";
186
+ readonly name: "takenQuoteAmount";
187
+ readonly type: "uint256";
188
+ }, {
189
+ readonly internalType: "uint256";
190
+ readonly name: "spentBaseAmount";
191
+ readonly type: "uint256";
192
+ }];
193
+ readonly stateMutability: "view";
194
+ readonly type: "function";
195
+ }, {
196
+ readonly inputs: readonly [{
197
+ readonly internalType: "BookId";
198
+ readonly name: "id";
199
+ readonly type: "uint192";
200
+ }, {
201
+ readonly internalType: "Tick";
202
+ readonly name: "tick";
203
+ readonly type: "int24";
204
+ }, {
205
+ readonly internalType: "uint256";
206
+ readonly name: "n";
207
+ readonly type: "uint256";
208
+ }];
209
+ readonly name: "getLiquidity";
210
+ readonly outputs: readonly [{
211
+ readonly components: readonly [{
212
+ readonly internalType: "Tick";
213
+ readonly name: "tick";
214
+ readonly type: "int24";
215
+ }, {
216
+ readonly internalType: "uint64";
217
+ readonly name: "depth";
218
+ readonly type: "uint64";
219
+ }];
220
+ readonly internalType: "struct IBookViewer.Liquidity[]";
221
+ readonly name: "liquidity";
222
+ readonly type: "tuple[]";
223
+ }];
224
+ readonly stateMutability: "view";
225
+ readonly type: "function";
226
+ }, {
227
+ readonly inputs: readonly [{
228
+ readonly internalType: "address";
229
+ readonly name: "implementationAddress";
230
+ readonly type: "address";
231
+ }, {
232
+ readonly internalType: "address";
233
+ readonly name: "ownerAddress";
234
+ readonly type: "address";
235
+ }, {
236
+ readonly internalType: "bytes";
237
+ readonly name: "data";
238
+ readonly type: "bytes";
239
+ }];
240
+ readonly stateMutability: "payable";
241
+ readonly type: "constructor";
242
+ }];
243
+ //# sourceMappingURL=book-viewer-abi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"book-viewer-abi.d.ts","sourceRoot":"","sources":["../../../../src/abis/core/book-viewer-abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4TlB,CAAA"}
@@ -14,14 +14,6 @@ export declare const CONTROLLER_ABI: readonly [{
14
14
  }];
15
15
  readonly name: "AddressEmptyCode";
16
16
  readonly type: "error";
17
- }, {
18
- readonly inputs: readonly [{
19
- readonly internalType: "address";
20
- readonly name: "account";
21
- readonly type: "address";
22
- }];
23
- readonly name: "AddressInsufficientBalance";
24
- readonly type: "error";
25
17
  }, {
26
18
  readonly inputs: readonly [];
27
19
  readonly name: "ControllerSlippage";
@@ -36,7 +28,19 @@ export declare const CONTROLLER_ABI: readonly [{
36
28
  readonly type: "error";
37
29
  }, {
38
30
  readonly inputs: readonly [];
39
- readonly name: "FailedInnerCall";
31
+ readonly name: "FailedCall";
32
+ readonly type: "error";
33
+ }, {
34
+ readonly inputs: readonly [{
35
+ readonly internalType: "uint256";
36
+ readonly name: "balance";
37
+ readonly type: "uint256";
38
+ }, {
39
+ readonly internalType: "uint256";
40
+ readonly name: "needed";
41
+ readonly type: "uint256";
42
+ }];
43
+ readonly name: "InsufficientBalance";
40
44
  readonly type: "error";
41
45
  }, {
42
46
  readonly inputs: readonly [];
@@ -50,10 +54,6 @@ export declare const CONTROLLER_ABI: readonly [{
50
54
  readonly inputs: readonly [];
51
55
  readonly name: "InvalidLength";
52
56
  readonly type: "error";
53
- }, {
54
- readonly inputs: readonly [];
55
- readonly name: "InvalidMarket";
56
- readonly type: "error";
57
57
  }, {
58
58
  readonly inputs: readonly [];
59
59
  readonly name: "InvalidPrice";
@@ -90,10 +90,6 @@ export declare const CONTROLLER_ABI: readonly [{
90
90
  }];
91
91
  readonly name: "SafeERC20FailedOperation";
92
92
  readonly type: "error";
93
- }, {
94
- readonly inputs: readonly [];
95
- readonly name: "ValueTransferFailed";
96
- readonly type: "error";
97
93
  }, {
98
94
  readonly inputs: readonly [{
99
95
  readonly components: readonly [{
@@ -340,7 +336,7 @@ export declare const CONTROLLER_ABI: readonly [{
340
336
  readonly name: "id";
341
337
  readonly type: "uint192";
342
338
  }];
343
- readonly name: "getLowestPrice";
339
+ readonly name: "getHighestPrice";
344
340
  readonly outputs: readonly [{
345
341
  readonly internalType: "uint256";
346
342
  readonly name: "";
@@ -559,7 +555,7 @@ export declare const CONTROLLER_ABI: readonly [{
559
555
  readonly type: "address";
560
556
  }, {
561
557
  readonly internalType: "uint64";
562
- readonly name: "unit";
558
+ readonly name: "unitSize";
563
559
  readonly type: "uint64";
564
560
  }, {
565
561
  readonly internalType: "Currency";
@@ -612,6 +608,10 @@ export declare const CONTROLLER_ABI: readonly [{
612
608
  readonly internalType: "uint256";
613
609
  readonly name: "baseAmount";
614
610
  readonly type: "uint256";
611
+ }, {
612
+ readonly internalType: "uint256";
613
+ readonly name: "minQuoteAmount";
614
+ readonly type: "uint256";
615
615
  }, {
616
616
  readonly internalType: "bytes";
617
617
  readonly name: "hookData";
@@ -681,6 +681,10 @@ export declare const CONTROLLER_ABI: readonly [{
681
681
  readonly internalType: "uint256";
682
682
  readonly name: "quoteAmount";
683
683
  readonly type: "uint256";
684
+ }, {
685
+ readonly internalType: "uint256";
686
+ readonly name: "maxBaseAmount";
687
+ readonly type: "uint256";
684
688
  }, {
685
689
  readonly internalType: "bytes";
686
690
  readonly name: "hookData";
@@ -1 +1 @@
1
- {"version":3,"file":"controller-abi.d.ts","sourceRoot":"","sources":["../../../../src/abis/core/controller-abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAw9BjB,CAAA"}
1
+ {"version":3,"file":"controller-abi.d.ts","sourceRoot":"","sources":["../../../../src/abis/core/controller-abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA69BjB,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { CHAIN_IDS } from '../constants/chain';
2
+ import { CHART_LOG_INTERVALS, ChartLog } from '../type';
3
+ export declare function fetchLatestChartLog(chainId: CHAIN_IDS, marketCode: string): Promise<ChartLog>;
4
+ export declare function fetchChartLogs(chainId: CHAIN_IDS, marketCode: string, intervalType: CHART_LOG_INTERVALS, from: number, to: number): Promise<ChartLog[]>;
5
+ //# sourceMappingURL=chart-logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-logs.d.ts","sourceRoot":"","sources":["../../../src/apis/chart-logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AA8EvD,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,SAAS,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,QAAQ,CAAC,CAwBnB;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,SAAS,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,mBAAmB,EACjC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,QAAQ,EAAE,CAAC,CA4GrB"}
@@ -1,4 +1,4 @@
1
1
  import { CHAIN_IDS } from '../constants/chain';
2
2
  import { Market } from '../model/market';
3
- export declare function fetchMarket(chainId: CHAIN_IDS, tokenAddresses: `0x${string}`[]): Promise<Market>;
3
+ export declare function fetchMarket(chainId: CHAIN_IDS, tokenAddresses: `0x${string}`[], n?: number): Promise<Market>;
4
4
  //# sourceMappingURL=market.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../../src/apis/market.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AA4BxC,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,EAClB,cAAc,EAAE,KAAK,MAAM,EAAE,EAAE,GAC9B,OAAO,CAAC,MAAM,CAAC,CAsDjB"}
1
+ {"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../../src/apis/market.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AA4FxC,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,EAClB,cAAc,EAAE,KAAK,MAAM,EAAE,EAAE,EAC/B,CAAC,SAAM,GACN,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
@@ -1,5 +1,6 @@
1
1
  import { CHAIN_IDS } from '../constants/chain';
2
- import { OpenOrder } from '../model/open-order';
3
- export declare function fetchOpenOrders(chainId: CHAIN_IDS, userAddress: `0x${string}`): Promise<OpenOrder[]>;
2
+ import type { OpenOrder } from '../model/open-order';
3
+ export declare function fetchOpenOrdersByUserAddress(chainId: CHAIN_IDS, userAddress: `0x${string}`): Promise<OpenOrder[]>;
4
4
  export declare function fetchOpenOrder(chainId: CHAIN_IDS, id: string): Promise<OpenOrder>;
5
+ export declare function fetchOpenOrders(chainId: CHAIN_IDS, ids: string[]): Promise<OpenOrder[]>;
5
6
  //# sourceMappingURL=open-order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"open-order.d.ts","sourceRoot":"","sources":["../../../src/apis/open-order.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAM9C,OAAO,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAA;AAsC7D,wBAAsB,eAAe,CACnC,OAAO,EAAE,SAAS,EAClB,WAAW,EAAE,KAAK,MAAM,EAAE,GACzB,OAAO,CAAC,SAAS,EAAE,CAAC,CAoBtB;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,SAAS,EAClB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,SAAS,CAAC,CAYpB"}
1
+ {"version":3,"file":"open-order.d.ts","sourceRoot":"","sources":["../../../src/apis/open-order.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAM9C,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAA;AAmDlE,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,SAAS,EAClB,WAAW,EAAE,KAAK,MAAM,EAAE,GACzB,OAAO,CAAC,SAAS,EAAE,CAAC,CAoBtB;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,SAAS,EAClB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,SAAS,CAAC,CAYpB;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,SAAS,EAClB,GAAG,EAAE,MAAM,EAAE,GACZ,OAAO,CAAC,SAAS,EAAE,CAAC,CAoBtB"}
@@ -1,35 +1,67 @@
1
- import { HDAccount, PrivateKeyAccount } from 'viem';
1
+ import { WalletClient } from 'viem';
2
2
  import { CHAIN_IDS } from './constants/chain';
3
- import { DefaultOptions } from './type';
3
+ import type { DefaultOptions } from './type';
4
4
  /**
5
+ * @dev This function relates with `viem` dependency
5
6
  * Sets approval of all open orders for the specified account on the given chain.
6
7
  *
7
8
  * @param {CHAIN_IDS} chainId The chain ID.
8
- * @param {HDAccount | PrivateKeyAccount} account The Ethereum account for which approval is to be set.
9
+ * @param {WalletClient} walletClient The wallet client.
9
10
  * @param {Object} [options] Optional parameters for setting approval.
10
11
  * @param {string} options.rpcUrl The RPC URL to use for executing the transaction.
11
12
  * @returns {Promise<`0x${string}` | undefined>} Promise resolving to the transaction hash. If the account is already approved for all, the promise resolves to `undefined`.
12
13
  * @example
13
14
  * import { setApprovalOfOpenOrdersForAll } from '@clober/v2-sdk'
14
- * import { privateKeyToAccount } from 'viem/accounts'
15
+ * import { mnemonicToAccount } from 'viem/accounts'
15
16
  *
16
- * const hash = await setApprovalOfOpenOrdersForAll(
17
- * 421614,
18
- * privateKeyToAccount('0x...')
19
- * )
17
+ * const walletClient = createWalletClient({
18
+ * chain: arbitrumSepolia,
19
+ * account: mnemonicToAccount('legal ...'),
20
+ * transport: http(),
21
+ * })
20
22
  *
23
+ * const hash = await setApprovalOfOpenOrdersForAll({
24
+ * chainId: 421614,
25
+ * walletClient
26
+ * })
27
+ */
28
+ export declare const setApprovalOfOpenOrdersForAll: (args: {
29
+ chainId: CHAIN_IDS;
30
+ walletClient: WalletClient;
31
+ options?: DefaultOptions;
32
+ }) => Promise<`0x${string}` | undefined>;
33
+ /**
34
+ * @dev This function relates with `viem` dependency
35
+ * Approves the specified amount of tokens for the given account on the specified chain.
36
+ *
37
+ * @param {CHAIN_IDS} chainId The chain ID.
38
+ * @param {WalletClient} walletClient The wallet client.
39
+ * @param {`0x${string}`} token The ERC20 token address.
40
+ * @param {string | undefined} amount The amount to approve. If not provided, the maximum amount is approved.
41
+ * @param options
42
+ * @param options.rpcUrl The RPC URL of the blockchain.
43
+ * @returns {Promise<`0x${string}` | undefined>} Promise resolving to the transaction hash. If the account is already approved, the promise resolves to `undefined`.
21
44
  * @example
22
- * import { setApprovalOfOpenOrdersForAll } from '@clober/v2-sdk'
23
- * import { mnemonicToAccount } from 'viem/accounts'
45
+ * import { approveERC20 } from '@clober/v2-sdk'
46
+ *
47
+ * const walletClient = createWalletClient({
48
+ * chain: arbitrumSepolia,
49
+ * account: mnemonicToAccount('legal ...'),
50
+ * transport: http(),
51
+ * })
24
52
  *
25
- * const hash = await setApprovalOfOpenOrdersForAll(
26
- * 421614,
27
- * mnemonicToAccount('legal ...')
28
- * )
53
+ * const hash = await approveERC20({
54
+ * chainId: 421614,
55
+ * walletClient
56
+ * token: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
57
+ * amount: '1000.123', // approve 1000.123 USDC
58
+ * })
29
59
  */
30
- export declare const setApprovalOfOpenOrdersForAll: (args: {
60
+ export declare const approveERC20: (args: {
31
61
  chainId: CHAIN_IDS;
32
- account: HDAccount | PrivateKeyAccount;
62
+ walletClient: WalletClient;
63
+ token: `0x${string}`;
64
+ amount?: string;
33
65
  options?: DefaultOptions;
34
66
  }) => Promise<`0x${string}` | undefined>;
35
67
  //# sourceMappingURL=approval.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,SAAS,EAAQ,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAE7E,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;AAIxD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAuBvC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,6BAA6B;aAM7B,SAAS;aACT,SAAS,GAAG,iBAAiB;cAC5B,cAAc;wCAuB3B,CAAA"}
1
+ {"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,MAAM,CAAA;AAE/C,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAI5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B;aAK7B,SAAS;kBACJ,YAAY;cAChB,cAAc;wCAwC3B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,YAAY;aAOZ,SAAS;kBACJ,YAAY;WACnB,KAAK,MAAM,EAAE;aACX,MAAM;cACL,cAAc;wCAsD3B,CAAA"}