@sentio/sdk 2.5.4-rc.1 → 2.5.5-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/lib/aptos/builtin/0x1.d.ts +70 -76
  2. package/lib/aptos/builtin/0x1.js +4 -4
  3. package/lib/aptos/builtin/0x1.js.map +1 -1
  4. package/lib/aptos/builtin/0x3.d.ts +14 -32
  5. package/lib/aptos/builtin/0x3.js.map +1 -1
  6. package/lib/aptos/codegen/codegen.js +1 -0
  7. package/lib/aptos/codegen/codegen.js.map +1 -1
  8. package/lib/aptos/codegen/types.test.js.map +1 -1
  9. package/lib/aptos/index.d.ts +2 -1
  10. package/lib/aptos/index.js +1 -0
  11. package/lib/aptos/index.js.map +1 -1
  12. package/lib/aptos/models.d.ts +1 -1
  13. package/lib/aptos/models.js.map +1 -1
  14. package/lib/aptos/module-client.d.ts +6 -0
  15. package/lib/aptos/module-client.js +25 -0
  16. package/lib/aptos/module-client.js.map +1 -0
  17. package/lib/aptos/module-client.test.d.ts +1 -0
  18. package/lib/aptos/module-client.test.js.map +1 -0
  19. package/lib/aptos/move-coder.d.ts +2 -0
  20. package/lib/aptos/move-coder.js +7 -15
  21. package/lib/aptos/move-coder.js.map +1 -1
  22. package/lib/aptos/network.d.ts +2 -0
  23. package/lib/aptos/network.js +1 -0
  24. package/lib/aptos/network.js.map +1 -1
  25. package/lib/move/abstract-codegen.d.ts +2 -0
  26. package/lib/move/abstract-codegen.js +44 -7
  27. package/lib/move/abstract-codegen.js.map +1 -1
  28. package/lib/move/abstract-move-coder.d.ts +12 -5
  29. package/lib/move/abstract-move-coder.js +100 -6
  30. package/lib/move/abstract-move-coder.js.map +1 -1
  31. package/lib/move/ts-type.js +1 -1
  32. package/lib/move/ts-type.js.map +1 -1
  33. package/lib/move/utils.js +1 -1
  34. package/lib/move/utils.js.map +1 -1
  35. package/lib/sui/builtin/0x1.js.map +1 -1
  36. package/lib/sui/builtin/0x2.d.ts +49 -49
  37. package/lib/sui/builtin/0x2.js.map +1 -1
  38. package/lib/sui/codegen/codegen.js +2 -4
  39. package/lib/sui/codegen/codegen.js.map +1 -1
  40. package/lib/sui/index.d.ts +1 -0
  41. package/lib/sui/index.js +1 -0
  42. package/lib/sui/index.js.map +1 -1
  43. package/lib/sui/models.d.ts +1 -1
  44. package/lib/sui/models.js.map +1 -1
  45. package/lib/sui/module-client.d.ts +3 -0
  46. package/lib/sui/module-client.js +7 -0
  47. package/lib/sui/module-client.js.map +1 -0
  48. package/lib/sui/move-coder.d.ts +2 -0
  49. package/lib/sui/move-coder.js +8 -17
  50. package/lib/sui/move-coder.js.map +1 -1
  51. package/lib/sui/utils.d.ts +2 -0
  52. package/lib/sui/utils.js +6 -0
  53. package/lib/sui/utils.js.map +1 -1
  54. package/package.json +4 -4
  55. package/src/aptos/builtin/0x1.ts +71 -81
  56. package/src/aptos/builtin/0x3.ts +15 -21
  57. package/src/aptos/codegen/codegen.ts +1 -0
  58. package/src/aptos/index.ts +2 -1
  59. package/src/aptos/models.ts +1 -1
  60. package/src/aptos/module-client.ts +30 -0
  61. package/src/aptos/move-coder.ts +11 -17
  62. package/src/aptos/network.ts +2 -0
  63. package/src/move/abstract-codegen.ts +55 -9
  64. package/src/move/abstract-move-coder.ts +116 -10
  65. package/src/move/ts-type.ts +1 -1
  66. package/src/move/utils.ts +1 -1
  67. package/src/sui/builtin/0x1.ts +2 -2
  68. package/src/sui/builtin/0x2.ts +50 -51
  69. package/src/sui/codegen/codegen.ts +2 -4
  70. package/src/sui/index.ts +2 -0
  71. package/src/sui/models.ts +1 -1
  72. package/src/sui/module-client.ts +7 -0
  73. package/src/sui/move-coder.ts +11 -21
  74. package/src/sui/utils.ts +8 -0
