public async Task TestSignMulti()
        {
            // Cosigner needs multi signature
            Signer[] signers = new Signer[1]
            {
                new Signer
                {
                    Account = multiHash,
                    Scopes  = WitnessScope.Global
                }
            };

            byte[] script = new byte[1];
            txManager = await TransactionManager.MakeTransactionAsync(multiSigMock.Object, script, signers);

            await txManager
            .AddMultiSig(keyPair1, 2, keyPair1.PublicKey, keyPair2.PublicKey)
            .AddMultiSig(keyPair2, 2, keyPair1.PublicKey, keyPair2.PublicKey)
            .SignAsync();
        }
Beispiel #2
0
        public static TransactionManager AddSignatures(this TransactionManager tm, ExpressChain chain, ExpressWalletAccount account)
        {
            if (account.IsMultiSigContract())
            {
                var signers = chain.GetMultiSigAccounts(account);

                var publicKeys = signers.Select(s => s.GetKey() !.PublicKey).ToArray();
                var sigCount   = account.Contract.Parameters.Count;

                foreach (var signer in signers.Take(sigCount))
                {
                    var keyPair = signer.GetKey() ?? throw new Exception();
                    tm = tm.AddMultiSig(keyPair, sigCount, publicKeys);
                }

                return(tm);
            }
            else
            {
                return(tm.AddSignature(account.GetKey() !));
            }
        }