本文整理汇总了Python中btctxstore.BtcTxStore.createtx方法的典型用法代码示例。如果您正苦于以下问题:Python BtcTxStore.createtx方法的具体用法?Python BtcTxStore.createtx怎么用?Python BtcTxStore.createtx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类btctxstore.BtcTxStore
的用法示例。
在下文中一共展示了BtcTxStore.createtx方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestCreateTx
# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import createtx [as 别名]
class TestCreateTx(unittest.TestCase):
def setUp(self):
self.api = BtcTxStore(dryrun=True, testnet=True)
def test_createtx(self):
locktime = 0
txins = fixtures["createtx"]["txins"]
txouts = fixtures["createtx"]["txouts"]
expected = fixtures["createtx"]["expected"]
result = self.api.createtx(txins, txouts, locktime)
self.assertEqual(result, expected)
示例2: TestSignTx
# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import createtx [as 别名]
class TestSignTx(unittest.TestCase):
def setUp(self):
self.api = BtcTxStore(dryrun=True, testnet=True)
def test_signtx(self):
txins = fixtures["signtx"]["txins"]
txouts = fixtures["signtx"]["txouts"]
wifs = fixtures["signtx"]["wifs"]
expected = fixtures["signtx"]["expected"]
rawtx = self.api.createtx(txins, txouts)
rawtx = self.api.addnulldata(rawtx, "f483")
result = self.api.signtx(rawtx, wifs)
self.assertEqual(result, expected)
示例3: TestIO
# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import createtx [as 别名]
class TestIO(unittest.TestCase):
def setUp(self):
self.api = BtcTxStore(dryrun=True, testnet=True)
def test_readwrite_nulldata(self):
rawtx = self.api.createtx([],[])
rawtx = self.api.addnulldata(rawtx, "f483")
data = self.api.getnulldata(rawtx)
self.assertEqual(data, "f483")
def test_readwrite_hash160data(self):
rawtx = self.api.createtx([],[])
rawtx = self.api.addhash160data(rawtx, 10 * "f483")
data = self.api.gethash160data(rawtx, 0)
self.assertEqual(data, 10 * "f483")
def test_only_one_nulldata_output(self):
def callback():
rawtx = self.api.createtx([],[])
rawtx = self.api.addnulldata(rawtx, "f483")
self.api.addnulldata(rawtx, "f483") # writing second fails
self.assertRaises(exceptions.ExistingNulldataOutput, callback)