@suilend/sdk 15.0.0 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/_generated/_dependencies/pyth-2/price-identifier/structs.d.ts +5 -1
  2. package/_generated/_dependencies/std/ascii/structs.d.ts +8 -2
  3. package/_generated/_dependencies/std/option/structs.d.ts +6 -1
  4. package/_generated/_dependencies/std/type-name/structs.d.ts +7 -1
  5. package/_generated/_dependencies/sui/bag/structs.d.ts +8 -1
  6. package/_generated/_dependencies/sui/balance/structs.d.ts +6 -2
  7. package/_generated/_dependencies/sui/object/structs.d.ts +8 -2
  8. package/_generated/_dependencies/sui/object-table/structs.d.ts +8 -1
  9. package/_generated/_envs/mainnet.js +39 -3
  10. package/_generated/suilend/cell/structs.d.ts +8 -1
  11. package/_generated/suilend/decimal/structs.d.ts +3 -1
  12. package/_generated/suilend/lending-market/functions.d.ts +185 -64
  13. package/_generated/suilend/lending-market/functions.js +227 -65
  14. package/_generated/suilend/lending-market/structs.d.ts +764 -25
  15. package/_generated/suilend/lending-market/structs.js +491 -3
  16. package/_generated/suilend/liquidity-mining/structs.d.ts +169 -5
  17. package/_generated/suilend/obligation/structs.d.ts +338 -7
  18. package/_generated/suilend/rate-limiter/functions.d.ts +6 -0
  19. package/_generated/suilend/rate-limiter/functions.js +12 -0
  20. package/_generated/suilend/rate-limiter/structs.d.ts +17 -2
  21. package/_generated/suilend/reserve/structs.d.ts +664 -17
  22. package/_generated/suilend/reserve/structs.js +623 -4
  23. package/_generated/suilend/reserve-config/functions.d.ts +64 -9
  24. package/_generated/suilend/reserve-config/functions.js +88 -11
  25. package/_generated/suilend/reserve-config/structs.d.ts +45 -3
  26. package/package.json +1 -1
