feat(@wallet): mask api keys
This commit is contained in:
parent
faf4933262
commit
678f751121
|
@ -10,6 +10,8 @@ QtObject:
|
|||
chainColor: string
|
||||
rpcURL: string
|
||||
fallbackURL: string
|
||||
originalRpcURL: string
|
||||
originalFallbackURL: string
|
||||
blockExplorerURL: string
|
||||
nativeCurrencySymbol: string
|
||||
|
||||
|
@ -22,6 +24,8 @@ QtObject:
|
|||
chainColor: string,
|
||||
rpcURL: string,
|
||||
fallbackURL: string,
|
||||
originalRpcURL: string,
|
||||
originalFallbackURL: string,
|
||||
blockExplorerURL: string,
|
||||
nativeCurrencySymbol: string
|
||||
) =
|
||||
|
@ -34,6 +38,8 @@ QtObject:
|
|||
self.chainColor = chainColor
|
||||
self.rpcURL = rpcURL
|
||||
self.fallbackURL = fallbackURL
|
||||
self.originalRpcURL = originalRpcURL
|
||||
self.originalFallbackURL = originalFallbackURL
|
||||
self.blockExplorerURL = blockExplorerURL
|
||||
self.nativeCurrencySymbol = nativeCurrencySymbol
|
||||
|
||||
|
@ -49,11 +55,13 @@ QtObject:
|
|||
chainColor: string,
|
||||
rpcURL: string,
|
||||
fallbackURL: string,
|
||||
originalRpcURL: string,
|
||||
originalFallbackURL: string,
|
||||
blockExplorerURL: string,
|
||||
nativeCurrencySymbol: string
|
||||
): Item =
|
||||
new(result, delete)
|
||||
result.setup(chainId, layer, chainName, iconUrl, shortName, chainColor, rpcURL, fallbackURL, blockExplorerURL, nativeCurrencySymbol)
|
||||
result.setup(chainId, layer, chainName, iconUrl, shortName, chainColor, rpcURL, fallbackURL, originalRpcURL, originalFallbackURL, blockExplorerURL, nativeCurrencySymbol)
|
||||
|
||||
proc `$`*(self: Item): string =
|
||||
result = fmt"""NetworkItem(
|
||||
|
@ -125,6 +133,20 @@ QtObject:
|
|||
read = fallbackURL
|
||||
notify = fallbackURLChanged
|
||||
|
||||
proc originalRpcURLChanged*(self: Item) {.signal.}
|
||||
proc originalRpcURL*(self: Item): string {.slot.} =
|
||||
return self.originalRpcURL
|
||||
QtProperty[string] originalRpcURL:
|
||||
read = originalRpcURL
|
||||
notify = originalRpcURLChanged
|
||||
|
||||
proc originalFallbackURLChanged*(self: Item) {.signal.}
|
||||
proc originalFallbackURL*(self: Item): string {.slot.} =
|
||||
return self.originalFallbackURL
|
||||
QtProperty[string] originalFallbackURL:
|
||||
read = originalFallbackURL
|
||||
notify = originalFallbackURLChanged
|
||||
|
||||
proc blockExplorerURLChanged*(self: Item) {.signal.}
|
||||
proc blockExplorerURL*(self: Item): string {.slot.} =
|
||||
return self.blockExplorerURL
|
||||
|
|
|
@ -51,6 +51,8 @@ method refreshNetworks*(self: Module) =
|
|||
n.prod.chainColor,
|
||||
n.prod.rpcURL,
|
||||
n.prod.fallbackURL,
|
||||
n.prod.originalRpcURL,
|
||||
n.prod.originalFallbackURL,
|
||||
n.prod.blockExplorerURL,
|
||||
n.prod.nativeCurrencySymbol
|
||||
)
|
||||
|
@ -63,6 +65,8 @@ method refreshNetworks*(self: Module) =
|
|||
n.test.chainColor,
|
||||
n.test.rpcURL,
|
||||
n.test.fallbackURL,
|
||||
n.test.originalRpcURL,
|
||||
n.test.originalFallbackURL,
|
||||
n.test.blockExplorerURL,
|
||||
n.test.nativeCurrencySymbol
|
||||
)
|
||||
|
|
|
@ -9,7 +9,9 @@ type NetworkDto* = ref object
|
|||
layer* {.serializedFieldName("layer").}: int
|
||||
chainName* {.serializedFieldName("chainName").}: string
|
||||
rpcURL* {.serializedFieldName("rpcUrl").}: string
|
||||
originalRpcURL* {.serializedFieldName("originalRpcUrl").}: string
|
||||
fallbackURL* {.serializedFieldName("fallbackURL").}: string
|
||||
originalFallbackURL* {.serializedFieldName("originalFallbackURL").}: string
|
||||
blockExplorerURL* {.serializedFieldName("blockExplorerUrl").}: string
|
||||
iconURL* {.serializedFieldName("iconUrl").}: string
|
||||
nativeCurrencyName* {.serializedFieldName("nativeCurrencyName").}: string
|
||||
|
|
|
@ -129,6 +129,8 @@ QtObject {
|
|||
chainColor: combinedNetwork.prod.chainColor,
|
||||
rpcURL: combinedNetwork.prod.rpcURL,
|
||||
fallbackURL: combinedNetwork.prod.fallbackURL,
|
||||
originalRpcURL: combinedNetwork.prod.originalRpcURL,
|
||||
originalFallbackURL: combinedNetwork.prod.originalFallbackURL,
|
||||
blockExplorerURL: combinedNetwork.prod.blockExplorerURL,
|
||||
nativeCurrencySymbol: combinedNetwork.prod.nativeCurrencySymbol},
|
||||
test: {chainId: combinedNetwork.test.chainId,
|
||||
|
@ -139,6 +141,8 @@ QtObject {
|
|||
chainColor: combinedNetwork.test.chainColor,
|
||||
rpcURL: combinedNetwork.test.rpcURL,
|
||||
fallbackURL: combinedNetwork.test.fallbackURL,
|
||||
originalRpcURL: combinedNetwork.test.originalRpcURL,
|
||||
originalFallbackURL: combinedNetwork.test.originalFallbackURL,
|
||||
blockExplorerURL: combinedNetwork.test.blockExplorerURL,
|
||||
nativeCurrencySymbol: combinedNetwork.test.nativeCurrencySymbol},
|
||||
layer: combinedNetwork.layer
|
||||
|
|
|
@ -131,9 +131,17 @@ ColumnLayout {
|
|||
id: mainRpcInput
|
||||
width: parent.width
|
||||
label: qsTr("Main JSON RPC URL")
|
||||
text: !!network ? network.rpcURL : ""
|
||||
text: {
|
||||
if (!network) {
|
||||
return ""
|
||||
}
|
||||
if (network.originalRpcURL == network.rpcURL) {
|
||||
return network.rpcURL.replace(/(.*\/).*/, '$1')
|
||||
}
|
||||
return network.rpcURL
|
||||
}
|
||||
onTextChanged: {
|
||||
if(!!text && text !== network.rpcURL) {
|
||||
if(!!text && text !== network.rpcURL.replace(/(.*\/).*/, '$1')) {
|
||||
d.evaluationStatus = EditNetworkForm.Pending
|
||||
Qt.callLater(d.evaluateRpcEndPoint, text);
|
||||
}
|
||||
|
@ -154,9 +162,17 @@ ColumnLayout {
|
|||
id: failoverRpcUrlInput
|
||||
Layout.fillWidth: true
|
||||
label: qsTr("Failover JSON RPC URL")
|
||||
text: !!network ? network.fallbackURL : ""
|
||||
text: {
|
||||
if (!network) {
|
||||
return ""
|
||||
}
|
||||
if (network.originalFallbackURL == network.fallbackURL) {
|
||||
return network.fallbackURL.replace(/(.*\/).*/, '$1')
|
||||
}
|
||||
return network.fallbackURL
|
||||
}
|
||||
onTextChanged: {
|
||||
if(!!text && text !== network.fallbackURL) {
|
||||
if(!!text && text !== network.fallbackURL.replace(/(.*\/).*/, '$1')) {
|
||||
d.evaluationStatusFallBackRpc = EditNetworkForm.Pending
|
||||
Qt.callLater(d.evaluateRpcEndPoint, text);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue