@typemove/aptos 1.10.1-rc.1 → 1.11.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 (47) 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/builtin/0x1.js +339 -339
  4. package/dist/cjs/builtin/0x1.js.map +1 -1
  5. package/dist/cjs/builtin/0x3.js +15 -15
  6. package/dist/cjs/builtin/0x3.js.map +1 -1
  7. package/dist/cjs/builtin/0x4.js +37 -37
  8. package/dist/cjs/builtin/0x4.js.map +1 -1
  9. package/dist/cjs/codegen/codegen.d.ts +3 -3
  10. package/dist/cjs/codegen/codegen.d.ts.map +1 -1
  11. package/dist/cjs/codegen/codegen.js +5 -5
  12. package/dist/cjs/codegen/codegen.js.map +1 -1
  13. package/dist/cjs/move-coder.d.ts +2 -2
  14. package/dist/cjs/move-coder.d.ts.map +1 -1
  15. package/dist/cjs/move-coder.js +5 -14
  16. package/dist/cjs/move-coder.js.map +1 -1
  17. package/dist/esm/account-resource-client.js +2 -2
  18. package/dist/esm/account-resource-client.js.map +1 -1
  19. package/dist/esm/builtin/0x1.js +339 -339
  20. package/dist/esm/builtin/0x1.js.map +1 -1
  21. package/dist/esm/builtin/0x3.js +15 -15
  22. package/dist/esm/builtin/0x3.js.map +1 -1
  23. package/dist/esm/builtin/0x4.js +37 -37
  24. package/dist/esm/builtin/0x4.js.map +1 -1
  25. package/dist/esm/codegen/codegen.d.ts +3 -3
  26. package/dist/esm/codegen/codegen.d.ts.map +1 -1
  27. package/dist/esm/codegen/codegen.js +6 -6
  28. package/dist/esm/codegen/codegen.js.map +1 -1
  29. package/dist/esm/codegen/run.js +17 -6
  30. package/dist/esm/codegen/run.js.map +1 -1
  31. package/dist/esm/move-coder.d.ts +2 -2
  32. package/dist/esm/move-coder.d.ts.map +1 -1
  33. package/dist/esm/move-coder.js +6 -15
  34. package/dist/esm/move-coder.js.map +1 -1
  35. package/package.json +3 -3
  36. package/src/account-resource-client.ts +2 -2
  37. package/src/builtin/0x1.ts +339 -339
  38. package/src/builtin/0x3.ts +15 -15
  39. package/src/builtin/0x4.ts +37 -37
  40. package/src/codegen/codegen.ts +5 -5
  41. package/src/codegen/run.ts +16 -7
  42. package/src/move-coder.ts +8 -15
  43. package/src/tests/types/0x48271d39d0b05bd6efca2278f22277d6fcc375504f9839fd73f74ace240861af.ts +44 -44
  44. package/src/tests/types/0x6b3720cd988adeaf721ed9d4730da4324d52364871a68eac62b46d21e4d2fa99.ts +45 -45
  45. package/src/tests/types/0x7fd500c11216f0fe3095d0c4b8aa4d64a4e2e04f83758462f2b127255643615.ts +26 -26
  46. package/src/tests/types/0x87978b35bf1eb73ae6cf04cfedcaa1f48254a683ebd00a21e7516a991edae3ac.ts +1 -1
  47. package/src/tests/types/0xbd35135844473187163ca197ca93b2ab014370587bb0ed3befff9e902d6bb541.ts +39 -39
@@ -711,7 +711,7 @@ export namespace token {
711
711
  },
712
712
  options?: InputGenerateTransactionOptions,
