status-lib/status/tokens.nim

45 lines
1.4 KiB
Nim
Raw Normal View History

import statusgo_backend/tokens as statusgo_backend_tokens
import tokens_backend as status_tokens
import eth/contracts
2021-09-08 18:05:39 +00:00
import ../eventemitter
type
TokensModel* = ref object
events*: EventEmitter
proc newTokensModel*(events: EventEmitter): TokensModel =
result = TokensModel()
result.events = events
proc getSNTAddress*(): string =
result = status_tokens.getSNTAddress()
proc getCustomTokens*(self: TokensModel, useCached: bool = true): seq[Erc20Contract] =
result = statusgo_backend_tokens.getCustomTokens(useCached)
2021-09-08 18:05:39 +00:00
proc removeCustomToken*(self: TokensModel, address: string) =
statusgo_backend_tokens.removeCustomToken(address)
2021-09-08 18:05:39 +00:00
proc getSNTBalance*(account: string): string =
result = status_tokens.getSNTBalance(account)
proc tokenDecimals*(contract: Contract): int =
result = status_tokens.tokenDecimals(contract)
proc tokenName*(contract: Contract): string =
result = status_tokens.tokenName(contract)
proc tokensymbol*(contract: Contract): string =
result = status_tokens.tokensymbol(contract)
proc getTokenBalance*(tokenAddress: string, account: string): string =
result = status_tokens.getTokenBalance(tokenAddress, account)
proc getToken*(self: TokensModel, tokenAddress: string): Erc20Contract =
result = status_tokens.getToken(tokenAddress)
export newErc20Contract
export getErc20Contracts
export Erc20Contract
export getErc20ContractByAddress