本文整理汇总了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
示例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
示例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
示例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 * ' '))
示例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