diff --git a/chaind/eth/token/base.py b/chaind/eth/token/base.py index b28f4a2..5559859 100644 --- a/chaind/eth/token/base.py +++ b/chaind/eth/token/base.py @@ -28,8 +28,10 @@ class BaseTokenResolver: def get_values(self, gas_value, value, executable_address=None): + nonce = self.nonce_oracle.next_nonce() + if executable_address == None: - return (value, 0) + return (value, 0, nonce) try: value = int(value) @@ -41,8 +43,6 @@ class BaseTokenResolver: except ValueError: gas_value = int(strip_0x(gas_value), 16) - nonce = self.nonce_oracle.next_nonce() - return (gas_value, value, nonce,) diff --git a/chaind/eth/token/gas.py b/chaind/eth/token/gas.py index 4526ddd..443a1e0 100644 --- a/chaind/eth/token/gas.py +++ b/chaind/eth/token/gas.py @@ -13,7 +13,7 @@ class GasTokenResolver(BaseTokenResolver): self.factory = Gas(self.chain_spec, signer=self.signer, gas_oracle=self.gas_oracle, nonce_oracle=self.nonce_oracle) - def create(self, recipient, gas_value, data=None, token_value=0, executable_address=None, passphrase=None): + def create(self, conn, recipient, gas_value, data=None, token_value=0, executable_address=None, passphrase=None): (gas_value, token_value, nonce) = self.get_values(gas_value, token_value, executable_address=executable_address) diff --git a/chaind/eth/token/process.py b/chaind/eth/token/process.py index b270d01..bd6711d 100644 --- a/chaind/eth/token/process.py +++ b/chaind/eth/token/process.py @@ -84,7 +84,13 @@ class Processor: logg.debug('gasvalue {}'.format(gas_value)) data = '0x' - tx = self.resolver.create(self.conn, r[0], gas_value, data=data, token_value=value, executable_address=r[2]) + executable_address = None + try: + executable_address = r[2] + except IndexError: + pass + + tx = self.resolver.create(self.conn, r[0], gas_value, data=data, token_value=value, executable_address=executable_address) v = self.resolver.sign(tx) self.cursor += 1