@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,46 @@
1
+ {
2
+ "version": "v4.2.5",
3
+ "name": "SwapMaxIn",
4
+ "bytecodeTemplate": "0101030002001fb41700{0}160047cc17011601c5194c0516000d0c{0}d465b302f9{1}{4}{5}a3{3}{1}{4}{5}{6}{1}{7}13070c{2}0105",
5
+ "fieldsSig": {
6
+ "names": [
7
+ "dexAccount",
8
+ "sender",
9
+ "router",
10
+ "pair",
11
+ "tokenInId",
12
+ "amountInMax",
13
+ "amountOut",
14
+ "deadline"
15
+ ],
16
+ "types": [
17
+ "IDexAccount",
18
+ "Address",
19
+ "Router",
20
+ "TokenPair",
21
+ "ByteVec",
22
+ "U256",
23
+ "U256",
24
+ "U256"
25
+ ],
26
+ "isMutable": [
27
+ false,
28
+ false,
29
+ false,
30
+ false,
31
+ false,
32
+ false,
33
+ false,
34
+ false
35
+ ]
36
+ },
37
+ "functions": [
38
+ {
39
+ "name": "main",
40
+ "paramNames": [],
41
+ "paramTypes": [],
42
+ "paramIsMutable": [],
43
+ "returnTypes": []
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "version": "v4.2.5",
3
+ "name": "SwapMinOut",
4
+ "bytecodeTemplate": "0101030002001fb41700{0}160047cc17011601c5194c0516000d0c{0}d465b302f9{1}{4}{5}a3{3}{1}{4}{5}{6}{1}{7}13070c{2}0104",
5
+ "fieldsSig": {
6
+ "names": [
7
+ "dexAccount",
8
+ "sender",
9
+ "router",
10
+ "pair",
11
+ "tokenInId",
12
+ "amountIn",
13
+ "amountOutMin",
14
+ "deadline"
15
+ ],
16
+ "types": [
17
+ "IDexAccount",
18
+ "Address",
19
+ "Router",
20
+ "TokenPair",
21
+ "ByteVec",
22
+ "U256",
23
+ "U256",
24
+ "U256"
25
+ ],
26
+ "isMutable": [
27
+ false,
28
+ false,
29
+ false,
30
+ false,
31
+ false,
32
+ false,
33
+ false,
34
+ false
35
+ ]
36
+ },
37
+ "functions": [
38
+ {
39
+ "name": "main",
40
+ "paramNames": [],
41
+ "paramTypes": [],
42
+ "paramIsMutable": [],
43
+ "returnTypes": []
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "version": "v4.0.0",
3
+ "name": "GetToken",
4
+ "bytecodeTemplate": "01010300000006{1}{2}0e0c{0}0104",
5
+ "fieldsSig": {
6
+ "names": [
7
+ "token",
8
+ "sender",
9
+ "amount"
10
+ ],
11
+ "types": [
12
+ "TestToken",
13
+ "Address",
14
+ "U256"
15
+ ],
16
+ "isMutable": [
17
+ false,
18
+ false,
19
+ false
20
+ ]
21
+ },
22
+ "functions": [
23
+ {
24
+ "name": "main",
25
+ "paramNames": [],
26
+ "paramTypes": [],
27
+ "paramIsMutable": [],
28
+ "returnTypes": []
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "version": "v4.0.0",
3
+ "name": "MathTest",
4
+ "bytecode": "0002174053010002020109d38c844efd16000d1340703b2c16012d0201000103014020d36ae1998016000f334c191600170116000e2d0d2a170216021601314c0b16021701160016022d16022a0e2d17024a311601020d02",
5
+ "codeHash": "732c8ff5b38eadaa96074453394619cb78ddf7371ff94ce7fb3dbe5fe332655c",
6
+ "fieldsSig": {
7
+ "names": [],
8
+ "types": [],
9
+ "isMutable": []
10
+ },
11
+ "eventsSig": [],
12
+ "functions": [
13
+ {
14
+ "name": "uqdiv",
15
+ "paramNames": [
16
+ "a",
17
+ "b"
18
+ ],
19
+ "paramTypes": [
20
+ "U256",
21
+ "U256"
22
+ ],
23
+ "paramIsMutable": [
24
+ false,
25
+ false
26
+ ],
27
+ "returnTypes": [
28
+ "U256"
29
+ ]
30
+ },
31
+ {
32
+ "name": "sqrt",
33
+ "paramNames": [
34
+ "y"
35
+ ],
36
+ "paramTypes": [
37
+ "U256"
38
+ ],
39
+ "paramIsMutable": [
40
+ false
41
+ ],
42
+ "returnTypes": [
43
+ "U256"
44
+ ]
45
+ }
46
+ ],
47
+ "constants": [],
48
+ "enums": []
49
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "version": "v4.0.0",
3
+ "name": "TestToken",
4
+ "bytecode": "050509121b40244035010000000102ce0002010000000102ce0102010000000102ce0202010000000102ce0302010202020005d359e9ded71600b11601ab",
5
+ "codeHash": "f9dac4e7d0bf28a2bc019f43138339e23afadde322d50441cdfe029993bf35f3",
6
+ "fieldsSig": {
7
+ "names": [
8
+ "symbol",
9
+ "name",
10
+ "decimals",
11
+ "totalSupply",
12
+ "__stdInterfaceId"
13
+ ],
14
+ "types": [
15
+ "ByteVec",
16
+ "ByteVec",
17
+ "U256",
18
+ "U256",
19
+ "ByteVec"
20
+ ],
21
+ "isMutable": [
22
+ false,
23
+ false,
24
+ false,
25
+ false,
26
+ false
27
+ ]
28
+ },
29
+ "eventsSig": [],
30
+ "functions": [
31
+ {
32
+ "name": "getSymbol",
33
+ "paramNames": [],
34
+ "paramTypes": [],
35
+ "paramIsMutable": [],
36
+ "returnTypes": [
37
+ "ByteVec"
38
+ ]
39
+ },
40
+ {
41
+ "name": "getName",
42
+ "paramNames": [],
43
+ "paramTypes": [],
44
+ "paramIsMutable": [],
45
+ "returnTypes": [
46
+ "ByteVec"
47
+ ]
48
+ },
49
+ {
50
+ "name": "getDecimals",
51
+ "paramNames": [],
52
+ "paramTypes": [],
53
+ "paramIsMutable": [],
54
+ "returnTypes": [
55
+ "U256"
56
+ ]
57
+ },
58
+ {
59
+ "name": "getTotalSupply",
60
+ "paramNames": [],
61
+ "paramTypes": [],
62
+ "paramIsMutable": [],
63
+ "returnTypes": [
64
+ "U256"
65
+ ]
66
+ },
67
+ {
68
+ "name": "getToken",
69
+ "paramNames": [
70
+ "sender",
71
+ "amount"
72
+ ],
73
+ "paramTypes": [
74
+ "Address",
75
+ "U256"
76
+ ],
77
+ "paramIsMutable": [
78
+ false,
79
+ false
80
+ ],
81
+ "returnTypes": []
82
+ }
83
+ ],
84
+ "constants": [],
85
+ "enums": [],
86
+ "stdInterfaceId": "0001"
87
+ }
@@ -0,0 +1,329 @@
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 DexAccountContractJson } from "../dex/DexAccount.ral.json";
37
+ import { getContractByCodeHash, registerContract } from "./contracts";
38
+
39
+ // Custom types for the contract
40
+ export namespace DexAccountTypes {
41
+ export type Fields = {
42
+ parents: [HexString, HexString];
43
+ owner: Address;
44
+ refferer: Address;
45
+ counter: bigint;
46
+ };
47
+
48
+ export type State = ContractState<Fields>;
49
+
50
+ export interface CallMethodTable {
51
+ deposit: {
52
+ params: CallContractParams<{
53
+ payer: Address;
54
+ tokenId: HexString;
55
+ amount: bigint;
56
+ path: HexString;
57
+ at: bigint;
58
+ }>;
59
+ result: CallContractResult<null>;
60
+ };
61
+ createAccount: {
62
+ params: CallContractParams<{ ref: Address }>;
63
+ result: CallContractResult<null>;
64
+ };
65
+ asRef: {
66
+ params: CallContractParams<{ defaultRef: Address }>;
67
+ result: CallContractResult<Address>;
68
+ };
69
+ updateCounter: {
70
+ params: CallContractParams<{ newCounter: bigint }>;
71
+ result: CallContractResult<null>;
72
+ };
73
+ setParents: {
74
+ params: CallContractParams<{ newParents: [HexString, HexString] }>;
75
+ result: CallContractResult<null>;
76
+ };
77
+ }
78
+ export type CallMethodParams<T extends keyof CallMethodTable> =
79
+ CallMethodTable[T]["params"];
80
+ export type CallMethodResult<T extends keyof CallMethodTable> =
81
+ CallMethodTable[T]["result"];
82
+ export type MultiCallParams = Partial<{
83
+ [Name in keyof CallMethodTable]: CallMethodTable[Name]["params"];
84
+ }>;
85
+ export type MultiCallResults<T extends MultiCallParams> = {
86
+ [MaybeName in keyof T]: MaybeName extends keyof CallMethodTable
87
+ ? CallMethodTable[MaybeName]["result"]
88
+ : undefined;
89
+ };
90
+ export type MulticallReturnType<Callss extends MultiCallParams[]> = {
91
+ [index in keyof Callss]: MultiCallResults<Callss[index]>;
92
+ };
93
+
94
+ export interface SignExecuteMethodTable {
95
+ deposit: {
96
+ params: SignExecuteContractMethodParams<{
97
+ payer: Address;
98
+ tokenId: HexString;
99
+ amount: bigint;
100
+ path: HexString;
101
+ at: bigint;
102
+ }>;
103
+ result: SignExecuteScriptTxResult;
104
+ };
105
+ createAccount: {
106
+ params: SignExecuteContractMethodParams<{ ref: Address }>;
107
+ result: SignExecuteScriptTxResult;
108
+ };
109
+ asRef: {
110
+ params: SignExecuteContractMethodParams<{ defaultRef: Address }>;
111
+ result: SignExecuteScriptTxResult;
112
+ };
113
+ updateCounter: {
114
+ params: SignExecuteContractMethodParams<{ newCounter: bigint }>;
115
+ result: SignExecuteScriptTxResult;
116
+ };
117
+ setParents: {
118
+ params: SignExecuteContractMethodParams<{
119
+ newParents: [HexString, HexString];
120
+ }>;
121
+ result: SignExecuteScriptTxResult;
122
+ };
123
+ }
124
+ export type SignExecuteMethodParams<T extends keyof SignExecuteMethodTable> =
125
+ SignExecuteMethodTable[T]["params"];
126
+ export type SignExecuteMethodResult<T extends keyof SignExecuteMethodTable> =
127
+ SignExecuteMethodTable[T]["result"];
128
+ }
129
+
130
+ class Factory extends ContractFactory<
131
+ DexAccountInstance,
132
+ DexAccountTypes.Fields
133
+ > {
134
+ encodeFields(fields: DexAccountTypes.Fields) {
135
+ return encodeContractFields(
136
+ addStdIdToFields(this.contract, fields),
137
+ this.contract.fieldsSig,
138
+ []
139
+ );
140
+ }
141
+
142
+ at(address: string): DexAccountInstance {
143
+ return new DexAccountInstance(address);
144
+ }
145
+
146
+ tests = {
147
+ deposit: async (
148
+ params: TestContractParamsWithoutMaps<
149
+ DexAccountTypes.Fields,
150
+ {
151
+ payer: Address;
152
+ tokenId: HexString;
153
+ amount: bigint;
154
+ path: HexString;
155
+ at: bigint;
156
+ }
157
+ >
158
+ ): Promise<TestContractResultWithoutMaps<null>> => {
159
+ return testMethod(this, "deposit", params, getContractByCodeHash);
160
+ },
161
+ createAccount: async (
162
+ params: TestContractParamsWithoutMaps<
163
+ DexAccountTypes.Fields,
164
+ { ref: Address }
165
+ >
166
+ ): Promise<TestContractResultWithoutMaps<null>> => {
167
+ return testMethod(this, "createAccount", params, getContractByCodeHash);
168
+ },
169
+ asRef: async (
170
+ params: TestContractParamsWithoutMaps<
171
+ DexAccountTypes.Fields,
172
+ { defaultRef: Address }
173
+ >
174
+ ): Promise<TestContractResultWithoutMaps<Address>> => {
175
+ return testMethod(this, "asRef", params, getContractByCodeHash);
176
+ },
177
+ updateCounter: async (
178
+ params: TestContractParamsWithoutMaps<
179
+ DexAccountTypes.Fields,
180
+ { newCounter: bigint }
181
+ >
182
+ ): Promise<TestContractResultWithoutMaps<null>> => {
183
+ return testMethod(this, "updateCounter", params, getContractByCodeHash);
184
+ },
185
+ setParents: async (
186
+ params: TestContractParamsWithoutMaps<
187
+ DexAccountTypes.Fields,
188
+ { newParents: [HexString, HexString] }
189
+ >
190
+ ): Promise<TestContractResultWithoutMaps<null>> => {
191
+ return testMethod(this, "setParents", params, getContractByCodeHash);
192
+ },
193
+ };
194
+
195
+ stateForTest(
196
+ initFields: DexAccountTypes.Fields,
197
+ asset?: Asset,
198
+ address?: string
199
+ ) {
200
+ return this.stateForTest_(initFields, asset, address, undefined);
201
+ }
202
+ }
203
+
204
+ // Use this object to test and deploy the contract
205
+ export const DexAccount = new Factory(
206
+ Contract.fromJson(
207
+ DexAccountContractJson,
208
+ "",
209
+ "66c27c91033d54a2d3edc97dbc36b35022274ddd8a7b84b724631ac37586ed48",
210
+ []
211
+ )
212
+ );
213
+ registerContract(DexAccount);
214
+
215
+ // Use this class to interact with the blockchain
216
+ export class DexAccountInstance extends ContractInstance {
217
+ constructor(address: Address) {
218
+ super(address);
219
+ }
220
+
221
+ async fetchState(): Promise<DexAccountTypes.State> {
222
+ return fetchContractState(DexAccount, this);
223
+ }
224
+
225
+ view = {
226
+ deposit: async (
227
+ params: DexAccountTypes.CallMethodParams<"deposit">
228
+ ): Promise<DexAccountTypes.CallMethodResult<"deposit">> => {
229
+ return callMethod(
230
+ DexAccount,
231
+ this,
232
+ "deposit",
233
+ params,
234
+ getContractByCodeHash
235
+ );
236
+ },
237
+ createAccount: async (
238
+ params: DexAccountTypes.CallMethodParams<"createAccount">
239
+ ): Promise<DexAccountTypes.CallMethodResult<"createAccount">> => {
240
+ return callMethod(
241
+ DexAccount,
242
+ this,
243
+ "createAccount",
244
+ params,
245
+ getContractByCodeHash
246
+ );
247
+ },
248
+ asRef: async (
249
+ params: DexAccountTypes.CallMethodParams<"asRef">
250
+ ): Promise<DexAccountTypes.CallMethodResult<"asRef">> => {
251
+ return callMethod(
252
+ DexAccount,
253
+ this,
254
+ "asRef",
255
+ params,
256
+ getContractByCodeHash
257
+ );
258
+ },
259
+ updateCounter: async (
260
+ params: DexAccountTypes.CallMethodParams<"updateCounter">
261
+ ): Promise<DexAccountTypes.CallMethodResult<"updateCounter">> => {
262
+ return callMethod(
263
+ DexAccount,
264
+ this,
265
+ "updateCounter",
266
+ params,
267
+ getContractByCodeHash
268
+ );
269
+ },
270
+ setParents: async (
271
+ params: DexAccountTypes.CallMethodParams<"setParents">
272
+ ): Promise<DexAccountTypes.CallMethodResult<"setParents">> => {
273
+ return callMethod(
274
+ DexAccount,
275
+ this,
276
+ "setParents",
277
+ params,
278
+ getContractByCodeHash
279
+ );
280
+ },
281
+ };
282
+
283
+ transact = {
284
+ deposit: async (
285
+ params: DexAccountTypes.SignExecuteMethodParams<"deposit">
286
+ ): Promise<DexAccountTypes.SignExecuteMethodResult<"deposit">> => {
287
+ return signExecuteMethod(DexAccount, this, "deposit", params);
288
+ },
289
+ createAccount: async (
290
+ params: DexAccountTypes.SignExecuteMethodParams<"createAccount">
291
+ ): Promise<DexAccountTypes.SignExecuteMethodResult<"createAccount">> => {
292
+ return signExecuteMethod(DexAccount, this, "createAccount", params);
293
+ },
294
+ asRef: async (
295
+ params: DexAccountTypes.SignExecuteMethodParams<"asRef">
296
+ ): Promise<DexAccountTypes.SignExecuteMethodResult<"asRef">> => {
297
+ return signExecuteMethod(DexAccount, this, "asRef", params);
298
+ },
299
+ updateCounter: async (
300
+ params: DexAccountTypes.SignExecuteMethodParams<"updateCounter">
301
+ ): Promise<DexAccountTypes.SignExecuteMethodResult<"updateCounter">> => {
302
+ return signExecuteMethod(DexAccount, this, "updateCounter", params);
303
+ },
304
+ setParents: async (
305
+ params: DexAccountTypes.SignExecuteMethodParams<"setParents">
306
+ ): Promise<DexAccountTypes.SignExecuteMethodResult<"setParents">> => {
307
+ return signExecuteMethod(DexAccount, this, "setParents", params);
308
+ },
309
+ };
310
+
311
+ async multicall<Calls extends DexAccountTypes.MultiCallParams>(
312
+ calls: Calls
313
+ ): Promise<DexAccountTypes.MultiCallResults<Calls>>;
314
+ async multicall<Callss extends DexAccountTypes.MultiCallParams[]>(
315
+ callss: Narrow<Callss>
316
+ ): Promise<DexAccountTypes.MulticallReturnType<Callss>>;
317
+ async multicall<
318
+ Callss extends
319
+ | DexAccountTypes.MultiCallParams
320
+ | DexAccountTypes.MultiCallParams[]
321
+ >(callss: Callss): Promise<unknown> {
322
+ return await multicallMethods(
323
+ DexAccount,
324
+ this,
325
+ callss,
326
+ getContractByCodeHash
327
+ );
328
+ }
329
+ }