@alephium/powfi-sdk 0.0.1-rc.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.
Files changed (146) hide show
  1. package/README.md +4 -0
  2. package/clmm/artifacts/BitmapWord.ral.json +125 -0
  3. package/clmm/artifacts/BitmapWordDeployer.ral.json +31 -0
  4. package/clmm/artifacts/CreateConfig.ral.json +37 -0
  5. package/clmm/artifacts/CreateLiquidPool.ral.json +55 -0
  6. package/clmm/artifacts/DexAccount.ral.json +110 -0
  7. package/clmm/artifacts/LiquidityAmountsTest.ral.json +161 -0
  8. package/clmm/artifacts/LiquidityManagmentTest.ral.json +384 -0
  9. package/clmm/artifacts/Pool.ral.json +1530 -0
  10. package/clmm/artifacts/PoolConfig.ral.json +31 -0
  11. package/clmm/artifacts/PoolFactory.ral.json +300 -0
  12. package/clmm/artifacts/PoolRouterDemo.ral.json +49 -0
  13. package/clmm/artifacts/PoolUser.ral.json +89 -0
  14. package/clmm/artifacts/Position.ral.json +183 -0
  15. package/clmm/artifacts/PositionManager.ral.json +416 -0
  16. package/clmm/artifacts/SwapWithoutAccount.ral.json +46 -0
  17. package/clmm/artifacts/TestToken.ral.json +68 -0
  18. package/clmm/artifacts/Tick.ral.json +161 -0
  19. package/clmm/artifacts/TickBitmapTest.ral.json +220 -0
  20. package/clmm/artifacts/constants.ral.json +81 -0
  21. package/clmm/artifacts/structs.ral.json +335 -0
  22. package/clmm/artifacts/ts/BitmapWord.ts +337 -0
  23. package/clmm/artifacts/ts/BitmapWordDeployer.ts +164 -0
  24. package/clmm/artifacts/ts/DexAccount.ts +330 -0
  25. package/clmm/artifacts/ts/LiquidityAmountsTest.ts +464 -0
  26. package/clmm/artifacts/ts/LiquidityManagmentTest.ts +859 -0
  27. package/clmm/artifacts/ts/Pool.ts +2535 -0
  28. package/clmm/artifacts/ts/PoolConfig.ts +179 -0
  29. package/clmm/artifacts/ts/PoolFactory.ts +640 -0
  30. package/clmm/artifacts/ts/PoolUser.ts +237 -0
  31. package/clmm/artifacts/ts/Position.ts +440 -0
  32. package/clmm/artifacts/ts/PositionManager.ts +929 -0
  33. package/clmm/artifacts/ts/TestToken.ts +277 -0
  34. package/clmm/artifacts/ts/Tick.ts +351 -0
  35. package/clmm/artifacts/ts/TickBitmapTest.ts +512 -0
  36. package/clmm/artifacts/ts/constants.ts +17 -0
  37. package/clmm/artifacts/ts/contracts.ts +26 -0
  38. package/clmm/artifacts/ts/deployments.ts +160 -0
  39. package/clmm/artifacts/ts/index.ts +20 -0
  40. package/clmm/artifacts/ts/scripts.ts +76 -0
  41. package/clmm/artifacts/ts/types.ts +105 -0
  42. package/clmm/deployments/.deployments.devnet.json +350 -0
  43. package/clmm/deployments/.deployments.testnet.json +350 -0
  44. package/cpmm/artifacts/dex/DexAccount.ral.json +110 -0
  45. package/cpmm/artifacts/dex/Router.ral.json +361 -0
  46. package/cpmm/artifacts/dex/TokenPair.ral.json +512 -0
  47. package/cpmm/artifacts/dex/TokenPairFactory.ral.json +297 -0
  48. package/cpmm/artifacts/examples/ExampleOracleSimple.ral.json +192 -0
  49. package/cpmm/artifacts/examples/FeeCollectorFactoryImpl.ral.json +185 -0
  50. package/cpmm/artifacts/examples/FeeCollectorPerTokenPairImpl.ral.json +216 -0
  51. package/cpmm/artifacts/examples/FullMathTest.ral.json +123 -0
  52. package/cpmm/artifacts/scripts/AddLiquidity.ral.json +46 -0
  53. package/cpmm/artifacts/scripts/Burn.ral.json +31 -0
  54. package/cpmm/artifacts/scripts/CollectFee.ral.json +25 -0
  55. package/cpmm/artifacts/scripts/CreatePair.ral.json +37 -0
  56. package/cpmm/artifacts/scripts/CreatePairAndAddLiquidity.ral.json +43 -0
  57. package/cpmm/artifacts/scripts/EnableFeeCollector.ral.json +28 -0
  58. package/cpmm/artifacts/scripts/Mint.ral.json +34 -0
  59. package/cpmm/artifacts/scripts/RemoveLiquidity.ral.json +43 -0
  60. package/cpmm/artifacts/scripts/SetFeeCollectorFactory.ral.json +28 -0
  61. package/cpmm/artifacts/scripts/Swap.ral.json +46 -0
  62. package/cpmm/artifacts/scripts/SwapMaxIn.ral.json +46 -0
  63. package/cpmm/artifacts/scripts/SwapMinOut.ral.json +46 -0
  64. package/cpmm/artifacts/test/GetToken.ral.json +31 -0
  65. package/cpmm/artifacts/test/MathTest.ral.json +49 -0
  66. package/cpmm/artifacts/test/TestToken.ral.json +87 -0
  67. package/cpmm/artifacts/ts/DexAccount.ts +329 -0
  68. package/cpmm/artifacts/ts/ExampleOracleSimple.ts +383 -0
  69. package/cpmm/artifacts/ts/FeeCollectorFactoryImpl.ts +227 -0
  70. package/cpmm/artifacts/ts/FeeCollectorPerTokenPairImpl.ts +327 -0
  71. package/cpmm/artifacts/ts/FullMathTest.ts +251 -0
  72. package/cpmm/artifacts/ts/MathTest.ts +183 -0
  73. package/cpmm/artifacts/ts/Router.ts +554 -0
  74. package/cpmm/artifacts/ts/TestToken.ts +312 -0
  75. package/cpmm/artifacts/ts/TokenPair.ts +947 -0
  76. package/cpmm/artifacts/ts/TokenPairFactory.ts +501 -0
  77. package/cpmm/artifacts/ts/contracts.ts +26 -0
  78. package/cpmm/artifacts/ts/deployments.ts +109 -0
  79. package/cpmm/artifacts/ts/index.ts +16 -0
  80. package/cpmm/artifacts/ts/scripts.ts +142 -0
  81. package/cpmm/deployments/.deployments.devnet.json +77 -0
  82. package/cpmm/deployments/.deployments.testnet.json +79 -0
  83. package/lib/index.d.mts +8800 -0
  84. package/lib/index.d.ts +8800 -0
  85. package/lib/index.js +21769 -0
  86. package/lib/index.js.map +1 -0
  87. package/lib/index.mjs +22118 -0
  88. package/lib/index.mjs.map +1 -0
  89. package/package.json +80 -0
  90. package/src/clmm/clmm.ts +607 -0
  91. package/src/clmm/constants.ts +7 -0
  92. package/src/clmm/index.ts +6 -0
  93. package/src/clmm/liquidity.ts +163 -0
  94. package/src/clmm/pool.ts +154 -0
  95. package/src/clmm/tick.ts +335 -0
  96. package/src/clmm/types.ts +155 -0
  97. package/src/common/constants.ts +1 -0
  98. package/src/common/error.ts +46 -0
  99. package/src/common/index.ts +7 -0
  100. package/src/common/logger.ts +82 -0
  101. package/src/common/math.ts +88 -0
  102. package/src/common/numeric.ts +64 -0
  103. package/src/common/types.ts +49 -0
  104. package/src/common/utils.ts +3 -0
  105. package/src/cpmm/constants.ts +2 -0
  106. package/src/cpmm/cpmm.ts +631 -0
  107. package/src/cpmm/index.ts +3 -0
  108. package/src/cpmm/types.ts +113 -0
  109. package/src/index.ts +25 -0
  110. package/src/moduleBase.ts +64 -0
  111. package/src/staking/index.ts +4 -0
  112. package/src/staking/settings.ts +38 -0
  113. package/src/staking/staking.ts +277 -0
  114. package/src/staking/types.ts +15 -0
  115. package/src/staking/utils.ts +25 -0
  116. package/src/token/index.ts +1 -0
  117. package/src/token/token.ts +163 -0
  118. package/src/zeta.ts +105 -0
  119. package/staking/artifacts/AlphStakeAndLock.ral.json +31 -0
  120. package/staking/artifacts/AlphUnstakeVault.ral.json +151 -0
  121. package/staking/artifacts/XAlphStakeVault.ral.json +559 -0
  122. package/staking/artifacts/XAlphToken.ral.json +404 -0
  123. package/staking/artifacts/XAlphUnlockAndStartUnstake.ral.json +31 -0
  124. package/staking/artifacts/examples/GovernanceDemo.ral.json +282 -0
  125. package/staking/artifacts/examples/RewardSharingVault.ral.json +253 -0
  126. package/staking/artifacts/structs.ral.json +47 -0
  127. package/staking/artifacts/ts/AlphUnstakeVault.ts +354 -0
  128. package/staking/artifacts/ts/FullMathTest.ts +175 -0
  129. package/staking/artifacts/ts/GovernanceDemo.ts +726 -0
  130. package/staking/artifacts/ts/RewardSharingVault.ts +559 -0
  131. package/staking/artifacts/ts/TestDynamicArrayByteVec32.ts +431 -0
  132. package/staking/artifacts/ts/TestDynamicSortedArrayForU256.ts +516 -0
  133. package/staking/artifacts/ts/TestMerkleProof.ts +343 -0
  134. package/staking/artifacts/ts/XAlphStakeVault.ts +1120 -0
  135. package/staking/artifacts/ts/XAlphToken.ts +835 -0
  136. package/staking/artifacts/ts/contracts.ts +26 -0
  137. package/staking/artifacts/ts/deployments.ts +109 -0
  138. package/staking/artifacts/ts/index.ts +15 -0
  139. package/staking/artifacts/ts/scripts.ts +35 -0
  140. package/staking/artifacts/ts/types.ts +19 -0
  141. package/staking/artifacts/utils/FullMathTest.ral.json +57 -0
  142. package/staking/artifacts/utils/TestDynamicArrayByteVec32.ral.json +165 -0
  143. package/staking/artifacts/utils/TestDynamicSortedArrayForU256.ral.json +189 -0
  144. package/staking/artifacts/utils/TestMerkleProof.ral.json +134 -0
  145. package/staking/deployments/.deployments.devnet.json +77 -0
  146. package/staking/deployments/.deployments.testnet.json +78 -0
