@suilend/sdk 12.7.0 → 13.0.0-next.g803bba0

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 (84) hide show
  1. package/_generated/_dependencies/pyth-2/price-identifier/structs.d.ts +46 -0
  2. package/_generated/_dependencies/{source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e → pyth-2}/price-identifier/structs.js +45 -25
  3. package/_generated/_dependencies/std/ascii/structs.d.ts +100 -0
  4. package/_generated/_dependencies/{source/0x1 → std}/ascii/structs.js +153 -103
  5. package/_generated/_dependencies/{source/0x1 → std}/option/structs.d.ts +29 -21
  6. package/_generated/_dependencies/std/option/structs.js +155 -0
  7. package/_generated/_dependencies/std/type-name/structs.d.ts +65 -0
  8. package/_generated/_dependencies/{source/0x1 → std}/type-name/structs.js +49 -22
  9. package/_generated/_dependencies/sui/bag/structs.d.ts +75 -0
  10. package/_generated/_dependencies/sui/bag/structs.js +154 -0
  11. package/_generated/_dependencies/{source/0x2 → sui}/balance/structs.d.ts +80 -60
  12. package/_generated/_dependencies/sui/balance/structs.js +306 -0
  13. package/_generated/_dependencies/sui/object/structs.d.ts +104 -0
  14. package/_generated/_dependencies/{source/0x2 → sui}/object/structs.js +98 -46
  15. package/_generated/_dependencies/{source/0x2 → sui}/object-table/structs.d.ts +37 -30
  16. package/_generated/_dependencies/sui/object-table/structs.js +164 -0
  17. package/_generated/_envs/index.d.ts +3 -0
  18. package/_generated/_envs/index.js +18 -0
  19. package/_generated/_envs/mainnet.d.ts +2 -0
  20. package/_generated/_envs/mainnet.js +490 -0
  21. package/_generated/_framework/env.d.ts +137 -0
  22. package/_generated/_framework/env.js +261 -0
  23. package/_generated/_framework/reified.d.ts +68 -36
  24. package/_generated/_framework/reified.js +110 -98
  25. package/_generated/_framework/util.d.ts +4 -4
  26. package/_generated/_framework/util.js +82 -79
  27. package/_generated/_framework/vector.d.ts +11 -9
  28. package/_generated/_framework/vector.js +10 -10
  29. package/_generated/suilend/cell/structs.d.ts +24 -22
  30. package/_generated/suilend/cell/structs.js +68 -24
  31. package/_generated/suilend/decimal/structs.d.ts +28 -24
  32. package/_generated/suilend/decimal/structs.js +45 -24
  33. package/_generated/suilend/index.d.ts +5 -6
  34. package/_generated/suilend/index.js +10 -19
  35. package/_generated/suilend/lending-market/functions.d.ts +1123 -149
  36. package/_generated/suilend/lending-market/functions.js +1121 -207
  37. package/_generated/suilend/lending-market/structs.d.ts +985 -1290
  38. package/_generated/suilend/lending-market/structs.js +2482 -1282
  39. package/_generated/suilend/lending-market-registry/functions.d.ts +32 -3
  40. package/_generated/suilend/lending-market-registry/functions.js +30 -6
  41. package/_generated/suilend/liquidity-mining/structs.d.ts +200 -333
  42. package/_generated/suilend/liquidity-mining/structs.js +449 -319
  43. package/_generated/suilend/obligation/structs.d.ts +406 -918
  44. package/_generated/suilend/obligation/structs.js +786 -596
  45. package/_generated/suilend/rate-limiter/functions.d.ts +134 -15
  46. package/_generated/suilend/rate-limiter/functions.js +139 -21
  47. package/_generated/suilend/rate-limiter/structs.d.ts +72 -80
  48. package/_generated/suilend/rate-limiter/structs.js +98 -48
  49. package/_generated/suilend/reserve/structs.d.ts +611 -904
  50. package/_generated/suilend/reserve/structs.js +1528 -736
  51. package/_generated/suilend/reserve-config/functions.d.ts +718 -96
  52. package/_generated/suilend/reserve-config/functions.js +751 -157
  53. package/_generated/suilend/reserve-config/structs.d.ts +148 -163
  54. package/_generated/suilend/reserve-config/structs.js +260 -94
  55. package/client.d.ts +2 -2
  56. package/client.js +22 -39
  57. package/lib/initialize.d.ts +76 -76
  58. package/lib/initialize.js +10 -10
  59. package/lib/proCompatible.js +5 -5
  60. package/package.json +1 -1
  61. package/parsers/lendingMarket.d.ts +9 -9
  62. package/parsers/obligation.d.ts +14 -14
  63. package/parsers/obligation.js +4 -4
  64. package/parsers/rateLimiter.d.ts +1 -1
  65. package/parsers/reserve.d.ts +12 -12
  66. package/parsers/reserve.js +2 -2
  67. package/strategies.d.ts +14 -14
  68. package/utils/simulate.d.ts +1 -1
  69. package/utils/simulate.js +5 -5
  70. package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +0 -84
  71. package/_generated/_dependencies/source/0x1/index.d.ts +0 -3
  72. package/_generated/_dependencies/source/0x1/index.js +0 -3
  73. package/_generated/_dependencies/source/0x1/option/structs.js +0 -110
  74. package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +0 -47
  75. package/_generated/_dependencies/source/0x2/bag/structs.d.ts +0 -52
  76. package/_generated/_dependencies/source/0x2/bag/structs.js +0 -113
  77. package/_generated/_dependencies/source/0x2/balance/structs.js +0 -210
  78. package/_generated/_dependencies/source/0x2/index.d.ts +0 -3
  79. package/_generated/_dependencies/source/0x2/index.js +0 -3
  80. package/_generated/_dependencies/source/0x2/object/structs.d.ts +0 -82
  81. package/_generated/_dependencies/source/0x2/object-table/structs.js +0 -115
  82. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.d.ts +0 -4
  83. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js +0 -4
  84. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +0 -46
