@openzeppelin/ui-builder-adapter-evm 0.11.1 → 0.13.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.
- package/dist/index.cjs +77 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +63 -38
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
- package/src/__tests__/mocks/mock-network-configs.ts +0 -1
- package/src/mapping/__tests__/field-generator.test.ts +100 -0
- package/src/mapping/__tests__/type-mapper.test.ts +139 -0
- package/src/mapping/constants.ts +12 -6
- package/src/mapping/field-generator.ts +6 -5
- package/src/mapping/type-mapper.ts +6 -6
- package/src/networks/README.md +1 -1
- package/src/networks/mainnet.ts +23 -11
- package/src/networks/testnet.ts +25 -12
package/dist/index.js
CHANGED
|
@@ -440,6 +440,18 @@ import { http as http2 } from "viem";
|
|
|
440
440
|
import { appConfigService as appConfigService2, logger as logger7 } from "@openzeppelin/ui-builder-utils";
|
|
441
441
|
|
|
442
442
|
// src/networks/mainnet.ts
|
|
443
|
+
import {
|
|
444
|
+
NetworkArbitrumOne,
|
|
445
|
+
NetworkAvalanche,
|
|
446
|
+
NetworkBase,
|
|
447
|
+
NetworkBinanceSmartChain,
|
|
448
|
+
NetworkEthereum,
|
|
449
|
+
NetworkLinea,
|
|
450
|
+
NetworkOptimism,
|
|
451
|
+
NetworkPolygon,
|
|
452
|
+
NetworkScroll,
|
|
453
|
+
NetworkZksync
|
|
454
|
+
} from "@web3icons/react";
|
|
443
455
|
import {
|
|
444
456
|
arbitrum as viemArbitrum,
|
|
445
457
|
avalanche as viemAvalanche,
|
|
@@ -467,7 +479,7 @@ var ethereumMainnet = {
|
|
|
467
479
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
468
480
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
469
481
|
supportsEtherscanV2: true,
|
|
470
|
-
|
|
482
|
+
iconComponent: NetworkEthereum,
|
|
471
483
|
nativeCurrency: {
|
|
472
484
|
name: "Ether",
|
|
473
485
|
symbol: "ETH",
|
|
@@ -489,7 +501,7 @@ var arbitrumMainnet = {
|
|
|
489
501
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
490
502
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
491
503
|
supportsEtherscanV2: true,
|
|
492
|
-
|
|
504
|
+
iconComponent: NetworkArbitrumOne,
|
|
493
505
|
nativeCurrency: {
|
|
494
506
|
name: "Ether",
|
|
495
507
|
symbol: "ETH",
|
|
@@ -511,7 +523,7 @@ var polygonMainnet = {
|
|
|
511
523
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
512
524
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
513
525
|
supportsEtherscanV2: true,
|
|
514
|
-
|
|
526
|
+
iconComponent: NetworkPolygon,
|
|
515
527
|
nativeCurrency: {
|
|
516
528
|
name: "MATIC",
|
|
517
529
|
symbol: "MATIC",
|
|
@@ -533,7 +545,7 @@ var polygonZkEvmMainnet = {
|
|
|
533
545
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
534
546
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
535
547
|
supportsEtherscanV2: true,
|
|
536
|
-
|
|
548
|
+
iconComponent: NetworkPolygon,
|
|
537
549
|
nativeCurrency: {
|
|
538
550
|
name: "Ether",
|
|
539
551
|
symbol: "ETH",
|
|
@@ -555,7 +567,7 @@ var baseMainnet = {
|
|
|
555
567
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
556
568
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
557
569
|
supportsEtherscanV2: true,
|
|
558
|
-
|
|
570
|
+
iconComponent: NetworkBase,
|
|
559
571
|
nativeCurrency: {
|
|
560
572
|
name: "Ether",
|
|
561
573
|
symbol: "ETH",
|
|
@@ -577,7 +589,7 @@ var bscMainnet = {
|
|
|
577
589
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
578
590
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
579
591
|
supportsEtherscanV2: true,
|
|
580
|
-
|
|
592
|
+
iconComponent: NetworkBinanceSmartChain,
|
|
581
593
|
nativeCurrency: {
|
|
582
594
|
name: "BNB",
|
|
583
595
|
symbol: "BNB",
|
|
@@ -599,7 +611,7 @@ var optimismMainnet = {
|
|
|
599
611
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
600
612
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
601
613
|
supportsEtherscanV2: true,
|
|
602
|
-
|
|
614
|
+
iconComponent: NetworkOptimism,
|
|
603
615
|
nativeCurrency: {
|
|
604
616
|
name: "Ether",
|
|
605
617
|
symbol: "ETH",
|
|
@@ -621,7 +633,7 @@ var avalancheMainnet = {
|
|
|
621
633
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
622
634
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
623
635
|
supportsEtherscanV2: true,
|
|
624
|
-
|
|
636
|
+
iconComponent: NetworkAvalanche,
|
|
625
637
|
nativeCurrency: {
|
|
626
638
|
name: "Avalanche",
|
|
627
639
|
symbol: "AVAX",
|
|
@@ -643,7 +655,7 @@ var zkSyncEraMainnet = {
|
|
|
643
655
|
apiUrl: "https://block-explorer-api.mainnet.zksync.io/api",
|
|
644
656
|
primaryExplorerApiIdentifier: "zksync-era-mainnet",
|
|
645
657
|
supportsEtherscanV2: false,
|
|
646
|
-
|
|
658
|
+
iconComponent: NetworkZksync,
|
|
647
659
|
nativeCurrency: {
|
|
648
660
|
name: "Ether",
|
|
649
661
|
symbol: "ETH",
|
|
@@ -665,7 +677,7 @@ var scrollMainnet = {
|
|
|
665
677
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
666
678
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
667
679
|
supportsEtherscanV2: true,
|
|
668
|
-
|
|
680
|
+
iconComponent: NetworkScroll,
|
|
669
681
|
nativeCurrency: {
|
|
670
682
|
name: "Ether",
|
|
671
683
|
symbol: "ETH",
|
|
@@ -687,7 +699,7 @@ var lineaMainnet = {
|
|
|
687
699
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
688
700
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
689
701
|
supportsEtherscanV2: true,
|
|
690
|
-
|
|
702
|
+
iconComponent: NetworkLinea,
|
|
691
703
|
nativeCurrency: {
|
|
692
704
|
name: "Ether",
|
|
693
705
|
symbol: "ETH",
|
|
@@ -697,6 +709,19 @@ var lineaMainnet = {
|
|
|
697
709
|
};
|
|
698
710
|
|
|
699
711
|
// src/networks/testnet.ts
|
|
712
|
+
import {
|
|
713
|
+
NetworkArbitrumOne as NetworkArbitrumOne2,
|
|
714
|
+
NetworkAvalanche as NetworkAvalanche2,
|
|
715
|
+
NetworkBase as NetworkBase2,
|
|
716
|
+
NetworkBinanceSmartChain as NetworkBinanceSmartChain2,
|
|
717
|
+
NetworkEthereum as NetworkEthereum2,
|
|
718
|
+
NetworkLinea as NetworkLinea2,
|
|
719
|
+
NetworkMonad,
|
|
720
|
+
NetworkOptimism as NetworkOptimism2,
|
|
721
|
+
NetworkPolygon as NetworkPolygon2,
|
|
722
|
+
NetworkScroll as NetworkScroll2,
|
|
723
|
+
NetworkZksync as NetworkZksync2
|
|
724
|
+
} from "@web3icons/react";
|
|
700
725
|
import {
|
|
701
726
|
arbitrumSepolia as viemArbitrumSepolia,
|
|
702
727
|
avalancheFuji as viemAvalancheFuji,
|
|
@@ -725,7 +750,7 @@ var ethereumSepolia = {
|
|
|
725
750
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
726
751
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
727
752
|
supportsEtherscanV2: true,
|
|
728
|
-
|
|
753
|
+
iconComponent: NetworkEthereum2,
|
|
729
754
|
nativeCurrency: {
|
|
730
755
|
name: "Sepolia Ether",
|
|
731
756
|
symbol: "ETH",
|
|
@@ -747,7 +772,7 @@ var arbitrumSepolia = {
|
|
|
747
772
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
748
773
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
749
774
|
supportsEtherscanV2: true,
|
|
750
|
-
|
|
775
|
+
iconComponent: NetworkArbitrumOne2,
|
|
751
776
|
nativeCurrency: {
|
|
752
777
|
name: "Arbitrum Sepolia Ether",
|
|
753
778
|
symbol: "ETH",
|
|
@@ -769,7 +794,7 @@ var polygonAmoy = {
|
|
|
769
794
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
770
795
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
771
796
|
supportsEtherscanV2: true,
|
|
772
|
-
|
|
797
|
+
iconComponent: NetworkPolygon2,
|
|
773
798
|
nativeCurrency: {
|
|
774
799
|
name: "MATIC",
|
|
775
800
|
symbol: "MATIC",
|
|
@@ -791,7 +816,7 @@ var polygonZkEvmCardona = {
|
|
|
791
816
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
792
817
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
793
818
|
supportsEtherscanV2: true,
|
|
794
|
-
|
|
819
|
+
iconComponent: NetworkPolygon2,
|
|
795
820
|
nativeCurrency: {
|
|
796
821
|
name: "Ether",
|
|
797
822
|
symbol: "ETH",
|
|
@@ -813,7 +838,7 @@ var baseSepolia = {
|
|
|
813
838
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
814
839
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
815
840
|
supportsEtherscanV2: true,
|
|
816
|
-
|
|
841
|
+
iconComponent: NetworkBase2,
|
|
817
842
|
nativeCurrency: {
|
|
818
843
|
name: "Sepolia Ether",
|
|
819
844
|
symbol: "ETH",
|
|
@@ -835,7 +860,7 @@ var bscTestnet = {
|
|
|
835
860
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
836
861
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
837
862
|
supportsEtherscanV2: true,
|
|
838
|
-
|
|
863
|
+
iconComponent: NetworkBinanceSmartChain2,
|
|
839
864
|
nativeCurrency: {
|
|
840
865
|
name: "BNB",
|
|
841
866
|
symbol: "BNB",
|
|
@@ -857,7 +882,7 @@ var optimismSepolia = {
|
|
|
857
882
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
858
883
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
859
884
|
supportsEtherscanV2: true,
|
|
860
|
-
|
|
885
|
+
iconComponent: NetworkOptimism2,
|
|
861
886
|
nativeCurrency: {
|
|
862
887
|
name: "Sepolia Ether",
|
|
863
888
|
symbol: "ETH",
|
|
@@ -882,7 +907,7 @@ var avalancheFuji = {
|
|
|
882
907
|
// Unified identifier for V2 API
|
|
883
908
|
supportsEtherscanV2: true,
|
|
884
909
|
requiresExplorerApiKey: true,
|
|
885
|
-
|
|
910
|
+
iconComponent: NetworkAvalanche2,
|
|
886
911
|
nativeCurrency: {
|
|
887
912
|
name: "Avalanche",
|
|
888
913
|
symbol: "AVAX",
|
|
@@ -904,7 +929,7 @@ var zksyncSepoliaTestnet = {
|
|
|
904
929
|
apiUrl: "https://block-explorer-api.sepolia.zksync.dev/api",
|
|
905
930
|
primaryExplorerApiIdentifier: "zksync-era-sepolia",
|
|
906
931
|
supportsEtherscanV2: false,
|
|
907
|
-
|
|
932
|
+
iconComponent: NetworkZksync2,
|
|
908
933
|
nativeCurrency: {
|
|
909
934
|
name: "Ether",
|
|
910
935
|
symbol: "ETH",
|
|
@@ -926,7 +951,7 @@ var scrollSepolia = {
|
|
|
926
951
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
927
952
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
928
953
|
supportsEtherscanV2: true,
|
|
929
|
-
|
|
954
|
+
iconComponent: NetworkScroll2,
|
|
930
955
|
nativeCurrency: {
|
|
931
956
|
name: "Ether",
|
|
932
957
|
symbol: "ETH",
|
|
@@ -948,7 +973,7 @@ var lineaSepolia = {
|
|
|
948
973
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
949
974
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
950
975
|
supportsEtherscanV2: true,
|
|
951
|
-
|
|
976
|
+
iconComponent: NetworkLinea2,
|
|
952
977
|
nativeCurrency: {
|
|
953
978
|
name: "Linea Ether",
|
|
954
979
|
symbol: "ETH",
|
|
@@ -970,7 +995,7 @@ var monadTestnet = {
|
|
|
970
995
|
apiUrl: "https://api.etherscan.io/v2/api",
|
|
971
996
|
primaryExplorerApiIdentifier: "etherscan-v2",
|
|
972
997
|
supportsEtherscanV2: true,
|
|
973
|
-
|
|
998
|
+
iconComponent: NetworkMonad,
|
|
974
999
|
nativeCurrency: {
|
|
975
1000
|
name: "Monad",
|
|
976
1001
|
symbol: "MON",
|
|
@@ -4000,16 +4025,16 @@ var EVM_TYPE_TO_FIELD_TYPE = {
|
|
|
4000
4025
|
uint8: "number",
|
|
4001
4026
|
uint16: "number",
|
|
4002
4027
|
uint32: "number",
|
|
4003
|
-
uint64: "
|
|
4004
|
-
uint128: "
|
|
4005
|
-
uint256: "
|
|
4028
|
+
uint64: "bigint",
|
|
4029
|
+
uint128: "bigint",
|
|
4030
|
+
uint256: "bigint",
|
|
4006
4031
|
int: "number",
|
|
4007
4032
|
int8: "number",
|
|
4008
4033
|
int16: "number",
|
|
4009
4034
|
int32: "number",
|
|
4010
|
-
int64: "
|
|
4011
|
-
int128: "
|
|
4012
|
-
int256: "
|
|
4035
|
+
int64: "bigint",
|
|
4036
|
+
int128: "bigint",
|
|
4037
|
+
int256: "bigint",
|
|
4013
4038
|
bool: "checkbox",
|
|
4014
4039
|
bytes: "textarea",
|
|
4015
4040
|
bytes32: "text"
|
|
@@ -4046,16 +4071,16 @@ function getEvmCompatibleFieldTypes(parameterType) {
|
|
|
4046
4071
|
uint8: ["number", "amount", "text"],
|
|
4047
4072
|
uint16: ["number", "amount", "text"],
|
|
4048
4073
|
uint32: ["number", "amount", "text"],
|
|
4049
|
-
uint64: ["number", "amount", "text"],
|
|
4050
|
-
uint128: ["number", "amount", "text"],
|
|
4051
|
-
uint256: ["number", "amount", "text"],
|
|
4074
|
+
uint64: ["bigint", "number", "amount", "text"],
|
|
4075
|
+
uint128: ["bigint", "number", "amount", "text"],
|
|
4076
|
+
uint256: ["bigint", "number", "amount", "text"],
|
|
4052
4077
|
int: ["number", "text"],
|
|
4053
4078
|
int8: ["number", "text"],
|
|
4054
4079
|
int16: ["number", "text"],
|
|
4055
4080
|
int32: ["number", "text"],
|
|
4056
|
-
int64: ["number", "text"],
|
|
4057
|
-
int128: ["number", "text"],
|
|
4058
|
-
int256: ["number", "text"],
|
|
4081
|
+
int64: ["bigint", "number", "text"],
|
|
4082
|
+
int128: ["bigint", "number", "text"],
|
|
4083
|
+
int256: ["bigint", "number", "text"],
|
|
4059
4084
|
bool: ["checkbox", "select", "radio", "text"],
|
|
4060
4085
|
string: ["text", "textarea", "email", "password"],
|
|
4061
4086
|
bytes: ["textarea", "text"],
|
|
@@ -4074,7 +4099,7 @@ function extractArrayElementType(parameterType) {
|
|
|
4074
4099
|
}
|
|
4075
4100
|
return null;
|
|
4076
4101
|
}
|
|
4077
|
-
function
|
|
4102
|
+
function getDefaultValidation() {
|
|
4078
4103
|
return { required: true };
|
|
4079
4104
|
}
|
|
4080
4105
|
function generateEvmDefaultField(parameter) {
|
|
@@ -4088,7 +4113,7 @@ function generateEvmDefaultField(parameter) {
|
|
|
4088
4113
|
placeholder: `Enter ${parameter.displayName || parameter.name || parameter.type}`,
|
|
4089
4114
|
helperText: parameter.description || "",
|
|
4090
4115
|
defaultValue: getDefaultValueForType(fieldType),
|
|
4091
|
-
validation:
|
|
4116
|
+
validation: getDefaultValidation(),
|
|
4092
4117
|
width: "full"
|
|
4093
4118
|
};
|
|
4094
4119
|
if (fieldType === "array") {
|
|
@@ -4100,7 +4125,7 @@ function generateEvmDefaultField(parameter) {
|
|
|
4100
4125
|
elementType: elementFieldType,
|
|
4101
4126
|
elementFieldConfig: {
|
|
4102
4127
|
type: elementFieldType,
|
|
4103
|
-
validation:
|
|
4128
|
+
validation: getDefaultValidation(),
|
|
4104
4129
|
placeholder: `Enter ${elementType}`
|
|
4105
4130
|
}
|
|
4106
4131
|
};
|