@suilend/sdk 2.0.3 → 3.0.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.
- package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +7 -11
- package/_generated/_dependencies/source/0x1/ascii/structs.js +6 -63
- package/_generated/_dependencies/source/0x1/option/structs.d.ts +3 -9
- package/_generated/_dependencies/source/0x1/option/structs.js +4 -42
- package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +5 -7
- package/_generated/_dependencies/source/0x1/type-name/structs.js +3 -32
- package/_generated/_dependencies/source/0x2/bag/structs.d.ts +7 -9
- package/_generated/_dependencies/source/0x2/bag/structs.js +3 -31
- package/_generated/_dependencies/source/0x2/balance/structs.d.ts +7 -11
- package/_generated/_dependencies/source/0x2/balance/structs.js +7 -82
- package/_generated/_dependencies/source/0x2/object/structs.d.ts +8 -12
- package/_generated/_dependencies/source/0x2/object/structs.js +7 -61
- package/_generated/_dependencies/source/0x2/object-table/structs.d.ts +7 -9
- package/_generated/_dependencies/source/0x2/object-table/structs.js +4 -44
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.d.ts +5 -7
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js +3 -31
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.d.ts +11 -13
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js +3 -32
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.d.ts +23 -25
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js +3 -32
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +4 -6
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +3 -33
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.d.ts +55 -59
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js +6 -64
- package/_generated/_framework/reified.d.ts +2 -4
- package/_generated/_framework/vector.d.ts +2 -12
- package/_generated/suilend/cell/structs.d.ts +4 -10
- package/_generated/suilend/cell/structs.js +4 -42
- package/_generated/suilend/decimal/structs.d.ts +4 -6
- package/_generated/suilend/decimal/structs.js +3 -32
- package/_generated/suilend/lending-market/structs.d.ts +152 -392
- package/_generated/suilend/lending-market/structs.js +50 -548
- package/_generated/suilend/liquidity-mining/structs.d.ts +50 -158
- package/_generated/suilend/liquidity-mining/structs.js +16 -169
- package/_generated/suilend/obligation/structs.d.ts +108 -148
- package/_generated/suilend/obligation/structs.js +23 -232
- package/_generated/suilend/rate-limiter/structs.d.ts +15 -19
- package/_generated/suilend/rate-limiter/structs.js +6 -64
- package/_generated/suilend/reserve/structs.d.ts +138 -362
- package/_generated/suilend/reserve/structs.js +29 -327
- package/_generated/suilend/reserve-config/structs.d.ts +33 -37
- package/_generated/suilend/reserve-config/structs.js +6 -65
- package/client.d.ts +8 -8
- package/client.js +55 -88
- package/lib/initialize.d.ts +29 -28
- package/lib/initialize.js +16 -12
- package/lib/liquidityMining.d.ts +3 -3
- package/lib/pythAdapter.d.ts +9 -0
- package/lib/pythAdapter.js +121 -0
- package/lib/strategyOwnerCap.d.ts +12 -7
- package/lib/strategyOwnerCap.js +159 -156
- package/margin/margin/admin_cap.d.ts +2 -2
- package/margin/margin/deps/std/type_name.d.ts +1 -1
- package/margin/margin/deps/sui/vec_set.d.ts +3 -5
- package/margin/margin/deps/suilend/lending_market.d.ts +2 -2
- package/margin/margin/market.d.ts +21 -38
- package/margin/margin/position.d.ts +47 -47
- package/margin/margin/router.d.ts +5 -5
- package/margin/margin/version.d.ts +1 -1
- package/package.json +1 -1
- package/parsers/lendingMarket.d.ts +6 -6
- package/parsers/obligation.d.ts +8 -8
- package/parsers/reserve.d.ts +8 -8
- package/strategies.d.ts +38 -21
- package/strategies.js +239 -79
- package/swap/quote.d.ts +1 -9
- package/swap/quote.js +1 -52
- package/swap/transaction.d.ts +2 -4
- package/swap/transaction.js +9 -25
- package/utils/events.d.ts +6 -5
- package/utils/events.js +11 -8
- package/utils/obligation.d.ts +6 -5
- package/utils/obligation.js +118 -117
|
@@ -8,7 +8,7 @@ import { FieldsWithTypes } from "../../_framework/util";
|
|
|
8
8
|
import { Vector } from "../../_framework/vector";
|
|
9
9
|
import { Decimal } from "../decimal/structs";
|
|
10
10
|
import { PKG_V1 } from "../index";
|
|
11
|
-
import {
|
|
11
|
+
import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
12
12
|
export declare function isPoolReward(type: string): boolean;
|
|
13
13
|
export interface PoolRewardFields {
|
|
14
14
|
id: ToField<UID>;
|
|
@@ -47,39 +47,39 @@ export declare class PoolReward implements StructClass {
|
|
|
47
47
|
static get r(): reified.StructClassReified<PoolReward, PoolRewardFields>;
|
|
48
48
|
static phantom(): PhantomReified<ToTypeStr<PoolReward>>;
|
|
49
49
|
static get p(): reified.PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::liquidity_mining::PoolReward" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::liquidity_mining::PoolReward">;
|
|
50
|
-
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
51
|
-
id: import("@mysten/bcs").BcsStruct<{
|
|
52
|
-
id: import("@mysten/bcs").BcsStruct<{
|
|
53
|
-
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
50
|
+
static get bcs(): import("@mysten/sui/bcs").BcsStruct<{
|
|
51
|
+
id: import("@mysten/sui/bcs").BcsStruct<{
|
|
52
|
+
id: import("@mysten/sui/bcs").BcsStruct<{
|
|
53
|
+
bytes: import("@mysten/sui/bcs").BcsType<string, string, string>;
|
|
54
54
|
}, string>;
|
|
55
55
|
}, string>;
|
|
56
|
-
pool_reward_manager_id: import("@mysten/bcs").BcsStruct<{
|
|
57
|
-
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
56
|
+
pool_reward_manager_id: import("@mysten/sui/bcs").BcsStruct<{
|
|
57
|
+
bytes: import("@mysten/sui/bcs").BcsType<string, string, string>;
|
|
58
58
|
}, string>;
|
|
59
|
-
coin_type: import("@mysten/bcs").BcsStruct<{
|
|
60
|
-
name: import("@mysten/bcs").BcsStruct<{
|
|
61
|
-
bytes: import("@mysten/bcs").BcsType<number[], Iterable<number> & {
|
|
59
|
+
coin_type: import("@mysten/sui/bcs").BcsStruct<{
|
|
60
|
+
name: import("@mysten/sui/bcs").BcsStruct<{
|
|
61
|
+
bytes: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
|
|
62
62
|
length: number;
|
|
63
63
|
}, string>;
|
|
64
64
|
}, string>;
|
|
65
65
|
}, string>;
|
|
66
|
-
start_time_ms: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
67
|
-
end_time_ms: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
68
|
-
total_rewards: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
69
|
-
allocated_rewards: import("@mysten/bcs").BcsStruct<{
|
|
70
|
-
value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
66
|
+
start_time_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
67
|
+
end_time_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
68
|
+
total_rewards: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
69
|
+
allocated_rewards: import("@mysten/sui/bcs").BcsStruct<{
|
|
70
|
+
value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
71
71
|
}, string>;
|
|
72
|
-
cumulative_rewards_per_share: import("@mysten/bcs").BcsStruct<{
|
|
73
|
-
value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
72
|
+
cumulative_rewards_per_share: import("@mysten/sui/bcs").BcsStruct<{
|
|
73
|
+
value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
74
74
|
}, string>;
|
|
75
|
-
num_user_reward_managers: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
76
|
-
additional_fields: import("@mysten/bcs").BcsStruct<{
|
|
77
|
-
id: import("@mysten/bcs").BcsStruct<{
|
|
78
|
-
id: import("@mysten/bcs").BcsStruct<{
|
|
79
|
-
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
75
|
+
num_user_reward_managers: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
76
|
+
additional_fields: import("@mysten/sui/bcs").BcsStruct<{
|
|
77
|
+
id: import("@mysten/sui/bcs").BcsStruct<{
|
|
78
|
+
id: import("@mysten/sui/bcs").BcsStruct<{
|
|
79
|
+
bytes: import("@mysten/sui/bcs").BcsType<string, string, string>;
|
|
80
80
|
}, string>;
|
|
81
81
|
}, string>;
|
|
82
|
-
size: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
82
|
+
size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
83
83
|
}, string>;
|
|
84
84
|
}, string>;
|
|
85
85
|
static fromFields(fields: Record<string, any>): PoolReward;
|
|
@@ -131,9 +131,7 @@ export declare class PoolReward implements StructClass {
|
|
|
131
131
|
};
|
|
132
132
|
static fromJSONField(field: any): PoolReward;
|
|
133
133
|
static fromJSON(json: Record<string, any>): PoolReward;
|
|
134
|
-
static
|
|
135
|
-
static fromSuiObjectData(data: SuiObjectData): PoolReward;
|
|
136
|
-
static fetch(client: SuiJsonRpcClient, id: string): Promise<PoolReward>;
|
|
134
|
+
static fetch(client: SuiGrpcClient, id: string): Promise<PoolReward>;
|
|
137
135
|
}
|
|
138
136
|
export declare function isPoolRewardManager(type: string): boolean;
|
|
139
137
|
export interface PoolRewardManagerFields {
|
|
@@ -161,89 +159,17 @@ export declare class PoolRewardManager implements StructClass {
|
|
|
161
159
|
static get r(): reified.StructClassReified<PoolRewardManager, PoolRewardManagerFields>;
|
|
162
160
|
static phantom(): PhantomReified<ToTypeStr<PoolRewardManager>>;
|
|
163
161
|
static get p(): reified.PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::liquidity_mining::PoolRewardManager" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::liquidity_mining::PoolRewardManager">;
|
|
164
|
-
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
165
|
-
id: import("@mysten/bcs").BcsStruct<{
|
|
166
|
-
id: import("@mysten/bcs").BcsStruct<{
|
|
167
|
-
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
162
|
+
static get bcs(): import("@mysten/sui/bcs").BcsStruct<{
|
|
163
|
+
id: import("@mysten/sui/bcs").BcsStruct<{
|
|
164
|
+
id: import("@mysten/sui/bcs").BcsStruct<{
|
|
165
|
+
bytes: import("@mysten/sui/bcs").BcsType<string, string, string>;
|
|
168
166
|
}, string>;
|
|
169
167
|
}, string>;
|
|
170
|
-
total_shares: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
171
|
-
pool_rewards: import("@mysten/bcs").BcsType<{
|
|
172
|
-
vec: {
|
|
173
|
-
id: {
|
|
174
|
-
id: {
|
|
175
|
-
bytes: string;
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
pool_reward_manager_id: {
|
|
179
|
-
bytes: string;
|
|
180
|
-
};
|
|
181
|
-
coin_type: {
|
|
182
|
-
name: {
|
|
183
|
-
bytes: number[];
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
start_time_ms: string;
|
|
187
|
-
end_time_ms: string;
|
|
188
|
-
total_rewards: string;
|
|
189
|
-
allocated_rewards: {
|
|
190
|
-
value: string;
|
|
191
|
-
};
|
|
192
|
-
cumulative_rewards_per_share: {
|
|
193
|
-
value: string;
|
|
194
|
-
};
|
|
195
|
-
num_user_reward_managers: string;
|
|
196
|
-
additional_fields: {
|
|
197
|
-
id: {
|
|
198
|
-
id: {
|
|
199
|
-
bytes: string;
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
size: string;
|
|
203
|
-
};
|
|
204
|
-
}[];
|
|
205
|
-
}[], Iterable<{
|
|
206
|
-
vec: Iterable<{
|
|
207
|
-
id: {
|
|
208
|
-
id: {
|
|
209
|
-
bytes: string;
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
pool_reward_manager_id: {
|
|
213
|
-
bytes: string;
|
|
214
|
-
};
|
|
215
|
-
coin_type: {
|
|
216
|
-
name: {
|
|
217
|
-
bytes: Iterable<number> & {
|
|
218
|
-
length: number;
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
start_time_ms: string | number | bigint;
|
|
223
|
-
end_time_ms: string | number | bigint;
|
|
224
|
-
total_rewards: string | number | bigint;
|
|
225
|
-
allocated_rewards: {
|
|
226
|
-
value: string | number | bigint;
|
|
227
|
-
};
|
|
228
|
-
cumulative_rewards_per_share: {
|
|
229
|
-
value: string | number | bigint;
|
|
230
|
-
};
|
|
231
|
-
num_user_reward_managers: string | number | bigint;
|
|
232
|
-
additional_fields: {
|
|
233
|
-
id: {
|
|
234
|
-
id: {
|
|
235
|
-
bytes: string;
|
|
236
|
-
};
|
|
237
|
-
};
|
|
238
|
-
size: string | number | bigint;
|
|
239
|
-
};
|
|
240
|
-
}> & {
|
|
241
|
-
length: number;
|
|
242
|
-
};
|
|
243
|
-
}> & {
|
|
168
|
+
total_shares: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
169
|
+
pool_rewards: import("@mysten/sui/bcs").BcsType<any[], Iterable<any> & {
|
|
244
170
|
length: number;
|
|
245
171
|
}, string>;
|
|
246
|
-
last_update_time_ms: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
172
|
+
last_update_time_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
247
173
|
}, string>;
|
|
248
174
|
static fromFields(fields: Record<string, any>): PoolRewardManager;
|
|
249
175
|
static fromFieldsWithTypes(item: FieldsWithTypes): PoolRewardManager;
|
|
@@ -304,9 +230,7 @@ export declare class PoolRewardManager implements StructClass {
|
|
|
304
230
|
};
|
|
305
231
|
static fromJSONField(field: any): PoolRewardManager;
|
|
306
232
|
static fromJSON(json: Record<string, any>): PoolRewardManager;
|
|
307
|
-
static
|
|
308
|
-
static fromSuiObjectData(data: SuiObjectData): PoolRewardManager;
|
|
309
|
-
static fetch(client: SuiJsonRpcClient, id: string): Promise<PoolRewardManager>;
|
|
233
|
+
static fetch(client: SuiGrpcClient, id: string): Promise<PoolRewardManager>;
|
|
310
234
|
}
|
|
311
235
|
export declare function isRewardBalance(type: string): boolean;
|
|
312
236
|
export interface RewardBalanceFields<T extends PhantomTypeArgument> {
|
|
@@ -328,8 +252,8 @@ export declare class RewardBalance<T extends PhantomTypeArgument> implements Str
|
|
|
328
252
|
static get r(): typeof RewardBalance.reified;
|
|
329
253
|
static phantom<T extends PhantomReified<PhantomTypeArgument>>(T: T): PhantomReified<ToTypeStr<RewardBalance<ToPhantomTypeArgument<T>>>>;
|
|
330
254
|
static get p(): typeof RewardBalance.phantom;
|
|
331
|
-
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
332
|
-
dummy_field: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
|
|
255
|
+
static get bcs(): import("@mysten/sui/bcs").BcsStruct<{
|
|
256
|
+
dummy_field: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
|
|
333
257
|
}, string>;
|
|
334
258
|
static fromFields<T extends PhantomReified<PhantomTypeArgument>>(typeArg: T, fields: Record<string, any>): RewardBalance<ToPhantomTypeArgument<T>>;
|
|
335
259
|
static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>(typeArg: T, item: FieldsWithTypes): RewardBalance<ToPhantomTypeArgument<T>>;
|
|
@@ -344,9 +268,7 @@ export declare class RewardBalance<T extends PhantomTypeArgument> implements Str
|
|
|
344
268
|
};
|
|
345
269
|
static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>(typeArg: T, field: any): RewardBalance<ToPhantomTypeArgument<T>>;
|
|
346
270
|
static fromJSON<T extends PhantomReified<PhantomTypeArgument>>(typeArg: T, json: Record<string, any>): RewardBalance<ToPhantomTypeArgument<T>>;
|
|
347
|
-
static
|
|
348
|
-
static fromSuiObjectData<T extends PhantomReified<PhantomTypeArgument>>(typeArg: T, data: SuiObjectData): RewardBalance<ToPhantomTypeArgument<T>>;
|
|
349
|
-
static fetch<T extends PhantomReified<PhantomTypeArgument>>(client: SuiJsonRpcClient, typeArg: T, id: string): Promise<RewardBalance<ToPhantomTypeArgument<T>>>;
|
|
271
|
+
static fetch<T extends PhantomReified<PhantomTypeArgument>>(client: SuiGrpcClient, typeArg: T, id: string): Promise<RewardBalance<ToPhantomTypeArgument<T>>>;
|
|
350
272
|
}
|
|
351
273
|
export declare function isUserReward(type: string): boolean;
|
|
352
274
|
export interface UserRewardFields {
|
|
@@ -372,15 +294,15 @@ export declare class UserReward implements StructClass {
|
|
|
372
294
|
static get r(): reified.StructClassReified<UserReward, UserRewardFields>;
|
|
373
295
|
static phantom(): PhantomReified<ToTypeStr<UserReward>>;
|
|
374
296
|
static get p(): reified.PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::liquidity_mining::UserReward" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::liquidity_mining::UserReward">;
|
|
375
|
-
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
376
|
-
pool_reward_id: import("@mysten/bcs").BcsStruct<{
|
|
377
|
-
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
297
|
+
static get bcs(): import("@mysten/sui/bcs").BcsStruct<{
|
|
298
|
+
pool_reward_id: import("@mysten/sui/bcs").BcsStruct<{
|
|
299
|
+
bytes: import("@mysten/sui/bcs").BcsType<string, string, string>;
|
|
378
300
|
}, string>;
|
|
379
|
-
earned_rewards: import("@mysten/bcs").BcsStruct<{
|
|
380
|
-
value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
301
|
+
earned_rewards: import("@mysten/sui/bcs").BcsStruct<{
|
|
302
|
+
value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
381
303
|
}, string>;
|
|
382
|
-
cumulative_rewards_per_share: import("@mysten/bcs").BcsStruct<{
|
|
383
|
-
value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
304
|
+
cumulative_rewards_per_share: import("@mysten/sui/bcs").BcsStruct<{
|
|
305
|
+
value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u256">;
|
|
384
306
|
}, string>;
|
|
385
307
|
}, string>;
|
|
386
308
|
static fromFields(fields: Record<string, any>): UserReward;
|
|
@@ -408,9 +330,7 @@ export declare class UserReward implements StructClass {
|
|
|
408
330
|
};
|
|
409
331
|
static fromJSONField(field: any): UserReward;
|
|
410
332
|
static fromJSON(json: Record<string, any>): UserReward;
|
|
411
|
-
static
|
|
412
|
-
static fromSuiObjectData(data: SuiObjectData): UserReward;
|
|
413
|
-
static fetch(client: SuiJsonRpcClient, id: string): Promise<UserReward>;
|
|
333
|
+
static fetch(client: SuiGrpcClient, id: string): Promise<UserReward>;
|
|
414
334
|
}
|
|
415
335
|
export declare function isUserRewardManager(type: string): boolean;
|
|
416
336
|
export interface UserRewardManagerFields {
|
|
@@ -438,41 +358,15 @@ export declare class UserRewardManager implements StructClass {
|
|
|
438
358
|
static get r(): reified.StructClassReified<UserRewardManager, UserRewardManagerFields>;
|
|
439
359
|
static phantom(): PhantomReified<ToTypeStr<UserRewardManager>>;
|
|
440
360
|
static get p(): reified.PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::liquidity_mining::UserRewardManager" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::liquidity_mining::UserRewardManager">;
|
|
441
|
-
static get bcs(): import("@mysten/bcs").BcsStruct<{
|
|
442
|
-
pool_reward_manager_id: import("@mysten/bcs").BcsStruct<{
|
|
443
|
-
bytes: import("@mysten/bcs").BcsType<string, string, string>;
|
|
361
|
+
static get bcs(): import("@mysten/sui/bcs").BcsStruct<{
|
|
362
|
+
pool_reward_manager_id: import("@mysten/sui/bcs").BcsStruct<{
|
|
363
|
+
bytes: import("@mysten/sui/bcs").BcsType<string, string, string>;
|
|
444
364
|
}, string>;
|
|
445
|
-
share: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
446
|
-
rewards: import("@mysten/bcs").BcsType<{
|
|
447
|
-
vec: {
|
|
448
|
-
pool_reward_id: {
|
|
449
|
-
bytes: string;
|
|
450
|
-
};
|
|
451
|
-
earned_rewards: {
|
|
452
|
-
value: string;
|
|
453
|
-
};
|
|
454
|
-
cumulative_rewards_per_share: {
|
|
455
|
-
value: string;
|
|
456
|
-
};
|
|
457
|
-
}[];
|
|
458
|
-
}[], Iterable<{
|
|
459
|
-
vec: Iterable<{
|
|
460
|
-
pool_reward_id: {
|
|
461
|
-
bytes: string;
|
|
462
|
-
};
|
|
463
|
-
earned_rewards: {
|
|
464
|
-
value: string | number | bigint;
|
|
465
|
-
};
|
|
466
|
-
cumulative_rewards_per_share: {
|
|
467
|
-
value: string | number | bigint;
|
|
468
|
-
};
|
|
469
|
-
}> & {
|
|
470
|
-
length: number;
|
|
471
|
-
};
|
|
472
|
-
}> & {
|
|
365
|
+
share: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
366
|
+
rewards: import("@mysten/sui/bcs").BcsType<any[], Iterable<any> & {
|
|
473
367
|
length: number;
|
|
474
368
|
}, string>;
|
|
475
|
-
last_update_time_ms: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
369
|
+
last_update_time_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
476
370
|
}, string>;
|
|
477
371
|
static fromFields(fields: Record<string, any>): UserRewardManager;
|
|
478
372
|
static fromFieldsWithTypes(item: FieldsWithTypes): UserRewardManager;
|
|
@@ -509,7 +403,5 @@ export declare class UserRewardManager implements StructClass {
|
|
|
509
403
|
};
|
|
510
404
|
static fromJSONField(field: any): UserRewardManager;
|
|
511
405
|
static fromJSON(json: Record<string, any>): UserRewardManager;
|
|
512
|
-
static
|
|
513
|
-
static fromSuiObjectData(data: SuiObjectData): UserRewardManager;
|
|
514
|
-
static fetch(client: SuiJsonRpcClient, id: string): Promise<UserRewardManager>;
|
|
406
|
+
static fetch(client: SuiGrpcClient, id: string): Promise<UserRewardManager>;
|
|
515
407
|
}
|
|
@@ -13,11 +13,10 @@ import { TypeName } from "../../_dependencies/source/0x1/type-name/structs";
|
|
|
13
13
|
import { Bag } from "../../_dependencies/source/0x2/bag/structs";
|
|
14
14
|
import { ID, UID } from "../../_dependencies/source/0x2/object/structs";
|
|
15
15
|
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, } from "../../_framework/reified";
|
|
16
|
-
import { composeSuiType, compressSuiType,
|
|
16
|
+
import { composeSuiType, compressSuiType, } from "../../_framework/util";
|
|
17
17
|
import { Decimal } from "../decimal/structs";
|
|
18
18
|
import { PKG_V1 } from "../index";
|
|
19
19
|
import { bcs } from "@mysten/sui/bcs";
|
|
20
|
-
import { fromBase64 } from "@mysten/sui/utils";
|
|
21
20
|
/* ============================== PoolReward =============================== */
|
|
22
21
|
export function isPoolReward(type) {
|
|
23
22
|
type = compressSuiType(type);
|
|
@@ -54,8 +53,6 @@ export class PoolReward {
|
|
|
54
53
|
bcs: PoolReward.bcs,
|
|
55
54
|
fromJSONField: (field) => PoolReward.fromJSONField(field),
|
|
56
55
|
fromJSON: (json) => PoolReward.fromJSON(json),
|
|
57
|
-
fromSuiParsedData: (content) => PoolReward.fromSuiParsedData(content),
|
|
58
|
-
fromSuiObjectData: (content) => PoolReward.fromSuiObjectData(content),
|
|
59
56
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return PoolReward.fetch(client, id); }),
|
|
60
57
|
new: (fields) => {
|
|
61
58
|
return new PoolReward([], fields);
|
|
@@ -157,39 +154,13 @@ export class PoolReward {
|
|
|
157
154
|
}
|
|
158
155
|
return PoolReward.fromJSONField(json);
|
|
159
156
|
}
|
|
160
|
-
static fromSuiParsedData(content) {
|
|
161
|
-
if (content.dataType !== "moveObject") {
|
|
162
|
-
throw new Error("not an object");
|
|
163
|
-
}
|
|
164
|
-
if (!isPoolReward(content.type)) {
|
|
165
|
-
throw new Error(`object at ${content.fields.id} is not a PoolReward object`);
|
|
166
|
-
}
|
|
167
|
-
return PoolReward.fromFieldsWithTypes(content);
|
|
168
|
-
}
|
|
169
|
-
static fromSuiObjectData(data) {
|
|
170
|
-
if (data.bcs) {
|
|
171
|
-
if (data.bcs.dataType !== "moveObject" || !isPoolReward(data.bcs.type)) {
|
|
172
|
-
throw new Error(`object at is not a PoolReward object`);
|
|
173
|
-
}
|
|
174
|
-
return PoolReward.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
175
|
-
}
|
|
176
|
-
if (data.content) {
|
|
177
|
-
return PoolReward.fromSuiParsedData(data.content);
|
|
178
|
-
}
|
|
179
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
180
|
-
}
|
|
181
157
|
static fetch(client, id) {
|
|
182
158
|
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (res.error) {
|
|
186
|
-
throw new Error(`error fetching PoolReward object at id ${id}: ${res.error.code}`);
|
|
187
|
-
}
|
|
188
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
189
|
-
!isPoolReward(res.data.bcs.type)) {
|
|
159
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
160
|
+
if (!isPoolReward(object.type)) {
|
|
190
161
|
throw new Error(`object at id ${id} is not a PoolReward object`);
|
|
191
162
|
}
|
|
192
|
-
return PoolReward.
|
|
163
|
+
return PoolReward.fromBcs(object.content);
|
|
193
164
|
});
|
|
194
165
|
}
|
|
195
166
|
}
|
|
@@ -226,8 +197,6 @@ export class PoolRewardManager {
|
|
|
226
197
|
bcs: PoolRewardManager.bcs,
|
|
227
198
|
fromJSONField: (field) => PoolRewardManager.fromJSONField(field),
|
|
228
199
|
fromJSON: (json) => PoolRewardManager.fromJSON(json),
|
|
229
|
-
fromSuiParsedData: (content) => PoolRewardManager.fromSuiParsedData(content),
|
|
230
|
-
fromSuiObjectData: (content) => PoolRewardManager.fromSuiObjectData(content),
|
|
231
200
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return PoolRewardManager.fetch(client, id); }),
|
|
232
201
|
new: (fields) => {
|
|
233
202
|
return new PoolRewardManager([], fields);
|
|
@@ -299,40 +268,13 @@ export class PoolRewardManager {
|
|
|
299
268
|
}
|
|
300
269
|
return PoolRewardManager.fromJSONField(json);
|
|
301
270
|
}
|
|
302
|
-
static fromSuiParsedData(content) {
|
|
303
|
-
if (content.dataType !== "moveObject") {
|
|
304
|
-
throw new Error("not an object");
|
|
305
|
-
}
|
|
306
|
-
if (!isPoolRewardManager(content.type)) {
|
|
307
|
-
throw new Error(`object at ${content.fields.id} is not a PoolRewardManager object`);
|
|
308
|
-
}
|
|
309
|
-
return PoolRewardManager.fromFieldsWithTypes(content);
|
|
310
|
-
}
|
|
311
|
-
static fromSuiObjectData(data) {
|
|
312
|
-
if (data.bcs) {
|
|
313
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
314
|
-
!isPoolRewardManager(data.bcs.type)) {
|
|
315
|
-
throw new Error(`object at is not a PoolRewardManager object`);
|
|
316
|
-
}
|
|
317
|
-
return PoolRewardManager.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
318
|
-
}
|
|
319
|
-
if (data.content) {
|
|
320
|
-
return PoolRewardManager.fromSuiParsedData(data.content);
|
|
321
|
-
}
|
|
322
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
323
|
-
}
|
|
324
271
|
static fetch(client, id) {
|
|
325
272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
if (res.error) {
|
|
329
|
-
throw new Error(`error fetching PoolRewardManager object at id ${id}: ${res.error.code}`);
|
|
330
|
-
}
|
|
331
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
332
|
-
!isPoolRewardManager(res.data.bcs.type)) {
|
|
273
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
274
|
+
if (!isPoolRewardManager(object.type)) {
|
|
333
275
|
throw new Error(`object at id ${id} is not a PoolRewardManager object`);
|
|
334
276
|
}
|
|
335
|
-
return PoolRewardManager.
|
|
277
|
+
return PoolRewardManager.fromBcs(object.content);
|
|
336
278
|
});
|
|
337
279
|
}
|
|
338
280
|
}
|
|
@@ -366,8 +308,6 @@ export class RewardBalance {
|
|
|
366
308
|
bcs: RewardBalance.bcs,
|
|
367
309
|
fromJSONField: (field) => RewardBalance.fromJSONField(T, field),
|
|
368
310
|
fromJSON: (json) => RewardBalance.fromJSON(T, json),
|
|
369
|
-
fromSuiParsedData: (content) => RewardBalance.fromSuiParsedData(T, content),
|
|
370
|
-
fromSuiObjectData: (content) => RewardBalance.fromSuiObjectData(T, content),
|
|
371
311
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return RewardBalance.fetch(client, T, id); }),
|
|
372
312
|
new: (fields) => {
|
|
373
313
|
return new RewardBalance([extractType(T)], fields);
|
|
@@ -426,49 +366,13 @@ export class RewardBalance {
|
|
|
426
366
|
assertReifiedTypeArgsMatch(composeSuiType(RewardBalance.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg]);
|
|
427
367
|
return RewardBalance.fromJSONField(typeArg, json);
|
|
428
368
|
}
|
|
429
|
-
static fromSuiParsedData(typeArg, content) {
|
|
430
|
-
if (content.dataType !== "moveObject") {
|
|
431
|
-
throw new Error("not an object");
|
|
432
|
-
}
|
|
433
|
-
if (!isRewardBalance(content.type)) {
|
|
434
|
-
throw new Error(`object at ${content.fields.id} is not a RewardBalance object`);
|
|
435
|
-
}
|
|
436
|
-
return RewardBalance.fromFieldsWithTypes(typeArg, content);
|
|
437
|
-
}
|
|
438
|
-
static fromSuiObjectData(typeArg, data) {
|
|
439
|
-
if (data.bcs) {
|
|
440
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
441
|
-
!isRewardBalance(data.bcs.type)) {
|
|
442
|
-
throw new Error(`object at is not a RewardBalance object`);
|
|
443
|
-
}
|
|
444
|
-
const gotTypeArgs = parseTypeName(data.bcs.type).typeArgs;
|
|
445
|
-
if (gotTypeArgs.length !== 1) {
|
|
446
|
-
throw new Error(`type argument mismatch: expected 1 type argument but got '${gotTypeArgs.length}'`);
|
|
447
|
-
}
|
|
448
|
-
const gotTypeArg = compressSuiType(gotTypeArgs[0]);
|
|
449
|
-
const expectedTypeArg = compressSuiType(extractType(typeArg));
|
|
450
|
-
if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
|
|
451
|
-
throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
452
|
-
}
|
|
453
|
-
return RewardBalance.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
|
|
454
|
-
}
|
|
455
|
-
if (data.content) {
|
|
456
|
-
return RewardBalance.fromSuiParsedData(typeArg, data.content);
|
|
457
|
-
}
|
|
458
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
459
|
-
}
|
|
460
369
|
static fetch(client, typeArg, id) {
|
|
461
370
|
return __awaiter(this, void 0, void 0, function* () {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
if (res.error) {
|
|
465
|
-
throw new Error(`error fetching RewardBalance object at id ${id}: ${res.error.code}`);
|
|
466
|
-
}
|
|
467
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
468
|
-
!isRewardBalance(res.data.bcs.type)) {
|
|
371
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
372
|
+
if (!isRewardBalance(object.type)) {
|
|
469
373
|
throw new Error(`object at id ${id} is not a RewardBalance object`);
|
|
470
374
|
}
|
|
471
|
-
return RewardBalance.
|
|
375
|
+
return RewardBalance.fromBcs(typeArg, object.content);
|
|
472
376
|
});
|
|
473
377
|
}
|
|
474
378
|
}
|
|
@@ -504,8 +408,6 @@ export class UserReward {
|
|
|
504
408
|
bcs: UserReward.bcs,
|
|
505
409
|
fromJSONField: (field) => UserReward.fromJSONField(field),
|
|
506
410
|
fromJSON: (json) => UserReward.fromJSON(json),
|
|
507
|
-
fromSuiParsedData: (content) => UserReward.fromSuiParsedData(content),
|
|
508
|
-
fromSuiObjectData: (content) => UserReward.fromSuiObjectData(content),
|
|
509
411
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return UserReward.fetch(client, id); }),
|
|
510
412
|
new: (fields) => {
|
|
511
413
|
return new UserReward([], fields);
|
|
@@ -572,39 +474,13 @@ export class UserReward {
|
|
|
572
474
|
}
|
|
573
475
|
return UserReward.fromJSONField(json);
|
|
574
476
|
}
|
|
575
|
-
static fromSuiParsedData(content) {
|
|
576
|
-
if (content.dataType !== "moveObject") {
|
|
577
|
-
throw new Error("not an object");
|
|
578
|
-
}
|
|
579
|
-
if (!isUserReward(content.type)) {
|
|
580
|
-
throw new Error(`object at ${content.fields.id} is not a UserReward object`);
|
|
581
|
-
}
|
|
582
|
-
return UserReward.fromFieldsWithTypes(content);
|
|
583
|
-
}
|
|
584
|
-
static fromSuiObjectData(data) {
|
|
585
|
-
if (data.bcs) {
|
|
586
|
-
if (data.bcs.dataType !== "moveObject" || !isUserReward(data.bcs.type)) {
|
|
587
|
-
throw new Error(`object at is not a UserReward object`);
|
|
588
|
-
}
|
|
589
|
-
return UserReward.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
590
|
-
}
|
|
591
|
-
if (data.content) {
|
|
592
|
-
return UserReward.fromSuiParsedData(data.content);
|
|
593
|
-
}
|
|
594
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
595
|
-
}
|
|
596
477
|
static fetch(client, id) {
|
|
597
478
|
return __awaiter(this, void 0, void 0, function* () {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
if (res.error) {
|
|
601
|
-
throw new Error(`error fetching UserReward object at id ${id}: ${res.error.code}`);
|
|
602
|
-
}
|
|
603
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
604
|
-
!isUserReward(res.data.bcs.type)) {
|
|
479
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
480
|
+
if (!isUserReward(object.type)) {
|
|
605
481
|
throw new Error(`object at id ${id} is not a UserReward object`);
|
|
606
482
|
}
|
|
607
|
-
return UserReward.
|
|
483
|
+
return UserReward.fromBcs(object.content);
|
|
608
484
|
});
|
|
609
485
|
}
|
|
610
486
|
}
|
|
@@ -641,8 +517,6 @@ export class UserRewardManager {
|
|
|
641
517
|
bcs: UserRewardManager.bcs,
|
|
642
518
|
fromJSONField: (field) => UserRewardManager.fromJSONField(field),
|
|
643
519
|
fromJSON: (json) => UserRewardManager.fromJSON(json),
|
|
644
|
-
fromSuiParsedData: (content) => UserRewardManager.fromSuiParsedData(content),
|
|
645
|
-
fromSuiObjectData: (content) => UserRewardManager.fromSuiObjectData(content),
|
|
646
520
|
fetch: (client, id) => __awaiter(this, void 0, void 0, function* () { return UserRewardManager.fetch(client, id); }),
|
|
647
521
|
new: (fields) => {
|
|
648
522
|
return new UserRewardManager([], fields);
|
|
@@ -714,40 +588,13 @@ export class UserRewardManager {
|
|
|
714
588
|
}
|
|
715
589
|
return UserRewardManager.fromJSONField(json);
|
|
716
590
|
}
|
|
717
|
-
static fromSuiParsedData(content) {
|
|
718
|
-
if (content.dataType !== "moveObject") {
|
|
719
|
-
throw new Error("not an object");
|
|
720
|
-
}
|
|
721
|
-
if (!isUserRewardManager(content.type)) {
|
|
722
|
-
throw new Error(`object at ${content.fields.id} is not a UserRewardManager object`);
|
|
723
|
-
}
|
|
724
|
-
return UserRewardManager.fromFieldsWithTypes(content);
|
|
725
|
-
}
|
|
726
|
-
static fromSuiObjectData(data) {
|
|
727
|
-
if (data.bcs) {
|
|
728
|
-
if (data.bcs.dataType !== "moveObject" ||
|
|
729
|
-
!isUserRewardManager(data.bcs.type)) {
|
|
730
|
-
throw new Error(`object at is not a UserRewardManager object`);
|
|
731
|
-
}
|
|
732
|
-
return UserRewardManager.fromBcs(fromBase64(data.bcs.bcsBytes));
|
|
733
|
-
}
|
|
734
|
-
if (data.content) {
|
|
735
|
-
return UserRewardManager.fromSuiParsedData(data.content);
|
|
736
|
-
}
|
|
737
|
-
throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
|
|
738
|
-
}
|
|
739
591
|
static fetch(client, id) {
|
|
740
592
|
return __awaiter(this, void 0, void 0, function* () {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
if (res.error) {
|
|
744
|
-
throw new Error(`error fetching UserRewardManager object at id ${id}: ${res.error.code}`);
|
|
745
|
-
}
|
|
746
|
-
if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" ||
|
|
747
|
-
!isUserRewardManager(res.data.bcs.type)) {
|
|
593
|
+
const { object } = yield client.getObject({ objectId: id, include: { content: true } });
|
|
594
|
+
if (!isUserRewardManager(object.type)) {
|
|
748
595
|
throw new Error(`object at id ${id} is not a UserRewardManager object`);
|
|
749
596
|
}
|
|
750
|
-
return UserRewardManager.
|
|
597
|
+
return UserRewardManager.fromBcs(object.content);
|
|
751
598
|
});
|
|
752
599
|
}
|
|
753
600
|
}
|