def new_total_supply_tx(self) -> InvokeTransaction: """ This interface is used to generate transaction which can get the total token supply. """ tx = InvokeTransaction() tx.add_invoke_code(self._contract_address, InvokeFunction('totalSupply')) return tx
def new_revoke_tx(self, claim_id: str, issuer: Union[str, bytes, Address], payer: Union[str, bytes, Address], gas_price: int, gas_limit: int): func = NeoInvokeFunction('Revoke') func.set_params_value(claim_id, Address.b58decode(issuer)) tx = InvokeTransaction(Address.b58decode(payer), gas_price, gas_limit) tx.add_invoke_code(self.__hex_contract_address, func) return tx
def new_allowance_tx(self, owner: Union[str, bytes, Address], spender: Union[str, bytes, Address]) -> InvokeTransaction: func = InvokeFunction('allowance') func.set_params_value(Address.b58decode(owner), Address.b58decode(spender)) tx = InvokeTransaction() tx.add_invoke_code(self._contract_address, func) return tx
def new_commit_tx(self, claim_id: str, issuer_address: Union[str, bytes, Address], owner_ont_id: str, payer_address: Union[str, bytes, Address], gas_price: int, gas_limit: int) -> InvokeTransaction: func = NeoInvokeFunction('Commit') func.set_params_value(claim_id, Address.b58decode(issuer_address), owner_ont_id) tx = InvokeTransaction(Address.b58decode(payer_address), gas_price, gas_limit) tx.add_invoke_code(self.__hex_contract_address, func) return tx
def new_init_tx(self, payer: Union[str, bytes, Address], gas_price: int, gas_limit: int) -> InvokeTransaction: """ This interface is used to call the TotalSupply method in ope4 that initialize smart contract parameter. """ tx = InvokeTransaction(payer, gas_price, gas_limit) tx.add_invoke_code(self._contract_address, InvokeFunction('init')) return tx
def make_invoke_transaction(contract_address: Union[str, bytes, bytearray, Address], func: Union[AbiFunction, InvokeFunction], payer: Union[str, bytes, Address] = b'', gas_price: int = 0, gas_limit: int = 0) -> InvokeTransaction: tx = InvokeTransaction(payer, gas_price, gas_limit) tx.add_invoke_code(contract_address, func) return tx
def new_balance_of_tx(self, owner: Union[str, bytes, Address]) -> InvokeTransaction: """ This interface is used to generate transaction which can get the account balance of another account with owner address. """ func = InvokeFunction('balanceOf') func.set_params_value(Address.b58decode(owner)) tx = InvokeTransaction() tx.add_invoke_code(self._contract_address, func) return tx
def new_transfer_from_tx(self, spender: Union[str, bytes, Address], owner: Union[str, bytes, Address], to_address: Union[str, bytes, Address], value: int, payer: Union[str, bytes, Address], gas_price: int, gas_limit: int) -> InvokeTransaction: func = InvokeFunction('transferFrom') if not isinstance(value, int): raise SDKException(ErrorCode.param_err('the data type of value should be int.')) func.set_params_value(Address.b58decode(spender), Address.b58decode(owner), Address.b58decode(to_address), value) tx = InvokeTransaction(payer, gas_price, gas_limit) tx.add_invoke_code(self._contract_address, func) return tx
def __new_token_setting_tx(self, func_name: str) -> InvokeTransaction: func = InvokeFunction(func_name) tx = InvokeTransaction() tx.add_invoke_code(self._contract_address, func) return tx
def new_get_status_tx(self, claim_id: str) -> InvokeTransaction: func = NeoInvokeFunction('GetStatus') func.set_params_value(claim_id) tx = InvokeTransaction() tx.add_invoke_code(self.__hex_contract_address, func) return tx