1
// Copyright © 2017-2020 Trust Wallet.
2
//
3
// This file is part of Trust. The full Trust copyright notice, including
4
// terms governing use, modification, and redistribution, is contained in the
5
// file LICENSE at the root of the source code distribution tree.
6

7
#include <stdexcept>
8

9
#include "ParamsBuilder.h"
10
#include "SigData.h"
11

12
using namespace TW;
13
using namespace TW::Ontology;
14

15 1
Data SigData::serialize() {
16 1
    auto sigInfo = ParamsBuilder::fromSigs(sigs);
17 1
    if (pubKeys.empty()) {
18 0
        throw std::runtime_error("Public key is empty.");
19
    }
20 1
    std::vector<uint8_t> verifyInfo;
21 1
    if (pubKeys.size() == 1) {
22 1
        verifyInfo = ParamsBuilder::fromPubkey(pubKeys[0]);
23 1
    } else {
24 0
        verifyInfo = ParamsBuilder::fromMultiPubkey(m, pubKeys);
25
    }
26 1
    ParamsBuilder builder;
27 1
    builder.pushVar(sigInfo);
28 1
    builder.pushVar(verifyInfo);
29 1
    return builder.getBytes();
30
}

Read our documentation on viewing source code .

Loading