Merge pull request #2237 from AlphaWallet/remove-magic-string-use-enum-rawvalue

Use enum's rawValue instead of magic string constant
pull/2241/head
James Sangalli 4 years ago committed by GitHub
commit 575f332062
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      AlphaWallet/Tokens/Coordinators/GetContractInteractions.swift
  2. 2
      AlphaWallet/Transactions/Storage/Transaction.swift

@ -34,7 +34,7 @@ class GetContractInteractions {
from: transactionJson["from"].stringValue,
to: transactionJson["to"].stringValue,
contract: AlphaWallet.Address(uncheckedAgainstNullAddress: transactionJson["contractAddress"].stringValue),
type: "erc20TokenTransfer",
type: OperationType.erc20TokenTransfer.rawValue,
value: transactionJson["value"].stringValue,
symbol: transactionJson["tokenSymbol"].stringValue,
name: transactionJson["tokenName"].stringValue,

@ -118,7 +118,7 @@ extension Transaction {
//Compiler thinks it's a `Slice<Data>` if don't explicitly state the type, so we have to split into 2 `if`s
let recipientData: Data = data[4..<(4 + 32)][4 + 12..<(4 + 32)]
if let recipient = AlphaWallet.Address(string: recipientData.hexEncoded) {
return (operations: [LocalizedOperationObject(from: from.eip55String, to: recipient.eip55String, contract: contract, type: "erc20TokenTransfer", value: String(value), symbol: token.symbol, name: token.name, decimals: token.decimals)], isErc20Interaction: true)
return (operations: [LocalizedOperationObject(from: from.eip55String, to: recipient.eip55String, contract: contract, type: OperationType.erc20TokenTransfer.rawValue, value: String(value), symbol: token.symbol, name: token.name, decimals: token.decimals)], isErc20Interaction: true)
}
}
return (operations: .init(), isErc20Interaction: false)

Loading…
Cancel
Save