@sentio/sdk 2.13.0-rc.7 → 2.13.0-rc.8

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 (69) hide show
  1. package/lib/aptos/builtin/0x1.d.ts +1076 -431
  2. package/lib/aptos/builtin/0x1.js +1937 -1457
  3. package/lib/aptos/builtin/0x1.js.map +1 -1
  4. package/lib/aptos/builtin/0x3.d.ts +206 -83
  5. package/lib/aptos/builtin/0x3.js +371 -332
  6. package/lib/aptos/builtin/0x3.js.map +1 -1
  7. package/lib/aptos/codegen/codegen.d.ts +1 -1
  8. package/lib/aptos/codegen/codegen.js +2 -2
  9. package/lib/aptos/codegen/codegen.js.map +1 -1
  10. package/lib/aptos/codegen/run.js +1 -1
  11. package/lib/aptos/codegen/run.js.map +1 -1
  12. package/lib/aptos/index.d.ts +1 -0
  13. package/lib/aptos/index.js +1 -0
  14. package/lib/aptos/index.js.map +1 -1
  15. package/lib/aptos/models.d.ts +3 -11
  16. package/lib/aptos/models.js.map +1 -1
  17. package/lib/aptos/move-coder.d.ts +3 -2
  18. package/lib/aptos/move-coder.js +11 -4
  19. package/lib/aptos/move-coder.js.map +1 -1
  20. package/lib/move/abstract-codegen.d.ts +2 -2
  21. package/lib/move/abstract-codegen.js +36 -11
  22. package/lib/move/abstract-codegen.js.map +1 -1
  23. package/lib/move/abstract-move-coder.d.ts +3 -7
  24. package/lib/move/abstract-move-coder.js +3 -3
  25. package/lib/move/abstract-move-coder.js.map +1 -1
  26. package/lib/move/types.d.ts +22 -1
  27. package/lib/move/types.js +46 -17
  28. package/lib/move/types.js.map +1 -1
  29. package/lib/sui/builtin/0x1.d.ts +31 -12
  30. package/lib/sui/builtin/0x1.js +56 -31
  31. package/lib/sui/builtin/0x1.js.map +1 -1
  32. package/lib/sui/builtin/0x2.d.ts +256 -103
  33. package/lib/sui/builtin/0x2.js +461 -316
  34. package/lib/sui/builtin/0x2.js.map +1 -1
  35. package/lib/sui/builtin/0x3.d.ts +126 -51
  36. package/lib/sui/builtin/0x3.js +227 -271
  37. package/lib/sui/builtin/0x3.js.map +1 -1
  38. package/lib/sui/codegen/codegen.d.ts +1 -1
  39. package/lib/sui/codegen/codegen.js +3 -2
  40. package/lib/sui/codegen/codegen.js.map +1 -1
  41. package/lib/sui/codegen/run.js +1 -1
  42. package/lib/sui/codegen/run.js.map +1 -1
  43. package/lib/sui/index.d.ts +1 -0
  44. package/lib/sui/index.js +1 -0
  45. package/lib/sui/index.js.map +1 -1
  46. package/lib/sui/models.d.ts +3 -11
  47. package/lib/sui/models.js.map +1 -1
  48. package/lib/sui/move-coder.d.ts +5 -5
  49. package/lib/sui/move-coder.js +14 -7
  50. package/lib/sui/move-coder.js.map +1 -1
  51. package/package.json +4 -4
  52. package/src/aptos/builtin/0x1.ts +2688 -447
  53. package/src/aptos/builtin/0x3.ts +506 -84
  54. package/src/aptos/codegen/codegen.ts +7 -2
  55. package/src/aptos/codegen/run.ts +1 -1
  56. package/src/aptos/index.ts +2 -0
  57. package/src/aptos/models.ts +3 -13
  58. package/src/aptos/move-coder.ts +14 -4
  59. package/src/move/abstract-codegen.ts +39 -13
  60. package/src/move/abstract-move-coder.ts +11 -16
  61. package/src/move/types.ts +63 -18
  62. package/src/sui/builtin/0x1.ts +67 -13
  63. package/src/sui/builtin/0x2.ts +649 -103
  64. package/src/sui/builtin/0x3.ts +315 -51
  65. package/src/sui/codegen/codegen.ts +8 -2
  66. package/src/sui/codegen/run.ts +1 -1
  67. package/src/sui/index.ts +1 -0
  68. package/src/sui/models.ts +3 -13
  69. package/src/sui/move-coder.ts +22 -15
@@ -4,7 +4,7 @@
4
4
 
