Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Commit 95c1726

Browse files
committed
[#10] prepare_multisig_transfer now returns raw trytes.
1 parent b6168c6 commit 95c1726

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

iota/multisig/api.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,15 @@ def prepare_multisig_transfer(
195195
Dict containing the following values::
196196
197197
{
198-
'bundle': ProposedBundle,
199-
Finalized bundle. The input transactions are not signed.
198+
'trytes': List[TransactionTrytes],
199+
Finalized bundle, as trytes.
200+
The input transactions are not signed.
200201
}
201202
202203
In order to authorize the spending of IOTAs from the multisig
203204
input, you must generate the correct private keys and invoke the
204-
bundle's :py:meth:`iota.transaction.ProposedBundle.sign_input_at`
205-
method for each key.
205+
:py:meth:`iota.crypto.types.PrivateKey.sign_input_at` method for
206+
each key, in the correct order.
206207
207208
Once the correct signatures are applied, you can then perform
208209
proof of work (``attachToTangle``) and broadcast the bundle using

iota/multisig/commands/prepare_multisig_transfer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _execute(self, request):
117117

118118
# Return the bundle with inputs unsigned.
119119
return {
120-
'bundle': bundle,
120+
'trytes': bundle.as_tryte_strings(),
121121
}
122122

123123

test/multisig/commands/prepare_multisig_transfer_test.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,14 @@ def test_happy_path(self):
564564
),
565565
)
566566

567-
bundle = pmt_result['bundle'] # type: Bundle
567+
# The command returns the raw trytes. This is useful in a
568+
# real-world scenario because trytes are easier to transfer between
569+
# each entity that needs to apply their signature.
570+
#
571+
# However, for purposes of this test, we will convert the trytes
572+
# back into a bundle so that we can inspect the end result more
573+
# easily.
574+
bundle = Bundle.from_tryte_strings(pmt_result['trytes'])
568575

569576
#
570577
# This bundle looks almost identical to what you would expect from
@@ -635,14 +642,8 @@ def test_unspent_inputs_with_change_address(self):
635642
changeAddress = Address(self.trytes_3),
636643
)
637644

638-
bundle = pmt_result['bundle'] # type: Bundle
645+
bundle = Bundle.from_tryte_strings(pmt_result['trytes'])
639646

640-
#
641-
# This bundle looks almost identical to what you would expect from
642-
# :py:meth:`iota.api.Iota.prepare_transfer`, except:
643-
# - There are 4 inputs (to hold all of the signature fragments).
644-
# - The inputs are unsigned.
645-
#
646647
self.assertEqual(len(bundle), 6)
647648

648649
# Spend Transaction

0 commit comments

Comments
 (0)