|
|
@ -16,6 +16,7 @@ async def sign_tx(ctx, msg: NEMSignTx):
|
|
|
|
|
|
|
|
|
|
|
|
if msg.multisig:
|
|
|
|
if msg.multisig:
|
|
|
|
public_key = msg.multisig.signer
|
|
|
|
public_key = msg.multisig.signer
|
|
|
|
|
|
|
|
await ask_multisig(ctx, msg)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
public_key = _get_public_key(node)
|
|
|
|
public_key = _get_public_key(node)
|
|
|
|
|
|
|
|
|
|
|
@ -35,6 +36,10 @@ async def sign_tx(ctx, msg: NEMSignTx):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise ValueError('No transaction provided')
|
|
|
|
raise ValueError('No transaction provided')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if msg.multisig:
|
|
|
|
|
|
|
|
# wrap transaction in multisig wrapper
|
|
|
|
|
|
|
|
tx = _multisig(node, msg, tx)
|
|
|
|
|
|
|
|
|
|
|
|
signature = ed25519.sign(node.private_key(), tx, helpers.NEM_HASH_ALG)
|
|
|
|
signature = ed25519.sign(node.private_key(), tx, helpers.NEM_HASH_ALG)
|
|
|
|
|
|
|
|
|
|
|
|
resp = NEMSignedTx()
|
|
|
|
resp = NEMSignedTx()
|
|
|
@ -43,6 +48,16 @@ async def sign_tx(ctx, msg: NEMSignTx):
|
|
|
|
return resp
|
|
|
|
return resp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _multisig(node, msg: NEMSignTx, inner_tx: bytes) -> bytes:
|
|
|
|
|
|
|
|
if msg.cosigning:
|
|
|
|
|
|
|
|
return serialize_multisig_signature(msg.multisig,
|
|
|
|
|
|
|
|
_get_public_key(node),
|
|
|
|
|
|
|
|
inner_tx,
|
|
|
|
|
|
|
|
msg.multisig.signer)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return serialize_multisig(msg.multisig, _get_public_key(node), inner_tx)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _get_public_key(node) -> bytes:
|
|
|
|
def _get_public_key(node) -> bytes:
|
|
|
|
# 0x01 prefix is not part of the actual public key, hence removed
|
|
|
|
# 0x01 prefix is not part of the actual public key, hence removed
|
|
|
|
return node.public_key()[1:]
|
|
|
|
return node.public_key()[1:]
|
|
|
@ -75,10 +90,7 @@ async def _supply_change(ctx, public_key: bytes, msg: NEMSignTx):
|
|
|
|
|
|
|
|
|
|
|
|
async def _aggregate_modification(ctx, public_key: bytes, msg: NEMSignTx):
|
|
|
|
async def _aggregate_modification(ctx, public_key: bytes, msg: NEMSignTx):
|
|
|
|
await ask_aggregate_modification(ctx, msg)
|
|
|
|
await ask_aggregate_modification(ctx, msg)
|
|
|
|
if not msg.multisig:
|
|
|
|
w = serialize_aggregate_modification(msg, public_key)
|
|
|
|
w = serialize_aggregate_modification(msg, public_key)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
w = bytearray() # todo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for m in msg.aggregate_modification.modifications:
|
|
|
|
for m in msg.aggregate_modification.modifications:
|
|
|
|
serialize_cosignatory_modification(w, m.type, m.public_key)
|
|
|
|
serialize_cosignatory_modification(w, m.type, m.public_key)
|
|
|
|