diff --git a/cadence/scripts/bridge/get_associated_type.cdc b/cadence/scripts/bridge/get_associated_type.cdc new file mode 100644 index 00000000..52520f03 --- /dev/null +++ b/cadence/scripts/bridge/get_associated_type.cdc @@ -0,0 +1,17 @@ +import "EVM" + +import "EVMUtils" +import "FlowEVMBridgeConfig" + +/// Returns the Cadence Type associated with the given EVM address (as its hex String) +/// +/// @param evmAddressHex: The hex-encoded address of the EVM contract as a String +/// +/// @return The Cadence Type associated with the EVM address or nil if the address is not onboarded. `nil` may also be +/// returned if the address is not a valid EVM address. +/// +access(all) +fun main(addressHex: String): Type? { + let address = EVMUtils.getEVMAddressFromHexString(address: addressHex) + return address != nil ? FlowEVMBridgeConfig.getTypeAssociated(with: address!) : nil +}