@alephium/powfi-sdk 0.0.1-rc.2 → 0.0.1-rc.21

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 (60) hide show
  1. package/README.md +97 -1
  2. package/clmm/artifacts/BitmapWord.ral.json +1 -1
  3. package/clmm/artifacts/BitmapWordDeployer.ral.json +1 -1
  4. package/clmm/artifacts/CreateConfig.ral.json +1 -1
  5. package/clmm/artifacts/CreateLiquidPool.ral.json +1 -1
  6. package/clmm/artifacts/DexAccount.ral.json +1 -1
  7. package/clmm/artifacts/LiquidityAmountsTest.ral.json +1 -1
  8. package/clmm/artifacts/LiquidityManagmentTest.ral.json +1 -1
  9. package/clmm/artifacts/Pool.ral.json +14 -5
  10. package/clmm/artifacts/PoolConfig.ral.json +1 -1
  11. package/clmm/artifacts/PoolFactory.ral.json +1 -1
  12. package/clmm/artifacts/PoolRouterDemo.ral.json +2 -2
  13. package/clmm/artifacts/PoolUser.ral.json +1 -1
  14. package/clmm/artifacts/Position.ral.json +18 -4
  15. package/clmm/artifacts/PositionManager.ral.json +1 -1
  16. package/clmm/artifacts/SwapWithoutAccount.ral.json +2 -2
  17. package/clmm/artifacts/TestToken.ral.json +1 -1
  18. package/clmm/artifacts/Tick.ral.json +1 -1
  19. package/clmm/artifacts/TickBitmapTest.ral.json +1 -1
  20. package/clmm/artifacts/ts/Pool.ts +14 -2
  21. package/clmm/artifacts/ts/Position.ts +37 -3
  22. package/cpmm/artifacts/scripts/CreatePairAndAddLiquidity.ral.json +6 -3
  23. package/cpmm/artifacts/ts/scripts.ts +1 -0
  24. package/lib/index.d.mts +242 -119
  25. package/lib/index.d.ts +242 -119
  26. package/lib/index.js +627 -329
  27. package/lib/index.js.map +1 -1
  28. package/lib/index.mjs +628 -329
  29. package/lib/index.mjs.map +1 -1
  30. package/package.json +9 -8
  31. package/src/clmm/clmm.ts +70 -47
  32. package/src/clmm/liquidity.ts +1 -1
  33. package/src/clmm/pool.ts +15 -17
  34. package/src/clmm/tick.ts +21 -33
  35. package/src/clmm/types.ts +12 -12
  36. package/src/common/error.ts +7 -7
  37. package/src/common/types.ts +1 -1
  38. package/src/cpmm/cpmm.ts +135 -103
  39. package/src/cpmm/types.ts +48 -42
  40. package/src/index.ts +1 -1
  41. package/src/moduleBase.ts +3 -3
  42. package/src/{zeta.ts → powfi.ts} +5 -5
  43. package/src/staking/staking.ts +31 -24
  44. package/src/token/token.ts +2 -2
  45. package/staking/artifacts/AlphUnstakeVault.ral.json +13 -3
  46. package/staking/artifacts/XAlphStakeVault.ral.json +1 -1
  47. package/staking/artifacts/XAlphToken.ral.json +139 -6
  48. package/staking/artifacts/XAlphUnlockAndStartUnstake.ral.json +2 -2
  49. package/staking/artifacts/examples/GovernanceDemo.ral.json +1 -1
  50. package/staking/artifacts/examples/RewardSharingVault.ral.json +1 -1
  51. package/staking/artifacts/ts/AlphUnstakeVault.ts +40 -1
  52. package/staking/artifacts/ts/XAlphToken.ts +209 -8
  53. package/staking/artifacts/ts/scripts.ts +0 -10
  54. package/staking/artifacts/utils/FullMathTest.ral.json +1 -1
  55. package/staking/artifacts/utils/TestDynamicArrayByteVec32.ral.json +1 -1
  56. package/staking/artifacts/utils/TestDynamicSortedArrayForU256.ral.json +1 -1
  57. package/staking/artifacts/utils/TestMerkleProof.ral.json +1 -1
  58. package/staking/deployments/.deployments.devnet.json +45 -44
  59. package/staking/deployments/.deployments.testnet.json +23 -23
  60. package/staking/artifacts/AlphStakeAndLock.ral.json +0 -31
