syntax = "proto3";
package emerald;
option java_package = "io.emeraldpay.api.proto";

message Chain {
    ChainRef type = 1;
}

enum ChainRef {
    CHAIN_UNSPECIFIED = 0;

    CHAIN_BITCOIN = 1;
    // CHAIN_GRIN = 2;

    CHAIN_ETHEREUM = 100;
    CHAIN_ETHEREUM_CLASSIC = 101;
    CHAIN_FANTOM = 102; // Fantom, https://fantom.foundation/

    // Sidechains and state channels start with 1_000
    // CHAIN_LIGHTNING = 1001;
    CHAIN_MATIC = 1002; // Matic PoS Ethereum sidechain based on Polygon
    CHAIN_RSK = 1003; // RSK sidechain, https://www.rsk.co/

    // Testnets start with 10_000
    CHAIN_MORDEN = 10001;
    CHAIN_KOVAN = 10002;
    CHAIN_TESTNET_BITCOIN = 10003;
    // CHAIN_FLOONET = 10004;
    CHAIN_GOERLI = 10005;
    CHAIN_ROPSTEN = 10006;
    CHAIN_RINKEBY = 10007;

    // Non-standard starts from 20_000
}

message SingleAddress {
    string address = 1;
}

message XpubAddress {
    bytes xpub = 1;
    string path = 2;
    uint64 start = 3;
    uint64 limit = 4;
}

message MultiAddress {
    repeated SingleAddress addresses = 1;
}

message ReferenceAddress {
    uint64 refid = 1;
}

message AnyAddress {
    oneof addr_type {
        SingleAddress address_single = 1;
        MultiAddress address_multi = 2;
        XpubAddress address_xpub = 3;
        ReferenceAddress address_ref = 4;
    }
}

message Asset {
    ChainRef chain = 1;
    string code = 2;
}

message BlockInfo {
    uint64 height = 1;
    string block_id = 2;
    uint64 timestamp = 3;
    bytes weight = 4;
}