@@ -650,9 +650,9 @@ export function isEmergencyPauseCap(type) {
650
650
  /**
651
651
  * No `store`: can only be held directly by an address, never wrapped into another
652
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.
653
+ * compile-time incapable of minting an `ObligationOwnerCap`, changing price feeds, or
654
+ * touching reserve config beyond lowering a protocol liquidation fee. Revocation is
655
+ * minting the next generation via `new_pause_cap`, no package upgrade needed.
656
656
  */
657
657
  export class EmergencyPauseCap {
658
658
  __StructClass = true;
@@ -1054,6 +1054,372 @@ export class PauseKey {
1054
1054
  return PauseKey.fromBcs(object.content);
1055
1055
  }
1056
1056
  }
1057
+ /* ============================== OperationHoldKey =============================== */
1058
+ export function isOperationHoldKey(type) {
1059
+ type = compressSuiType(type);
1060
+ return type
1061
+ === `${getTypeOrigin('suilend', 'lending_market::OperationHoldKey')}::lending_market::OperationHoldKey`;
1062
+ }
1063
+ export class OperationHoldKey {
1064
+ __StructClass = true;
1065
+ static get $typeName() {
1066
+ return `${getTypeOrigin('suilend', 'lending_market::OperationHoldKey')}::lending_market::OperationHoldKey`;
1067
+ }
1068
+ static $numTypeParams = 0;
1069
+ static $isPhantom = [];
1070
+ $typeName = OperationHoldKey.$typeName;
1071
+ $fullTypeName;
1072
+ $typeArgs;
1073
+ $isPhantom = OperationHoldKey.$isPhantom;
1074
+ operation;
1075
+ constructor(typeArgs, fields) {
1076
+ this.$fullTypeName = composeSuiType(OperationHoldKey.$typeName, ...typeArgs);
1077
+ this.$typeArgs = typeArgs;
1078
+ this.operation = fields.operation;
1079
+ }
1080
+ static reified() {
1081
+ const reifiedBcs = OperationHoldKey.bcs;
1082
+ return {
1083
+ get typeName() {
1084
+ return OperationHoldKey.$typeName;
1085
+ },
1086
+ get fullTypeName() {
1087
+ return composeSuiType(OperationHoldKey.$typeName, ...[]);
1088
+ },
1089
+ typeArgs: [],
1090
+ isPhantom: OperationHoldKey.$isPhantom,
1091
+ reifiedTypeArgs: [],
1092
+ fromFields: (fields) => OperationHoldKey.fromFields(fields),
1093
+ fromFieldsWithTypes: (item) => OperationHoldKey.fromFieldsWithTypes(item),
1094
+ fromBcs: (data) => OperationHoldKey.fromFields(reifiedBcs.parse(data)),
1095
+ bcs: reifiedBcs,
1096
+ fromJSONField: (field) => OperationHoldKey.fromJSONField(field),
1097
+ fromJSON: (json) => OperationHoldKey.fromJSON(json),
1098
+ fromCoreObject: (obj) => OperationHoldKey.fromCoreObject(obj),
1099
+ fetch: async (client, id) => OperationHoldKey.fetch(client, id),
1100
+ new: (fields) => {
1101
+ return new OperationHoldKey([], fields);
1102
+ },
1103
+ kind: 'StructClassReified',
1104
+ };
1105
+ }
1106
+ static get r() {
1107
+ return OperationHoldKey.reified();
1108
+ }
1109
+ static phantom() {
1110
+ return phantom(OperationHoldKey.reified());
1111
+ }
1112
+ static get p() {
1113
+ return OperationHoldKey.phantom();
1114
+ }
1115
+ static instantiateBcs() {
1116
+ return bcs.struct('OperationHoldKey', {
1117
+ operation: bcs.u8(),
1118
+ });
1119
+ }
1120
+ static cachedBcs = null;
1121
+ static get bcs() {
1122
+ if (!OperationHoldKey.cachedBcs) {
1123
+ OperationHoldKey.cachedBcs = OperationHoldKey.instantiateBcs();
1124
+ }
1125
+ return OperationHoldKey.cachedBcs;
1126
+ }
1127
+ static fromFields(fields) {
1128
+ return OperationHoldKey.reified().new({
1129
+ operation: decodeFromFields('u8', fields.operation),
1130
+ });
1131
+ }
1132
+ static fromFieldsWithTypes(item) {
1133
+ if (!isOperationHoldKey(item.type)) {
1134
+ throw new Error('not a OperationHoldKey type');
1135
+ }
1136
+ return OperationHoldKey.reified().new({
1137
+ operation: decodeFromFieldsWithTypes('u8', item.fields.operation),
1138
+ });
1139
+ }
1140
+ static fromBcs(data) {
1141
+ return OperationHoldKey.fromFields(OperationHoldKey.bcs.parse(data));
1142
+ }
1143
+ toJSONField() {
1144
+ return {
1145
+ operation: this.operation,
1146
+ };
1147
+ }
1148
+ toJSON() {
1149
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
1150
+ }
1151
+ static fromJSONField(field) {
1152
+ return OperationHoldKey.reified().new({
1153
+ operation: decodeFromJSONField('u8', field.operation),
1154
+ });
1155
+ }
1156
+ static fromJSON(json) {
1157
+ if (json.$typeName !== OperationHoldKey.$typeName) {
1158
+ throw new Error(`not a OperationHoldKey json object: expected '${OperationHoldKey.$typeName}' but got '${json.$typeName}'`);
1159
+ }
1160
+ return OperationHoldKey.fromJSONField(json);
1161
+ }
1162
+ static fromCoreObject(obj) {
1163
+ if (!isOperationHoldKey(obj.type)) {
1164
+ throw new Error(`object at ${obj.objectId} is not a OperationHoldKey object`);
1165
+ }
1166
+ return OperationHoldKey.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 (!isOperationHoldKey(object.type)) {
1174
+ throw new Error(`object at id ${id} is not a OperationHoldKey object`);
1175
+ }
1176
+ return OperationHoldKey.fromBcs(object.content);
1177
+ }
1178
+ }
1179
+ /* ============================== OperationHoldGenerationKey =============================== */
1180
+ export function isOperationHoldGenerationKey(type) {
1181
+ type = compressSuiType(type);
1182
+ return type
1183
+ === `${getTypeOrigin('suilend', 'lending_market::OperationHoldGenerationKey')}::lending_market::OperationHoldGenerationKey`;
1184
+ }
1185
+ export class OperationHoldGenerationKey {
1186
+ __StructClass = true;
1187
+ static get $typeName() {
1188
+ return `${getTypeOrigin('suilend', 'lending_market::OperationHoldGenerationKey')}::lending_market::OperationHoldGenerationKey`;
1189
+ }
1190
+ static $numTypeParams = 0;
1191
+ static $isPhantom = [];
1192
+ $typeName = OperationHoldGenerationKey.$typeName;
1193
+ $fullTypeName;
1194
+ $typeArgs;
1195
+ $isPhantom = OperationHoldGenerationKey.$isPhantom;
1196
+ operation;
1197
+ constructor(typeArgs, fields) {
1198
+ this.$fullTypeName = composeSuiType(OperationHoldGenerationKey.$typeName, ...typeArgs);
1199
+ this.$typeArgs = typeArgs;
1200
+ this.operation = fields.operation;
1201
+ }
1202
+ static reified() {
1203
+ const reifiedBcs = OperationHoldGenerationKey.bcs;
1204
+ return {
1205
+ get typeName() {
1206
+ return OperationHoldGenerationKey.$typeName;
1207
+ },
1208
+ get fullTypeName() {
1209
+ return composeSuiType(OperationHoldGenerationKey.$typeName, ...[]);
1210
+ },
1211
+ typeArgs: [],
1212
+ isPhantom: OperationHoldGenerationKey.$isPhantom,
1213
+ reifiedTypeArgs: [],
1214
+ fromFields: (fields) => OperationHoldGenerationKey.fromFields(fields),
1215
+ fromFieldsWithTypes: (item) => OperationHoldGenerationKey.fromFieldsWithTypes(item),
1216
+ fromBcs: (data) => OperationHoldGenerationKey.fromFields(reifiedBcs.parse(data)),
1217
+ bcs: reifiedBcs,
1218
+ fromJSONField: (field) => OperationHoldGenerationKey.fromJSONField(field),
1219
+ fromJSON: (json) => OperationHoldGenerationKey.fromJSON(json),
1220
+ fromCoreObject: (obj) => OperationHoldGenerationKey.fromCoreObject(obj),
1221
+ fetch: async (client, id) => OperationHoldGenerationKey.fetch(client, id),
1222
+ new: (fields) => {
1223
+ return new OperationHoldGenerationKey([], fields);
1224
+ },
1225
+ kind: 'StructClassReified',
1226
+ };
1227
+ }
1228
+ static get r() {
1229
+ return OperationHoldGenerationKey.reified();
1230
+ }
1231
+ static phantom() {
1232
+ return phantom(OperationHoldGenerationKey.reified());
1233
+ }
1234
+ static get p() {
1235
+ return OperationHoldGenerationKey.phantom();
1236
+ }
1237
+ static instantiateBcs() {
1238
+ return bcs.struct('OperationHoldGenerationKey', {
1239
+ operation: bcs.u8(),
1240
+ });
1241
+ }
1242
+ static cachedBcs = null;
1243
+ static get bcs() {
1244
+ if (!OperationHoldGenerationKey.cachedBcs) {
1245
+ OperationHoldGenerationKey.cachedBcs = OperationHoldGenerationKey.instantiateBcs();
1246
+ }
1247
+ return OperationHoldGenerationKey.cachedBcs;
1248
+ }
1249
+ static fromFields(fields) {
1250
+ return OperationHoldGenerationKey.reified().new({
1251
+ operation: decodeFromFields('u8', fields.operation),
1252
+ });
1253
+ }
1254
+ static fromFieldsWithTypes(item) {
1255
+ if (!isOperationHoldGenerationKey(item.type)) {
1256
+ throw new Error('not a OperationHoldGenerationKey type');
1257
+ }
1258
+ return OperationHoldGenerationKey.reified().new({
1259
+ operation: decodeFromFieldsWithTypes('u8', item.fields.operation),
1260
+ });
1261
+ }
1262
+ static fromBcs(data) {
1263
+ return OperationHoldGenerationKey.fromFields(OperationHoldGenerationKey.bcs.parse(data));
1264
+ }
1265
+ toJSONField() {
1266
+ return {
1267
+ operation: this.operation,
1268
+ };
1269
+ }
1270
+ toJSON() {
1271
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
1272
+ }
1273
+ static fromJSONField(field) {
1274
+ return OperationHoldGenerationKey.reified().new({
1275
+ operation: decodeFromJSONField('u8', field.operation),
1276
+ });
1277
+ }
1278
+ static fromJSON(json) {
1279
+ if (json.$typeName !== OperationHoldGenerationKey.$typeName) {
1280
+ throw new Error(`not a OperationHoldGenerationKey json object: expected '${OperationHoldGenerationKey.$typeName}' but got '${json.$typeName}'`);
1281
+ }
1282
+ return OperationHoldGenerationKey.fromJSONField(json);
1283
+ }
1284
+ static fromCoreObject(obj) {
1285
+ if (!isOperationHoldGenerationKey(obj.type)) {
1286
+ throw new Error(`object at ${obj.objectId} is not a OperationHoldGenerationKey object`);
1287
+ }
1288
+ return OperationHoldGenerationKey.fromBcs(obj.content);
1289
+ }
1290
+ static async fetch(client, id) {
1291
+ const { object } = await client.core.getObject({
1292
+ objectId: id,
1293
+ include: { content: true },
1294
+ });
1295
+ if (!isOperationHoldGenerationKey(object.type)) {
1296
+ throw new Error(`object at id ${id} is not a OperationHoldGenerationKey object`);
1297
+ }
1298
+ return OperationHoldGenerationKey.fromBcs(object.content);
1299
+ }
1300
+ }
1301
+ /* ============================== WithdrawHoldExemptKey =============================== */
1302
+ export function isWithdrawHoldExemptKey(type) {
1303
+ type = compressSuiType(type);
1304
+ return type
1305
+ === `${getTypeOrigin('suilend', 'lending_market::WithdrawHoldExemptKey')}::lending_market::WithdrawHoldExemptKey`;
1306
+ }
1307
+ export class WithdrawHoldExemptKey {
1308
+ __StructClass = true;
1309
+ static get $typeName() {
1310
+ return `${getTypeOrigin('suilend', 'lending_market::WithdrawHoldExemptKey')}::lending_market::WithdrawHoldExemptKey`;
1311
+ }
1312
+ static $numTypeParams = 0;
1313
+ static $isPhantom = [];
1314
+ $typeName = WithdrawHoldExemptKey.$typeName;
1315
+ $fullTypeName;
1316
+ $typeArgs;
1317
+ $isPhantom = WithdrawHoldExemptKey.$isPhantom;
1318
+ obligationId;
1319
+ constructor(typeArgs, fields) {
1320
+ this.$fullTypeName = composeSuiType(WithdrawHoldExemptKey.$typeName, ...typeArgs);
1321
+ this.$typeArgs = typeArgs;
1322
+ this.obligationId = fields.obligationId;
1323
+ }
1324
+ static reified() {
1325
+ const reifiedBcs = WithdrawHoldExemptKey.bcs;
1326
+ return {
1327
+ get typeName() {
1328
+ return WithdrawHoldExemptKey.$typeName;
1329
+ },
1330
+ get fullTypeName() {
1331
+ return composeSuiType(WithdrawHoldExemptKey.$typeName, ...[]);
1332
+ },
1333
+ typeArgs: [],
1334
+ isPhantom: WithdrawHoldExemptKey.$isPhantom,
1335
+ reifiedTypeArgs: [],
1336
+ fromFields: (fields) => WithdrawHoldExemptKey.fromFields(fields),
1337
+ fromFieldsWithTypes: (item) => WithdrawHoldExemptKey.fromFieldsWithTypes(item),
1338
+ fromBcs: (data) => WithdrawHoldExemptKey.fromFields(reifiedBcs.parse(data)),
1339
+ bcs: reifiedBcs,
1340
+ fromJSONField: (field) => WithdrawHoldExemptKey.fromJSONField(field),
1341
+ fromJSON: (json) => WithdrawHoldExemptKey.fromJSON(json),
1342
+ fromCoreObject: (obj) => WithdrawHoldExemptKey.fromCoreObject(obj),
1343
+ fetch: async (client, id) => WithdrawHoldExemptKey.fetch(client, id),
1344
+ new: (fields) => {
1345
+ return new WithdrawHoldExemptKey([], fields);
1346
+ },
1347
+ kind: 'StructClassReified',
1348
+ };
1349
+ }
1350
+ static get r() {
1351
+ return WithdrawHoldExemptKey.reified();
1352
+ }
1353
+ static phantom() {
1354
+ return phantom(WithdrawHoldExemptKey.reified());
1355
+ }
1356
+ static get p() {
1357
+ return WithdrawHoldExemptKey.phantom();
1358
+ }
1359
+ static instantiateBcs() {
1360
+ return bcs.struct('WithdrawHoldExemptKey', {
1361
+ obligation_id: ID.bcs,
1362
+ });
1363
+ }
1364
+ static cachedBcs = null;
1365
+ static get bcs() {
1366
+ if (!WithdrawHoldExemptKey.cachedBcs) {
1367
+ WithdrawHoldExemptKey.cachedBcs = WithdrawHoldExemptKey.instantiateBcs();
1368
+ }
1369
+ return WithdrawHoldExemptKey.cachedBcs;
1370
+ }
1371
+ static fromFields(fields) {
1372
+ return WithdrawHoldExemptKey.reified().new({
1373
+ obligationId: decodeFromFields(ID.reified(), fields.obligation_id),
1374
+ });
1375
+ }
1376
+ static fromFieldsWithTypes(item) {
1377
+ if (!isWithdrawHoldExemptKey(item.type)) {
1378
+ throw new Error('not a WithdrawHoldExemptKey type');
1379
+ }
1380
+ return WithdrawHoldExemptKey.reified().new({
1381
+ obligationId: decodeFromFieldsWithTypes(ID.reified(), item.fields.obligation_id),
1382
+ });
1383
+ }
1384
+ static fromBcs(data) {
1385
+ return WithdrawHoldExemptKey.fromFields(WithdrawHoldExemptKey.bcs.parse(data));
1386
+ }
1387
+ toJSONField() {
1388
+ return {
1389
+ obligationId: this.obligationId,
1390
+ };
1391
+ }
1392
+ toJSON() {
1393
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
1394
+ }
1395
+ static fromJSONField(field) {
1396
+ return WithdrawHoldExemptKey.reified().new({
1397
+ obligationId: decodeFromJSONField(ID.reified(), field.obligationId),
1398
+ });
1399
+ }
1400
+ static fromJSON(json) {
1401
+ if (json.$typeName !== WithdrawHoldExemptKey.$typeName) {
1402
+ throw new Error(`not a WithdrawHoldExemptKey json object: expected '${WithdrawHoldExemptKey.$typeName}' but got '${json.$typeName}'`);
1403
+ }
1404
+ return WithdrawHoldExemptKey.fromJSONField(json);
1405
+ }
1406
+ static fromCoreObject(obj) {
1407
+ if (!isWithdrawHoldExemptKey(obj.type)) {
1408
+ throw new Error(`object at ${obj.objectId} is not a WithdrawHoldExemptKey object`);
1409
+ }
1410
+ return WithdrawHoldExemptKey.fromBcs(obj.content);
1411
+ }
1412
+ static async fetch(client, id) {
1413
+ const { object } = await client.core.getObject({
1414
+ objectId: id,
1415
+ include: { content: true },
1416
+ });
1417
+ if (!isWithdrawHoldExemptKey(object.type)) {
1418
+ throw new Error(`object at id ${id} is not a WithdrawHoldExemptKey object`);
1419
+ }
1420
+ return WithdrawHoldExemptKey.fromBcs(object.content);
1421
+ }
1422
+ }
1057
1423
  /* ============================== PauseCapGenerationKey =============================== */
1058
1424
  export function isPauseCapGenerationKey(type) {
1059
1425
  type = compressSuiType(type);
@@ -1462,6 +1828,128 @@ export class RateLimiterExemption {
1462
1828
  return RateLimiterExemption.fromBcs(typeArgs, object.content);
1463
1829
  }
1464
1830
  }
1831
+ /* ============================== AdminWitness =============================== */
1832
+ export function isAdminWitness(type) {
1833
+ type = compressSuiType(type);
1834
+ return type
1835
+ === `${getTypeOrigin('suilend', 'lending_market::AdminWitness')}::lending_market::AdminWitness`;
1836
+ }
1837
+ export class AdminWitness {
1838
+ __StructClass = true;
1839
+ static get $typeName() {
1840
+ return `${getTypeOrigin('suilend', 'lending_market::AdminWitness')}::lending_market::AdminWitness`;
1841
+ }
1842
+ static $numTypeParams = 0;
1843
+ static $isPhantom = [];
1844
+ $typeName = AdminWitness.$typeName;
1845
+ $fullTypeName;
1846
+ $typeArgs;
1847
+ $isPhantom = AdminWitness.$isPhantom;
1848
+ dummyField;
1849
+ constructor(typeArgs, fields) {
1850
+ this.$fullTypeName = composeSuiType(AdminWitness.$typeName, ...typeArgs);
1851
+ this.$typeArgs = typeArgs;
1852
+ this.dummyField = fields.dummyField;
1853
+ }
1854
+ static reified() {
1855
+ const reifiedBcs = AdminWitness.bcs;
1856
+ return {
1857
+ get typeName() {
1858
+ return AdminWitness.$typeName;
1859
+ },
1860
+ get fullTypeName() {
1861
+ return composeSuiType(AdminWitness.$typeName, ...[]);
1862
+ },
1863
+ typeArgs: [],
1864
+ isPhantom: AdminWitness.$isPhantom,
1865
+ reifiedTypeArgs: [],
1866
+ fromFields: (fields) => AdminWitness.fromFields(fields),
1867
+ fromFieldsWithTypes: (item) => AdminWitness.fromFieldsWithTypes(item),
1868
+ fromBcs: (data) => AdminWitness.fromFields(reifiedBcs.parse(data)),
1869
+ bcs: reifiedBcs,
1870
+ fromJSONField: (field) => AdminWitness.fromJSONField(field),
1871
+ fromJSON: (json) => AdminWitness.fromJSON(json),
1872
+ fromCoreObject: (obj) => AdminWitness.fromCoreObject(obj),
1873
+ fetch: async (client, id) => AdminWitness.fetch(client, id),
1874
+ new: (fields) => {
1875
+ return new AdminWitness([], fields);
1876
+ },
1877
+ kind: 'StructClassReified',
1878
+ };
1879
+ }
1880
+ static get r() {
1881
+ return AdminWitness.reified();
1882
+ }
1883
+ static phantom() {
1884
+ return phantom(AdminWitness.reified());
1885
+ }
1886
+ static get p() {
1887
+ return AdminWitness.phantom();
1888
+ }
1889
+ static instantiateBcs() {
1890
+ return bcs.struct('AdminWitness', {
1891
+ dummy_field: bcs.bool(),
1892
+ });
1893
+ }
1894
+ static cachedBcs = null;
1895
+ static get bcs() {
1896
+ if (!AdminWitness.cachedBcs) {
1897
+ AdminWitness.cachedBcs = AdminWitness.instantiateBcs();
1898
+ }
1899
+ return AdminWitness.cachedBcs;
1900
+ }
1901
+ static fromFields(fields) {
1902
+ return AdminWitness.reified().new({
1903
+ dummyField: decodeFromFields('bool', fields.dummy_field),
1904
+ });
1905
+ }
1906
+ static fromFieldsWithTypes(item) {
1907
+ if (!isAdminWitness(item.type)) {
1908
+ throw new Error('not a AdminWitness type');
1909
+ }
1910
+ return AdminWitness.reified().new({
1911
+ dummyField: decodeFromFieldsWithTypes('bool', item.fields.dummy_field),
1912
+ });
1913
+ }
1914
+ static fromBcs(data) {
1915
+ return AdminWitness.fromFields(AdminWitness.bcs.parse(data));
1916
+ }
1917
+ toJSONField() {
1918
+ return {
1919
+ dummyField: this.dummyField,
1920
+ };
1921
+ }
1922
+ toJSON() {
1923
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
1924
+ }
1925
+ static fromJSONField(field) {
1926
+ return AdminWitness.reified().new({
1927
+ dummyField: decodeFromJSONField('bool', field.dummyField),
1928
+ });
1929
+ }
1930
+ static fromJSON(json) {
1931
+ if (json.$typeName !== AdminWitness.$typeName) {
1932
+ throw new Error(`not a AdminWitness json object: expected '${AdminWitness.$typeName}' but got '${json.$typeName}'`);
1933
+ }
1934
+ return AdminWitness.fromJSONField(json);
1935
+ }
1936
+ static fromCoreObject(obj) {
1937
+ if (!isAdminWitness(obj.type)) {
1938
+ throw new Error(`object at ${obj.objectId} is not a AdminWitness object`);
1939
+ }
1940
+ return AdminWitness.fromBcs(obj.content);
1941
+ }
1942
+ static async fetch(client, id) {
1943
+ const { object } = await client.core.getObject({
1944
+ objectId: id,
1945
+ include: { content: true },
1946
+ });
1947
+ if (!isAdminWitness(object.type)) {
1948
+ throw new Error(`object at id ${id} is not a AdminWitness object`);
1949
+ }
1950
+ return AdminWitness.fromBcs(object.content);
1951
+ }
1952
+ }
1465
1953
  /* ============================== MintEvent =============================== */
1466
1954
  export function isMintEvent(type) {
1467
1955
  type = compressSuiType(type);