An advanced Ethereum/EVM mobile wallet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
alpha-wallet-ios/Trust/Vendors/New Group/Commands/GetERC20Balance.swift

28 lines
875 B

// Copyright SIX DAY LLC. All rights reserved.
import Foundation
import TrustKeystore
struct GetERC20BalanceEncode: Web3Request {
typealias Response = String
static let abi = "{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}"
let address: Address
var type: Web3RequestType {
let run = "web3.eth.abi.encodeFunctionCall(\(GetERC20BalanceEncode.abi), [\"\(address.description)\"])"
return .script(command: run)
}
}
struct GetERC20BalanceDecode: Web3Request {
typealias Response = String
let data: String
var type: Web3RequestType {
let run = "web3.eth.abi.decodeParameter('uint', '\(data)')"
return .script(command: run)
}
}