@@ -0,0 +1,512 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import {
6
+ Address,
7
+ Contract,
8
+ ContractState,
9
+ TestContractResult,
10
+ HexString,
11
+ ContractFactory,
12
+ EventSubscribeOptions,
13
+ EventSubscription,
14
+ CallContractParams,
15
+ CallContractResult,
16
+ TestContractParams,
17
+ ContractEvent,
18
+ subscribeContractEvent,
19
+ subscribeContractEvents,
20
+ testMethod,
21
+ callMethod,
22
+ multicallMethods,
23
+ fetchContractState,
24
+ Asset,
25
+ ContractInstance,
26
+ getContractEventsCurrentCount,
27
+ TestContractParamsWithoutMaps,
28
+ TestContractResultWithoutMaps,
29
+ SignExecuteContractMethodParams,
30
+ SignExecuteScriptTxResult,
31
+ signExecuteMethod,
32
+ addStdIdToFields,
33
+ encodeContractFields,
34
+ Narrow,
35
+ } from "@alephium/web3";
36
+ import { default as TickBitmapTestContractJson } from "../TickBitmapTest.ral.json";
37
+ import { getContractByCodeHash, registerContract } from "./contracts";
38
+ import * as types from "./types";
39
+
40
+ // Custom types for the contract
41
+ export namespace TickBitmapTestTypes {
42
+ export type Fields = {
43
+ wordTemplate: HexString;
44
+ tickSpacing: bigint;
45
+ };
46
+
47
+ export type State = ContractState<Fields>;
48
+
49
+ export interface CallMethodTable {
50
+ wordPath: {
51
+ params: CallContractParams<{ compressed: bigint }>;
52
+ result: CallContractResult<HexString>;
53
+ };
54
+ getWord: {
55
+ params: CallContractParams<{ compressed: bigint }>;
56
+ result: CallContractResult<HexString>;
57
+ };
58
+ getWordOrTemplate: {
59
+ params: CallContractParams<{ compressed: bigint }>;
60
+ result: CallContractResult<HexString>;
61
+ };
62
+ flipTick: {
63
+ params: CallContractParams<{ tick: bigint }>;
64
+ result: CallContractResult<null>;
65
+ };
66
+ nextInitializedTickWithinOneWord: {
67
+ params: CallContractParams<{ tick: bigint; zeroForOne: boolean }>;
68
+ result: CallContractResult<[bigint, boolean]>;
69
+ };
70
+ positionPath: {
71
+ params: CallContractParams<{
72
+ o: Address;
73
+ tickLower: bigint;
74
+ tickUpper: bigint;
75
+ }>;
76
+ result: CallContractResult<HexString>;
77
+ };
78
+ positionContractId: {
79
+ params: CallContractParams<{
80
+ pool: HexString;
81
+ o: Address;
82
+ tickLower: bigint;
83
+ tickUpper: bigint;
84
+ }>;
85
+ result: CallContractResult<HexString>;
86
+ };
87
+ deploy: {
88
+ params: CallContractParams<{
89
+ payer: Address;
90
+ word: HexString;
91
+ ts: bigint;
92
+ }>;
93
+ result: CallContractResult<HexString>;
94
+ };
95
+ flipTick_: {
96
+ params: CallContractParams<{ tick: bigint }>;
97
+ result: CallContractResult<null>;
98
+ };
99
+ }
100
+ export type CallMethodParams<T extends keyof CallMethodTable> =
101
+ CallMethodTable[T]["params"];
102
+ export type CallMethodResult<T extends keyof CallMethodTable> =
103
+ CallMethodTable[T]["result"];
104
+ export type MultiCallParams = Partial<{
105
+ [Name in keyof CallMethodTable]: CallMethodTable[Name]["params"];
106
+ }>;
107
+ export type MultiCallResults<T extends MultiCallParams> = {
108
+ [MaybeName in keyof T]: MaybeName extends keyof CallMethodTable
109
+ ? CallMethodTable[MaybeName]["result"]
110
+ : undefined;
111
+ };
112
+ export type MulticallReturnType<Callss extends MultiCallParams[]> = {
113
+ [index in keyof Callss]: MultiCallResults<Callss[index]>;
114
+ };
115
+
116
+ export interface SignExecuteMethodTable {
117
+ wordPath: {
118
+ params: SignExecuteContractMethodParams<{ compressed: bigint }>;
119
+ result: SignExecuteScriptTxResult;
120
+ };
121
+ getWord: {
122
+ params: SignExecuteContractMethodParams<{ compressed: bigint }>;
123
+ result: SignExecuteScriptTxResult;
124
+ };
125
+ getWordOrTemplate: {
126
+ params: SignExecuteContractMethodParams<{ compressed: bigint }>;
127
+ result: SignExecuteScriptTxResult;
128
+ };
129
+ flipTick: {
130
+ params: SignExecuteContractMethodParams<{ tick: bigint }>;
131
+ result: SignExecuteScriptTxResult;
132
+ };
133
+ nextInitializedTickWithinOneWord: {
134
+ params: SignExecuteContractMethodParams<{
135
+ tick: bigint;
136
+ zeroForOne: boolean;
137
+ }>;
138
+ result: SignExecuteScriptTxResult;
139
+ };
140
+ positionPath: {
141
+ params: SignExecuteContractMethodParams<{
142
+ o: Address;
143
+ tickLower: bigint;
144
+ tickUpper: bigint;
145
+ }>;
146
+ result: SignExecuteScriptTxResult;
147
+ };
148
+ positionContractId: {
149
+ params: SignExecuteContractMethodParams<{
150
+ pool: HexString;
151
+ o: Address;
152
+ tickLower: bigint;
153
+ tickUpper: bigint;
154
+ }>;
155
+ result: SignExecuteScriptTxResult;
156
+ };
157
+ deploy: {
158
+ params: SignExecuteContractMethodParams<{
159
+ payer: Address;
160
+ word: HexString;
161
+ ts: bigint;
162
+ }>;
163
+ result: SignExecuteScriptTxResult;
164
+ };
165
+ flipTick_: {
166
+ params: SignExecuteContractMethodParams<{ tick: bigint }>;
167
+ result: SignExecuteScriptTxResult;
168
+ };
169
+ }
170
+ export type SignExecuteMethodParams<T extends keyof SignExecuteMethodTable> =
171
+ SignExecuteMethodTable[T]["params"];
172
+ export type SignExecuteMethodResult<T extends keyof SignExecuteMethodTable> =
173
+ SignExecuteMethodTable[T]["result"];
174
+ }
175
+
176
+ class Factory extends ContractFactory<
177
+ TickBitmapTestInstance,
178
+ TickBitmapTestTypes.Fields
179
+ > {
180
+ encodeFields(fields: TickBitmapTestTypes.Fields) {
181
+ return encodeContractFields(
182
+ addStdIdToFields(this.contract, fields),
183
+ this.contract.fieldsSig,
184
+ types.AllStructs
185
+ );
186
+ }
187
+
188
+ consts = {
189
+ TickBitmapError: { TickNotAligned: BigInt("301") },
190
+ PathPrefixes: {
191
+ Tick: BigInt("0"),
192
+ Position: BigInt("1"),
193
+ Word: BigInt("2"),
194
+ },
195
+ };
196
+
197
+ at(address: string): TickBitmapTestInstance {
198
+ return new TickBitmapTestInstance(address);
199
+ }
200
+
201
+ tests = {
202
+ wordPath: async (
203
+ params: TestContractParamsWithoutMaps<
204
+ TickBitmapTestTypes.Fields,
205
+ { compressed: bigint }
206
+ >
207
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
208
+ return testMethod(this, "wordPath", params, getContractByCodeHash);
209
+ },
210
+ getWord: async (
211
+ params: TestContractParamsWithoutMaps<
212
+ TickBitmapTestTypes.Fields,
213
+ { compressed: bigint }
214
+ >
215
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
216
+ return testMethod(this, "getWord", params, getContractByCodeHash);
217
+ },
218
+ getWordOrTemplate: async (
219
+ params: TestContractParamsWithoutMaps<
220
+ TickBitmapTestTypes.Fields,
221
+ { compressed: bigint }
222
+ >
223
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
224
+ return testMethod(
225
+ this,
226
+ "getWordOrTemplate",
227
+ params,
228
+ getContractByCodeHash
229
+ );
230
+ },
231
+ flipTick: async (
232
+ params: TestContractParamsWithoutMaps<
233
+ TickBitmapTestTypes.Fields,
234
+ { tick: bigint }
235
+ >
236
+ ): Promise<TestContractResultWithoutMaps<null>> => {
237
+ return testMethod(this, "flipTick", params, getContractByCodeHash);
238
+ },
239
+ nextInitializedTickWithinOneWord: async (
240
+ params: TestContractParamsWithoutMaps<
241
+ TickBitmapTestTypes.Fields,
242
+ { tick: bigint; zeroForOne: boolean }
243
+ >
244
+ ): Promise<TestContractResultWithoutMaps<[bigint, boolean]>> => {
245
+ return testMethod(
246
+ this,
247
+ "nextInitializedTickWithinOneWord",
248
+ params,
249
+ getContractByCodeHash
250
+ );
251
+ },
252
+ positionPath: async (
253
+ params: TestContractParamsWithoutMaps<
254
+ TickBitmapTestTypes.Fields,
255
+ { o: Address; tickLower: bigint; tickUpper: bigint }
256
+ >
257
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
258
+ return testMethod(this, "positionPath", params, getContractByCodeHash);
259
+ },
260
+ positionContractId: async (
261
+ params: TestContractParamsWithoutMaps<
262
+ TickBitmapTestTypes.Fields,
263
+ { pool: HexString; o: Address; tickLower: bigint; tickUpper: bigint }
264
+ >
265
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
266
+ return testMethod(
267
+ this,
268
+ "positionContractId",
269
+ params,
270
+ getContractByCodeHash
271
+ );
272
+ },
273
+ deploy: async (
274
+ params: TestContractParamsWithoutMaps<
275
+ TickBitmapTestTypes.Fields,
276
+ { payer: Address; word: HexString; ts: bigint }
277
+ >
278
+ ): Promise<TestContractResultWithoutMaps<HexString>> => {
279
+ return testMethod(this, "deploy", params, getContractByCodeHash);
280
+ },
281
+ flipTick_: async (
282
+ params: TestContractParamsWithoutMaps<
283
+ TickBitmapTestTypes.Fields,
284
+ { tick: bigint }
285
+ >
286
+ ): Promise<TestContractResultWithoutMaps<null>> => {
287
+ return testMethod(this, "flipTick_", params, getContractByCodeHash);
288
+ },
289
+ };
290
+
291
+ stateForTest(
292
+ initFields: TickBitmapTestTypes.Fields,
293
+ asset?: Asset,
294
+ address?: string
295
+ ) {
296
+ return this.stateForTest_(initFields, asset, address, undefined);
297
+ }
298
+ }
299
+
300
+ // Use this object to test and deploy the contract
301
+ export const TickBitmapTest = new Factory(
302
+ Contract.fromJson(
303
+ TickBitmapTestContractJson,
304
+ "",
305
+ "5cb6cce5c5b8adb88a18a993227d51465e3e54b5a34936cafc51100725724b54",
306
+ types.AllStructs
307
+ )
308
+ );
309
+ registerContract(TickBitmapTest);
310
+
311
+ // Use this class to interact with the blockchain
312
+ export class TickBitmapTestInstance extends ContractInstance {
313
+ constructor(address: Address) {
314
+ super(address);
315
+ }
316
+
317
+ async fetchState(): Promise<TickBitmapTestTypes.State> {
318
+ return fetchContractState(TickBitmapTest, this);
319
+ }
320
+
321
+ view = {
322
+ wordPath: async (
323
+ params: TickBitmapTestTypes.CallMethodParams<"wordPath">
324
+ ): Promise<TickBitmapTestTypes.CallMethodResult<"wordPath">> => {
325
+ return callMethod(
326
+ TickBitmapTest,
327
+ this,
328
+ "wordPath",
329
+ params,
330
+ getContractByCodeHash
331
+ );
332
+ },
333
+ getWord: async (
334
+ params: TickBitmapTestTypes.CallMethodParams<"getWord">
335
+ ): Promise<TickBitmapTestTypes.CallMethodResult<"getWord">> => {
336
+ return callMethod(
337
+ TickBitmapTest,
338
+ this,
339
+ "getWord",
340
+ params,
341
+ getContractByCodeHash
342
+ );
343
+ },
344
+ getWordOrTemplate: async (
345
+ params: TickBitmapTestTypes.CallMethodParams<"getWordOrTemplate">
346
+ ): Promise<TickBitmapTestTypes.CallMethodResult<"getWordOrTemplate">> => {
347
+ return callMethod(
348
+ TickBitmapTest,
349
+ this,
350
+ "getWordOrTemplate",
351
+ params,
352
+ getContractByCodeHash
353
+ );
354
+ },
355
+ flipTick: async (
356
+ params: TickBitmapTestTypes.CallMethodParams<"flipTick">
357
+ ): Promise<TickBitmapTestTypes.CallMethodResult<"flipTick">> => {
358
+ return callMethod(
359
+ TickBitmapTest,
360
+ this,
361
+ "flipTick",
362
+ params,
363
+ getContractByCodeHash
364
+ );
365
+ },
366
+ nextInitializedTickWithinOneWord: async (
367
+ params: TickBitmapTestTypes.CallMethodParams<"nextInitializedTickWithinOneWord">
368
+ ): Promise<
369
+ TickBitmapTestTypes.CallMethodResult<"nextInitializedTickWithinOneWord">
370
+ > => {
371
+ return callMethod(
372
+ TickBitmapTest,
373
+ this,
374
+ "nextInitializedTickWithinOneWord",
375
+ params,
376
+ getContractByCodeHash
377
+ );
378
+ },
379
+ positionPath: async (
380
+ params: TickBitmapTestTypes.CallMethodParams<"positionPath">
381
+ ): Promise<TickBitmapTestTypes.CallMethodResult<"positionPath">> => {
382
+ return callMethod(
383
+ TickBitmapTest,
384
+ this,
385
+ "positionPath",
386
+ params,
387
+ getContractByCodeHash
388
+ );
389
+ },
390
+ positionContractId: async (
391
+ params: TickBitmapTestTypes.CallMethodParams<"positionContractId">
392
+ ): Promise<TickBitmapTestTypes.CallMethodResult<"positionContractId">> => {
393
+ return callMethod(
394
+ TickBitmapTest,
395
+ this,
396
+ "positionContractId",
397
+ params,
398
+ getContractByCodeHash
399
+ );
400
+ },
401
+ deploy: async (
402
+ params: TickBitmapTestTypes.CallMethodParams<"deploy">
403
+ ): Promise<TickBitmapTestTypes.CallMethodResult<"deploy">> => {
404
+ return callMethod(
405
+ TickBitmapTest,
406
+ this,
407
+ "deploy",
408
+ params,
409
+ getContractByCodeHash
410
+ );
411
+ },
412
+ flipTick_: async (
413
+ params: TickBitmapTestTypes.CallMethodParams<"flipTick_">
414
+ ): Promise<TickBitmapTestTypes.CallMethodResult<"flipTick_">> => {
415
+ return callMethod(
416
+ TickBitmapTest,
417
+ this,
418
+ "flipTick_",
419
+ params,
420
+ getContractByCodeHash
421
+ );
422
+ },
423
+ };
424
+
425
+ transact = {
426
+ wordPath: async (
427
+ params: TickBitmapTestTypes.SignExecuteMethodParams<"wordPath">
428
+ ): Promise<TickBitmapTestTypes.SignExecuteMethodResult<"wordPath">> => {
429
+ return signExecuteMethod(TickBitmapTest, this, "wordPath", params);
430
+ },
431
+ getWord: async (
432
+ params: TickBitmapTestTypes.SignExecuteMethodParams<"getWord">
433
+ ): Promise<TickBitmapTestTypes.SignExecuteMethodResult<"getWord">> => {
434
+ return signExecuteMethod(TickBitmapTest, this, "getWord", params);
435
+ },
436
+ getWordOrTemplate: async (
437
+ params: TickBitmapTestTypes.SignExecuteMethodParams<"getWordOrTemplate">
438
+ ): Promise<
439
+ TickBitmapTestTypes.SignExecuteMethodResult<"getWordOrTemplate">
440
+ > => {
441
+ return signExecuteMethod(
442
+ TickBitmapTest,
443
+ this,
444
+ "getWordOrTemplate",
445
+ params
446
+ );
447
+ },
448
+ flipTick: async (
449
+ params: TickBitmapTestTypes.SignExecuteMethodParams<"flipTick">
450
+ ): Promise<TickBitmapTestTypes.SignExecuteMethodResult<"flipTick">> => {
451
+ return signExecuteMethod(TickBitmapTest, this, "flipTick", params);
452
+ },
453
+ nextInitializedTickWithinOneWord: async (
454
+ params: TickBitmapTestTypes.SignExecuteMethodParams<"nextInitializedTickWithinOneWord">
455
+ ): Promise<
456
+ TickBitmapTestTypes.SignExecuteMethodResult<"nextInitializedTickWithinOneWord">
457
+ > => {
458
+ return signExecuteMethod(
459
+ TickBitmapTest,
460
+ this,
461
+ "nextInitializedTickWithinOneWord",
462
+ params
463
+ );
464
+ },
465
+ positionPath: async (
466
+ params: TickBitmapTestTypes.SignExecuteMethodParams<"positionPath">
467
+ ): Promise<TickBitmapTestTypes.SignExecuteMethodResult<"positionPath">> => {
468
+ return signExecuteMethod(TickBitmapTest, this, "positionPath", params);
469
+ },
470
+ positionContractId: async (
471
+ params: TickBitmapTestTypes.SignExecuteMethodParams<"positionContractId">
472
+ ): Promise<
473
+ TickBitmapTestTypes.SignExecuteMethodResult<"positionContractId">
474
+ > => {
475
+ return signExecuteMethod(
476
+ TickBitmapTest,
477
+ this,
478
+ "positionContractId",
479
+ params
480
+ );
481
+ },
482
+ deploy: async (
483
+ params: TickBitmapTestTypes.SignExecuteMethodParams<"deploy">
484
+ ): Promise<TickBitmapTestTypes.SignExecuteMethodResult<"deploy">> => {
485
+ return signExecuteMethod(TickBitmapTest, this, "deploy", params);
486
+ },
487
+ flipTick_: async (
488
+ params: TickBitmapTestTypes.SignExecuteMethodParams<"flipTick_">
489
+ ): Promise<TickBitmapTestTypes.SignExecuteMethodResult<"flipTick_">> => {
490
+ return signExecuteMethod(TickBitmapTest, this, "flipTick_", params);
491
+ },
492
+ };
493
+
494
+ async multicall<Calls extends TickBitmapTestTypes.MultiCallParams>(
495
+ calls: Calls
496
+ ): Promise<TickBitmapTestTypes.MultiCallResults<Calls>>;
497
+ async multicall<Callss extends TickBitmapTestTypes.MultiCallParams[]>(
498
+ callss: Narrow<Callss>
499
+ ): Promise<TickBitmapTestTypes.MulticallReturnType<Callss>>;
500
+ async multicall<
501
+ Callss extends
502
+ | TickBitmapTestTypes.MultiCallParams
503
+ | TickBitmapTestTypes.MultiCallParams[]
504
+ >(callss: Callss): Promise<unknown> {
505
+ return await multicallMethods(
506
+ TickBitmapTest,
507
+ this,
508
+ callss,
509
+ getContractByCodeHash
510
+ );
511
+ }
512
+ }
@@ -0,0 +1,17 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ export const MIN_TICK = BigInt("-887272");
6
+ export const MAX_TICK = BigInt("887272");
7
+ export const MIN_SQRT_RATIO = BigInt("4295128739");
8
+ export const MAX_SQRT_RATIO = BigInt(
9
+ "1461446703485210103287273052203988822378723970342"
10
+ );
11
+ export const Q128 = BigInt("340282366920938463463374607431768211456");
12
+ export const U128_MAX = BigInt("340282366920938463463374607431768211455");
13
+ export const Q64 = BigInt("18446744073709551616");
14
+ export const Q32 = BigInt("4294967296");
15
+ export const Q96 = BigInt("79228162514264337593543950336");
16
+ export const Q160 = BigInt("1461501637330902918203684832716283019655932542976");
17
+ export const MAX_REWARDS = BigInt("3");
@@ -0,0 +1,26 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import { Contract, ContractFactory } from "@alephium/web3";
6
+
7
+ let contracts: ContractFactory<any>[] | undefined = undefined;
8
+
9
+ export function getAllContracts(): ContractFactory<any>[] {
10
+ return contracts ?? [];
11
+ }
12
+
13
+ export function registerContract(factory: ContractFactory<any>) {
14
+ if (contracts === undefined) {
15
+ contracts = [factory];
16
+ } else {
17
+ contracts.push(factory);
18
+ }
19
+ }
20
+ export function getContractByCodeHash(codeHash: string): Contract {
21
+ const c = contracts?.find((c) => c.contract.hasCodeHash(codeHash));
22
+ if (c === undefined) {
23
+ throw new Error("Unknown code with code hash: " + codeHash);
24
+ }
25
+ return c.contract;
26
+ }