From 62975ef4198baecc60e9cffac1b5006e59f26e4d Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 11 Sep 2021 08:09:52 -0400 Subject: [PATCH] refactor: move eth logic out of libstatus wrapper (#21) --- status/ens.nim | 4 ++-- status/{libstatus => }/eth/contracts.nim | 2 +- status/{libstatus => }/eth/eth.nim | 2 +- status/{libstatus => }/eth/methods.nim | 2 +- status/{libstatus => }/eth/transactions.nim | 2 +- status/libstatus/stickers.nim | 2 +- status/libstatus/tokens.nim | 2 +- status/stickers.nim | 2 +- status/tokens.nim | 2 +- status/types/message.nim | 2 +- status/wallet.nim | 2 +- status/wallet/collectibles.nim | 2 +- status/wallet2.nim | 2 +- status/wallet2/collectibles.nim | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) rename status/{libstatus => }/eth/contracts.nim (99%) rename status/{libstatus => }/eth/eth.nim (87%) rename status/{libstatus => }/eth/methods.nim (92%) rename status/{libstatus => }/eth/transactions.nim (90%) diff --git a/status/ens.nim b/status/ens.nim index d6bb5b6..b651d8c 100644 --- a/status/ens.nim +++ b/status/ens.nim @@ -15,8 +15,8 @@ import unicode import transactions import algorithm import web3/[ethtypes, conversions], stew/byteutils, stint -import libstatus/eth/contracts -import libstatus/eth/transactions as eth_transactions +import eth/contracts +import eth/transactions as eth_transactions import chronicles, libp2p/[multihash, multicodec, cid] import ./settings as status_settings diff --git a/status/libstatus/eth/contracts.nim b/status/eth/contracts.nim similarity index 99% rename from status/libstatus/eth/contracts.nim rename to status/eth/contracts.nim index 0e91cfb..0d27874 100644 --- a/status/libstatus/eth/contracts.nim +++ b/status/eth/contracts.nim @@ -5,7 +5,7 @@ import web3/ethtypes, stew/byteutils, nimcrypto, json_serialization, chronicles import - ../../types/[network_type], ../settings, ../coder, transactions, methods, ../../utils + ../types/[network_type], ../libstatus/settings, ../libstatus/coder, transactions, methods, ../utils export GetPackData, PackData, BuyToken, ApproveAndCall, Transfer, BalanceOf, Register, SetPubkey, diff --git a/status/libstatus/eth/eth.nim b/status/eth/eth.nim similarity index 87% rename from status/libstatus/eth/eth.nim rename to status/eth/eth.nim index 9eb624e..2911ead 100644 --- a/status/libstatus/eth/eth.nim +++ b/status/eth/eth.nim @@ -2,7 +2,7 @@ import web3/ethtypes import - transactions, ../../types/[rpc_response, transaction] + transactions, ../types/[rpc_response, transaction] proc sendTransaction*(tx: var TransactionData, password: string, success: var bool): string = success = true diff --git a/status/libstatus/eth/methods.nim b/status/eth/methods.nim similarity index 92% rename from status/libstatus/eth/methods.nim rename to status/eth/methods.nim index 4f2cd6d..0eafa34 100644 --- a/status/libstatus/eth/methods.nim +++ b/status/eth/methods.nim @@ -5,7 +5,7 @@ import nimcrypto, web3/[encoding, ethtypes] import - ../../types/[rpc_response, transaction], ../coder, eth, transactions + ../types/[rpc_response, transaction], ../libstatus/coder, eth, transactions export sendTransaction diff --git a/status/libstatus/eth/transactions.nim b/status/eth/transactions.nim similarity index 90% rename from status/libstatus/eth/transactions.nim rename to status/eth/transactions.nim index 7d7cddc..130b99c 100644 --- a/status/libstatus/eth/transactions.nim +++ b/status/eth/transactions.nim @@ -5,7 +5,7 @@ import json_serialization, chronicles, web3/ethtypes import - ../core, ../../types/[rpc_response, transaction], ../conversions + ../libstatus/core, ../types/[rpc_response, transaction], ../libstatus/conversions proc estimateGas*(tx: TransactionData): RpcResponse = let response = core.callPrivateRPC("eth_estimateGas", %*[%tx]) diff --git a/status/libstatus/stickers.nim b/status/libstatus/stickers.nim index 71d22b1..bf9aed2 100644 --- a/status/libstatus/stickers.nim +++ b/status/libstatus/stickers.nim @@ -9,7 +9,7 @@ from nimcrypto import fromHex import # status-desktop libs ./core as status, ../types/[sticker, setting, rpc_response], - ./eth/contracts, ./settings, ./edn_helpers + ../eth/contracts, ./settings, ./edn_helpers proc decodeContentHash*(value: string): string = if value == "": diff --git a/status/libstatus/tokens.nim b/status/libstatus/tokens.nim index 73aa6e9..ebf51f3 100644 --- a/status/libstatus/tokens.nim +++ b/status/libstatus/tokens.nim @@ -5,7 +5,7 @@ import web3/[ethtypes, conversions], json_serialization import - ./settings, ./core, ./wallet, ./eth/contracts, + ./settings, ./core, ./wallet, ../eth/contracts, ../types/[setting, network_type, rpc_response] from ../utils import parseAddress diff --git a/status/stickers.nim b/status/stickers.nim index 510b403..eba49a6 100644 --- a/status/stickers.nim +++ b/status/stickers.nim @@ -5,7 +5,7 @@ import # project deps chronicles, web3/[ethtypes, conversions], stint import # local deps - libstatus/eth/contracts as status_contracts, + eth/contracts as status_contracts, libstatus/stickers as status_stickers, transactions, libstatus/wallet, ../eventemitter import ./types/[sticker, transaction, rpc_response] diff --git a/status/tokens.nim b/status/tokens.nim index 21c5fb1..23ef12d 100644 --- a/status/tokens.nim +++ b/status/tokens.nim @@ -1,5 +1,5 @@ import libstatus/tokens as status_tokens -import libstatus/eth/contracts +import eth/contracts import ../eventemitter type diff --git a/status/types/message.nim b/status/types/message.nim index 3bba5c0..02951a1 100644 --- a/status/types/message.nim +++ b/status/types/message.nim @@ -8,7 +8,7 @@ import ../libstatus/accounts/constants as constants import ../libstatus/wallet as status_wallet import ../libstatus/settings as status_settings import ../libstatus/tokens as status_tokens -import ../libstatus/eth/contracts as status_contracts +import ../eth/contracts as status_contracts import web3/conversions from ../utils import parseAddress, wei2Eth import setting, network_type diff --git a/status/wallet.nim b/status/wallet.nim index dcdd7a0..04f8dc9 100644 --- a/status/wallet.nim +++ b/status/wallet.nim @@ -8,7 +8,7 @@ import libstatus/tokens as status_tokens import libstatus/settings as status_settings import libstatus/wallet as status_wallet import libstatus/accounts/constants as constants -import libstatus/eth/[eth, contracts] +import eth/[eth, contracts] from libstatus/core import getBlockByNumber from utils as libstatus_utils import eth2Wei, gwei2Wei, wei2Gwei, first, toUInt64, parseAddress import wallet/[balance_manager, collectibles] diff --git a/status/wallet/collectibles.nim b/status/wallet/collectibles.nim index 768492d..934c03f 100644 --- a/status/wallet/collectibles.nim +++ b/status/wallet/collectibles.nim @@ -6,7 +6,7 @@ import # vendor libs stint import # status-desktop libs - ../libstatus/core as status, ../libstatus/eth/contracts as contracts, + ../libstatus/core as status, ../eth/contracts as contracts, ../stickers as status_stickers, web3/[conversions, ethtypes], ../utils, account diff --git a/status/wallet2.nim b/status/wallet2.nim index 809308c..726f5de 100644 --- a/status/wallet2.nim +++ b/status/wallet2.nim @@ -6,7 +6,7 @@ import libstatus/tokens as status_tokens import libstatus/wallet as status_wallet import libstatus/network as status_network import libstatus/settings as status_settings -import libstatus/eth/[contracts] +import eth/[contracts] import wallet2/[balance_manager, collectibles, network] import wallet2/account as wallet_account import ./types/[account, transaction, network_type, setting, gas_prediction, rpc_response] diff --git a/status/wallet2/collectibles.nim b/status/wallet2/collectibles.nim index 768492d..934c03f 100644 --- a/status/wallet2/collectibles.nim +++ b/status/wallet2/collectibles.nim @@ -6,7 +6,7 @@ import # vendor libs stint import # status-desktop libs - ../libstatus/core as status, ../libstatus/eth/contracts as contracts, + ../libstatus/core as status, ../eth/contracts as contracts, ../stickers as status_stickers, web3/[conversions, ethtypes], ../utils, account