dragonchain/lib/dto/bnb.py
def sign_transaction(self, raw_transaction: Dict[str, Any]) -> str:
        """Sign a transaction for this network
        Args:
            amount (int): amount of token in transaction
            to_address (str): hex of the address to send to
            symbol (str, optional): the exchange symbol for the token (defaults to 'BNB')
            memo (str, optional): string of data to publish in the transaction (defaults to '')
        Returns:
            String of the signed transaction as base64
        """
        built_transaction = self._build_transaction_msg(raw_transaction)
        try:
            if self.testnet:
                tx = TestBnbTransaction.from_obj(built_transaction)
            else:  # mainnet
                tx = BnbTransaction.from_obj(built_transaction)
            _log.info(f"[BINANCE] Signing raw transaction: {tx.signing_json()}")
            mykeys = keys.DCKeys(pull_keys=False)
            mykeys.initialize(private_key_string=self.b64_private_key)
            signature = base64.b64decode(mykeys.make_binance_signature(content=tx.signing_json()))
            tx.apply_sig(signature, self.pub.serialize(compressed=True))
            signed_transaction_bytes = tx.encode()
            # signed_transaction expected to be base64, not hex:
            return base64.b64encode(signed_transaction_bytes).decode("ascii")
        except Exception as e:
            raise exceptions.BadRequest(f"[BINANCE] Error signing transaction: {e}")
Sign a transaction for this network
        Args:
            amount (int): amount of token in transaction
            to_address (str): hex of the address to send to
            symbol (str, optional): the exchange symbol for the token (defaults to 'BNB')
            memo (str, optional): string of data to publish in the transaction (defaults to '')
        Returns:
            String of the signed transaction as base64
        
Sign a transaction for this network
Sign a transaction for this network
def sign_transaction(self, raw_transaction: Dict[str, Any]) -> str:
        built_transaction = self._build_transaction_msg(raw_transaction)
        try:
            if self.testnet:
                tx = TestBnbTransaction.from_obj(built_transaction)
            else:  
                tx = BnbTransaction.from_obj(built_transaction)
            _log.info(f"[BINANCE] Signing raw transaction: {tx.signing_json()}")
            mykeys = keys.DCKeys(pull_keys=False)
            mykeys.initialize(private_key_string=self.b64_private_key)
            signature = base64.b64decode(mykeys.make_binance_signature(content=tx.signing_json()))
            tx.apply_sig(signature, self.pub.serialize(compressed=True))
            signed_transaction_bytes = tx.encode()
            return base64.b64encode(signed_transaction_bytes).decode("ascii")
        except Exception as e:
            raise exceptions.BadRequest(f"[BINANCE] Error signing transaction: {e}")
def sign_transaction ( self , raw_transaction : Dict [ str , Any ] ) -> str : built_transaction = self . _build_transaction_msg ( raw_transaction ) try : if self . testnet : tx = TestBnbTransaction . from_obj ( built_transaction ) else : tx = BnbTransaction . from_obj ( built_transaction ) _log . info ( f"[BINANCE] Signing raw transaction: {tx.signing_json()}" ) mykeys = keys . DCKeys ( pull_keys = False ) mykeys . initialize ( private_key_string = self . b64_private_key ) signature = base64 . b64decode ( mykeys . make_binance_signature ( content = tx . signing_json ( ) ) ) tx . apply_sig ( signature , self . pub . serialize ( compressed = True ) ) signed_transaction_bytes = tx . encode ( ) return base64 . b64encode ( signed_transaction_bytes ) . decode ( "ascii" ) except Exception as e : raise exceptions . BadRequest ( f"[BINANCE] Error signing transaction: {e}" )
Sign a transaction for this network
Sign a transaction for this network
"""Sign a transaction for this network
        Args:
            amount (int): amount of token in transaction
            to_address (str): hex of the address to send to
            symbol (str, optional): the exchange symbol for the token (defaults to 'BNB')
            memo (str, optional): string of data to publish in the transaction (defaults to '')
        Returns:
            String of the signed transaction as base64
        """ # mainnet # signed_transaction expected to be base64, not hex:
String of the signed transaction as base64
String of the signed transaction as base64
self
raw_transaction
Dict[str, Any]
amount
amount of token in transaction
amount of token in transaction
to_address
hex of the address to send to
hex of the address to send to
symbol
the exchange symbol for the token (defaults to 'BNB')
the exchange symbol for the token ( defaults to ' BNB ' )
memo
string of data to publish in the transaction (defaults to '')
string of data to publish in the transaction ( defaults to ' ' )