package/lib/index.d.mts CHANGED
@@ -3,6 +3,9 @@ import { ExecuteScriptResult, NetworkId, SignerProvider, Val, Address, HexString
3
3
  import { TokenInfo } from '@alephium/token-list';
4
4
  import Decimal from 'decimal.js';
5
5
 
6
+ type CpmmTokenId = string;
7
+ type CpmmSlippageBps = bigint;
8
+ type CpmmInputType = 'TokenA' | 'TokenB';
6
9
  interface CpmmConfig {
7
10
  groupIndex: number;
8
11
  factoryId: string;
@@ -18,16 +21,24 @@ interface CpmmPoolContractState {
18
21
  totalSupply: bigint;
19
22
  dexAccount: string;
20
23
  }
21
- interface SwapParams$1 {
22
- tokenIn: TokenInfo;
23
- tokenOut: TokenInfo;
24
+ interface CpmmSwapRequest {
25
+ tokenInId: CpmmTokenId;
26
+ tokenOutId: CpmmTokenId;
24
27
  amountIn?: bigint;
25
28
  amountOut?: bigint;
26
- slippage: bigint;
29
+ slippageBps: CpmmSlippageBps;
27
30
  sender: string;
28
- ttl?: number;
31
+ ttlMinutes?: number;
32
+ }
33
+ interface CpmmSwapQuoteParams {
34
+ state: CpmmPoolContractState;
35
+ tokenInId: CpmmTokenId;
36
+ tokenOutId: CpmmTokenId;
37
+ amountIn?: bigint;
38
+ amountOut?: bigint;
39
+ slippageBps: CpmmSlippageBps;
29
40
  }
30
- interface SwapDetails {
41
+ interface CpmmSwapQuote {
31
42
  swapType: 'ExactIn' | 'ExactOut';
32
43
  state: CpmmPoolContractState;
33
44
  tokenInInfo: TokenInfo;
@@ -38,17 +49,25 @@ interface SwapDetails {
38
49
  minimalTokenOutAmount: bigint | undefined;
39
50
  priceImpact: number;
40
51
  }
41
- interface AddLiquidityParams {
42
- cpmmPoolState: CpmmPoolContractState;
43
- tokenA: TokenInfo;
44
- tokenB: TokenInfo;
52
+ interface CpmmAddLiquidityRequest {
53
+ poolState: CpmmPoolContractState;
54
+ tokenAId: CpmmTokenId;
55
+ tokenBId: CpmmTokenId;
45
56
  amountA: bigint;
46
57
  amountB: bigint;
47
- slippage: bigint;
58
+ slippageBps: CpmmSlippageBps;
48
59
  sender: string;
49
- ttl?: number;
60
+ ttlMinutes?: number;
61
+ }
62
+ interface CpmmAddLiquidityQuoteParams {
63
+ poolState?: CpmmPoolContractState;
64
+ tokenAId: CpmmTokenId;
65
+ tokenBId: CpmmTokenId;
66
+ amountA?: bigint;
67
+ amountB?: bigint;
68
+ inputType?: CpmmInputType;
50
69
  }
51
- interface AddLiquidityDetails {
70
+ interface CpmmAddLiquidityQuote {
52
71
  state?: CpmmPoolContractState;
53
72
  tokenAId: string;
54
73
  tokenBId: string;
@@ -57,15 +76,15 @@ interface AddLiquidityDetails {
57
76
  shareAmount: bigint;
58
77
  sharePercentage: number;
59
78
  }
60
- interface RemoveLiquidityParams {
61
- state: CpmmPoolContractState;
79
+ interface CpmmRemoveLiquidityRequest {
80
+ poolState: CpmmPoolContractState;
62
81
  liquidity: bigint;
63
82
  totalLiquidityAmount?: bigint;
64
- slippage: bigint;
83
+ slippageBps: CpmmSlippageBps;
65
84
  sender: string;
66
- ttl?: number;
85
+ ttlMinutes?: number;
67
86
  }
68
- interface RemoveLiquidityDetails {
87
+ interface CpmmRemoveLiquidityQuote {
69
88
  state: CpmmPoolContractState;
70
89
  token0: TokenInfo;
71
90
  amount0: bigint;
@@ -74,34 +93,20 @@ interface RemoveLiquidityDetails {
74
93
  remainShareAmount: bigint;
75
94
  remainSharePercentage: number;
76
95
  }
77
- interface ClaimableAmounts {
96
+ interface CpmmClaimableAmounts {
78
97
  token0: TokenInfo;
79
98
  amount0: bigint;
80
99
  token1: TokenInfo;
81
100
  amount1: bigint;
82
101
  }
83
- interface CreatePoolParams {
84
- tokenA: TokenInfo;
85
- tokenB: TokenInfo;
102
+ interface CpmmCreatePoolRequest {
103
+ tokenAId: CpmmTokenId;
104
+ tokenBId: CpmmTokenId;
86
105
  sender: string;
87
- tokenAAmount?: bigint;
88
- tokenBAmount?: bigint;
89
- }
90
- interface ComputeSwapParams {
91
- state: CpmmPoolContractState;
92
- tokenIn: TokenInfo;
93
- tokenOut: TokenInfo;
94
- amountIn?: bigint;
95
- amountOut?: bigint;
96
- slippage: bigint;
97
- }
98
- interface ComputeLiquidityParams {
99
- state?: CpmmPoolContractState;
100
- tokenA: TokenInfo;
101
- tokenB: TokenInfo;
102
- amountA?: bigint;
103
- amountB?: bigint;
104
- inputType?: 'TokenA' | 'TokenB';
106
+ initialLiquidity?: {
107
+ tokenAAmount: bigint;
108
+ tokenBAmount: bigint;
109
+ };
105
110
  }
106
111
 
107
112
  declare enum LogLevel {
@@ -131,11 +136,11 @@ declare function createLogger(moduleName: string): Logger;
131
136
  declare function setLoggerLevel(moduleName: string, level: LogLevel): void;
132
137
 
133
138
  interface ModuleBaseProps {
134
- scope: Zeta;
139
+ scope: Powfi;
135
140
  moduleName: string;
136
141
  }
137
142
  declare class ModuleBase {
138
- scope: Zeta;
143
+ scope: Powfi;
139
144
  private disabled;
140
145
  protected logger: Logger;
141
146
  constructor({ scope, moduleName }: ModuleBaseProps);
@@ -149,46 +154,32 @@ declare class ModuleBase {
149
154
 
150
155
  declare class CpmmModule extends ModuleBase {
151
156
  private config;
152
- constructor(scope: Zeta);
157
+ constructor(scope: Powfi);
153
158
  getPoolId(tokenA: string, tokenB: string): string;
154
159
  getPoolAddress(tokenA: string, tokenB: string): string;
155
160
  getPoolState(tokenA: string, tokenB: string): Promise<CpmmPoolContractState>;
156
161
  poolExists(tokenA: string, tokenB: string): Promise<boolean>;
157
- swap(params: SwapParams$1, balances?: Map<string, bigint>): Promise<ExecuteScriptResult>;
158
- addLiquidity(params: AddLiquidityParams, balances?: Map<string, bigint>): Promise<ExecuteScriptResult>;
159
- removeLiquidity(params: RemoveLiquidityParams): Promise<ExecuteScriptResult>;
160
- computeClaimableAmounts(tokenAId: string, tokenBId: string, liquidityBalance: bigint): Promise<ClaimableAmounts>;
161
- createPool(params: CreatePoolParams): Promise<ExecuteScriptResult & {
162
+ swap(params: CpmmSwapRequest, balances?: Map<string, bigint>): Promise<ExecuteScriptResult>;
163
+ addLiquidity(params: CpmmAddLiquidityRequest, balances?: Map<string, bigint>): Promise<ExecuteScriptResult>;
164
+ removeLiquidity(params: CpmmRemoveLiquidityRequest): Promise<ExecuteScriptResult>;
165
+ computeClaimableAmounts(tokenAId: string, tokenBId: string, liquidityBalance: bigint): Promise<CpmmClaimableAmounts>;
166
+ createPool(params: CpmmCreatePoolRequest): Promise<ExecuteScriptResult & {
162
167
  poolId: string;
163
168
  }>;
164
169
  getCpmmConfig(): CpmmConfig;
165
- static computeSwapAmount(params: ComputeSwapParams): SwapDetails;
166
- static computeLiquidityAmounts(params: ComputeLiquidityParams): AddLiquidityDetails;
167
- static computeRemoveLiquidityAmounts(state: CpmmPoolContractState, totalLiquidity: bigint, liquidityToRemove: bigint): RemoveLiquidityDetails;
168
- static computeClaimableAmounts(state: CpmmPoolContractState, liquidityBalance: bigint): RemoveLiquidityDetails;
170
+ static computeSwapAmount(params: CpmmSwapQuoteParams): CpmmSwapQuote;
171
+ static computeLiquidityAmounts(params: CpmmAddLiquidityQuoteParams): CpmmAddLiquidityQuote;
172
+ static computeRemoveLiquidityAmounts(state: CpmmPoolContractState, totalLiquidity: bigint, liquidityToRemove: bigint): CpmmRemoveLiquidityQuote;
173
+ static computeClaimableAmounts(state: CpmmPoolContractState, liquidityBalance: bigint): CpmmRemoveLiquidityQuote;
169
174
  static minimalAmount(amount: bigint, slippage: bigint): bigint;
170
175
  static maximalAmount(amount: bigint, slippage: bigint): bigint;
171
176
  private static assertSlippageInRange;
172
177
  static calcPriceImpact(reserve0: bigint, reserve1: bigint, tokenInId: string, token0Id: string, amountIn: bigint, amountOut: bigint): number;
173
- static getLiquidityDetails(state: CpmmPoolContractState, inputTokenId: string, inputAmount: bigint, inputType: 'TokenA' | 'TokenB'): {
174
- state: CpmmPoolContractState;
175
- tokenAId: string;
176
- tokenBId: string;
177
- amountA: bigint;
178
- amountB: bigint;
179
- shareAmount: bigint;
180
- sharePercentage: number;
181
- };
178
+ static getLiquidityDetails(state: CpmmPoolContractState, inputTokenId: string, inputAmount: bigint, inputType: 'TokenA' | 'TokenB'): CpmmAddLiquidityQuote;
182
179
  static getAmountIn(state: CpmmPoolContractState, tokenOutId: string, amountOut: bigint): bigint;
183
180
  static getAmountOut(state: CpmmPoolContractState, tokenInId: string, amountIn: bigint): bigint;
184
- static getInitLiquidityDetails(tokenAId: string, tokenBId: string, amountA: bigint, amountB: bigint): {
185
- tokenAId: string;
186
- tokenBId: string;
187
- amountA: bigint;
188
- amountB: bigint;
189
- shareAmount: bigint;
190
- sharePercentage: number;
191
- };
181
+ static getInitLiquidityDetails(tokenAId: string, tokenBId: string, amountA: bigint, amountB: bigint): CpmmAddLiquidityQuote;
182
+ private static getTokenInfoFromPoolState;
192
183
  private static _getAmountOut;
193
184
  private getExtraAlphAmount;
194
185
  }
@@ -212,7 +203,7 @@ declare const DEVNET: {
212
203
  };
213
204
  declare const defaultNetworks: Network[];
214
205
  type NetworkOverrides = Partial<Omit<Network, 'id'>>;
215
- interface ZetaLoadParams {
206
+ interface PowfiLoadParams {
216
207
  networkId: NetworkId;
217
208
  signer?: SignerProvider;
218
209
  networkOverrides?: NetworkOverrides;
@@ -302,14 +293,15 @@ interface ClmmConfig {
302
293
  defaultConfigIndex: bigint;
303
294
  accountRoot: string;
304
295
  }
305
- interface ClmmSwapParams {
296
+ interface ClmmSwapRequest {
306
297
  token0: string;
307
298
  token1: string;
308
299
  amount: bigint;
300
+ amountIn: bigint;
309
301
  slippage: bigint;
310
302
  routePlan: bigint[];
311
303
  }
312
- interface SimulateSwap {
304
+ interface ClmmSimulateSwapParams {
313
305
  configIndex: bigint;
314
306
  token0: string;
315
307
  token1: string;
@@ -320,14 +312,14 @@ interface LiquidityForPrice {
320
312
  liquidity: bigint;
321
313
  sqrtPriceX96: bigint;
322
314
  }
323
- interface LiquidityDistribution {
315
+ interface ClmmSimulateSwapQuote {
324
316
  baseSqrtPriceX96: bigint;
325
317
  sqrtPriceX96: bigint;
326
318
  liquidity: bigint;
327
319
  fee: bigint;
328
320
  rows: Array<LiquidityForPrice>;
329
321
  }
330
- interface AddLiquidity$1 {
322
+ interface ClmmAddLiquidityRequest {
331
323
  token0: string;
332
324
  token1: string;
333
325
  configIndex: bigint;
@@ -339,7 +331,7 @@ interface AddLiquidity$1 {
339
331
  amount1: bigint;
340
332
  existingPosition?: boolean;
341
333
  }
342
- interface RemoveLiquidity$1 {
334
+ interface ClmmRemoveLiquidityRequest {
343
335
  token0: string;
344
336
  token1: string;
345
337
  configIndex: bigint;
@@ -351,7 +343,7 @@ interface RemoveLiquidity$1 {
351
343
  baseAmount: bigint;
352
344
  otherAmountMax: bigint;
353
345
  }
354
- interface CollectTokens {
346
+ interface ClmmCollectTokensRequest {
355
347
  token0: string;
356
348
  token1: string;
357
349
  configIndex: bigint;
@@ -363,7 +355,7 @@ interface CollectTokens {
363
355
  amount0Max: bigint;
364
356
  amount1Max: bigint;
365
357
  }
366
- interface PositionPath {
358
+ interface ClmmPositionInfoRequest {
367
359
  poolId: string;
368
360
  owner: string;
369
361
  tickLower: bigint;
@@ -374,13 +366,13 @@ interface PositionPath {
374
366
  t0: bigint;
375
367
  acct0: bigint;
376
368
  }
377
- interface CollectProtocolFees {
369
+ interface ClmmCollectProtocolFeesRequest {
378
370
  token0: string;
379
371
  token1: string;
380
372
  configIndex: bigint;
381
373
  recipient: string;
382
374
  }
383
- interface SetRewardParams {
375
+ interface ClmmSetRewardParamsRequest {
384
376
  token0: string;
385
377
  token1: string;
386
378
  configIndex: bigint;
@@ -390,7 +382,7 @@ interface SetRewardParams {
390
382
  openTime: bigint;
391
383
  endTime: bigint;
392
384
  }
393
- interface ExtendRewards {
385
+ interface ClmmExtendRewardsRequest {
394
386
  token0: string;
395
387
  token1: string;
396
388
  configIndex: bigint;
@@ -1731,8 +1723,11 @@ declare namespace PoolTypes {
1731
1723
  };
1732
1724
  withdraw: {
1733
1725
  params: CallContractParams<{
1726
+ position: HexString;
1727
+ operator: Address;
1734
1728
  recipient: Address;
1735
1729
  amounts: [bigint, bigint, bigint];
1730
+ toDestroy: boolean;
1736
1731
  }>;
1737
1732
  result: CallContractResult<null>;
1738
1733
  };
@@ -2157,8 +2152,11 @@ declare namespace PoolTypes {
2157
2152
  };
2158
2153
  withdraw: {
2159
2154
  params: SignExecuteContractMethodParams<{
2155
+ position: HexString;
2156
+ operator: Address;
2160
2157
  recipient: Address;
2161
2158
  amounts: [bigint, bigint, bigint];
2159
+ toDestroy: boolean;
2162
2160
  }>;
2163
2161
  result: SignExecuteScriptTxResult;
2164
2162
  };
@@ -2513,8 +2511,11 @@ declare class Factory$r extends ContractFactory<PoolInstance, PoolTypes.Fields>
2513
2511
  maxAmounts: [bigint, bigint, bigint];
2514
2512
  }>) => Promise<TestContractResultWithoutMaps<[bigint, bigint, bigint]>>;
2515
2513
  withdraw: (params: TestContractParamsWithoutMaps<PoolTypes.Fields, {
2514
+ position: HexString;
2515
+ operator: Address;
2516
2516
  recipient: Address;
2517
2517
  amounts: [bigint, bigint, bigint];
2518
+ toDestroy: boolean;
2518
2519
  }>) => Promise<TestContractResultWithoutMaps<null>>;
2519
2520
  simulateSwap: (params: TestContractParamsWithoutMaps<PoolTypes.Fields, {
2520
2521
  zeroForOne: boolean;
@@ -3224,7 +3225,13 @@ declare namespace PositionTypes {
3224
3225
  params: CallContractParams<{
3225
3226
  maxAmounts: [bigint, bigint, bigint];
3226
3227
  }>;
3227
- result: CallContractResult<[bigint, bigint, bigint]>;
3228
+ result: CallContractResult<[[bigint, bigint, bigint], boolean]>;
3229
+ };
3230
+ destroy: {
3231
+ params: CallContractParams<{
3232
+ recipient: Address;
3233
+ }>;
3234
+ result: CallContractResult<null>;
3228
3235
  };
3229
3236
  getState: {
3230
3237
  params: Omit<CallContractParams<{}>, "args">;
@@ -3287,6 +3294,12 @@ declare namespace PositionTypes {
3287
3294
  }>;
3288
3295
  result: SignExecuteScriptTxResult;
3289
3296
  };
3297
+ destroy: {
3298
+ params: SignExecuteContractMethodParams<{
3299
+ recipient: Address;
3300
+ }>;
3301
+ result: SignExecuteScriptTxResult;
3302
+ };
3290
3303
  getState: {
3291
3304
  params: Omit<SignExecuteContractMethodParams<{}>, "args">;
3292
3305
  result: SignExecuteScriptTxResult;
@@ -3332,7 +3345,10 @@ declare class Factory$n extends ContractFactory<PositionInstance, PositionTypes.
3332
3345
  }>) => Promise<TestContractResultWithoutMaps<null>>;
3333
3346
  collect: (params: TestContractParamsWithoutMaps<PositionTypes.Fields, {
3334
3347
  maxAmounts: [bigint, bigint, bigint];
3335
- }>) => Promise<TestContractResultWithoutMaps<[bigint, bigint, bigint]>>;
3348
+ }>) => Promise<TestContractResultWithoutMaps<[[bigint, bigint, bigint], boolean]>>;
3349
+ destroy: (params: TestContractParamsWithoutMaps<PositionTypes.Fields, {
3350
+ recipient: Address;
3351
+ }>) => Promise<TestContractResultWithoutMaps<null>>;
3336
3352
  getState: (params: Omit<TestContractParamsWithoutMaps<PositionTypes.Fields, never>, "args">) => Promise<TestContractResultWithoutMaps<[bigint, [bigint, bigint, bigint]]>>;
3337
3353
  };
3338
3354
  stateForTest(initFields: PositionTypes.Fields, asset?: Asset, address?: string): ContractState<PositionTypes.Fields> | _alephium_web3.ContractStateWithMaps<PositionTypes.Fields, Record<string, Map<_alephium_web3.Val, _alephium_web3.Val>>>;
@@ -3349,6 +3365,7 @@ declare class PositionInstance extends ContractInstance {
3349
3365
  update: (params: PositionTypes.CallMethodParams<"update">) => Promise<PositionTypes.CallMethodResult<"update">>;
3350
3366
  deposit: (params: PositionTypes.CallMethodParams<"deposit">) => Promise<PositionTypes.CallMethodResult<"deposit">>;
3351
3367
  collect: (params: PositionTypes.CallMethodParams<"collect">) => Promise<PositionTypes.CallMethodResult<"collect">>;
3368
+ destroy: (params: PositionTypes.CallMethodParams<"destroy">) => Promise<PositionTypes.CallMethodResult<"destroy">>;
3352
3369
  getState: (params?: PositionTypes.CallMethodParams<"getState">) => Promise<PositionTypes.CallMethodResult<"getState">>;
3353
3370
  };
3354
3371
  transact: {
@@ -3359,6 +3376,7 @@ declare class PositionInstance extends ContractInstance {
3359
3376
  update: (params: PositionTypes.SignExecuteMethodParams<"update">) => Promise<PositionTypes.SignExecuteMethodResult<"update">>;
3360
3377
  deposit: (params: PositionTypes.SignExecuteMethodParams<"deposit">) => Promise<PositionTypes.SignExecuteMethodResult<"deposit">>;
3361
3378
  collect: (params: PositionTypes.SignExecuteMethodParams<"collect">) => Promise<PositionTypes.SignExecuteMethodResult<"collect">>;
3379
+ destroy: (params: PositionTypes.SignExecuteMethodParams<"destroy">) => Promise<PositionTypes.SignExecuteMethodResult<"destroy">>;
3362
3380
  getState: (params: PositionTypes.SignExecuteMethodParams<"getState">) => Promise<PositionTypes.SignExecuteMethodResult<"getState">>;
3363
3381
  };
3364
3382
  multicall<Calls extends PositionTypes.MultiCallParams>(calls: Calls): Promise<PositionTypes.MultiCallResults<Calls>>;
@@ -4399,7 +4417,7 @@ declare namespace index$2 {
4399
4417
  declare class ClmmModule extends ModuleBase {
4400
4418
  private config;
4401
4419
  private configsByIndex;
4402
- constructor(scope: Zeta);
4420
+ constructor(scope: Powfi);
4403
4421
  setConfig(config: ClmmConfig): void;
4404
4422
  getClmmConfig(): ClmmConfig;
4405
4423
  getPoolConfigId(configIndex: bigint): string;
@@ -4420,25 +4438,31 @@ declare class ClmmModule extends ModuleBase {
4420
4438
  poolAddress: string;
4421
4439
  result: SignExecuteScriptTxResult;
4422
4440
  }>;
4423
- addLiquidity(p: AddLiquidity$1): Promise<{
4441
+ addLiquidity(p: ClmmAddLiquidityRequest): Promise<{
4424
4442
  positionId: string;
4425
4443
  result: SignExecuteScriptTxResult;
4426
4444
  }>;
4427
- removeLiquidity(p: RemoveLiquidity$1): Promise<{
4445
+ getAddLiquidityParams(p: ClmmAddLiquidityRequest): Promise<[string, PositionManagerInstance, PositionManagerTypes.SignExecuteMethodParams<'addLiquidity'>]>;
4446
+ addLiquidityFromParams(positionId: string, positionManager: PositionManagerInstance, params: PositionManagerTypes.SignExecuteMethodParams<'addLiquidity'>): Promise<{
4428
4447
  positionId: string;
4429
4448
  result: SignExecuteScriptTxResult;
4430
4449
  }>;
4431
- positionInfo({ poolId, ...args }: PositionPath): Promise<ClmmPositionInfo>;
4432
- collectTokens(p: CollectTokens): Promise<{
4450
+ removeLiquidity(p: ClmmRemoveLiquidityRequest): Promise<{
4451
+ positionId: string;
4452
+ result: SignExecuteScriptTxResult;
4453
+ }>;
4454
+ positionInfo({ poolId, ...args }: ClmmPositionInfoRequest): Promise<ClmmPositionInfo>;
4455
+ collectTokens(p: ClmmCollectTokensRequest): Promise<{
4433
4456
  positionId: string;
4434
4457
  result: SignExecuteScriptTxResult;
4435
4458
  }>;
4436
4459
  findBestRoute(token0: string, token1: string): Promise<bigint>;
4437
- simulateSwap(p: SimulateSwap): Promise<LiquidityDistribution>;
4438
- swap(p: ClmmSwapParams): Promise<SignExecuteScriptTxResult>;
4439
- collectProtocolFees(p: CollectProtocolFees): Promise<SignExecuteScriptTxResult>;
4440
- setRewardParams(p: SetRewardParams): Promise<SignExecuteScriptTxResult>;
4441
- extendRewards(p: ExtendRewards): Promise<SignExecuteScriptTxResult>;
4460
+ simulateSwap(p: ClmmSimulateSwapParams): Promise<ClmmSimulateSwapQuote>;
4461
+ swap(p: ClmmSwapRequest): Promise<SignExecuteScriptTxResult>;
4462
+ collectProtocolFees(p: ClmmCollectProtocolFeesRequest): Promise<SignExecuteScriptTxResult>;
4463
+ setRewardParams(p: ClmmSetRewardParamsRequest): Promise<SignExecuteScriptTxResult>;
4464
+ extendRewards(p: ClmmExtendRewardsRequest): Promise<SignExecuteScriptTxResult>;
4465
+ private getAddLiquidityAttoAlphAmount;
4442
4466
  private _getClmmConfig;
4443
4467
  }
4444
4468
 
@@ -4446,7 +4470,7 @@ declare class TokenModule extends ModuleBase {
4446
4470
  private readonly cacheTimeDays;
4447
4471
  private cache?;
4448
4472
  private readonly cacheTimeMs;
4449
- constructor(scope: Zeta, cacheTimeDays?: number);
4473
+ constructor(scope: Powfi, cacheTimeDays?: number);
4450
4474
  getTokens(): Promise<TokenInfo[]>;
4451
4475
  getTokenById(id: string): Promise<TokenInfo>;
4452
4476
  getTokenBySymbol(symbol: string): Promise<TokenInfo>;
@@ -4491,6 +4515,10 @@ declare namespace AlphUnstakeVaultTypes {
4491
4515
  }>;
4492
4516
  result: CallContractResult<boolean>;
4493
4517
  };
4518
+ cancelAndReturn: {
4519
+ params: Omit<CallContractParams<{}>, "args">;
4520
+ result: CallContractResult<[bigint, bigint]>;
4521
+ };
4494
4522
  destroy: {
4495
4523
  params: Omit<CallContractParams<{}>, "args">;
4496
4524
  result: CallContractResult<null>;
@@ -4530,6 +4558,10 @@ declare namespace AlphUnstakeVaultTypes {
4530
4558
  }>;
4531
4559
  result: SignExecuteScriptTxResult;
4532
4560
  };
4561
+ cancelAndReturn: {
4562
+ params: Omit<SignExecuteContractMethodParams<{}>, "args">;
4563
+ result: SignExecuteScriptTxResult;
4564
+ };
4533
4565
  destroy: {
4534
4566
  params: Omit<SignExecuteContractMethodParams<{}>, "args">;
4535
4567
  result: SignExecuteScriptTxResult;
@@ -4567,6 +4599,7 @@ declare class Factory$i extends ContractFactory<AlphUnstakeVaultInstance, AlphUn
4567
4599
  claim: (params: TestContractParamsWithoutMaps<AlphUnstakeVaultTypes.Fields, {
4568
4600
  amount: bigint;
4569
4601
  }>) => Promise<TestContractResultWithoutMaps<boolean>>;
4602
+ cancelAndReturn: (params: Omit<TestContractParamsWithoutMaps<AlphUnstakeVaultTypes.Fields, never>, "args">) => Promise<TestContractResultWithoutMaps<[bigint, bigint]>>;
4570
4603
  destroy: (params: Omit<TestContractParamsWithoutMaps<AlphUnstakeVaultTypes.Fields, never>, "args">) => Promise<TestContractResultWithoutMaps<null>>;
4571
4604
  };
4572
4605
  stateForTest(initFields: AlphUnstakeVaultTypes.Fields, asset?: Asset, address?: string): ContractState<AlphUnstakeVaultTypes.Fields> | _alephium_web3.ContractStateWithMaps<AlphUnstakeVaultTypes.Fields, Record<string, Map<_alephium_web3.Val, _alephium_web3.Val>>>;
@@ -4580,6 +4613,7 @@ declare class AlphUnstakeVaultInstance extends ContractInstance {
4580
4613
  getTotalUnstakeAmount: (params?: AlphUnstakeVaultTypes.CallMethodParams<"getTotalUnstakeAmount">) => Promise<AlphUnstakeVaultTypes.CallMethodResult<"getTotalUnstakeAmount">>;
4581
4614
  getClaimableAmount: (params?: AlphUnstakeVaultTypes.CallMethodParams<"getClaimableAmount">) => Promise<AlphUnstakeVaultTypes.CallMethodResult<"getClaimableAmount">>;
4582
4615
  claim: (params: AlphUnstakeVaultTypes.CallMethodParams<"claim">) => Promise<AlphUnstakeVaultTypes.CallMethodResult<"claim">>;
4616
+ cancelAndReturn: (params?: AlphUnstakeVaultTypes.CallMethodParams<"cancelAndReturn">) => Promise<AlphUnstakeVaultTypes.CallMethodResult<"cancelAndReturn">>;
4583
4617
  destroy: (params?: AlphUnstakeVaultTypes.CallMethodParams<"destroy">) => Promise<AlphUnstakeVaultTypes.CallMethodResult<"destroy">>;
4584
4618
  };
4585
4619
  transact: {
@@ -4587,6 +4621,7 @@ declare class AlphUnstakeVaultInstance extends ContractInstance {
4587
4621
  getTotalUnstakeAmount: (params: AlphUnstakeVaultTypes.SignExecuteMethodParams<"getTotalUnstakeAmount">) => Promise<AlphUnstakeVaultTypes.SignExecuteMethodResult<"getTotalUnstakeAmount">>;
4588
4622
  getClaimableAmount: (params: AlphUnstakeVaultTypes.SignExecuteMethodParams<"getClaimableAmount">) => Promise<AlphUnstakeVaultTypes.SignExecuteMethodResult<"getClaimableAmount">>;
4589
4623
  claim: (params: AlphUnstakeVaultTypes.SignExecuteMethodParams<"claim">) => Promise<AlphUnstakeVaultTypes.SignExecuteMethodResult<"claim">>;
4624
+ cancelAndReturn: (params: AlphUnstakeVaultTypes.SignExecuteMethodParams<"cancelAndReturn">) => Promise<AlphUnstakeVaultTypes.SignExecuteMethodResult<"cancelAndReturn">>;
4590
4625
  destroy: (params: AlphUnstakeVaultTypes.SignExecuteMethodParams<"destroy">) => Promise<AlphUnstakeVaultTypes.SignExecuteMethodResult<"destroy">>;
4591
4626
  };
4592
4627
  multicall<Calls extends AlphUnstakeVaultTypes.MultiCallParams>(calls: Calls): Promise<AlphUnstakeVaultTypes.MultiCallResults<Calls>>;
@@ -6197,16 +6232,29 @@ declare namespace XAlphTokenTypes {
6197
6232
  unstakeVaultTemplateId: HexString;
6198
6233
  maxActiveUnstakeRequestsPerUser: bigint;
6199
6234
  unstakeDuration: bigint;
6200
- totalStaked: bigint;
6235
+ totalDepositedAlph: bigint;
6236
+ totalXAlphSupply: bigint;
6201
6237
  lastUnstakeVaultIndex: bigint;
6202
6238
  };
6203
6239
  type State = ContractState<Fields>;
6204
6240
  type StakedEvent = ContractEvent<{
6205
6241
  to: Address;
6206
- amount: bigint;
6242
+ alphAmount: bigint;
6243
+ xAlphAmount: bigint;
6207
6244
  }>;
6208
6245
  type UnstakeScheduledEvent = ContractEvent<{
6209
6246
  to: Address;
6247
+ xAlphAmount: bigint;
6248
+ alphAmount: bigint;
6249
+ }>;
6250
+ type UnstakeCancelledEvent = ContractEvent<{
6251
+ to: Address;
6252
+ xAlphAmount: bigint;
6253
+ claimedAlphAmount: bigint;
6254
+ restakedAlphAmount: bigint;
6255
+ }>;
6256
+ type RewardDepositedEvent = ContractEvent<{
6257
+ from: Address;
6210
6258
  amount: bigint;
6211
6259
  }>;
6212
6260
  interface CallMethodTable {
@@ -6280,11 +6328,23 @@ declare namespace XAlphTokenTypes {
6280
6328
  params: Omit<CallContractParams<{}>, "args">;
6281
6329
  result: CallContractResult<HexString>;
6282
6330
  };
6331
+ mulDiv: {
6332
+ params: CallContractParams<{
6333
+ a: bigint;
6334
+ b: bigint;
6335
+ denominator: bigint;
6336
+ }>;
6337
+ result: CallContractResult<bigint>;
6338
+ };
6339
+ getTotalDepositedAlph: {
6340
+ params: Omit<CallContractParams<{}>, "args">;
6341
+ result: CallContractResult<bigint>;
6342
+ };
6283
6343
  stake: {
6284
6344
  params: CallContractParams<{
6285
6345
  amount: bigint;
6286
6346
  }>;
6287
- result: CallContractResult<null>;
6347
+ result: CallContractResult<bigint>;
6288
6348
  };
6289
6349
  startUnstake: {
6290
6350
  params: CallContractParams<{
@@ -6292,6 +6352,12 @@ declare namespace XAlphTokenTypes {
6292
6352
  }>;
6293
6353
  result: CallContractResult<HexString>;
6294
6354
  };
6355
+ depositReward: {
6356
+ params: CallContractParams<{
6357
+ amount: bigint;
6358
+ }>;
6359
+ result: CallContractResult<null>;
6360
+ };
6295
6361
  getActiveUnstakeVaultIndexes: {
6296
6362
  params: CallContractParams<{
6297
6363
  caller: Address;
@@ -6312,6 +6378,12 @@ declare namespace XAlphTokenTypes {
6312
6378
  }>;
6313
6379
  result: CallContractResult<null>;
6314
6380
  };
6381
+ cancelUnstake: {
6382
+ params: CallContractParams<{
6383
+ vaultIndex: bigint;
6384
+ }>;
6385
+ result: CallContractResult<bigint>;
6386
+ };
6315
6387
  }
6316
6388
  type CallMethodParams<T extends keyof CallMethodTable> = CallMethodTable[T]["params"];
6317
6389
  type CallMethodResult<T extends keyof CallMethodTable> = CallMethodTable[T]["result"];
@@ -6395,6 +6467,18 @@ declare namespace XAlphTokenTypes {
6395
6467
  params: Omit<SignExecuteContractMethodParams<{}>, "args">;
6396
6468
  result: SignExecuteScriptTxResult;
6397
6469
  };
6470
+ mulDiv: {
6471
+ params: SignExecuteContractMethodParams<{
6472
+ a: bigint;
6473
+ b: bigint;
6474
+ denominator: bigint;
6475
+ }>;
6476
+ result: SignExecuteScriptTxResult;
6477
+ };
6478
+ getTotalDepositedAlph: {
6479
+ params: Omit<SignExecuteContractMethodParams<{}>, "args">;
6480
+ result: SignExecuteScriptTxResult;
6481
+ };
6398
6482
  stake: {
6399
6483
  params: SignExecuteContractMethodParams<{
6400
6484
  amount: bigint;
@@ -6407,6 +6491,12 @@ declare namespace XAlphTokenTypes {
6407
6491
  }>;
6408
6492
  result: SignExecuteScriptTxResult;
6409
6493
  };
6494
+ depositReward: {
6495
+ params: SignExecuteContractMethodParams<{
6496
+ amount: bigint;
6497
+ }>;
6498
+ result: SignExecuteScriptTxResult;
6499
+ };
6410
6500
  getActiveUnstakeVaultIndexes: {
6411
6501
  params: SignExecuteContractMethodParams<{
6412
6502
  caller: Address;
@@ -6427,6 +6517,12 @@ declare namespace XAlphTokenTypes {
6427
6517
  }>;
6428
6518
  result: SignExecuteScriptTxResult;
6429
6519
  };
6520
+ cancelUnstake: {
6521
+ params: SignExecuteContractMethodParams<{
6522
+ vaultIndex: bigint;
6523
+ }>;
6524
+ result: SignExecuteScriptTxResult;
6525
+ };
6430
6526
  }
6431
6527
  type SignExecuteMethodParams<T extends keyof SignExecuteMethodTable> = SignExecuteMethodTable[T]["params"];
6432
6528
  type SignExecuteMethodResult<T extends keyof SignExecuteMethodTable> = SignExecuteMethodTable[T]["result"];
@@ -6442,6 +6538,8 @@ declare class Factory$a extends ContractFactory<XAlphTokenInstance, XAlphTokenTy
6442
6538
  eventIndex: {
6443
6539
  Staked: number;
6444
6540
  UnstakeScheduled: number;
6541
+ UnstakeCancelled: number;
6542
+ RewardDeposited: number;
6445
6543
  };
6446
6544
  consts: {
6447
6545
  IntByteLength: bigint;
@@ -6450,12 +6548,19 @@ declare class Factory$a extends ContractFactory<XAlphTokenInstance, XAlphTokenTy
6450
6548
  IndexOutOfBound: bigint;
6451
6549
  InvalidByteVecLength: bigint;
6452
6550
  };
6551
+ FullMathError: {
6552
+ DivByZero: bigint;
6553
+ MulDivOverflow: bigint;
6554
+ };
6453
6555
  ErrorCodes: {
6454
6556
  AssetAddressCallerOnly: bigint;
6455
6557
  TooManyActiveUnstakeVaults: bigint;
6456
6558
  InvalidUnstakeDuration: bigint;
6457
6559
  NonExistantUnstakeVault: bigint;
6458
6560
  AmountMustBeGreaterThanZero: bigint;
6561
+ ZeroXAlphOutput: bigint;
6562
+ ZeroAlphOutput: bigint;
6563
+ NoStakers: bigint;
6459
6564
  };
6460
6565
  };
6461
6566
  at(address: string): XAlphTokenInstance;
@@ -6494,12 +6599,21 @@ declare class Factory$a extends ContractFactory<XAlphTokenInstance, XAlphTokenTy
6494
6599
  array: HexString;
6495
6600
  }, XAlphTokenTypes.Maps>) => Promise<TestContractResult<bigint, XAlphTokenTypes.Maps>>;
6496
6601
  empty: (params: Omit<TestContractParams<XAlphTokenTypes.Fields, never, XAlphTokenTypes.Maps>, "args">) => Promise<TestContractResult<HexString, XAlphTokenTypes.Maps>>;
6602
+ mulDiv: (params: TestContractParams<XAlphTokenTypes.Fields, {
6603
+ a: bigint;
6604
+ b: bigint;
6605
+ denominator: bigint;
6606
+ }, XAlphTokenTypes.Maps>) => Promise<TestContractResult<bigint, XAlphTokenTypes.Maps>>;
6607
+ getTotalDepositedAlph: (params: Omit<TestContractParams<XAlphTokenTypes.Fields, never, XAlphTokenTypes.Maps>, "args">) => Promise<TestContractResult<bigint, XAlphTokenTypes.Maps>>;
6497
6608
  stake: (params: TestContractParams<XAlphTokenTypes.Fields, {
6498
6609
  amount: bigint;
6499
- }, XAlphTokenTypes.Maps>) => Promise<TestContractResult<null, XAlphTokenTypes.Maps>>;
6610
+ }, XAlphTokenTypes.Maps>) => Promise<TestContractResult<bigint, XAlphTokenTypes.Maps>>;
6500
6611
  startUnstake: (params: TestContractParams<XAlphTokenTypes.Fields, {
6501
6612
  amount: bigint;
6502
6613
  }, XAlphTokenTypes.Maps>) => Promise<TestContractResult<HexString, XAlphTokenTypes.Maps>>;
6614
+ depositReward: (params: TestContractParams<XAlphTokenTypes.Fields, {
6615
+ amount: bigint;
6616
+ }, XAlphTokenTypes.Maps>) => Promise<TestContractResult<null, XAlphTokenTypes.Maps>>;
6503
6617
  getActiveUnstakeVaultIndexes: (params: TestContractParams<XAlphTokenTypes.Fields, {
6504
6618
  caller: Address;
6505
6619
  }, XAlphTokenTypes.Maps>) => Promise<TestContractResult<HexString, XAlphTokenTypes.Maps>>;
@@ -6511,6 +6625,9 @@ declare class Factory$a extends ContractFactory<XAlphTokenInstance, XAlphTokenTy
6511
6625
  vaultIndex: bigint;
6512
6626
  amount: bigint;
6513
6627
  }, XAlphTokenTypes.Maps>) => Promise<TestContractResult<null, XAlphTokenTypes.Maps>>;
6628
+ cancelUnstake: (params: TestContractParams<XAlphTokenTypes.Fields, {
6629
+ vaultIndex: bigint;
6630
+ }, XAlphTokenTypes.Maps>) => Promise<TestContractResult<bigint, XAlphTokenTypes.Maps>>;
6514
6631
  };
6515
6632
  stateForTest(initFields: XAlphTokenTypes.Fields, asset?: Asset, address?: string, maps?: XAlphTokenTypes.Maps): ContractState<XAlphTokenTypes.Fields> | _alephium_web3.ContractStateWithMaps<XAlphTokenTypes.Fields, Record<string, Map<_alephium_web3.Val, _alephium_web3.Val>>>;
6516
6633
  }
@@ -6524,7 +6641,9 @@ declare class XAlphTokenInstance extends ContractInstance {
6524
6641
  getContractEventsCurrentCount(): Promise<number>;
6525
6642
  subscribeStakedEvent(options: EventSubscribeOptions<XAlphTokenTypes.StakedEvent>, fromCount?: number): EventSubscription;
6526
6643
  subscribeUnstakeScheduledEvent(options: EventSubscribeOptions<XAlphTokenTypes.UnstakeScheduledEvent>, fromCount?: number): EventSubscription;
6527
- subscribeAllEvents(options: EventSubscribeOptions<XAlphTokenTypes.StakedEvent | XAlphTokenTypes.UnstakeScheduledEvent>, fromCount?: number): EventSubscription;
6644
+ subscribeUnstakeCancelledEvent(options: EventSubscribeOptions<XAlphTokenTypes.UnstakeCancelledEvent>, fromCount?: number): EventSubscription;
6645
+ subscribeRewardDepositedEvent(options: EventSubscribeOptions<XAlphTokenTypes.RewardDepositedEvent>, fromCount?: number): EventSubscription;
6646
+ subscribeAllEvents(options: EventSubscribeOptions<XAlphTokenTypes.StakedEvent | XAlphTokenTypes.UnstakeScheduledEvent | XAlphTokenTypes.UnstakeCancelledEvent | XAlphTokenTypes.RewardDepositedEvent>, fromCount?: number): EventSubscription;
6528
6647
  view: {
6529
6648
  getSymbol: (params?: XAlphTokenTypes.CallMethodParams<"getSymbol">) => Promise<XAlphTokenTypes.CallMethodResult<"getSymbol">>;
6530
6649
  getName: (params?: XAlphTokenTypes.CallMethodParams<"getName">) => Promise<XAlphTokenTypes.CallMethodResult<"getName">>;
@@ -6538,11 +6657,15 @@ declare class XAlphTokenInstance extends ContractInstance {
6538
6657
  removeAt: (params: XAlphTokenTypes.CallMethodParams<"removeAt">) => Promise<XAlphTokenTypes.CallMethodResult<"removeAt">>;
6539
6658
  size: (params: XAlphTokenTypes.CallMethodParams<"size">) => Promise<XAlphTokenTypes.CallMethodResult<"size">>;
6540
6659
  empty: (params?: XAlphTokenTypes.CallMethodParams<"empty">) => Promise<XAlphTokenTypes.CallMethodResult<"empty">>;
6660
+ mulDiv: (params: XAlphTokenTypes.CallMethodParams<"mulDiv">) => Promise<XAlphTokenTypes.CallMethodResult<"mulDiv">>;
6661
+ getTotalDepositedAlph: (params?: XAlphTokenTypes.CallMethodParams<"getTotalDepositedAlph">) => Promise<XAlphTokenTypes.CallMethodResult<"getTotalDepositedAlph">>;
6541
6662
  stake: (params: XAlphTokenTypes.CallMethodParams<"stake">) => Promise<XAlphTokenTypes.CallMethodResult<"stake">>;
6542
6663
  startUnstake: (params: XAlphTokenTypes.CallMethodParams<"startUnstake">) => Promise<XAlphTokenTypes.CallMethodResult<"startUnstake">>;
6664
+ depositReward: (params: XAlphTokenTypes.CallMethodParams<"depositReward">) => Promise<XAlphTokenTypes.CallMethodResult<"depositReward">>;
6543
6665
  getActiveUnstakeVaultIndexes: (params: XAlphTokenTypes.CallMethodParams<"getActiveUnstakeVaultIndexes">) => Promise<XAlphTokenTypes.CallMethodResult<"getActiveUnstakeVaultIndexes">>;
6544
6666
  getClaimableAmount: (params: XAlphTokenTypes.CallMethodParams<"getClaimableAmount">) => Promise<XAlphTokenTypes.CallMethodResult<"getClaimableAmount">>;
6545
6667
  claimUnstaked: (params: XAlphTokenTypes.CallMethodParams<"claimUnstaked">) => Promise<XAlphTokenTypes.CallMethodResult<"claimUnstaked">>;
6668
+ cancelUnstake: (params: XAlphTokenTypes.CallMethodParams<"cancelUnstake">) => Promise<XAlphTokenTypes.CallMethodResult<"cancelUnstake">>;
6546
6669
  };
6547
6670
  transact: {
6548
6671
  getSymbol: (params: XAlphTokenTypes.SignExecuteMethodParams<"getSymbol">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"getSymbol">>;
@@ -6557,11 +6680,15 @@ declare class XAlphTokenInstance extends ContractInstance {
6557
6680
  removeAt: (params: XAlphTokenTypes.SignExecuteMethodParams<"removeAt">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"removeAt">>;
6558
6681
  size: (params: XAlphTokenTypes.SignExecuteMethodParams<"size">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"size">>;
6559
6682
  empty: (params: XAlphTokenTypes.SignExecuteMethodParams<"empty">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"empty">>;
6683
+ mulDiv: (params: XAlphTokenTypes.SignExecuteMethodParams<"mulDiv">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"mulDiv">>;
6684
+ getTotalDepositedAlph: (params: XAlphTokenTypes.SignExecuteMethodParams<"getTotalDepositedAlph">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"getTotalDepositedAlph">>;
6560
6685
  stake: (params: XAlphTokenTypes.SignExecuteMethodParams<"stake">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"stake">>;
6561
6686
  startUnstake: (params: XAlphTokenTypes.SignExecuteMethodParams<"startUnstake">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"startUnstake">>;
6687
+ depositReward: (params: XAlphTokenTypes.SignExecuteMethodParams<"depositReward">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"depositReward">>;
6562
6688
  getActiveUnstakeVaultIndexes: (params: XAlphTokenTypes.SignExecuteMethodParams<"getActiveUnstakeVaultIndexes">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"getActiveUnstakeVaultIndexes">>;
6563
6689
  getClaimableAmount: (params: XAlphTokenTypes.SignExecuteMethodParams<"getClaimableAmount">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"getClaimableAmount">>;
6564
6690
  claimUnstaked: (params: XAlphTokenTypes.SignExecuteMethodParams<"claimUnstaked">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"claimUnstaked">>;
6691
+ cancelUnstake: (params: XAlphTokenTypes.SignExecuteMethodParams<"cancelUnstake">) => Promise<XAlphTokenTypes.SignExecuteMethodResult<"cancelUnstake">>;
6565
6692
  };
6566
6693
  multicall<Calls extends XAlphTokenTypes.MultiCallParams>(calls: Calls): Promise<XAlphTokenTypes.MultiCallResults<Calls>>;
6567
6694
  multicall<Callss extends XAlphTokenTypes.MultiCallParams[]>(callss: Narrow<Callss>): Promise<XAlphTokenTypes.MulticallReturnType<Callss>>;
@@ -6571,18 +6698,12 @@ declare function getAllContracts$1(): ContractFactory<any>[];
6571
6698
  declare function registerContract$1(factory: ContractFactory<any>): void;
6572
6699
  declare function getContractByCodeHash$1(codeHash: string): Contract;
6573
6700
 
6574
- declare const AlphStakeAndLock: ExecutableScript<{
6575
- xAlphToken: HexString;
6576
- xAlphStakeVault: HexString;
6577
- amount: bigint;
6578
- }, null>;
6579
6701
  declare const XAlphUnlockAndStartUnstake: ExecutableScript<{
6580
6702
  xAlphToken: HexString;
6581
6703
  xAlphStakeVault: HexString;
6582
6704
  amount: bigint;
6583
6705
  }, null>;
6584
6706
 
6585
- declare const index$1_AlphStakeAndLock: typeof AlphStakeAndLock;
6586
6707
  declare const index$1_AlphUnstakeVault: typeof AlphUnstakeVault;
6587
6708
  type index$1_AlphUnstakeVaultInstance = AlphUnstakeVaultInstance;
6588
6709
  declare const index$1_AlphUnstakeVaultInstance: typeof AlphUnstakeVaultInstance;
@@ -6617,7 +6738,7 @@ declare const index$1_XAlphTokenInstance: typeof XAlphTokenInstance;
6617
6738
  declare const index$1_XAlphTokenTypes: typeof XAlphTokenTypes;
6618
6739
  declare const index$1_XAlphUnlockAndStartUnstake: typeof XAlphUnlockAndStartUnstake;
6619
6740
  declare namespace index$1 {
6620
- export { index$1_AlphStakeAndLock as AlphStakeAndLock, index$1_AlphUnstakeVault as AlphUnstakeVault, index$1_AlphUnstakeVaultInstance as AlphUnstakeVaultInstance, index$1_AlphUnstakeVaultTypes as AlphUnstakeVaultTypes, FullMathTest$1 as FullMathTest, FullMathTestInstance$1 as FullMathTestInstance, FullMathTestTypes$1 as FullMathTestTypes, index$1_GovernanceDemo as GovernanceDemo, index$1_GovernanceDemoInstance as GovernanceDemoInstance, index$1_GovernanceDemoTypes as GovernanceDemoTypes, index$1_RewardSharingVault as RewardSharingVault, index$1_RewardSharingVaultInstance as RewardSharingVaultInstance, index$1_RewardSharingVaultTypes as RewardSharingVaultTypes, index$1_TestDynamicArrayByteVec32 as TestDynamicArrayByteVec32, index$1_TestDynamicArrayByteVec32Instance as TestDynamicArrayByteVec32Instance, index$1_TestDynamicArrayByteVec32Types as TestDynamicArrayByteVec32Types, index$1_TestDynamicSortedArrayForU256 as TestDynamicSortedArrayForU256, index$1_TestDynamicSortedArrayForU256Instance as TestDynamicSortedArrayForU256Instance, index$1_TestDynamicSortedArrayForU256Types as TestDynamicSortedArrayForU256Types, index$1_TestMerkleProof as TestMerkleProof, index$1_TestMerkleProofInstance as TestMerkleProofInstance, index$1_TestMerkleProofTypes as TestMerkleProofTypes, index$1_XAlphStakeVault as XAlphStakeVault, index$1_XAlphStakeVaultInstance as XAlphStakeVaultInstance, index$1_XAlphStakeVaultTypes as XAlphStakeVaultTypes, index$1_XAlphToken as XAlphToken, index$1_XAlphTokenInstance as XAlphTokenInstance, index$1_XAlphTokenTypes as XAlphTokenTypes, index$1_XAlphUnlockAndStartUnstake as XAlphUnlockAndStartUnstake, getAllContracts$1 as getAllContracts, getContractByCodeHash$1 as getContractByCodeHash, registerContract$1 as registerContract };
6741
+ export { index$1_AlphUnstakeVault as AlphUnstakeVault, index$1_AlphUnstakeVaultInstance as AlphUnstakeVaultInstance, index$1_AlphUnstakeVaultTypes as AlphUnstakeVaultTypes, FullMathTest$1 as FullMathTest, FullMathTestInstance$1 as FullMathTestInstance, FullMathTestTypes$1 as FullMathTestTypes, index$1_GovernanceDemo as GovernanceDemo, index$1_GovernanceDemoInstance as GovernanceDemoInstance, index$1_GovernanceDemoTypes as GovernanceDemoTypes, index$1_RewardSharingVault as RewardSharingVault, index$1_RewardSharingVaultInstance as RewardSharingVaultInstance, index$1_RewardSharingVaultTypes as RewardSharingVaultTypes, index$1_TestDynamicArrayByteVec32 as TestDynamicArrayByteVec32, index$1_TestDynamicArrayByteVec32Instance as TestDynamicArrayByteVec32Instance, index$1_TestDynamicArrayByteVec32Types as TestDynamicArrayByteVec32Types, index$1_TestDynamicSortedArrayForU256 as TestDynamicSortedArrayForU256, index$1_TestDynamicSortedArrayForU256Instance as TestDynamicSortedArrayForU256Instance, index$1_TestDynamicSortedArrayForU256Types as TestDynamicSortedArrayForU256Types, index$1_TestMerkleProof as TestMerkleProof, index$1_TestMerkleProofInstance as TestMerkleProofInstance, index$1_TestMerkleProofTypes as TestMerkleProofTypes, index$1_XAlphStakeVault as XAlphStakeVault, index$1_XAlphStakeVaultInstance as XAlphStakeVaultInstance, index$1_XAlphStakeVaultTypes as XAlphStakeVaultTypes, index$1_XAlphToken as XAlphToken, index$1_XAlphTokenInstance as XAlphTokenInstance, index$1_XAlphTokenTypes as XAlphTokenTypes, index$1_XAlphUnlockAndStartUnstake as XAlphUnlockAndStartUnstake, getAllContracts$1 as getAllContracts, getContractByCodeHash$1 as getContractByCodeHash, registerContract$1 as registerContract };
6621
6742
  }
6622
6743
 
6623
6744
  interface StakingConfig {
@@ -6647,7 +6768,7 @@ declare class StakingModule extends ModuleBase {
6647
6768
  private config;
6648
6769
  private xAlphTokenContract;
6649
6770
  private stakeVaultContract;
6650
- constructor(scope: Zeta);
6771
+ constructor(scope: Powfi);
6651
6772
  setConfig(config: StakingConfig): void;
6652
6773
  getConfig(): StakingConfig;
6653
6774
  getXAlphToken(): XAlphTokenInstance;
@@ -6659,9 +6780,9 @@ declare class StakingModule extends ModuleBase {
6659
6780
  stakeAlph(amount: bigint): Promise<XAlphTokenTypes.SignExecuteMethodResult<'stake'>>;
6660
6781
  startUnstake(amount: bigint): Promise<XAlphTokenTypes.SignExecuteMethodResult<'startUnstake'>>;
6661
6782
  claimUnstaked(vaultIndex: bigint, amount: bigint): Promise<XAlphTokenTypes.SignExecuteMethodResult<'claimUnstaked'>>;
6783
+ cancelUnstake(vaultIndex: bigint): Promise<XAlphTokenTypes.SignExecuteMethodResult<'cancelUnstake'>>;
6662
6784
  stakeXAlph(amount: bigint): Promise<XAlphStakeVaultTypes.SignExecuteMethodResult<'stake'>>;
6663
6785
  unstakeXAlph(amount: bigint): Promise<XAlphStakeVaultTypes.SignExecuteMethodResult<'unstake'>>;
6664
- stakeAndLockAlph(amount: bigint): Promise<ExecuteScriptResult>;
6665
6786
  unlockAndStartUnstake(amount: bigint): Promise<ExecuteScriptResult>;
6666
6787
  getAlphUnstakeVault(userAddress: string, vaultIndex: bigint): AlphUnstakeVaultInstance;
6667
6788
  getAlphUnstakeVaultState(userAddress: string, vaultIndex: bigint): Promise<AlphUnstakeVaultTypes.State>;
@@ -6675,9 +6796,10 @@ declare class StakingModule extends ModuleBase {
6675
6796
  getSettings(): StakingSettings;
6676
6797
  private loadStakingConfig;
6677
6798
  private ensurePositiveAmount;
6799
+ private getStakerAddress;
6678
6800
  }
6679
6801
 
6680
- declare class Zeta {
6802
+ declare class Powfi {
6681
6803
  cpmm: CpmmModule;
6682
6804
  clmm: ClmmModule;
6683
6805
  token: TokenModule;
@@ -6688,8 +6810,8 @@ declare class Zeta {
6688
6810
  private _signer?;
6689
6811
  private _account?;
6690
6812
  private _network;
6691
- constructor(params: ZetaLoadParams);
6692
- static load(config: ZetaLoadParams): Zeta;
6813
+ constructor(params: PowfiLoadParams);
6814
+ static load(config: PowfiLoadParams): Powfi;
6693
6815
  set signer(signer: SignerProvider);
6694
6816
  set account(account: Account);
6695
6817
  get signer(): SignerProvider;
@@ -6708,22 +6830,22 @@ declare const BPS = 10000n;
6708
6830
  declare function normalizeAddress(address: string, group: number): string;
6709
6831
  declare function sortTokens(tokenAId: string, tokenBId: string): [string, string];
6710
6832
 
6711
- declare class ZetaSDKError extends Error {
6833
+ declare class PowfiSDKError extends Error {
6712
6834
  constructor(message: string, options?: ErrorOptions);
6713
6835
  }
6714
- declare class InsufficientLiquidityError extends ZetaSDKError {
6836
+ declare class InsufficientLiquidityError extends PowfiSDKError {
6715
6837
  constructor(message?: string);
6716
6838
  }
6717
- declare class PriceImpactTooHighError extends ZetaSDKError {
6839
+ declare class PriceImpactTooHighError extends PowfiSDKError {
6718
6840
  constructor(priceImpact: number, maxPriceImpact: number);
6719
6841
  }
6720
- declare class PoolNotFoundError extends ZetaSDKError {
6842
+ declare class PoolNotFoundError extends PowfiSDKError {
6721
6843
  constructor(poolId: string);
6722
6844
  }
6723
- declare class InsufficientBalanceError extends ZetaSDKError {
6845
+ declare class InsufficientBalanceError extends PowfiSDKError {
6724
6846
  constructor(token: string, required: string, available: string);
6725
6847
  }
6726
- declare class TokenListFetchError extends ZetaSDKError {
6848
+ declare class TokenListFetchError extends PowfiSDKError {
6727
6849
  readonly status?: number;
6728
6850
  constructor(url: string, options?: {
6729
6851
  status?: number;
@@ -6779,9 +6901,9 @@ declare class TickUtils {
6779
6901
  tick: bigint;
6780
6902
  price: number;
6781
6903
  };
6782
- static getNextSqrtPrice(sqrtPriceX96: bigint, liquidity: bigint, amount: bigint, zeroForOne: boolean): bigint;
6783
6904
  static getNextSqrtPriceFromAmount0(sqrtPriceX96: bigint, liquidity: bigint, amount: bigint): bigint;
6784
6905
  static getNextSqrtPriceFromAmount1(sqrtPriceX96: bigint, liquidity: bigint, amount: bigint): bigint;
6906
+ static getNextSqrtPrice(sqrtPX96: bigint, liquidity: bigint, amount: bigint, zeroForOne: boolean): bigint;
6785
6907
  static getSqrtPriceLimitX96(sqrtPriceX96: bigint, slippage: bigint, zeroForOne: boolean): bigint;
6786
6908
  static getSqrtPriceX96Bounds(sqrtPriceX96: bigint, slippage: bigint): [bigint, bigint];
6787
6909
  private static priceSqrt;
@@ -6796,7 +6918,7 @@ declare const UNLIMITED_AMOUNT: bigint;
6796
6918
  declare class PoolUtils {
6797
6919
  static getPositionId(poolAddress: string, owner: string, tickLower: bigint, tickUpper: bigint): string;
6798
6920
  static computeSwapStep(sqrtPriceX96: bigint, sqrtPriceTargetX96: bigint, liquidity: bigint, amount: bigint, feePips: bigint): [bigint, bigint, bigint, bigint];
6799
- static offlineSwap(liqDist: LiquidityDistribution, amountSpecified: bigint, sqrtPriceX96: bigint): bigint;
6921
+ static offlineSwap(liqDist: ClmmSimulateSwapQuote, amountSpecified: bigint, sqrtPriceX96: bigint): bigint;
6800
6922
  }
6801
6923
 
6802
6924
  declare class ClmmLiquidityUtils {
@@ -8610,6 +8732,7 @@ declare const CreatePairAndAddLiquidity: ExecutableScript<{
8610
8732
  token1Id: HexString;
8611
8733
  amount0: bigint;
8612
8734
  amount1: bigint;
8735
+ dexAccount: HexString;
8613
8736
  }, null>;
8614
8737
  declare const EnableFeeCollector: ExecutableScript<{
8615
8738
  tokenPairFactory: HexString;
@@ -8798,4 +8921,4 @@ type Deployments = {
8798
8921
  };
8799
8922
  declare function loadDeployments(networkId: NetworkId, deployerAddress?: string): Deployments;
8800
8923
 
8801
- export { type AddLiquidity$1 as AddLiquidity, type AddLiquidityDetails, type AddLiquidityParams, BPS, type ClaimableAmounts, type ClmmConfig, index$2 as ClmmContracts, ClmmLiquidityUtils, ClmmModule, type ClmmPoolConfig, type ClmmPoolContractState, PoolFactoryTypes as ClmmPoolFactoryTypes, PoolTypes as ClmmPoolTypes, type ClmmPositionInfo, PositionManagerTypes as ClmmPositionManagerTypes, scripts$1 as ClmmScripts, type ClmmSwapParams, type CollectProtocolFees, type CollectTokens, type ComputeLiquidityParams, type ComputeSwapParams, type CpmmConfig, index as CpmmContracts, CpmmModule, type CpmmPoolContractState, scripts as CpmmScripts, TokenPairFactoryTypes as CpmmTokenPairFactoryTypes, TokenPairTypes as CpmmTokenPairTypes, type CreatePoolParams, DEVNET, type ExtendRewards, type GetPositionAmountsFromPriceProps, type GetPositionAmountsFromPriceReturn, GovernanceDemoTypes, InsufficientBalanceError, InsufficientLiquidityError, type LiquidityDistribution, type LiquidityForPrice, LogLevel, Logger, MAX_PIPS, MAX_PRICE_IMPACT, MAX_TICK, MINIMUM_LIQUIDITY, MIN_TICK, MathUtil, type Network, type NetworkOverrides, type NumericLike, NumericUtils, PoolNotFoundError, PoolUtils, type PositionPath, PriceImpactTooHighError, type RemoveLiquidity$1 as RemoveLiquidity, type RemoveLiquidityDetails, type RemoveLiquidityParams, RewardSharingVaultTypes, type Rounding, type SetRewardParams, type SimulateSwap, type StakeVaultUserInfo, type StakingConfig, index$1 as StakingContracts, StakingModule, type StakingSettings, type SwapDetails, type SwapParams$1 as SwapParams, TickUtils, TokenListFetchError, TokenModule, U256_MAX, UNLIMITED_AMOUNT, XAlphStakeVaultTypes, XAlphTokenTypes, Zeta, type ZetaLoadParams, ZetaSDKError, createLogger, decodeContractIdList, decodeU256List, defaultNetworks, getStakingSettings, loadDeployments$1 as loadClmmDeployments, loadDeployments$2 as loadCpmmDeployments, loadDeployments as loadStakingDeployments, normalizeAddress, setLoggerLevel, sortTokens, stakingSettingsByNetwork };
8924
+ export { BPS, type ClmmAddLiquidityRequest, type ClmmCollectProtocolFeesRequest, type ClmmCollectTokensRequest, type ClmmConfig, index$2 as ClmmContracts, type ClmmExtendRewardsRequest, ClmmLiquidityUtils, ClmmModule, type ClmmPoolConfig, type ClmmPoolContractState, PoolFactoryTypes as ClmmPoolFactoryTypes, PoolTypes as ClmmPoolTypes, type ClmmPositionInfo, type ClmmPositionInfoRequest, PositionManagerTypes as ClmmPositionManagerTypes, type ClmmRemoveLiquidityRequest, scripts$1 as ClmmScripts, type ClmmSetRewardParamsRequest, type ClmmSimulateSwapParams, type ClmmSimulateSwapQuote, type ClmmSwapRequest, type CpmmAddLiquidityQuote, type CpmmAddLiquidityQuoteParams, type CpmmAddLiquidityRequest, type CpmmClaimableAmounts, type CpmmConfig, index as CpmmContracts, type CpmmCreatePoolRequest, type CpmmInputType, CpmmModule, type CpmmPoolContractState, type CpmmRemoveLiquidityQuote, type CpmmRemoveLiquidityRequest, scripts as CpmmScripts, type CpmmSlippageBps, type CpmmSwapQuote, type CpmmSwapQuoteParams, type CpmmSwapRequest, type CpmmTokenId, TokenPairFactoryTypes as CpmmTokenPairFactoryTypes, TokenPairTypes as CpmmTokenPairTypes, DEVNET, type GetPositionAmountsFromPriceProps, type GetPositionAmountsFromPriceReturn, GovernanceDemoTypes, InsufficientBalanceError, InsufficientLiquidityError, type LiquidityForPrice, LogLevel, Logger, MAX_PIPS, MAX_PRICE_IMPACT, MAX_TICK, MINIMUM_LIQUIDITY, MIN_TICK, MathUtil, type Network, type NetworkOverrides, type NumericLike, NumericUtils, PoolNotFoundError, PoolUtils, Powfi, type PowfiLoadParams, PowfiSDKError, PriceImpactTooHighError, RewardSharingVaultTypes, type Rounding, type StakeVaultUserInfo, type StakingConfig, index$1 as StakingContracts, StakingModule, type StakingSettings, TickUtils, TokenListFetchError, TokenModule, U256_MAX, UNLIMITED_AMOUNT, XAlphStakeVaultTypes, XAlphTokenTypes, createLogger, decodeContractIdList, decodeU256List, defaultNetworks, getStakingSettings, loadDeployments$1 as loadClmmDeployments, loadDeployments$2 as loadCpmmDeployments, loadDeployments as loadStakingDeployments, normalizeAddress, setLoggerLevel, sortTokens, stakingSettingsByNetwork };