@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.
- package/_generated/_dependencies/pyth-2/price-identifier/structs.d.ts +46 -0
- package/_generated/_dependencies/{source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e → pyth-2}/price-identifier/structs.js +45 -25
- package/_generated/_dependencies/std/ascii/structs.d.ts +100 -0
- package/_generated/_dependencies/{source/0x1 → std}/ascii/structs.js +153 -103
- package/_generated/_dependencies/{source/0x1 → std}/option/structs.d.ts +29 -21
- package/_generated/_dependencies/std/option/structs.js +155 -0
- package/_generated/_dependencies/std/type-name/structs.d.ts +65 -0
- package/_generated/_dependencies/{source/0x1 → std}/type-name/structs.js +49 -22
- package/_generated/_dependencies/sui/bag/structs.d.ts +75 -0
- package/_generated/_dependencies/sui/bag/structs.js +154 -0
- package/_generated/_dependencies/{source/0x2 → sui}/balance/structs.d.ts +80 -60
- package/_generated/_dependencies/sui/balance/structs.js +306 -0
- package/_generated/_dependencies/sui/object/structs.d.ts +104 -0
- package/_generated/_dependencies/{source/0x2 → sui}/object/structs.js +98 -46
- package/_generated/_dependencies/{source/0x2 → sui}/object-table/structs.d.ts +37 -30
- package/_generated/_dependencies/sui/object-table/structs.js +164 -0
- package/_generated/_envs/index.d.ts +3 -0
- package/_generated/_envs/index.js +18 -0
- package/_generated/_envs/mainnet.d.ts +2 -0
- package/_generated/_envs/mainnet.js +490 -0
- package/_generated/_framework/env.d.ts +137 -0
- package/_generated/_framework/env.js +261 -0
- package/_generated/_framework/reified.d.ts +68 -36
- package/_generated/_framework/reified.js +110 -98
- package/_generated/_framework/util.d.ts +4 -4
- package/_generated/_framework/util.js +82 -79
- package/_generated/_framework/vector.d.ts +11 -9
- package/_generated/_framework/vector.js +10 -10
- package/_generated/suilend/cell/structs.d.ts +24 -22
- package/_generated/suilend/cell/structs.js +68 -24
- package/_generated/suilend/decimal/structs.d.ts +28 -24
- package/_generated/suilend/decimal/structs.js +45 -24
- package/_generated/suilend/index.d.ts +5 -6
- package/_generated/suilend/index.js +10 -19
- package/_generated/suilend/lending-market/functions.d.ts +1123 -149
- package/_generated/suilend/lending-market/functions.js +1121 -207
- package/_generated/suilend/lending-market/structs.d.ts +985 -1290
- package/_generated/suilend/lending-market/structs.js +2482 -1282
- package/_generated/suilend/lending-market-registry/functions.d.ts +32 -3
- package/_generated/suilend/lending-market-registry/functions.js +30 -6
- package/_generated/suilend/liquidity-mining/structs.d.ts +200 -333
- package/_generated/suilend/liquidity-mining/structs.js +449 -319
- package/_generated/suilend/obligation/structs.d.ts +406 -918
- package/_generated/suilend/obligation/structs.js +786 -596
- package/_generated/suilend/rate-limiter/functions.d.ts +134 -15
- package/_generated/suilend/rate-limiter/functions.js +139 -21
- package/_generated/suilend/rate-limiter/structs.d.ts +72 -80
- package/_generated/suilend/rate-limiter/structs.js +98 -48
- package/_generated/suilend/reserve/structs.d.ts +611 -904
- package/_generated/suilend/reserve/structs.js +1528 -736
- package/_generated/suilend/reserve-config/functions.d.ts +718 -96
- package/_generated/suilend/reserve-config/functions.js +751 -157
- package/_generated/suilend/reserve-config/structs.d.ts +148 -163
- package/_generated/suilend/reserve-config/structs.js +260 -94
- package/client.d.ts +2 -2
- package/client.js +22 -39
- package/lib/initialize.d.ts +76 -76
- package/lib/initialize.js +10 -10
- package/lib/proCompatible.js +5 -5
- package/package.json +1 -1
- package/parsers/lendingMarket.d.ts +9 -9
- package/parsers/obligation.d.ts +14 -14
- package/parsers/obligation.js +4 -4
- package/parsers/rateLimiter.d.ts +1 -1
- package/parsers/reserve.d.ts +12 -12
- package/parsers/reserve.js +2 -2
- package/strategies.d.ts +14 -14
- package/utils/simulate.d.ts +1 -1
- package/utils/simulate.js +5 -5
- package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +0 -84
- package/_generated/_dependencies/source/0x1/index.d.ts +0 -3
- package/_generated/_dependencies/source/0x1/index.js +0 -3
- package/_generated/_dependencies/source/0x1/option/structs.js +0 -110
- package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +0 -47
- package/_generated/_dependencies/source/0x2/bag/structs.d.ts +0 -52
- package/_generated/_dependencies/source/0x2/bag/structs.js +0 -113
- package/_generated/_dependencies/source/0x2/balance/structs.js +0 -210
- package/_generated/_dependencies/source/0x2/index.d.ts +0 -3
- package/_generated/_dependencies/source/0x2/index.js +0 -3
- package/_generated/_dependencies/source/0x2/object/structs.d.ts +0 -82
- package/_generated/_dependencies/source/0x2/object-table/structs.js +0 -115
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.d.ts +0 -4
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js +0 -4
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +0 -46
|
@@ -1,616 +1,1790 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
2
|
+
import { fromHex, toHex } from '@mysten/sui/utils';
|
|
3
|
+
import { TypeName } from '../../_dependencies/std/type-name/structs.js';
|
|
4
|
+
import { ObjectTable } from '../../_dependencies/sui/object-table/structs.js';
|
|
5
|
+
import { ID, UID } from '../../_dependencies/sui/object/structs.js';
|
|
6
|
+
import { getTypeOrigin } from '../../_envs/index.js';
|
|
7
|
+
import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, vector, } from '../../_framework/reified.js';
|
|
8
|
+
import { composeSuiType, compressSuiType, parseTypeName, } from '../../_framework/util.js';
|
|
9
|
+
import { Decimal } from '../decimal/structs.js';
|
|
10
|
+
import { Obligation } from '../obligation/structs.js';
|
|
11
|
+
import { RateLimiter } from '../rate-limiter/structs.js';
|
|
12
|
+
import { Reserve } from '../reserve/structs.js';
|
|
13
|
+
/* ============================== LENDING_MARKET =============================== */
|
|
14
|
+
export function isLENDING_MARKET(type) {
|
|
15
|
+
type = compressSuiType(type);
|
|
16
|
+
return type
|
|
17
|
+
=== `${getTypeOrigin('suilend', 'lending_market::LENDING_MARKET')}::lending_market::LENDING_MARKET`;
|
|
18
|
+
}
|
|
19
|
+
export class LENDING_MARKET {
|
|
20
|
+
__StructClass = true;
|
|
21
|
+
static get $typeName() {
|
|
22
|
+
return `${getTypeOrigin('suilend', 'lending_market::LENDING_MARKET')}::lending_market::LENDING_MARKET`;
|
|
23
|
+
}
|
|
24
|
+
static $numTypeParams = 0;
|
|
25
|
+
static $isPhantom = [];
|
|
26
|
+
$typeName = LENDING_MARKET.$typeName;
|
|
27
|
+
$fullTypeName;
|
|
28
|
+
$typeArgs;
|
|
29
|
+
$isPhantom = LENDING_MARKET.$isPhantom;
|
|
30
|
+
dummyField;
|
|
31
|
+
constructor(typeArgs, fields) {
|
|
32
|
+
this.$fullTypeName = composeSuiType(LENDING_MARKET.$typeName, ...typeArgs);
|
|
33
|
+
this.$typeArgs = typeArgs;
|
|
34
|
+
this.dummyField = fields.dummyField;
|
|
35
|
+
}
|
|
36
|
+
static reified() {
|
|
37
|
+
const reifiedBcs = LENDING_MARKET.bcs;
|
|
38
|
+
return {
|
|
39
|
+
get typeName() {
|
|
40
|
+
return LENDING_MARKET.$typeName;
|
|
41
|
+
},
|
|
42
|
+
get fullTypeName() {
|
|
43
|
+
return composeSuiType(LENDING_MARKET.$typeName, ...[]);
|
|
44
|
+
},
|
|
45
|
+
typeArgs: [],
|
|
46
|
+
isPhantom: LENDING_MARKET.$isPhantom,
|
|
47
|
+
reifiedTypeArgs: [],
|
|
48
|
+
fromFields: (fields) => LENDING_MARKET.fromFields(fields),
|
|
49
|
+
fromFieldsWithTypes: (item) => LENDING_MARKET.fromFieldsWithTypes(item),
|
|
50
|
+
fromBcs: (data) => LENDING_MARKET.fromFields(reifiedBcs.parse(data)),
|
|
51
|
+
bcs: reifiedBcs,
|
|
52
|
+
fromJSONField: (field) => LENDING_MARKET.fromJSONField(field),
|
|
53
|
+
fromJSON: (json) => LENDING_MARKET.fromJSON(json),
|
|
54
|
+
fromCoreObject: (obj) => LENDING_MARKET.fromCoreObject(obj),
|
|
55
|
+
fetch: async (client, id) => LENDING_MARKET.fetch(client, id),
|
|
56
|
+
new: (fields) => {
|
|
57
|
+
return new LENDING_MARKET([], fields);
|
|
58
|
+
},
|
|
59
|
+
kind: 'StructClassReified',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
static get r() {
|
|
63
|
+
return LENDING_MARKET.reified();
|
|
64
|
+
}
|
|
65
|
+
static phantom() {
|
|
66
|
+
return phantom(LENDING_MARKET.reified());
|
|
67
|
+
}
|
|
68
|
+
static get p() {
|
|
69
|
+
return LENDING_MARKET.phantom();
|
|
70
|
+
}
|
|
71
|
+
static instantiateBcs() {
|
|
72
|
+
return bcs.struct('LENDING_MARKET', {
|
|
73
|
+
dummy_field: bcs.bool(),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
static cachedBcs = null;
|
|
77
|
+
static get bcs() {
|
|
78
|
+
if (!LENDING_MARKET.cachedBcs) {
|
|
79
|
+
LENDING_MARKET.cachedBcs = LENDING_MARKET.instantiateBcs();
|
|
80
|
+
}
|
|
81
|
+
return LENDING_MARKET.cachedBcs;
|
|
82
|
+
}
|
|
83
|
+
static fromFields(fields) {
|
|
84
|
+
return LENDING_MARKET.reified().new({
|
|
85
|
+
dummyField: decodeFromFields('bool', fields.dummy_field),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
static fromFieldsWithTypes(item) {
|
|
89
|
+
if (!isLENDING_MARKET(item.type)) {
|
|
90
|
+
throw new Error('not a LENDING_MARKET type');
|
|
91
|
+
}
|
|
92
|
+
return LENDING_MARKET.reified().new({
|
|
93
|
+
dummyField: decodeFromFieldsWithTypes('bool', item.fields.dummy_field),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
static fromBcs(data) {
|
|
97
|
+
return LENDING_MARKET.fromFields(LENDING_MARKET.bcs.parse(data));
|
|
98
|
+
}
|
|
99
|
+
toJSONField() {
|
|
100
|
+
return {
|
|
101
|
+
dummyField: this.dummyField,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
toJSON() {
|
|
105
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
106
|
+
}
|
|
107
|
+
static fromJSONField(field) {
|
|
108
|
+
return LENDING_MARKET.reified().new({
|
|
109
|
+
dummyField: decodeFromJSONField('bool', field.dummyField),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
static fromJSON(json) {
|
|
113
|
+
if (json.$typeName !== LENDING_MARKET.$typeName) {
|
|
114
|
+
throw new Error(`not a LENDING_MARKET json object: expected '${LENDING_MARKET.$typeName}' but got '${json.$typeName}'`);
|
|
115
|
+
}
|
|
116
|
+
return LENDING_MARKET.fromJSONField(json);
|
|
117
|
+
}
|
|
118
|
+
static fromCoreObject(obj) {
|
|
119
|
+
if (!isLENDING_MARKET(obj.type)) {
|
|
120
|
+
throw new Error(`object at ${obj.objectId} is not a LENDING_MARKET object`);
|
|
121
|
+
}
|
|
122
|
+
return LENDING_MARKET.fromBcs(obj.content);
|
|
123
|
+
}
|
|
124
|
+
static async fetch(client, id) {
|
|
125
|
+
const { object } = await client.core.getObject({
|
|
126
|
+
objectId: id,
|
|
127
|
+
include: { content: true },
|
|
128
|
+
});
|
|
129
|
+
if (!isLENDING_MARKET(object.type)) {
|
|
130
|
+
throw new Error(`object at id ${id} is not a LENDING_MARKET object`);
|
|
131
|
+
}
|
|
132
|
+
return LENDING_MARKET.fromBcs(object.content);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/* ============================== LendingMarket =============================== */
|
|
136
|
+
export function isLendingMarket(type) {
|
|
137
|
+
type = compressSuiType(type);
|
|
138
|
+
return type.startsWith(`${getTypeOrigin('suilend', 'lending_market::LendingMarket')}::lending_market::LendingMarket`
|
|
139
|
+
+ '<');
|
|
140
|
+
}
|
|
141
|
+
export class LendingMarket {
|
|
142
|
+
__StructClass = true;
|
|
143
|
+
static get $typeName() {
|
|
144
|
+
return `${getTypeOrigin('suilend', 'lending_market::LendingMarket')}::lending_market::LendingMarket`;
|
|
145
|
+
}
|
|
146
|
+
static $numTypeParams = 1;
|
|
147
|
+
static $isPhantom = [true];
|
|
148
|
+
$typeName = LendingMarket.$typeName;
|
|
149
|
+
$fullTypeName;
|
|
150
|
+
$typeArgs;
|
|
151
|
+
$isPhantom = LendingMarket.$isPhantom;
|
|
152
|
+
id;
|
|
153
|
+
version;
|
|
154
|
+
reserves;
|
|
155
|
+
obligations;
|
|
156
|
+
rateLimiter;
|
|
157
|
+
feeReceiver;
|
|
158
|
+
/** unused */
|
|
159
|
+
badDebtUsd;
|
|
160
|
+
/** unused */
|
|
161
|
+
badDebtLimitUsd;
|
|
162
|
+
constructor(typeArgs, fields) {
|
|
163
|
+
this.$fullTypeName = composeSuiType(LendingMarket.$typeName, ...typeArgs);
|
|
164
|
+
this.$typeArgs = typeArgs;
|
|
165
|
+
this.id = fields.id;
|
|
166
|
+
this.version = fields.version;
|
|
167
|
+
this.reserves = fields.reserves;
|
|
168
|
+
this.obligations = fields.obligations;
|
|
169
|
+
this.rateLimiter = fields.rateLimiter;
|
|
170
|
+
this.feeReceiver = fields.feeReceiver;
|
|
171
|
+
this.badDebtUsd = fields.badDebtUsd;
|
|
172
|
+
this.badDebtLimitUsd = fields.badDebtLimitUsd;
|
|
173
|
+
}
|
|
174
|
+
static reified(P) {
|
|
175
|
+
const reifiedBcs = LendingMarket.bcs;
|
|
176
|
+
return {
|
|
177
|
+
get typeName() {
|
|
178
|
+
return LendingMarket.$typeName;
|
|
179
|
+
},
|
|
180
|
+
get fullTypeName() {
|
|
181
|
+
return composeSuiType(LendingMarket.$typeName, ...[extractType(P)]);
|
|
182
|
+
},
|
|
183
|
+
get typeArgs() {
|
|
184
|
+
return [extractType(P)];
|
|
185
|
+
},
|
|
186
|
+
isPhantom: LendingMarket.$isPhantom,
|
|
187
|
+
reifiedTypeArgs: [P],
|
|
188
|
+
fromFields: (fields) => LendingMarket.fromFields(P, fields),
|
|
189
|
+
fromFieldsWithTypes: (item) => LendingMarket.fromFieldsWithTypes(P, item),
|
|
190
|
+
fromBcs: (data) => LendingMarket.fromFields(P, reifiedBcs.parse(data)),
|
|
191
|
+
bcs: reifiedBcs,
|
|
192
|
+
fromJSONField: (field) => LendingMarket.fromJSONField(P, field),
|
|
193
|
+
fromJSON: (json) => LendingMarket.fromJSON(P, json),
|
|
194
|
+
fromCoreObject: (obj) => LendingMarket.fromCoreObject(P, obj),
|
|
195
|
+
fetch: async (client, id) => LendingMarket.fetch(client, P, id),
|
|
196
|
+
new: (fields) => {
|
|
197
|
+
return new LendingMarket([extractType(P)], fields);
|
|
198
|
+
},
|
|
199
|
+
kind: 'StructClassReified',
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
static get r() {
|
|
203
|
+
return LendingMarket.reified;
|
|
204
|
+
}
|
|
205
|
+
static phantom(P) {
|
|
206
|
+
return phantom(LendingMarket.reified(P));
|
|
207
|
+
}
|
|
208
|
+
static get p() {
|
|
209
|
+
return LendingMarket.phantom;
|
|
210
|
+
}
|
|
211
|
+
static instantiateBcs() {
|
|
212
|
+
return bcs.struct('LendingMarket', {
|
|
213
|
+
id: UID.bcs,
|
|
214
|
+
version: bcs.u64(),
|
|
215
|
+
reserves: bcs.vector(Reserve.bcs),
|
|
216
|
+
obligations: ObjectTable.bcs,
|
|
217
|
+
rate_limiter: RateLimiter.bcs,
|
|
218
|
+
fee_receiver: bcs.bytes(32).transform({
|
|
219
|
+
input: (val) => fromHex(val),
|
|
220
|
+
output: (val) => toHex(val),
|
|
221
|
+
}),
|
|
222
|
+
bad_debt_usd: Decimal.bcs,
|
|
223
|
+
bad_debt_limit_usd: Decimal.bcs,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
static cachedBcs = null;
|
|
227
|
+
static get bcs() {
|
|
228
|
+
if (!LendingMarket.cachedBcs) {
|
|
229
|
+
LendingMarket.cachedBcs = LendingMarket.instantiateBcs();
|
|
230
|
+
}
|
|
231
|
+
return LendingMarket.cachedBcs;
|
|
232
|
+
}
|
|
233
|
+
static fromFields(typeArg, fields) {
|
|
234
|
+
return LendingMarket.reified(typeArg).new({
|
|
235
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
236
|
+
version: decodeFromFields('u64', fields.version),
|
|
237
|
+
reserves: decodeFromFields(vector(Reserve.reified(typeArg)), fields.reserves),
|
|
238
|
+
obligations: decodeFromFields(ObjectTable.reified(phantom(ID.reified()), phantom(Obligation.reified(typeArg))), fields.obligations),
|
|
239
|
+
rateLimiter: decodeFromFields(RateLimiter.reified(), fields.rate_limiter),
|
|
240
|
+
feeReceiver: decodeFromFields('address', fields.fee_receiver),
|
|
241
|
+
badDebtUsd: decodeFromFields(Decimal.reified(), fields.bad_debt_usd),
|
|
242
|
+
badDebtLimitUsd: decodeFromFields(Decimal.reified(), fields.bad_debt_limit_usd),
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
static fromFieldsWithTypes(typeArg, item) {
|
|
246
|
+
if (!isLendingMarket(item.type)) {
|
|
247
|
+
throw new Error('not a LendingMarket type');
|
|
248
|
+
}
|
|
249
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
250
|
+
return LendingMarket.reified(typeArg).new({
|
|
251
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
252
|
+
version: decodeFromFieldsWithTypes('u64', item.fields.version),
|
|
253
|
+
reserves: decodeFromFieldsWithTypes(vector(Reserve.reified(typeArg)), item.fields.reserves),
|
|
254
|
+
obligations: decodeFromFieldsWithTypes(ObjectTable.reified(phantom(ID.reified()), phantom(Obligation.reified(typeArg))), item.fields.obligations),
|
|
255
|
+
rateLimiter: decodeFromFieldsWithTypes(RateLimiter.reified(), item.fields.rate_limiter),
|
|
256
|
+
feeReceiver: decodeFromFieldsWithTypes('address', item.fields.fee_receiver),
|
|
257
|
+
badDebtUsd: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.bad_debt_usd),
|
|
258
|
+
badDebtLimitUsd: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.bad_debt_limit_usd),
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
static fromBcs(typeArg, data) {
|
|
262
|
+
return LendingMarket.fromFields(typeArg, LendingMarket.bcs.parse(data));
|
|
263
|
+
}
|
|
264
|
+
toJSONField() {
|
|
265
|
+
return {
|
|
266
|
+
id: this.id,
|
|
267
|
+
version: this.version.toString(),
|
|
268
|
+
reserves: fieldToJSON(`vector<${Reserve.$typeName}<${this.$typeArgs[0]}>>`, this.reserves),
|
|
269
|
+
obligations: this.obligations.toJSONField(),
|
|
270
|
+
rateLimiter: this.rateLimiter.toJSONField(),
|
|
271
|
+
feeReceiver: this.feeReceiver,
|
|
272
|
+
badDebtUsd: this.badDebtUsd.toJSONField(),
|
|
273
|
+
badDebtLimitUsd: this.badDebtLimitUsd.toJSONField(),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
toJSON() {
|
|
277
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
278
|
+
}
|
|
279
|
+
static fromJSONField(typeArg, field) {
|
|
280
|
+
return LendingMarket.reified(typeArg).new({
|
|
281
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
282
|
+
version: decodeFromJSONField('u64', field.version),
|
|
283
|
+
reserves: decodeFromJSONField(vector(Reserve.reified(typeArg)), field.reserves),
|
|
284
|
+
obligations: decodeFromJSONField(ObjectTable.reified(phantom(ID.reified()), phantom(Obligation.reified(typeArg))), field.obligations),
|
|
285
|
+
rateLimiter: decodeFromJSONField(RateLimiter.reified(), field.rateLimiter),
|
|
286
|
+
feeReceiver: decodeFromJSONField('address', field.feeReceiver),
|
|
287
|
+
badDebtUsd: decodeFromJSONField(Decimal.reified(), field.badDebtUsd),
|
|
288
|
+
badDebtLimitUsd: decodeFromJSONField(Decimal.reified(), field.badDebtLimitUsd),
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
static fromJSON(typeArg, json) {
|
|
292
|
+
if (json.$typeName !== LendingMarket.$typeName) {
|
|
293
|
+
throw new Error(`not a LendingMarket json object: expected '${LendingMarket.$typeName}' but got '${json.$typeName}'`);
|
|
294
|
+
}
|
|
295
|
+
assertReifiedTypeArgsMatch(composeSuiType(LendingMarket.$typeName, ...[extractType(typeArg)]), json.$typeArgs, [typeArg]);
|
|
296
|
+
return LendingMarket.fromJSONField(typeArg, json);
|
|
297
|
+
}
|
|
298
|
+
static fromCoreObject(typeArg, obj) {
|
|
299
|
+
if (!isLendingMarket(obj.type)) {
|
|
300
|
+
throw new Error(`object at ${obj.objectId} is not a LendingMarket object`);
|
|
301
|
+
}
|
|
302
|
+
const gotTypeArgs = parseTypeName(obj.type).typeArgs;
|
|
303
|
+
if (gotTypeArgs.length !== 1) {
|
|
304
|
+
throw new Error(`type argument mismatch: expected 1 type arguments but got '${gotTypeArgs.length}'`);
|
|
305
|
+
}
|
|
306
|
+
for (let i = 0; i < 1; i++) {
|
|
307
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
308
|
+
const expectedTypeArg = compressSuiType(extractType([typeArg][i]));
|
|
309
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
310
|
+
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return LendingMarket.fromBcs(typeArg, obj.content);
|
|
314
|
+
}
|
|
315
|
+
static async fetch(client, typeArg, id) {
|
|
316
|
+
const { object } = await client.core.getObject({
|
|
317
|
+
objectId: id,
|
|
318
|
+
include: { content: true },
|
|
319
|
+
});
|
|
320
|
+
if (!isLendingMarket(object.type)) {
|
|
321
|
+
throw new Error(`object at id ${id} is not a LendingMarket object`);
|
|
322
|
+
}
|
|
323
|
+
const gotTypeArgs = parseTypeName(object.type).typeArgs;
|
|
324
|
+
if (gotTypeArgs.length !== 1) {
|
|
325
|
+
throw new Error(`type argument mismatch: expected 1 type arguments but got '${gotTypeArgs.length}'`);
|
|
326
|
+
}
|
|
327
|
+
for (let i = 0; i < 1; i++) {
|
|
328
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
329
|
+
const expectedTypeArg = compressSuiType(extractType([typeArg][i]));
|
|
330
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
331
|
+
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return LendingMarket.fromBcs(typeArg, object.content);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
/* ============================== LendingMarketOwnerCap =============================== */
|
|
338
|
+
export function isLendingMarketOwnerCap(type) {
|
|
339
|
+
type = compressSuiType(type);
|
|
340
|
+
return type.startsWith(`${getTypeOrigin('suilend', 'lending_market::LendingMarketOwnerCap')}::lending_market::LendingMarketOwnerCap` + '<');
|
|
341
|
+
}
|
|
342
|
+
export class LendingMarketOwnerCap {
|
|
343
|
+
__StructClass = true;
|
|
344
|
+
static get $typeName() {
|
|
345
|
+
return `${getTypeOrigin('suilend', 'lending_market::LendingMarketOwnerCap')}::lending_market::LendingMarketOwnerCap`;
|
|
346
|
+
}
|
|
347
|
+
static $numTypeParams = 1;
|
|
348
|
+
static $isPhantom = [true];
|
|
349
|
+
$typeName = LendingMarketOwnerCap.$typeName;
|
|
350
|
+
$fullTypeName;
|
|
351
|
+
$typeArgs;
|
|
352
|
+
$isPhantom = LendingMarketOwnerCap.$isPhantom;
|
|
353
|
+
id;
|
|
354
|
+
lendingMarketId;
|
|
355
|
+
constructor(typeArgs, fields) {
|
|
356
|
+
this.$fullTypeName = composeSuiType(LendingMarketOwnerCap.$typeName, ...typeArgs);
|
|
357
|
+
this.$typeArgs = typeArgs;
|
|
358
|
+
this.id = fields.id;
|
|
359
|
+
this.lendingMarketId = fields.lendingMarketId;
|
|
360
|
+
}
|
|
361
|
+
static reified(P) {
|
|
362
|
+
const reifiedBcs = LendingMarketOwnerCap.bcs;
|
|
363
|
+
return {
|
|
364
|
+
get typeName() {
|
|
365
|
+
return LendingMarketOwnerCap.$typeName;
|
|
366
|
+
},
|
|
367
|
+
get fullTypeName() {
|
|
368
|
+
return composeSuiType(LendingMarketOwnerCap.$typeName, ...[extractType(P)]);
|
|
369
|
+
},
|
|
370
|
+
get typeArgs() {
|
|
371
|
+
return [extractType(P)];
|
|
372
|
+
},
|
|
373
|
+
isPhantom: LendingMarketOwnerCap.$isPhantom,
|
|
374
|
+
reifiedTypeArgs: [P],
|
|
375
|
+
fromFields: (fields) => LendingMarketOwnerCap.fromFields(P, fields),
|
|
376
|
+
fromFieldsWithTypes: (item) => LendingMarketOwnerCap.fromFieldsWithTypes(P, item),
|
|
377
|
+
fromBcs: (data) => LendingMarketOwnerCap.fromFields(P, reifiedBcs.parse(data)),
|
|
378
|
+
bcs: reifiedBcs,
|
|
379
|
+
fromJSONField: (field) => LendingMarketOwnerCap.fromJSONField(P, field),
|
|
380
|
+
fromJSON: (json) => LendingMarketOwnerCap.fromJSON(P, json),
|
|
381
|
+
fromCoreObject: (obj) => LendingMarketOwnerCap.fromCoreObject(P, obj),
|
|
382
|
+
fetch: async (client, id) => LendingMarketOwnerCap.fetch(client, P, id),
|
|
383
|
+
new: (fields) => {
|
|
384
|
+
return new LendingMarketOwnerCap([extractType(P)], fields);
|
|
385
|
+
},
|
|
386
|
+
kind: 'StructClassReified',
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
static get r() {
|
|
390
|
+
return LendingMarketOwnerCap.reified;
|
|
391
|
+
}
|
|
392
|
+
static phantom(P) {
|
|
393
|
+
return phantom(LendingMarketOwnerCap.reified(P));
|
|
394
|
+
}
|
|
395
|
+
static get p() {
|
|
396
|
+
return LendingMarketOwnerCap.phantom;
|
|
397
|
+
}
|
|
398
|
+
static instantiateBcs() {
|
|
399
|
+
return bcs.struct('LendingMarketOwnerCap', {
|
|
400
|
+
id: UID.bcs,
|
|
401
|
+
lending_market_id: ID.bcs,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
static cachedBcs = null;
|
|
405
|
+
static get bcs() {
|
|
406
|
+
if (!LendingMarketOwnerCap.cachedBcs) {
|
|
407
|
+
LendingMarketOwnerCap.cachedBcs = LendingMarketOwnerCap.instantiateBcs();
|
|
408
|
+
}
|
|
409
|
+
return LendingMarketOwnerCap.cachedBcs;
|
|
410
|
+
}
|
|
411
|
+
static fromFields(typeArg, fields) {
|
|
412
|
+
return LendingMarketOwnerCap.reified(typeArg).new({
|
|
413
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
414
|
+
lendingMarketId: decodeFromFields(ID.reified(), fields.lending_market_id),
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
static fromFieldsWithTypes(typeArg, item) {
|
|
418
|
+
if (!isLendingMarketOwnerCap(item.type)) {
|
|
419
|
+
throw new Error('not a LendingMarketOwnerCap type');
|
|
420
|
+
}
|
|
421
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
422
|
+
return LendingMarketOwnerCap.reified(typeArg).new({
|
|
423
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
424
|
+
lendingMarketId: decodeFromFieldsWithTypes(ID.reified(), item.fields.lending_market_id),
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
static fromBcs(typeArg, data) {
|
|
428
|
+
return LendingMarketOwnerCap.fromFields(typeArg, LendingMarketOwnerCap.bcs.parse(data));
|
|
429
|
+
}
|
|
430
|
+
toJSONField() {
|
|
431
|
+
return {
|
|
432
|
+
id: this.id,
|
|
433
|
+
lendingMarketId: this.lendingMarketId,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
toJSON() {
|
|
437
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
438
|
+
}
|
|
439
|
+
static fromJSONField(typeArg, field) {
|
|
440
|
+
return LendingMarketOwnerCap.reified(typeArg).new({
|
|
441
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
442
|
+
lendingMarketId: decodeFromJSONField(ID.reified(), field.lendingMarketId),
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
static fromJSON(typeArg, json) {
|
|
446
|
+
if (json.$typeName !== LendingMarketOwnerCap.$typeName) {
|
|
447
|
+
throw new Error(`not a LendingMarketOwnerCap json object: expected '${LendingMarketOwnerCap.$typeName}' but got '${json.$typeName}'`);
|
|
448
|
+
}
|
|
449
|
+
assertReifiedTypeArgsMatch(composeSuiType(LendingMarketOwnerCap.$typeName, ...[extractType(typeArg)]), json.$typeArgs, [typeArg]);
|
|
450
|
+
return LendingMarketOwnerCap.fromJSONField(typeArg, json);
|
|
451
|
+
}
|
|
452
|
+
static fromCoreObject(typeArg, obj) {
|
|
453
|
+
if (!isLendingMarketOwnerCap(obj.type)) {
|
|
454
|
+
throw new Error(`object at ${obj.objectId} is not a LendingMarketOwnerCap object`);
|
|
455
|
+
}
|
|
456
|
+
const gotTypeArgs = parseTypeName(obj.type).typeArgs;
|
|
457
|
+
if (gotTypeArgs.length !== 1) {
|
|
458
|
+
throw new Error(`type argument mismatch: expected 1 type arguments but got '${gotTypeArgs.length}'`);
|
|
459
|
+
}
|
|
460
|
+
for (let i = 0; i < 1; i++) {
|
|
461
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
462
|
+
const expectedTypeArg = compressSuiType(extractType([typeArg][i]));
|
|
463
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
464
|
+
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return LendingMarketOwnerCap.fromBcs(typeArg, obj.content);
|
|
468
|
+
}
|
|
469
|
+
static async fetch(client, typeArg, id) {
|
|
470
|
+
const { object } = await client.core.getObject({
|
|
471
|
+
objectId: id,
|
|
472
|
+
include: { content: true },
|
|
473
|
+
});
|
|
474
|
+
if (!isLendingMarketOwnerCap(object.type)) {
|
|
475
|
+
throw new Error(`object at id ${id} is not a LendingMarketOwnerCap object`);
|
|
476
|
+
}
|
|
477
|
+
const gotTypeArgs = parseTypeName(object.type).typeArgs;
|
|
478
|
+
if (gotTypeArgs.length !== 1) {
|
|
479
|
+
throw new Error(`type argument mismatch: expected 1 type arguments but got '${gotTypeArgs.length}'`);
|
|
480
|
+
}
|
|
481
|
+
for (let i = 0; i < 1; i++) {
|
|
482
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
483
|
+
const expectedTypeArg = compressSuiType(extractType([typeArg][i]));
|
|
484
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
485
|
+
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return LendingMarketOwnerCap.fromBcs(typeArg, object.content);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
/* ============================== ObligationOwnerCap =============================== */
|
|
492
|
+
export function isObligationOwnerCap(type) {
|
|
493
|
+
type = compressSuiType(type);
|
|
494
|
+
return type.startsWith(`${getTypeOrigin('suilend', 'lending_market::ObligationOwnerCap')}::lending_market::ObligationOwnerCap` + '<');
|
|
495
|
+
}
|
|
496
|
+
export class ObligationOwnerCap {
|
|
497
|
+
__StructClass = true;
|
|
498
|
+
static get $typeName() {
|
|
499
|
+
return `${getTypeOrigin('suilend', 'lending_market::ObligationOwnerCap')}::lending_market::ObligationOwnerCap`;
|
|
500
|
+
}
|
|
501
|
+
static $numTypeParams = 1;
|
|
502
|
+
static $isPhantom = [true];
|
|
503
|
+
$typeName = ObligationOwnerCap.$typeName;
|
|
504
|
+
$fullTypeName;
|
|
505
|
+
$typeArgs;
|
|
506
|
+
$isPhantom = ObligationOwnerCap.$isPhantom;
|
|
507
|
+
id;
|
|
508
|
+
obligationId;
|
|
509
|
+
constructor(typeArgs, fields) {
|
|
510
|
+
this.$fullTypeName = composeSuiType(ObligationOwnerCap.$typeName, ...typeArgs);
|
|
511
|
+
this.$typeArgs = typeArgs;
|
|
512
|
+
this.id = fields.id;
|
|
513
|
+
this.obligationId = fields.obligationId;
|
|
514
|
+
}
|
|
515
|
+
static reified(P) {
|
|
516
|
+
const reifiedBcs = ObligationOwnerCap.bcs;
|
|
517
|
+
return {
|
|
518
|
+
get typeName() {
|
|
519
|
+
return ObligationOwnerCap.$typeName;
|
|
520
|
+
},
|
|
521
|
+
get fullTypeName() {
|
|
522
|
+
return composeSuiType(ObligationOwnerCap.$typeName, ...[extractType(P)]);
|
|
523
|
+
},
|
|
524
|
+
get typeArgs() {
|
|
525
|
+
return [extractType(P)];
|
|
526
|
+
},
|
|
527
|
+
isPhantom: ObligationOwnerCap.$isPhantom,
|
|
528
|
+
reifiedTypeArgs: [P],
|
|
529
|
+
fromFields: (fields) => ObligationOwnerCap.fromFields(P, fields),
|
|
530
|
+
fromFieldsWithTypes: (item) => ObligationOwnerCap.fromFieldsWithTypes(P, item),
|
|
531
|
+
fromBcs: (data) => ObligationOwnerCap.fromFields(P, reifiedBcs.parse(data)),
|
|
532
|
+
bcs: reifiedBcs,
|
|
533
|
+
fromJSONField: (field) => ObligationOwnerCap.fromJSONField(P, field),
|
|
534
|
+
fromJSON: (json) => ObligationOwnerCap.fromJSON(P, json),
|
|
535
|
+
fromCoreObject: (obj) => ObligationOwnerCap.fromCoreObject(P, obj),
|
|
536
|
+
fetch: async (client, id) => ObligationOwnerCap.fetch(client, P, id),
|
|
537
|
+
new: (fields) => {
|
|
538
|
+
return new ObligationOwnerCap([extractType(P)], fields);
|
|
539
|
+
},
|
|
540
|
+
kind: 'StructClassReified',
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
static get r() {
|
|
544
|
+
return ObligationOwnerCap.reified;
|
|
545
|
+
}
|
|
546
|
+
static phantom(P) {
|
|
547
|
+
return phantom(ObligationOwnerCap.reified(P));
|
|
548
|
+
}
|
|
549
|
+
static get p() {
|
|
550
|
+
return ObligationOwnerCap.phantom;
|
|
551
|
+
}
|
|
552
|
+
static instantiateBcs() {
|
|
553
|
+
return bcs.struct('ObligationOwnerCap', {
|
|
554
|
+
id: UID.bcs,
|
|
555
|
+
obligation_id: ID.bcs,
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
static cachedBcs = null;
|
|
559
|
+
static get bcs() {
|
|
560
|
+
if (!ObligationOwnerCap.cachedBcs) {
|
|
561
|
+
ObligationOwnerCap.cachedBcs = ObligationOwnerCap.instantiateBcs();
|
|
562
|
+
}
|
|
563
|
+
return ObligationOwnerCap.cachedBcs;
|
|
564
|
+
}
|
|
565
|
+
static fromFields(typeArg, fields) {
|
|
566
|
+
return ObligationOwnerCap.reified(typeArg).new({
|
|
567
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
568
|
+
obligationId: decodeFromFields(ID.reified(), fields.obligation_id),
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
static fromFieldsWithTypes(typeArg, item) {
|
|
572
|
+
if (!isObligationOwnerCap(item.type)) {
|
|
573
|
+
throw new Error('not a ObligationOwnerCap type');
|
|
574
|
+
}
|
|
575
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
576
|
+
return ObligationOwnerCap.reified(typeArg).new({
|
|
577
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
578
|
+
obligationId: decodeFromFieldsWithTypes(ID.reified(), item.fields.obligation_id),
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
static fromBcs(typeArg, data) {
|
|
582
|
+
return ObligationOwnerCap.fromFields(typeArg, ObligationOwnerCap.bcs.parse(data));
|
|
583
|
+
}
|
|
584
|
+
toJSONField() {
|
|
585
|
+
return {
|
|
586
|
+
id: this.id,
|
|
587
|
+
obligationId: this.obligationId,
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
toJSON() {
|
|
591
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
592
|
+
}
|
|
593
|
+
static fromJSONField(typeArg, field) {
|
|
594
|
+
return ObligationOwnerCap.reified(typeArg).new({
|
|
595
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
596
|
+
obligationId: decodeFromJSONField(ID.reified(), field.obligationId),
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
static fromJSON(typeArg, json) {
|
|
600
|
+
if (json.$typeName !== ObligationOwnerCap.$typeName) {
|
|
601
|
+
throw new Error(`not a ObligationOwnerCap json object: expected '${ObligationOwnerCap.$typeName}' but got '${json.$typeName}'`);
|
|
602
|
+
}
|
|
603
|
+
assertReifiedTypeArgsMatch(composeSuiType(ObligationOwnerCap.$typeName, ...[extractType(typeArg)]), json.$typeArgs, [typeArg]);
|
|
604
|
+
return ObligationOwnerCap.fromJSONField(typeArg, json);
|
|
605
|
+
}
|
|
606
|
+
static fromCoreObject(typeArg, obj) {
|
|
607
|
+
if (!isObligationOwnerCap(obj.type)) {
|
|
608
|
+
throw new Error(`object at ${obj.objectId} is not a ObligationOwnerCap object`);
|
|
609
|
+
}
|
|
610
|
+
const gotTypeArgs = parseTypeName(obj.type).typeArgs;
|
|
611
|
+
if (gotTypeArgs.length !== 1) {
|
|
612
|
+
throw new Error(`type argument mismatch: expected 1 type arguments but got '${gotTypeArgs.length}'`);
|
|
613
|
+
}
|
|
614
|
+
for (let i = 0; i < 1; i++) {
|
|
615
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
616
|
+
const expectedTypeArg = compressSuiType(extractType([typeArg][i]));
|
|
617
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
618
|
+
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return ObligationOwnerCap.fromBcs(typeArg, obj.content);
|
|
622
|
+
}
|
|
623
|
+
static async fetch(client, typeArg, id) {
|
|
624
|
+
const { object } = await client.core.getObject({
|
|
625
|
+
objectId: id,
|
|
626
|
+
include: { content: true },
|
|
627
|
+
});
|
|
628
|
+
if (!isObligationOwnerCap(object.type)) {
|
|
629
|
+
throw new Error(`object at id ${id} is not a ObligationOwnerCap object`);
|
|
630
|
+
}
|
|
631
|
+
const gotTypeArgs = parseTypeName(object.type).typeArgs;
|
|
632
|
+
if (gotTypeArgs.length !== 1) {
|
|
633
|
+
throw new Error(`type argument mismatch: expected 1 type arguments but got '${gotTypeArgs.length}'`);
|
|
634
|
+
}
|
|
635
|
+
for (let i = 0; i < 1; i++) {
|
|
636
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
637
|
+
const expectedTypeArg = compressSuiType(extractType([typeArg][i]));
|
|
638
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
639
|
+
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return ObligationOwnerCap.fromBcs(typeArg, object.content);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
/* ============================== EmergencyPauseCap =============================== */
|
|
646
|
+
export function isEmergencyPauseCap(type) {
|
|
647
|
+
type = compressSuiType(type);
|
|
648
|
+
return type.startsWith(`${getTypeOrigin('suilend', 'lending_market::EmergencyPauseCap')}::lending_market::EmergencyPauseCap` + '<');
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* No `store`: can only be held directly by an address, never wrapped into another
|
|
652
|
+
* object, and can never satisfy a `&LendingMarketOwnerCap<P>` parameter -- so it is
|
|
653
|
+
* compile-time incapable of minting an `ObligationOwnerCap` or touching reserve
|
|
654
|
+
* config/price feeds. Revocation is minting the next generation via `new_pause_cap`,
|
|
655
|
+
* no package upgrade needed.
|
|
656
|
+
*/
|
|
657
|
+
export class EmergencyPauseCap {
|
|
658
|
+
__StructClass = true;
|
|
659
|
+
static get $typeName() {
|
|
660
|
+
return `${getTypeOrigin('suilend', 'lending_market::EmergencyPauseCap')}::lending_market::EmergencyPauseCap`;
|
|
661
|
+
}
|
|
662
|
+
static $numTypeParams = 1;
|
|
663
|
+
static $isPhantom = [true];
|
|
664
|
+
$typeName = EmergencyPauseCap.$typeName;
|
|
665
|
+
$fullTypeName;
|
|
666
|
+
$typeArgs;
|
|
667
|
+
$isPhantom = EmergencyPauseCap.$isPhantom;
|
|
668
|
+
id;
|
|
669
|
+
lendingMarketId;
|
|
670
|
+
generation;
|
|
671
|
+
constructor(typeArgs, fields) {
|
|
672
|
+
this.$fullTypeName = composeSuiType(EmergencyPauseCap.$typeName, ...typeArgs);
|
|
673
|
+
this.$typeArgs = typeArgs;
|
|
674
|
+
this.id = fields.id;
|
|
675
|
+
this.lendingMarketId = fields.lendingMarketId;
|
|
676
|
+
this.generation = fields.generation;
|
|
677
|
+
}
|
|
678
|
+
static reified(P) {
|
|
679
|
+
const reifiedBcs = EmergencyPauseCap.bcs;
|
|
680
|
+
return {
|
|
681
|
+
get typeName() {
|
|
682
|
+
return EmergencyPauseCap.$typeName;
|
|
683
|
+
},
|
|
684
|
+
get fullTypeName() {
|
|
685
|
+
return composeSuiType(EmergencyPauseCap.$typeName, ...[extractType(P)]);
|
|
686
|
+
},
|
|
687
|
+
get typeArgs() {
|
|
688
|
+
return [extractType(P)];
|
|
689
|
+
},
|
|
690
|
+
isPhantom: EmergencyPauseCap.$isPhantom,
|
|
691
|
+
reifiedTypeArgs: [P],
|
|
692
|
+
fromFields: (fields) => EmergencyPauseCap.fromFields(P, fields),
|
|
693
|
+
fromFieldsWithTypes: (item) => EmergencyPauseCap.fromFieldsWithTypes(P, item),
|
|
694
|
+
fromBcs: (data) => EmergencyPauseCap.fromFields(P, reifiedBcs.parse(data)),
|
|
695
|
+
bcs: reifiedBcs,
|
|
696
|
+
fromJSONField: (field) => EmergencyPauseCap.fromJSONField(P, field),
|
|
697
|
+
fromJSON: (json) => EmergencyPauseCap.fromJSON(P, json),
|
|
698
|
+
fromCoreObject: (obj) => EmergencyPauseCap.fromCoreObject(P, obj),
|
|
699
|
+
fetch: async (client, id) => EmergencyPauseCap.fetch(client, P, id),
|
|
700
|
+
new: (fields) => {
|
|
701
|
+
return new EmergencyPauseCap([extractType(P)], fields);
|
|
702
|
+
},
|
|
703
|
+
kind: 'StructClassReified',
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
static get r() {
|
|
707
|
+
return EmergencyPauseCap.reified;
|
|
708
|
+
}
|
|
709
|
+
static phantom(P) {
|
|
710
|
+
return phantom(EmergencyPauseCap.reified(P));
|
|
711
|
+
}
|
|
712
|
+
static get p() {
|
|
713
|
+
return EmergencyPauseCap.phantom;
|
|
714
|
+
}
|
|
715
|
+
static instantiateBcs() {
|
|
716
|
+
return bcs.struct('EmergencyPauseCap', {
|
|
717
|
+
id: UID.bcs,
|
|
718
|
+
lending_market_id: ID.bcs,
|
|
719
|
+
generation: bcs.u64(),
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
static cachedBcs = null;
|
|
723
|
+
static get bcs() {
|
|
724
|
+
if (!EmergencyPauseCap.cachedBcs) {
|
|
725
|
+
EmergencyPauseCap.cachedBcs = EmergencyPauseCap.instantiateBcs();
|
|
726
|
+
}
|
|
727
|
+
return EmergencyPauseCap.cachedBcs;
|
|
728
|
+
}
|
|
729
|
+
static fromFields(typeArg, fields) {
|
|
730
|
+
return EmergencyPauseCap.reified(typeArg).new({
|
|
731
|
+
id: decodeFromFields(UID.reified(), fields.id),
|
|
732
|
+
lendingMarketId: decodeFromFields(ID.reified(), fields.lending_market_id),
|
|
733
|
+
generation: decodeFromFields('u64', fields.generation),
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
static fromFieldsWithTypes(typeArg, item) {
|
|
737
|
+
if (!isEmergencyPauseCap(item.type)) {
|
|
738
|
+
throw new Error('not a EmergencyPauseCap type');
|
|
739
|
+
}
|
|
740
|
+
assertFieldsWithTypesArgsMatch(item, [typeArg]);
|
|
741
|
+
return EmergencyPauseCap.reified(typeArg).new({
|
|
742
|
+
id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
|
|
743
|
+
lendingMarketId: decodeFromFieldsWithTypes(ID.reified(), item.fields.lending_market_id),
|
|
744
|
+
generation: decodeFromFieldsWithTypes('u64', item.fields.generation),
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
static fromBcs(typeArg, data) {
|
|
748
|
+
return EmergencyPauseCap.fromFields(typeArg, EmergencyPauseCap.bcs.parse(data));
|
|
749
|
+
}
|
|
750
|
+
toJSONField() {
|
|
751
|
+
return {
|
|
752
|
+
id: this.id,
|
|
753
|
+
lendingMarketId: this.lendingMarketId,
|
|
754
|
+
generation: this.generation.toString(),
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
toJSON() {
|
|
758
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
759
|
+
}
|
|
760
|
+
static fromJSONField(typeArg, field) {
|
|
761
|
+
return EmergencyPauseCap.reified(typeArg).new({
|
|
762
|
+
id: decodeFromJSONField(UID.reified(), field.id),
|
|
763
|
+
lendingMarketId: decodeFromJSONField(ID.reified(), field.lendingMarketId),
|
|
764
|
+
generation: decodeFromJSONField('u64', field.generation),
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
static fromJSON(typeArg, json) {
|
|
768
|
+
if (json.$typeName !== EmergencyPauseCap.$typeName) {
|
|
769
|
+
throw new Error(`not a EmergencyPauseCap json object: expected '${EmergencyPauseCap.$typeName}' but got '${json.$typeName}'`);
|
|
770
|
+
}
|
|
771
|
+
assertReifiedTypeArgsMatch(composeSuiType(EmergencyPauseCap.$typeName, ...[extractType(typeArg)]), json.$typeArgs, [typeArg]);
|
|
772
|
+
return EmergencyPauseCap.fromJSONField(typeArg, json);
|
|
773
|
+
}
|
|
774
|
+
static fromCoreObject(typeArg, obj) {
|
|
775
|
+
if (!isEmergencyPauseCap(obj.type)) {
|
|
776
|
+
throw new Error(`object at ${obj.objectId} is not a EmergencyPauseCap object`);
|
|
777
|
+
}
|
|
778
|
+
const gotTypeArgs = parseTypeName(obj.type).typeArgs;
|
|
779
|
+
if (gotTypeArgs.length !== 1) {
|
|
780
|
+
throw new Error(`type argument mismatch: expected 1 type arguments but got '${gotTypeArgs.length}'`);
|
|
781
|
+
}
|
|
782
|
+
for (let i = 0; i < 1; i++) {
|
|
783
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
784
|
+
const expectedTypeArg = compressSuiType(extractType([typeArg][i]));
|
|
785
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
786
|
+
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
return EmergencyPauseCap.fromBcs(typeArg, obj.content);
|
|
790
|
+
}
|
|
791
|
+
static async fetch(client, typeArg, id) {
|
|
792
|
+
const { object } = await client.core.getObject({
|
|
793
|
+
objectId: id,
|
|
794
|
+
include: { content: true },
|
|
795
|
+
});
|
|
796
|
+
if (!isEmergencyPauseCap(object.type)) {
|
|
797
|
+
throw new Error(`object at id ${id} is not a EmergencyPauseCap object`);
|
|
798
|
+
}
|
|
799
|
+
const gotTypeArgs = parseTypeName(object.type).typeArgs;
|
|
800
|
+
if (gotTypeArgs.length !== 1) {
|
|
801
|
+
throw new Error(`type argument mismatch: expected 1 type arguments but got '${gotTypeArgs.length}'`);
|
|
802
|
+
}
|
|
803
|
+
for (let i = 0; i < 1; i++) {
|
|
804
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
805
|
+
const expectedTypeArg = compressSuiType(extractType([typeArg][i]));
|
|
806
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
807
|
+
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
return EmergencyPauseCap.fromBcs(typeArg, object.content);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
/* ============================== FeeReceiversKey =============================== */
|
|
814
|
+
export function isFeeReceiversKey(type) {
|
|
815
|
+
type = compressSuiType(type);
|
|
816
|
+
return type
|
|
817
|
+
=== `${getTypeOrigin('suilend', 'lending_market::FeeReceiversKey')}::lending_market::FeeReceiversKey`;
|
|
818
|
+
}
|
|
819
|
+
export class FeeReceiversKey {
|
|
820
|
+
__StructClass = true;
|
|
821
|
+
static get $typeName() {
|
|
822
|
+
return `${getTypeOrigin('suilend', 'lending_market::FeeReceiversKey')}::lending_market::FeeReceiversKey`;
|
|
823
|
+
}
|
|
824
|
+
static $numTypeParams = 0;
|
|
825
|
+
static $isPhantom = [];
|
|
826
|
+
$typeName = FeeReceiversKey.$typeName;
|
|
827
|
+
$fullTypeName;
|
|
828
|
+
$typeArgs;
|
|
829
|
+
$isPhantom = FeeReceiversKey.$isPhantom;
|
|
830
|
+
dummyField;
|
|
831
|
+
constructor(typeArgs, fields) {
|
|
832
|
+
this.$fullTypeName = composeSuiType(FeeReceiversKey.$typeName, ...typeArgs);
|
|
833
|
+
this.$typeArgs = typeArgs;
|
|
834
|
+
this.dummyField = fields.dummyField;
|
|
835
|
+
}
|
|
836
|
+
static reified() {
|
|
837
|
+
const reifiedBcs = FeeReceiversKey.bcs;
|
|
838
|
+
return {
|
|
839
|
+
get typeName() {
|
|
840
|
+
return FeeReceiversKey.$typeName;
|
|
841
|
+
},
|
|
842
|
+
get fullTypeName() {
|
|
843
|
+
return composeSuiType(FeeReceiversKey.$typeName, ...[]);
|
|
844
|
+
},
|
|
845
|
+
typeArgs: [],
|
|
846
|
+
isPhantom: FeeReceiversKey.$isPhantom,
|
|
847
|
+
reifiedTypeArgs: [],
|
|
848
|
+
fromFields: (fields) => FeeReceiversKey.fromFields(fields),
|
|
849
|
+
fromFieldsWithTypes: (item) => FeeReceiversKey.fromFieldsWithTypes(item),
|
|
850
|
+
fromBcs: (data) => FeeReceiversKey.fromFields(reifiedBcs.parse(data)),
|
|
851
|
+
bcs: reifiedBcs,
|
|
852
|
+
fromJSONField: (field) => FeeReceiversKey.fromJSONField(field),
|
|
853
|
+
fromJSON: (json) => FeeReceiversKey.fromJSON(json),
|
|
854
|
+
fromCoreObject: (obj) => FeeReceiversKey.fromCoreObject(obj),
|
|
855
|
+
fetch: async (client, id) => FeeReceiversKey.fetch(client, id),
|
|
856
|
+
new: (fields) => {
|
|
857
|
+
return new FeeReceiversKey([], fields);
|
|
858
|
+
},
|
|
859
|
+
kind: 'StructClassReified',
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
static get r() {
|
|
863
|
+
return FeeReceiversKey.reified();
|
|
864
|
+
}
|
|
865
|
+
static phantom() {
|
|
866
|
+
return phantom(FeeReceiversKey.reified());
|
|
867
|
+
}
|
|
868
|
+
static get p() {
|
|
869
|
+
return FeeReceiversKey.phantom();
|
|
870
|
+
}
|
|
871
|
+
static instantiateBcs() {
|
|
872
|
+
return bcs.struct('FeeReceiversKey', {
|
|
873
|
+
dummy_field: bcs.bool(),
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
static cachedBcs = null;
|
|
877
|
+
static get bcs() {
|
|
878
|
+
if (!FeeReceiversKey.cachedBcs) {
|
|
879
|
+
FeeReceiversKey.cachedBcs = FeeReceiversKey.instantiateBcs();
|
|
880
|
+
}
|
|
881
|
+
return FeeReceiversKey.cachedBcs;
|
|
882
|
+
}
|
|
883
|
+
static fromFields(fields) {
|
|
884
|
+
return FeeReceiversKey.reified().new({
|
|
885
|
+
dummyField: decodeFromFields('bool', fields.dummy_field),
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
static fromFieldsWithTypes(item) {
|
|
889
|
+
if (!isFeeReceiversKey(item.type)) {
|
|
890
|
+
throw new Error('not a FeeReceiversKey type');
|
|
891
|
+
}
|
|
892
|
+
return FeeReceiversKey.reified().new({
|
|
893
|
+
dummyField: decodeFromFieldsWithTypes('bool', item.fields.dummy_field),
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
static fromBcs(data) {
|
|
897
|
+
return FeeReceiversKey.fromFields(FeeReceiversKey.bcs.parse(data));
|
|
898
|
+
}
|
|
899
|
+
toJSONField() {
|
|
900
|
+
return {
|
|
901
|
+
dummyField: this.dummyField,
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
toJSON() {
|
|
905
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
906
|
+
}
|
|
907
|
+
static fromJSONField(field) {
|
|
908
|
+
return FeeReceiversKey.reified().new({
|
|
909
|
+
dummyField: decodeFromJSONField('bool', field.dummyField),
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
static fromJSON(json) {
|
|
913
|
+
if (json.$typeName !== FeeReceiversKey.$typeName) {
|
|
914
|
+
throw new Error(`not a FeeReceiversKey json object: expected '${FeeReceiversKey.$typeName}' but got '${json.$typeName}'`);
|
|
915
|
+
}
|
|
916
|
+
return FeeReceiversKey.fromJSONField(json);
|
|
917
|
+
}
|
|
918
|
+
static fromCoreObject(obj) {
|
|
919
|
+
if (!isFeeReceiversKey(obj.type)) {
|
|
920
|
+
throw new Error(`object at ${obj.objectId} is not a FeeReceiversKey object`);
|
|
921
|
+
}
|
|
922
|
+
return FeeReceiversKey.fromBcs(obj.content);
|
|
923
|
+
}
|
|
924
|
+
static async fetch(client, id) {
|
|
925
|
+
const { object } = await client.core.getObject({
|
|
926
|
+
objectId: id,
|
|
927
|
+
include: { content: true },
|
|
928
|
+
});
|
|
929
|
+
if (!isFeeReceiversKey(object.type)) {
|
|
930
|
+
throw new Error(`object at id ${id} is not a FeeReceiversKey object`);
|
|
931
|
+
}
|
|
932
|
+
return FeeReceiversKey.fromBcs(object.content);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
/* ============================== PauseKey =============================== */
|
|
936
|
+
export function isPauseKey(type) {
|
|
16
937
|
type = compressSuiType(type);
|
|
17
|
-
return type
|
|
938
|
+
return type
|
|
939
|
+
=== `${getTypeOrigin('suilend', 'lending_market::PauseKey')}::lending_market::PauseKey`;
|
|
18
940
|
}
|
|
19
|
-
export class
|
|
941
|
+
export class PauseKey {
|
|
20
942
|
__StructClass = true;
|
|
21
|
-
static $typeName
|
|
943
|
+
static get $typeName() {
|
|
944
|
+
return `${getTypeOrigin('suilend', 'lending_market::PauseKey')}::lending_market::PauseKey`;
|
|
945
|
+
}
|
|
22
946
|
static $numTypeParams = 0;
|
|
23
947
|
static $isPhantom = [];
|
|
24
|
-
$typeName =
|
|
948
|
+
$typeName = PauseKey.$typeName;
|
|
25
949
|
$fullTypeName;
|
|
26
950
|
$typeArgs;
|
|
27
|
-
$isPhantom =
|
|
28
|
-
|
|
29
|
-
coinType;
|
|
30
|
-
reserveId;
|
|
31
|
-
liquidityAmount;
|
|
32
|
-
ctokenAmount;
|
|
951
|
+
$isPhantom = PauseKey.$isPhantom;
|
|
952
|
+
dummyField;
|
|
33
953
|
constructor(typeArgs, fields) {
|
|
34
|
-
this.$fullTypeName = composeSuiType(
|
|
954
|
+
this.$fullTypeName = composeSuiType(PauseKey.$typeName, ...typeArgs);
|
|
35
955
|
this.$typeArgs = typeArgs;
|
|
36
|
-
this.
|
|
37
|
-
this.coinType = fields.coinType;
|
|
38
|
-
this.reserveId = fields.reserveId;
|
|
39
|
-
this.liquidityAmount = fields.liquidityAmount;
|
|
40
|
-
this.ctokenAmount = fields.ctokenAmount;
|
|
956
|
+
this.dummyField = fields.dummyField;
|
|
41
957
|
}
|
|
42
958
|
static reified() {
|
|
959
|
+
const reifiedBcs = PauseKey.bcs;
|
|
43
960
|
return {
|
|
44
|
-
typeName
|
|
45
|
-
|
|
961
|
+
get typeName() {
|
|
962
|
+
return PauseKey.$typeName;
|
|
963
|
+
},
|
|
964
|
+
get fullTypeName() {
|
|
965
|
+
return composeSuiType(PauseKey.$typeName, ...[]);
|
|
966
|
+
},
|
|
46
967
|
typeArgs: [],
|
|
47
|
-
isPhantom:
|
|
968
|
+
isPhantom: PauseKey.$isPhantom,
|
|
48
969
|
reifiedTypeArgs: [],
|
|
49
|
-
fromFields: (fields) =>
|
|
50
|
-
fromFieldsWithTypes: (item) =>
|
|
51
|
-
fromBcs: (data) =>
|
|
52
|
-
bcs:
|
|
53
|
-
fromJSONField: (field) =>
|
|
54
|
-
fromJSON: (json) =>
|
|
55
|
-
|
|
970
|
+
fromFields: (fields) => PauseKey.fromFields(fields),
|
|
971
|
+
fromFieldsWithTypes: (item) => PauseKey.fromFieldsWithTypes(item),
|
|
972
|
+
fromBcs: (data) => PauseKey.fromFields(reifiedBcs.parse(data)),
|
|
973
|
+
bcs: reifiedBcs,
|
|
974
|
+
fromJSONField: (field) => PauseKey.fromJSONField(field),
|
|
975
|
+
fromJSON: (json) => PauseKey.fromJSON(json),
|
|
976
|
+
fromCoreObject: (obj) => PauseKey.fromCoreObject(obj),
|
|
977
|
+
fetch: async (client, id) => PauseKey.fetch(client, id),
|
|
56
978
|
new: (fields) => {
|
|
57
|
-
return new
|
|
979
|
+
return new PauseKey([], fields);
|
|
58
980
|
},
|
|
59
|
-
kind:
|
|
981
|
+
kind: 'StructClassReified',
|
|
60
982
|
};
|
|
61
983
|
}
|
|
62
984
|
static get r() {
|
|
63
|
-
return
|
|
985
|
+
return PauseKey.reified();
|
|
64
986
|
}
|
|
65
987
|
static phantom() {
|
|
66
|
-
return phantom(
|
|
988
|
+
return phantom(PauseKey.reified());
|
|
67
989
|
}
|
|
68
990
|
static get p() {
|
|
69
|
-
return
|
|
991
|
+
return PauseKey.phantom();
|
|
992
|
+
}
|
|
993
|
+
static instantiateBcs() {
|
|
994
|
+
return bcs.struct('PauseKey', {
|
|
995
|
+
dummy_field: bcs.bool(),
|
|
996
|
+
});
|
|
70
997
|
}
|
|
998
|
+
static cachedBcs = null;
|
|
71
999
|
static get bcs() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
1000
|
+
if (!PauseKey.cachedBcs) {
|
|
1001
|
+
PauseKey.cachedBcs = PauseKey.instantiateBcs();
|
|
1002
|
+
}
|
|
1003
|
+
return PauseKey.cachedBcs;
|
|
1004
|
+
}
|
|
1005
|
+
static fromFields(fields) {
|
|
1006
|
+
return PauseKey.reified().new({
|
|
1007
|
+
dummyField: decodeFromFields('bool', fields.dummy_field),
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
static fromFieldsWithTypes(item) {
|
|
1011
|
+
if (!isPauseKey(item.type)) {
|
|
1012
|
+
throw new Error('not a PauseKey type');
|
|
1013
|
+
}
|
|
1014
|
+
return PauseKey.reified().new({
|
|
1015
|
+
dummyField: decodeFromFieldsWithTypes('bool', item.fields.dummy_field),
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
static fromBcs(data) {
|
|
1019
|
+
return PauseKey.fromFields(PauseKey.bcs.parse(data));
|
|
1020
|
+
}
|
|
1021
|
+
toJSONField() {
|
|
1022
|
+
return {
|
|
1023
|
+
dummyField: this.dummyField,
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
toJSON() {
|
|
1027
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
1028
|
+
}
|
|
1029
|
+
static fromJSONField(field) {
|
|
1030
|
+
return PauseKey.reified().new({
|
|
1031
|
+
dummyField: decodeFromJSONField('bool', field.dummyField),
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
static fromJSON(json) {
|
|
1035
|
+
if (json.$typeName !== PauseKey.$typeName) {
|
|
1036
|
+
throw new Error(`not a PauseKey json object: expected '${PauseKey.$typeName}' but got '${json.$typeName}'`);
|
|
1037
|
+
}
|
|
1038
|
+
return PauseKey.fromJSONField(json);
|
|
1039
|
+
}
|
|
1040
|
+
static fromCoreObject(obj) {
|
|
1041
|
+
if (!isPauseKey(obj.type)) {
|
|
1042
|
+
throw new Error(`object at ${obj.objectId} is not a PauseKey object`);
|
|
1043
|
+
}
|
|
1044
|
+
return PauseKey.fromBcs(obj.content);
|
|
1045
|
+
}
|
|
1046
|
+
static async fetch(client, id) {
|
|
1047
|
+
const { object } = await client.core.getObject({
|
|
1048
|
+
objectId: id,
|
|
1049
|
+
include: { content: true },
|
|
1050
|
+
});
|
|
1051
|
+
if (!isPauseKey(object.type)) {
|
|
1052
|
+
throw new Error(`object at id ${id} is not a PauseKey object`);
|
|
1053
|
+
}
|
|
1054
|
+
return PauseKey.fromBcs(object.content);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
/* ============================== PauseCapGenerationKey =============================== */
|
|
1058
|
+
export function isPauseCapGenerationKey(type) {
|
|
1059
|
+
type = compressSuiType(type);
|
|
1060
|
+
return type
|
|
1061
|
+
=== `${getTypeOrigin('suilend', 'lending_market::PauseCapGenerationKey')}::lending_market::PauseCapGenerationKey`;
|
|
1062
|
+
}
|
|
1063
|
+
export class PauseCapGenerationKey {
|
|
1064
|
+
__StructClass = true;
|
|
1065
|
+
static get $typeName() {
|
|
1066
|
+
return `${getTypeOrigin('suilend', 'lending_market::PauseCapGenerationKey')}::lending_market::PauseCapGenerationKey`;
|
|
1067
|
+
}
|
|
1068
|
+
static $numTypeParams = 0;
|
|
1069
|
+
static $isPhantom = [];
|
|
1070
|
+
$typeName = PauseCapGenerationKey.$typeName;
|
|
1071
|
+
$fullTypeName;
|
|
1072
|
+
$typeArgs;
|
|
1073
|
+
$isPhantom = PauseCapGenerationKey.$isPhantom;
|
|
1074
|
+
dummyField;
|
|
1075
|
+
constructor(typeArgs, fields) {
|
|
1076
|
+
this.$fullTypeName = composeSuiType(PauseCapGenerationKey.$typeName, ...typeArgs);
|
|
1077
|
+
this.$typeArgs = typeArgs;
|
|
1078
|
+
this.dummyField = fields.dummyField;
|
|
1079
|
+
}
|
|
1080
|
+
static reified() {
|
|
1081
|
+
const reifiedBcs = PauseCapGenerationKey.bcs;
|
|
1082
|
+
return {
|
|
1083
|
+
get typeName() {
|
|
1084
|
+
return PauseCapGenerationKey.$typeName;
|
|
1085
|
+
},
|
|
1086
|
+
get fullTypeName() {
|
|
1087
|
+
return composeSuiType(PauseCapGenerationKey.$typeName, ...[]);
|
|
1088
|
+
},
|
|
1089
|
+
typeArgs: [],
|
|
1090
|
+
isPhantom: PauseCapGenerationKey.$isPhantom,
|
|
1091
|
+
reifiedTypeArgs: [],
|
|
1092
|
+
fromFields: (fields) => PauseCapGenerationKey.fromFields(fields),
|
|
1093
|
+
fromFieldsWithTypes: (item) => PauseCapGenerationKey.fromFieldsWithTypes(item),
|
|
1094
|
+
fromBcs: (data) => PauseCapGenerationKey.fromFields(reifiedBcs.parse(data)),
|
|
1095
|
+
bcs: reifiedBcs,
|
|
1096
|
+
fromJSONField: (field) => PauseCapGenerationKey.fromJSONField(field),
|
|
1097
|
+
fromJSON: (json) => PauseCapGenerationKey.fromJSON(json),
|
|
1098
|
+
fromCoreObject: (obj) => PauseCapGenerationKey.fromCoreObject(obj),
|
|
1099
|
+
fetch: async (client, id) => PauseCapGenerationKey.fetch(client, id),
|
|
1100
|
+
new: (fields) => {
|
|
1101
|
+
return new PauseCapGenerationKey([], fields);
|
|
1102
|
+
},
|
|
1103
|
+
kind: 'StructClassReified',
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
static get r() {
|
|
1107
|
+
return PauseCapGenerationKey.reified();
|
|
1108
|
+
}
|
|
1109
|
+
static phantom() {
|
|
1110
|
+
return phantom(PauseCapGenerationKey.reified());
|
|
1111
|
+
}
|
|
1112
|
+
static get p() {
|
|
1113
|
+
return PauseCapGenerationKey.phantom();
|
|
1114
|
+
}
|
|
1115
|
+
static instantiateBcs() {
|
|
1116
|
+
return bcs.struct('PauseCapGenerationKey', {
|
|
1117
|
+
dummy_field: bcs.bool(),
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
static cachedBcs = null;
|
|
1121
|
+
static get bcs() {
|
|
1122
|
+
if (!PauseCapGenerationKey.cachedBcs) {
|
|
1123
|
+
PauseCapGenerationKey.cachedBcs = PauseCapGenerationKey.instantiateBcs();
|
|
1124
|
+
}
|
|
1125
|
+
return PauseCapGenerationKey.cachedBcs;
|
|
1126
|
+
}
|
|
1127
|
+
static fromFields(fields) {
|
|
1128
|
+
return PauseCapGenerationKey.reified().new({
|
|
1129
|
+
dummyField: decodeFromFields('bool', fields.dummy_field),
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
static fromFieldsWithTypes(item) {
|
|
1133
|
+
if (!isPauseCapGenerationKey(item.type)) {
|
|
1134
|
+
throw new Error('not a PauseCapGenerationKey type');
|
|
1135
|
+
}
|
|
1136
|
+
return PauseCapGenerationKey.reified().new({
|
|
1137
|
+
dummyField: decodeFromFieldsWithTypes('bool', item.fields.dummy_field),
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
static fromBcs(data) {
|
|
1141
|
+
return PauseCapGenerationKey.fromFields(PauseCapGenerationKey.bcs.parse(data));
|
|
1142
|
+
}
|
|
1143
|
+
toJSONField() {
|
|
1144
|
+
return {
|
|
1145
|
+
dummyField: this.dummyField,
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
toJSON() {
|
|
1149
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
1150
|
+
}
|
|
1151
|
+
static fromJSONField(field) {
|
|
1152
|
+
return PauseCapGenerationKey.reified().new({
|
|
1153
|
+
dummyField: decodeFromJSONField('bool', field.dummyField),
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
static fromJSON(json) {
|
|
1157
|
+
if (json.$typeName !== PauseCapGenerationKey.$typeName) {
|
|
1158
|
+
throw new Error(`not a PauseCapGenerationKey json object: expected '${PauseCapGenerationKey.$typeName}' but got '${json.$typeName}'`);
|
|
1159
|
+
}
|
|
1160
|
+
return PauseCapGenerationKey.fromJSONField(json);
|
|
1161
|
+
}
|
|
1162
|
+
static fromCoreObject(obj) {
|
|
1163
|
+
if (!isPauseCapGenerationKey(obj.type)) {
|
|
1164
|
+
throw new Error(`object at ${obj.objectId} is not a PauseCapGenerationKey object`);
|
|
1165
|
+
}
|
|
1166
|
+
return PauseCapGenerationKey.fromBcs(obj.content);
|
|
1167
|
+
}
|
|
1168
|
+
static async fetch(client, id) {
|
|
1169
|
+
const { object } = await client.core.getObject({
|
|
1170
|
+
objectId: id,
|
|
1171
|
+
include: { content: true },
|
|
1172
|
+
});
|
|
1173
|
+
if (!isPauseCapGenerationKey(object.type)) {
|
|
1174
|
+
throw new Error(`object at id ${id} is not a PauseCapGenerationKey object`);
|
|
1175
|
+
}
|
|
1176
|
+
return PauseCapGenerationKey.fromBcs(object.content);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
/* ============================== FeeReceivers =============================== */
|
|
1180
|
+
export function isFeeReceivers(type) {
|
|
1181
|
+
type = compressSuiType(type);
|
|
1182
|
+
return type
|
|
1183
|
+
=== `${getTypeOrigin('suilend', 'lending_market::FeeReceivers')}::lending_market::FeeReceivers`;
|
|
1184
|
+
}
|
|
1185
|
+
export class FeeReceivers {
|
|
1186
|
+
__StructClass = true;
|
|
1187
|
+
static get $typeName() {
|
|
1188
|
+
return `${getTypeOrigin('suilend', 'lending_market::FeeReceivers')}::lending_market::FeeReceivers`;
|
|
1189
|
+
}
|
|
1190
|
+
static $numTypeParams = 0;
|
|
1191
|
+
static $isPhantom = [];
|
|
1192
|
+
$typeName = FeeReceivers.$typeName;
|
|
1193
|
+
$fullTypeName;
|
|
1194
|
+
$typeArgs;
|
|
1195
|
+
$isPhantom = FeeReceivers.$isPhantom;
|
|
1196
|
+
receivers;
|
|
1197
|
+
weights;
|
|
1198
|
+
totalWeight;
|
|
1199
|
+
constructor(typeArgs, fields) {
|
|
1200
|
+
this.$fullTypeName = composeSuiType(FeeReceivers.$typeName, ...typeArgs);
|
|
1201
|
+
this.$typeArgs = typeArgs;
|
|
1202
|
+
this.receivers = fields.receivers;
|
|
1203
|
+
this.weights = fields.weights;
|
|
1204
|
+
this.totalWeight = fields.totalWeight;
|
|
1205
|
+
}
|
|
1206
|
+
static reified() {
|
|
1207
|
+
const reifiedBcs = FeeReceivers.bcs;
|
|
1208
|
+
return {
|
|
1209
|
+
get typeName() {
|
|
1210
|
+
return FeeReceivers.$typeName;
|
|
1211
|
+
},
|
|
1212
|
+
get fullTypeName() {
|
|
1213
|
+
return composeSuiType(FeeReceivers.$typeName, ...[]);
|
|
1214
|
+
},
|
|
1215
|
+
typeArgs: [],
|
|
1216
|
+
isPhantom: FeeReceivers.$isPhantom,
|
|
1217
|
+
reifiedTypeArgs: [],
|
|
1218
|
+
fromFields: (fields) => FeeReceivers.fromFields(fields),
|
|
1219
|
+
fromFieldsWithTypes: (item) => FeeReceivers.fromFieldsWithTypes(item),
|
|
1220
|
+
fromBcs: (data) => FeeReceivers.fromFields(reifiedBcs.parse(data)),
|
|
1221
|
+
bcs: reifiedBcs,
|
|
1222
|
+
fromJSONField: (field) => FeeReceivers.fromJSONField(field),
|
|
1223
|
+
fromJSON: (json) => FeeReceivers.fromJSON(json),
|
|
1224
|
+
fromCoreObject: (obj) => FeeReceivers.fromCoreObject(obj),
|
|
1225
|
+
fetch: async (client, id) => FeeReceivers.fetch(client, id),
|
|
1226
|
+
new: (fields) => {
|
|
1227
|
+
return new FeeReceivers([], fields);
|
|
1228
|
+
},
|
|
1229
|
+
kind: 'StructClassReified',
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
static get r() {
|
|
1233
|
+
return FeeReceivers.reified();
|
|
1234
|
+
}
|
|
1235
|
+
static phantom() {
|
|
1236
|
+
return phantom(FeeReceivers.reified());
|
|
1237
|
+
}
|
|
1238
|
+
static get p() {
|
|
1239
|
+
return FeeReceivers.phantom();
|
|
1240
|
+
}
|
|
1241
|
+
static instantiateBcs() {
|
|
1242
|
+
return bcs.struct('FeeReceivers', {
|
|
1243
|
+
receivers: bcs.vector(bcs.bytes(32).transform({
|
|
83
1244
|
input: (val) => fromHex(val),
|
|
84
1245
|
output: (val) => toHex(val),
|
|
85
|
-
}),
|
|
86
|
-
|
|
87
|
-
|
|
1246
|
+
})),
|
|
1247
|
+
weights: bcs.vector(bcs.u64()),
|
|
1248
|
+
total_weight: bcs.u64(),
|
|
88
1249
|
});
|
|
89
1250
|
}
|
|
1251
|
+
static cachedBcs = null;
|
|
1252
|
+
static get bcs() {
|
|
1253
|
+
if (!FeeReceivers.cachedBcs) {
|
|
1254
|
+
FeeReceivers.cachedBcs = FeeReceivers.instantiateBcs();
|
|
1255
|
+
}
|
|
1256
|
+
return FeeReceivers.cachedBcs;
|
|
1257
|
+
}
|
|
90
1258
|
static fromFields(fields) {
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
liquidityAmount: decodeFromFields("u64", fields.liquidity_amount),
|
|
96
|
-
ctokenAmount: decodeFromFields("u64", fields.ctoken_amount),
|
|
1259
|
+
return FeeReceivers.reified().new({
|
|
1260
|
+
receivers: decodeFromFields(vector('address'), fields.receivers),
|
|
1261
|
+
weights: decodeFromFields(vector('u64'), fields.weights),
|
|
1262
|
+
totalWeight: decodeFromFields('u64', fields.total_weight),
|
|
97
1263
|
});
|
|
98
1264
|
}
|
|
99
1265
|
static fromFieldsWithTypes(item) {
|
|
100
|
-
if (!
|
|
101
|
-
throw new Error(
|
|
1266
|
+
if (!isFeeReceivers(item.type)) {
|
|
1267
|
+
throw new Error('not a FeeReceivers type');
|
|
102
1268
|
}
|
|
103
|
-
return
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
liquidityAmount: decodeFromFieldsWithTypes("u64", item.fields.liquidity_amount),
|
|
108
|
-
ctokenAmount: decodeFromFieldsWithTypes("u64", item.fields.ctoken_amount),
|
|
1269
|
+
return FeeReceivers.reified().new({
|
|
1270
|
+
receivers: decodeFromFieldsWithTypes(vector('address'), item.fields.receivers),
|
|
1271
|
+
weights: decodeFromFieldsWithTypes(vector('u64'), item.fields.weights),
|
|
1272
|
+
totalWeight: decodeFromFieldsWithTypes('u64', item.fields.total_weight),
|
|
109
1273
|
});
|
|
110
1274
|
}
|
|
111
1275
|
static fromBcs(data) {
|
|
112
|
-
return
|
|
1276
|
+
return FeeReceivers.fromFields(FeeReceivers.bcs.parse(data));
|
|
113
1277
|
}
|
|
114
1278
|
toJSONField() {
|
|
115
1279
|
return {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
liquidityAmount: this.liquidityAmount.toString(),
|
|
120
|
-
ctokenAmount: this.ctokenAmount.toString(),
|
|
1280
|
+
receivers: fieldToJSON(`vector<address>`, this.receivers),
|
|
1281
|
+
weights: fieldToJSON(`vector<u64>`, this.weights),
|
|
1282
|
+
totalWeight: this.totalWeight.toString(),
|
|
121
1283
|
};
|
|
122
1284
|
}
|
|
123
1285
|
toJSON() {
|
|
124
|
-
return {
|
|
125
|
-
$typeName: this.$typeName,
|
|
126
|
-
$typeArgs: this.$typeArgs,
|
|
127
|
-
...this.toJSONField(),
|
|
128
|
-
};
|
|
1286
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
129
1287
|
}
|
|
130
1288
|
static fromJSONField(field) {
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
liquidityAmount: decodeFromJSONField("u64", field.liquidityAmount),
|
|
136
|
-
ctokenAmount: decodeFromJSONField("u64", field.ctokenAmount),
|
|
1289
|
+
return FeeReceivers.reified().new({
|
|
1290
|
+
receivers: decodeFromJSONField(vector('address'), field.receivers),
|
|
1291
|
+
weights: decodeFromJSONField(vector('u64'), field.weights),
|
|
1292
|
+
totalWeight: decodeFromJSONField('u64', field.totalWeight),
|
|
137
1293
|
});
|
|
138
1294
|
}
|
|
139
1295
|
static fromJSON(json) {
|
|
140
|
-
if (json.$typeName !==
|
|
141
|
-
throw new Error(
|
|
1296
|
+
if (json.$typeName !== FeeReceivers.$typeName) {
|
|
1297
|
+
throw new Error(`not a FeeReceivers json object: expected '${FeeReceivers.$typeName}' but got '${json.$typeName}'`);
|
|
142
1298
|
}
|
|
143
|
-
return
|
|
1299
|
+
return FeeReceivers.fromJSONField(json);
|
|
1300
|
+
}
|
|
1301
|
+
static fromCoreObject(obj) {
|
|
1302
|
+
if (!isFeeReceivers(obj.type)) {
|
|
1303
|
+
throw new Error(`object at ${obj.objectId} is not a FeeReceivers object`);
|
|
1304
|
+
}
|
|
1305
|
+
return FeeReceivers.fromBcs(obj.content);
|
|
144
1306
|
}
|
|
145
1307
|
static async fetch(client, id) {
|
|
146
|
-
const { object } = await client.getObject({
|
|
147
|
-
|
|
148
|
-
|
|
1308
|
+
const { object } = await client.core.getObject({
|
|
1309
|
+
objectId: id,
|
|
1310
|
+
include: { content: true },
|
|
1311
|
+
});
|
|
1312
|
+
if (!isFeeReceivers(object.type)) {
|
|
1313
|
+
throw new Error(`object at id ${id} is not a FeeReceivers object`);
|
|
149
1314
|
}
|
|
150
|
-
return
|
|
1315
|
+
return FeeReceivers.fromBcs(object.content);
|
|
151
1316
|
}
|
|
152
1317
|
}
|
|
153
|
-
/* ==============================
|
|
154
|
-
export function
|
|
1318
|
+
/* ============================== RateLimiterExemption =============================== */
|
|
1319
|
+
export function isRateLimiterExemption(type) {
|
|
155
1320
|
type = compressSuiType(type);
|
|
156
|
-
return type
|
|
1321
|
+
return type.startsWith(`${getTypeOrigin('suilend', 'lending_market::RateLimiterExemption')}::lending_market::RateLimiterExemption` + '<');
|
|
157
1322
|
}
|
|
158
|
-
export class
|
|
1323
|
+
export class RateLimiterExemption {
|
|
159
1324
|
__StructClass = true;
|
|
160
|
-
static $typeName
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
$
|
|
1325
|
+
static get $typeName() {
|
|
1326
|
+
return `${getTypeOrigin('suilend', 'lending_market::RateLimiterExemption')}::lending_market::RateLimiterExemption`;
|
|
1327
|
+
}
|
|
1328
|
+
static $numTypeParams = 2;
|
|
1329
|
+
static $isPhantom = [true, true];
|
|
1330
|
+
$typeName = RateLimiterExemption.$typeName;
|
|
164
1331
|
$fullTypeName;
|
|
165
1332
|
$typeArgs;
|
|
166
|
-
$isPhantom =
|
|
167
|
-
|
|
168
|
-
coinType;
|
|
169
|
-
reserveId;
|
|
170
|
-
ctokenAmount;
|
|
171
|
-
liquidityAmount;
|
|
1333
|
+
$isPhantom = RateLimiterExemption.$isPhantom;
|
|
1334
|
+
amount;
|
|
172
1335
|
constructor(typeArgs, fields) {
|
|
173
|
-
this.$fullTypeName = composeSuiType(
|
|
1336
|
+
this.$fullTypeName = composeSuiType(RateLimiterExemption.$typeName, ...typeArgs);
|
|
174
1337
|
this.$typeArgs = typeArgs;
|
|
175
|
-
this.
|
|
176
|
-
this.coinType = fields.coinType;
|
|
177
|
-
this.reserveId = fields.reserveId;
|
|
178
|
-
this.ctokenAmount = fields.ctokenAmount;
|
|
179
|
-
this.liquidityAmount = fields.liquidityAmount;
|
|
1338
|
+
this.amount = fields.amount;
|
|
180
1339
|
}
|
|
181
|
-
static reified() {
|
|
1340
|
+
static reified(P, T) {
|
|
1341
|
+
const reifiedBcs = RateLimiterExemption.bcs;
|
|
182
1342
|
return {
|
|
183
|
-
typeName
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
1343
|
+
get typeName() {
|
|
1344
|
+
return RateLimiterExemption.$typeName;
|
|
1345
|
+
},
|
|
1346
|
+
get fullTypeName() {
|
|
1347
|
+
return composeSuiType(RateLimiterExemption.$typeName, ...[extractType(P), extractType(T)]);
|
|
1348
|
+
},
|
|
1349
|
+
get typeArgs() {
|
|
1350
|
+
return [extractType(P), extractType(T)];
|
|
1351
|
+
},
|
|
1352
|
+
isPhantom: RateLimiterExemption.$isPhantom,
|
|
1353
|
+
reifiedTypeArgs: [P, T],
|
|
1354
|
+
fromFields: (fields) => RateLimiterExemption.fromFields([P, T], fields),
|
|
1355
|
+
fromFieldsWithTypes: (item) => RateLimiterExemption.fromFieldsWithTypes([P, T], item),
|
|
1356
|
+
fromBcs: (data) => RateLimiterExemption.fromFields([P, T], reifiedBcs.parse(data)),
|
|
1357
|
+
bcs: reifiedBcs,
|
|
1358
|
+
fromJSONField: (field) => RateLimiterExemption.fromJSONField([P, T], field),
|
|
1359
|
+
fromJSON: (json) => RateLimiterExemption.fromJSON([P, T], json),
|
|
1360
|
+
fromCoreObject: (obj) => RateLimiterExemption.fromCoreObject([P, T], obj),
|
|
1361
|
+
fetch: async (client, id) => RateLimiterExemption.fetch(client, [P, T], id),
|
|
195
1362
|
new: (fields) => {
|
|
196
|
-
return new
|
|
1363
|
+
return new RateLimiterExemption([extractType(P), extractType(T)], fields);
|
|
197
1364
|
},
|
|
198
|
-
kind:
|
|
1365
|
+
kind: 'StructClassReified',
|
|
199
1366
|
};
|
|
200
1367
|
}
|
|
201
1368
|
static get r() {
|
|
202
|
-
return
|
|
1369
|
+
return RateLimiterExemption.reified;
|
|
203
1370
|
}
|
|
204
|
-
static phantom() {
|
|
205
|
-
return phantom(
|
|
1371
|
+
static phantom(P, T) {
|
|
1372
|
+
return phantom(RateLimiterExemption.reified(P, T));
|
|
206
1373
|
}
|
|
207
1374
|
static get p() {
|
|
208
|
-
return
|
|
1375
|
+
return RateLimiterExemption.phantom;
|
|
209
1376
|
}
|
|
210
|
-
static
|
|
211
|
-
return bcs.struct(
|
|
212
|
-
|
|
213
|
-
.bytes(32)
|
|
214
|
-
.transform({
|
|
215
|
-
input: (val) => fromHex(val),
|
|
216
|
-
output: (val) => toHex(val),
|
|
217
|
-
}),
|
|
218
|
-
coin_type: TypeName.bcs,
|
|
219
|
-
reserve_id: bcs
|
|
220
|
-
.bytes(32)
|
|
221
|
-
.transform({
|
|
222
|
-
input: (val) => fromHex(val),
|
|
223
|
-
output: (val) => toHex(val),
|
|
224
|
-
}),
|
|
225
|
-
ctoken_amount: bcs.u64(),
|
|
226
|
-
liquidity_amount: bcs.u64(),
|
|
1377
|
+
static instantiateBcs() {
|
|
1378
|
+
return bcs.struct('RateLimiterExemption', {
|
|
1379
|
+
amount: bcs.u64(),
|
|
227
1380
|
});
|
|
228
1381
|
}
|
|
229
|
-
static
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
1382
|
+
static cachedBcs = null;
|
|
1383
|
+
static get bcs() {
|
|
1384
|
+
if (!RateLimiterExemption.cachedBcs) {
|
|
1385
|
+
RateLimiterExemption.cachedBcs = RateLimiterExemption.instantiateBcs();
|
|
1386
|
+
}
|
|
1387
|
+
return RateLimiterExemption.cachedBcs;
|
|
1388
|
+
}
|
|
1389
|
+
static fromFields(typeArgs, fields) {
|
|
1390
|
+
return RateLimiterExemption.reified(typeArgs[0], typeArgs[1]).new({
|
|
1391
|
+
amount: decodeFromFields('u64', fields.amount),
|
|
236
1392
|
});
|
|
237
1393
|
}
|
|
238
|
-
static fromFieldsWithTypes(item) {
|
|
239
|
-
if (!
|
|
240
|
-
throw new Error(
|
|
1394
|
+
static fromFieldsWithTypes(typeArgs, item) {
|
|
1395
|
+
if (!isRateLimiterExemption(item.type)) {
|
|
1396
|
+
throw new Error('not a RateLimiterExemption type');
|
|
241
1397
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
reserveId: decodeFromFieldsWithTypes("address", item.fields.reserve_id),
|
|
246
|
-
ctokenAmount: decodeFromFieldsWithTypes("u64", item.fields.ctoken_amount),
|
|
247
|
-
liquidityAmount: decodeFromFieldsWithTypes("u64", item.fields.liquidity_amount),
|
|
1398
|
+
assertFieldsWithTypesArgsMatch(item, typeArgs);
|
|
1399
|
+
return RateLimiterExemption.reified(typeArgs[0], typeArgs[1]).new({
|
|
1400
|
+
amount: decodeFromFieldsWithTypes('u64', item.fields.amount),
|
|
248
1401
|
});
|
|
249
1402
|
}
|
|
250
|
-
static fromBcs(data) {
|
|
251
|
-
return
|
|
1403
|
+
static fromBcs(typeArgs, data) {
|
|
1404
|
+
return RateLimiterExemption.fromFields(typeArgs, RateLimiterExemption.bcs.parse(data));
|
|
252
1405
|
}
|
|
253
1406
|
toJSONField() {
|
|
254
1407
|
return {
|
|
255
|
-
|
|
256
|
-
coinType: this.coinType.toJSONField(),
|
|
257
|
-
reserveId: this.reserveId,
|
|
258
|
-
ctokenAmount: this.ctokenAmount.toString(),
|
|
259
|
-
liquidityAmount: this.liquidityAmount.toString(),
|
|
1408
|
+
amount: this.amount.toString(),
|
|
260
1409
|
};
|
|
261
1410
|
}
|
|
262
1411
|
toJSON() {
|
|
263
|
-
return {
|
|
264
|
-
$typeName: this.$typeName,
|
|
265
|
-
$typeArgs: this.$typeArgs,
|
|
266
|
-
...this.toJSONField(),
|
|
267
|
-
};
|
|
1412
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
268
1413
|
}
|
|
269
|
-
static fromJSONField(field) {
|
|
270
|
-
return
|
|
271
|
-
|
|
272
|
-
coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
|
|
273
|
-
reserveId: decodeFromJSONField("address", field.reserveId),
|
|
274
|
-
ctokenAmount: decodeFromJSONField("u64", field.ctokenAmount),
|
|
275
|
-
liquidityAmount: decodeFromJSONField("u64", field.liquidityAmount),
|
|
1414
|
+
static fromJSONField(typeArgs, field) {
|
|
1415
|
+
return RateLimiterExemption.reified(typeArgs[0], typeArgs[1]).new({
|
|
1416
|
+
amount: decodeFromJSONField('u64', field.amount),
|
|
276
1417
|
});
|
|
277
1418
|
}
|
|
278
|
-
static fromJSON(json) {
|
|
279
|
-
if (json.$typeName !==
|
|
280
|
-
throw new Error(
|
|
1419
|
+
static fromJSON(typeArgs, json) {
|
|
1420
|
+
if (json.$typeName !== RateLimiterExemption.$typeName) {
|
|
1421
|
+
throw new Error(`not a RateLimiterExemption json object: expected '${RateLimiterExemption.$typeName}' but got '${json.$typeName}'`);
|
|
281
1422
|
}
|
|
282
|
-
|
|
1423
|
+
assertReifiedTypeArgsMatch(composeSuiType(RateLimiterExemption.$typeName, ...typeArgs.map(extractType)), json.$typeArgs, typeArgs);
|
|
1424
|
+
return RateLimiterExemption.fromJSONField(typeArgs, json);
|
|
283
1425
|
}
|
|
284
|
-
static
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
throw new Error(`object at id ${id} is not a RedeemEvent object`);
|
|
1426
|
+
static fromCoreObject(typeArgs, obj) {
|
|
1427
|
+
if (!isRateLimiterExemption(obj.type)) {
|
|
1428
|
+
throw new Error(`object at ${obj.objectId} is not a RateLimiterExemption object`);
|
|
288
1429
|
}
|
|
289
|
-
|
|
1430
|
+
const gotTypeArgs = parseTypeName(obj.type).typeArgs;
|
|
1431
|
+
if (gotTypeArgs.length !== 2) {
|
|
1432
|
+
throw new Error(`type argument mismatch: expected 2 type arguments but got '${gotTypeArgs.length}'`);
|
|
1433
|
+
}
|
|
1434
|
+
for (let i = 0; i < 2; i++) {
|
|
1435
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
1436
|
+
const expectedTypeArg = compressSuiType(extractType(typeArgs[i]));
|
|
1437
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
1438
|
+
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
return RateLimiterExemption.fromBcs(typeArgs, obj.content);
|
|
1442
|
+
}
|
|
1443
|
+
static async fetch(client, typeArgs, id) {
|
|
1444
|
+
const { object } = await client.core.getObject({
|
|
1445
|
+
objectId: id,
|
|
1446
|
+
include: { content: true },
|
|
1447
|
+
});
|
|
1448
|
+
if (!isRateLimiterExemption(object.type)) {
|
|
1449
|
+
throw new Error(`object at id ${id} is not a RateLimiterExemption object`);
|
|
1450
|
+
}
|
|
1451
|
+
const gotTypeArgs = parseTypeName(object.type).typeArgs;
|
|
1452
|
+
if (gotTypeArgs.length !== 2) {
|
|
1453
|
+
throw new Error(`type argument mismatch: expected 2 type arguments but got '${gotTypeArgs.length}'`);
|
|
1454
|
+
}
|
|
1455
|
+
for (let i = 0; i < 2; i++) {
|
|
1456
|
+
const gotTypeArg = compressSuiType(gotTypeArgs[i]);
|
|
1457
|
+
const expectedTypeArg = compressSuiType(extractType(typeArgs[i]));
|
|
1458
|
+
if (gotTypeArg !== expectedTypeArg) {
|
|
1459
|
+
throw new Error(`type argument mismatch at position ${i}: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
return RateLimiterExemption.fromBcs(typeArgs, object.content);
|
|
290
1463
|
}
|
|
291
1464
|
}
|
|
292
|
-
/* ==============================
|
|
293
|
-
export function
|
|
1465
|
+
/* ============================== MintEvent =============================== */
|
|
1466
|
+
export function isMintEvent(type) {
|
|
294
1467
|
type = compressSuiType(type);
|
|
295
|
-
return type
|
|
1468
|
+
return type
|
|
1469
|
+
=== `${getTypeOrigin('suilend', 'lending_market::MintEvent')}::lending_market::MintEvent`;
|
|
296
1470
|
}
|
|
297
|
-
export class
|
|
1471
|
+
export class MintEvent {
|
|
298
1472
|
__StructClass = true;
|
|
299
|
-
static $typeName
|
|
1473
|
+
static get $typeName() {
|
|
1474
|
+
return `${getTypeOrigin('suilend', 'lending_market::MintEvent')}::lending_market::MintEvent`;
|
|
1475
|
+
}
|
|
300
1476
|
static $numTypeParams = 0;
|
|
301
1477
|
static $isPhantom = [];
|
|
302
|
-
$typeName =
|
|
1478
|
+
$typeName = MintEvent.$typeName;
|
|
303
1479
|
$fullTypeName;
|
|
304
1480
|
$typeArgs;
|
|
305
|
-
$isPhantom =
|
|
1481
|
+
$isPhantom = MintEvent.$isPhantom;
|
|
306
1482
|
lendingMarketId;
|
|
307
1483
|
coinType;
|
|
308
1484
|
reserveId;
|
|
309
|
-
obligationId;
|
|
310
1485
|
liquidityAmount;
|
|
311
|
-
|
|
1486
|
+
ctokenAmount;
|
|
312
1487
|
constructor(typeArgs, fields) {
|
|
313
|
-
this.$fullTypeName = composeSuiType(
|
|
1488
|
+
this.$fullTypeName = composeSuiType(MintEvent.$typeName, ...typeArgs);
|
|
314
1489
|
this.$typeArgs = typeArgs;
|
|
315
1490
|
this.lendingMarketId = fields.lendingMarketId;
|
|
316
1491
|
this.coinType = fields.coinType;
|
|
317
1492
|
this.reserveId = fields.reserveId;
|
|
318
|
-
this.obligationId = fields.obligationId;
|
|
319
1493
|
this.liquidityAmount = fields.liquidityAmount;
|
|
320
|
-
this.
|
|
1494
|
+
this.ctokenAmount = fields.ctokenAmount;
|
|
321
1495
|
}
|
|
322
1496
|
static reified() {
|
|
1497
|
+
const reifiedBcs = MintEvent.bcs;
|
|
323
1498
|
return {
|
|
324
|
-
typeName
|
|
325
|
-
|
|
1499
|
+
get typeName() {
|
|
1500
|
+
return MintEvent.$typeName;
|
|
1501
|
+
},
|
|
1502
|
+
get fullTypeName() {
|
|
1503
|
+
return composeSuiType(MintEvent.$typeName, ...[]);
|
|
1504
|
+
},
|
|
326
1505
|
typeArgs: [],
|
|
327
|
-
isPhantom:
|
|
1506
|
+
isPhantom: MintEvent.$isPhantom,
|
|
328
1507
|
reifiedTypeArgs: [],
|
|
329
|
-
fromFields: (fields) =>
|
|
330
|
-
fromFieldsWithTypes: (item) =>
|
|
331
|
-
fromBcs: (data) =>
|
|
332
|
-
bcs:
|
|
333
|
-
fromJSONField: (field) =>
|
|
334
|
-
fromJSON: (json) =>
|
|
335
|
-
|
|
1508
|
+
fromFields: (fields) => MintEvent.fromFields(fields),
|
|
1509
|
+
fromFieldsWithTypes: (item) => MintEvent.fromFieldsWithTypes(item),
|
|
1510
|
+
fromBcs: (data) => MintEvent.fromFields(reifiedBcs.parse(data)),
|
|
1511
|
+
bcs: reifiedBcs,
|
|
1512
|
+
fromJSONField: (field) => MintEvent.fromJSONField(field),
|
|
1513
|
+
fromJSON: (json) => MintEvent.fromJSON(json),
|
|
1514
|
+
fromCoreObject: (obj) => MintEvent.fromCoreObject(obj),
|
|
1515
|
+
fetch: async (client, id) => MintEvent.fetch(client, id),
|
|
336
1516
|
new: (fields) => {
|
|
337
|
-
return new
|
|
1517
|
+
return new MintEvent([], fields);
|
|
338
1518
|
},
|
|
339
|
-
kind:
|
|
1519
|
+
kind: 'StructClassReified',
|
|
340
1520
|
};
|
|
341
1521
|
}
|
|
342
1522
|
static get r() {
|
|
343
|
-
return
|
|
1523
|
+
return MintEvent.reified();
|
|
344
1524
|
}
|
|
345
1525
|
static phantom() {
|
|
346
|
-
return phantom(
|
|
1526
|
+
return phantom(MintEvent.reified());
|
|
347
1527
|
}
|
|
348
1528
|
static get p() {
|
|
349
|
-
return
|
|
1529
|
+
return MintEvent.phantom();
|
|
350
1530
|
}
|
|
351
|
-
static
|
|
352
|
-
return bcs.struct(
|
|
353
|
-
lending_market_id: bcs
|
|
354
|
-
.bytes(32)
|
|
355
|
-
.transform({
|
|
1531
|
+
static instantiateBcs() {
|
|
1532
|
+
return bcs.struct('MintEvent', {
|
|
1533
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
356
1534
|
input: (val) => fromHex(val),
|
|
357
1535
|
output: (val) => toHex(val),
|
|
358
1536
|
}),
|
|
359
1537
|
coin_type: TypeName.bcs,
|
|
360
|
-
reserve_id: bcs
|
|
361
|
-
.bytes(32)
|
|
362
|
-
.transform({
|
|
363
|
-
input: (val) => fromHex(val),
|
|
364
|
-
output: (val) => toHex(val),
|
|
365
|
-
}),
|
|
366
|
-
obligation_id: bcs
|
|
367
|
-
.bytes(32)
|
|
368
|
-
.transform({
|
|
1538
|
+
reserve_id: bcs.bytes(32).transform({
|
|
369
1539
|
input: (val) => fromHex(val),
|
|
370
1540
|
output: (val) => toHex(val),
|
|
371
1541
|
}),
|
|
372
1542
|
liquidity_amount: bcs.u64(),
|
|
373
|
-
|
|
1543
|
+
ctoken_amount: bcs.u64(),
|
|
374
1544
|
});
|
|
375
1545
|
}
|
|
1546
|
+
static cachedBcs = null;
|
|
1547
|
+
static get bcs() {
|
|
1548
|
+
if (!MintEvent.cachedBcs) {
|
|
1549
|
+
MintEvent.cachedBcs = MintEvent.instantiateBcs();
|
|
1550
|
+
}
|
|
1551
|
+
return MintEvent.cachedBcs;
|
|
1552
|
+
}
|
|
376
1553
|
static fromFields(fields) {
|
|
377
|
-
return
|
|
378
|
-
lendingMarketId: decodeFromFields(
|
|
1554
|
+
return MintEvent.reified().new({
|
|
1555
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
379
1556
|
coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
|
|
380
|
-
reserveId: decodeFromFields(
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
originationFeeAmount: decodeFromFields("u64", fields.origination_fee_amount),
|
|
1557
|
+
reserveId: decodeFromFields('address', fields.reserve_id),
|
|
1558
|
+
liquidityAmount: decodeFromFields('u64', fields.liquidity_amount),
|
|
1559
|
+
ctokenAmount: decodeFromFields('u64', fields.ctoken_amount),
|
|
384
1560
|
});
|
|
385
1561
|
}
|
|
386
1562
|
static fromFieldsWithTypes(item) {
|
|
387
|
-
if (!
|
|
388
|
-
throw new Error(
|
|
1563
|
+
if (!isMintEvent(item.type)) {
|
|
1564
|
+
throw new Error('not a MintEvent type');
|
|
389
1565
|
}
|
|
390
|
-
return
|
|
391
|
-
lendingMarketId: decodeFromFieldsWithTypes(
|
|
1566
|
+
return MintEvent.reified().new({
|
|
1567
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
392
1568
|
coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
|
|
393
|
-
reserveId: decodeFromFieldsWithTypes(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
originationFeeAmount: decodeFromFieldsWithTypes("u64", item.fields.origination_fee_amount),
|
|
1569
|
+
reserveId: decodeFromFieldsWithTypes('address', item.fields.reserve_id),
|
|
1570
|
+
liquidityAmount: decodeFromFieldsWithTypes('u64', item.fields.liquidity_amount),
|
|
1571
|
+
ctokenAmount: decodeFromFieldsWithTypes('u64', item.fields.ctoken_amount),
|
|
397
1572
|
});
|
|
398
1573
|
}
|
|
399
1574
|
static fromBcs(data) {
|
|
400
|
-
return
|
|
1575
|
+
return MintEvent.fromFields(MintEvent.bcs.parse(data));
|
|
401
1576
|
}
|
|
402
1577
|
toJSONField() {
|
|
403
1578
|
return {
|
|
404
1579
|
lendingMarketId: this.lendingMarketId,
|
|
405
|
-
coinType: this.coinType
|
|
1580
|
+
coinType: this.coinType,
|
|
406
1581
|
reserveId: this.reserveId,
|
|
407
|
-
obligationId: this.obligationId,
|
|
408
1582
|
liquidityAmount: this.liquidityAmount.toString(),
|
|
409
|
-
|
|
1583
|
+
ctokenAmount: this.ctokenAmount.toString(),
|
|
410
1584
|
};
|
|
411
1585
|
}
|
|
412
1586
|
toJSON() {
|
|
413
|
-
return {
|
|
414
|
-
$typeName: this.$typeName,
|
|
415
|
-
$typeArgs: this.$typeArgs,
|
|
416
|
-
...this.toJSONField(),
|
|
417
|
-
};
|
|
1587
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
418
1588
|
}
|
|
419
1589
|
static fromJSONField(field) {
|
|
420
|
-
return
|
|
421
|
-
lendingMarketId: decodeFromJSONField(
|
|
1590
|
+
return MintEvent.reified().new({
|
|
1591
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
422
1592
|
coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
|
|
423
|
-
reserveId: decodeFromJSONField(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
originationFeeAmount: decodeFromJSONField("u64", field.originationFeeAmount),
|
|
1593
|
+
reserveId: decodeFromJSONField('address', field.reserveId),
|
|
1594
|
+
liquidityAmount: decodeFromJSONField('u64', field.liquidityAmount),
|
|
1595
|
+
ctokenAmount: decodeFromJSONField('u64', field.ctokenAmount),
|
|
427
1596
|
});
|
|
428
1597
|
}
|
|
429
1598
|
static fromJSON(json) {
|
|
430
|
-
if (json.$typeName !==
|
|
431
|
-
throw new Error(
|
|
1599
|
+
if (json.$typeName !== MintEvent.$typeName) {
|
|
1600
|
+
throw new Error(`not a MintEvent json object: expected '${MintEvent.$typeName}' but got '${json.$typeName}'`);
|
|
432
1601
|
}
|
|
433
|
-
return
|
|
1602
|
+
return MintEvent.fromJSONField(json);
|
|
1603
|
+
}
|
|
1604
|
+
static fromCoreObject(obj) {
|
|
1605
|
+
if (!isMintEvent(obj.type)) {
|
|
1606
|
+
throw new Error(`object at ${obj.objectId} is not a MintEvent object`);
|
|
1607
|
+
}
|
|
1608
|
+
return MintEvent.fromBcs(obj.content);
|
|
434
1609
|
}
|
|
435
1610
|
static async fetch(client, id) {
|
|
436
|
-
const { object } = await client.getObject({
|
|
437
|
-
|
|
438
|
-
|
|
1611
|
+
const { object } = await client.core.getObject({
|
|
1612
|
+
objectId: id,
|
|
1613
|
+
include: { content: true },
|
|
1614
|
+
});
|
|
1615
|
+
if (!isMintEvent(object.type)) {
|
|
1616
|
+
throw new Error(`object at id ${id} is not a MintEvent object`);
|
|
439
1617
|
}
|
|
440
|
-
return
|
|
1618
|
+
return MintEvent.fromBcs(object.content);
|
|
441
1619
|
}
|
|
442
1620
|
}
|
|
443
|
-
/* ==============================
|
|
444
|
-
export function
|
|
1621
|
+
/* ============================== RedeemEvent =============================== */
|
|
1622
|
+
export function isRedeemEvent(type) {
|
|
445
1623
|
type = compressSuiType(type);
|
|
446
|
-
return type
|
|
1624
|
+
return type
|
|
1625
|
+
=== `${getTypeOrigin('suilend', 'lending_market::RedeemEvent')}::lending_market::RedeemEvent`;
|
|
447
1626
|
}
|
|
448
|
-
export class
|
|
1627
|
+
export class RedeemEvent {
|
|
449
1628
|
__StructClass = true;
|
|
450
|
-
static $typeName
|
|
1629
|
+
static get $typeName() {
|
|
1630
|
+
return `${getTypeOrigin('suilend', 'lending_market::RedeemEvent')}::lending_market::RedeemEvent`;
|
|
1631
|
+
}
|
|
451
1632
|
static $numTypeParams = 0;
|
|
452
1633
|
static $isPhantom = [];
|
|
453
|
-
$typeName =
|
|
1634
|
+
$typeName = RedeemEvent.$typeName;
|
|
454
1635
|
$fullTypeName;
|
|
455
1636
|
$typeArgs;
|
|
456
|
-
$isPhantom =
|
|
1637
|
+
$isPhantom = RedeemEvent.$isPhantom;
|
|
457
1638
|
lendingMarketId;
|
|
458
|
-
reserveId;
|
|
459
|
-
obligationId;
|
|
460
|
-
isDepositReward;
|
|
461
|
-
poolRewardId;
|
|
462
1639
|
coinType;
|
|
1640
|
+
reserveId;
|
|
1641
|
+
ctokenAmount;
|
|
463
1642
|
liquidityAmount;
|
|
464
1643
|
constructor(typeArgs, fields) {
|
|
465
|
-
this.$fullTypeName = composeSuiType(
|
|
1644
|
+
this.$fullTypeName = composeSuiType(RedeemEvent.$typeName, ...typeArgs);
|
|
466
1645
|
this.$typeArgs = typeArgs;
|
|
467
1646
|
this.lendingMarketId = fields.lendingMarketId;
|
|
468
|
-
this.reserveId = fields.reserveId;
|
|
469
|
-
this.obligationId = fields.obligationId;
|
|
470
|
-
this.isDepositReward = fields.isDepositReward;
|
|
471
|
-
this.poolRewardId = fields.poolRewardId;
|
|
472
1647
|
this.coinType = fields.coinType;
|
|
1648
|
+
this.reserveId = fields.reserveId;
|
|
1649
|
+
this.ctokenAmount = fields.ctokenAmount;
|
|
473
1650
|
this.liquidityAmount = fields.liquidityAmount;
|
|
474
1651
|
}
|
|
475
1652
|
static reified() {
|
|
1653
|
+
const reifiedBcs = RedeemEvent.bcs;
|
|
476
1654
|
return {
|
|
477
|
-
typeName
|
|
478
|
-
|
|
1655
|
+
get typeName() {
|
|
1656
|
+
return RedeemEvent.$typeName;
|
|
1657
|
+
},
|
|
1658
|
+
get fullTypeName() {
|
|
1659
|
+
return composeSuiType(RedeemEvent.$typeName, ...[]);
|
|
1660
|
+
},
|
|
479
1661
|
typeArgs: [],
|
|
480
|
-
isPhantom:
|
|
1662
|
+
isPhantom: RedeemEvent.$isPhantom,
|
|
481
1663
|
reifiedTypeArgs: [],
|
|
482
|
-
fromFields: (fields) =>
|
|
483
|
-
fromFieldsWithTypes: (item) =>
|
|
484
|
-
fromBcs: (data) =>
|
|
485
|
-
bcs:
|
|
486
|
-
fromJSONField: (field) =>
|
|
487
|
-
fromJSON: (json) =>
|
|
488
|
-
|
|
1664
|
+
fromFields: (fields) => RedeemEvent.fromFields(fields),
|
|
1665
|
+
fromFieldsWithTypes: (item) => RedeemEvent.fromFieldsWithTypes(item),
|
|
1666
|
+
fromBcs: (data) => RedeemEvent.fromFields(reifiedBcs.parse(data)),
|
|
1667
|
+
bcs: reifiedBcs,
|
|
1668
|
+
fromJSONField: (field) => RedeemEvent.fromJSONField(field),
|
|
1669
|
+
fromJSON: (json) => RedeemEvent.fromJSON(json),
|
|
1670
|
+
fromCoreObject: (obj) => RedeemEvent.fromCoreObject(obj),
|
|
1671
|
+
fetch: async (client, id) => RedeemEvent.fetch(client, id),
|
|
489
1672
|
new: (fields) => {
|
|
490
|
-
return new
|
|
1673
|
+
return new RedeemEvent([], fields);
|
|
491
1674
|
},
|
|
492
|
-
kind:
|
|
1675
|
+
kind: 'StructClassReified',
|
|
493
1676
|
};
|
|
494
1677
|
}
|
|
495
1678
|
static get r() {
|
|
496
|
-
return
|
|
1679
|
+
return RedeemEvent.reified();
|
|
497
1680
|
}
|
|
498
1681
|
static phantom() {
|
|
499
|
-
return phantom(
|
|
1682
|
+
return phantom(RedeemEvent.reified());
|
|
500
1683
|
}
|
|
501
1684
|
static get p() {
|
|
502
|
-
return
|
|
1685
|
+
return RedeemEvent.phantom();
|
|
503
1686
|
}
|
|
504
|
-
static
|
|
505
|
-
return bcs.struct(
|
|
506
|
-
lending_market_id: bcs
|
|
507
|
-
.bytes(32)
|
|
508
|
-
.transform({
|
|
509
|
-
input: (val) => fromHex(val),
|
|
510
|
-
output: (val) => toHex(val),
|
|
511
|
-
}),
|
|
512
|
-
reserve_id: bcs
|
|
513
|
-
.bytes(32)
|
|
514
|
-
.transform({
|
|
515
|
-
input: (val) => fromHex(val),
|
|
516
|
-
output: (val) => toHex(val),
|
|
517
|
-
}),
|
|
518
|
-
obligation_id: bcs
|
|
519
|
-
.bytes(32)
|
|
520
|
-
.transform({
|
|
1687
|
+
static instantiateBcs() {
|
|
1688
|
+
return bcs.struct('RedeemEvent', {
|
|
1689
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
521
1690
|
input: (val) => fromHex(val),
|
|
522
1691
|
output: (val) => toHex(val),
|
|
523
1692
|
}),
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
.bytes(32)
|
|
527
|
-
.transform({
|
|
1693
|
+
coin_type: TypeName.bcs,
|
|
1694
|
+
reserve_id: bcs.bytes(32).transform({
|
|
528
1695
|
input: (val) => fromHex(val),
|
|
529
1696
|
output: (val) => toHex(val),
|
|
530
1697
|
}),
|
|
531
|
-
|
|
1698
|
+
ctoken_amount: bcs.u64(),
|
|
532
1699
|
liquidity_amount: bcs.u64(),
|
|
533
1700
|
});
|
|
534
1701
|
}
|
|
1702
|
+
static cachedBcs = null;
|
|
1703
|
+
static get bcs() {
|
|
1704
|
+
if (!RedeemEvent.cachedBcs) {
|
|
1705
|
+
RedeemEvent.cachedBcs = RedeemEvent.instantiateBcs();
|
|
1706
|
+
}
|
|
1707
|
+
return RedeemEvent.cachedBcs;
|
|
1708
|
+
}
|
|
535
1709
|
static fromFields(fields) {
|
|
536
|
-
return
|
|
537
|
-
lendingMarketId: decodeFromFields(
|
|
538
|
-
reserveId: decodeFromFields("address", fields.reserve_id),
|
|
539
|
-
obligationId: decodeFromFields("address", fields.obligation_id),
|
|
540
|
-
isDepositReward: decodeFromFields("bool", fields.is_deposit_reward),
|
|
541
|
-
poolRewardId: decodeFromFields("address", fields.pool_reward_id),
|
|
1710
|
+
return RedeemEvent.reified().new({
|
|
1711
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
542
1712
|
coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
|
|
543
|
-
|
|
1713
|
+
reserveId: decodeFromFields('address', fields.reserve_id),
|
|
1714
|
+
ctokenAmount: decodeFromFields('u64', fields.ctoken_amount),
|
|
1715
|
+
liquidityAmount: decodeFromFields('u64', fields.liquidity_amount),
|
|
544
1716
|
});
|
|
545
1717
|
}
|
|
546
1718
|
static fromFieldsWithTypes(item) {
|
|
547
|
-
if (!
|
|
548
|
-
throw new Error(
|
|
1719
|
+
if (!isRedeemEvent(item.type)) {
|
|
1720
|
+
throw new Error('not a RedeemEvent type');
|
|
549
1721
|
}
|
|
550
|
-
return
|
|
551
|
-
lendingMarketId: decodeFromFieldsWithTypes(
|
|
552
|
-
reserveId: decodeFromFieldsWithTypes("address", item.fields.reserve_id),
|
|
553
|
-
obligationId: decodeFromFieldsWithTypes("address", item.fields.obligation_id),
|
|
554
|
-
isDepositReward: decodeFromFieldsWithTypes("bool", item.fields.is_deposit_reward),
|
|
555
|
-
poolRewardId: decodeFromFieldsWithTypes("address", item.fields.pool_reward_id),
|
|
1722
|
+
return RedeemEvent.reified().new({
|
|
1723
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
556
1724
|
coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
|
|
557
|
-
|
|
1725
|
+
reserveId: decodeFromFieldsWithTypes('address', item.fields.reserve_id),
|
|
1726
|
+
ctokenAmount: decodeFromFieldsWithTypes('u64', item.fields.ctoken_amount),
|
|
1727
|
+
liquidityAmount: decodeFromFieldsWithTypes('u64', item.fields.liquidity_amount),
|
|
558
1728
|
});
|
|
559
1729
|
}
|
|
560
1730
|
static fromBcs(data) {
|
|
561
|
-
return
|
|
1731
|
+
return RedeemEvent.fromFields(RedeemEvent.bcs.parse(data));
|
|
562
1732
|
}
|
|
563
1733
|
toJSONField() {
|
|
564
1734
|
return {
|
|
565
1735
|
lendingMarketId: this.lendingMarketId,
|
|
1736
|
+
coinType: this.coinType,
|
|
566
1737
|
reserveId: this.reserveId,
|
|
567
|
-
|
|
568
|
-
isDepositReward: this.isDepositReward,
|
|
569
|
-
poolRewardId: this.poolRewardId,
|
|
570
|
-
coinType: this.coinType.toJSONField(),
|
|
1738
|
+
ctokenAmount: this.ctokenAmount.toString(),
|
|
571
1739
|
liquidityAmount: this.liquidityAmount.toString(),
|
|
572
1740
|
};
|
|
573
1741
|
}
|
|
574
1742
|
toJSON() {
|
|
575
|
-
return {
|
|
576
|
-
$typeName: this.$typeName,
|
|
577
|
-
$typeArgs: this.$typeArgs,
|
|
578
|
-
...this.toJSONField(),
|
|
579
|
-
};
|
|
1743
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
580
1744
|
}
|
|
581
1745
|
static fromJSONField(field) {
|
|
582
|
-
return
|
|
583
|
-
lendingMarketId: decodeFromJSONField(
|
|
584
|
-
reserveId: decodeFromJSONField("address", field.reserveId),
|
|
585
|
-
obligationId: decodeFromJSONField("address", field.obligationId),
|
|
586
|
-
isDepositReward: decodeFromJSONField("bool", field.isDepositReward),
|
|
587
|
-
poolRewardId: decodeFromJSONField("address", field.poolRewardId),
|
|
1746
|
+
return RedeemEvent.reified().new({
|
|
1747
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
588
1748
|
coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
|
|
589
|
-
|
|
1749
|
+
reserveId: decodeFromJSONField('address', field.reserveId),
|
|
1750
|
+
ctokenAmount: decodeFromJSONField('u64', field.ctokenAmount),
|
|
1751
|
+
liquidityAmount: decodeFromJSONField('u64', field.liquidityAmount),
|
|
590
1752
|
});
|
|
591
1753
|
}
|
|
592
1754
|
static fromJSON(json) {
|
|
593
|
-
if (json.$typeName !==
|
|
594
|
-
throw new Error(
|
|
1755
|
+
if (json.$typeName !== RedeemEvent.$typeName) {
|
|
1756
|
+
throw new Error(`not a RedeemEvent json object: expected '${RedeemEvent.$typeName}' but got '${json.$typeName}'`);
|
|
595
1757
|
}
|
|
596
|
-
return
|
|
1758
|
+
return RedeemEvent.fromJSONField(json);
|
|
1759
|
+
}
|
|
1760
|
+
static fromCoreObject(obj) {
|
|
1761
|
+
if (!isRedeemEvent(obj.type)) {
|
|
1762
|
+
throw new Error(`object at ${obj.objectId} is not a RedeemEvent object`);
|
|
1763
|
+
}
|
|
1764
|
+
return RedeemEvent.fromBcs(obj.content);
|
|
597
1765
|
}
|
|
598
1766
|
static async fetch(client, id) {
|
|
599
|
-
const { object } = await client.getObject({
|
|
600
|
-
|
|
601
|
-
|
|
1767
|
+
const { object } = await client.core.getObject({
|
|
1768
|
+
objectId: id,
|
|
1769
|
+
include: { content: true },
|
|
1770
|
+
});
|
|
1771
|
+
if (!isRedeemEvent(object.type)) {
|
|
1772
|
+
throw new Error(`object at id ${id} is not a RedeemEvent object`);
|
|
602
1773
|
}
|
|
603
|
-
return
|
|
1774
|
+
return RedeemEvent.fromBcs(object.content);
|
|
604
1775
|
}
|
|
605
1776
|
}
|
|
606
1777
|
/* ============================== DepositEvent =============================== */
|
|
607
1778
|
export function isDepositEvent(type) {
|
|
608
1779
|
type = compressSuiType(type);
|
|
609
|
-
return type
|
|
1780
|
+
return type
|
|
1781
|
+
=== `${getTypeOrigin('suilend', 'lending_market::DepositEvent')}::lending_market::DepositEvent`;
|
|
610
1782
|
}
|
|
611
1783
|
export class DepositEvent {
|
|
612
1784
|
__StructClass = true;
|
|
613
|
-
static $typeName
|
|
1785
|
+
static get $typeName() {
|
|
1786
|
+
return `${getTypeOrigin('suilend', 'lending_market::DepositEvent')}::lending_market::DepositEvent`;
|
|
1787
|
+
}
|
|
614
1788
|
static $numTypeParams = 0;
|
|
615
1789
|
static $isPhantom = [];
|
|
616
1790
|
$typeName = DepositEvent.$typeName;
|
|
@@ -632,23 +1806,29 @@ export class DepositEvent {
|
|
|
632
1806
|
this.ctokenAmount = fields.ctokenAmount;
|
|
633
1807
|
}
|
|
634
1808
|
static reified() {
|
|
1809
|
+
const reifiedBcs = DepositEvent.bcs;
|
|
635
1810
|
return {
|
|
636
|
-
typeName
|
|
637
|
-
|
|
1811
|
+
get typeName() {
|
|
1812
|
+
return DepositEvent.$typeName;
|
|
1813
|
+
},
|
|
1814
|
+
get fullTypeName() {
|
|
1815
|
+
return composeSuiType(DepositEvent.$typeName, ...[]);
|
|
1816
|
+
},
|
|
638
1817
|
typeArgs: [],
|
|
639
1818
|
isPhantom: DepositEvent.$isPhantom,
|
|
640
1819
|
reifiedTypeArgs: [],
|
|
641
1820
|
fromFields: (fields) => DepositEvent.fromFields(fields),
|
|
642
1821
|
fromFieldsWithTypes: (item) => DepositEvent.fromFieldsWithTypes(item),
|
|
643
|
-
fromBcs: (data) => DepositEvent.
|
|
644
|
-
bcs:
|
|
1822
|
+
fromBcs: (data) => DepositEvent.fromFields(reifiedBcs.parse(data)),
|
|
1823
|
+
bcs: reifiedBcs,
|
|
645
1824
|
fromJSONField: (field) => DepositEvent.fromJSONField(field),
|
|
646
1825
|
fromJSON: (json) => DepositEvent.fromJSON(json),
|
|
1826
|
+
fromCoreObject: (obj) => DepositEvent.fromCoreObject(obj),
|
|
647
1827
|
fetch: async (client, id) => DepositEvent.fetch(client, id),
|
|
648
1828
|
new: (fields) => {
|
|
649
1829
|
return new DepositEvent([], fields);
|
|
650
1830
|
},
|
|
651
|
-
kind:
|
|
1831
|
+
kind: 'StructClassReified',
|
|
652
1832
|
};
|
|
653
1833
|
}
|
|
654
1834
|
static get r() {
|
|
@@ -660,49 +1840,50 @@ export class DepositEvent {
|
|
|
660
1840
|
static get p() {
|
|
661
1841
|
return DepositEvent.phantom();
|
|
662
1842
|
}
|
|
663
|
-
static
|
|
664
|
-
return bcs.struct(
|
|
665
|
-
lending_market_id: bcs
|
|
666
|
-
.bytes(32)
|
|
667
|
-
.transform({
|
|
1843
|
+
static instantiateBcs() {
|
|
1844
|
+
return bcs.struct('DepositEvent', {
|
|
1845
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
668
1846
|
input: (val) => fromHex(val),
|
|
669
1847
|
output: (val) => toHex(val),
|
|
670
1848
|
}),
|
|
671
1849
|
coin_type: TypeName.bcs,
|
|
672
|
-
reserve_id: bcs
|
|
673
|
-
.bytes(32)
|
|
674
|
-
.transform({
|
|
1850
|
+
reserve_id: bcs.bytes(32).transform({
|
|
675
1851
|
input: (val) => fromHex(val),
|
|
676
1852
|
output: (val) => toHex(val),
|
|
677
1853
|
}),
|
|
678
|
-
obligation_id: bcs
|
|
679
|
-
.bytes(32)
|
|
680
|
-
.transform({
|
|
1854
|
+
obligation_id: bcs.bytes(32).transform({
|
|
681
1855
|
input: (val) => fromHex(val),
|
|
682
1856
|
output: (val) => toHex(val),
|
|
683
1857
|
}),
|
|
684
1858
|
ctoken_amount: bcs.u64(),
|
|
685
1859
|
});
|
|
686
1860
|
}
|
|
1861
|
+
static cachedBcs = null;
|
|
1862
|
+
static get bcs() {
|
|
1863
|
+
if (!DepositEvent.cachedBcs) {
|
|
1864
|
+
DepositEvent.cachedBcs = DepositEvent.instantiateBcs();
|
|
1865
|
+
}
|
|
1866
|
+
return DepositEvent.cachedBcs;
|
|
1867
|
+
}
|
|
687
1868
|
static fromFields(fields) {
|
|
688
1869
|
return DepositEvent.reified().new({
|
|
689
|
-
lendingMarketId: decodeFromFields(
|
|
1870
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
690
1871
|
coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
|
|
691
|
-
reserveId: decodeFromFields(
|
|
692
|
-
obligationId: decodeFromFields(
|
|
693
|
-
ctokenAmount: decodeFromFields(
|
|
1872
|
+
reserveId: decodeFromFields('address', fields.reserve_id),
|
|
1873
|
+
obligationId: decodeFromFields('address', fields.obligation_id),
|
|
1874
|
+
ctokenAmount: decodeFromFields('u64', fields.ctoken_amount),
|
|
694
1875
|
});
|
|
695
1876
|
}
|
|
696
1877
|
static fromFieldsWithTypes(item) {
|
|
697
1878
|
if (!isDepositEvent(item.type)) {
|
|
698
|
-
throw new Error(
|
|
1879
|
+
throw new Error('not a DepositEvent type');
|
|
699
1880
|
}
|
|
700
1881
|
return DepositEvent.reified().new({
|
|
701
|
-
lendingMarketId: decodeFromFieldsWithTypes(
|
|
1882
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
702
1883
|
coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
|
|
703
|
-
reserveId: decodeFromFieldsWithTypes(
|
|
704
|
-
obligationId: decodeFromFieldsWithTypes(
|
|
705
|
-
ctokenAmount: decodeFromFieldsWithTypes(
|
|
1884
|
+
reserveId: decodeFromFieldsWithTypes('address', item.fields.reserve_id),
|
|
1885
|
+
obligationId: decodeFromFieldsWithTypes('address', item.fields.obligation_id),
|
|
1886
|
+
ctokenAmount: decodeFromFieldsWithTypes('u64', item.fields.ctoken_amount),
|
|
706
1887
|
});
|
|
707
1888
|
}
|
|
708
1889
|
static fromBcs(data) {
|
|
@@ -711,783 +1892,701 @@ export class DepositEvent {
|
|
|
711
1892
|
toJSONField() {
|
|
712
1893
|
return {
|
|
713
1894
|
lendingMarketId: this.lendingMarketId,
|
|
714
|
-
coinType: this.coinType
|
|
1895
|
+
coinType: this.coinType,
|
|
715
1896
|
reserveId: this.reserveId,
|
|
716
1897
|
obligationId: this.obligationId,
|
|
717
1898
|
ctokenAmount: this.ctokenAmount.toString(),
|
|
718
1899
|
};
|
|
719
1900
|
}
|
|
720
1901
|
toJSON() {
|
|
721
|
-
return {
|
|
722
|
-
$typeName: this.$typeName,
|
|
723
|
-
$typeArgs: this.$typeArgs,
|
|
724
|
-
...this.toJSONField(),
|
|
725
|
-
};
|
|
1902
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
726
1903
|
}
|
|
727
1904
|
static fromJSONField(field) {
|
|
728
1905
|
return DepositEvent.reified().new({
|
|
729
|
-
lendingMarketId: decodeFromJSONField(
|
|
1906
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
730
1907
|
coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
|
|
731
|
-
reserveId: decodeFromJSONField(
|
|
732
|
-
obligationId: decodeFromJSONField(
|
|
733
|
-
ctokenAmount: decodeFromJSONField(
|
|
1908
|
+
reserveId: decodeFromJSONField('address', field.reserveId),
|
|
1909
|
+
obligationId: decodeFromJSONField('address', field.obligationId),
|
|
1910
|
+
ctokenAmount: decodeFromJSONField('u64', field.ctokenAmount),
|
|
734
1911
|
});
|
|
735
1912
|
}
|
|
736
1913
|
static fromJSON(json) {
|
|
737
1914
|
if (json.$typeName !== DepositEvent.$typeName) {
|
|
738
|
-
throw new Error(
|
|
1915
|
+
throw new Error(`not a DepositEvent json object: expected '${DepositEvent.$typeName}' but got '${json.$typeName}'`);
|
|
739
1916
|
}
|
|
740
1917
|
return DepositEvent.fromJSONField(json);
|
|
741
1918
|
}
|
|
1919
|
+
static fromCoreObject(obj) {
|
|
1920
|
+
if (!isDepositEvent(obj.type)) {
|
|
1921
|
+
throw new Error(`object at ${obj.objectId} is not a DepositEvent object`);
|
|
1922
|
+
}
|
|
1923
|
+
return DepositEvent.fromBcs(obj.content);
|
|
1924
|
+
}
|
|
742
1925
|
static async fetch(client, id) {
|
|
743
|
-
const { object } = await client.getObject({
|
|
1926
|
+
const { object } = await client.core.getObject({
|
|
1927
|
+
objectId: id,
|
|
1928
|
+
include: { content: true },
|
|
1929
|
+
});
|
|
744
1930
|
if (!isDepositEvent(object.type)) {
|
|
745
1931
|
throw new Error(`object at id ${id} is not a DepositEvent object`);
|
|
746
1932
|
}
|
|
747
1933
|
return DepositEvent.fromBcs(object.content);
|
|
748
1934
|
}
|
|
749
1935
|
}
|
|
750
|
-
/* ==============================
|
|
751
|
-
export function
|
|
752
|
-
type = compressSuiType(type);
|
|
753
|
-
return type === `${PKG_V10}::lending_market::FeeReceivers`;
|
|
754
|
-
}
|
|
755
|
-
export class FeeReceivers {
|
|
756
|
-
__StructClass = true;
|
|
757
|
-
static $typeName = `${PKG_V10}::lending_market::FeeReceivers`;
|
|
758
|
-
static $numTypeParams = 0;
|
|
759
|
-
static $isPhantom = [];
|
|
760
|
-
$typeName = FeeReceivers.$typeName;
|
|
761
|
-
$fullTypeName;
|
|
762
|
-
$typeArgs;
|
|
763
|
-
$isPhantom = FeeReceivers.$isPhantom;
|
|
764
|
-
receivers;
|
|
765
|
-
weights;
|
|
766
|
-
totalWeight;
|
|
767
|
-
constructor(typeArgs, fields) {
|
|
768
|
-
this.$fullTypeName = composeSuiType(FeeReceivers.$typeName, ...typeArgs);
|
|
769
|
-
this.$typeArgs = typeArgs;
|
|
770
|
-
this.receivers = fields.receivers;
|
|
771
|
-
this.weights = fields.weights;
|
|
772
|
-
this.totalWeight = fields.totalWeight;
|
|
773
|
-
}
|
|
774
|
-
static reified() {
|
|
775
|
-
return {
|
|
776
|
-
typeName: FeeReceivers.$typeName,
|
|
777
|
-
fullTypeName: composeSuiType(FeeReceivers.$typeName, ...[]),
|
|
778
|
-
typeArgs: [],
|
|
779
|
-
isPhantom: FeeReceivers.$isPhantom,
|
|
780
|
-
reifiedTypeArgs: [],
|
|
781
|
-
fromFields: (fields) => FeeReceivers.fromFields(fields),
|
|
782
|
-
fromFieldsWithTypes: (item) => FeeReceivers.fromFieldsWithTypes(item),
|
|
783
|
-
fromBcs: (data) => FeeReceivers.fromBcs(data),
|
|
784
|
-
bcs: FeeReceivers.bcs,
|
|
785
|
-
fromJSONField: (field) => FeeReceivers.fromJSONField(field),
|
|
786
|
-
fromJSON: (json) => FeeReceivers.fromJSON(json),
|
|
787
|
-
fetch: async (client, id) => FeeReceivers.fetch(client, id),
|
|
788
|
-
new: (fields) => {
|
|
789
|
-
return new FeeReceivers([], fields);
|
|
790
|
-
},
|
|
791
|
-
kind: "StructClassReified",
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
static get r() {
|
|
795
|
-
return FeeReceivers.reified();
|
|
796
|
-
}
|
|
797
|
-
static phantom() {
|
|
798
|
-
return phantom(FeeReceivers.reified());
|
|
799
|
-
}
|
|
800
|
-
static get p() {
|
|
801
|
-
return FeeReceivers.phantom();
|
|
802
|
-
}
|
|
803
|
-
static get bcs() {
|
|
804
|
-
return bcs.struct("FeeReceivers", {
|
|
805
|
-
receivers: bcs.vector(bcs
|
|
806
|
-
.bytes(32)
|
|
807
|
-
.transform({
|
|
808
|
-
input: (val) => fromHex(val),
|
|
809
|
-
output: (val) => toHex(val),
|
|
810
|
-
})),
|
|
811
|
-
weights: bcs.vector(bcs.u64()),
|
|
812
|
-
total_weight: bcs.u64(),
|
|
813
|
-
});
|
|
814
|
-
}
|
|
815
|
-
static fromFields(fields) {
|
|
816
|
-
return FeeReceivers.reified().new({
|
|
817
|
-
receivers: decodeFromFields(reified.vector("address"), fields.receivers),
|
|
818
|
-
weights: decodeFromFields(reified.vector("u64"), fields.weights),
|
|
819
|
-
totalWeight: decodeFromFields("u64", fields.total_weight),
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
|
-
static fromFieldsWithTypes(item) {
|
|
823
|
-
if (!isFeeReceivers(item.type)) {
|
|
824
|
-
throw new Error("not a FeeReceivers type");
|
|
825
|
-
}
|
|
826
|
-
return FeeReceivers.reified().new({
|
|
827
|
-
receivers: decodeFromFieldsWithTypes(reified.vector("address"), item.fields.receivers),
|
|
828
|
-
weights: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.weights),
|
|
829
|
-
totalWeight: decodeFromFieldsWithTypes("u64", item.fields.total_weight),
|
|
830
|
-
});
|
|
831
|
-
}
|
|
832
|
-
static fromBcs(data) {
|
|
833
|
-
return FeeReceivers.fromFields(FeeReceivers.bcs.parse(data));
|
|
834
|
-
}
|
|
835
|
-
toJSONField() {
|
|
836
|
-
return {
|
|
837
|
-
receivers: fieldToJSON(`vector<address>`, this.receivers),
|
|
838
|
-
weights: fieldToJSON(`vector<u64>`, this.weights),
|
|
839
|
-
totalWeight: this.totalWeight.toString(),
|
|
840
|
-
};
|
|
841
|
-
}
|
|
842
|
-
toJSON() {
|
|
843
|
-
return {
|
|
844
|
-
$typeName: this.$typeName,
|
|
845
|
-
$typeArgs: this.$typeArgs,
|
|
846
|
-
...this.toJSONField(),
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
static fromJSONField(field) {
|
|
850
|
-
return FeeReceivers.reified().new({
|
|
851
|
-
receivers: decodeFromJSONField(reified.vector("address"), field.receivers),
|
|
852
|
-
weights: decodeFromJSONField(reified.vector("u64"), field.weights),
|
|
853
|
-
totalWeight: decodeFromJSONField("u64", field.totalWeight),
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
static fromJSON(json) {
|
|
857
|
-
if (json.$typeName !== FeeReceivers.$typeName) {
|
|
858
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
859
|
-
}
|
|
860
|
-
return FeeReceivers.fromJSONField(json);
|
|
861
|
-
}
|
|
862
|
-
static async fetch(client, id) {
|
|
863
|
-
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
864
|
-
if (!isFeeReceivers(object.type)) {
|
|
865
|
-
throw new Error(`object at id ${id} is not a FeeReceivers object`);
|
|
866
|
-
}
|
|
867
|
-
return FeeReceivers.fromBcs(object.content);
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
/* ============================== FeeReceiversKey =============================== */
|
|
871
|
-
export function isFeeReceiversKey(type) {
|
|
1936
|
+
/* ============================== WithdrawEvent =============================== */
|
|
1937
|
+
export function isWithdrawEvent(type) {
|
|
872
1938
|
type = compressSuiType(type);
|
|
873
|
-
return type
|
|
1939
|
+
return type
|
|
1940
|
+
=== `${getTypeOrigin('suilend', 'lending_market::WithdrawEvent')}::lending_market::WithdrawEvent`;
|
|
874
1941
|
}
|
|
875
|
-
export class
|
|
1942
|
+
export class WithdrawEvent {
|
|
876
1943
|
__StructClass = true;
|
|
877
|
-
static $typeName
|
|
878
|
-
|
|
879
|
-
static $isPhantom = [];
|
|
880
|
-
$typeName = FeeReceiversKey.$typeName;
|
|
881
|
-
$fullTypeName;
|
|
882
|
-
$typeArgs;
|
|
883
|
-
$isPhantom = FeeReceiversKey.$isPhantom;
|
|
884
|
-
dummyField;
|
|
885
|
-
constructor(typeArgs, fields) {
|
|
886
|
-
this.$fullTypeName = composeSuiType(FeeReceiversKey.$typeName, ...typeArgs);
|
|
887
|
-
this.$typeArgs = typeArgs;
|
|
888
|
-
this.dummyField = fields.dummyField;
|
|
889
|
-
}
|
|
890
|
-
static reified() {
|
|
891
|
-
return {
|
|
892
|
-
typeName: FeeReceiversKey.$typeName,
|
|
893
|
-
fullTypeName: composeSuiType(FeeReceiversKey.$typeName, ...[]),
|
|
894
|
-
typeArgs: [],
|
|
895
|
-
isPhantom: FeeReceiversKey.$isPhantom,
|
|
896
|
-
reifiedTypeArgs: [],
|
|
897
|
-
fromFields: (fields) => FeeReceiversKey.fromFields(fields),
|
|
898
|
-
fromFieldsWithTypes: (item) => FeeReceiversKey.fromFieldsWithTypes(item),
|
|
899
|
-
fromBcs: (data) => FeeReceiversKey.fromBcs(data),
|
|
900
|
-
bcs: FeeReceiversKey.bcs,
|
|
901
|
-
fromJSONField: (field) => FeeReceiversKey.fromJSONField(field),
|
|
902
|
-
fromJSON: (json) => FeeReceiversKey.fromJSON(json),
|
|
903
|
-
fetch: async (client, id) => FeeReceiversKey.fetch(client, id),
|
|
904
|
-
new: (fields) => {
|
|
905
|
-
return new FeeReceiversKey([], fields);
|
|
906
|
-
},
|
|
907
|
-
kind: "StructClassReified",
|
|
908
|
-
};
|
|
1944
|
+
static get $typeName() {
|
|
1945
|
+
return `${getTypeOrigin('suilend', 'lending_market::WithdrawEvent')}::lending_market::WithdrawEvent`;
|
|
909
1946
|
}
|
|
910
|
-
static get r() {
|
|
911
|
-
return FeeReceiversKey.reified();
|
|
912
|
-
}
|
|
913
|
-
static phantom() {
|
|
914
|
-
return phantom(FeeReceiversKey.reified());
|
|
915
|
-
}
|
|
916
|
-
static get p() {
|
|
917
|
-
return FeeReceiversKey.phantom();
|
|
918
|
-
}
|
|
919
|
-
static get bcs() {
|
|
920
|
-
return bcs.struct("FeeReceiversKey", {
|
|
921
|
-
dummy_field: bcs.bool(),
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
static fromFields(fields) {
|
|
925
|
-
return FeeReceiversKey.reified().new({
|
|
926
|
-
dummyField: decodeFromFields("bool", fields.dummy_field),
|
|
927
|
-
});
|
|
928
|
-
}
|
|
929
|
-
static fromFieldsWithTypes(item) {
|
|
930
|
-
if (!isFeeReceiversKey(item.type)) {
|
|
931
|
-
throw new Error("not a FeeReceiversKey type");
|
|
932
|
-
}
|
|
933
|
-
return FeeReceiversKey.reified().new({
|
|
934
|
-
dummyField: decodeFromFieldsWithTypes("bool", item.fields.dummy_field),
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
static fromBcs(data) {
|
|
938
|
-
return FeeReceiversKey.fromFields(FeeReceiversKey.bcs.parse(data));
|
|
939
|
-
}
|
|
940
|
-
toJSONField() {
|
|
941
|
-
return {
|
|
942
|
-
dummyField: this.dummyField,
|
|
943
|
-
};
|
|
944
|
-
}
|
|
945
|
-
toJSON() {
|
|
946
|
-
return {
|
|
947
|
-
$typeName: this.$typeName,
|
|
948
|
-
$typeArgs: this.$typeArgs,
|
|
949
|
-
...this.toJSONField(),
|
|
950
|
-
};
|
|
951
|
-
}
|
|
952
|
-
static fromJSONField(field) {
|
|
953
|
-
return FeeReceiversKey.reified().new({
|
|
954
|
-
dummyField: decodeFromJSONField("bool", field.dummyField),
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
static fromJSON(json) {
|
|
958
|
-
if (json.$typeName !== FeeReceiversKey.$typeName) {
|
|
959
|
-
throw new Error("not a WithTwoGenerics json object");
|
|
960
|
-
}
|
|
961
|
-
return FeeReceiversKey.fromJSONField(json);
|
|
962
|
-
}
|
|
963
|
-
static async fetch(client, id) {
|
|
964
|
-
const { object } = await client.getObject({ objectId: id, include: { content: true } });
|
|
965
|
-
if (!isFeeReceiversKey(object.type)) {
|
|
966
|
-
throw new Error(`object at id ${id} is not a FeeReceiversKey object`);
|
|
967
|
-
}
|
|
968
|
-
return FeeReceiversKey.fromBcs(object.content);
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
/* ============================== ForgiveEvent =============================== */
|
|
972
|
-
export function isForgiveEvent(type) {
|
|
973
|
-
type = compressSuiType(type);
|
|
974
|
-
return type === `${PKG_V1}::lending_market::ForgiveEvent`;
|
|
975
|
-
}
|
|
976
|
-
export class ForgiveEvent {
|
|
977
|
-
__StructClass = true;
|
|
978
|
-
static $typeName = `${PKG_V1}::lending_market::ForgiveEvent`;
|
|
979
1947
|
static $numTypeParams = 0;
|
|
980
1948
|
static $isPhantom = [];
|
|
981
|
-
$typeName =
|
|
1949
|
+
$typeName = WithdrawEvent.$typeName;
|
|
982
1950
|
$fullTypeName;
|
|
983
1951
|
$typeArgs;
|
|
984
|
-
$isPhantom =
|
|
1952
|
+
$isPhantom = WithdrawEvent.$isPhantom;
|
|
985
1953
|
lendingMarketId;
|
|
986
1954
|
coinType;
|
|
987
1955
|
reserveId;
|
|
988
1956
|
obligationId;
|
|
989
|
-
|
|
1957
|
+
ctokenAmount;
|
|
990
1958
|
constructor(typeArgs, fields) {
|
|
991
|
-
this.$fullTypeName = composeSuiType(
|
|
1959
|
+
this.$fullTypeName = composeSuiType(WithdrawEvent.$typeName, ...typeArgs);
|
|
992
1960
|
this.$typeArgs = typeArgs;
|
|
993
1961
|
this.lendingMarketId = fields.lendingMarketId;
|
|
994
1962
|
this.coinType = fields.coinType;
|
|
995
1963
|
this.reserveId = fields.reserveId;
|
|
996
1964
|
this.obligationId = fields.obligationId;
|
|
997
|
-
this.
|
|
1965
|
+
this.ctokenAmount = fields.ctokenAmount;
|
|
998
1966
|
}
|
|
999
1967
|
static reified() {
|
|
1968
|
+
const reifiedBcs = WithdrawEvent.bcs;
|
|
1000
1969
|
return {
|
|
1001
|
-
typeName
|
|
1002
|
-
|
|
1970
|
+
get typeName() {
|
|
1971
|
+
return WithdrawEvent.$typeName;
|
|
1972
|
+
},
|
|
1973
|
+
get fullTypeName() {
|
|
1974
|
+
return composeSuiType(WithdrawEvent.$typeName, ...[]);
|
|
1975
|
+
},
|
|
1003
1976
|
typeArgs: [],
|
|
1004
|
-
isPhantom:
|
|
1977
|
+
isPhantom: WithdrawEvent.$isPhantom,
|
|
1005
1978
|
reifiedTypeArgs: [],
|
|
1006
|
-
fromFields: (fields) =>
|
|
1007
|
-
fromFieldsWithTypes: (item) =>
|
|
1008
|
-
fromBcs: (data) =>
|
|
1009
|
-
bcs:
|
|
1010
|
-
fromJSONField: (field) =>
|
|
1011
|
-
fromJSON: (json) =>
|
|
1012
|
-
|
|
1979
|
+
fromFields: (fields) => WithdrawEvent.fromFields(fields),
|
|
1980
|
+
fromFieldsWithTypes: (item) => WithdrawEvent.fromFieldsWithTypes(item),
|
|
1981
|
+
fromBcs: (data) => WithdrawEvent.fromFields(reifiedBcs.parse(data)),
|
|
1982
|
+
bcs: reifiedBcs,
|
|
1983
|
+
fromJSONField: (field) => WithdrawEvent.fromJSONField(field),
|
|
1984
|
+
fromJSON: (json) => WithdrawEvent.fromJSON(json),
|
|
1985
|
+
fromCoreObject: (obj) => WithdrawEvent.fromCoreObject(obj),
|
|
1986
|
+
fetch: async (client, id) => WithdrawEvent.fetch(client, id),
|
|
1013
1987
|
new: (fields) => {
|
|
1014
|
-
return new
|
|
1988
|
+
return new WithdrawEvent([], fields);
|
|
1015
1989
|
},
|
|
1016
|
-
kind:
|
|
1990
|
+
kind: 'StructClassReified',
|
|
1017
1991
|
};
|
|
1018
1992
|
}
|
|
1019
1993
|
static get r() {
|
|
1020
|
-
return
|
|
1994
|
+
return WithdrawEvent.reified();
|
|
1021
1995
|
}
|
|
1022
1996
|
static phantom() {
|
|
1023
|
-
return phantom(
|
|
1997
|
+
return phantom(WithdrawEvent.reified());
|
|
1024
1998
|
}
|
|
1025
1999
|
static get p() {
|
|
1026
|
-
return
|
|
2000
|
+
return WithdrawEvent.phantom();
|
|
1027
2001
|
}
|
|
1028
|
-
static
|
|
1029
|
-
return bcs.struct(
|
|
1030
|
-
lending_market_id: bcs
|
|
1031
|
-
.bytes(32)
|
|
1032
|
-
.transform({
|
|
2002
|
+
static instantiateBcs() {
|
|
2003
|
+
return bcs.struct('WithdrawEvent', {
|
|
2004
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
1033
2005
|
input: (val) => fromHex(val),
|
|
1034
2006
|
output: (val) => toHex(val),
|
|
1035
2007
|
}),
|
|
1036
2008
|
coin_type: TypeName.bcs,
|
|
1037
|
-
reserve_id: bcs
|
|
1038
|
-
.bytes(32)
|
|
1039
|
-
.transform({
|
|
2009
|
+
reserve_id: bcs.bytes(32).transform({
|
|
1040
2010
|
input: (val) => fromHex(val),
|
|
1041
2011
|
output: (val) => toHex(val),
|
|
1042
2012
|
}),
|
|
1043
|
-
obligation_id: bcs
|
|
1044
|
-
.bytes(32)
|
|
1045
|
-
.transform({
|
|
2013
|
+
obligation_id: bcs.bytes(32).transform({
|
|
1046
2014
|
input: (val) => fromHex(val),
|
|
1047
2015
|
output: (val) => toHex(val),
|
|
1048
2016
|
}),
|
|
1049
|
-
|
|
2017
|
+
ctoken_amount: bcs.u64(),
|
|
1050
2018
|
});
|
|
1051
2019
|
}
|
|
2020
|
+
static cachedBcs = null;
|
|
2021
|
+
static get bcs() {
|
|
2022
|
+
if (!WithdrawEvent.cachedBcs) {
|
|
2023
|
+
WithdrawEvent.cachedBcs = WithdrawEvent.instantiateBcs();
|
|
2024
|
+
}
|
|
2025
|
+
return WithdrawEvent.cachedBcs;
|
|
2026
|
+
}
|
|
1052
2027
|
static fromFields(fields) {
|
|
1053
|
-
return
|
|
1054
|
-
lendingMarketId: decodeFromFields(
|
|
2028
|
+
return WithdrawEvent.reified().new({
|
|
2029
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
1055
2030
|
coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
|
|
1056
|
-
reserveId: decodeFromFields(
|
|
1057
|
-
obligationId: decodeFromFields(
|
|
1058
|
-
|
|
2031
|
+
reserveId: decodeFromFields('address', fields.reserve_id),
|
|
2032
|
+
obligationId: decodeFromFields('address', fields.obligation_id),
|
|
2033
|
+
ctokenAmount: decodeFromFields('u64', fields.ctoken_amount),
|
|
1059
2034
|
});
|
|
1060
2035
|
}
|
|
1061
2036
|
static fromFieldsWithTypes(item) {
|
|
1062
|
-
if (!
|
|
1063
|
-
throw new Error(
|
|
2037
|
+
if (!isWithdrawEvent(item.type)) {
|
|
2038
|
+
throw new Error('not a WithdrawEvent type');
|
|
1064
2039
|
}
|
|
1065
|
-
return
|
|
1066
|
-
lendingMarketId: decodeFromFieldsWithTypes(
|
|
2040
|
+
return WithdrawEvent.reified().new({
|
|
2041
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
1067
2042
|
coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
|
|
1068
|
-
reserveId: decodeFromFieldsWithTypes(
|
|
1069
|
-
obligationId: decodeFromFieldsWithTypes(
|
|
1070
|
-
|
|
2043
|
+
reserveId: decodeFromFieldsWithTypes('address', item.fields.reserve_id),
|
|
2044
|
+
obligationId: decodeFromFieldsWithTypes('address', item.fields.obligation_id),
|
|
2045
|
+
ctokenAmount: decodeFromFieldsWithTypes('u64', item.fields.ctoken_amount),
|
|
1071
2046
|
});
|
|
1072
2047
|
}
|
|
1073
2048
|
static fromBcs(data) {
|
|
1074
|
-
return
|
|
2049
|
+
return WithdrawEvent.fromFields(WithdrawEvent.bcs.parse(data));
|
|
1075
2050
|
}
|
|
1076
2051
|
toJSONField() {
|
|
1077
2052
|
return {
|
|
1078
2053
|
lendingMarketId: this.lendingMarketId,
|
|
1079
|
-
coinType: this.coinType
|
|
2054
|
+
coinType: this.coinType,
|
|
1080
2055
|
reserveId: this.reserveId,
|
|
1081
2056
|
obligationId: this.obligationId,
|
|
1082
|
-
|
|
2057
|
+
ctokenAmount: this.ctokenAmount.toString(),
|
|
1083
2058
|
};
|
|
1084
2059
|
}
|
|
1085
2060
|
toJSON() {
|
|
1086
|
-
return {
|
|
1087
|
-
$typeName: this.$typeName,
|
|
1088
|
-
$typeArgs: this.$typeArgs,
|
|
1089
|
-
...this.toJSONField(),
|
|
1090
|
-
};
|
|
2061
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
1091
2062
|
}
|
|
1092
2063
|
static fromJSONField(field) {
|
|
1093
|
-
return
|
|
1094
|
-
lendingMarketId: decodeFromJSONField(
|
|
2064
|
+
return WithdrawEvent.reified().new({
|
|
2065
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
1095
2066
|
coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
|
|
1096
|
-
reserveId: decodeFromJSONField(
|
|
1097
|
-
obligationId: decodeFromJSONField(
|
|
1098
|
-
|
|
2067
|
+
reserveId: decodeFromJSONField('address', field.reserveId),
|
|
2068
|
+
obligationId: decodeFromJSONField('address', field.obligationId),
|
|
2069
|
+
ctokenAmount: decodeFromJSONField('u64', field.ctokenAmount),
|
|
1099
2070
|
});
|
|
1100
2071
|
}
|
|
1101
2072
|
static fromJSON(json) {
|
|
1102
|
-
if (json.$typeName !==
|
|
1103
|
-
throw new Error(
|
|
2073
|
+
if (json.$typeName !== WithdrawEvent.$typeName) {
|
|
2074
|
+
throw new Error(`not a WithdrawEvent json object: expected '${WithdrawEvent.$typeName}' but got '${json.$typeName}'`);
|
|
1104
2075
|
}
|
|
1105
|
-
return
|
|
2076
|
+
return WithdrawEvent.fromJSONField(json);
|
|
2077
|
+
}
|
|
2078
|
+
static fromCoreObject(obj) {
|
|
2079
|
+
if (!isWithdrawEvent(obj.type)) {
|
|
2080
|
+
throw new Error(`object at ${obj.objectId} is not a WithdrawEvent object`);
|
|
2081
|
+
}
|
|
2082
|
+
return WithdrawEvent.fromBcs(obj.content);
|
|
1106
2083
|
}
|
|
1107
2084
|
static async fetch(client, id) {
|
|
1108
|
-
const { object } = await client.getObject({
|
|
1109
|
-
|
|
1110
|
-
|
|
2085
|
+
const { object } = await client.core.getObject({
|
|
2086
|
+
objectId: id,
|
|
2087
|
+
include: { content: true },
|
|
2088
|
+
});
|
|
2089
|
+
if (!isWithdrawEvent(object.type)) {
|
|
2090
|
+
throw new Error(`object at id ${id} is not a WithdrawEvent object`);
|
|
1111
2091
|
}
|
|
1112
|
-
return
|
|
2092
|
+
return WithdrawEvent.fromBcs(object.content);
|
|
1113
2093
|
}
|
|
1114
2094
|
}
|
|
1115
|
-
/* ==============================
|
|
1116
|
-
export function
|
|
2095
|
+
/* ============================== BorrowEvent =============================== */
|
|
2096
|
+
export function isBorrowEvent(type) {
|
|
1117
2097
|
type = compressSuiType(type);
|
|
1118
|
-
return type
|
|
2098
|
+
return type
|
|
2099
|
+
=== `${getTypeOrigin('suilend', 'lending_market::BorrowEvent')}::lending_market::BorrowEvent`;
|
|
1119
2100
|
}
|
|
1120
|
-
export class
|
|
2101
|
+
export class BorrowEvent {
|
|
1121
2102
|
__StructClass = true;
|
|
1122
|
-
static $typeName
|
|
2103
|
+
static get $typeName() {
|
|
2104
|
+
return `${getTypeOrigin('suilend', 'lending_market::BorrowEvent')}::lending_market::BorrowEvent`;
|
|
2105
|
+
}
|
|
1123
2106
|
static $numTypeParams = 0;
|
|
1124
2107
|
static $isPhantom = [];
|
|
1125
|
-
$typeName =
|
|
2108
|
+
$typeName = BorrowEvent.$typeName;
|
|
1126
2109
|
$fullTypeName;
|
|
1127
2110
|
$typeArgs;
|
|
1128
|
-
$isPhantom =
|
|
1129
|
-
|
|
2111
|
+
$isPhantom = BorrowEvent.$isPhantom;
|
|
2112
|
+
lendingMarketId;
|
|
2113
|
+
coinType;
|
|
2114
|
+
reserveId;
|
|
2115
|
+
obligationId;
|
|
2116
|
+
liquidityAmount;
|
|
2117
|
+
originationFeeAmount;
|
|
1130
2118
|
constructor(typeArgs, fields) {
|
|
1131
|
-
this.$fullTypeName = composeSuiType(
|
|
2119
|
+
this.$fullTypeName = composeSuiType(BorrowEvent.$typeName, ...typeArgs);
|
|
1132
2120
|
this.$typeArgs = typeArgs;
|
|
1133
|
-
this.
|
|
2121
|
+
this.lendingMarketId = fields.lendingMarketId;
|
|
2122
|
+
this.coinType = fields.coinType;
|
|
2123
|
+
this.reserveId = fields.reserveId;
|
|
2124
|
+
this.obligationId = fields.obligationId;
|
|
2125
|
+
this.liquidityAmount = fields.liquidityAmount;
|
|
2126
|
+
this.originationFeeAmount = fields.originationFeeAmount;
|
|
1134
2127
|
}
|
|
1135
2128
|
static reified() {
|
|
2129
|
+
const reifiedBcs = BorrowEvent.bcs;
|
|
1136
2130
|
return {
|
|
1137
|
-
typeName
|
|
1138
|
-
|
|
2131
|
+
get typeName() {
|
|
2132
|
+
return BorrowEvent.$typeName;
|
|
2133
|
+
},
|
|
2134
|
+
get fullTypeName() {
|
|
2135
|
+
return composeSuiType(BorrowEvent.$typeName, ...[]);
|
|
2136
|
+
},
|
|
1139
2137
|
typeArgs: [],
|
|
1140
|
-
isPhantom:
|
|
2138
|
+
isPhantom: BorrowEvent.$isPhantom,
|
|
1141
2139
|
reifiedTypeArgs: [],
|
|
1142
|
-
fromFields: (fields) =>
|
|
1143
|
-
fromFieldsWithTypes: (item) =>
|
|
1144
|
-
fromBcs: (data) =>
|
|
1145
|
-
bcs:
|
|
1146
|
-
fromJSONField: (field) =>
|
|
1147
|
-
fromJSON: (json) =>
|
|
1148
|
-
|
|
2140
|
+
fromFields: (fields) => BorrowEvent.fromFields(fields),
|
|
2141
|
+
fromFieldsWithTypes: (item) => BorrowEvent.fromFieldsWithTypes(item),
|
|
2142
|
+
fromBcs: (data) => BorrowEvent.fromFields(reifiedBcs.parse(data)),
|
|
2143
|
+
bcs: reifiedBcs,
|
|
2144
|
+
fromJSONField: (field) => BorrowEvent.fromJSONField(field),
|
|
2145
|
+
fromJSON: (json) => BorrowEvent.fromJSON(json),
|
|
2146
|
+
fromCoreObject: (obj) => BorrowEvent.fromCoreObject(obj),
|
|
2147
|
+
fetch: async (client, id) => BorrowEvent.fetch(client, id),
|
|
1149
2148
|
new: (fields) => {
|
|
1150
|
-
return new
|
|
2149
|
+
return new BorrowEvent([], fields);
|
|
1151
2150
|
},
|
|
1152
|
-
kind:
|
|
2151
|
+
kind: 'StructClassReified',
|
|
1153
2152
|
};
|
|
1154
2153
|
}
|
|
1155
2154
|
static get r() {
|
|
1156
|
-
return
|
|
2155
|
+
return BorrowEvent.reified();
|
|
1157
2156
|
}
|
|
1158
2157
|
static phantom() {
|
|
1159
|
-
return phantom(
|
|
2158
|
+
return phantom(BorrowEvent.reified());
|
|
1160
2159
|
}
|
|
1161
2160
|
static get p() {
|
|
1162
|
-
return
|
|
2161
|
+
return BorrowEvent.phantom();
|
|
1163
2162
|
}
|
|
1164
|
-
static
|
|
1165
|
-
return bcs.struct(
|
|
1166
|
-
|
|
2163
|
+
static instantiateBcs() {
|
|
2164
|
+
return bcs.struct('BorrowEvent', {
|
|
2165
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
2166
|
+
input: (val) => fromHex(val),
|
|
2167
|
+
output: (val) => toHex(val),
|
|
2168
|
+
}),
|
|
2169
|
+
coin_type: TypeName.bcs,
|
|
2170
|
+
reserve_id: bcs.bytes(32).transform({
|
|
2171
|
+
input: (val) => fromHex(val),
|
|
2172
|
+
output: (val) => toHex(val),
|
|
2173
|
+
}),
|
|
2174
|
+
obligation_id: bcs.bytes(32).transform({
|
|
2175
|
+
input: (val) => fromHex(val),
|
|
2176
|
+
output: (val) => toHex(val),
|
|
2177
|
+
}),
|
|
2178
|
+
liquidity_amount: bcs.u64(),
|
|
2179
|
+
origination_fee_amount: bcs.u64(),
|
|
1167
2180
|
});
|
|
1168
2181
|
}
|
|
2182
|
+
static cachedBcs = null;
|
|
2183
|
+
static get bcs() {
|
|
2184
|
+
if (!BorrowEvent.cachedBcs) {
|
|
2185
|
+
BorrowEvent.cachedBcs = BorrowEvent.instantiateBcs();
|
|
2186
|
+
}
|
|
2187
|
+
return BorrowEvent.cachedBcs;
|
|
2188
|
+
}
|
|
1169
2189
|
static fromFields(fields) {
|
|
1170
|
-
return
|
|
1171
|
-
|
|
2190
|
+
return BorrowEvent.reified().new({
|
|
2191
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
2192
|
+
coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
|
|
2193
|
+
reserveId: decodeFromFields('address', fields.reserve_id),
|
|
2194
|
+
obligationId: decodeFromFields('address', fields.obligation_id),
|
|
2195
|
+
liquidityAmount: decodeFromFields('u64', fields.liquidity_amount),
|
|
2196
|
+
originationFeeAmount: decodeFromFields('u64', fields.origination_fee_amount),
|
|
1172
2197
|
});
|
|
1173
2198
|
}
|
|
1174
2199
|
static fromFieldsWithTypes(item) {
|
|
1175
|
-
if (!
|
|
1176
|
-
throw new Error(
|
|
2200
|
+
if (!isBorrowEvent(item.type)) {
|
|
2201
|
+
throw new Error('not a BorrowEvent type');
|
|
1177
2202
|
}
|
|
1178
|
-
return
|
|
1179
|
-
|
|
2203
|
+
return BorrowEvent.reified().new({
|
|
2204
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
2205
|
+
coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
|
|
2206
|
+
reserveId: decodeFromFieldsWithTypes('address', item.fields.reserve_id),
|
|
2207
|
+
obligationId: decodeFromFieldsWithTypes('address', item.fields.obligation_id),
|
|
2208
|
+
liquidityAmount: decodeFromFieldsWithTypes('u64', item.fields.liquidity_amount),
|
|
2209
|
+
originationFeeAmount: decodeFromFieldsWithTypes('u64', item.fields.origination_fee_amount),
|
|
1180
2210
|
});
|
|
1181
2211
|
}
|
|
1182
2212
|
static fromBcs(data) {
|
|
1183
|
-
return
|
|
2213
|
+
return BorrowEvent.fromFields(BorrowEvent.bcs.parse(data));
|
|
1184
2214
|
}
|
|
1185
2215
|
toJSONField() {
|
|
1186
2216
|
return {
|
|
1187
|
-
|
|
2217
|
+
lendingMarketId: this.lendingMarketId,
|
|
2218
|
+
coinType: this.coinType,
|
|
2219
|
+
reserveId: this.reserveId,
|
|
2220
|
+
obligationId: this.obligationId,
|
|
2221
|
+
liquidityAmount: this.liquidityAmount.toString(),
|
|
2222
|
+
originationFeeAmount: this.originationFeeAmount.toString(),
|
|
1188
2223
|
};
|
|
1189
2224
|
}
|
|
1190
2225
|
toJSON() {
|
|
1191
|
-
return {
|
|
1192
|
-
$typeName: this.$typeName,
|
|
1193
|
-
$typeArgs: this.$typeArgs,
|
|
1194
|
-
...this.toJSONField(),
|
|
1195
|
-
};
|
|
2226
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
1196
2227
|
}
|
|
1197
2228
|
static fromJSONField(field) {
|
|
1198
|
-
return
|
|
1199
|
-
|
|
2229
|
+
return BorrowEvent.reified().new({
|
|
2230
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
2231
|
+
coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
|
|
2232
|
+
reserveId: decodeFromJSONField('address', field.reserveId),
|
|
2233
|
+
obligationId: decodeFromJSONField('address', field.obligationId),
|
|
2234
|
+
liquidityAmount: decodeFromJSONField('u64', field.liquidityAmount),
|
|
2235
|
+
originationFeeAmount: decodeFromJSONField('u64', field.originationFeeAmount),
|
|
1200
2236
|
});
|
|
1201
2237
|
}
|
|
1202
2238
|
static fromJSON(json) {
|
|
1203
|
-
if (json.$typeName !==
|
|
1204
|
-
throw new Error(
|
|
2239
|
+
if (json.$typeName !== BorrowEvent.$typeName) {
|
|
2240
|
+
throw new Error(`not a BorrowEvent json object: expected '${BorrowEvent.$typeName}' but got '${json.$typeName}'`);
|
|
1205
2241
|
}
|
|
1206
|
-
return
|
|
2242
|
+
return BorrowEvent.fromJSONField(json);
|
|
2243
|
+
}
|
|
2244
|
+
static fromCoreObject(obj) {
|
|
2245
|
+
if (!isBorrowEvent(obj.type)) {
|
|
2246
|
+
throw new Error(`object at ${obj.objectId} is not a BorrowEvent object`);
|
|
2247
|
+
}
|
|
2248
|
+
return BorrowEvent.fromBcs(obj.content);
|
|
1207
2249
|
}
|
|
1208
2250
|
static async fetch(client, id) {
|
|
1209
|
-
const { object } = await client.getObject({
|
|
1210
|
-
|
|
1211
|
-
|
|
2251
|
+
const { object } = await client.core.getObject({
|
|
2252
|
+
objectId: id,
|
|
2253
|
+
include: { content: true },
|
|
2254
|
+
});
|
|
2255
|
+
if (!isBorrowEvent(object.type)) {
|
|
2256
|
+
throw new Error(`object at id ${id} is not a BorrowEvent object`);
|
|
1212
2257
|
}
|
|
1213
|
-
return
|
|
2258
|
+
return BorrowEvent.fromBcs(object.content);
|
|
1214
2259
|
}
|
|
1215
2260
|
}
|
|
1216
|
-
/* ==============================
|
|
1217
|
-
export function
|
|
2261
|
+
/* ============================== RepayEvent =============================== */
|
|
2262
|
+
export function isRepayEvent(type) {
|
|
1218
2263
|
type = compressSuiType(type);
|
|
1219
|
-
return type
|
|
2264
|
+
return type
|
|
2265
|
+
=== `${getTypeOrigin('suilend', 'lending_market::RepayEvent')}::lending_market::RepayEvent`;
|
|
1220
2266
|
}
|
|
1221
|
-
export class
|
|
2267
|
+
export class RepayEvent {
|
|
1222
2268
|
__StructClass = true;
|
|
1223
|
-
static $typeName
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
$
|
|
2269
|
+
static get $typeName() {
|
|
2270
|
+
return `${getTypeOrigin('suilend', 'lending_market::RepayEvent')}::lending_market::RepayEvent`;
|
|
2271
|
+
}
|
|
2272
|
+
static $numTypeParams = 0;
|
|
2273
|
+
static $isPhantom = [];
|
|
2274
|
+
$typeName = RepayEvent.$typeName;
|
|
1227
2275
|
$fullTypeName;
|
|
1228
2276
|
$typeArgs;
|
|
1229
|
-
$isPhantom =
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
feeReceiver;
|
|
1236
|
-
badDebtUsd;
|
|
1237
|
-
badDebtLimitUsd;
|
|
2277
|
+
$isPhantom = RepayEvent.$isPhantom;
|
|
2278
|
+
lendingMarketId;
|
|
2279
|
+
coinType;
|
|
2280
|
+
reserveId;
|
|
2281
|
+
obligationId;
|
|
2282
|
+
liquidityAmount;
|
|
1238
2283
|
constructor(typeArgs, fields) {
|
|
1239
|
-
this.$fullTypeName = composeSuiType(
|
|
2284
|
+
this.$fullTypeName = composeSuiType(RepayEvent.$typeName, ...typeArgs);
|
|
1240
2285
|
this.$typeArgs = typeArgs;
|
|
1241
|
-
this.
|
|
1242
|
-
this.
|
|
1243
|
-
this.
|
|
1244
|
-
this.
|
|
1245
|
-
this.
|
|
1246
|
-
this.feeReceiver = fields.feeReceiver;
|
|
1247
|
-
this.badDebtUsd = fields.badDebtUsd;
|
|
1248
|
-
this.badDebtLimitUsd = fields.badDebtLimitUsd;
|
|
2286
|
+
this.lendingMarketId = fields.lendingMarketId;
|
|
2287
|
+
this.coinType = fields.coinType;
|
|
2288
|
+
this.reserveId = fields.reserveId;
|
|
2289
|
+
this.obligationId = fields.obligationId;
|
|
2290
|
+
this.liquidityAmount = fields.liquidityAmount;
|
|
1249
2291
|
}
|
|
1250
|
-
static reified(
|
|
2292
|
+
static reified() {
|
|
2293
|
+
const reifiedBcs = RepayEvent.bcs;
|
|
1251
2294
|
return {
|
|
1252
|
-
typeName
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
2295
|
+
get typeName() {
|
|
2296
|
+
return RepayEvent.$typeName;
|
|
2297
|
+
},
|
|
2298
|
+
get fullTypeName() {
|
|
2299
|
+
return composeSuiType(RepayEvent.$typeName, ...[]);
|
|
2300
|
+
},
|
|
2301
|
+
typeArgs: [],
|
|
2302
|
+
isPhantom: RepayEvent.$isPhantom,
|
|
2303
|
+
reifiedTypeArgs: [],
|
|
2304
|
+
fromFields: (fields) => RepayEvent.fromFields(fields),
|
|
2305
|
+
fromFieldsWithTypes: (item) => RepayEvent.fromFieldsWithTypes(item),
|
|
2306
|
+
fromBcs: (data) => RepayEvent.fromFields(reifiedBcs.parse(data)),
|
|
2307
|
+
bcs: reifiedBcs,
|
|
2308
|
+
fromJSONField: (field) => RepayEvent.fromJSONField(field),
|
|
2309
|
+
fromJSON: (json) => RepayEvent.fromJSON(json),
|
|
2310
|
+
fromCoreObject: (obj) => RepayEvent.fromCoreObject(obj),
|
|
2311
|
+
fetch: async (client, id) => RepayEvent.fetch(client, id),
|
|
1264
2312
|
new: (fields) => {
|
|
1265
|
-
return new
|
|
2313
|
+
return new RepayEvent([], fields);
|
|
1266
2314
|
},
|
|
1267
|
-
kind:
|
|
2315
|
+
kind: 'StructClassReified',
|
|
1268
2316
|
};
|
|
1269
2317
|
}
|
|
1270
2318
|
static get r() {
|
|
1271
|
-
return
|
|
2319
|
+
return RepayEvent.reified();
|
|
1272
2320
|
}
|
|
1273
|
-
static phantom(
|
|
1274
|
-
return phantom(
|
|
2321
|
+
static phantom() {
|
|
2322
|
+
return phantom(RepayEvent.reified());
|
|
1275
2323
|
}
|
|
1276
2324
|
static get p() {
|
|
1277
|
-
return
|
|
2325
|
+
return RepayEvent.phantom();
|
|
1278
2326
|
}
|
|
1279
|
-
static
|
|
1280
|
-
return bcs.struct(
|
|
1281
|
-
|
|
1282
|
-
version: bcs.u64(),
|
|
1283
|
-
reserves: bcs.vector(Reserve.bcs),
|
|
1284
|
-
obligations: ObjectTable.bcs,
|
|
1285
|
-
rate_limiter: RateLimiter.bcs,
|
|
1286
|
-
fee_receiver: bcs
|
|
1287
|
-
.bytes(32)
|
|
1288
|
-
.transform({
|
|
2327
|
+
static instantiateBcs() {
|
|
2328
|
+
return bcs.struct('RepayEvent', {
|
|
2329
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
1289
2330
|
input: (val) => fromHex(val),
|
|
1290
2331
|
output: (val) => toHex(val),
|
|
1291
2332
|
}),
|
|
1292
|
-
|
|
1293
|
-
|
|
2333
|
+
coin_type: TypeName.bcs,
|
|
2334
|
+
reserve_id: bcs.bytes(32).transform({
|
|
2335
|
+
input: (val) => fromHex(val),
|
|
2336
|
+
output: (val) => toHex(val),
|
|
2337
|
+
}),
|
|
2338
|
+
obligation_id: bcs.bytes(32).transform({
|
|
2339
|
+
input: (val) => fromHex(val),
|
|
2340
|
+
output: (val) => toHex(val),
|
|
2341
|
+
}),
|
|
2342
|
+
liquidity_amount: bcs.u64(),
|
|
1294
2343
|
});
|
|
1295
2344
|
}
|
|
1296
|
-
static
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
2345
|
+
static cachedBcs = null;
|
|
2346
|
+
static get bcs() {
|
|
2347
|
+
if (!RepayEvent.cachedBcs) {
|
|
2348
|
+
RepayEvent.cachedBcs = RepayEvent.instantiateBcs();
|
|
2349
|
+
}
|
|
2350
|
+
return RepayEvent.cachedBcs;
|
|
2351
|
+
}
|
|
2352
|
+
static fromFields(fields) {
|
|
2353
|
+
return RepayEvent.reified().new({
|
|
2354
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
2355
|
+
coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
|
|
2356
|
+
reserveId: decodeFromFields('address', fields.reserve_id),
|
|
2357
|
+
obligationId: decodeFromFields('address', fields.obligation_id),
|
|
2358
|
+
liquidityAmount: decodeFromFields('u64', fields.liquidity_amount),
|
|
1306
2359
|
});
|
|
1307
2360
|
}
|
|
1308
|
-
static fromFieldsWithTypes(
|
|
1309
|
-
if (!
|
|
1310
|
-
throw new Error(
|
|
2361
|
+
static fromFieldsWithTypes(item) {
|
|
2362
|
+
if (!isRepayEvent(item.type)) {
|
|
2363
|
+
throw new Error('not a RepayEvent type');
|
|
1311
2364
|
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
rateLimiter: decodeFromFieldsWithTypes(RateLimiter.reified(), item.fields.rate_limiter),
|
|
1319
|
-
feeReceiver: decodeFromFieldsWithTypes("address", item.fields.fee_receiver),
|
|
1320
|
-
badDebtUsd: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.bad_debt_usd),
|
|
1321
|
-
badDebtLimitUsd: decodeFromFieldsWithTypes(Decimal.reified(), item.fields.bad_debt_limit_usd),
|
|
2365
|
+
return RepayEvent.reified().new({
|
|
2366
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
2367
|
+
coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
|
|
2368
|
+
reserveId: decodeFromFieldsWithTypes('address', item.fields.reserve_id),
|
|
2369
|
+
obligationId: decodeFromFieldsWithTypes('address', item.fields.obligation_id),
|
|
2370
|
+
liquidityAmount: decodeFromFieldsWithTypes('u64', item.fields.liquidity_amount),
|
|
1322
2371
|
});
|
|
1323
2372
|
}
|
|
1324
|
-
static fromBcs(
|
|
1325
|
-
return
|
|
2373
|
+
static fromBcs(data) {
|
|
2374
|
+
return RepayEvent.fromFields(RepayEvent.bcs.parse(data));
|
|
1326
2375
|
}
|
|
1327
2376
|
toJSONField() {
|
|
1328
2377
|
return {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
feeReceiver: this.feeReceiver,
|
|
1335
|
-
badDebtUsd: this.badDebtUsd.toJSONField(),
|
|
1336
|
-
badDebtLimitUsd: this.badDebtLimitUsd.toJSONField(),
|
|
2378
|
+
lendingMarketId: this.lendingMarketId,
|
|
2379
|
+
coinType: this.coinType,
|
|
2380
|
+
reserveId: this.reserveId,
|
|
2381
|
+
obligationId: this.obligationId,
|
|
2382
|
+
liquidityAmount: this.liquidityAmount.toString(),
|
|
1337
2383
|
};
|
|
1338
2384
|
}
|
|
1339
2385
|
toJSON() {
|
|
1340
|
-
return {
|
|
1341
|
-
$typeName: this.$typeName,
|
|
1342
|
-
$typeArgs: this.$typeArgs,
|
|
1343
|
-
...this.toJSONField(),
|
|
1344
|
-
};
|
|
2386
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
1345
2387
|
}
|
|
1346
|
-
static fromJSONField(
|
|
1347
|
-
return
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
feeReceiver: decodeFromJSONField("address", field.feeReceiver),
|
|
1354
|
-
badDebtUsd: decodeFromJSONField(Decimal.reified(), field.badDebtUsd),
|
|
1355
|
-
badDebtLimitUsd: decodeFromJSONField(Decimal.reified(), field.badDebtLimitUsd),
|
|
2388
|
+
static fromJSONField(field) {
|
|
2389
|
+
return RepayEvent.reified().new({
|
|
2390
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
2391
|
+
coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
|
|
2392
|
+
reserveId: decodeFromJSONField('address', field.reserveId),
|
|
2393
|
+
obligationId: decodeFromJSONField('address', field.obligationId),
|
|
2394
|
+
liquidityAmount: decodeFromJSONField('u64', field.liquidityAmount),
|
|
1356
2395
|
});
|
|
1357
2396
|
}
|
|
1358
|
-
static fromJSON(
|
|
1359
|
-
if (json.$typeName !==
|
|
1360
|
-
throw new Error(
|
|
2397
|
+
static fromJSON(json) {
|
|
2398
|
+
if (json.$typeName !== RepayEvent.$typeName) {
|
|
2399
|
+
throw new Error(`not a RepayEvent json object: expected '${RepayEvent.$typeName}' but got '${json.$typeName}'`);
|
|
1361
2400
|
}
|
|
1362
|
-
|
|
1363
|
-
return LendingMarket.fromJSONField(typeArg, json);
|
|
2401
|
+
return RepayEvent.fromJSONField(json);
|
|
1364
2402
|
}
|
|
1365
|
-
static
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
throw new Error(`object at id ${id} is not a LendingMarket object`);
|
|
2403
|
+
static fromCoreObject(obj) {
|
|
2404
|
+
if (!isRepayEvent(obj.type)) {
|
|
2405
|
+
throw new Error(`object at ${obj.objectId} is not a RepayEvent object`);
|
|
1369
2406
|
}
|
|
1370
|
-
return
|
|
2407
|
+
return RepayEvent.fromBcs(obj.content);
|
|
2408
|
+
}
|
|
2409
|
+
static async fetch(client, id) {
|
|
2410
|
+
const { object } = await client.core.getObject({
|
|
2411
|
+
objectId: id,
|
|
2412
|
+
include: { content: true },
|
|
2413
|
+
});
|
|
2414
|
+
if (!isRepayEvent(object.type)) {
|
|
2415
|
+
throw new Error(`object at id ${id} is not a RepayEvent object`);
|
|
2416
|
+
}
|
|
2417
|
+
return RepayEvent.fromBcs(object.content);
|
|
1371
2418
|
}
|
|
1372
2419
|
}
|
|
1373
|
-
/* ==============================
|
|
1374
|
-
export function
|
|
2420
|
+
/* ============================== ForgiveEvent =============================== */
|
|
2421
|
+
export function isForgiveEvent(type) {
|
|
1375
2422
|
type = compressSuiType(type);
|
|
1376
|
-
return type
|
|
2423
|
+
return type
|
|
2424
|
+
=== `${getTypeOrigin('suilend', 'lending_market::ForgiveEvent')}::lending_market::ForgiveEvent`;
|
|
1377
2425
|
}
|
|
1378
|
-
export class
|
|
2426
|
+
export class ForgiveEvent {
|
|
1379
2427
|
__StructClass = true;
|
|
1380
|
-
static $typeName
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
$
|
|
2428
|
+
static get $typeName() {
|
|
2429
|
+
return `${getTypeOrigin('suilend', 'lending_market::ForgiveEvent')}::lending_market::ForgiveEvent`;
|
|
2430
|
+
}
|
|
2431
|
+
static $numTypeParams = 0;
|
|
2432
|
+
static $isPhantom = [];
|
|
2433
|
+
$typeName = ForgiveEvent.$typeName;
|
|
1384
2434
|
$fullTypeName;
|
|
1385
2435
|
$typeArgs;
|
|
1386
|
-
$isPhantom =
|
|
1387
|
-
id;
|
|
2436
|
+
$isPhantom = ForgiveEvent.$isPhantom;
|
|
1388
2437
|
lendingMarketId;
|
|
2438
|
+
coinType;
|
|
2439
|
+
reserveId;
|
|
2440
|
+
obligationId;
|
|
2441
|
+
liquidityAmount;
|
|
1389
2442
|
constructor(typeArgs, fields) {
|
|
1390
|
-
this.$fullTypeName = composeSuiType(
|
|
2443
|
+
this.$fullTypeName = composeSuiType(ForgiveEvent.$typeName, ...typeArgs);
|
|
1391
2444
|
this.$typeArgs = typeArgs;
|
|
1392
|
-
this.id = fields.id;
|
|
1393
2445
|
this.lendingMarketId = fields.lendingMarketId;
|
|
2446
|
+
this.coinType = fields.coinType;
|
|
2447
|
+
this.reserveId = fields.reserveId;
|
|
2448
|
+
this.obligationId = fields.obligationId;
|
|
2449
|
+
this.liquidityAmount = fields.liquidityAmount;
|
|
1394
2450
|
}
|
|
1395
|
-
static reified(
|
|
2451
|
+
static reified() {
|
|
2452
|
+
const reifiedBcs = ForgiveEvent.bcs;
|
|
1396
2453
|
return {
|
|
1397
|
-
typeName
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
2454
|
+
get typeName() {
|
|
2455
|
+
return ForgiveEvent.$typeName;
|
|
2456
|
+
},
|
|
2457
|
+
get fullTypeName() {
|
|
2458
|
+
return composeSuiType(ForgiveEvent.$typeName, ...[]);
|
|
2459
|
+
},
|
|
2460
|
+
typeArgs: [],
|
|
2461
|
+
isPhantom: ForgiveEvent.$isPhantom,
|
|
2462
|
+
reifiedTypeArgs: [],
|
|
2463
|
+
fromFields: (fields) => ForgiveEvent.fromFields(fields),
|
|
2464
|
+
fromFieldsWithTypes: (item) => ForgiveEvent.fromFieldsWithTypes(item),
|
|
2465
|
+
fromBcs: (data) => ForgiveEvent.fromFields(reifiedBcs.parse(data)),
|
|
2466
|
+
bcs: reifiedBcs,
|
|
2467
|
+
fromJSONField: (field) => ForgiveEvent.fromJSONField(field),
|
|
2468
|
+
fromJSON: (json) => ForgiveEvent.fromJSON(json),
|
|
2469
|
+
fromCoreObject: (obj) => ForgiveEvent.fromCoreObject(obj),
|
|
2470
|
+
fetch: async (client, id) => ForgiveEvent.fetch(client, id),
|
|
1409
2471
|
new: (fields) => {
|
|
1410
|
-
return new
|
|
2472
|
+
return new ForgiveEvent([], fields);
|
|
1411
2473
|
},
|
|
1412
|
-
kind:
|
|
2474
|
+
kind: 'StructClassReified',
|
|
1413
2475
|
};
|
|
1414
2476
|
}
|
|
1415
2477
|
static get r() {
|
|
1416
|
-
return
|
|
2478
|
+
return ForgiveEvent.reified();
|
|
1417
2479
|
}
|
|
1418
|
-
static phantom(
|
|
1419
|
-
return phantom(
|
|
2480
|
+
static phantom() {
|
|
2481
|
+
return phantom(ForgiveEvent.reified());
|
|
1420
2482
|
}
|
|
1421
2483
|
static get p() {
|
|
1422
|
-
return
|
|
2484
|
+
return ForgiveEvent.phantom();
|
|
1423
2485
|
}
|
|
1424
|
-
static
|
|
1425
|
-
return bcs.struct(
|
|
1426
|
-
|
|
1427
|
-
|
|
2486
|
+
static instantiateBcs() {
|
|
2487
|
+
return bcs.struct('ForgiveEvent', {
|
|
2488
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
2489
|
+
input: (val) => fromHex(val),
|
|
2490
|
+
output: (val) => toHex(val),
|
|
2491
|
+
}),
|
|
2492
|
+
coin_type: TypeName.bcs,
|
|
2493
|
+
reserve_id: bcs.bytes(32).transform({
|
|
2494
|
+
input: (val) => fromHex(val),
|
|
2495
|
+
output: (val) => toHex(val),
|
|
2496
|
+
}),
|
|
2497
|
+
obligation_id: bcs.bytes(32).transform({
|
|
2498
|
+
input: (val) => fromHex(val),
|
|
2499
|
+
output: (val) => toHex(val),
|
|
2500
|
+
}),
|
|
2501
|
+
liquidity_amount: bcs.u64(),
|
|
1428
2502
|
});
|
|
1429
2503
|
}
|
|
1430
|
-
static
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
2504
|
+
static cachedBcs = null;
|
|
2505
|
+
static get bcs() {
|
|
2506
|
+
if (!ForgiveEvent.cachedBcs) {
|
|
2507
|
+
ForgiveEvent.cachedBcs = ForgiveEvent.instantiateBcs();
|
|
2508
|
+
}
|
|
2509
|
+
return ForgiveEvent.cachedBcs;
|
|
2510
|
+
}
|
|
2511
|
+
static fromFields(fields) {
|
|
2512
|
+
return ForgiveEvent.reified().new({
|
|
2513
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
2514
|
+
coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
|
|
2515
|
+
reserveId: decodeFromFields('address', fields.reserve_id),
|
|
2516
|
+
obligationId: decodeFromFields('address', fields.obligation_id),
|
|
2517
|
+
liquidityAmount: decodeFromFields('u64', fields.liquidity_amount),
|
|
1434
2518
|
});
|
|
1435
2519
|
}
|
|
1436
|
-
static fromFieldsWithTypes(
|
|
1437
|
-
if (!
|
|
1438
|
-
throw new Error(
|
|
2520
|
+
static fromFieldsWithTypes(item) {
|
|
2521
|
+
if (!isForgiveEvent(item.type)) {
|
|
2522
|
+
throw new Error('not a ForgiveEvent type');
|
|
1439
2523
|
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
2524
|
+
return ForgiveEvent.reified().new({
|
|
2525
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
2526
|
+
coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
|
|
2527
|
+
reserveId: decodeFromFieldsWithTypes('address', item.fields.reserve_id),
|
|
2528
|
+
obligationId: decodeFromFieldsWithTypes('address', item.fields.obligation_id),
|
|
2529
|
+
liquidityAmount: decodeFromFieldsWithTypes('u64', item.fields.liquidity_amount),
|
|
1444
2530
|
});
|
|
1445
2531
|
}
|
|
1446
|
-
static fromBcs(
|
|
1447
|
-
return
|
|
2532
|
+
static fromBcs(data) {
|
|
2533
|
+
return ForgiveEvent.fromFields(ForgiveEvent.bcs.parse(data));
|
|
1448
2534
|
}
|
|
1449
2535
|
toJSONField() {
|
|
1450
2536
|
return {
|
|
1451
|
-
id: this.id,
|
|
1452
2537
|
lendingMarketId: this.lendingMarketId,
|
|
2538
|
+
coinType: this.coinType,
|
|
2539
|
+
reserveId: this.reserveId,
|
|
2540
|
+
obligationId: this.obligationId,
|
|
2541
|
+
liquidityAmount: this.liquidityAmount.toString(),
|
|
1453
2542
|
};
|
|
1454
2543
|
}
|
|
1455
2544
|
toJSON() {
|
|
1456
|
-
return {
|
|
1457
|
-
$typeName: this.$typeName,
|
|
1458
|
-
$typeArgs: this.$typeArgs,
|
|
1459
|
-
...this.toJSONField(),
|
|
1460
|
-
};
|
|
2545
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
1461
2546
|
}
|
|
1462
|
-
static fromJSONField(
|
|
1463
|
-
return
|
|
1464
|
-
|
|
1465
|
-
|
|
2547
|
+
static fromJSONField(field) {
|
|
2548
|
+
return ForgiveEvent.reified().new({
|
|
2549
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
2550
|
+
coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
|
|
2551
|
+
reserveId: decodeFromJSONField('address', field.reserveId),
|
|
2552
|
+
obligationId: decodeFromJSONField('address', field.obligationId),
|
|
2553
|
+
liquidityAmount: decodeFromJSONField('u64', field.liquidityAmount),
|
|
1466
2554
|
});
|
|
1467
2555
|
}
|
|
1468
|
-
static fromJSON(
|
|
1469
|
-
if (json.$typeName !==
|
|
1470
|
-
throw new Error(
|
|
2556
|
+
static fromJSON(json) {
|
|
2557
|
+
if (json.$typeName !== ForgiveEvent.$typeName) {
|
|
2558
|
+
throw new Error(`not a ForgiveEvent json object: expected '${ForgiveEvent.$typeName}' but got '${json.$typeName}'`);
|
|
1471
2559
|
}
|
|
1472
|
-
|
|
1473
|
-
return LendingMarketOwnerCap.fromJSONField(typeArg, json);
|
|
2560
|
+
return ForgiveEvent.fromJSONField(json);
|
|
1474
2561
|
}
|
|
1475
|
-
static
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
throw new Error(`object at id ${id} is not a LendingMarketOwnerCap object`);
|
|
2562
|
+
static fromCoreObject(obj) {
|
|
2563
|
+
if (!isForgiveEvent(obj.type)) {
|
|
2564
|
+
throw new Error(`object at ${obj.objectId} is not a ForgiveEvent object`);
|
|
1479
2565
|
}
|
|
1480
|
-
return
|
|
2566
|
+
return ForgiveEvent.fromBcs(obj.content);
|
|
2567
|
+
}
|
|
2568
|
+
static async fetch(client, id) {
|
|
2569
|
+
const { object } = await client.core.getObject({
|
|
2570
|
+
objectId: id,
|
|
2571
|
+
include: { content: true },
|
|
2572
|
+
});
|
|
2573
|
+
if (!isForgiveEvent(object.type)) {
|
|
2574
|
+
throw new Error(`object at id ${id} is not a ForgiveEvent object`);
|
|
2575
|
+
}
|
|
2576
|
+
return ForgiveEvent.fromBcs(object.content);
|
|
1481
2577
|
}
|
|
1482
2578
|
}
|
|
1483
2579
|
/* ============================== LiquidateEvent =============================== */
|
|
1484
2580
|
export function isLiquidateEvent(type) {
|
|
1485
2581
|
type = compressSuiType(type);
|
|
1486
|
-
return type
|
|
2582
|
+
return type
|
|
2583
|
+
=== `${getTypeOrigin('suilend', 'lending_market::LiquidateEvent')}::lending_market::LiquidateEvent`;
|
|
1487
2584
|
}
|
|
1488
2585
|
export class LiquidateEvent {
|
|
1489
2586
|
__StructClass = true;
|
|
1490
|
-
static $typeName
|
|
2587
|
+
static get $typeName() {
|
|
2588
|
+
return `${getTypeOrigin('suilend', 'lending_market::LiquidateEvent')}::lending_market::LiquidateEvent`;
|
|
2589
|
+
}
|
|
1491
2590
|
static $numTypeParams = 0;
|
|
1492
2591
|
static $isPhantom = [];
|
|
1493
2592
|
$typeName = LiquidateEvent.$typeName;
|
|
@@ -1519,23 +2618,29 @@ export class LiquidateEvent {
|
|
|
1519
2618
|
this.liquidatorBonusAmount = fields.liquidatorBonusAmount;
|
|
1520
2619
|
}
|
|
1521
2620
|
static reified() {
|
|
2621
|
+
const reifiedBcs = LiquidateEvent.bcs;
|
|
1522
2622
|
return {
|
|
1523
|
-
typeName
|
|
1524
|
-
|
|
2623
|
+
get typeName() {
|
|
2624
|
+
return LiquidateEvent.$typeName;
|
|
2625
|
+
},
|
|
2626
|
+
get fullTypeName() {
|
|
2627
|
+
return composeSuiType(LiquidateEvent.$typeName, ...[]);
|
|
2628
|
+
},
|
|
1525
2629
|
typeArgs: [],
|
|
1526
2630
|
isPhantom: LiquidateEvent.$isPhantom,
|
|
1527
2631
|
reifiedTypeArgs: [],
|
|
1528
2632
|
fromFields: (fields) => LiquidateEvent.fromFields(fields),
|
|
1529
2633
|
fromFieldsWithTypes: (item) => LiquidateEvent.fromFieldsWithTypes(item),
|
|
1530
|
-
fromBcs: (data) => LiquidateEvent.
|
|
1531
|
-
bcs:
|
|
2634
|
+
fromBcs: (data) => LiquidateEvent.fromFields(reifiedBcs.parse(data)),
|
|
2635
|
+
bcs: reifiedBcs,
|
|
1532
2636
|
fromJSONField: (field) => LiquidateEvent.fromJSONField(field),
|
|
1533
2637
|
fromJSON: (json) => LiquidateEvent.fromJSON(json),
|
|
2638
|
+
fromCoreObject: (obj) => LiquidateEvent.fromCoreObject(obj),
|
|
1534
2639
|
fetch: async (client, id) => LiquidateEvent.fetch(client, id),
|
|
1535
2640
|
new: (fields) => {
|
|
1536
2641
|
return new LiquidateEvent([], fields);
|
|
1537
2642
|
},
|
|
1538
|
-
kind:
|
|
2643
|
+
kind: 'StructClassReified',
|
|
1539
2644
|
};
|
|
1540
2645
|
}
|
|
1541
2646
|
static get r() {
|
|
@@ -1547,29 +2652,21 @@ export class LiquidateEvent {
|
|
|
1547
2652
|
static get p() {
|
|
1548
2653
|
return LiquidateEvent.phantom();
|
|
1549
2654
|
}
|
|
1550
|
-
static
|
|
1551
|
-
return bcs.struct(
|
|
1552
|
-
lending_market_id: bcs
|
|
1553
|
-
.bytes(32)
|
|
1554
|
-
.transform({
|
|
2655
|
+
static instantiateBcs() {
|
|
2656
|
+
return bcs.struct('LiquidateEvent', {
|
|
2657
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
1555
2658
|
input: (val) => fromHex(val),
|
|
1556
2659
|
output: (val) => toHex(val),
|
|
1557
2660
|
}),
|
|
1558
|
-
repay_reserve_id: bcs
|
|
1559
|
-
.bytes(32)
|
|
1560
|
-
.transform({
|
|
2661
|
+
repay_reserve_id: bcs.bytes(32).transform({
|
|
1561
2662
|
input: (val) => fromHex(val),
|
|
1562
2663
|
output: (val) => toHex(val),
|
|
1563
2664
|
}),
|
|
1564
|
-
withdraw_reserve_id: bcs
|
|
1565
|
-
.bytes(32)
|
|
1566
|
-
.transform({
|
|
2665
|
+
withdraw_reserve_id: bcs.bytes(32).transform({
|
|
1567
2666
|
input: (val) => fromHex(val),
|
|
1568
2667
|
output: (val) => toHex(val),
|
|
1569
2668
|
}),
|
|
1570
|
-
obligation_id: bcs
|
|
1571
|
-
.bytes(32)
|
|
1572
|
-
.transform({
|
|
2669
|
+
obligation_id: bcs.bytes(32).transform({
|
|
1573
2670
|
input: (val) => fromHex(val),
|
|
1574
2671
|
output: (val) => toHex(val),
|
|
1575
2672
|
}),
|
|
@@ -1581,35 +2678,42 @@ export class LiquidateEvent {
|
|
|
1581
2678
|
liquidator_bonus_amount: bcs.u64(),
|
|
1582
2679
|
});
|
|
1583
2680
|
}
|
|
2681
|
+
static cachedBcs = null;
|
|
2682
|
+
static get bcs() {
|
|
2683
|
+
if (!LiquidateEvent.cachedBcs) {
|
|
2684
|
+
LiquidateEvent.cachedBcs = LiquidateEvent.instantiateBcs();
|
|
2685
|
+
}
|
|
2686
|
+
return LiquidateEvent.cachedBcs;
|
|
2687
|
+
}
|
|
1584
2688
|
static fromFields(fields) {
|
|
1585
2689
|
return LiquidateEvent.reified().new({
|
|
1586
|
-
lendingMarketId: decodeFromFields(
|
|
1587
|
-
repayReserveId: decodeFromFields(
|
|
1588
|
-
withdrawReserveId: decodeFromFields(
|
|
1589
|
-
obligationId: decodeFromFields(
|
|
2690
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
2691
|
+
repayReserveId: decodeFromFields('address', fields.repay_reserve_id),
|
|
2692
|
+
withdrawReserveId: decodeFromFields('address', fields.withdraw_reserve_id),
|
|
2693
|
+
obligationId: decodeFromFields('address', fields.obligation_id),
|
|
1590
2694
|
repayCoinType: decodeFromFields(TypeName.reified(), fields.repay_coin_type),
|
|
1591
2695
|
withdrawCoinType: decodeFromFields(TypeName.reified(), fields.withdraw_coin_type),
|
|
1592
|
-
repayAmount: decodeFromFields(
|
|
1593
|
-
withdrawAmount: decodeFromFields(
|
|
1594
|
-
protocolFeeAmount: decodeFromFields(
|
|
1595
|
-
liquidatorBonusAmount: decodeFromFields(
|
|
2696
|
+
repayAmount: decodeFromFields('u64', fields.repay_amount),
|
|
2697
|
+
withdrawAmount: decodeFromFields('u64', fields.withdraw_amount),
|
|
2698
|
+
protocolFeeAmount: decodeFromFields('u64', fields.protocol_fee_amount),
|
|
2699
|
+
liquidatorBonusAmount: decodeFromFields('u64', fields.liquidator_bonus_amount),
|
|
1596
2700
|
});
|
|
1597
2701
|
}
|
|
1598
2702
|
static fromFieldsWithTypes(item) {
|
|
1599
2703
|
if (!isLiquidateEvent(item.type)) {
|
|
1600
|
-
throw new Error(
|
|
2704
|
+
throw new Error('not a LiquidateEvent type');
|
|
1601
2705
|
}
|
|
1602
2706
|
return LiquidateEvent.reified().new({
|
|
1603
|
-
lendingMarketId: decodeFromFieldsWithTypes(
|
|
1604
|
-
repayReserveId: decodeFromFieldsWithTypes(
|
|
1605
|
-
withdrawReserveId: decodeFromFieldsWithTypes(
|
|
1606
|
-
obligationId: decodeFromFieldsWithTypes(
|
|
2707
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
2708
|
+
repayReserveId: decodeFromFieldsWithTypes('address', item.fields.repay_reserve_id),
|
|
2709
|
+
withdrawReserveId: decodeFromFieldsWithTypes('address', item.fields.withdraw_reserve_id),
|
|
2710
|
+
obligationId: decodeFromFieldsWithTypes('address', item.fields.obligation_id),
|
|
1607
2711
|
repayCoinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.repay_coin_type),
|
|
1608
2712
|
withdrawCoinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.withdraw_coin_type),
|
|
1609
|
-
repayAmount: decodeFromFieldsWithTypes(
|
|
1610
|
-
withdrawAmount: decodeFromFieldsWithTypes(
|
|
1611
|
-
protocolFeeAmount: decodeFromFieldsWithTypes(
|
|
1612
|
-
liquidatorBonusAmount: decodeFromFieldsWithTypes(
|
|
2713
|
+
repayAmount: decodeFromFieldsWithTypes('u64', item.fields.repay_amount),
|
|
2714
|
+
withdrawAmount: decodeFromFieldsWithTypes('u64', item.fields.withdraw_amount),
|
|
2715
|
+
protocolFeeAmount: decodeFromFieldsWithTypes('u64', item.fields.protocol_fee_amount),
|
|
2716
|
+
liquidatorBonusAmount: decodeFromFieldsWithTypes('u64', item.fields.liquidator_bonus_amount),
|
|
1613
2717
|
});
|
|
1614
2718
|
}
|
|
1615
2719
|
static fromBcs(data) {
|
|
@@ -1621,8 +2725,8 @@ export class LiquidateEvent {
|
|
|
1621
2725
|
repayReserveId: this.repayReserveId,
|
|
1622
2726
|
withdrawReserveId: this.withdrawReserveId,
|
|
1623
2727
|
obligationId: this.obligationId,
|
|
1624
|
-
repayCoinType: this.repayCoinType
|
|
1625
|
-
withdrawCoinType: this.withdrawCoinType
|
|
2728
|
+
repayCoinType: this.repayCoinType,
|
|
2729
|
+
withdrawCoinType: this.withdrawCoinType,
|
|
1626
2730
|
repayAmount: this.repayAmount.toString(),
|
|
1627
2731
|
withdrawAmount: this.withdrawAmount.toString(),
|
|
1628
2732
|
protocolFeeAmount: this.protocolFeeAmount.toString(),
|
|
@@ -1630,538 +2734,634 @@ export class LiquidateEvent {
|
|
|
1630
2734
|
};
|
|
1631
2735
|
}
|
|
1632
2736
|
toJSON() {
|
|
1633
|
-
return {
|
|
1634
|
-
$typeName: this.$typeName,
|
|
1635
|
-
$typeArgs: this.$typeArgs,
|
|
1636
|
-
...this.toJSONField(),
|
|
1637
|
-
};
|
|
2737
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
1638
2738
|
}
|
|
1639
2739
|
static fromJSONField(field) {
|
|
1640
2740
|
return LiquidateEvent.reified().new({
|
|
1641
|
-
lendingMarketId: decodeFromJSONField(
|
|
1642
|
-
repayReserveId: decodeFromJSONField(
|
|
1643
|
-
withdrawReserveId: decodeFromJSONField(
|
|
1644
|
-
obligationId: decodeFromJSONField(
|
|
2741
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
2742
|
+
repayReserveId: decodeFromJSONField('address', field.repayReserveId),
|
|
2743
|
+
withdrawReserveId: decodeFromJSONField('address', field.withdrawReserveId),
|
|
2744
|
+
obligationId: decodeFromJSONField('address', field.obligationId),
|
|
1645
2745
|
repayCoinType: decodeFromJSONField(TypeName.reified(), field.repayCoinType),
|
|
1646
2746
|
withdrawCoinType: decodeFromJSONField(TypeName.reified(), field.withdrawCoinType),
|
|
1647
|
-
repayAmount: decodeFromJSONField(
|
|
1648
|
-
withdrawAmount: decodeFromJSONField(
|
|
1649
|
-
protocolFeeAmount: decodeFromJSONField(
|
|
1650
|
-
liquidatorBonusAmount: decodeFromJSONField(
|
|
2747
|
+
repayAmount: decodeFromJSONField('u64', field.repayAmount),
|
|
2748
|
+
withdrawAmount: decodeFromJSONField('u64', field.withdrawAmount),
|
|
2749
|
+
protocolFeeAmount: decodeFromJSONField('u64', field.protocolFeeAmount),
|
|
2750
|
+
liquidatorBonusAmount: decodeFromJSONField('u64', field.liquidatorBonusAmount),
|
|
1651
2751
|
});
|
|
1652
2752
|
}
|
|
1653
2753
|
static fromJSON(json) {
|
|
1654
2754
|
if (json.$typeName !== LiquidateEvent.$typeName) {
|
|
1655
|
-
throw new Error(
|
|
2755
|
+
throw new Error(`not a LiquidateEvent json object: expected '${LiquidateEvent.$typeName}' but got '${json.$typeName}'`);
|
|
1656
2756
|
}
|
|
1657
2757
|
return LiquidateEvent.fromJSONField(json);
|
|
1658
2758
|
}
|
|
2759
|
+
static fromCoreObject(obj) {
|
|
2760
|
+
if (!isLiquidateEvent(obj.type)) {
|
|
2761
|
+
throw new Error(`object at ${obj.objectId} is not a LiquidateEvent object`);
|
|
2762
|
+
}
|
|
2763
|
+
return LiquidateEvent.fromBcs(obj.content);
|
|
2764
|
+
}
|
|
1659
2765
|
static async fetch(client, id) {
|
|
1660
|
-
const { object } = await client.getObject({
|
|
2766
|
+
const { object } = await client.core.getObject({
|
|
2767
|
+
objectId: id,
|
|
2768
|
+
include: { content: true },
|
|
2769
|
+
});
|
|
1661
2770
|
if (!isLiquidateEvent(object.type)) {
|
|
1662
2771
|
throw new Error(`object at id ${id} is not a LiquidateEvent object`);
|
|
1663
2772
|
}
|
|
1664
2773
|
return LiquidateEvent.fromBcs(object.content);
|
|
1665
2774
|
}
|
|
1666
2775
|
}
|
|
1667
|
-
/* ==============================
|
|
1668
|
-
export function
|
|
2776
|
+
/* ============================== ClaimRewardEvent =============================== */
|
|
2777
|
+
export function isClaimRewardEvent(type) {
|
|
1669
2778
|
type = compressSuiType(type);
|
|
1670
|
-
return type
|
|
2779
|
+
return type
|
|
2780
|
+
=== `${getTypeOrigin('suilend', 'lending_market::ClaimRewardEvent')}::lending_market::ClaimRewardEvent`;
|
|
1671
2781
|
}
|
|
1672
|
-
export class
|
|
2782
|
+
export class ClaimRewardEvent {
|
|
1673
2783
|
__StructClass = true;
|
|
1674
|
-
static $typeName
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
$
|
|
2784
|
+
static get $typeName() {
|
|
2785
|
+
return `${getTypeOrigin('suilend', 'lending_market::ClaimRewardEvent')}::lending_market::ClaimRewardEvent`;
|
|
2786
|
+
}
|
|
2787
|
+
static $numTypeParams = 0;
|
|
2788
|
+
static $isPhantom = [];
|
|
2789
|
+
$typeName = ClaimRewardEvent.$typeName;
|
|
1678
2790
|
$fullTypeName;
|
|
1679
2791
|
$typeArgs;
|
|
1680
|
-
$isPhantom =
|
|
1681
|
-
|
|
2792
|
+
$isPhantom = ClaimRewardEvent.$isPhantom;
|
|
2793
|
+
lendingMarketId;
|
|
2794
|
+
reserveId;
|
|
1682
2795
|
obligationId;
|
|
2796
|
+
isDepositReward;
|
|
2797
|
+
poolRewardId;
|
|
2798
|
+
coinType;
|
|
2799
|
+
liquidityAmount;
|
|
1683
2800
|
constructor(typeArgs, fields) {
|
|
1684
|
-
this.$fullTypeName = composeSuiType(
|
|
2801
|
+
this.$fullTypeName = composeSuiType(ClaimRewardEvent.$typeName, ...typeArgs);
|
|
1685
2802
|
this.$typeArgs = typeArgs;
|
|
1686
|
-
this.
|
|
2803
|
+
this.lendingMarketId = fields.lendingMarketId;
|
|
2804
|
+
this.reserveId = fields.reserveId;
|
|
1687
2805
|
this.obligationId = fields.obligationId;
|
|
2806
|
+
this.isDepositReward = fields.isDepositReward;
|
|
2807
|
+
this.poolRewardId = fields.poolRewardId;
|
|
2808
|
+
this.coinType = fields.coinType;
|
|
2809
|
+
this.liquidityAmount = fields.liquidityAmount;
|
|
1688
2810
|
}
|
|
1689
|
-
static reified(
|
|
2811
|
+
static reified() {
|
|
2812
|
+
const reifiedBcs = ClaimRewardEvent.bcs;
|
|
1690
2813
|
return {
|
|
1691
|
-
typeName
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
2814
|
+
get typeName() {
|
|
2815
|
+
return ClaimRewardEvent.$typeName;
|
|
2816
|
+
},
|
|
2817
|
+
get fullTypeName() {
|
|
2818
|
+
return composeSuiType(ClaimRewardEvent.$typeName, ...[]);
|
|
2819
|
+
},
|
|
2820
|
+
typeArgs: [],
|
|
2821
|
+
isPhantom: ClaimRewardEvent.$isPhantom,
|
|
2822
|
+
reifiedTypeArgs: [],
|
|
2823
|
+
fromFields: (fields) => ClaimRewardEvent.fromFields(fields),
|
|
2824
|
+
fromFieldsWithTypes: (item) => ClaimRewardEvent.fromFieldsWithTypes(item),
|
|
2825
|
+
fromBcs: (data) => ClaimRewardEvent.fromFields(reifiedBcs.parse(data)),
|
|
2826
|
+
bcs: reifiedBcs,
|
|
2827
|
+
fromJSONField: (field) => ClaimRewardEvent.fromJSONField(field),
|
|
2828
|
+
fromJSON: (json) => ClaimRewardEvent.fromJSON(json),
|
|
2829
|
+
fromCoreObject: (obj) => ClaimRewardEvent.fromCoreObject(obj),
|
|
2830
|
+
fetch: async (client, id) => ClaimRewardEvent.fetch(client, id),
|
|
1703
2831
|
new: (fields) => {
|
|
1704
|
-
return new
|
|
2832
|
+
return new ClaimRewardEvent([], fields);
|
|
1705
2833
|
},
|
|
1706
|
-
kind:
|
|
2834
|
+
kind: 'StructClassReified',
|
|
1707
2835
|
};
|
|
1708
2836
|
}
|
|
1709
2837
|
static get r() {
|
|
1710
|
-
return
|
|
2838
|
+
return ClaimRewardEvent.reified();
|
|
1711
2839
|
}
|
|
1712
|
-
static phantom(
|
|
1713
|
-
return phantom(
|
|
2840
|
+
static phantom() {
|
|
2841
|
+
return phantom(ClaimRewardEvent.reified());
|
|
1714
2842
|
}
|
|
1715
2843
|
static get p() {
|
|
1716
|
-
return
|
|
2844
|
+
return ClaimRewardEvent.phantom();
|
|
2845
|
+
}
|
|
2846
|
+
static instantiateBcs() {
|
|
2847
|
+
return bcs.struct('ClaimRewardEvent', {
|
|
2848
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
2849
|
+
input: (val) => fromHex(val),
|
|
2850
|
+
output: (val) => toHex(val),
|
|
2851
|
+
}),
|
|
2852
|
+
reserve_id: bcs.bytes(32).transform({
|
|
2853
|
+
input: (val) => fromHex(val),
|
|
2854
|
+
output: (val) => toHex(val),
|
|
2855
|
+
}),
|
|
2856
|
+
obligation_id: bcs.bytes(32).transform({
|
|
2857
|
+
input: (val) => fromHex(val),
|
|
2858
|
+
output: (val) => toHex(val),
|
|
2859
|
+
}),
|
|
2860
|
+
is_deposit_reward: bcs.bool(),
|
|
2861
|
+
pool_reward_id: bcs.bytes(32).transform({
|
|
2862
|
+
input: (val) => fromHex(val),
|
|
2863
|
+
output: (val) => toHex(val),
|
|
2864
|
+
}),
|
|
2865
|
+
coin_type: TypeName.bcs,
|
|
2866
|
+
liquidity_amount: bcs.u64(),
|
|
2867
|
+
});
|
|
1717
2868
|
}
|
|
2869
|
+
static cachedBcs = null;
|
|
1718
2870
|
static get bcs() {
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
2871
|
+
if (!ClaimRewardEvent.cachedBcs) {
|
|
2872
|
+
ClaimRewardEvent.cachedBcs = ClaimRewardEvent.instantiateBcs();
|
|
2873
|
+
}
|
|
2874
|
+
return ClaimRewardEvent.cachedBcs;
|
|
1723
2875
|
}
|
|
1724
|
-
static fromFields(
|
|
1725
|
-
return
|
|
1726
|
-
|
|
1727
|
-
|
|
2876
|
+
static fromFields(fields) {
|
|
2877
|
+
return ClaimRewardEvent.reified().new({
|
|
2878
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
2879
|
+
reserveId: decodeFromFields('address', fields.reserve_id),
|
|
2880
|
+
obligationId: decodeFromFields('address', fields.obligation_id),
|
|
2881
|
+
isDepositReward: decodeFromFields('bool', fields.is_deposit_reward),
|
|
2882
|
+
poolRewardId: decodeFromFields('address', fields.pool_reward_id),
|
|
2883
|
+
coinType: decodeFromFields(TypeName.reified(), fields.coin_type),
|
|
2884
|
+
liquidityAmount: decodeFromFields('u64', fields.liquidity_amount),
|
|
1728
2885
|
});
|
|
1729
2886
|
}
|
|
1730
|
-
static fromFieldsWithTypes(
|
|
1731
|
-
if (!
|
|
1732
|
-
throw new Error(
|
|
2887
|
+
static fromFieldsWithTypes(item) {
|
|
2888
|
+
if (!isClaimRewardEvent(item.type)) {
|
|
2889
|
+
throw new Error('not a ClaimRewardEvent type');
|
|
1733
2890
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
obligationId: decodeFromFieldsWithTypes(
|
|
2891
|
+
return ClaimRewardEvent.reified().new({
|
|
2892
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
2893
|
+
reserveId: decodeFromFieldsWithTypes('address', item.fields.reserve_id),
|
|
2894
|
+
obligationId: decodeFromFieldsWithTypes('address', item.fields.obligation_id),
|
|
2895
|
+
isDepositReward: decodeFromFieldsWithTypes('bool', item.fields.is_deposit_reward),
|
|
2896
|
+
poolRewardId: decodeFromFieldsWithTypes('address', item.fields.pool_reward_id),
|
|
2897
|
+
coinType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.coin_type),
|
|
2898
|
+
liquidityAmount: decodeFromFieldsWithTypes('u64', item.fields.liquidity_amount),
|
|
1738
2899
|
});
|
|
1739
2900
|
}
|
|
1740
|
-
static fromBcs(
|
|
1741
|
-
return
|
|
2901
|
+
static fromBcs(data) {
|
|
2902
|
+
return ClaimRewardEvent.fromFields(ClaimRewardEvent.bcs.parse(data));
|
|
1742
2903
|
}
|
|
1743
2904
|
toJSONField() {
|
|
1744
2905
|
return {
|
|
1745
|
-
|
|
2906
|
+
lendingMarketId: this.lendingMarketId,
|
|
2907
|
+
reserveId: this.reserveId,
|
|
1746
2908
|
obligationId: this.obligationId,
|
|
2909
|
+
isDepositReward: this.isDepositReward,
|
|
2910
|
+
poolRewardId: this.poolRewardId,
|
|
2911
|
+
coinType: this.coinType,
|
|
2912
|
+
liquidityAmount: this.liquidityAmount.toString(),
|
|
1747
2913
|
};
|
|
1748
2914
|
}
|
|
1749
2915
|
toJSON() {
|
|
1750
|
-
return {
|
|
1751
|
-
$typeName: this.$typeName,
|
|
1752
|
-
$typeArgs: this.$typeArgs,
|
|
1753
|
-
...this.toJSONField(),
|
|
1754
|
-
};
|
|
2916
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
1755
2917
|
}
|
|
1756
|
-
static fromJSONField(
|
|
1757
|
-
return
|
|
1758
|
-
|
|
1759
|
-
|
|
2918
|
+
static fromJSONField(field) {
|
|
2919
|
+
return ClaimRewardEvent.reified().new({
|
|
2920
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
2921
|
+
reserveId: decodeFromJSONField('address', field.reserveId),
|
|
2922
|
+
obligationId: decodeFromJSONField('address', field.obligationId),
|
|
2923
|
+
isDepositReward: decodeFromJSONField('bool', field.isDepositReward),
|
|
2924
|
+
poolRewardId: decodeFromJSONField('address', field.poolRewardId),
|
|
2925
|
+
coinType: decodeFromJSONField(TypeName.reified(), field.coinType),
|
|
2926
|
+
liquidityAmount: decodeFromJSONField('u64', field.liquidityAmount),
|
|
1760
2927
|
});
|
|
1761
2928
|
}
|
|
1762
|
-
static fromJSON(
|
|
1763
|
-
if (json.$typeName !==
|
|
1764
|
-
throw new Error(
|
|
2929
|
+
static fromJSON(json) {
|
|
2930
|
+
if (json.$typeName !== ClaimRewardEvent.$typeName) {
|
|
2931
|
+
throw new Error(`not a ClaimRewardEvent json object: expected '${ClaimRewardEvent.$typeName}' but got '${json.$typeName}'`);
|
|
1765
2932
|
}
|
|
1766
|
-
|
|
1767
|
-
return ObligationOwnerCap.fromJSONField(typeArg, json);
|
|
2933
|
+
return ClaimRewardEvent.fromJSONField(json);
|
|
1768
2934
|
}
|
|
1769
|
-
static
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
throw new Error(`object at id ${id} is not a ObligationOwnerCap object`);
|
|
2935
|
+
static fromCoreObject(obj) {
|
|
2936
|
+
if (!isClaimRewardEvent(obj.type)) {
|
|
2937
|
+
throw new Error(`object at ${obj.objectId} is not a ClaimRewardEvent object`);
|
|
1773
2938
|
}
|
|
1774
|
-
return
|
|
2939
|
+
return ClaimRewardEvent.fromBcs(obj.content);
|
|
2940
|
+
}
|
|
2941
|
+
static async fetch(client, id) {
|
|
2942
|
+
const { object } = await client.core.getObject({
|
|
2943
|
+
objectId: id,
|
|
2944
|
+
include: { content: true },
|
|
2945
|
+
});
|
|
2946
|
+
if (!isClaimRewardEvent(object.type)) {
|
|
2947
|
+
throw new Error(`object at id ${id} is not a ClaimRewardEvent object`);
|
|
2948
|
+
}
|
|
2949
|
+
return ClaimRewardEvent.fromBcs(object.content);
|
|
1775
2950
|
}
|
|
1776
2951
|
}
|
|
1777
|
-
/* ==============================
|
|
1778
|
-
export function
|
|
2952
|
+
/* ============================== MarketPauseEvent =============================== */
|
|
2953
|
+
export function isMarketPauseEvent(type) {
|
|
1779
2954
|
type = compressSuiType(type);
|
|
1780
|
-
return type
|
|
2955
|
+
return type
|
|
2956
|
+
=== `${getTypeOrigin('suilend', 'lending_market::MarketPauseEvent')}::lending_market::MarketPauseEvent`;
|
|
1781
2957
|
}
|
|
1782
|
-
export class
|
|
2958
|
+
export class MarketPauseEvent {
|
|
1783
2959
|
__StructClass = true;
|
|
1784
|
-
static $typeName
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
$
|
|
2960
|
+
static get $typeName() {
|
|
2961
|
+
return `${getTypeOrigin('suilend', 'lending_market::MarketPauseEvent')}::lending_market::MarketPauseEvent`;
|
|
2962
|
+
}
|
|
2963
|
+
static $numTypeParams = 0;
|
|
2964
|
+
static $isPhantom = [];
|
|
2965
|
+
$typeName = MarketPauseEvent.$typeName;
|
|
1788
2966
|
$fullTypeName;
|
|
1789
2967
|
$typeArgs;
|
|
1790
|
-
$isPhantom =
|
|
1791
|
-
|
|
2968
|
+
$isPhantom = MarketPauseEvent.$isPhantom;
|
|
2969
|
+
lendingMarketId;
|
|
2970
|
+
paused;
|
|
1792
2971
|
constructor(typeArgs, fields) {
|
|
1793
|
-
this.$fullTypeName = composeSuiType(
|
|
2972
|
+
this.$fullTypeName = composeSuiType(MarketPauseEvent.$typeName, ...typeArgs);
|
|
1794
2973
|
this.$typeArgs = typeArgs;
|
|
1795
|
-
this.
|
|
2974
|
+
this.lendingMarketId = fields.lendingMarketId;
|
|
2975
|
+
this.paused = fields.paused;
|
|
1796
2976
|
}
|
|
1797
|
-
static reified(
|
|
2977
|
+
static reified() {
|
|
2978
|
+
const reifiedBcs = MarketPauseEvent.bcs;
|
|
1798
2979
|
return {
|
|
1799
|
-
typeName
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
2980
|
+
get typeName() {
|
|
2981
|
+
return MarketPauseEvent.$typeName;
|
|
2982
|
+
},
|
|
2983
|
+
get fullTypeName() {
|
|
2984
|
+
return composeSuiType(MarketPauseEvent.$typeName, ...[]);
|
|
2985
|
+
},
|
|
2986
|
+
typeArgs: [],
|
|
2987
|
+
isPhantom: MarketPauseEvent.$isPhantom,
|
|
2988
|
+
reifiedTypeArgs: [],
|
|
2989
|
+
fromFields: (fields) => MarketPauseEvent.fromFields(fields),
|
|
2990
|
+
fromFieldsWithTypes: (item) => MarketPauseEvent.fromFieldsWithTypes(item),
|
|
2991
|
+
fromBcs: (data) => MarketPauseEvent.fromFields(reifiedBcs.parse(data)),
|
|
2992
|
+
bcs: reifiedBcs,
|
|
2993
|
+
fromJSONField: (field) => MarketPauseEvent.fromJSONField(field),
|
|
2994
|
+
fromJSON: (json) => MarketPauseEvent.fromJSON(json),
|
|
2995
|
+
fromCoreObject: (obj) => MarketPauseEvent.fromCoreObject(obj),
|
|
2996
|
+
fetch: async (client, id) => MarketPauseEvent.fetch(client, id),
|
|
1811
2997
|
new: (fields) => {
|
|
1812
|
-
return new
|
|
2998
|
+
return new MarketPauseEvent([], fields);
|
|
1813
2999
|
},
|
|
1814
|
-
kind:
|
|
3000
|
+
kind: 'StructClassReified',
|
|
1815
3001
|
};
|
|
1816
3002
|
}
|
|
1817
3003
|
static get r() {
|
|
1818
|
-
return
|
|
3004
|
+
return MarketPauseEvent.reified();
|
|
1819
3005
|
}
|
|
1820
|
-
static phantom(
|
|
1821
|
-
return phantom(
|
|
3006
|
+
static phantom() {
|
|
3007
|
+
return phantom(MarketPauseEvent.reified());
|
|
1822
3008
|
}
|
|
1823
3009
|
static get p() {
|
|
1824
|
-
return
|
|
3010
|
+
return MarketPauseEvent.phantom();
|
|
1825
3011
|
}
|
|
1826
|
-
static
|
|
1827
|
-
return bcs.struct(
|
|
1828
|
-
|
|
3012
|
+
static instantiateBcs() {
|
|
3013
|
+
return bcs.struct('MarketPauseEvent', {
|
|
3014
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
3015
|
+
input: (val) => fromHex(val),
|
|
3016
|
+
output: (val) => toHex(val),
|
|
3017
|
+
}),
|
|
3018
|
+
paused: bcs.bool(),
|
|
1829
3019
|
});
|
|
1830
3020
|
}
|
|
1831
|
-
static
|
|
1832
|
-
|
|
1833
|
-
|
|
3021
|
+
static cachedBcs = null;
|
|
3022
|
+
static get bcs() {
|
|
3023
|
+
if (!MarketPauseEvent.cachedBcs) {
|
|
3024
|
+
MarketPauseEvent.cachedBcs = MarketPauseEvent.instantiateBcs();
|
|
3025
|
+
}
|
|
3026
|
+
return MarketPauseEvent.cachedBcs;
|
|
3027
|
+
}
|
|
3028
|
+
static fromFields(fields) {
|
|
3029
|
+
return MarketPauseEvent.reified().new({
|
|
3030
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
3031
|
+
paused: decodeFromFields('bool', fields.paused),
|
|
1834
3032
|
});
|
|
1835
3033
|
}
|
|
1836
|
-
static fromFieldsWithTypes(
|
|
1837
|
-
if (!
|
|
1838
|
-
throw new Error(
|
|
3034
|
+
static fromFieldsWithTypes(item) {
|
|
3035
|
+
if (!isMarketPauseEvent(item.type)) {
|
|
3036
|
+
throw new Error('not a MarketPauseEvent type');
|
|
1839
3037
|
}
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
3038
|
+
return MarketPauseEvent.reified().new({
|
|
3039
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
3040
|
+
paused: decodeFromFieldsWithTypes('bool', item.fields.paused),
|
|
1843
3041
|
});
|
|
1844
3042
|
}
|
|
1845
|
-
static fromBcs(
|
|
1846
|
-
return
|
|
3043
|
+
static fromBcs(data) {
|
|
3044
|
+
return MarketPauseEvent.fromFields(MarketPauseEvent.bcs.parse(data));
|
|
1847
3045
|
}
|
|
1848
3046
|
toJSONField() {
|
|
1849
3047
|
return {
|
|
1850
|
-
|
|
3048
|
+
lendingMarketId: this.lendingMarketId,
|
|
3049
|
+
paused: this.paused,
|
|
1851
3050
|
};
|
|
1852
3051
|
}
|
|
1853
3052
|
toJSON() {
|
|
1854
|
-
return {
|
|
1855
|
-
$typeName: this.$typeName,
|
|
1856
|
-
$typeArgs: this.$typeArgs,
|
|
1857
|
-
...this.toJSONField(),
|
|
1858
|
-
};
|
|
3053
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
1859
3054
|
}
|
|
1860
|
-
static fromJSONField(
|
|
1861
|
-
return
|
|
1862
|
-
|
|
3055
|
+
static fromJSONField(field) {
|
|
3056
|
+
return MarketPauseEvent.reified().new({
|
|
3057
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
3058
|
+
paused: decodeFromJSONField('bool', field.paused),
|
|
1863
3059
|
});
|
|
1864
3060
|
}
|
|
1865
|
-
static fromJSON(
|
|
1866
|
-
if (json.$typeName !==
|
|
1867
|
-
throw new Error(
|
|
3061
|
+
static fromJSON(json) {
|
|
3062
|
+
if (json.$typeName !== MarketPauseEvent.$typeName) {
|
|
3063
|
+
throw new Error(`not a MarketPauseEvent json object: expected '${MarketPauseEvent.$typeName}' but got '${json.$typeName}'`);
|
|
1868
3064
|
}
|
|
1869
|
-
|
|
1870
|
-
return RateLimiterExemption.fromJSONField(typeArgs, json);
|
|
3065
|
+
return MarketPauseEvent.fromJSONField(json);
|
|
1871
3066
|
}
|
|
1872
|
-
static
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
throw new Error(`object at id ${id} is not a RateLimiterExemption object`);
|
|
3067
|
+
static fromCoreObject(obj) {
|
|
3068
|
+
if (!isMarketPauseEvent(obj.type)) {
|
|
3069
|
+
throw new Error(`object at ${obj.objectId} is not a MarketPauseEvent object`);
|
|
1876
3070
|
}
|
|
1877
|
-
return
|
|
3071
|
+
return MarketPauseEvent.fromBcs(obj.content);
|
|
3072
|
+
}
|
|
3073
|
+
static async fetch(client, id) {
|
|
3074
|
+
const { object } = await client.core.getObject({
|
|
3075
|
+
objectId: id,
|
|
3076
|
+
include: { content: true },
|
|
3077
|
+
});
|
|
3078
|
+
if (!isMarketPauseEvent(object.type)) {
|
|
3079
|
+
throw new Error(`object at id ${id} is not a MarketPauseEvent object`);
|
|
3080
|
+
}
|
|
3081
|
+
return MarketPauseEvent.fromBcs(object.content);
|
|
1878
3082
|
}
|
|
1879
3083
|
}
|
|
1880
|
-
/* ==============================
|
|
1881
|
-
export function
|
|
3084
|
+
/* ============================== ReservePauseEvent =============================== */
|
|
3085
|
+
export function isReservePauseEvent(type) {
|
|
1882
3086
|
type = compressSuiType(type);
|
|
1883
|
-
return type
|
|
3087
|
+
return type
|
|
3088
|
+
=== `${getTypeOrigin('suilend', 'lending_market::ReservePauseEvent')}::lending_market::ReservePauseEvent`;
|
|
1884
3089
|
}
|
|
1885
|
-
export class
|
|
3090
|
+
export class ReservePauseEvent {
|
|
1886
3091
|
__StructClass = true;
|
|
1887
|
-
static $typeName
|
|
3092
|
+
static get $typeName() {
|
|
3093
|
+
return `${getTypeOrigin('suilend', 'lending_market::ReservePauseEvent')}::lending_market::ReservePauseEvent`;
|
|
3094
|
+
}
|
|
1888
3095
|
static $numTypeParams = 0;
|
|
1889
3096
|
static $isPhantom = [];
|
|
1890
|
-
$typeName =
|
|
3097
|
+
$typeName = ReservePauseEvent.$typeName;
|
|
1891
3098
|
$fullTypeName;
|
|
1892
3099
|
$typeArgs;
|
|
1893
|
-
$isPhantom =
|
|
3100
|
+
$isPhantom = ReservePauseEvent.$isPhantom;
|
|
1894
3101
|
lendingMarketId;
|
|
1895
|
-
coinType;
|
|
1896
3102
|
reserveId;
|
|
1897
|
-
|
|
1898
|
-
liquidityAmount;
|
|
3103
|
+
paused;
|
|
1899
3104
|
constructor(typeArgs, fields) {
|
|
1900
|
-
this.$fullTypeName = composeSuiType(
|
|
3105
|
+
this.$fullTypeName = composeSuiType(ReservePauseEvent.$typeName, ...typeArgs);
|
|
1901
3106
|
this.$typeArgs = typeArgs;
|
|
1902
3107
|
this.lendingMarketId = fields.lendingMarketId;
|
|
1903
|
-
this.coinType = fields.coinType;
|
|
1904
3108
|
this.reserveId = fields.reserveId;
|
|
1905
|
-
this.
|
|
1906
|
-
this.liquidityAmount = fields.liquidityAmount;
|
|
3109
|
+
this.paused = fields.paused;
|
|
1907
3110
|
}
|
|
1908
3111
|
static reified() {
|
|
3112
|
+
const reifiedBcs = ReservePauseEvent.bcs;
|
|
1909
3113
|
return {
|
|
1910
|
-
typeName
|
|
1911
|
-
|
|
3114
|
+
get typeName() {
|
|
3115
|
+
return ReservePauseEvent.$typeName;
|
|
3116
|
+
},
|
|
3117
|
+
get fullTypeName() {
|
|
3118
|
+
return composeSuiType(ReservePauseEvent.$typeName, ...[]);
|
|
3119
|
+
},
|
|
1912
3120
|
typeArgs: [],
|
|
1913
|
-
isPhantom:
|
|
3121
|
+
isPhantom: ReservePauseEvent.$isPhantom,
|
|
1914
3122
|
reifiedTypeArgs: [],
|
|
1915
|
-
fromFields: (fields) =>
|
|
1916
|
-
fromFieldsWithTypes: (item) =>
|
|
1917
|
-
fromBcs: (data) =>
|
|
1918
|
-
bcs:
|
|
1919
|
-
fromJSONField: (field) =>
|
|
1920
|
-
fromJSON: (json) =>
|
|
1921
|
-
|
|
3123
|
+
fromFields: (fields) => ReservePauseEvent.fromFields(fields),
|
|
3124
|
+
fromFieldsWithTypes: (item) => ReservePauseEvent.fromFieldsWithTypes(item),
|
|
3125
|
+
fromBcs: (data) => ReservePauseEvent.fromFields(reifiedBcs.parse(data)),
|
|
3126
|
+
bcs: reifiedBcs,
|
|
3127
|
+
fromJSONField: (field) => ReservePauseEvent.fromJSONField(field),
|
|
3128
|
+
fromJSON: (json) => ReservePauseEvent.fromJSON(json),
|
|
3129
|
+
fromCoreObject: (obj) => ReservePauseEvent.fromCoreObject(obj),
|
|
3130
|
+
fetch: async (client, id) => ReservePauseEvent.fetch(client, id),
|
|
1922
3131
|
new: (fields) => {
|
|
1923
|
-
return new
|
|
3132
|
+
return new ReservePauseEvent([], fields);
|
|
1924
3133
|
},
|
|
1925
|
-
kind:
|
|
3134
|
+
kind: 'StructClassReified',
|
|
1926
3135
|
};
|
|
1927
3136
|
}
|
|
1928
3137
|
static get r() {
|
|
1929
|
-
return
|
|
3138
|
+
return ReservePauseEvent.reified();
|
|
1930
3139
|
}
|
|
1931
3140
|
static phantom() {
|
|
1932
|
-
return phantom(
|
|
3141
|
+
return phantom(ReservePauseEvent.reified());
|
|
1933
3142
|
}
|
|
1934
3143
|
static get p() {
|
|
1935
|
-
return
|
|
3144
|
+
return ReservePauseEvent.phantom();
|
|
1936
3145
|
}
|
|
1937
|
-
static
|
|
1938
|
-
return bcs.struct(
|
|
1939
|
-
lending_market_id: bcs
|
|
1940
|
-
.bytes(32)
|
|
1941
|
-
.transform({
|
|
1942
|
-
input: (val) => fromHex(val),
|
|
1943
|
-
output: (val) => toHex(val),
|
|
1944
|
-
}),
|
|
1945
|
-
coin_type: TypeName.bcs,
|
|
1946
|
-
reserve_id: bcs
|
|
1947
|
-
.bytes(32)
|
|
1948
|
-
.transform({
|
|
3146
|
+
static instantiateBcs() {
|
|
3147
|
+
return bcs.struct('ReservePauseEvent', {
|
|
3148
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
1949
3149
|
input: (val) => fromHex(val),
|
|
1950
3150
|
output: (val) => toHex(val),
|
|
1951
3151
|
}),
|
|
1952
|
-
|
|
1953
|
-
.bytes(32)
|
|
1954
|
-
.transform({
|
|
3152
|
+
reserve_id: bcs.bytes(32).transform({
|
|
1955
3153
|
input: (val) => fromHex(val),
|
|
1956
3154
|
output: (val) => toHex(val),
|
|
1957
3155
|
}),
|
|
1958
|
-
|
|
3156
|
+
paused: bcs.bool(),
|
|
1959
3157
|
});
|
|
1960
3158
|
}
|
|
3159
|
+
static cachedBcs = null;
|
|
3160
|
+
static get bcs() {
|
|
3161
|
+
if (!ReservePauseEvent.cachedBcs) {
|
|
3162
|
+
ReservePauseEvent.cachedBcs = ReservePauseEvent.instantiateBcs();
|
|
3163
|
+
}
|
|
3164
|
+
return ReservePauseEvent.cachedBcs;
|
|
3165
|
+
}
|
|
1961
3166
|
static fromFields(fields) {
|
|
1962
|
-
return
|
|
1963
|
-
lendingMarketId: decodeFromFields(
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
obligationId: decodeFromFields("address", fields.obligation_id),
|
|
1967
|
-
liquidityAmount: decodeFromFields("u64", fields.liquidity_amount),
|
|
3167
|
+
return ReservePauseEvent.reified().new({
|
|
3168
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
3169
|
+
reserveId: decodeFromFields('address', fields.reserve_id),
|
|
3170
|
+
paused: decodeFromFields('bool', fields.paused),
|
|
1968
3171
|
});
|
|
1969
3172
|
}
|
|
1970
3173
|
static fromFieldsWithTypes(item) {
|
|
1971
|
-
if (!
|
|
1972
|
-
throw new Error(
|
|
3174
|
+
if (!isReservePauseEvent(item.type)) {
|
|
3175
|
+
throw new Error('not a ReservePauseEvent type');
|
|
1973
3176
|
}
|
|
1974
|
-
return
|
|
1975
|
-
lendingMarketId: decodeFromFieldsWithTypes(
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
obligationId: decodeFromFieldsWithTypes("address", item.fields.obligation_id),
|
|
1979
|
-
liquidityAmount: decodeFromFieldsWithTypes("u64", item.fields.liquidity_amount),
|
|
3177
|
+
return ReservePauseEvent.reified().new({
|
|
3178
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
3179
|
+
reserveId: decodeFromFieldsWithTypes('address', item.fields.reserve_id),
|
|
3180
|
+
paused: decodeFromFieldsWithTypes('bool', item.fields.paused),
|
|
1980
3181
|
});
|
|
1981
3182
|
}
|
|
1982
3183
|
static fromBcs(data) {
|
|
1983
|
-
return
|
|
3184
|
+
return ReservePauseEvent.fromFields(ReservePauseEvent.bcs.parse(data));
|
|
1984
3185
|
}
|
|
1985
3186
|
toJSONField() {
|
|
1986
3187
|
return {
|
|
1987
3188
|
lendingMarketId: this.lendingMarketId,
|
|
1988
|
-
coinType: this.coinType.toJSONField(),
|
|
1989
3189
|
reserveId: this.reserveId,
|
|
1990
|
-
|
|
1991
|
-
liquidityAmount: this.liquidityAmount.toString(),
|
|
3190
|
+
paused: this.paused,
|
|
1992
3191
|
};
|
|
1993
3192
|
}
|
|
1994
3193
|
toJSON() {
|
|
1995
|
-
return {
|
|
1996
|
-
$typeName: this.$typeName,
|
|
1997
|
-
$typeArgs: this.$typeArgs,
|
|
1998
|
-
...this.toJSONField(),
|
|
1999
|
-
};
|
|
3194
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
2000
3195
|
}
|
|
2001
3196
|
static fromJSONField(field) {
|
|
2002
|
-
return
|
|
2003
|
-
lendingMarketId: decodeFromJSONField(
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
obligationId: decodeFromJSONField("address", field.obligationId),
|
|
2007
|
-
liquidityAmount: decodeFromJSONField("u64", field.liquidityAmount),
|
|
3197
|
+
return ReservePauseEvent.reified().new({
|
|
3198
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
3199
|
+
reserveId: decodeFromJSONField('address', field.reserveId),
|
|
3200
|
+
paused: decodeFromJSONField('bool', field.paused),
|
|
2008
3201
|
});
|
|
2009
3202
|
}
|
|
2010
3203
|
static fromJSON(json) {
|
|
2011
|
-
if (json.$typeName !==
|
|
2012
|
-
throw new Error(
|
|
3204
|
+
if (json.$typeName !== ReservePauseEvent.$typeName) {
|
|
3205
|
+
throw new Error(`not a ReservePauseEvent json object: expected '${ReservePauseEvent.$typeName}' but got '${json.$typeName}'`);
|
|
2013
3206
|
}
|
|
2014
|
-
return
|
|
3207
|
+
return ReservePauseEvent.fromJSONField(json);
|
|
3208
|
+
}
|
|
3209
|
+
static fromCoreObject(obj) {
|
|
3210
|
+
if (!isReservePauseEvent(obj.type)) {
|
|
3211
|
+
throw new Error(`object at ${obj.objectId} is not a ReservePauseEvent object`);
|
|
3212
|
+
}
|
|
3213
|
+
return ReservePauseEvent.fromBcs(obj.content);
|
|
2015
3214
|
}
|
|
2016
3215
|
static async fetch(client, id) {
|
|
2017
|
-
const { object } = await client.getObject({
|
|
2018
|
-
|
|
2019
|
-
|
|
3216
|
+
const { object } = await client.core.getObject({
|
|
3217
|
+
objectId: id,
|
|
3218
|
+
include: { content: true },
|
|
3219
|
+
});
|
|
3220
|
+
if (!isReservePauseEvent(object.type)) {
|
|
3221
|
+
throw new Error(`object at id ${id} is not a ReservePauseEvent object`);
|
|
2020
3222
|
}
|
|
2021
|
-
return
|
|
3223
|
+
return ReservePauseEvent.fromBcs(object.content);
|
|
2022
3224
|
}
|
|
2023
3225
|
}
|
|
2024
|
-
/* ==============================
|
|
2025
|
-
export function
|
|
3226
|
+
/* ============================== PauseCapRotatedEvent =============================== */
|
|
3227
|
+
export function isPauseCapRotatedEvent(type) {
|
|
2026
3228
|
type = compressSuiType(type);
|
|
2027
|
-
return type
|
|
3229
|
+
return type
|
|
3230
|
+
=== `${getTypeOrigin('suilend', 'lending_market::PauseCapRotatedEvent')}::lending_market::PauseCapRotatedEvent`;
|
|
2028
3231
|
}
|
|
2029
|
-
export class
|
|
3232
|
+
export class PauseCapRotatedEvent {
|
|
2030
3233
|
__StructClass = true;
|
|
2031
|
-
static $typeName
|
|
3234
|
+
static get $typeName() {
|
|
3235
|
+
return `${getTypeOrigin('suilend', 'lending_market::PauseCapRotatedEvent')}::lending_market::PauseCapRotatedEvent`;
|
|
3236
|
+
}
|
|
2032
3237
|
static $numTypeParams = 0;
|
|
2033
3238
|
static $isPhantom = [];
|
|
2034
|
-
$typeName =
|
|
3239
|
+
$typeName = PauseCapRotatedEvent.$typeName;
|
|
2035
3240
|
$fullTypeName;
|
|
2036
3241
|
$typeArgs;
|
|
2037
|
-
$isPhantom =
|
|
3242
|
+
$isPhantom = PauseCapRotatedEvent.$isPhantom;
|
|
2038
3243
|
lendingMarketId;
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
obligationId;
|
|
2042
|
-
ctokenAmount;
|
|
3244
|
+
newCapId;
|
|
3245
|
+
generation;
|
|
2043
3246
|
constructor(typeArgs, fields) {
|
|
2044
|
-
this.$fullTypeName = composeSuiType(
|
|
3247
|
+
this.$fullTypeName = composeSuiType(PauseCapRotatedEvent.$typeName, ...typeArgs);
|
|
2045
3248
|
this.$typeArgs = typeArgs;
|
|
2046
3249
|
this.lendingMarketId = fields.lendingMarketId;
|
|
2047
|
-
this.
|
|
2048
|
-
this.
|
|
2049
|
-
this.obligationId = fields.obligationId;
|
|
2050
|
-
this.ctokenAmount = fields.ctokenAmount;
|
|
3250
|
+
this.newCapId = fields.newCapId;
|
|
3251
|
+
this.generation = fields.generation;
|
|
2051
3252
|
}
|
|
2052
3253
|
static reified() {
|
|
3254
|
+
const reifiedBcs = PauseCapRotatedEvent.bcs;
|
|
2053
3255
|
return {
|
|
2054
|
-
typeName
|
|
2055
|
-
|
|
3256
|
+
get typeName() {
|
|
3257
|
+
return PauseCapRotatedEvent.$typeName;
|
|
3258
|
+
},
|
|
3259
|
+
get fullTypeName() {
|
|
3260
|
+
return composeSuiType(PauseCapRotatedEvent.$typeName, ...[]);
|
|
3261
|
+
},
|
|
2056
3262
|
typeArgs: [],
|
|
2057
|
-
isPhantom:
|
|
3263
|
+
isPhantom: PauseCapRotatedEvent.$isPhantom,
|
|
2058
3264
|
reifiedTypeArgs: [],
|
|
2059
|
-
fromFields: (fields) =>
|
|
2060
|
-
fromFieldsWithTypes: (item) =>
|
|
2061
|
-
fromBcs: (data) =>
|
|
2062
|
-
bcs:
|
|
2063
|
-
fromJSONField: (field) =>
|
|
2064
|
-
fromJSON: (json) =>
|
|
2065
|
-
|
|
3265
|
+
fromFields: (fields) => PauseCapRotatedEvent.fromFields(fields),
|
|
3266
|
+
fromFieldsWithTypes: (item) => PauseCapRotatedEvent.fromFieldsWithTypes(item),
|
|
3267
|
+
fromBcs: (data) => PauseCapRotatedEvent.fromFields(reifiedBcs.parse(data)),
|
|
3268
|
+
bcs: reifiedBcs,
|
|
3269
|
+
fromJSONField: (field) => PauseCapRotatedEvent.fromJSONField(field),
|
|
3270
|
+
fromJSON: (json) => PauseCapRotatedEvent.fromJSON(json),
|
|
3271
|
+
fromCoreObject: (obj) => PauseCapRotatedEvent.fromCoreObject(obj),
|
|
3272
|
+
fetch: async (client, id) => PauseCapRotatedEvent.fetch(client, id),
|
|
2066
3273
|
new: (fields) => {
|
|
2067
|
-
return new
|
|
3274
|
+
return new PauseCapRotatedEvent([], fields);
|
|
2068
3275
|
},
|
|
2069
|
-
kind:
|
|
3276
|
+
kind: 'StructClassReified',
|
|
2070
3277
|
};
|
|
2071
3278
|
}
|
|
2072
3279
|
static get r() {
|
|
2073
|
-
return
|
|
3280
|
+
return PauseCapRotatedEvent.reified();
|
|
2074
3281
|
}
|
|
2075
3282
|
static phantom() {
|
|
2076
|
-
return phantom(
|
|
3283
|
+
return phantom(PauseCapRotatedEvent.reified());
|
|
2077
3284
|
}
|
|
2078
3285
|
static get p() {
|
|
2079
|
-
return
|
|
3286
|
+
return PauseCapRotatedEvent.phantom();
|
|
2080
3287
|
}
|
|
2081
|
-
static
|
|
2082
|
-
return bcs.struct(
|
|
2083
|
-
lending_market_id: bcs
|
|
2084
|
-
.bytes(32)
|
|
2085
|
-
.transform({
|
|
2086
|
-
input: (val) => fromHex(val),
|
|
2087
|
-
output: (val) => toHex(val),
|
|
2088
|
-
}),
|
|
2089
|
-
coin_type: TypeName.bcs,
|
|
2090
|
-
reserve_id: bcs
|
|
2091
|
-
.bytes(32)
|
|
2092
|
-
.transform({
|
|
3288
|
+
static instantiateBcs() {
|
|
3289
|
+
return bcs.struct('PauseCapRotatedEvent', {
|
|
3290
|
+
lending_market_id: bcs.bytes(32).transform({
|
|
2093
3291
|
input: (val) => fromHex(val),
|
|
2094
3292
|
output: (val) => toHex(val),
|
|
2095
3293
|
}),
|
|
2096
|
-
|
|
2097
|
-
.bytes(32)
|
|
2098
|
-
.transform({
|
|
3294
|
+
new_cap_id: bcs.bytes(32).transform({
|
|
2099
3295
|
input: (val) => fromHex(val),
|
|
2100
3296
|
output: (val) => toHex(val),
|
|
2101
3297
|
}),
|
|
2102
|
-
|
|
3298
|
+
generation: bcs.u64(),
|
|
2103
3299
|
});
|
|
2104
3300
|
}
|
|
3301
|
+
static cachedBcs = null;
|
|
3302
|
+
static get bcs() {
|
|
3303
|
+
if (!PauseCapRotatedEvent.cachedBcs) {
|
|
3304
|
+
PauseCapRotatedEvent.cachedBcs = PauseCapRotatedEvent.instantiateBcs();
|
|
3305
|
+
}
|
|
3306
|
+
return PauseCapRotatedEvent.cachedBcs;
|
|
3307
|
+
}
|
|
2105
3308
|
static fromFields(fields) {
|
|
2106
|
-
return
|
|
2107
|
-
lendingMarketId: decodeFromFields(
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
obligationId: decodeFromFields("address", fields.obligation_id),
|
|
2111
|
-
ctokenAmount: decodeFromFields("u64", fields.ctoken_amount),
|
|
3309
|
+
return PauseCapRotatedEvent.reified().new({
|
|
3310
|
+
lendingMarketId: decodeFromFields('address', fields.lending_market_id),
|
|
3311
|
+
newCapId: decodeFromFields('address', fields.new_cap_id),
|
|
3312
|
+
generation: decodeFromFields('u64', fields.generation),
|
|
2112
3313
|
});
|
|
2113
3314
|
}
|
|
2114
3315
|
static fromFieldsWithTypes(item) {
|
|
2115
|
-
if (!
|
|
2116
|
-
throw new Error(
|
|
3316
|
+
if (!isPauseCapRotatedEvent(item.type)) {
|
|
3317
|
+
throw new Error('not a PauseCapRotatedEvent type');
|
|
2117
3318
|
}
|
|
2118
|
-
return
|
|
2119
|
-
lendingMarketId: decodeFromFieldsWithTypes(
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
obligationId: decodeFromFieldsWithTypes("address", item.fields.obligation_id),
|
|
2123
|
-
ctokenAmount: decodeFromFieldsWithTypes("u64", item.fields.ctoken_amount),
|
|
3319
|
+
return PauseCapRotatedEvent.reified().new({
|
|
3320
|
+
lendingMarketId: decodeFromFieldsWithTypes('address', item.fields.lending_market_id),
|
|
3321
|
+
newCapId: decodeFromFieldsWithTypes('address', item.fields.new_cap_id),
|
|
3322
|
+
generation: decodeFromFieldsWithTypes('u64', item.fields.generation),
|
|
2124
3323
|
});
|
|
2125
3324
|
}
|
|
2126
3325
|
static fromBcs(data) {
|
|
2127
|
-
return
|
|
3326
|
+
return PauseCapRotatedEvent.fromFields(PauseCapRotatedEvent.bcs.parse(data));
|
|
2128
3327
|
}
|
|
2129
3328
|
toJSONField() {
|
|
2130
3329
|
return {
|
|
2131
3330
|
lendingMarketId: this.lendingMarketId,
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
obligationId: this.obligationId,
|
|
2135
|
-
ctokenAmount: this.ctokenAmount.toString(),
|
|
3331
|
+
newCapId: this.newCapId,
|
|
3332
|
+
generation: this.generation.toString(),
|
|
2136
3333
|
};
|
|
2137
3334
|
}
|
|
2138
3335
|
toJSON() {
|
|
2139
|
-
return {
|
|
2140
|
-
$typeName: this.$typeName,
|
|
2141
|
-
$typeArgs: this.$typeArgs,
|
|
2142
|
-
...this.toJSONField(),
|
|
2143
|
-
};
|
|
3336
|
+
return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
|
|
2144
3337
|
}
|
|
2145
3338
|
static fromJSONField(field) {
|
|
2146
|
-
return
|
|
2147
|
-
lendingMarketId: decodeFromJSONField(
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
obligationId: decodeFromJSONField("address", field.obligationId),
|
|
2151
|
-
ctokenAmount: decodeFromJSONField("u64", field.ctokenAmount),
|
|
3339
|
+
return PauseCapRotatedEvent.reified().new({
|
|
3340
|
+
lendingMarketId: decodeFromJSONField('address', field.lendingMarketId),
|
|
3341
|
+
newCapId: decodeFromJSONField('address', field.newCapId),
|
|
3342
|
+
generation: decodeFromJSONField('u64', field.generation),
|
|
2152
3343
|
});
|
|
2153
3344
|
}
|
|
2154
3345
|
static fromJSON(json) {
|
|
2155
|
-
if (json.$typeName !==
|
|
2156
|
-
throw new Error(
|
|
3346
|
+
if (json.$typeName !== PauseCapRotatedEvent.$typeName) {
|
|
3347
|
+
throw new Error(`not a PauseCapRotatedEvent json object: expected '${PauseCapRotatedEvent.$typeName}' but got '${json.$typeName}'`);
|
|
2157
3348
|
}
|
|
2158
|
-
return
|
|
3349
|
+
return PauseCapRotatedEvent.fromJSONField(json);
|
|
3350
|
+
}
|
|
3351
|
+
static fromCoreObject(obj) {
|
|
3352
|
+
if (!isPauseCapRotatedEvent(obj.type)) {
|
|
3353
|
+
throw new Error(`object at ${obj.objectId} is not a PauseCapRotatedEvent object`);
|
|
3354
|
+
}
|
|
3355
|
+
return PauseCapRotatedEvent.fromBcs(obj.content);
|
|
2159
3356
|
}
|
|
2160
3357
|
static async fetch(client, id) {
|
|
2161
|
-
const { object } = await client.getObject({
|
|
2162
|
-
|
|
2163
|
-
|
|
3358
|
+
const { object } = await client.core.getObject({
|
|
3359
|
+
objectId: id,
|
|
3360
|
+
include: { content: true },
|
|
3361
|
+
});
|
|
3362
|
+
if (!isPauseCapRotatedEvent(object.type)) {
|
|
3363
|
+
throw new Error(`object at id ${id} is not a PauseCapRotatedEvent object`);
|
|
2164
3364
|
}
|
|
2165
|
-
return
|
|
3365
|
+
return PauseCapRotatedEvent.fromBcs(object.content);
|
|
2166
3366
|
}
|
|
2167
3367
|
}
|