コード例 #1
0
ファイル: transactions.py プロジェクト: ezaruba/elrond-sdk
    def add(self, sender, receiver_address, nonce, value, data, gas_price, gas_limit):
        plain = PlainTransaction()
        plain.nonce = int(nonce)
        plain.value = str(value)
        plain.sender = sender.address.bech32()
        plain.receiver = receiver_address
        plain.gasPrice = gas_price
        plain.gasLimit = gas_limit
        plain.data = data

        payload = TransactionPayloadToSign(plain)
        signature = signing.sign_transaction(payload, sender.pem_file)
        prepared = PreparedTransaction(plain, signature)

        self.transactions.append(prepared)
コード例 #2
0
ファイル: mission4.py プロジェクト: kamalzaman/elrond-sdk
def send_one_tx(proxy, sender, receiver_address):
    plain = PlainTransaction()
    plain.nonce = sender.nonce
    plain.value = "20000000000000000"  # 0.02 ERD
    plain.sender = sender.address.bech32()
    plain.receiver = receiver_address
    plain.gasPrice = 200000000000
    plain.gasLimit = 50000
    plain.data = ""

    payload = TransactionPayloadToSign(plain)
    signature = signing.sign_transaction(payload, sender.pem_file)
    prepared = PreparedTransaction(plain, signature)
    prepared.send(proxy)

    global counter
    counter += 1
    print(f"Sent transaction #{counter}, with nonce = {plain.nonce}.")
コード例 #3
0
ファイル: transactions.py プロジェクト: ezaruba/elrond-sdk
def do_prepare_transaction(args):
    # "sender" taken from the PEM file
    sender_bytes = pem.get_pubkey(args.pem)
    sender_bech32 = Address(sender_bytes).bech32()

    plain = PlainTransaction()
    plain.nonce = int(args.nonce)
    plain.value = args.value
    plain.sender = sender_bech32
    plain.receiver = args.receiver
    plain.gasPrice = int(args.gas_price)
    plain.gasLimit = int(args.gas_limit)
    plain.data = args.data

    payload = TransactionPayloadToSign(plain)
    signature = signing.sign_transaction(payload, args.pem)
    prepared = PreparedTransaction(plain, signature)
    return prepared
コード例 #4
0
ファイル: BoN_mission4.py プロジェクト: stjordanis/elrond-sdk
def send_one_tx(proxy: ElrondProxy, sender: Account, receiver_address: str):
    tx = Transaction()
    tx.nonce = sender.nonce
    tx.value = "20000000000000000"  # 0.02 ERD
    tx.sender = sender.address.bech32()
    tx.receiver = receiver_address
    tx.gasPrice = 1000000000
    tx.gasLimit = 50000
    tx.data = ""
    tx.chainID = config.get_chain_id()
    tx.version = config.get_tx_version()

    tx.signature = signing.sign_transaction(tx, sender)
    tx.send(proxy)

    global counter
    counter += 1
    print(f"Sent transaction #{counter}, with nonce = {tx.nonce}.")
コード例 #5
0
ファイル: contracts.py プロジェクト: kamalzaman/elrond-sdk
    def prepare_execute_transaction(self, caller, function, arguments,
                                    gas_price, gas_limit, value):
        arguments = arguments or []
        gas_price = int(gas_price or config.DEFAULT_GAS_PRICE)
        gas_limit = int(gas_limit)
        value = str(value or "0")

        plain = PlainTransaction()
        plain.nonce = caller.nonce
        plain.value = value
        plain.sender = caller.address.bech32()
        plain.receiver = self.address.bech32()
        plain.gasPrice = gas_price
        plain.gasLimit = gas_limit
        plain.data = self.prepare_execute_transaction_data(function, arguments)

        payload = TransactionPayloadToSign(plain)
        signature = signing.sign_transaction(payload, caller.pem_file)
        prepared = PreparedTransaction(plain, signature)
        return prepared
コード例 #6
0
ファイル: contracts.py プロジェクト: natebolam/elrond-sdk
    def prepare_deploy_transaction(self, owner, arguments, gas_price,
                                   gas_limit, value):
        arguments = arguments or []
        gas_price = int(gas_price or config.DEFAULT_GAS_PRICE)
        gas_limit = int(gas_limit or config.DEFAULT_GAS_LIMIT)
        value = str(value or "0")

        plain = PlainTransaction()
        plain.nonce = owner.nonce
        plain.value = value
        plain.sender = owner.address.bech32()
        plain.receiver = Address.zero().bech32()
        plain.gasPrice = gas_price
        plain.gasLimit = gas_limit
        plain.data = self.prepare_deploy_transaction_data(arguments)

        payload = TransactionPayloadToSign(plain)
        signature = signing.sign_transaction(payload, owner.pem_file)
        prepared = PreparedTransaction(plain, signature)
        return prepared
コード例 #7
0
ファイル: transactions.py プロジェクト: irfan798/elrond-sdk
 def sign(self, account: Account):
     self.signature = signing.sign_transaction(self, account)