當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。