mirror of
https://github.com/chaintool-py/eth-erc20.git
synced 2024-11-24 02:36:46 +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
|
* 0.5.1
|
||||||
- Change license to AGPL3 and copyright waived to public domain
|
- Change license to AGPL3 and copyright waived to public domain
|
||||||
* 0.5.0
|
* 0.5.0
|
||||||
|
@ -65,7 +65,7 @@ logg = logging.getLogger()
|
|||||||
|
|
||||||
arg_flags = ArgFlag()
|
arg_flags = ArgFlag()
|
||||||
arg = Arg(arg_flags)
|
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 = chainlib.eth.cli.ArgumentParser()
|
||||||
argparser = process_args(argparser, arg, flags)
|
argparser = process_args(argparser, arg, flags)
|
||||||
@ -87,29 +87,30 @@ logg.debug('settings loaded:\n{}'.format(settings))
|
|||||||
def main():
|
def main():
|
||||||
token_address = settings.get('EXEC')
|
token_address = settings.get('EXEC')
|
||||||
conn = settings.get('CONN')
|
conn = settings.get('CONN')
|
||||||
|
sender_address = settings.get('SENDER_ADDRESS')
|
||||||
g = ERC20(
|
g = ERC20(
|
||||||
chain_spec=settings.get('CHAIN_SPEC'),
|
chain_spec=settings.get('CHAIN_SPEC'),
|
||||||
gas_oracle=settings.get('GAS_ORACLE'),
|
gas_oracle=settings.get('GAS_ORACLE'),
|
||||||
)
|
)
|
||||||
|
|
||||||
# determine decimals
|
# determine decimals
|
||||||
decimals_o = g.decimals(token_address)
|
decimals_o = g.decimals(token_address, sender_address=sender_address)
|
||||||
r = conn.do(decimals_o)
|
r = conn.do(decimals_o)
|
||||||
decimals = int(strip_0x(r), 16)
|
decimals = int(strip_0x(r), 16)
|
||||||
logg.info('decimals {}'.format(decimals))
|
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)
|
r = conn.do(name_o)
|
||||||
token_name = g.parse_name(r)
|
token_name = g.parse_name(r)
|
||||||
logg.info('name {}'.format(token_name))
|
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)
|
r = conn.do(symbol_o)
|
||||||
token_symbol = g.parse_symbol(r)
|
token_symbol = g.parse_symbol(r)
|
||||||
logg.info('symbol {}'.format(token_symbol))
|
logg.info('symbol {}'.format(token_symbol))
|
||||||
|
|
||||||
# get balance
|
# 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)
|
r = conn.do(balance_o)
|
||||||
|
|
||||||
hx = strip_0x(r)
|
hx = strip_0x(r)
|
||||||
|
@ -74,7 +74,7 @@ def process_config_local(config, arg, args, flags):
|
|||||||
|
|
||||||
arg_flags = ArgFlag()
|
arg_flags = ArgFlag()
|
||||||
arg = Arg(arg_flags)
|
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 = chainlib.eth.cli.ArgumentParser()
|
||||||
argparser = process_args(argparser, arg, flags)
|
argparser = process_args(argparser, arg, flags)
|
||||||
@ -96,6 +96,7 @@ logg.debug('settings loaded:\n{}'.format(settings))
|
|||||||
def main():
|
def main():
|
||||||
token_address = config.get('_CONTRACT')
|
token_address = config.get('_CONTRACT')
|
||||||
conn = settings.get('CONN')
|
conn = settings.get('CONN')
|
||||||
|
sender_address = settings.get('SENDER_ADDRESS')
|
||||||
g = ERC20(
|
g = ERC20(
|
||||||
chain_spec=settings.get('CHAIN_SPEC'),
|
chain_spec=settings.get('CHAIN_SPEC'),
|
||||||
gas_oracle=settings.get('GAS_ORACLE'),
|
gas_oracle=settings.get('GAS_ORACLE'),
|
||||||
@ -104,7 +105,7 @@ def main():
|
|||||||
outkeys = config.get('_OUTARG')
|
outkeys = config.get('_OUTARG')
|
||||||
|
|
||||||
if not outkeys or 'address' in outkeys:
|
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)
|
r = conn.do(name_o)
|
||||||
token_name = g.parse_name(r)
|
token_name = g.parse_name(r)
|
||||||
s = ''
|
s = ''
|
||||||
@ -114,7 +115,7 @@ def main():
|
|||||||
print(s)
|
print(s)
|
||||||
|
|
||||||
if not outkeys or 'symbol' in outkeys:
|
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)
|
r = conn.do(symbol_o)
|
||||||
token_symbol = g.parse_symbol(r)
|
token_symbol = g.parse_symbol(r)
|
||||||
s = ''
|
s = ''
|
||||||
@ -124,7 +125,7 @@ def main():
|
|||||||
print(s)
|
print(s)
|
||||||
|
|
||||||
if not outkeys or 'decimals' in outkeys:
|
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)
|
r = conn.do(decimals_o)
|
||||||
decimals = int(strip_0x(r), 16)
|
decimals = int(strip_0x(r), 16)
|
||||||
s = ''
|
s = ''
|
||||||
@ -134,7 +135,7 @@ def main():
|
|||||||
print(s)
|
print(s)
|
||||||
|
|
||||||
if not outkeys or 'supply' in outkeys:
|
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)
|
r = conn.do(supply_o)
|
||||||
supply = int(strip_0x(r), 16)
|
supply = int(strip_0x(r), 16)
|
||||||
s = ''
|
s = ''
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
confini~=0.6.1
|
confini~=0.6.1
|
||||||
chainlib-eth~=0.4.2
|
chainlib-eth~=0.4.15
|
||||||
potaahto~=0.1.1
|
potaahto~=0.1.1
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = eth-erc20
|
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.
|
description = ERC20 interface and simple contract with deployment script that lets any address mint and gift itself tokens.
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
url = https://git.defalsify.org/eth-erc20.git
|
url = https://git.defalsify.org/eth-erc20
|
||||||
keywords =
|
keywords =
|
||||||
dlt
|
dlt
|
||||||
ethereum
|
ethereum
|
||||||
|
Loading…
Reference in New Issue
Block a user