Esempio n. 1
0
 def __init__(self, network, url, polisd_inf, cache_dir, zcash=None):
     TxApiInsight.__init__(self, network, url, zcash)
     self.polisd_inf = polisd_inf
     self.cache_dir = cache_dir
Esempio n. 2
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.

from binascii import hexlify, unhexlify

from trezorlib import btc, messages as proto
from trezorlib.tools import H_, parse_path
from trezorlib.tx_api import TxApiInsight

from ..support import ckd_public as bip32
from .common import TrezorTest

TxApiTestnet = TxApiInsight("insight_testnet")


class TestMultisigChange(TrezorTest):
    def setup_method(self, method):
        super(TestMultisigChange, self).setup_method(method)
        self.client.set_tx_api(TxApiTestnet)

    node_ext1 = bip32.deserialize(
        "tpubDADHV9u9Y6gkggintTdMjJE3be58zKNLhpxBQyuEM6Pwx3sN9JVLmMCMN4DNVwL9AKec27z5TaWcWuHzMXiGAtcra5DjwWbvppGX4gaEGVN"
    )
    # m/1 => 02c0d0c5fee952620757c6128dbf327c996cd72ed3358d15d6518a1186099bc15e
    # m/2 => 0375b9dfaad928ce1a7eed88df7c084e67d99e9ab74332419458a9a45779706801

    node_ext2 = bip32.deserialize(
        "tpubDADHV9u9Y6gkhWXBmDJ6TUhZajLWjvKukRe2w9FfhdbQpUux8Z8jnPHNAZqFRgHPg9sR7YR93xThM32M7NfRu8S5WyDtext7S62sqxeJNkd"
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library.  If not, see <http://www.gnu.org/licenses/>.

import unittest
import common
import binascii

import trezorlib.messages_pb2 as proto
import trezorlib.types_pb2 as proto_types
from trezorlib.tx_api import TxApiInsight
from trezorlib.ckd_public import deserialize
from trezorlib.client import CallException

TxApiBitcoinCash = TxApiInsight(network='insight_bch',
                                url='https://bch-bitcore2.trezor.io/api/')


class TestMsgSigntxSegwit(common.TrezorTest):
    def test_send_bch_change(self):
        self.setup_mnemonic_allallall()
        self.client.set_tx_api(TxApiBitcoinCash)
        inp1 = proto_types.TxInputType(
            address_n=self.client.expand_path("44'/145'/0'/0/0"),
            # 1MH9KKcvdCTY44xVDC2k3fjBbX5Cz29N1q
            amount=1995344,
            prev_hash=binascii.unhexlify(
                'bc37c28dfb467d2ecb50261387bf752a3977d7e5337915071bb4151e6b711a78'
            ),
            prev_index=0,
            script_type=proto_types.SPENDADDRESS,
 def __init__(self, network, url, gobyted_inf, cache_dir, zcash=None):
     TxApiInsight.__init__(self, network, url, zcash)
     self.gobyted_inf = gobyted_inf
     self.cache_dir = cache_dir
                return j
            except:
                pass
        try:
            j = self.dashd_inf.getrawtransaction(resourceid, 1)
        except Exception as e:
            raise
        if cache_file:
            try:  # saving into cache
                simplejson.dump(j, open(cache_file, 'w'))
            except Exception as e:
                pass
        return j


TxApiDash = TxApiInsight(network='insight_dash',
                         url='https://dash-bitcore1.trezor.io/api/')


def prepare_transfer_tx(main_ui, utxos_to_spend, dest_address, tx_fee):
    """
    Creates a signed transaction.
    :param main_ui: Main window for configuration data
    :param utxos_to_spend: list of utxos to send
    :param dest_address: destination (Dash) address
    :param tx_fee: transaction fee
    :return: tuple (serialized tx, total transaction amount in satoshis)
    """
    # tx_api = MyTxApiInsight('insight_dash', None, main_ui.dashd_intf, main_ui.config.cache_dir)
    tx_api = TxApiDash
    client = main_ui.hw_client
    client.set_tx_api(tx_api)