@@ -12,11 +12,11 @@ import {
12
12
  SuiBaseProcessor,
13
13
  TypedEventInstance,
14
14
  SuiNetwork,
15
- TypedEntryFunctionPayload,
15
+ TypedFunctionPayload,
16
16
  SuiContext,
17
17
  } from "@sentio/sdk/sui";
18
18
  import { MoveFetchConfig } from "@sentio/protos";
19
- import { SuiAddress } from "@sentio/sdk/sui";
19
+ import { SuiAddress, ModuleClient } from "@sentio/sdk/sui";
20
20
 
21
21
  import * as _0x1 from "./0x1.js";
22
22
 
@@ -261,43 +261,43 @@ export namespace coin {
261
261
  }
262
262
 
263
263
  export interface BurnPayload<T0 = any>
264
- extends TypedEntryFunctionPayload<[SuiAddress]> {
264
+ extends TypedFunctionPayload<[SuiAddress]> {
265
265
  arguments_decoded: [SuiAddress];
266
266
  type_arguments: [string];
267
267
  }
268
268
 
269
269
  export interface JoinPayload<T0 = any>
270
- extends TypedEntryFunctionPayload<[SuiAddress]> {
270
+ extends TypedFunctionPayload<[SuiAddress]> {
271
271
  arguments_decoded: [SuiAddress];
272
272
  type_arguments: [string];
273
273
  }
274
274
 
275
275
  export interface MintAndTransferPayload<T0 = any>
276
- extends TypedEntryFunctionPayload<[SuiAddress, bigint, SuiAddress]> {
276
+ extends TypedFunctionPayload<[SuiAddress, bigint, SuiAddress]> {
277
277
  arguments_decoded: [SuiAddress, bigint, SuiAddress];
278
278
  type_arguments: [string];
279
279
  }
280
280
 
281
281
  export interface UpdateDescriptionPayload<T0 = any>
282
- extends TypedEntryFunctionPayload<[SuiAddress, SuiAddress]> {
282
+ extends TypedFunctionPayload<[SuiAddress, SuiAddress]> {
283
283
  arguments_decoded: [SuiAddress, SuiAddress];
284
284
  type_arguments: [string];
285
285
  }
286
286
 
287
287
  export interface UpdateIconUrlPayload<T0 = any>
288
- extends TypedEntryFunctionPayload<[SuiAddress, SuiAddress]> {
288
+ extends TypedFunctionPayload<[SuiAddress, SuiAddress]> {
289
289
  arguments_decoded: [SuiAddress, SuiAddress];
290
290
  type_arguments: [string];
291
291
  }
292
292
 
293
293
  export interface UpdateNamePayload<T0 = any>
294
- extends TypedEntryFunctionPayload<[SuiAddress, SuiAddress]> {
294
+ extends TypedFunctionPayload<[SuiAddress, SuiAddress]> {
295
295
  arguments_decoded: [SuiAddress, SuiAddress];
296
296
  type_arguments: [string];
297
297
  }
298
298
 
299
299
  export interface UpdateSymbolPayload<T0 = any>
300
- extends TypedEntryFunctionPayload<[SuiAddress, SuiAddress]> {
300
+ extends TypedFunctionPayload<[SuiAddress, SuiAddress]> {
301
301
  arguments_decoded: [SuiAddress, SuiAddress];
302
302
  type_arguments: [string];
303
303
  }
@@ -401,19 +401,19 @@ export namespace devnet_nft {
401
401
  type_arguments: [];
402
402
  }
403
403
 
404
- export interface BurnPayload extends TypedEntryFunctionPayload<[]> {
404
+ export interface BurnPayload extends TypedFunctionPayload<[]> {
405
405
  arguments_decoded: [];
406
406
  type_arguments: [];
407
407
  }
408
408
 
409
409
  export interface MintPayload
410
- extends TypedEntryFunctionPayload<[string, string, string]> {
410
+ extends TypedFunctionPayload<[string, string, string]> {
411
411
  arguments_decoded: [string, string, string];
412
412
  type_arguments: [];
413
413
  }
414
414
 
415
415
  export interface UpdateDescriptionPayload
416
- extends TypedEntryFunctionPayload<[SuiAddress]> {
416
+ extends TypedFunctionPayload<[SuiAddress]> {
417
417
  arguments_decoded: [SuiAddress];
418
418
  type_arguments: [];
419
419
  }
@@ -838,13 +838,13 @@ export namespace locked_coin {
838
838
  }
839
839
 
840
840
  export interface LockCoinPayload<T0 = any>
841
- extends TypedEntryFunctionPayload<[string, SuiAddress, bigint]> {
841
+ extends TypedFunctionPayload<[string, SuiAddress, bigint]> {
842
842
  arguments_decoded: [string, SuiAddress, bigint];
843
843
  type_arguments: [string];
844
844
  }
845
845
 
846
846
  export interface UnlockCoinPayload<T0 = any>
847
- extends TypedEntryFunctionPayload<[locked_coin.LockedCoin<T0>]> {
847
+ extends TypedFunctionPayload<[locked_coin.LockedCoin<T0>]> {
848
848
  arguments_decoded: [locked_coin.LockedCoin<T0>];
849
849
  type_arguments: [string];
850
850
  }
@@ -1041,43 +1041,43 @@ export class pay extends SuiBaseProcessor {
1041
1041
 
1042
1042
  export namespace pay {
1043
1043
  export interface DivideAndKeepPayload<T0 = any>
1044
- extends TypedEntryFunctionPayload<[SuiAddress, bigint]> {
1044
+ extends TypedFunctionPayload<[SuiAddress, bigint]> {
1045
1045
  arguments_decoded: [SuiAddress, bigint];
1046
1046
  type_arguments: [string];
1047
1047
  }
1048
1048
 
1049
1049
  export interface JoinPayload<T0 = any>
1050
- extends TypedEntryFunctionPayload<[SuiAddress]> {
1050
+ extends TypedFunctionPayload<[SuiAddress]> {
1051
1051
  arguments_decoded: [SuiAddress];
1052
1052
  type_arguments: [string];
1053
1053
  }
1054
1054
 
1055
1055
  export interface JoinVecPayload<T0 = any>
1056
- extends TypedEntryFunctionPayload<[SuiAddress]> {
1056
+ extends TypedFunctionPayload<[SuiAddress]> {
1057
1057
  arguments_decoded: [SuiAddress];
1058
1058
  type_arguments: [string];
1059
1059
  }
1060
1060
 
1061
1061
  export interface JoinVecAndTransferPayload<T0 = any>
1062
- extends TypedEntryFunctionPayload<[string[]]> {
1062
+ extends TypedFunctionPayload<[string[]]> {
1063
1063
  arguments_decoded: [string[]];
1064
1064
  type_arguments: [string];
1065
1065
  }
1066
1066
 
1067
1067
  export interface SplitPayload<T0 = any>
1068
- extends TypedEntryFunctionPayload<[SuiAddress, bigint]> {
1068
+ extends TypedFunctionPayload<[SuiAddress, bigint]> {
1069
1069
  arguments_decoded: [SuiAddress, bigint];
1070
1070
  type_arguments: [string];
1071
1071
  }
1072
1072
 
1073
1073
  export interface SplitAndTransferPayload<T0 = any>
1074
- extends TypedEntryFunctionPayload<[SuiAddress, bigint, SuiAddress]> {
1074
+ extends TypedFunctionPayload<[SuiAddress, bigint, SuiAddress]> {
1075
1075
  arguments_decoded: [SuiAddress, bigint, SuiAddress];
1076
1076
  type_arguments: [string];
1077
1077
  }
1078
1078
 
1079
1079
  export interface SplitVecPayload<T0 = any>
1080
- extends TypedEntryFunctionPayload<[SuiAddress, bigint[]]> {
1080
+ extends TypedFunctionPayload<[SuiAddress, bigint[]]> {
1081
1081
  arguments_decoded: [SuiAddress, bigint[]];
1082
1082
  type_arguments: [string];
1083
1083
  }
@@ -1240,37 +1240,37 @@ export namespace safe {
1240
1240
  }
1241
1241
 
1242
1242
  export interface CreatePayload<T0 = any>
1243
- extends TypedEntryFunctionPayload<[string]> {
1243
+ extends TypedFunctionPayload<[string]> {
1244
1244
  arguments_decoded: [string];
1245
1245
  type_arguments: [string];
1246
1246
  }
1247
1247
 
1248
1248
  export interface CreateEmptyPayload<T0 = any>
1249
- extends TypedEntryFunctionPayload<[]> {
1249
+ extends TypedFunctionPayload<[]> {
1250
1250
  arguments_decoded: [];
1251
1251
  type_arguments: [string];
1252
1252
  }
1253
1253
 
1254
1254
  export interface DepositPayload<T0 = any>
1255
- extends TypedEntryFunctionPayload<[SuiAddress]> {
1255
+ extends TypedFunctionPayload<[SuiAddress]> {
1256
1256
  arguments_decoded: [SuiAddress];
1257
1257
  type_arguments: [string];
1258
1258
  }
1259
1259
 
1260
1260
  export interface RevokeTransferCapabilityPayload<T0 = any>
1261
- extends TypedEntryFunctionPayload<[SuiAddress, SuiAddress]> {
1261
+ extends TypedFunctionPayload<[SuiAddress, SuiAddress]> {
1262
1262
  arguments_decoded: [SuiAddress, SuiAddress];
1263
1263
  type_arguments: [string];
1264
1264
  }
1265
1265
 
1266
1266
  export interface SelfRevokeTransferCapabilityPayload<T0 = any>
1267
- extends TypedEntryFunctionPayload<[SuiAddress]> {
1267
+ extends TypedFunctionPayload<[SuiAddress]> {
1268
1268
  arguments_decoded: [SuiAddress];
1269
1269
  type_arguments: [string];
1270
1270
  }
1271
1271
 
1272
1272
  export interface WithdrawPayload<T0 = any>
1273
- extends TypedEntryFunctionPayload<[SuiAddress, SuiAddress, bigint]> {
1273
+ extends TypedFunctionPayload<[SuiAddress, SuiAddress, bigint]> {
1274
1274
  arguments_decoded: [SuiAddress, SuiAddress, bigint];
1275
1275
  type_arguments: [string];
1276
1276
  }
@@ -1314,8 +1314,7 @@ export namespace stake {
1314
1314
  locked_until_epoch: _0x1.option.Option<epoch_time_lock.EpochTimeLock>;
1315
1315
  }
1316
1316
 
1317
- export interface BurnPayload
1318
- extends TypedEntryFunctionPayload<[stake.Stake]> {
1317
+ export interface BurnPayload extends TypedFunctionPayload<[stake.Stake]> {
1319
1318
  arguments_decoded: [stake.Stake];
1320
1319
  type_arguments: [];
1321
1320
  }
@@ -1488,19 +1487,19 @@ export namespace staking_pool {
1488
1487
  }
1489
1488
 
1490
1489
  export interface DestroyEmptyDelegationPayload
1491
- extends TypedEntryFunctionPayload<[]> {
1490
+ extends TypedFunctionPayload<[]> {
1492
1491
  arguments_decoded: [];
1493
1492
  type_arguments: [];
1494
1493
  }
1495
1494
 
1496
1495
  export interface DestroyEmptyStakedSuiPayload
1497
- extends TypedEntryFunctionPayload<[]> {
1496
+ extends TypedFunctionPayload<[]> {
1498
1497
  arguments_decoded: [];
1499
1498
  type_arguments: [];
1500
1499
  }
1501
1500
 
1502
1501
  export interface WithdrawFromInactivePoolPayload
1503
- extends TypedEntryFunctionPayload<
1502
+ extends TypedFunctionPayload<
1504
1503
  [SuiAddress, staking_pool.StakedSui, staking_pool.Delegation]
1505
1504
  > {
1506
1505
  arguments_decoded: [
@@ -1548,7 +1547,7 @@ export namespace sui {
1548
1547
  dummy_field: Boolean;
1549
1548
  }
1550
1549
 
1551
- export interface TransferPayload extends TypedEntryFunctionPayload<[string]> {
1550
+ export interface TransferPayload extends TypedFunctionPayload<[string]> {
1552
1551
  arguments_decoded: [string];
1553
1552
  type_arguments: [];
1554
1553
  }
@@ -1957,7 +1956,7 @@ export namespace sui_system {
1957
1956
  }
1958
1957
 
1959
1958
  export interface AdvanceEpochPayload
1960
- extends TypedEntryFunctionPayload<
1959
+ extends TypedFunctionPayload<
1961
1960
  [SuiAddress, bigint, bigint, bigint, bigint, bigint, bigint, bigint]
1962
1961
  > {
1963
1962
  arguments_decoded: [
@@ -1974,31 +1973,31 @@ export namespace sui_system {
1974
1973
  }
1975
1974
 
1976
1975
  export interface AdvanceEpochSafeModePayload
1977
- extends TypedEntryFunctionPayload<[SuiAddress, bigint]> {
1976
+ extends TypedFunctionPayload<[SuiAddress, bigint]> {
1978
1977
  arguments_decoded: [SuiAddress, bigint];
1979
1978
  type_arguments: [];
1980
1979
  }
1981
1980
 
1982
1981
  export interface CancelDelegationRequestPayload
1983
- extends TypedEntryFunctionPayload<[SuiAddress, staking_pool.StakedSui]> {
1982
+ extends TypedFunctionPayload<[SuiAddress, staking_pool.StakedSui]> {
1984
1983
  arguments_decoded: [SuiAddress, staking_pool.StakedSui];
1985
1984
  type_arguments: [];
1986
1985
  }
1987
1986
 
1988
1987
  export interface ReportValidatorPayload
1989
- extends TypedEntryFunctionPayload<[SuiAddress, SuiAddress]> {
1988
+ extends TypedFunctionPayload<[SuiAddress, SuiAddress]> {
1990
1989
  arguments_decoded: [SuiAddress, SuiAddress];
1991
1990
  type_arguments: [];
1992
1991
  }
1993
1992
 
1994
1993
  export interface RequestAddDelegationPayload
1995
- extends TypedEntryFunctionPayload<[SuiAddress, string, SuiAddress]> {
1994
+ extends TypedFunctionPayload<[SuiAddress, string, SuiAddress]> {
1996
1995
  arguments_decoded: [SuiAddress, string, SuiAddress];
1997
1996
  type_arguments: [];
1998
1997
  }
1999
1998
 
2000
1999
  export interface RequestAddDelegationMulCoinPayload
2001
- extends TypedEntryFunctionPayload<
2000
+ extends TypedFunctionPayload<
2002
2001
  [SuiAddress, string[], _0x1.option.Option<bigint>, SuiAddress]
2003
2002
  > {
2004
2003
  arguments_decoded: [
@@ -2011,7 +2010,7 @@ export namespace sui_system {
2011
2010
  }
2012
2011
 
2013
2012
  export interface RequestAddDelegationMulLockedCoinPayload
2014
- extends TypedEntryFunctionPayload<
2013
+ extends TypedFunctionPayload<
2015
2014
  [
2016
2015
  SuiAddress,
2017
2016
  locked_coin.LockedCoin<sui.SUI>[],
@@ -2029,7 +2028,7 @@ export namespace sui_system {
2029
2028
  }
2030
2029
 
2031
2030
  export interface RequestAddDelegationWithLockedCoinPayload
2032
- extends TypedEntryFunctionPayload<
2031
+ extends TypedFunctionPayload<
2033
2032
  [SuiAddress, locked_coin.LockedCoin<sui.SUI>, SuiAddress]
2034
2033
  > {
2035
2034
  arguments_decoded: [
@@ -2041,13 +2040,13 @@ export namespace sui_system {
2041
2040
  }
2042
2041
 
2043
2042
  export interface RequestAddStakePayload
2044
- extends TypedEntryFunctionPayload<[SuiAddress, string]> {
2043
+ extends TypedFunctionPayload<[SuiAddress, string]> {
2045
2044
  arguments_decoded: [SuiAddress, string];
2046
2045
  type_arguments: [];
2047
2046
  }
2048
2047
 
2049
2048
  export interface RequestAddStakeWithLockedCoinPayload
2050
- extends TypedEntryFunctionPayload<
2049
+ extends TypedFunctionPayload<
2051
2050
  [SuiAddress, locked_coin.LockedCoin<sui.SUI>]
2052
2051
  > {
2053
2052
  arguments_decoded: [SuiAddress, locked_coin.LockedCoin<sui.SUI>];
@@ -2055,7 +2054,7 @@ export namespace sui_system {
2055
2054
  }
2056
2055
 
2057
2056
  export interface RequestAddValidatorPayload
2058
- extends TypedEntryFunctionPayload<
2057
+ extends TypedFunctionPayload<
2059
2058
  [
2060
2059
  SuiAddress,
2061
2060
  string,
@@ -2095,25 +2094,25 @@ export namespace sui_system {
2095
2094
  }
2096
2095
 
2097
2096
  export interface RequestRemoveValidatorPayload
2098
- extends TypedEntryFunctionPayload<[SuiAddress]> {
2097
+ extends TypedFunctionPayload<[SuiAddress]> {
2099
2098
  arguments_decoded: [SuiAddress];
2100
2099
  type_arguments: [];
2101
2100
  }
2102
2101
 
2103
2102
  export interface RequestSetCommissionRatePayload
2104
- extends TypedEntryFunctionPayload<[SuiAddress, bigint]> {
2103
+ extends TypedFunctionPayload<[SuiAddress, bigint]> {
2105
2104
  arguments_decoded: [SuiAddress, bigint];
2106
2105
  type_arguments: [];
2107
2106
  }
2108
2107
 
2109
2108
  export interface RequestSetGasPricePayload
2110
- extends TypedEntryFunctionPayload<[SuiAddress, bigint]> {
2109
+ extends TypedFunctionPayload<[SuiAddress, bigint]> {
2111
2110
  arguments_decoded: [SuiAddress, bigint];
2112
2111
  type_arguments: [];
2113
2112
  }
2114
2113
 
2115
2114
  export interface RequestSwitchDelegationPayload
2116
- extends TypedEntryFunctionPayload<
2115
+ extends TypedFunctionPayload<
2117
2116
  [SuiAddress, staking_pool.Delegation, staking_pool.StakedSui, SuiAddress]
2118
2117
  > {
2119
2118
  arguments_decoded: [
@@ -2126,7 +2125,7 @@ export namespace sui_system {
2126
2125
  }
2127
2126
 
2128
2127
  export interface RequestWithdrawDelegationPayload
2129
- extends TypedEntryFunctionPayload<
2128
+ extends TypedFunctionPayload<
2130
2129
  [SuiAddress, staking_pool.Delegation, staking_pool.StakedSui]
2131
2130
  > {
2132
2131
  arguments_decoded: [
@@ -2138,13 +2137,13 @@ export namespace sui_system {
2138
2137
  }
2139
2138
 
2140
2139
  export interface RequestWithdrawStakePayload
2141
- extends TypedEntryFunctionPayload<[SuiAddress, SuiAddress, bigint]> {
2140
+ extends TypedFunctionPayload<[SuiAddress, SuiAddress, bigint]> {
2142
2141
  arguments_decoded: [SuiAddress, SuiAddress, bigint];
2143
2142
  type_arguments: [];
2144
2143
  }
2145
2144
 
2146
2145
  export interface UndoReportValidatorPayload
2147
- extends TypedEntryFunctionPayload<[SuiAddress, SuiAddress]> {
2146
+ extends TypedFunctionPayload<[SuiAddress, SuiAddress]> {
2148
2147
  arguments_decoded: [SuiAddress, SuiAddress];
2149
2148
  type_arguments: [];
2150
2149
  }
@@ -6,6 +6,7 @@ import { AbstractCodegen } from '../../move/abstract-codegen.js'
6
6
  import { JsonRpcProvider, SuiMoveNormalizedModules } from '@mysten/sui.js'
7
7
  import { toInternalModule } from '../move-types.js'
8
8
  import { moduleQname, SPLITTER, TypeDescriptor } from '../../move/index.js'
9
+ import { getMeaningfulFunctionParams } from '../utils.js'
9
10
 
10
11
  export async function codegen(abisDir: string, outDir = 'src/types/sui') {
11
12
  if (!fs.existsSync(abisDir)) {
@@ -41,10 +42,7 @@ class SuiCodegen extends AbstractCodegen<SuiMoveNormalizedModules, SuiNetwork> {
41
42
  }
42
43
 
43
44
  getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[] {
44
- if (params.length === 0) {
45
- return params
46
- }
47
- return params.slice(0, params.length - 1)
45
+ return getMeaningfulFunctionParams(params)
48
46
  }
49
47
 
50
48
  toInternalModules(modules: SuiMoveNormalizedModules): InternalMoveModule[] {
package/src/sui/index.ts CHANGED
@@ -9,3 +9,5 @@ export type { SuiAddress } from './move-types.js'
9
9
  export * from './move-coder.js'
10
10
 
11
11
  export { SuiPlugin } from './sui-plugin.js'
12
+
13
+ export { ModuleClient } from './module-client.js'
package/src/sui/models.ts CHANGED
@@ -9,7 +9,7 @@ export type TypedEventInstance<T> = MoveEvent & {
9
9
  type_arguments: string[]
10
10
  }
11
11
 
12
- export type TypedEntryFunctionPayload<T extends Array<any>> = MoveCall & {
12
+ export type TypedFunctionPayload<T extends Array<any>> = MoveCall & {
13
13
  /**
14
14
  * decoded argument data using ABI, undefined if there is decoding error, usually because the ABI/data mismatch
15
15
  */
@@ -0,0 +1,7 @@
1
+ // import { JsonRpcProvider } from "@mysten/sui.js";
2
+
3
+ export class ModuleClient {
4
+ public async viewDecoded(func: string, typeArguments: string[], args: any[], ledger_version?: bigint) {
5
+ throw Error('not implemented')
6
+ }
7
+ }
@@ -1,8 +1,9 @@
1
- import { TypedEventInstance, TypedEntryFunctionPayload } from './models.js'
1
+ import { TypedEventInstance, TypedFunctionPayload } from './models.js'
2
2
  import { AbstractMoveCoder } from '../move/abstract-move-coder.js'
3
3
  import { MoveCall, MoveEvent, SuiMoveNormalizedModule } from '@mysten/sui.js'
4
4
  import { toInternalModule } from './move-types.js'
5
- import { SPLITTER } from '../move/index.js'
5
+ import { SPLITTER, TypeDescriptor } from '../move/index.js'
6
+ import { getMeaningfulFunctionParams } from './utils.js'
6
7
 
7
8
  export class MoveCoder extends AbstractMoveCoder<MoveEvent> {
8
9
  load(module: SuiMoveNormalizedModule) {
@@ -29,30 +30,19 @@ export class MoveCoder extends AbstractMoveCoder<MoveEvent> {
29
30
  return { ...event, fields_decoded: res?.data_decoded as T, type_arguments: res?.type_arguments || [] }
30
31
  })
31
32
  }
33
+ getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[] {
34
+ return getMeaningfulFunctionParams(params)
35
+ }
32
36
 
33
37
  decodeFunctionPayload(payload: MoveCall): MoveCall {
34
- // this.loadTypes(registry)
35
- const argumentsTyped: any[] = []
36
-
37
- try {
38
- const functionType = [payload.package.objectId, payload.module, payload.function].join(SPLITTER)
39
- const func = this.getMoveFunction(functionType)
40
- const params = func.params.slice(0, func.params.length - 1)
41
- const args = payload.arguments || []
42
- for (const [idx, arg] of args.entries()) {
43
- // TODO consider apply payload.type_arguments, but this might be hard since we don't code gen for them
44
- const argType = params[idx]
45
- argumentsTyped.push(this.decode(arg, argType))
46
- }
47
- } catch (e) {
48
- console.error('Decoding error for ', JSON.stringify(payload), e)
49
- return payload
50
- }
51
-
38
+ const functionType = [payload.package.objectId, payload.module, payload.function].join(SPLITTER)
39
+ const func = this.getMoveFunction(functionType)
40
+ const params = getMeaningfulFunctionParams(func.params)
41
+ const argumentsTyped = this.decodeArray(payload.arguments || [], params)
52
42
  return {
53
43
  ...payload,
54
44
  arguments_decoded: argumentsTyped,
55
- } as TypedEntryFunctionPayload<any>
45
+ } as TypedFunctionPayload<any>
56
46
  }
57
47
  }
58
48
 
package/src/sui/utils.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { SuiTransactionResponse, getMoveCallTransaction, SuiTransactionKind } from '@mysten/sui.js'
2
+ import { TypeDescriptor } from '../move/index.js'
2
3
 
3
4
  export function getMoveCalls(tx: SuiTransactionResponse) {
4
5
  return tx.certificate.data.transactions.flatMap((tx: SuiTransactionKind) => {
@@ -9,3 +10,10 @@ export function getMoveCalls(tx: SuiTransactionResponse) {
9
10
  return []
10
11
  })
11
12
  }
13
+
14
+ export function getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[] {
15
+ if (params.length === 0) {
16
+ return params
17
+ }
18
+ return params.slice(0, params.length - 1)
19
+ }