@typemove/aptos 1.10.0 → 1.11.0-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 (69) hide show
  1. package/dist/cjs/account-resource-client.js +2 -2
  2. package/dist/cjs/account-resource-client.js.map +1 -1
  3. package/dist/cjs/aptos-chain-adapter.d.ts +2 -1
  4. package/dist/cjs/aptos-chain-adapter.d.ts.map +1 -1
  5. package/dist/cjs/aptos-chain-adapter.js +16 -15
  6. package/dist/cjs/aptos-chain-adapter.js.map +1 -1
  7. package/dist/cjs/builtin/0x1.d.ts +80 -0
  8. package/dist/cjs/builtin/0x1.d.ts.map +1 -1
  9. package/dist/cjs/builtin/0x1.js +340 -340
  10. package/dist/cjs/builtin/0x1.js.map +1 -1
  11. package/dist/cjs/builtin/0x3.d.ts +8 -0
  12. package/dist/cjs/builtin/0x3.d.ts.map +1 -1
  13. package/dist/cjs/builtin/0x3.js +15 -15
  14. package/dist/cjs/builtin/0x3.js.map +1 -1
  15. package/dist/cjs/builtin/0x4.d.ts +24 -0
  16. package/dist/cjs/builtin/0x4.d.ts.map +1 -1
  17. package/dist/cjs/builtin/0x4.js +37 -37
  18. package/dist/cjs/builtin/0x4.js.map +1 -1
  19. package/dist/cjs/codegen/codegen.d.ts +3 -3
  20. package/dist/cjs/codegen/codegen.d.ts.map +1 -1
  21. package/dist/cjs/codegen/codegen.js +5 -5
  22. package/dist/cjs/codegen/codegen.js.map +1 -1
  23. package/dist/cjs/move-coder.d.ts +2 -2
  24. package/dist/cjs/move-coder.d.ts.map +1 -1
  25. package/dist/cjs/move-coder.js +5 -14
  26. package/dist/cjs/move-coder.js.map +1 -1
  27. package/dist/esm/account-resource-client.js +2 -2
  28. package/dist/esm/account-resource-client.js.map +1 -1
  29. package/dist/esm/aptos-chain-adapter.d.ts +2 -1
  30. package/dist/esm/aptos-chain-adapter.d.ts.map +1 -1
  31. package/dist/esm/aptos-chain-adapter.js +16 -15
  32. package/dist/esm/aptos-chain-adapter.js.map +1 -1
  33. package/dist/esm/builtin/0x1.d.ts +80 -0
  34. package/dist/esm/builtin/0x1.d.ts.map +1 -1
  35. package/dist/esm/builtin/0x1.js +340 -340
  36. package/dist/esm/builtin/0x1.js.map +1 -1
  37. package/dist/esm/builtin/0x3.d.ts +8 -0
  38. package/dist/esm/builtin/0x3.d.ts.map +1 -1
  39. package/dist/esm/builtin/0x3.js +15 -15
  40. package/dist/esm/builtin/0x3.js.map +1 -1
  41. package/dist/esm/builtin/0x4.d.ts +24 -0
  42. package/dist/esm/builtin/0x4.d.ts.map +1 -1
  43. package/dist/esm/builtin/0x4.js +37 -37
  44. package/dist/esm/builtin/0x4.js.map +1 -1
  45. package/dist/esm/codegen/codegen.d.ts +3 -3
  46. package/dist/esm/codegen/codegen.d.ts.map +1 -1
  47. package/dist/esm/codegen/codegen.js +6 -6
  48. package/dist/esm/codegen/codegen.js.map +1 -1
  49. package/dist/esm/codegen/run.js +17 -6
  50. package/dist/esm/codegen/run.js.map +1 -1
  51. package/dist/esm/move-coder.d.ts +2 -2
  52. package/dist/esm/move-coder.d.ts.map +1 -1
  53. package/dist/esm/move-coder.js +6 -15
  54. package/dist/esm/move-coder.js.map +1 -1
  55. package/package.json +3 -3
  56. package/src/abis/0x1.json +47 -3
  57. package/src/account-resource-client.ts +2 -2
  58. package/src/aptos-chain-adapter.ts +20 -17
  59. package/src/builtin/0x1.ts +448 -340
  60. package/src/builtin/0x3.ts +26 -15
  61. package/src/builtin/0x4.ts +67 -37
  62. package/src/codegen/codegen.ts +5 -5
  63. package/src/codegen/run.ts +16 -7
  64. package/src/move-coder.ts +8 -15
  65. package/src/tests/types/0x48271d39d0b05bd6efca2278f22277d6fcc375504f9839fd73f74ace240861af.ts +44 -44
  66. package/src/tests/types/0x6b3720cd988adeaf721ed9d4730da4324d52364871a68eac62b46d21e4d2fa99.ts +45 -45
  67. package/src/tests/types/0x7fd500c11216f0fe3095d0c4b8aa4d64a4e2e04f83758462f2b127255643615.ts +26 -26
  68. package/src/tests/types/0x87978b35bf1eb73ae6cf04cfedcaa1f48254a683ebd00a21e7516a991edae3ac.ts +1 -1
  69. package/src/tests/types/0xbd35135844473187163ca197ca93b2ab014370587bb0ed3befff9e902d6bb541.ts +60 -39