5
5
  /* Generated modules for account 0x3 */
6
6
 
7
- import { CallFilter } from "@sentio/sdk/move";
7
+ import { CallFilter, TypeDescriptor, ANY_TYPE } from "@sentio/sdk/move";
8
8
  import {
9
9
  MoveCoder,
10
10
  defaultMoveCoder,
@@ -70,8 +70,7 @@ export class genesis extends SuiBaseProcessor {
70
70
  }
71
71
 
72
72
  export namespace genesis {
73
- export class GenesisChainParameters {
74
- static TYPE_QNAME = "0x3::genesis::GenesisChainParameters";
73
+ export interface GenesisChainParameters {
75
74
  protocol_version: bigint;
76
75
  chain_start_timestamp_ms: bigint;
77
76
  epoch_duration_ms: bigint;
@@ -86,14 +85,25 @@ export namespace genesis {
86
85
  validator_low_stake_grace_period: bigint;
87
86
  }
88
87
 
88
+ export namespace GenesisChainParameters {
89
+ export const TYPE_QNAME = "0x3::genesis::GenesisChainParameters";
90
+
91
+ const TYPE = new TypeDescriptor<GenesisChainParameters>(
92
+ GenesisChainParameters.TYPE_QNAME
93
+ );
94
+
95
+ export function type(): TypeDescriptor<GenesisChainParameters> {
96
+ return TYPE.apply();
97
+ }
98
+ }
99
+
89
100
  export interface GenesisChainParametersInstance
90
101
  extends TypedEventInstance<GenesisChainParameters> {
91
102
  data_decoded: GenesisChainParameters;
92
103
  type_arguments: [];
93
104
  }
94
105
 
95
- export class GenesisValidatorMetadata {
96
- static TYPE_QNAME = "0x3::genesis::GenesisValidatorMetadata";
106
+ export interface GenesisValidatorMetadata {
97
107
  name: number[];
98
108
  description: number[];
99
109
  image_url: number[];
@@ -111,29 +121,62 @@ export namespace genesis {
111
121
  worker_address: number[];
112
122
  }
113
123
 
124
+ export namespace GenesisValidatorMetadata {
125
+ export const TYPE_QNAME = "0x3::genesis::GenesisValidatorMetadata";
126
+
127
+ const TYPE = new TypeDescriptor<GenesisValidatorMetadata>(
128
+ GenesisValidatorMetadata.TYPE_QNAME
129
+ );
130
+
131
+ export function type(): TypeDescriptor<GenesisValidatorMetadata> {
132
+ return TYPE.apply();
133
+ }
134
+ }
135
+
114
136
  export interface GenesisValidatorMetadataInstance
115
137
  extends TypedEventInstance<GenesisValidatorMetadata> {
116
138
  data_decoded: GenesisValidatorMetadata;
117
139
  type_arguments: [];
118
140
  }
119
141
 
120
- export class TokenAllocation {
121
- static TYPE_QNAME = "0x3::genesis::TokenAllocation";
142
+ export interface TokenAllocation {
122
143
  recipient_address: SuiAddress;
123
144
  amount_mist: bigint;
124
145
  staked_with_validator: _0x1.option.Option<SuiAddress>;
125
146
  }
126
147
 
127
- export class TokenDistributionSchedule {
128
- static TYPE_QNAME = "0x3::genesis::TokenDistributionSchedule";
148
+ export namespace TokenAllocation {
149
+ export const TYPE_QNAME = "0x3::genesis::TokenAllocation";
150
+
151
+ const TYPE = new TypeDescriptor<TokenAllocation>(
152
+ TokenAllocation.TYPE_QNAME
153
+ );
154
+
155
+ export function type(): TypeDescriptor<TokenAllocation> {
156
+ return TYPE.apply();
157
+ }
158
+ }
159
+
160
+ export interface TokenDistributionSchedule {
129
161
  stake_subsidy_fund_mist: bigint;
130
162
  allocations: genesis.TokenAllocation[];
131
163
  }
164
+
165
+ export namespace TokenDistributionSchedule {
166
+ export const TYPE_QNAME = "0x3::genesis::TokenDistributionSchedule";
167
+
168
+ const TYPE = new TypeDescriptor<TokenDistributionSchedule>(
169
+ TokenDistributionSchedule.TYPE_QNAME
170
+ );
171
+
172
+ export function type(): TypeDescriptor<TokenDistributionSchedule> {
173
+ return TYPE.apply();
174
+ }
175
+ }
132
176
  }
133
177
 
134
178
  export namespace stake_subsidy {
135
- export class StakeSubsidy {
136
- static TYPE_QNAME = "0x3::stake_subsidy::StakeSubsidy";
179
+ export interface StakeSubsidy {
137
180
  balance: _0x2.balance.Balance<_0x2.sui.SUI>;
138
181
  distribution_counter: bigint;
139
182
  current_distribution_amount: bigint;
@@ -141,6 +184,16 @@ export namespace stake_subsidy {
141
184
  stake_subsidy_decrease_rate: number;
142
185
  extra_fields: _0x2.bag.Bag;
143
186
  }
187
+
188
+ export namespace StakeSubsidy {
189
+ export const TYPE_QNAME = "0x3::stake_subsidy::StakeSubsidy";
190
+
191
+ const TYPE = new TypeDescriptor<StakeSubsidy>(StakeSubsidy.TYPE_QNAME);
192
+
193
+ export function type(): TypeDescriptor<StakeSubsidy> {
194
+ return TYPE.apply();
195
+ }
196
+ }
144
197
  }
145
198
 
146
199
  export class staking_pool extends SuiBaseProcessor {
@@ -207,28 +260,47 @@ export class staking_pool extends SuiBaseProcessor {
207
260
  }
208
261
 
209
262
  export namespace staking_pool {
210
- export class PoolTokenExchangeRate {
211
- static TYPE_QNAME = "0x3::staking_pool::PoolTokenExchangeRate";
263
+ export interface PoolTokenExchangeRate {
212
264
  sui_amount: bigint;
213
265
  pool_token_amount: bigint;
214
266
  }
215
267
 
268
+ export namespace PoolTokenExchangeRate {
269
+ export const TYPE_QNAME = "0x3::staking_pool::PoolTokenExchangeRate";
270
+
271
+ const TYPE = new TypeDescriptor<PoolTokenExchangeRate>(
272
+ PoolTokenExchangeRate.TYPE_QNAME
273
+ );
274
+
275
+ export function type(): TypeDescriptor<PoolTokenExchangeRate> {
276
+ return TYPE.apply();
277
+ }
278
+ }
279
+
216
280
  export interface PoolTokenExchangeRateInstance
217
281
  extends TypedEventInstance<PoolTokenExchangeRate> {
218
282
  data_decoded: PoolTokenExchangeRate;
219
283
  type_arguments: [];
220
284
  }
221
285
 
222
- export class StakedSui {
223
- static TYPE_QNAME = "0x3::staking_pool::StakedSui";
286
+ export interface StakedSui {
224
287
  id: _0x2.object_.UID;
225
288
  pool_id: _0x2.object_.ID;
226
289
  stake_activation_epoch: bigint;
227
290
  principal: _0x2.balance.Balance<_0x2.sui.SUI>;
228
291
  }
229
292
 
230
- export class StakingPool {
231
- static TYPE_QNAME = "0x3::staking_pool::StakingPool";
293
+ export namespace StakedSui {
294
+ export const TYPE_QNAME = "0x3::staking_pool::StakedSui";
295
+
296
+ const TYPE = new TypeDescriptor<StakedSui>(StakedSui.TYPE_QNAME);
297
+
298
+ export function type(): TypeDescriptor<StakedSui> {
299
+ return TYPE.apply();
300
+ }
301
+ }
302
+
303
+ export interface StakingPool {
232
304
  id: _0x2.object_.UID;
233
305
  activation_epoch: _0x1.option.Option<bigint>;
234
306
  deactivation_epoch: _0x1.option.Option<bigint>;
@@ -245,6 +317,16 @@ export namespace staking_pool {
245
317
  extra_fields: _0x2.bag.Bag;
246
318
  }
247
319
 
320
+ export namespace StakingPool {
321
+ export const TYPE_QNAME = "0x3::staking_pool::StakingPool";
322
+
323
+ const TYPE = new TypeDescriptor<StakingPool>(StakingPool.TYPE_QNAME);
324
+
325
+ export function type(): TypeDescriptor<StakingPool> {
326
+ return TYPE.apply();
327
+ }
328
+ }
329
+
248
330
  export interface JoinStakedSuiPayload
249
331
  extends TypedFunctionPayload<[SuiAddress | undefined]> {
250
332
  arguments_decoded: [SuiAddress | undefined];
@@ -259,11 +341,20 @@ export namespace staking_pool {
259
341
  }
260
342
 
261
343
  export namespace storage_fund {
262
- export class StorageFund {
263
- static TYPE_QNAME = "0x3::storage_fund::StorageFund";
344
+ export interface StorageFund {
264
345
  total_object_storage_rebates: _0x2.balance.Balance<_0x2.sui.SUI>;
265
346
  non_refundable_balance: _0x2.balance.Balance<_0x2.sui.SUI>;
266
347
  }
348
+
349
+ export namespace StorageFund {
350
+ export const TYPE_QNAME = "0x3::storage_fund::StorageFund";
351
+
352
+ const TYPE = new TypeDescriptor<StorageFund>(StorageFund.TYPE_QNAME);
353
+
354
+ export function type(): TypeDescriptor<StorageFund> {
355
+ return TYPE.apply();
356
+ }
357
+ }
267
358
  }
268
359
 
269
360
  export class sui_system extends SuiBaseProcessor {
@@ -877,12 +968,21 @@ export class sui_system extends SuiBaseProcessor {
877
968
  }
878
969
 
879
970
  export namespace sui_system {
880
- export class SuiSystemState {
881
- static TYPE_QNAME = "0x3::sui_system::SuiSystemState";
971
+ export interface SuiSystemState {
882
972
  id: _0x2.object_.UID;
883
973
  version: bigint;
884
974
  }
885
975
 
976
+ export namespace SuiSystemState {
977
+ export const TYPE_QNAME = "0x3::sui_system::SuiSystemState";
978
+
979
+ const TYPE = new TypeDescriptor<SuiSystemState>(SuiSystemState.TYPE_QNAME);
980
+
981
+ export function type(): TypeDescriptor<SuiSystemState> {
982
+ return TYPE.apply();
983
+ }
984
+ }
985
+
886
986
  export interface ReportValidatorPayload
887
987
  extends TypedFunctionPayload<
888
988
  [SuiAddress | undefined, SuiAddress | undefined]
@@ -1224,8 +1324,7 @@ export class sui_system_state_inner extends SuiBaseProcessor {
1224
1324
  }
1225
1325
 
1226
1326
  export namespace sui_system_state_inner {
1227
- export class SuiSystemStateInner {
1228
- static TYPE_QNAME = "0x3::sui_system_state_inner::SuiSystemStateInner";
1327
+ export interface SuiSystemStateInner {
1229
1328
  epoch: bigint;
1230
1329
  protocol_version: bigint;
1231
1330
  system_state_version: bigint;
@@ -1247,8 +1346,20 @@ export namespace sui_system_state_inner {
1247
1346
  extra_fields: _0x2.bag.Bag;
1248
1347
  }
1249
1348
 
1250
- export class SystemEpochInfoEvent {
1251
- static TYPE_QNAME = "0x3::sui_system_state_inner::SystemEpochInfoEvent";
1349
+ export namespace SuiSystemStateInner {
1350
+ export const TYPE_QNAME =
1351
+ "0x3::sui_system_state_inner::SuiSystemStateInner";
1352
+
1353
+ const TYPE = new TypeDescriptor<SuiSystemStateInner>(
1354
+ SuiSystemStateInner.TYPE_QNAME
1355
+ );
1356
+
1357
+ export function type(): TypeDescriptor<SuiSystemStateInner> {
1358
+ return TYPE.apply();
1359
+ }
1360
+ }
1361
+
1362
+ export interface SystemEpochInfoEvent {
1252
1363
  epoch: bigint;
1253
1364
  protocol_version: bigint;
1254
1365
  reference_gas_price: bigint;
@@ -1263,14 +1374,26 @@ export namespace sui_system_state_inner {
1263
1374
  leftover_storage_fund_inflow: bigint;
1264
1375
  }
1265
1376
 
1377
+ export namespace SystemEpochInfoEvent {
1378
+ export const TYPE_QNAME =
1379
+ "0x3::sui_system_state_inner::SystemEpochInfoEvent";
1380
+
1381
+ const TYPE = new TypeDescriptor<SystemEpochInfoEvent>(
1382
+ SystemEpochInfoEvent.TYPE_QNAME
1383
+ );
1384
+
1385
+ export function type(): TypeDescriptor<SystemEpochInfoEvent> {
1386
+ return TYPE.apply();
1387
+ }
1388
+ }
1389
+
1266
1390
  export interface SystemEpochInfoEventInstance
1267
1391
  extends TypedEventInstance<SystemEpochInfoEvent> {
1268
1392
  data_decoded: SystemEpochInfoEvent;
1269
1393
  type_arguments: [];
1270
1394
  }
1271
1395
 
1272
- export class SystemParameters {
1273
- static TYPE_QNAME = "0x3::sui_system_state_inner::SystemParameters";
1396
+ export interface SystemParameters {
1274
1397
  epoch_duration_ms: bigint;
1275
1398
  stake_subsidy_start_epoch: bigint;
1276
1399
  max_validator_count: bigint;
@@ -1280,6 +1403,18 @@ export namespace sui_system_state_inner {
1280
1403
  validator_low_stake_grace_period: bigint;
1281
1404
  extra_fields: _0x2.bag.Bag;
1282
1405
  }
1406
+
1407
+ export namespace SystemParameters {
1408
+ export const TYPE_QNAME = "0x3::sui_system_state_inner::SystemParameters";
1409
+
1410
+ const TYPE = new TypeDescriptor<SystemParameters>(
1411
+ SystemParameters.TYPE_QNAME
1412
+ );
1413
+
1414
+ export function type(): TypeDescriptor<SystemParameters> {
1415
+ return TYPE.apply();
1416
+ }
1417
+ }
1283
1418
  }
1284
1419
 
1285
1420
  export class validator extends SuiBaseProcessor {
@@ -1331,8 +1466,7 @@ export class validator extends SuiBaseProcessor {
1331
1466
  }
1332
1467
 
1333
1468
  export namespace validator {
1334
- export class StakingRequestEvent {
1335
- static TYPE_QNAME = "0x3::validator::StakingRequestEvent";
1469
+ export interface StakingRequestEvent {
1336
1470
  pool_id: _0x2.object_.ID;
1337
1471
  validator_address: SuiAddress;
1338
1472
  staker_address: SuiAddress;
@@ -1340,14 +1474,25 @@ export namespace validator {
1340
1474
  amount: bigint;
1341
1475
  }
1342
1476
 
1477
+ export namespace StakingRequestEvent {
1478
+ export const TYPE_QNAME = "0x3::validator::StakingRequestEvent";
1479
+
1480
+ const TYPE = new TypeDescriptor<StakingRequestEvent>(
1481
+ StakingRequestEvent.TYPE_QNAME
1482
+ );
1483
+
1484
+ export function type(): TypeDescriptor<StakingRequestEvent> {
1485
+ return TYPE.apply();
1486
+ }
1487
+ }
1488
+
1343
1489
  export interface StakingRequestEventInstance
1344
1490
  extends TypedEventInstance<StakingRequestEvent> {
1345
1491
  data_decoded: StakingRequestEvent;
1346
1492
  type_arguments: [];
1347
1493
  }
1348
1494
 
1349
- export class UnstakingRequestEvent {
1350
- static TYPE_QNAME = "0x3::validator::UnstakingRequestEvent";
1495
+ export interface UnstakingRequestEvent {
1351
1496
  pool_id: _0x2.object_.ID;
1352
1497
  validator_address: SuiAddress;
1353
1498
  staker_address: SuiAddress;
@@ -1357,14 +1502,25 @@ export namespace validator {
1357
1502
  reward_amount: bigint;
1358
1503
  }
1359
1504
 
1505
+ export namespace UnstakingRequestEvent {
1506
+ export const TYPE_QNAME = "0x3::validator::UnstakingRequestEvent";
1507
+
1508
+ const TYPE = new TypeDescriptor<UnstakingRequestEvent>(
1509
+ UnstakingRequestEvent.TYPE_QNAME
1510
+ );
1511
+
1512
+ export function type(): TypeDescriptor<UnstakingRequestEvent> {
1513
+ return TYPE.apply();
1514
+ }
1515
+ }
1516
+
1360
1517
  export interface UnstakingRequestEventInstance
1361
1518
  extends TypedEventInstance<UnstakingRequestEvent> {
1362
1519
  data_decoded: UnstakingRequestEvent;
1363
1520
  type_arguments: [];
1364
1521
  }
1365
1522
 
1366
- export class Validator {
1367
- static TYPE_QNAME = "0x3::validator::Validator";
1523
+ export interface Validator {
1368
1524
  metadata: validator.ValidatorMetadata;
1369
1525
  voting_power: bigint;
1370
1526
  operation_cap_id: _0x2.object_.ID;
@@ -1377,8 +1533,17 @@ export namespace validator {
1377
1533
  extra_fields: _0x2.bag.Bag;
1378
1534
  }
1379
1535
 
1380
- export class ValidatorMetadata {
1381
- static TYPE_QNAME = "0x3::validator::ValidatorMetadata";
1536
+ export namespace Validator {
1537
+ export const TYPE_QNAME = "0x3::validator::Validator";
1538
+
1539
+ const TYPE = new TypeDescriptor<Validator>(Validator.TYPE_QNAME);
1540
+
1541
+ export function type(): TypeDescriptor<Validator> {
1542
+ return TYPE.apply();
1543
+ }
1544
+ }
1545
+
1546
+ export interface ValidatorMetadata {
1382
1547
  sui_address: SuiAddress;
1383
1548
  protocol_pubkey_bytes: number[];
1384
1549
  network_pubkey_bytes: number[];
@@ -1402,19 +1567,54 @@ export namespace validator {
1402
1567
  next_epoch_worker_address: _0x1.option.Option<string>;
1403
1568
  extra_fields: _0x2.bag.Bag;
1404
1569
  }
1570
+
1571
+ export namespace ValidatorMetadata {
1572
+ export const TYPE_QNAME = "0x3::validator::ValidatorMetadata";
1573
+
1574
+ const TYPE = new TypeDescriptor<ValidatorMetadata>(
1575
+ ValidatorMetadata.TYPE_QNAME
1576
+ );
1577
+
1578
+ export function type(): TypeDescriptor<ValidatorMetadata> {
1579
+ return TYPE.apply();
1580
+ }
1581
+ }
1405
1582
  }
1406
1583
 
1407
1584
  export namespace validator_cap {
1408
- export class UnverifiedValidatorOperationCap {
1409
- static TYPE_QNAME = "0x3::validator_cap::UnverifiedValidatorOperationCap";
1585
+ export interface UnverifiedValidatorOperationCap {
1410
1586
  id: _0x2.object_.UID;
1411
1587
  authorizer_validator_address: SuiAddress;
1412
1588
  }
1413
1589
 
1414
- export class ValidatorOperationCap {
1415
- static TYPE_QNAME = "0x3::validator_cap::ValidatorOperationCap";
1590
+ export namespace UnverifiedValidatorOperationCap {
1591
+ export const TYPE_QNAME =
1592
+ "0x3::validator_cap::UnverifiedValidatorOperationCap";
1593
+
1594
+ const TYPE = new TypeDescriptor<UnverifiedValidatorOperationCap>(
1595
+ UnverifiedValidatorOperationCap.TYPE_QNAME
1596
+ );
1597
+
1598
+ export function type(): TypeDescriptor<UnverifiedValidatorOperationCap> {
1599
+ return TYPE.apply();
1600
+ }
1601
+ }
1602
+
1603
+ export interface ValidatorOperationCap {
1416
1604
  authorizer_validator_address: SuiAddress;
1417
1605
  }
1606
+
1607
+ export namespace ValidatorOperationCap {
1608
+ export const TYPE_QNAME = "0x3::validator_cap::ValidatorOperationCap";
1609
+
1610
+ const TYPE = new TypeDescriptor<ValidatorOperationCap>(
1611
+ ValidatorOperationCap.TYPE_QNAME
1612
+ );
1613
+
1614
+ export function type(): TypeDescriptor<ValidatorOperationCap> {
1615
+ return TYPE.apply();
1616
+ }
1617
+ }
1418
1618
  }
1419
1619
 
1420
1620
  export class validator_set extends SuiBaseProcessor {
@@ -1483,8 +1683,7 @@ export class validator_set extends SuiBaseProcessor {
1483
1683
  }
1484
1684
 
1485
1685
  export namespace validator_set {
1486
- export class ValidatorEpochInfoEvent {
1487
- static TYPE_QNAME = "0x3::validator_set::ValidatorEpochInfoEvent";
1686
+ export interface ValidatorEpochInfoEvent {
1488
1687
  epoch: bigint;
1489
1688
  validator_address: SuiAddress;
1490
1689
  reference_gas_survey_quote: bigint;
@@ -1497,41 +1696,74 @@ export namespace validator_set {
1497
1696
  tallying_rule_global_score: bigint;
1498
1697
  }
1499
1698
 
1699
+ export namespace ValidatorEpochInfoEvent {
1700
+ export const TYPE_QNAME = "0x3::validator_set::ValidatorEpochInfoEvent";
1701
+
1702
+ const TYPE = new TypeDescriptor<ValidatorEpochInfoEvent>(
1703
+ ValidatorEpochInfoEvent.TYPE_QNAME
1704
+ );
1705
+
1706
+ export function type(): TypeDescriptor<ValidatorEpochInfoEvent> {
1707
+ return TYPE.apply();
1708
+ }
1709
+ }
1710
+
1500
1711
  export interface ValidatorEpochInfoEventInstance
1501
1712
  extends TypedEventInstance<ValidatorEpochInfoEvent> {
1502
1713
  data_decoded: ValidatorEpochInfoEvent;
1503
1714
  type_arguments: [];
1504
1715
  }
1505
1716
 
1506
- export class ValidatorJoinEvent {
1507
- static TYPE_QNAME = "0x3::validator_set::ValidatorJoinEvent";
1717
+ export interface ValidatorJoinEvent {
1508
1718
  epoch: bigint;
1509
1719
  validator_address: SuiAddress;
1510
1720
  staking_pool_id: _0x2.object_.ID;
1511
1721
  }
1512
1722
 
1723
+ export namespace ValidatorJoinEvent {
1724
+ export const TYPE_QNAME = "0x3::validator_set::ValidatorJoinEvent";
1725
+
1726
+ const TYPE = new TypeDescriptor<ValidatorJoinEvent>(
1727
+ ValidatorJoinEvent.TYPE_QNAME
1728
+ );
1729
+
1730
+ export function type(): TypeDescriptor<ValidatorJoinEvent> {
1731
+ return TYPE.apply();
1732
+ }
1733
+ }
1734
+
1513
1735
  export interface ValidatorJoinEventInstance
1514
1736
  extends TypedEventInstance<ValidatorJoinEvent> {
1515
1737
  data_decoded: ValidatorJoinEvent;
1516
1738
  type_arguments: [];
1517
1739
  }
1518
1740
 
1519
- export class ValidatorLeaveEvent {
1520
- static TYPE_QNAME = "0x3::validator_set::ValidatorLeaveEvent";
1741
+ export interface ValidatorLeaveEvent {
1521
1742
  epoch: bigint;
1522
1743
  validator_address: SuiAddress;
1523
1744
  staking_pool_id: _0x2.object_.ID;
1524
1745
  is_voluntary: Boolean;
1525
1746
  }
1526
1747
 
1748
+ export namespace ValidatorLeaveEvent {
1749
+ export const TYPE_QNAME = "0x3::validator_set::ValidatorLeaveEvent";
1750
+
1751
+ const TYPE = new TypeDescriptor<ValidatorLeaveEvent>(
1752
+ ValidatorLeaveEvent.TYPE_QNAME
1753
+ );
1754
+
1755
+ export function type(): TypeDescriptor<ValidatorLeaveEvent> {
1756
+ return TYPE.apply();
1757
+ }
1758
+ }
1759
+
1527
1760
  export interface ValidatorLeaveEventInstance
1528
1761
  extends TypedEventInstance<ValidatorLeaveEvent> {
1529
1762
  data_decoded: ValidatorLeaveEvent;
1530
1763
  type_arguments: [];
1531
1764
  }
1532
1765
 
1533
- export class ValidatorSet {
1534
- static TYPE_QNAME = "0x3::validator_set::ValidatorSet";
1766
+ export interface ValidatorSet {
1535
1767
  total_stake: bigint;
1536
1768
  active_validators: validator.Validator[];
1537
1769
  pending_active_validators: _0x2.table_vec.TableVec<validator.Validator>;
@@ -1548,21 +1780,53 @@ export namespace validator_set {
1548
1780
  at_risk_validators: _0x2.vec_map.VecMap<SuiAddress, bigint>;
1549
1781
  extra_fields: _0x2.bag.Bag;
1550
1782
  }
1783
+
1784
+ export namespace ValidatorSet {
1785
+ export const TYPE_QNAME = "0x3::validator_set::ValidatorSet";
1786
+
1787
+ const TYPE = new TypeDescriptor<ValidatorSet>(ValidatorSet.TYPE_QNAME);
1788
+
1789
+ export function type(): TypeDescriptor<ValidatorSet> {
1790
+ return TYPE.apply();
1791
+ }
1792
+ }
1551
1793
  }
1552
1794
 
1553
1795
  export namespace validator_wrapper {
1554
- export class ValidatorWrapper {
1555
- static TYPE_QNAME = "0x3::validator_wrapper::ValidatorWrapper";
1796
+ export interface ValidatorWrapper {
1556
1797
  inner: _0x2.versioned.Versioned;
1557
1798
  }
1799
+
1800
+ export namespace ValidatorWrapper {
1801
+ export const TYPE_QNAME = "0x3::validator_wrapper::ValidatorWrapper";
1802
+
1803
+ const TYPE = new TypeDescriptor<ValidatorWrapper>(
1804
+ ValidatorWrapper.TYPE_QNAME
1805
+ );
1806
+
1807
+ export function type(): TypeDescriptor<ValidatorWrapper> {
1808
+ return TYPE.apply();
1809
+ }
1810
+ }
1558
1811
  }
1559
1812
 
1560
1813
  export namespace voting_power {
1561
- export class VotingPowerInfo {
1562
- static TYPE_QNAME = "0x3::voting_power::VotingPowerInfo";
1814
+ export interface VotingPowerInfo {
1563
1815
  validator_index: bigint;
1564
1816
  voting_power: bigint;
1565
1817
  }
1818
+
1819
+ export namespace VotingPowerInfo {
1820
+ export const TYPE_QNAME = "0x3::voting_power::VotingPowerInfo";
1821
+
1822
+ const TYPE = new TypeDescriptor<VotingPowerInfo>(
1823
+ VotingPowerInfo.TYPE_QNAME
1824
+ );
1825
+
1826
+ export function type(): TypeDescriptor<VotingPowerInfo> {
1827
+ return TYPE.apply();
1828
+ }
1829
+ }
1566
1830
  }
1567
1831
 
1568
1832
  const MODULES = JSON.parse(
@@ -9,17 +9,23 @@ import { structQname } from '../../move/index.js'
9
9
  import { join } from 'path'
10
10
  import { SuiChainAdapter } from '../sui-chain-adapter.js'
11
11
 
12
- export async function codegen(abisDir: string, outDir = join('src', 'types', 'sui'), genExample = false) {
12
+ export async function codegen(
13
+ abisDir: string,
14
+ outDir = join('src', 'types', 'sui'),
15
+ genExample = false,
16
+ builtin = false
17
+ ) {
13
18
  if (!fs.existsSync(abisDir)) {
14
19
  return
15
20
  }
16
21
  const gen = new SuiCodegen()
17
- const numFiles = await gen.generate(abisDir, outDir)
22
+ const numFiles = await gen.generate(abisDir, outDir, builtin)
18
23
  console.log(chalk.green(`Generated ${numFiles} for Sui`))
19
24
  }
20
25
 
21
26
  class SuiCodegen extends AbstractCodegen<SuiNetwork, SuiMoveNormalizedModule, SuiEvent | SuiMoveObject> {
22
27
  ADDRESS_TYPE = 'SuiAddress'
28
+ // ADDRESS_TYPE = 'string'
23
29
  MAIN_NET = SuiNetwork.MAIN_NET
24
30
  TEST_NET = SuiNetwork.TEST_NET
25
31
  PREFIX = 'Sui'
@@ -6,7 +6,7 @@ if (process.argv.length > 3) {
6
6
  const abisDir = process.argv[2]
7
7
  const targetDir = process.argv[3]
8
8
 
9
- await codegen(abisDir, targetDir)
9
+ await codegen(abisDir, targetDir, false, true)
10
10
  } else {
11
11
  console.error('Not enough argument')
12
12
  process.exit(1)
package/src/sui/index.ts CHANGED
@@ -11,6 +11,7 @@ export * from './context.js'
11
11
  export * from './models.js'
12
12
 
13
13
  export type { SuiAddress } from './move-types.js'
14
+ export { BUILTIN_TYPES } from '../move/types.js'
14
15
 
15
16
  export * from './move-coder.js'
16
17
 
package/src/sui/models.ts CHANGED
@@ -1,13 +1,8 @@
1
1
  import type { SuiEvent, MoveCallSuiTransaction, SuiMoveObject } from '@mysten/sui.js'
2
+ import { DecodedStruct } from '../move/types.js'
2
3
 
3
- export type TypedEventInstance<T> = SuiEvent & {
4
- /**
5
- * decoded data using ABI, undefined if there is decoding error, usually because the ABI/data mismatch
6
- */
7
- data_decoded: T
8
-
9
- type_arguments: string[]
10
- }
4
+ export type TypedEventInstance<T> = DecodedStruct<SuiEvent, T>
5
+ export type TypedSuiMoveObject<T> = DecodedStruct<SuiMoveObject, T>
11
6
 
12
7
  export type TypedFunctionPayload<T extends Array<any>> = MoveCallSuiTransaction & {
13
8
  /**
@@ -15,8 +10,3 @@ export type TypedFunctionPayload<T extends Array<any>> = MoveCallSuiTransaction
15
10
  */
16
11
  arguments_decoded: T
17
12
  }
18
-
19
- export type TypedSuiMoveObject<T> = SuiMoveObject & {
20
- data_decoded: T
21
- type_arguments: string[]
22
- }