mirror of
https://github.com/chaintool-py/eth-erc20.git
synced 2024-12-21 23:17:33 +01:00
Add sender address option to cli for read calls
This commit is contained in:
parent
7183e01b72
commit
d218d93fba
@ -1,3 +1,9 @@
|
||||
* 0.5.4
|
||||
- Enable setting sender address on contract read calls
|
||||
* 0.5.3
|
||||
- Fix giftable token cli commands
|
||||
* 0.5.2
|
||||
- Add block height to balance call
|
||||
* 0.5.1
|
||||
- Change license to AGPL3 and copyright waived to public domain
|
||||
* 0.5.0
|
||||
|
@ -65,7 +65,7 @@ logg = logging.getLogger()
|
||||
|
||||
arg_flags = ArgFlag()
|
||||
arg = Arg(arg_flags)
|
||||
flags = arg_flags.STD_READ | arg_flags.EXEC
|
||||
flags = arg_flags.STD_READ | arg_flags.EXEC | arg_flags.SENDER
|
||||
|
||||
argparser = chainlib.eth.cli.ArgumentParser()
|
||||
argparser = process_args(argparser, arg, flags)
|
||||
@ -87,29 +87,30 @@ logg.debug('settings loaded:\n{}'.format(settings))
|
||||
def main():
|
||||
token_address = settings.get('EXEC')
|
||||
conn = settings.get('CONN')
|
||||
sender_address = settings.get('SENDER_ADDRESS')
|
||||
g = ERC20(
|
||||
chain_spec=settings.get('CHAIN_SPEC'),
|
||||
gas_oracle=settings.get('GAS_ORACLE'),
|
||||
)
|
||||
|
||||
# determine decimals
|
||||
decimals_o = g.decimals(token_address)
|
||||
decimals_o = g.decimals(token_address, sender_address=sender_address)
|
||||
r = conn.do(decimals_o)
|
||||
decimals = int(strip_0x(r), 16)
|
||||
logg.info('decimals {}'.format(decimals))
|
||||
|
||||
name_o = g.name(token_address)
|
||||
name_o = g.name(token_address, sender_address=sender_address)
|
||||
r = conn.do(name_o)
|
||||
token_name = g.parse_name(r)
|
||||
logg.info('name {}'.format(token_name))
|
||||
|
||||
symbol_o = g.symbol(token_address)
|
||||
symbol_o = g.symbol(token_address, sender_address=sender_address)
|
||||
r = conn.do(symbol_o)
|
||||
token_symbol = g.parse_symbol(r)
|
||||
logg.info('symbol {}'.format(token_symbol))
|
||||
|
||||
# get balance
|
||||
balance_o = g.balance(token_address, settings.get('RECIPIENT'))
|
||||
balance_o = g.balance(token_address, settings.get('RECIPIENT'), sender_address=sender_address)
|
||||
r = conn.do(balance_o)
|
||||
|
||||
hx = strip_0x(r)
|
||||
|
@ -74,7 +74,7 @@ def process_config_local(config, arg, args, flags):
|
||||
|
||||
arg_flags = ArgFlag()
|
||||
arg = Arg(arg_flags)
|
||||
flags = arg_flags.STD_READ | arg_flags.EXEC | arg_flags.TAB
|
||||
flags = arg_flags.STD_READ | arg_flags.EXEC | arg_flags.TAB | arg_flags.SENDER
|
||||
|
||||
argparser = chainlib.eth.cli.ArgumentParser()
|
||||
argparser = process_args(argparser, arg, flags)
|
||||
@ -96,6 +96,7 @@ logg.debug('settings loaded:\n{}'.format(settings))
|
||||
def main():
|
||||
token_address = config.get('_CONTRACT')
|
||||
conn = settings.get('CONN')
|
||||
sender_address = settings.get('SENDER_ADDRESS')
|
||||
g = ERC20(
|
||||
chain_spec=settings.get('CHAIN_SPEC'),
|
||||
gas_oracle=settings.get('GAS_ORACLE'),
|
||||
@ -104,7 +105,7 @@ def main():
|
||||
outkeys = config.get('_OUTARG')
|
||||
|
||||
if not outkeys or 'address' in outkeys:
|
||||
name_o = g.name(token_address)
|
||||
name_o = g.name(token_address, sender_address=sender_address)
|
||||
r = conn.do(name_o)
|
||||
token_name = g.parse_name(r)
|
||||
s = ''
|
||||
@ -114,7 +115,7 @@ def main():
|
||||
print(s)
|
||||
|
||||
if not outkeys or 'symbol' in outkeys:
|
||||
symbol_o = g.symbol(token_address)
|
||||
symbol_o = g.symbol(token_address, sender_address=sender_address)
|
||||
r = conn.do(symbol_o)
|
||||
token_symbol = g.parse_symbol(r)
|
||||
s = ''
|
||||
@ -124,7 +125,7 @@ def main():
|
||||
print(s)
|
||||
|
||||
if not outkeys or 'decimals' in outkeys:
|
||||
decimals_o = g.decimals(token_address)
|
||||
decimals_o = g.decimals(token_address, sender_address=sender_address)
|
||||
r = conn.do(decimals_o)
|
||||
decimals = int(strip_0x(r), 16)
|
||||
s = ''
|
||||
@ -134,7 +135,7 @@ def main():
|
||||
print(s)
|
||||
|
||||
if not outkeys or 'supply' in outkeys:
|
||||
supply_o = g.total_supply(token_address)
|
||||
supply_o = g.total_supply(token_address, sender_address=sender_address)
|
||||
r = conn.do(supply_o)
|
||||
supply = int(strip_0x(r), 16)
|
||||
s = ''
|
||||
|
@ -1,3 +1,3 @@
|
||||
confini~=0.6.1
|
||||
chainlib-eth~=0.4.2
|
||||
chainlib-eth~=0.4.15
|
||||
potaahto~=0.1.1
|
||||
|
@ -1,10 +1,10 @@
|
||||
[metadata]
|
||||
name = eth-erc20
|
||||
version = 0.5.3
|
||||
version = 0.5.4
|
||||
description = ERC20 interface and simple contract with deployment script that lets any address mint and gift itself tokens.
|
||||
author = Louis Holbrook
|
||||
author_email = dev@holbrook.no
|
||||
url = https://git.defalsify.org/eth-erc20.git
|
||||
url = https://git.defalsify.org/eth-erc20
|
||||
keywords =
|
||||
dlt
|
||||
ethereum
|
||||
|
Loading…
Reference in New Issue
Block a user