当前位置: 首页>>代码示例>>Python>>正文


Python TransactionEnvelope.sign方法代码示例

本文整理汇总了Python中stellar_base.transaction_envelope.TransactionEnvelope.sign方法的典型用法代码示例。如果您正苦于以下问题:Python TransactionEnvelope.sign方法的具体用法?Python TransactionEnvelope.sign怎么用?Python TransactionEnvelope.sign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在stellar_base.transaction_envelope.TransactionEnvelope的用法示例。


在下文中一共展示了TransactionEnvelope.sign方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do

# 需要导入模块: from stellar_base.transaction_envelope import TransactionEnvelope [as 别名]
# 或者: from stellar_base.transaction_envelope.TransactionEnvelope import sign [as 别名]
 def do(self, op):
     from stellar_base.transaction import Transaction
     from stellar_base.keypair import Keypair
     from stellar_base.transaction_envelope import TransactionEnvelope as Te
     tx = Transaction(source=self.source, opts={'sequence': self.seq})
     tx.add_operation(operation=op)
     envelope = Te(tx=tx, opts={"network_id": "TESTNET"})
     signer = Keypair.from_seed(seed=self.seed)
     envelope.sign(keypair=signer)
     envelope_b64 = envelope.xdr()
     print(envelope_b64)
     return envelope_b64
开发者ID:bartekn,项目名称:py-stellar-base,代码行数:14,代码来源:test_envelope.py

示例2: make_envelope

# 需要导入模块: from stellar_base.transaction_envelope import TransactionEnvelope [as 别名]
# 或者: from stellar_base.transaction_envelope.TransactionEnvelope import sign [as 别名]
    def make_envelope(self, *args, **kwargs):
        from stellar_base.transaction import Transaction
        from stellar_base.keypair import Keypair
        from stellar_base.transaction_envelope import TransactionEnvelope as Te

        opts = {"sequence": self.seq, "fee": self.fee * len(args)}
        for opt, value in kwargs.items():
            opts[opt] = value
        tx = Transaction(source=self.address, opts=opts)
        for count, op in enumerate(args):
            tx.add_operation(operation=op)
        envelope = Te(tx=tx, opts={"network_id": "TESTNET"})
        signer = Keypair.from_seed(seed=self.seed)
        envelope.sign(keypair=signer)
        envelope_b64 = envelope.xdr()
        print(envelope_b64)
        return envelope_b64
开发者ID:jobforp,项目名称:py-stellar-base,代码行数:19,代码来源:test_envelope.py

示例3: do_single_signer

# 需要导入模块: from stellar_base.transaction_envelope import TransactionEnvelope [as 别名]
# 或者: from stellar_base.transaction_envelope.TransactionEnvelope import sign [as 别名]
def do_single_signer(operation_opts=False, tx_opts=False):
    assert operation_opts and tx_opts
    from stellar_base.operation import Payment
    from stellar_base.transaction import Transaction
    from stellar_base.keypair import Keypair
    from stellar_base.transaction_envelope import TransactionEnvelope as Te

    operation = Payment(opts=operation_opts)
    tx = Transaction(source=SOURCE, opts=tx_opts)
    tx.add_operation(operation=operation)
    envelope = Te(tx=tx, opts={"network_id": "TESTNET"})
    signer = Keypair.from_seed(seed=SEED)
    envelope.sign(keypair=signer)
    envelope_b64 = bip(envelope)

    print(envelope_b64)
    return envelope_b64
开发者ID:nelisky,项目名称:py-stellar-base,代码行数:19,代码来源:test_cases.py

示例4: print

# 需要导入模块: from stellar_base.transaction_envelope import TransactionEnvelope [as 别名]
# 或者: from stellar_base.transaction_envelope.TransactionEnvelope import sign [as 别名]
print('Anna: ', json.dumps(anna, sort_keys=True, indent=4 * ' '))
print('Bob: ', json.dumps(bob, sort_keys=True, indent=4 * ' '))

operation = Payment({
	'source': anna['address'],
	'destination': bob['address'],
	'asset': Asset.native(),
	'amount': '1000', # needs to be a string?
})
tx = Transaction(
	source=anna['address'],
	opts={
		'sequence': json.loads(requests.get(url+'/accounts/'+anna['address']).text)['sequence'],
		'timeBounds': [],
		'memo': NoneMemo(),
		'fee': 100,
		'operations': [
			operation,
		],
	},
)
envelope = Te(tx=tx, opts={"network_id": "TESTNET"})
envelope.sign(Keypair.from_seed(anna['seed']))

print('Tx: ', json.dumps(json.loads(requests.post(
	url=url+'/transactions',
	data={
		'tx': packer(envelope).decode('ascii')
	}
).text), sort_keys=True, indent=4 * ' '))
开发者ID:andela-osule,项目名称:py-stellar-base,代码行数:32,代码来源:sample.py

示例5: te_xdr_build

# 需要导入模块: from stellar_base.transaction_envelope import TransactionEnvelope [as 别名]
# 或者: from stellar_base.transaction_envelope.TransactionEnvelope import sign [as 别名]
def te_xdr_build(tx, secret):
    envelope = Envelope(tx)
    signer = Keypair.from_seed(secret)
    envelope.sign(signer)
    re = envelope.xdr()
    return re
开发者ID:andela-osule,项目名称:py-stellar-base,代码行数:8,代码来源:build.py


注:本文中的stellar_base.transaction_envelope.TransactionEnvelope.sign方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。