Merge pull request #1357 from AlphaWallet/fix-server-not-initialized

fix server not initialized
pull/1272/head
James Sangalli 5 years ago committed by GitHub
commit 7ab60defd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      AlphaWallet/TokenScriptClient/Models/XMLHandler.swift

@ -58,7 +58,7 @@ private class PrivateXMLHandler {
private let xmlContext = PrivateXMLHandler.createXmlContext(withLang: PrivateXMLHandler.lang)
private let contractAddress: AlphaWallet.Address
private weak var assetDefinitionStore: AssetDefinitionStore?
let server: RPCServer?
var server: RPCServer?
//Explicit type so that the variable autocompletes with AppCode
private lazy var fields: [AttributeId: AssetAttribute] = extractFieldsForToken()
private let isOfficial: Bool
@ -268,6 +268,7 @@ private class PrivateXMLHandler {
let (xml, hasValidTokenScriptFile) = PrivateXMLHandler.storeXmlAccordingToTokenScriptStatus(xmlString: xmlString, tokenScriptStatus: tokenScriptStatus)
self.xml = xml
self.hasValidTokenScriptFile = hasValidTokenScriptFile
self.server = PrivateXMLHandler.extractServer(fromXML: xml, xmlContext: xmlContext, matchingContract: contract)
} else {
xml = (try? Kanna.XML(xml: xmlString, encoding: .utf8)) ?? PrivateXMLHandler.emptyXML
//TODO check this again when we implement signature verification using the web API. We can't just set this to false first because we don't notify client code when it changes to false either. So when a TokenScript file changes, live-reloading thinks there's no TokenScript file
@ -277,6 +278,7 @@ private class PrivateXMLHandler {
let (xml, hasValidTokenScriptFile) = PrivateXMLHandler.storeXmlAccordingToTokenScriptStatus(xmlString: xmlString, tokenScriptStatus: tokenScriptStatus)
self.xml = xml
self.hasValidTokenScriptFile = hasValidTokenScriptFile
self.server = PrivateXMLHandler.extractServer(fromXML: xml, xmlContext: self.xmlContext, matchingContract: contract)
}
}
}

Loading…
Cancel
Save