@@ -1,32 +1,151 @@
1
- import { Transaction, TransactionArgument, TransactionObjectInput } from "@mysten/sui/transactions";
1
+ import { Transaction, TransactionArgument, TransactionObjectInput, TransactionResult } from '@mysten/sui/transactions';
2
+ import type { EnvConfig } from '../../_envs';
3
+ export interface NewConfigArgs {
4
+ windowDuration: bigint | TransactionArgument;
5
+ maxOutflow: bigint | TransactionArgument;
6
+ }
7
+ /**
8
+ * Creates a new rate limiter configuration.
9
+ *
10
+ * # Arguments
11
+ *
12
+ * * `window_duration` - The duration of the rate limiter window in seconds.
13
+ * * `max_outflow` - The maximum allowed outflow in a single window.
14
+ *
15
+ * # Returns
16
+ *
17
+ * * `RateLimiterConfig` - A new configuration instance for the rate limiter.
18
+ *
19
+ * # Panics
20
+ *
21
+ * * If `window_duration` is zero (`EInvalidConfig`).
22
+ */
23
+ export declare function newConfig(tx: Transaction, args: NewConfigArgs, options?: {
24
+ env?: EnvConfig;
25
+ }): TransactionResult;
2
26
  export interface NewArgs {
3
27
  config: TransactionObjectInput;
4
28
  curTime: bigint | TransactionArgument;
5
29
  }