@@ -695,6 +695,12 @@ export namespace token {
695
695
  }
696
696
  }
697
697
 
698
+ export type WithdrawCapabilityInstance =
699
+ TypedEventInstance<WithdrawCapability> & {
700
+ data_decoded: WithdrawCapability;
701
+ type_arguments: [];
702
+ };
703
+
698
704
  export namespace entry {
699
705
  export async function burn(
700
706
  client: Aptos,
@@ -705,7 +711,7 @@ export namespace token {
705
711
  },
706
712
  options?: InputGenerateTransactionOptions,
707
713
  ): Promise<PendingTransactionResponse> {
708
- const coder = defaultMoveCoder(client.config.fullnode);
714
+ const coder = defaultMoveCoder(client.config);
709
715
  const transaction = await client.transaction.build.simple({
710
716
  sender: account.accountAddress,
711
717
  data: {
@@ -730,7 +736,7 @@ export namespace token {
730
736
  },
731
737
  options?: InputGenerateTransactionOptions,
732
738
  ): Promise<PendingTransactionResponse> {
733
- const coder = defaultMoveCoder(client.config.fullnode);
739
+ const coder = defaultMoveCoder(client.config);
734
740
  const transaction = await client.transaction.build.simple({
735
741
  sender: account.accountAddress,
736
742
  data: {
@@ -755,7 +761,7 @@ export namespace token {
755
761
  },
756
762
  options?: InputGenerateTransactionOptions,
757
763
  ): Promise<PendingTransactionResponse> {
758
- const coder = defaultMoveCoder(client.config.fullnode);
764
+ const coder = defaultMoveCoder(client.config);
759
765
  const transaction = await client.transaction.build.simple({
760
766
  sender: account.accountAddress,
761
767
  data: {
@@ -794,7 +800,7 @@ export namespace token {
794
800
  },
795
801
  options?: InputGenerateTransactionOptions,
796
802
  ): Promise<PendingTransactionResponse> {
797
- const coder = defaultMoveCoder(client.config.fullnode);
803
+ const coder = defaultMoveCoder(client.config);
798
804
  const transaction = await client.transaction.build.simple({
799
805
  sender: account.accountAddress,
800
806
  data: {
@@ -826,7 +832,7 @@ export namespace token {
826
832
  },
827
833
  options?: InputGenerateTransactionOptions,
828
834
  ): Promise<PendingTransactionResponse> {
829
- const coder = defaultMoveCoder(client.config.fullnode);
835
+ const coder = defaultMoveCoder(client.config);
830
836
  const transaction = await client.transaction.build.simple({
831
837
  sender: account.accountAddress,
832
838
  data: {
@@ -851,7 +857,7 @@ export namespace token {
851
857
  },
852
858
  options?: InputGenerateTransactionOptions,
853
859
  ): Promise<PendingTransactionResponse> {
854
- const coder = defaultMoveCoder(client.config.fullnode);
860
+ const coder = defaultMoveCoder(client.config);
855
861
  const transaction = await client.transaction.build.simple({
856
862
  sender: account.accountAddress,
857
863
  data: {
@@ -876,7 +882,7 @@ export namespace token {
876
882
  },
877
883
  options?: InputGenerateTransactionOptions,
878
884
  ): Promise<PendingTransactionResponse> {
879
- const coder = defaultMoveCoder(client.config.fullnode);
885
+ const coder = defaultMoveCoder(client.config);
880
886
  const transaction = await client.transaction.build.simple({
881
887
  sender: account.accountAddress,
882
888
  data: {
@@ -911,7 +917,7 @@ export namespace token {
911
917
  },
912
918
  options?: InputGenerateTransactionOptions,
913
919
  ): Promise<PendingTransactionResponse> {
914
- const coder = defaultMoveCoder(client.config.fullnode);
920
+ const coder = defaultMoveCoder(client.config);
915
921
  const transaction = await client.transaction.build.simple({
916
922
  sender: account.accountAddress,
917
923
  data: {
@@ -936,7 +942,7 @@ export namespace token {
936
942
  },
937
943
  options?: InputGenerateTransactionOptions,
938
944
  ): Promise<PendingTransactionResponse> {
939
- const coder = defaultMoveCoder(client.config.fullnode);
945
+ const coder = defaultMoveCoder(client.config);
940
946
  const transaction = await client.transaction.build.simple({
941
947
  sender: account.accountAddress,
942
948
  data: {
@@ -968,7 +974,7 @@ export namespace token {
968
974
  },
969
975
  options?: InputGenerateTransactionOptions,
970
976
  ): Promise<PendingTransactionResponse> {
971
- const coder = defaultMoveCoder(client.config.fullnode);
977
+ const coder = defaultMoveCoder(client.config);
972
978
  const transaction = await client.transaction.build.simple({
973
979
  sender: account.accountAddress,
974
980
  data: {
@@ -992,7 +998,7 @@ export namespace token {
992
998
  },
993
999
  version?: bigint,
994
1000
  ): Promise<[token.CollectionMutabilityConfig]> {
995
- const coder = defaultMoveCoder(client.config.fullnode);
1001
+ const coder = defaultMoveCoder(client.config);
996
1002
  const data: InputViewFunctionData = {
997
1003
  function: "0x3::token::get_collection_mutability_config",
998
1004
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1064,6 +1070,11 @@ export namespace token_coin_swap {
1064
1070
  }
1065
1071
  }
1066
1072
 
1073
+ export type TokenCoinSwapInstance = TypedEventInstance<TokenCoinSwap<any>> & {
1074
+ data_decoded: TokenCoinSwap<any>;
1075
+ type_arguments: [string];
1076
+ };
1077
+
1067
1078
  export interface TokenEscrow {
1068
1079
  token: token.Token;
1069
1080
  locked_until_secs: bigint;
@@ -1185,7 +1196,7 @@ export namespace token_coin_swap {
1185
1196
  },
1186
1197
  options?: InputGenerateTransactionOptions,
1187
1198
  ): Promise<PendingTransactionResponse> {
1188
- const coder = defaultMoveCoder(client.config.fullnode);
1199
+ const coder = defaultMoveCoder(client.config);
1189
1200
  const transaction = await client.transaction.build.simple({
1190
1201
  sender: account.accountAddress,
1191
1202
  data: {
@@ -1461,7 +1472,7 @@ export namespace token_transfers {
1461
1472
  },
1462
1473
  options?: InputGenerateTransactionOptions,
1463
1474
  ): Promise<PendingTransactionResponse> {
1464
- const coder = defaultMoveCoder(client.config.fullnode);
1475
+ const coder = defaultMoveCoder(client.config);
1465
1476
  const transaction = await client.transaction.build.simple({
1466
1477
  sender: account.accountAddress,
1467
1478
  data: {
@@ -1493,7 +1504,7 @@ export namespace token_transfers {
1493
1504
  },
1494
1505
  options?: InputGenerateTransactionOptions,
1495
1506
  ): Promise<PendingTransactionResponse> {
1496
- const coder = defaultMoveCoder(client.config.fullnode);
1507
+ const coder = defaultMoveCoder(client.config);
1497
1508
  const transaction = await client.transaction.build.simple({
1498
1509
  sender: account.accountAddress,
1499
1510
  data: {
@@ -1526,7 +1537,7 @@ export namespace token_transfers {
1526
1537
  },
1527
1538
  options?: InputGenerateTransactionOptions,
1528
1539
  ): Promise<PendingTransactionResponse> {
1529
- const coder = defaultMoveCoder(client.config.fullnode);
1540
+ const coder = defaultMoveCoder(client.config);
1530
1541
  const transaction = await client.transaction.build.simple({
1531
1542
  sender: account.accountAddress,
1532
1543
  data: {
@@ -38,6 +38,11 @@ export namespace token {
38
38
  }
39
39
  }
40
40
 
41
+ export type BurnRefInstance = TypedEventInstance<BurnRef> & {
42
+ data_decoded: BurnRef;
43
+ type_arguments: [];
44
+ };
45
+
41
46
  export interface MutatorRef {
42
47
  self: MoveAddressType;
43
48
  }
@@ -52,6 +57,11 @@ export namespace token {
52
57
  }
53
58
  }
54
59
 
60
+ export type MutatorRefInstance = TypedEventInstance<MutatorRef> & {
61
+ data_decoded: MutatorRef;
62
+ type_arguments: [];
63
+ };
64
+
55
65
  export interface Mutation {
56
66
  token_address: MoveAddressType;
57
67
  mutated_field_name: string;
@@ -158,7 +168,7 @@ export namespace token {
158
168
  },
159
169
  version?: bigint,
160
170
  ): Promise<[bigint]> {
161
- const coder = defaultMoveCoder(client.config.fullnode);
171
+ const coder = defaultMoveCoder(client.config);
162
172
  const data: InputViewFunctionData = {
163
173
  function: "0x4::token::index",
164
174
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -180,7 +190,7 @@ export namespace token {
180
190
  },
181
191
  version?: bigint,
182
192
  ): Promise<[MoveAddressType]> {
183
- const coder = defaultMoveCoder(client.config.fullnode);
193
+ const coder = defaultMoveCoder(client.config);
184
194
  const data: InputViewFunctionData = {
185
195
  function: "0x4::token::creator",
186
196
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -201,7 +211,7 @@ export namespace token {
201
211
  },
202
212
  version?: bigint,
203
213
  ): Promise<[string]> {
204
- const coder = defaultMoveCoder(client.config.fullnode);
214
+ const coder = defaultMoveCoder(client.config);
205
215
  const data: InputViewFunctionData = {
206
216
  function: "0x4::token::name",
207
217
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -223,7 +233,7 @@ export namespace token {
223
233
  },
224
234
  version?: bigint,
225
235
  ): Promise<[_0x1.option.Option<royalty.Royalty>]> {
226
- const coder = defaultMoveCoder(client.config.fullnode);
236
+ const coder = defaultMoveCoder(client.config);
227
237
  const data: InputViewFunctionData = {
228
238
  function: "0x4::token::royalty",
229
239
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -245,7 +255,7 @@ export namespace token {
245
255
  },
246
256
  version?: bigint,
247
257
  ): Promise<[string]> {
248
- const coder = defaultMoveCoder(client.config.fullnode);
258
+ const coder = defaultMoveCoder(client.config);
249
259
  const data: InputViewFunctionData = {
250
260
  function: "0x4::token::description",
251
261
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -266,7 +276,7 @@ export namespace token {
266
276
  },
267
277
  version?: bigint,
268
278
  ): Promise<[string]> {
269
- const coder = defaultMoveCoder(client.config.fullnode);
279
+ const coder = defaultMoveCoder(client.config);
270
280
  const data: InputViewFunctionData = {
271
281
  function: "0x4::token::uri",
272
282
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -288,7 +298,7 @@ export namespace token {
288
298
  },
289
299
  version?: bigint,
290
300
  ): Promise<[string]> {
291
- const coder = defaultMoveCoder(client.config.fullnode);
301
+ const coder = defaultMoveCoder(client.config);
292
302
  const data: InputViewFunctionData = {
293
303
  function: "0x4::token::collection_name",
294
304
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -309,7 +319,7 @@ export namespace token {
309
319
  },
310
320
  version?: bigint,
311
321
  ): Promise<[_0x1.object$.Object<collection.Collection>]> {
312
- const coder = defaultMoveCoder(client.config.fullnode);
322
+ const coder = defaultMoveCoder(client.config);
313
323
  const data: InputViewFunctionData = {
314
324
  function: "0x4::token::collection_object",
315
325
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -330,7 +340,7 @@ export namespace token {
330
340
  },
331
341
  version?: bigint,
332
342
  ): Promise<[MoveAddressType]> {
333
- const coder = defaultMoveCoder(client.config.fullnode);
343
+ const coder = defaultMoveCoder(client.config);
334
344
  const data: InputViewFunctionData = {
335
345
  function: "0x4::token::create_token_address_with_seed",
336
346
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -363,6 +373,11 @@ export namespace royalty {
363
373
  }
364
374
  }
365
375
 
376
+ export type MutatorRefInstance = TypedEventInstance<MutatorRef> & {
377
+ data_decoded: MutatorRef;
378
+ type_arguments: [];
379
+ };
380
+
366
381
  export interface Royalty {
367
382
  numerator: bigint;
368
383
  denominator: bigint;
@@ -415,6 +430,11 @@ export namespace collection {
415
430
  }
416
431
  }
417
432
 
433
+ export type MutatorRefInstance = TypedEventInstance<MutatorRef> & {
434
+ data_decoded: MutatorRef;
435
+ type_arguments: [];
436
+ };
437
+
418
438
  export interface Burn {
419
439
  collection: MoveAddressType;
420
440
  index: bigint;
@@ -673,7 +693,7 @@ export namespace collection {
673
693
  },
674
694
  version?: bigint,
675
695
  ): Promise<[_0x1.option.Option<bigint>]> {
676
- const coder = defaultMoveCoder(client.config.fullnode);
696
+ const coder = defaultMoveCoder(client.config);
677
697
  const data: InputViewFunctionData = {
678
698
  function: "0x4::collection::count",
679
699
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -694,7 +714,7 @@ export namespace collection {
694
714
  },
695
715
  version?: bigint,
696
716
  ): Promise<[MoveAddressType]> {
697
- const coder = defaultMoveCoder(client.config.fullnode);
717
+ const coder = defaultMoveCoder(client.config);
698
718
  const data: InputViewFunctionData = {
699
719
  function: "0x4::collection::creator",
700
720
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -715,7 +735,7 @@ export namespace collection {
715
735
  },
716
736
  version?: bigint,
717
737
  ): Promise<[string]> {
718
- const coder = defaultMoveCoder(client.config.fullnode);
738
+ const coder = defaultMoveCoder(client.config);
719
739
  const data: InputViewFunctionData = {
720
740
  function: "0x4::collection::name",
721
741
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -737,7 +757,7 @@ export namespace collection {
737
757
  },
738
758
  version?: bigint,
739
759
  ): Promise<[string]> {
740
- const coder = defaultMoveCoder(client.config.fullnode);
760
+ const coder = defaultMoveCoder(client.config);
741
761
  const data: InputViewFunctionData = {
742
762
  function: "0x4::collection::description",
743
763
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -758,7 +778,7 @@ export namespace collection {
758
778
  },
759
779
  version?: bigint,
760
780
  ): Promise<[string]> {
761
- const coder = defaultMoveCoder(client.config.fullnode);
781
+ const coder = defaultMoveCoder(client.config);
762
782
  const data: InputViewFunctionData = {
763
783
  function: "0x4::collection::uri",
764
784
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -827,7 +847,7 @@ export namespace aptos_token {
827
847
  },
828
848
  options?: InputGenerateTransactionOptions,
829
849
  ): Promise<PendingTransactionResponse> {
830
- const coder = defaultMoveCoder(client.config.fullnode);
850
+ const coder = defaultMoveCoder(client.config);
831
851
  const transaction = await client.transaction.build.simple({
832
852
  sender: account.accountAddress,
833
853
  data: {
@@ -859,7 +879,7 @@ export namespace aptos_token {
859
879
  },
860
880
  options?: InputGenerateTransactionOptions,
861
881
  ): Promise<PendingTransactionResponse> {
862
- const coder = defaultMoveCoder(client.config.fullnode);
882
+ const coder = defaultMoveCoder(client.config);
863
883
  const transaction = await client.transaction.build.simple({
864
884
  sender: account.accountAddress,
865
885
  data: {
@@ -883,7 +903,7 @@ export namespace aptos_token {
883
903
  },
884
904
  options?: InputGenerateTransactionOptions,
885
905
  ): Promise<PendingTransactionResponse> {
886
- const coder = defaultMoveCoder(client.config.fullnode);
906
+ const coder = defaultMoveCoder(client.config);
887
907
  const transaction = await client.transaction.build.simple({
888
908
  sender: account.accountAddress,
889
909
  data: {
@@ -907,7 +927,7 @@ export namespace aptos_token {
907
927
  },
908
928
  options?: InputGenerateTransactionOptions,
909
929
  ): Promise<PendingTransactionResponse> {
910
- const coder = defaultMoveCoder(client.config.fullnode);
930
+ const coder = defaultMoveCoder(client.config);
911
931
  const transaction = await client.transaction.build.simple({
912
932
  sender: account.accountAddress,
913
933
  data: {
@@ -931,7 +951,7 @@ export namespace aptos_token {
931
951
  },
932
952
  options?: InputGenerateTransactionOptions,
933
953
  ): Promise<PendingTransactionResponse> {
934
- const coder = defaultMoveCoder(client.config.fullnode);
954
+ const coder = defaultMoveCoder(client.config);
935
955
  const transaction = await client.transaction.build.simple({
936
956
  sender: account.accountAddress,
937
957
  data: {
@@ -955,7 +975,7 @@ export namespace aptos_token {
955
975
  },
956
976
  options?: InputGenerateTransactionOptions,
957
977
  ): Promise<PendingTransactionResponse> {
958
- const coder = defaultMoveCoder(client.config.fullnode);
978
+ const coder = defaultMoveCoder(client.config);
959
979
  const transaction = await client.transaction.build.simple({
960
980
  sender: account.accountAddress,
961
981
  data: {
@@ -979,7 +999,7 @@ export namespace aptos_token {
979
999
  },
980
1000
  options?: InputGenerateTransactionOptions,
981
1001
  ): Promise<PendingTransactionResponse> {
982
- const coder = defaultMoveCoder(client.config.fullnode);
1002
+ const coder = defaultMoveCoder(client.config);
983
1003
  const transaction = await client.transaction.build.simple({
984
1004
  sender: account.accountAddress,
985
1005
  data: {
@@ -1020,7 +1040,7 @@ export namespace aptos_token {
1020
1040
  },
1021
1041
  options?: InputGenerateTransactionOptions,
1022
1042
  ): Promise<PendingTransactionResponse> {
1023
- const coder = defaultMoveCoder(client.config.fullnode);
1043
+ const coder = defaultMoveCoder(client.config);
1024
1044
  const transaction = await client.transaction.build.simple({
1025
1045
  sender: account.accountAddress,
1026
1046
  data: {
@@ -1045,7 +1065,7 @@ export namespace aptos_token {
1045
1065
  },
1046
1066
  options?: InputGenerateTransactionOptions,
1047
1067
  ): Promise<PendingTransactionResponse> {
1048
- const coder = defaultMoveCoder(client.config.fullnode);
1068
+ const coder = defaultMoveCoder(client.config);
1049
1069
  const transaction = await client.transaction.build.simple({
1050
1070
  sender: account.accountAddress,
1051
1071
  data: {
@@ -1079,7 +1099,7 @@ export namespace aptos_token {
1079
1099
  },
1080
1100
  options?: InputGenerateTransactionOptions,
1081
1101
  ): Promise<PendingTransactionResponse> {
1082
- const coder = defaultMoveCoder(client.config.fullnode);
1102
+ const coder = defaultMoveCoder(client.config);
1083
1103
  const transaction = await client.transaction.build.simple({
1084
1104
  sender: account.accountAddress,
1085
1105
  data: {
@@ -1104,7 +1124,7 @@ export namespace aptos_token {
1104
1124
  },
1105
1125
  options?: InputGenerateTransactionOptions,
1106
1126
  ): Promise<PendingTransactionResponse> {
1107
- const coder = defaultMoveCoder(client.config.fullnode);
1127
+ const coder = defaultMoveCoder(client.config);
1108
1128
  const transaction = await client.transaction.build.simple({
1109
1129
  sender: account.accountAddress,
1110
1130
  data: {
@@ -1128,7 +1148,7 @@ export namespace aptos_token {
1128
1148
  },
1129
1149
  options?: InputGenerateTransactionOptions,
1130
1150
  ): Promise<PendingTransactionResponse> {
1131
- const coder = defaultMoveCoder(client.config.fullnode);
1151
+ const coder = defaultMoveCoder(client.config);
1132
1152
  const transaction = await client.transaction.build.simple({
1133
1153
  sender: account.accountAddress,
1134
1154
  data: {
@@ -1158,7 +1178,7 @@ export namespace aptos_token {
1158
1178
  },
1159
1179
  options?: InputGenerateTransactionOptions,
1160
1180
  ): Promise<PendingTransactionResponse> {
1161
- const coder = defaultMoveCoder(client.config.fullnode);
1181
+ const coder = defaultMoveCoder(client.config);
1162
1182
  const transaction = await client.transaction.build.simple({
1163
1183
  sender: account.accountAddress,
1164
1184
  data: {
@@ -1182,7 +1202,7 @@ export namespace aptos_token {
1182
1202
  },
1183
1203
  options?: InputGenerateTransactionOptions,
1184
1204
  ): Promise<PendingTransactionResponse> {
1185
- const coder = defaultMoveCoder(client.config.fullnode);
1205
+ const coder = defaultMoveCoder(client.config);
1186
1206
  const transaction = await client.transaction.build.simple({
1187
1207
  sender: account.accountAddress,
1188
1208
  data: {
@@ -1206,7 +1226,7 @@ export namespace aptos_token {
1206
1226
  },
1207
1227
  options?: InputGenerateTransactionOptions,
1208
1228
  ): Promise<PendingTransactionResponse> {
1209
- const coder = defaultMoveCoder(client.config.fullnode);
1229
+ const coder = defaultMoveCoder(client.config);
1210
1230
  const transaction = await client.transaction.build.simple({
1211
1231
  sender: account.accountAddress,
1212
1232
  data: {
@@ -1230,7 +1250,7 @@ export namespace aptos_token {
1230
1250
  },
1231
1251
  options?: InputGenerateTransactionOptions,
1232
1252
  ): Promise<PendingTransactionResponse> {
1233
- const coder = defaultMoveCoder(client.config.fullnode);
1253
+ const coder = defaultMoveCoder(client.config);
1234
1254
  const transaction = await client.transaction.build.simple({
1235
1255
  sender: account.accountAddress,
1236
1256
  data: {
@@ -1254,7 +1274,7 @@ export namespace aptos_token {
1254
1274
  },
1255
1275
  options?: InputGenerateTransactionOptions,
1256
1276
  ): Promise<PendingTransactionResponse> {
1257
- const coder = defaultMoveCoder(client.config.fullnode);
1277
+ const coder = defaultMoveCoder(client.config);
1258
1278
  const transaction = await client.transaction.build.simple({
1259
1279
  sender: account.accountAddress,
1260
1280
  data: {
@@ -1279,7 +1299,7 @@ export namespace aptos_token {
1279
1299
  },
1280
1300
  version?: bigint,
1281
1301
  ): Promise<[boolean]> {
1282
- const coder = defaultMoveCoder(client.config.fullnode);
1302
+ const coder = defaultMoveCoder(client.config);
1283
1303
  const data: InputViewFunctionData = {
1284
1304
  function: "0x4::aptos_token::are_properties_mutable",
1285
1305
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1303,7 +1323,7 @@ export namespace aptos_token {
1303
1323
  },
1304
1324
  version?: bigint,
1305
1325
  ): Promise<[boolean]> {
1306
- const coder = defaultMoveCoder(client.config.fullnode);
1326
+ const coder = defaultMoveCoder(client.config);
1307
1327
  const data: InputViewFunctionData = {
1308
1328
  function: "0x4::aptos_token::is_burnable",
1309
1329
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1324,7 +1344,7 @@ export namespace aptos_token {
1324
1344
  },
1325
1345
  version?: bigint,
1326
1346
  ): Promise<[boolean]> {
1327
- const coder = defaultMoveCoder(client.config.fullnode);
1347
+ const coder = defaultMoveCoder(client.config);
1328
1348
  const data: InputViewFunctionData = {
1329
1349
  function: "0x4::aptos_token::is_freezable_by_creator",
1330
1350
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1348,7 +1368,7 @@ export namespace aptos_token {
1348
1368
  },
1349
1369
  version?: bigint,
1350
1370
  ): Promise<[boolean]> {
1351
- const coder = defaultMoveCoder(client.config.fullnode);
1371
+ const coder = defaultMoveCoder(client.config);
1352
1372
  const data: InputViewFunctionData = {
1353
1373
  function: "0x4::aptos_token::is_mutable_description",
1354
1374
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1371,7 +1391,7 @@ export namespace aptos_token {
1371
1391
  },
1372
1392
  version?: bigint,
1373
1393
  ): Promise<[boolean]> {
1374
- const coder = defaultMoveCoder(client.config.fullnode);
1394
+ const coder = defaultMoveCoder(client.config);
1375
1395
  const data: InputViewFunctionData = {
1376
1396
  function: "0x4::aptos_token::is_mutable_name",
1377
1397
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1394,7 +1414,7 @@ export namespace aptos_token {
1394
1414
  },
1395
1415
  version?: bigint,
1396
1416
  ): Promise<[boolean]> {
1397
- const coder = defaultMoveCoder(client.config.fullnode);
1417
+ const coder = defaultMoveCoder(client.config);
1398
1418
  const data: InputViewFunctionData = {
1399
1419
  function: "0x4::aptos_token::is_mutable_uri",
1400
1420
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1427,6 +1447,11 @@ export namespace property_map {
1427
1447
  }
1428
1448
  }
1429
1449
 
1450
+ export type MutatorRefInstance = TypedEventInstance<MutatorRef> & {
1451
+ data_decoded: MutatorRef;
1452
+ type_arguments: [];
1453
+ };
1454
+
1430
1455
  export interface PropertyMap {
1431
1456
  inner: _0x1.simple_map.SimpleMap<string, property_map.PropertyValue>;
1432
1457
  }
@@ -1456,6 +1481,11 @@ export namespace property_map {
1456
1481
  }
1457
1482
  }
1458
1483
 
1484
+ export type PropertyValueInstance = TypedEventInstance<PropertyValue> & {
1485
+ data_decoded: PropertyValue;
1486
+ type_arguments: [];
1487
+ };
1488
+
1459
1489
  export namespace entry {}
1460
1490
  export namespace view {}
1461
1491
  }
@@ -16,7 +16,7 @@ import { Aptos, AptosConfig, Event, MoveModuleBytecode, MoveResource } from '@ap
16
16
  export async function codegen(
17
17
  abisDir: string,
18
18
  outDir = join('src', 'types', 'aptos'),
19
- endpoint: string,
19
+ config: AptosConfig,
20
20
  genExample = false,
21
21
  builtin = false
22
22
  ) {
@@ -24,7 +24,7 @@ export async function codegen(
24
24
  console.error(chalk.red(`ABIs directory ${abisDir} does not exist`))
25
25
  return 0
26
26
  }
27
- const gen = new AptosCodegen(endpoint)
27
+ const gen = new AptosCodegen(config)
28
28
  try {
29
29
  const numFiles = await gen.generate(abisDir, outDir, builtin)
30
30
  if (numFiles > 0) {
@@ -46,10 +46,10 @@ export class AptosCodegen extends AbstractCodegen<MoveModuleBytecode, Event | Mo
46
46
  SYSTEM_PACKAGE = '@typemove/aptos'
47
47
 
48
48
  constructor(
49
- endpoint: string,
49
+ config: AptosConfig,
50
50
  readonly useViewJson = false
51
51
  ) {
52
- super(new AptosChainAdapter(new Aptos(new AptosConfig({ fullnode: endpoint }))))
52
+ super(new AptosChainAdapter(new Aptos(config)))
53
53
  }
54
54
 
55
55
  generateImports(): string {
@@ -145,7 +145,7 @@ export class AptosCodegen extends AbstractCodegen<MoveModuleBytecode, Event | Mo
145
145
  }
146
146
 
147
147
  protected getGetDefaultCoder() {
148
- return `defaultMoveCoder(client.config.fullnode)`
148
+ return `defaultMoveCoder(client.config)`
149
149
  }
150
150
 
151
151
  protected generateEntryForFunction(module: InternalMoveModule, func: InternalMoveFunction): string {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { codegen } from './codegen.js'
4
- import { Aptos, AptosConfig } from '@aptos-labs/ts-sdk'
4
+ import { Aptos, AptosConfig, Network } from '@aptos-labs/ts-sdk'
5
5
  import * as path from 'path'
6
6
  import * as fs from 'fs'
7
7
  import { Command } from 'commander'
@@ -30,14 +30,23 @@ program
30
30
  'mainnet'
31
31
  )
32
32
  .action(async (location, options) => {
33
- let endpoint = options.network
33
+ const endpoint = options.network
34
+ let config: AptosConfig
34
35
  if (endpoint == 'mainnet') {
35
- endpoint = 'https://mainnet.aptoslabs.com/v1'
36
+ config = new AptosConfig({
37
+ network: Network.MAINNET
38
+ })
39
+ } else if (endpoint == 'testnet') {
40
+ config = new AptosConfig({
41
+ network: Network.TESTNET
42
+ })
43
+ } else {
44
+ config = new AptosConfig({
45
+ network: Network.CUSTOM,
46
+ fullnode: endpoint
47
+ })
36
48
  }
37
- if (endpoint == 'testnet') {
38
- endpoint = 'https://testnet.aptoslabs.com/v1'
39
- }
40
- const aptosClient = new Aptos(new AptosConfig({ fullnode: endpoint }))
49
+ const aptosClient = new Aptos(config)
41
50
 
42
51
  let abisDir = location
43
52
  if (location.startsWith('0x')) {
package/src/move-coder.ts CHANGED
@@ -9,7 +9,8 @@ import {
9
9
  Event,
10
10
  MoveModuleBytecode,
11
11
  MoveResource,
12
- MoveValue
12
+ MoveValue,
13
+ Network
13
14
  } from '@aptos-labs/ts-sdk'
14
15
 
15
16
  export class MoveCoder extends AbstractMoveCoder<MoveModuleBytecode, Event | MoveResource> {
@@ -107,25 +108,17 @@ export class MoveCoder extends AbstractMoveCoder<MoveModuleBytecode, Event | Mov
107
108
  }
108
109
  }
109
110
 
110
- // const MOVE_CODER = new MoveCoder(AptosNetwork.MAIN_NET)
111
- // const TESTNET_MOVE_CODER = new MoveCoder(AptosNetwork.TEST_NET)
112
- //
113
- // export function defaultMoveCoder(network: AptosNetwork = AptosNetwork.MAIN_NET): MoveCoder {
114
- // if (network == AptosNetwork.MAIN_NET) {
115
- // return MOVE_CODER
116
- // }
117
- // return TESTNET_MOVE_CODER
118
- // }
111
+ const DEFAULT_CONFIG = new AptosConfig({ network: Network.MAINNET })
119
112
 
120
- const DEFAULT_ENDPOINT = 'https://mainnet.aptoslabs.com/v1'
121
113
  const CODER_MAP = new Map<string, MoveCoder>()
122
114
 
123
- export function defaultMoveCoder(endpoint: string = DEFAULT_ENDPOINT): MoveCoder {
124
- let coder = CODER_MAP.get(endpoint)
115
+ export function defaultMoveCoder(config = DEFAULT_CONFIG): MoveCoder {
116
+ const configKey = config.fullnode ? config.fullnode : config.network
117
+
118
+ let coder = CODER_MAP.get(configKey)
125
119
  if (!coder) {
126
- const config = new AptosConfig({ fullnode: endpoint })
127
120
  coder = new MoveCoder(new Aptos(config))
128
- CODER_MAP.set(endpoint, coder)
121
+ CODER_MAP.set(configKey, coder)
129
122
  }
130
123
  return coder
131
124
  }