713
713
  ): Promise<PendingTransactionResponse> {
714
- const coder = defaultMoveCoder(client.config.fullnode);
714
+ const coder = defaultMoveCoder(client.config);
715
715
  const transaction = await client.transaction.build.simple({
716
716
  sender: account.accountAddress,
717
717
  data: {
@@ -736,7 +736,7 @@ export namespace token {
736
736
  },
737
737
  options?: InputGenerateTransactionOptions,
738
738
  ): Promise<PendingTransactionResponse> {
739
- const coder = defaultMoveCoder(client.config.fullnode);
739
+ const coder = defaultMoveCoder(client.config);
740
740
  const transaction = await client.transaction.build.simple({
741
741
  sender: account.accountAddress,
742
742
  data: {
@@ -761,7 +761,7 @@ export namespace token {
761
761
  },
762
762
  options?: InputGenerateTransactionOptions,
763
763
  ): Promise<PendingTransactionResponse> {
764
- const coder = defaultMoveCoder(client.config.fullnode);
764
+ const coder = defaultMoveCoder(client.config);
765
765
  const transaction = await client.transaction.build.simple({
766
766
  sender: account.accountAddress,
767
767
  data: {
@@ -800,7 +800,7 @@ export namespace token {
800
800
  },
801
801
  options?: InputGenerateTransactionOptions,
802
802
  ): Promise<PendingTransactionResponse> {
803
- const coder = defaultMoveCoder(client.config.fullnode);
803
+ const coder = defaultMoveCoder(client.config);
804
804
  const transaction = await client.transaction.build.simple({
805
805
  sender: account.accountAddress,
806
806
  data: {
@@ -832,7 +832,7 @@ export namespace token {
832
832
  },
833
833
  options?: InputGenerateTransactionOptions,
834
834
  ): Promise<PendingTransactionResponse> {
835
- const coder = defaultMoveCoder(client.config.fullnode);
835
+ const coder = defaultMoveCoder(client.config);
836
836
  const transaction = await client.transaction.build.simple({
837
837
  sender: account.accountAddress,
838
838
  data: {
@@ -857,7 +857,7 @@ export namespace token {
857
857
  },
858
858
  options?: InputGenerateTransactionOptions,
859
859
  ): Promise<PendingTransactionResponse> {
860
- const coder = defaultMoveCoder(client.config.fullnode);
860
+ const coder = defaultMoveCoder(client.config);
861
861
  const transaction = await client.transaction.build.simple({
862
862
  sender: account.accountAddress,
863
863
  data: {
@@ -882,7 +882,7 @@ export namespace token {
882
882
  },
883
883
  options?: InputGenerateTransactionOptions,
884
884
  ): Promise<PendingTransactionResponse> {
885
- const coder = defaultMoveCoder(client.config.fullnode);
885
+ const coder = defaultMoveCoder(client.config);
886
886
  const transaction = await client.transaction.build.simple({
887
887
  sender: account.accountAddress,
888
888
  data: {
@@ -917,7 +917,7 @@ export namespace token {
917
917
  },
918
918
  options?: InputGenerateTransactionOptions,
919
919
  ): Promise<PendingTransactionResponse> {
920
- const coder = defaultMoveCoder(client.config.fullnode);
920
+ const coder = defaultMoveCoder(client.config);
921
921
  const transaction = await client.transaction.build.simple({
922
922
  sender: account.accountAddress,
923
923
  data: {
@@ -942,7 +942,7 @@ export namespace token {
942
942
  },
943
943
  options?: InputGenerateTransactionOptions,
944
944
  ): Promise<PendingTransactionResponse> {
945
- const coder = defaultMoveCoder(client.config.fullnode);
945
+ const coder = defaultMoveCoder(client.config);
946
946
  const transaction = await client.transaction.build.simple({
947
947
  sender: account.accountAddress,
948
948
  data: {
@@ -974,7 +974,7 @@ export namespace token {
974
974
  },
975
975
  options?: InputGenerateTransactionOptions,
976
976
  ): Promise<PendingTransactionResponse> {
977
- const coder = defaultMoveCoder(client.config.fullnode);
977
+ const coder = defaultMoveCoder(client.config);
978
978
  const transaction = await client.transaction.build.simple({
979
979
  sender: account.accountAddress,
980
980
  data: {
@@ -998,7 +998,7 @@ export namespace token {
998
998
  },
999
999
  version?: bigint,
1000
1000
  ): Promise<[token.CollectionMutabilityConfig]> {
1001
- const coder = defaultMoveCoder(client.config.fullnode);
1001
+ const coder = defaultMoveCoder(client.config);
1002
1002
  const data: InputViewFunctionData = {
1003
1003
  function: "0x3::token::get_collection_mutability_config",
1004
1004
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1196,7 +1196,7 @@ export namespace token_coin_swap {
1196
1196
  },
1197
1197
  options?: InputGenerateTransactionOptions,
1198
1198
  ): Promise<PendingTransactionResponse> {
1199
- const coder = defaultMoveCoder(client.config.fullnode);
1199
+ const coder = defaultMoveCoder(client.config);
1200
1200
  const transaction = await client.transaction.build.simple({
1201
1201
  sender: account.accountAddress,
1202
1202
  data: {
@@ -1472,7 +1472,7 @@ export namespace token_transfers {
1472
1472
  },
1473
1473
  options?: InputGenerateTransactionOptions,
1474
1474
  ): Promise<PendingTransactionResponse> {
1475
- const coder = defaultMoveCoder(client.config.fullnode);
1475
+ const coder = defaultMoveCoder(client.config);
1476
1476
  const transaction = await client.transaction.build.simple({
1477
1477
  sender: account.accountAddress,
1478
1478
  data: {
@@ -1504,7 +1504,7 @@ export namespace token_transfers {
1504
1504
  },
1505
1505
  options?: InputGenerateTransactionOptions,
1506
1506
  ): Promise<PendingTransactionResponse> {
1507
- const coder = defaultMoveCoder(client.config.fullnode);
1507
+ const coder = defaultMoveCoder(client.config);
1508
1508
  const transaction = await client.transaction.build.simple({
1509
1509
  sender: account.accountAddress,
1510
1510
  data: {
@@ -1537,7 +1537,7 @@ export namespace token_transfers {
1537
1537
  },
1538
1538
  options?: InputGenerateTransactionOptions,
1539
1539
  ): Promise<PendingTransactionResponse> {
1540
- const coder = defaultMoveCoder(client.config.fullnode);
1540
+ const coder = defaultMoveCoder(client.config);
1541
1541
  const transaction = await client.transaction.build.simple({
1542
1542
  sender: account.accountAddress,
1543
1543
  data: {
@@ -168,7 +168,7 @@ export namespace token {
168
168
  },
169
169
  version?: bigint,
170
170
  ): Promise<[bigint]> {
171
- const coder = defaultMoveCoder(client.config.fullnode);
171
+ const coder = defaultMoveCoder(client.config);
172
172
  const data: InputViewFunctionData = {
173
173
  function: "0x4::token::index",
174
174
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -190,7 +190,7 @@ export namespace token {
190
190
  },
191
191
  version?: bigint,
192
192
  ): Promise<[MoveAddressType]> {
193
- const coder = defaultMoveCoder(client.config.fullnode);
193
+ const coder = defaultMoveCoder(client.config);
194
194
  const data: InputViewFunctionData = {
195
195
  function: "0x4::token::creator",
196
196
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -211,7 +211,7 @@ export namespace token {
211
211
  },
212
212
  version?: bigint,
213
213
  ): Promise<[string]> {
214
- const coder = defaultMoveCoder(client.config.fullnode);
214
+ const coder = defaultMoveCoder(client.config);
215
215
  const data: InputViewFunctionData = {
216
216
  function: "0x4::token::name",
217
217
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -233,7 +233,7 @@ export namespace token {
233
233
  },
234
234
  version?: bigint,
235
235
  ): Promise<[_0x1.option.Option<royalty.Royalty>]> {
236
- const coder = defaultMoveCoder(client.config.fullnode);
236
+ const coder = defaultMoveCoder(client.config);
237
237
  const data: InputViewFunctionData = {
238
238
  function: "0x4::token::royalty",
239
239
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -255,7 +255,7 @@ export namespace token {
255
255
  },
256
256
  version?: bigint,
257
257
  ): Promise<[string]> {
258
- const coder = defaultMoveCoder(client.config.fullnode);
258
+ const coder = defaultMoveCoder(client.config);
259
259
  const data: InputViewFunctionData = {
260
260
  function: "0x4::token::description",
261
261
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -276,7 +276,7 @@ export namespace token {
276
276
  },
277
277
  version?: bigint,
278
278
  ): Promise<[string]> {
279
- const coder = defaultMoveCoder(client.config.fullnode);
279
+ const coder = defaultMoveCoder(client.config);
280
280
  const data: InputViewFunctionData = {
281
281
  function: "0x4::token::uri",
282
282
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -298,7 +298,7 @@ export namespace token {
298
298
  },
299
299
  version?: bigint,
300
300
  ): Promise<[string]> {
301
- const coder = defaultMoveCoder(client.config.fullnode);
301
+ const coder = defaultMoveCoder(client.config);
302
302
  const data: InputViewFunctionData = {
303
303
  function: "0x4::token::collection_name",
304
304
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -319,7 +319,7 @@ export namespace token {
319
319
  },
320
320
  version?: bigint,
321
321
  ): Promise<[_0x1.object$.Object<collection.Collection>]> {
322
- const coder = defaultMoveCoder(client.config.fullnode);
322
+ const coder = defaultMoveCoder(client.config);
323
323
  const data: InputViewFunctionData = {
324
324
  function: "0x4::token::collection_object",
325
325
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -340,7 +340,7 @@ export namespace token {
340
340
  },
341
341
  version?: bigint,
342
342
  ): Promise<[MoveAddressType]> {
343
- const coder = defaultMoveCoder(client.config.fullnode);
343
+ const coder = defaultMoveCoder(client.config);
344
344
  const data: InputViewFunctionData = {
345
345
  function: "0x4::token::create_token_address_with_seed",
346
346
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -693,7 +693,7 @@ export namespace collection {
693
693
  },
694
694
  version?: bigint,
695
695
  ): Promise<[_0x1.option.Option<bigint>]> {
696
- const coder = defaultMoveCoder(client.config.fullnode);
696
+ const coder = defaultMoveCoder(client.config);
697
697
  const data: InputViewFunctionData = {
698
698
  function: "0x4::collection::count",
699
699
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -714,7 +714,7 @@ export namespace collection {
714
714
  },
715
715
  version?: bigint,
716
716
  ): Promise<[MoveAddressType]> {
717
- const coder = defaultMoveCoder(client.config.fullnode);
717
+ const coder = defaultMoveCoder(client.config);
718
718
  const data: InputViewFunctionData = {
719
719
  function: "0x4::collection::creator",
720
720
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -735,7 +735,7 @@ export namespace collection {
735
735
  },
736
736
  version?: bigint,
737
737
  ): Promise<[string]> {
738
- const coder = defaultMoveCoder(client.config.fullnode);
738
+ const coder = defaultMoveCoder(client.config);
739
739
  const data: InputViewFunctionData = {
740
740
  function: "0x4::collection::name",
741
741
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -757,7 +757,7 @@ export namespace collection {
757
757
  },
758
758
  version?: bigint,
759
759
  ): Promise<[string]> {
760
- const coder = defaultMoveCoder(client.config.fullnode);
760
+ const coder = defaultMoveCoder(client.config);
761
761
  const data: InputViewFunctionData = {
762
762
  function: "0x4::collection::description",
763
763
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -778,7 +778,7 @@ export namespace collection {
778
778
  },
779
779
  version?: bigint,
780
780
  ): Promise<[string]> {
781
- const coder = defaultMoveCoder(client.config.fullnode);
781
+ const coder = defaultMoveCoder(client.config);
782
782
  const data: InputViewFunctionData = {
783
783
  function: "0x4::collection::uri",
784
784
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -847,7 +847,7 @@ export namespace aptos_token {
847
847
  },
848
848
  options?: InputGenerateTransactionOptions,
849
849
  ): Promise<PendingTransactionResponse> {
850
- const coder = defaultMoveCoder(client.config.fullnode);
850
+ const coder = defaultMoveCoder(client.config);
851
851
  const transaction = await client.transaction.build.simple({
852
852
  sender: account.accountAddress,
853
853
  data: {
@@ -879,7 +879,7 @@ export namespace aptos_token {
879
879
  },
880
880
  options?: InputGenerateTransactionOptions,
881
881
  ): Promise<PendingTransactionResponse> {
882
- const coder = defaultMoveCoder(client.config.fullnode);
882
+ const coder = defaultMoveCoder(client.config);
883
883
  const transaction = await client.transaction.build.simple({
884
884
  sender: account.accountAddress,
885
885
  data: {
@@ -903,7 +903,7 @@ export namespace aptos_token {
903
903
  },
904
904
  options?: InputGenerateTransactionOptions,
905
905
  ): Promise<PendingTransactionResponse> {
906
- const coder = defaultMoveCoder(client.config.fullnode);
906
+ const coder = defaultMoveCoder(client.config);
907
907
  const transaction = await client.transaction.build.simple({
908
908
  sender: account.accountAddress,
909
909
  data: {
@@ -927,7 +927,7 @@ export namespace aptos_token {
927
927
  },
928
928
  options?: InputGenerateTransactionOptions,
929
929
  ): Promise<PendingTransactionResponse> {
930
- const coder = defaultMoveCoder(client.config.fullnode);
930
+ const coder = defaultMoveCoder(client.config);
931
931
  const transaction = await client.transaction.build.simple({
932
932
  sender: account.accountAddress,
933
933
  data: {
@@ -951,7 +951,7 @@ export namespace aptos_token {
951
951
  },
952
952
  options?: InputGenerateTransactionOptions,
953
953
  ): Promise<PendingTransactionResponse> {
954
- const coder = defaultMoveCoder(client.config.fullnode);
954
+ const coder = defaultMoveCoder(client.config);
955
955
  const transaction = await client.transaction.build.simple({
956
956
  sender: account.accountAddress,
957
957
  data: {
@@ -975,7 +975,7 @@ export namespace aptos_token {
975
975
  },
976
976
  options?: InputGenerateTransactionOptions,
977
977
  ): Promise<PendingTransactionResponse> {
978
- const coder = defaultMoveCoder(client.config.fullnode);
978
+ const coder = defaultMoveCoder(client.config);
979
979
  const transaction = await client.transaction.build.simple({
980
980
  sender: account.accountAddress,
981
981
  data: {
@@ -999,7 +999,7 @@ export namespace aptos_token {
999
999
  },
1000
1000
  options?: InputGenerateTransactionOptions,
1001
1001
  ): Promise<PendingTransactionResponse> {
1002
- const coder = defaultMoveCoder(client.config.fullnode);
1002
+ const coder = defaultMoveCoder(client.config);
1003
1003
  const transaction = await client.transaction.build.simple({
1004
1004
  sender: account.accountAddress,
1005
1005
  data: {
@@ -1040,7 +1040,7 @@ export namespace aptos_token {
1040
1040
  },
1041
1041
  options?: InputGenerateTransactionOptions,
1042
1042
  ): Promise<PendingTransactionResponse> {
1043
- const coder = defaultMoveCoder(client.config.fullnode);
1043
+ const coder = defaultMoveCoder(client.config);
1044
1044
  const transaction = await client.transaction.build.simple({
1045
1045
  sender: account.accountAddress,
1046
1046
  data: {
@@ -1065,7 +1065,7 @@ export namespace aptos_token {
1065
1065
  },
1066
1066
  options?: InputGenerateTransactionOptions,
1067
1067
  ): Promise<PendingTransactionResponse> {
1068
- const coder = defaultMoveCoder(client.config.fullnode);
1068
+ const coder = defaultMoveCoder(client.config);
1069
1069
  const transaction = await client.transaction.build.simple({
1070
1070
  sender: account.accountAddress,
1071
1071
  data: {
@@ -1099,7 +1099,7 @@ export namespace aptos_token {
1099
1099
  },
1100
1100
  options?: InputGenerateTransactionOptions,
1101
1101
  ): Promise<PendingTransactionResponse> {
1102
- const coder = defaultMoveCoder(client.config.fullnode);
1102
+ const coder = defaultMoveCoder(client.config);
1103
1103
  const transaction = await client.transaction.build.simple({
1104
1104
  sender: account.accountAddress,
1105
1105
  data: {
@@ -1124,7 +1124,7 @@ export namespace aptos_token {
1124
1124
  },
1125
1125
  options?: InputGenerateTransactionOptions,
1126
1126
  ): Promise<PendingTransactionResponse> {
1127
- const coder = defaultMoveCoder(client.config.fullnode);
1127
+ const coder = defaultMoveCoder(client.config);
1128
1128
  const transaction = await client.transaction.build.simple({
1129
1129
  sender: account.accountAddress,
1130
1130
  data: {
@@ -1148,7 +1148,7 @@ export namespace aptos_token {
1148
1148
  },
1149
1149
  options?: InputGenerateTransactionOptions,
1150
1150
  ): Promise<PendingTransactionResponse> {
1151
- const coder = defaultMoveCoder(client.config.fullnode);
1151
+ const coder = defaultMoveCoder(client.config);
1152
1152
  const transaction = await client.transaction.build.simple({
1153
1153
  sender: account.accountAddress,
1154
1154
  data: {
@@ -1178,7 +1178,7 @@ export namespace aptos_token {
1178
1178
  },
1179
1179
  options?: InputGenerateTransactionOptions,
1180
1180
  ): Promise<PendingTransactionResponse> {
1181
- const coder = defaultMoveCoder(client.config.fullnode);
1181
+ const coder = defaultMoveCoder(client.config);
1182
1182
  const transaction = await client.transaction.build.simple({
1183
1183
  sender: account.accountAddress,
1184
1184
  data: {
@@ -1202,7 +1202,7 @@ export namespace aptos_token {
1202
1202
  },
1203
1203
  options?: InputGenerateTransactionOptions,
1204
1204
  ): Promise<PendingTransactionResponse> {
1205
- const coder = defaultMoveCoder(client.config.fullnode);
1205
+ const coder = defaultMoveCoder(client.config);
1206
1206
  const transaction = await client.transaction.build.simple({
1207
1207
  sender: account.accountAddress,
1208
1208
  data: {
@@ -1226,7 +1226,7 @@ export namespace aptos_token {
1226
1226
  },
1227
1227
  options?: InputGenerateTransactionOptions,
1228
1228
  ): Promise<PendingTransactionResponse> {
1229
- const coder = defaultMoveCoder(client.config.fullnode);
1229
+ const coder = defaultMoveCoder(client.config);
1230
1230
  const transaction = await client.transaction.build.simple({
1231
1231
  sender: account.accountAddress,
1232
1232
  data: {
@@ -1250,7 +1250,7 @@ export namespace aptos_token {
1250
1250
  },
1251
1251
  options?: InputGenerateTransactionOptions,
1252
1252
  ): Promise<PendingTransactionResponse> {
1253
- const coder = defaultMoveCoder(client.config.fullnode);
1253
+ const coder = defaultMoveCoder(client.config);
1254
1254
  const transaction = await client.transaction.build.simple({
1255
1255
  sender: account.accountAddress,
1256
1256
  data: {
@@ -1274,7 +1274,7 @@ export namespace aptos_token {
1274
1274
  },
1275
1275
  options?: InputGenerateTransactionOptions,
1276
1276
  ): Promise<PendingTransactionResponse> {
1277
- const coder = defaultMoveCoder(client.config.fullnode);
1277
+ const coder = defaultMoveCoder(client.config);
1278
1278
  const transaction = await client.transaction.build.simple({
1279
1279
  sender: account.accountAddress,
1280
1280
  data: {
@@ -1299,7 +1299,7 @@ export namespace aptos_token {
1299
1299
  },
1300
1300
  version?: bigint,
1301
1301
  ): Promise<[boolean]> {
1302
- const coder = defaultMoveCoder(client.config.fullnode);
1302
+ const coder = defaultMoveCoder(client.config);
1303
1303
  const data: InputViewFunctionData = {
1304
1304
  function: "0x4::aptos_token::are_properties_mutable",
1305
1305
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1323,7 +1323,7 @@ export namespace aptos_token {
1323
1323
  },
1324
1324
  version?: bigint,
1325
1325
  ): Promise<[boolean]> {
1326
- const coder = defaultMoveCoder(client.config.fullnode);
1326
+ const coder = defaultMoveCoder(client.config);
1327
1327
  const data: InputViewFunctionData = {
1328
1328
  function: "0x4::aptos_token::is_burnable",
1329
1329
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1344,7 +1344,7 @@ export namespace aptos_token {
1344
1344
  },
1345
1345
  version?: bigint,
1346
1346
  ): Promise<[boolean]> {
1347
- const coder = defaultMoveCoder(client.config.fullnode);
1347
+ const coder = defaultMoveCoder(client.config);
1348
1348
  const data: InputViewFunctionData = {
1349
1349
  function: "0x4::aptos_token::is_freezable_by_creator",
1350
1350
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1368,7 +1368,7 @@ export namespace aptos_token {
1368
1368
  },
1369
1369
  version?: bigint,
1370
1370
  ): Promise<[boolean]> {
1371
- const coder = defaultMoveCoder(client.config.fullnode);
1371
+ const coder = defaultMoveCoder(client.config);
1372
1372
  const data: InputViewFunctionData = {
1373
1373
  function: "0x4::aptos_token::is_mutable_description",
1374
1374
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1391,7 +1391,7 @@ export namespace aptos_token {
1391
1391
  },
1392
1392
  version?: bigint,
1393
1393
  ): Promise<[boolean]> {
1394
- const coder = defaultMoveCoder(client.config.fullnode);
1394
+ const coder = defaultMoveCoder(client.config);
1395
1395
  const data: InputViewFunctionData = {
1396
1396
  function: "0x4::aptos_token::is_mutable_name",
1397
1397
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -1414,7 +1414,7 @@ export namespace aptos_token {
1414
1414
  },
1415
1415
  version?: bigint,
1416
1416
  ): Promise<[boolean]> {
1417
- const coder = defaultMoveCoder(client.config.fullnode);
1417
+ const coder = defaultMoveCoder(client.config);
1418
1418
  const data: InputViewFunctionData = {
1419
1419
  function: "0x4::aptos_token::is_mutable_uri",
1420
1420
  functionArguments: coder.encodeArray(request.functionArguments),
@@ -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
  }