6
- export declare function new_(tx: Transaction, args: NewArgs): import("@mysten/sui/transactions").TransactionResult;
7
- export interface CurrentOutflowArgs {
30
+ /**
31
+ * Creates a new rate limiter with the specified configuration and current time.
32
+ *
33
+ * Initializes the rate limiter with zero previous and current quantities, setting the
34
+ * window start to the provided time.
35
+ *
36
+ * # Arguments
37
+ *
38
+ * * `config` - The `RateLimiterConfig` defining the window duration and max outflow.
39
+ * * `cur_time` - The current timestamp in seconds.
40
+ *
41
+ * # Returns
42
+ *
43
+ * * `RateLimiter` - A new rate limiter instance.
44
+ */
45
+ export declare function new_(tx: Transaction, args: NewArgs, options?: {
46
+ env?: EnvConfig;
47
+ }): TransactionResult;
48
+ export interface UpdateInternalArgs {
8
49
  rateLimiter: TransactionObjectInput;
9
50
  curTime: bigint | TransactionArgument;
10
51
  }
11
- export declare function currentOutflow(tx: Transaction, args: CurrentOutflowArgs): import("@mysten/sui/transactions").TransactionResult;
12
- export interface NewConfigArgs {
13
- windowDuration: bigint | TransactionArgument;
14
- maxOutflow: bigint | TransactionArgument;
52
+ /**
53
+ * Updates the rate limiter's state based on the current time.
54
+ *
55
+ * This internal function shifts the window forward if the current time exceeds the
56
+ * current window's end. It moves the current quantity to the previous quantity and
57
+ * resets the current quantity if within the next window, or clears both if the time
58
+ * is beyond two windows.
59
+ *
60
+ * # Arguments
61
+ *
62
+ * * `rate_limiter` - A mutable reference to the `RateLimiter` to update.
63
+ * * `cur_time` - The current timestamp in seconds.
64
+ *
65
+ * # Panics
66
+ *
67
+ * * If `cur_time` is less than the rate limiter's `window_start` (`EInvalidTime`).
68
+ */
69
+ export declare function updateInternal(tx: Transaction, args: UpdateInternalArgs, options?: {
70
+ env?: EnvConfig;
71
+ }): TransactionResult;
72
+ export interface CurrentOutflowArgs {
73
+ rateLimiter: TransactionObjectInput;
74
+ curTime: bigint | TransactionArgument;
15
75
  }
16
- export declare function newConfig(tx: Transaction, args: NewConfigArgs): import("@mysten/sui/transactions").TransactionResult;
76
+ /**
77
+ * Calculates the current outflow for the rate limiter.
78
+ *
79
+ * This function assumes an even distribution of the previous window's outflow and
80
+ * combines it with the current window's outflow, weighted by the time remaining in
81
+ * the previous window. Must be called after `update_internal`.
82
+ *
83
+ * # Arguments
84
+ *
85
+ * * `rate_limiter` - A reference to the `RateLimiter` to query.
86
+ * * `cur_time` - The current timestamp in seconds.
87
+ *
88
+ * # Returns
89
+ *
90
+ * * `Decimal` - The calculated current outflow, combining weighted previous and current quantities.
91
+ *
92
+ * # Panics
93
+ *
94
+ * * If the `window_duration` is zero, as this would lead to division by zero.
95
+ */
96
+ export declare function currentOutflow(tx: Transaction, args: CurrentOutflowArgs, options?: {
97
+ env?: EnvConfig;
98
+ }): TransactionResult;
17
99
  export interface ProcessQtyArgs {
18
100
  rateLimiter: TransactionObjectInput;
19
101
  curTime: bigint | TransactionArgument;
20
102
  qty: TransactionObjectInput;
21
103
  }
22
- export declare function processQty(tx: Transaction, args: ProcessQtyArgs): import("@mysten/sui/transactions").TransactionResult;
104
+ /**
105
+ * Processes a new outflow quantity, updating the rate limiter and checking the limit.
106
+ *
107
+ * Updates the rate limiter's state and adds the specified quantity to the current
108
+ * window's outflow. It ensures the total outflow does not exceed the configured maximum.
109
+ *
110
+ * # Arguments
111
+ *
112
+ * * `rate_limiter` - A mutable reference to the `RateLimiter` to update.
113
+ * * `cur_time` - The current timestamp in seconds.
114
+ * * `qty` - The outflow quantity to process, as a `Decimal`.
115
+ *
116
+ * # Panics
117
+ *
118
+ * * If `cur_time` is less than the rate limiter's `window_start` (`EInvalidTime`).
119
+ * * If the total outflow exceeds the configured `max_outflow` (`ERateLimitExceeded`).
120
+ * * If the `window_duration` is zero, as this would lead to division by zero in `current_outflow`.
121
+ */
122
+ export declare function processQty(tx: Transaction, args: ProcessQtyArgs, options?: {
123
+ env?: EnvConfig;
124
+ }): TransactionResult;
23
125
  export interface RemainingOutflowArgs {
24
126
  rateLimiter: TransactionObjectInput;
25
127
  curTime: bigint | TransactionArgument;
26
128
  }
27
- export declare function remainingOutflow(tx: Transaction, args: RemainingOutflowArgs): import("@mysten/sui/transactions").TransactionResult;
28
- export interface UpdateInternalArgs {
29
- rateLimiter: TransactionObjectInput;
30
- curTime: bigint | TransactionArgument;
31
- }
32
- export declare function updateInternal(tx: Transaction, args: UpdateInternalArgs): import("@mysten/sui/transactions").TransactionResult;
129
+ /**
130
+ * Calculates the remaining outflow capacity in the current window.
131
+ *
132
+ * Updates the rate limiter's state and returns the difference between the maximum
133
+ * allowed outflow and the current outflow, ensuring non-negative results.
134
+ *
135
+ * # Arguments
136
+ *
137
+ * * `rate_limiter` - A mutable reference to the `RateLimiter` to query.
138
+ * * `cur_time` - The current timestamp in seconds.
139
+ *
140
+ * # Returns
141
+ *
142
+ * * `Decimal` - The remaining outflow capacity in the current window.
143
+ *
144
+ * # Panics
145
+ *
146
+ * * If `cur_time` is less than the rate limiter's `window_start` (`EInvalidTime`).
147
+ * * If the `window_duration` is zero, as this would lead to division by zero in `current_outflow`.
148
+ */
149
+ export declare function remainingOutflow(tx: Transaction, args: RemainingOutflowArgs, options?: {
150
+ env?: EnvConfig;
151
+ }): TransactionResult;
@@ -1,45 +1,163 @@
1
- import { PUBLISHED_AT } from "../index.js";
2
- import { obj, pure } from "../../_framework/util.js";
3
- export function new_(tx, args) {
1
+ import { getPublishedAt } from '../../_envs/index.js';
2
+ import { obj, pure } from '../../_framework/util.js';
3
+ /**
4
+ * Creates a new rate limiter configuration.
5
+ *
6
+ * # Arguments
7
+ *
8
+ * * `window_duration` - The duration of the rate limiter window in seconds.
9
+ * * `max_outflow` - The maximum allowed outflow in a single window.
10
+ *
11
+ * # Returns
12
+ *
13
+ * * `RateLimiterConfig` - A new configuration instance for the rate limiter.
14
+ *
15
+ * # Panics
16
+ *
17
+ * * If `window_duration` is zero (`EInvalidConfig`).
18
+ */
19
+ export function newConfig(tx, args, options) {
4
20
  return tx.moveCall({
5
- target: `${PUBLISHED_AT}::rate_limiter::new`,
6
- arguments: [obj(tx, args.config), pure(tx, args.curTime, `u64`)],
21
+ target: `${getPublishedAt('suilend', options?.env)}::rate_limiter::new_config`,
22
+ arguments: [
23
+ pure(tx, args.windowDuration, `u64`),
24
+ pure(tx, args.maxOutflow, `u64`),
25
+ ],
7
26
  });
8
27
  }
9
- export function currentOutflow(tx, args) {
28
+ /**
29
+ * Creates a new rate limiter with the specified configuration and current time.
30
+ *
31
+ * Initializes the rate limiter with zero previous and current quantities, setting the
32
+ * window start to the provided time.
33
+ *
34
+ * # Arguments
35
+ *
36
+ * * `config` - The `RateLimiterConfig` defining the window duration and max outflow.
37
+ * * `cur_time` - The current timestamp in seconds.
38
+ *
39
+ * # Returns
40
+ *
41
+ * * `RateLimiter` - A new rate limiter instance.
42
+ */
43
+ export function new_(tx, args, options) {
10
44
  return tx.moveCall({
11
- target: `${PUBLISHED_AT}::rate_limiter::current_outflow`,
12
- arguments: [obj(tx, args.rateLimiter), pure(tx, args.curTime, `u64`)],
45
+ target: `${getPublishedAt('suilend', options?.env)}::rate_limiter::new`,
46
+ arguments: [
47
+ obj(tx, args.config),
48
+ pure(tx, args.curTime, `u64`),
49
+ ],
13
50
  });
14
51
  }
15
- export function newConfig(tx, args) {
52
+ /**
53
+ * Updates the rate limiter's state based on the current time.
54
+ *
55
+ * This internal function shifts the window forward if the current time exceeds the
56
+ * current window's end. It moves the current quantity to the previous quantity and
57
+ * resets the current quantity if within the next window, or clears both if the time
58
+ * is beyond two windows.
59
+ *
60
+ * # Arguments
61
+ *
62
+ * * `rate_limiter` - A mutable reference to the `RateLimiter` to update.
63
+ * * `cur_time` - The current timestamp in seconds.
64
+ *
65
+ * # Panics
66
+ *
67
+ * * If `cur_time` is less than the rate limiter's `window_start` (`EInvalidTime`).
68
+ */
69
+ export function updateInternal(tx, args, options) {
16
70
  return tx.moveCall({
17
- target: `${PUBLISHED_AT}::rate_limiter::new_config`,
71
+ target: `${getPublishedAt('suilend', options?.env)}::rate_limiter::update_internal`,
18
72
  arguments: [
19
- pure(tx, args.windowDuration, `u64`),
20
- pure(tx, args.maxOutflow, `u64`),
73
+ obj(tx, args.rateLimiter),
74
+ pure(tx, args.curTime, `u64`),
21
75
  ],
22
76
  });
23
77
  }
24
- export function processQty(tx, args) {
78
+ /**
79
+ * Calculates the current outflow for the rate limiter.
80
+ *
81
+ * This function assumes an even distribution of the previous window's outflow and
82
+ * combines it with the current window's outflow, weighted by the time remaining in
83
+ * the previous window. Must be called after `update_internal`.
84
+ *
85
+ * # Arguments
86
+ *
87
+ * * `rate_limiter` - A reference to the `RateLimiter` to query.
88
+ * * `cur_time` - The current timestamp in seconds.
89
+ *
90
+ * # Returns
91
+ *
92
+ * * `Decimal` - The calculated current outflow, combining weighted previous and current quantities.
93
+ *
94
+ * # Panics
95
+ *
96
+ * * If the `window_duration` is zero, as this would lead to division by zero.
97
+ */
98
+ export function currentOutflow(tx, args, options) {
25
99
  return tx.moveCall({
26
- target: `${PUBLISHED_AT}::rate_limiter::process_qty`,
100
+ target: `${getPublishedAt('suilend', options?.env)}::rate_limiter::current_outflow`,
27
101
  arguments: [
28
102
  obj(tx, args.rateLimiter),
29
103
  pure(tx, args.curTime, `u64`),
30
- obj(tx, args.qty),
31
104
  ],
32
105
  });
33
106
  }
34
- export function remainingOutflow(tx, args) {
107
+ /**
108
+ * Processes a new outflow quantity, updating the rate limiter and checking the limit.
109
+ *
110
+ * Updates the rate limiter's state and adds the specified quantity to the current
111
+ * window's outflow. It ensures the total outflow does not exceed the configured maximum.
112
+ *
113
+ * # Arguments
114
+ *
115
+ * * `rate_limiter` - A mutable reference to the `RateLimiter` to update.
116
+ * * `cur_time` - The current timestamp in seconds.
117
+ * * `qty` - The outflow quantity to process, as a `Decimal`.
118
+ *
119
+ * # Panics
120
+ *
121
+ * * If `cur_time` is less than the rate limiter's `window_start` (`EInvalidTime`).
122
+ * * If the total outflow exceeds the configured `max_outflow` (`ERateLimitExceeded`).
123
+ * * If the `window_duration` is zero, as this would lead to division by zero in `current_outflow`.
124
+ */
125
+ export function processQty(tx, args, options) {
35
126
  return tx.moveCall({
36
- target: `${PUBLISHED_AT}::rate_limiter::remaining_outflow`,
37
- arguments: [obj(tx, args.rateLimiter), pure(tx, args.curTime, `u64`)],
127
+ target: `${getPublishedAt('suilend', options?.env)}::rate_limiter::process_qty`,
128
+ arguments: [
129
+ obj(tx, args.rateLimiter),
130
+ pure(tx, args.curTime, `u64`),
131
+ obj(tx, args.qty),
132
+ ],
38
133
  });
39
134
  }
40
- export function updateInternal(tx, args) {
135
+ /**
136
+ * Calculates the remaining outflow capacity in the current window.
137
+ *
138
+ * Updates the rate limiter's state and returns the difference between the maximum
139
+ * allowed outflow and the current outflow, ensuring non-negative results.
140
+ *
141
+ * # Arguments
142
+ *
143
+ * * `rate_limiter` - A mutable reference to the `RateLimiter` to query.
144
+ * * `cur_time` - The current timestamp in seconds.
145
+ *
146
+ * # Returns
147
+ *
148
+ * * `Decimal` - The remaining outflow capacity in the current window.
149
+ *
150
+ * # Panics
151
+ *
152
+ * * If `cur_time` is less than the rate limiter's `window_start` (`EInvalidTime`).
153
+ * * If the `window_duration` is zero, as this would lead to division by zero in `current_outflow`.
154
+ */
155
+ export function remainingOutflow(tx, args, options) {
41
156
  return tx.moveCall({
42
- target: `${PUBLISHED_AT}::rate_limiter::update_internal`,
43
- arguments: [obj(tx, args.rateLimiter), pure(tx, args.curTime, `u64`)],
157
+ target: `${getPublishedAt('suilend', options?.env)}::rate_limiter::remaining_outflow`,
158
+ arguments: [
159
+ obj(tx, args.rateLimiter),
160
+ pure(tx, args.curTime, `u64`),
161
+ ],
44
162
  });
45
163
  }
@@ -1,122 +1,114 @@
1
- import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../_framework/reified";
2
- import { FieldsWithTypes } from "../../_framework/util";
3
- import { Decimal } from "../decimal/structs";
4
- import { PKG_V1 } from "../index";
5
- import { SuiGrpcClient } from "@mysten/sui/grpc";
1
+ import type { ClientWithCoreApi, SuiClientTypes } from '@mysten/sui/client';
2
+ import { PhantomReified, Reified, StructClass, ToField, ToJSON, ToTypeStr } from '../../_framework/reified';
3
+ import { FieldsWithTypes } from '../../_framework/util';
4
+ import { Decimal } from '../decimal/structs';
6
5
  export declare function isRateLimiter(type: string): boolean;
7
6
  export interface RateLimiterFields {
7
+ /** Configuration parameters for the rate limiter. */
8
8
  config: ToField<RateLimiterConfig>;
9
+ /** The sum of all outflows from the previous window. */
9
10
  prevQty: ToField<Decimal>;
10
- windowStart: ToField<"u64">;
11
+ /** The timestamp (in seconds) when the current window started. */
12
+ windowStart: ToField<'u64'>;
13
+ /** The sum of all outflows in the current window. */
11
14
  curQty: ToField<Decimal>;
12
15
  }
13
16
  export type RateLimiterReified = Reified<RateLimiter, RateLimiterFields>;
17
+ export type RateLimiterJSONField = {
18
+ config: ToJSON<RateLimiterConfig>;
19
+ prevQty: ToJSON<Decimal>;
20
+ windowStart: string;
21
+ curQty: ToJSON<Decimal>;
22
+ };
23
+ export type RateLimiterJSON = {
24
+ $typeName: typeof RateLimiter.$typeName;
25
+ $typeArgs: [];
26
+ } & RateLimiterJSONField;
27
+ /** A structure to manage rate limiting for outflows within a specified time window. */
14
28
  export declare class RateLimiter implements StructClass {
15
29
  __StructClass: true;
16
- static readonly $typeName: string;
30
+ static get $typeName(): `${string}::rate_limiter::RateLimiter`;
17
31
  static readonly $numTypeParams = 0;
18
32
  static readonly $isPhantom: readonly [];
19
- readonly $typeName: string;
20
- readonly $fullTypeName: `${typeof PKG_V1}::rate_limiter::RateLimiter`;
33
+ readonly $typeName: typeof RateLimiter.$typeName;
34
+ readonly $fullTypeName: `${string}::rate_limiter::RateLimiter`;
21
35
  readonly $typeArgs: [];
22
- readonly $isPhantom: readonly [];
36
+ readonly $isPhantom: typeof RateLimiter.$isPhantom;
37
+ /** Configuration parameters for the rate limiter. */
23
38
  readonly config: ToField<RateLimiterConfig>;
39
+ /** The sum of all outflows from the previous window. */
24
40
  readonly prevQty: ToField<Decimal>;
25
- readonly windowStart: ToField<"u64">;
41
+ /** The timestamp (in seconds) when the current window started. */
42
+ readonly windowStart: ToField<'u64'>;
43
+ /** The sum of all outflows in the current window. */
26
44
  readonly curQty: ToField<Decimal>;
27
45
  private constructor();
28
46
  static reified(): RateLimiterReified;
29
- static get r(): import("../../_framework/reified").StructClassReified<RateLimiter, RateLimiterFields>;
47
+ static get r(): RateLimiterReified;
30
48
  static phantom(): PhantomReified<ToTypeStr<RateLimiter>>;
31
- static get p(): PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::rate_limiter::RateLimiter" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::rate_limiter::RateLimiter">;
32
- static get bcs(): import("@mysten/bcs").BcsStruct<{
33
- config: import("@mysten/bcs").BcsStruct<{
34
- window_duration: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
35
- max_outflow: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
36
- }, string>;
37
- prev_qty: import("@mysten/bcs").BcsStruct<{
38
- value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u256">;
39
- }, string>;
40
- window_start: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
41
- cur_qty: import("@mysten/bcs").BcsStruct<{
42
- value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u256">;
43
- }, string>;
44
- }, string>;
49
+ static get p(): PhantomReified<ToTypeStr<RateLimiter>>;
50
+ private static instantiateBcs;
51
+ private static cachedBcs;
52
+ static get bcs(): ReturnType<typeof RateLimiter.instantiateBcs>;
45
53
  static fromFields(fields: Record<string, any>): RateLimiter;
46
54
  static fromFieldsWithTypes(item: FieldsWithTypes): RateLimiter;
47
55
  static fromBcs(data: Uint8Array): RateLimiter;
48
- toJSONField(): {
49
- config: {
50
- windowDuration: string;
51
- maxOutflow: string;
52
- };
53
- prevQty: {
54
- value: string;
55
- };
56
- windowStart: string;
57
- curQty: {
58
- value: string;
59
- };
60
- };
61
- toJSON(): {
62
- config: {
63
- windowDuration: string;
64
- maxOutflow: string;
65
- };
66
- prevQty: {
67
- value: string;
68
- };
69
- windowStart: string;
70
- curQty: {
71
- value: string;
72
- };
73
- $typeName: string;
74
- $typeArgs: [];
75
- };
56
+ toJSONField(): RateLimiterJSONField;
57
+ toJSON(): RateLimiterJSON;
76
58
  static fromJSONField(field: any): RateLimiter;
77
59
  static fromJSON(json: Record<string, any>): RateLimiter;
78
- static fetch(client: SuiGrpcClient, id: string): Promise<RateLimiter>;
60
+ static fromCoreObject(obj: SuiClientTypes.Object<{
61
+ content: true;
62
+ }>): RateLimiter;
63
+ static fetch(client: ClientWithCoreApi, id: string): Promise<RateLimiter>;
79
64
  }
80
65
  export declare function isRateLimiterConfig(type: string): boolean;
81
66
  export interface RateLimiterConfigFields {
82
- windowDuration: ToField<"u64">;
83
- maxOutflow: ToField<"u64">;
67
+ /** The duration of the rate limiter window in seconds. */
68
+ windowDuration: ToField<'u64'>;
69
+ /** The maximum allowed outflow in a single window. */
70
+ maxOutflow: ToField<'u64'>;
84
71
  }
85
72
  export type RateLimiterConfigReified = Reified<RateLimiterConfig, RateLimiterConfigFields>;
73
+ export type RateLimiterConfigJSONField = {
74
+ windowDuration: string;
75
+ maxOutflow: string;
76
+ };
77
+ export type RateLimiterConfigJSON = {
78
+ $typeName: typeof RateLimiterConfig.$typeName;
79
+ $typeArgs: [];
80
+ } & RateLimiterConfigJSONField;
81
+ /** Configuration for the rate limiter, defining the window duration and maximum outflow. */
86
82
  export declare class RateLimiterConfig implements StructClass {
87
83
  __StructClass: true;
88
- static readonly $typeName: string;
84
+ static get $typeName(): `${string}::rate_limiter::RateLimiterConfig`;
89
85
  static readonly $numTypeParams = 0;
90
86
  static readonly $isPhantom: readonly [];
91
- readonly $typeName: string;
92
- readonly $fullTypeName: `${typeof PKG_V1}::rate_limiter::RateLimiterConfig`;
87
+ readonly $typeName: typeof RateLimiterConfig.$typeName;
88
+ readonly $fullTypeName: `${string}::rate_limiter::RateLimiterConfig`;
93
89
  readonly $typeArgs: [];
94
- readonly $isPhantom: readonly [];
95
- readonly windowDuration: ToField<"u64">;
96
- readonly maxOutflow: ToField<"u64">;
90
+ readonly $isPhantom: typeof RateLimiterConfig.$isPhantom;
91
+ /** The duration of the rate limiter window in seconds. */
92
+ readonly windowDuration: ToField<'u64'>;
93
+ /** The maximum allowed outflow in a single window. */
94
+ readonly maxOutflow: ToField<'u64'>;
97
95
  private constructor();
98
96
  static reified(): RateLimiterConfigReified;
99
- static get r(): import("../../_framework/reified").StructClassReified<RateLimiterConfig, RateLimiterConfigFields>;
97
+ static get r(): RateLimiterConfigReified;
100
98
  static phantom(): PhantomReified<ToTypeStr<RateLimiterConfig>>;
101
- static get p(): PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::rate_limiter::RateLimiterConfig" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::rate_limiter::RateLimiterConfig">;
102
- static get bcs(): import("@mysten/bcs").BcsStruct<{
103
- window_duration: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
104
- max_outflow: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
105
- }, string>;
99
+ static get p(): PhantomReified<ToTypeStr<RateLimiterConfig>>;
100
+ private static instantiateBcs;
101
+ private static cachedBcs;
102
+ static get bcs(): ReturnType<typeof RateLimiterConfig.instantiateBcs>;
106
103
  static fromFields(fields: Record<string, any>): RateLimiterConfig;
107
104
  static fromFieldsWithTypes(item: FieldsWithTypes): RateLimiterConfig;
108
105
  static fromBcs(data: Uint8Array): RateLimiterConfig;
109
- toJSONField(): {
110
- windowDuration: string;
111
- maxOutflow: string;
112
- };
113
- toJSON(): {
114
- windowDuration: string;
115
- maxOutflow: string;
116
- $typeName: string;
117
- $typeArgs: [];
118
- };
106
+ toJSONField(): RateLimiterConfigJSONField;
107
+ toJSON(): RateLimiterConfigJSON;
119
108
  static fromJSONField(field: any): RateLimiterConfig;
120
109
  static fromJSON(json: Record<string, any>): RateLimiterConfig;
121
- static fetch(client: SuiGrpcClient, id: string): Promise<RateLimiterConfig>;
110
+ static fromCoreObject(obj: SuiClientTypes.Object<{
111
+ content: true;
112
+ }>): RateLimiterConfig;
113
+ static fetch(client: ClientWithCoreApi, id: string): Promise<RateLimiterConfig>;
122
114
  }