export declare type WalletMessageType = 'authenticate' | 'request' | 'subscribe' | 'tx';
export interface MessageBody {
    topic?: string;
}
export interface BaseRequest {
    requestid?: number | string;
    MessageType: string;
    MessageBody: any;
}
export interface SubscribeRequest extends BaseRequest {
    MessageType: 'subscribe';
    MessageBody: {
        topic: string[];
    };
}
export interface ServerMessageRequest<T> extends BaseRequest {
    MessageType: 'servermessage';
    MessageBody: T;
}
export interface AuthenticateRequest extends BaseRequest {
    MessageType: 'authenticate';
    MessageBody: AuthenticateBody;
}
export interface RequestRequest<T extends MessageBody> extends BaseRequest {
    MessageType: 'request';
    MessageBody: T;
}
export interface TxRequest<T extends MessageBody> extends BaseRequest {
    MessageType: 'tx';
    MessageBody: T;
}
export interface StateBody extends MessageBody {
    topic: 'state';
}
export interface AuthenticateBody extends MessageBody {
    userid: number;
    apikey: string;
}
export interface SigUpdateBody extends MessageBody {
    MessageType: '';
    Data: {
        ResponseToken: '';
        Token: string;
        updatemsg: {
            userid: number;
            wallets: number[];
        };
    };
}
export interface NamespaceBody extends MessageBody {
    topic: 'issuers';
    walletid?: number;
    namespace?: string;
    address?: string;
}
export interface InstrumentsBody extends MessageBody {
    topic: 'instruments';
    walletid?: number;
}
export interface AddressesBody extends MessageBody {
    topic: 'addresses';
    walletid: number;
}
export interface RegisterNamespaceBody extends MessageBody {
    txtype: 'nsreg';
    walletid: number;
    name: string;
    address: string;
    metadata?: any;
}
export interface HoldingsDetailBody extends MessageBody {
    topic: 'holdingsdetail';
    walletid: number;
}
export interface RegisterAssetBody extends MessageBody {
    txtype: 'asreg';
    walletid: number;
    address: string;
    namespace: string;
    instrument: string;
    metadata?: any;
}
export interface IssueAssetBody extends MessageBody {
    txtype: 'asiss';
    walletid: number;
    address: string;
    namespace: string;
    instrument: string;
    amount: number;
}
export declare type RawBeneficiary = [
/** address */
string, number, number];
export declare type RawAdministrator = RawBeneficiary;
export interface EncumberAssetBody extends MessageBody {
    txtype: 'encum';
    walletid: number;
    address: string;
    subjectaddress: string;
    reference: string;
    namespace: string;
    instrument: string;
    amount: number;
    beneficiaries: RawBeneficiary[];
    administrators: RawAdministrator[];
    iscumulative: boolean;
    metadata?: any;
}
export interface UnencumberAssetBody extends MessageBody {
    txtype: 'unenc';
    walletid: number;
    amount: number;
    address: string;
    instrument: string;
    subjectaddress: string;
    reference: string;
    publickey?: string;
    namespace: string;
}
export declare type RawPayee = [string, // Address
string, // Namespace
string, // Instrument
number, // Amount
string, // PubKey
string, // Signature
boolean, // Issuance
string, // Metadata
string];
export declare type RawRecipient = [string, // Address
string, // Namespace
string, // Asset Class
number];
export declare type RawParty = [string, // Identifier
string, // Address
RawPayee[], // PayList
RawRecipient[], // ReceiveList
string, // PubKey
string, // Signature
boolean, // Must Sign?
string];
export declare type RawParties = [number, // Party Count
...RawParty[]];
export declare type DvpEvent = 'commit' | 'expiry';
export declare type RawAddEncumbrance = [string, string, string, number, RawBeneficiary[], RawAdministrator[]];
/**
 * HEX, Public key, 64 chars.
 */
export declare type RawAddressString = string;
/**
 * Address string.
 */
export declare type RawPublicKey = string;
/**
 * May be empty string.
 */
export declare type AuthorisationId = string;
/**
 * Base64 signature. Concatenation of the contract address and the authorisation ID. Usually empty string, provided by subsequent commitment.
 */
declare type AuthorisationSignature = string;
/**
 * User metadata.
 */
declare type Metadata = string;
/**
 * If true, then this authorisation is "Refused". Refused authorisations will not count as signed, This value may be set during commit TXs.
 */
declare type AuthorisationRefused = boolean;
/**
 * RawAuthorisation is the raw blockchain format. You should not use this directly, but instead use Authorisation.
 */
export declare type RawAuthorisation = [RawAddressString | RawPublicKey, AuthorisationId, AuthorisationSignature, Metadata, AuthorisationRefused];
/**
 * Authorisation is an additional contract commitment required to validate the contract.
 */
export interface Authorisation {
    /**
     * The address of autoriser.
     */
    address: string;
    /**
     * May be empty string.
     */
    authorisationId: string;
    /**
     * The signature of the authoriser.
     */
    signature?: string;
    /**
     * User metadata.
     */
    metadata: string;
    /**
     * If true, then this authorisation is "refused", refused authorisations will not count as signed. This value may be set during commit Txs.
     */
    refused?: boolean;
}
/**
 * "key" is the variable name used in payment/receipt lines.
 * We recommend tat all keys are specified in lower case. Keys are not case sensitive when value substitution takes place, but are case sensitive for signing or commitment purposes.
 * If two keys are given which resolve the the same lowercase value, then one will be arbitrarily get precedence.
 */
declare type ParameterKey = string;
/**
 * value to insert, empty string ('') indicates a not-yet-set value.
 */
declare type ParameterValue = string;
/**
 * 'Values' will be evaluated before use in 'CalculatedIndex' order. This allows a calculation sequence to be defined.
 */
declare type ParameterCalculatedIndex = number;
/**
 * (Int) 0 : Signature message does not include ContractAddress, 1 : It does. This allows a parameter value to, optionally, be sent to multiple contracts is required.
 */
declare type ParameterContractSpecific = 0 | 1;
/**
 * (Int) 0 : Normal - Requires signature etc. 1 : Is only present as an intermediate value to be evaluated in consensus thus can not be changed and does not require signature.
 */
declare type ParameterCalculationOnly = 0 | 1;
/**
 * Signature of '[ContractAddress|]key|Value' by 'Public Key'. 'ContractAddress|' is included in the message if 'ContractSpecific' != 0
 */
declare type ParameterSignature = string;
/**
 * RawParameter is the raw blockchain format for a contract parameter. It should not be used directly, but instead, use Parameter.
 */
declare type RawParameter = [ParameterKey, RawAddressString | RawPublicKey, ParameterValue, ParameterCalculatedIndex, ParameterContractSpecific, ParameterCalculationOnly, ParameterSignature];
/**
 * Parameters are values that may be substituted into payment / receipt lines.
 */
export interface Parameter {
    /**
     * "key" is the variable name used in payment/receipt lines.
     * We recommend tat all keys are specified in lower case. Keys are not case sensitive when value substitution takes place, but are case sensitive for signing or commitment purposes.
     * If two keys are given which resolve the the same lowercase value, then one will be arbitrarily get precedence.
     */
    key: string;
    /**
     * The address of the party that may udpate the variable in a commit transaction.
     */
    address: string;
    /**
     * Value to insert. Empty string indicates a not-yet-set value.
     */
    value: string;
    /**
     * 'Values' will be evaluated before use in 'CalculatedIndex' order. This allows a calculation sequence to be defined.
     */
    calculatedIndex: number;
    /**
     * false: Signature message does not include ContractAddress, true: It does. This allows a parameter value to, optionally, be sent to multiple contracts is required.
     */
    contractSpecific: boolean;
    /**
     * false: Normal - Requires signature etc. true: Is only present as an intermediate value to be evaluated in consensus thus can not be changed and does not require signature.
     */
    calculationOnly: boolean;
    /**
     * Signature of '[ContractAddress|]key|Value' by 'Public Key'. 'ContractAddress|' is included in the message if 'ContractSpecific' == true.
     */
    signature: string;
}
export interface NewContractBody extends MessageBody {
    txtype: 'conew';
    walletid: number;
    address: string;
    contractdata: {
        __function: 'dvp_uk';
        parties: RawParties;
        authorisations: RawAuthorisation[];
        parameters: RawParameter[];
        encumbrance: [boolean, string];
        addencumbrances: RawAddEncumbrance[];
        events: DvpEvent[];
        expiry: number;
        startdate: number;
        protocol: 'dvp';
        metadata: string;
        deletedelayoncomplete: number;
        autosign: boolean;
    };
}
export interface ContractCommitBody extends MessageBody {
    topic: 'cocom';
    walletid: number;
    address: string;
    function: 'dvp_uk_commit';
    contractaddress: string;
    contractdata: {
        contractfunction: 'dvp_uk_commit';
        authorise: RawAuthorisation[];
    };
}
export interface BaseMessage<T> {
    request: any;
    data: T;
    messagetype: string;
    requestid: number;
    status: 'OK' | 'FAIL' | undefined;
}
export interface ErrorBody {
    status?: string;
    error?: string;
}
export interface Message<T> extends BaseMessage<T> {
    status: 'OK';
}
export interface ErrorMessage extends BaseMessage<ErrorBody> {
    status: 'FAIL' | undefined;
}
export interface BaseResponse<T> {
    id: string | number;
    message: T;
    userData?: any;
}
export interface WalletResponse<T> extends BaseResponse<Message<T>> {
    status: 'OK';
}
export interface ErrorResponse extends BaseResponse<ErrorMessage> {
    status: 'FAIL';
}
export declare type RawInstrument = [string, string, string, string?];
export interface Namespace {
    address: string;
    namespace: string;
    metadata: string;
}
export interface Instrument {
    address: string;
    namespace: string;
    instrument: string;
    metadata: string;
}
export declare type RawAddress = [string, string];
export interface Address {
    address: string;
    publicKey: string;
}
export declare type NamespacesResponse = string[];
export interface AuthenticateResponse {
    token: string;
}
export interface NewAddressResponse {
    walletid: number;
    address: string;
    publickey: string;
}
export interface RegisterNamespaceResponse {
    metadata: string;
    poa: string;
    signature: string;
    namespace: string;
    nonce: number;
    txtype: number;
    updated: boolean;
    basechain: number;
    creation: number;
    fromaddr: string;
    hash: string;
}
export interface RegisterAssetResponse {
    metadata: string;
    poa: string;
    signature: string;
    error: string;
    nonce: number;
    fromaddr: string;
    classid: string;
    namespace: string;
    txtype: number;
    updated: boolean;
    basechain: number;
    creation: number;
    hash: string;
}
export declare type InstrumentResponse = Instrument[];
export interface IssueAssetResponse {
    amount: number;
    metadata: string;
    poa: string;
    signature: string;
    nonce: number;
    fromaddr: string;
    classid: string;
    protocol: string;
    toaddr: string;
    namespace: string;
    txtype: number;
    updated: boolean;
    basechain: number;
    creation: number;
    hash: string;
}
export interface HoldingsDetailResponse {
    error?: string;
    balances: {
        [address: string]: {
            [fullAssetId: string]: [number, // balance
            number];
        };
    };
}
export interface Administrator extends Beneficiary {
}
export interface Beneficiary {
    address: string;
    endtime: number;
    starttime: number;
}
export interface Encumbrances {
    administrators: Administrator[];
    beneficiaries: Beneficiary[];
    iscumulative: boolean;
    reference: string;
}
export interface EncumbranceResponse {
    amount: number;
    metadata: string;
    poa: string;
    signature: string;
    subjectaddr: string;
    nonce: number;
    fromaddr: string;
    classid: string;
    error?: string;
    protocol: string;
    namespace: string;
    encumbrances: Encumbrances;
    txtype: number;
    updated: boolean;
    basechain: number;
    creation: number;
    hash: string;
}
export interface UnencumberAssetResponse {
    amount: number;
    metadata: string;
    poa: string;
    signature: string;
    subjectaddr: string;
    nonce: number;
    fromaddr: string;
    reference: string;
    classid: string;
    protocol: string;
    namespace: string;
    txtype: number;
    updated: boolean;
    basechain: number;
    creation: number;
    hash: string;
    error?: string;
}
export interface SigUpdateResponse {
    status: string;
    responsetoken: string;
}
export interface NewContractResponse {
    error?: string;
    contractaddress: string;
    poa: string;
    signature: string;
    nonce: number;
    txtype: number;
    updated: boolean;
    basechain: number;
    creation: number;
    fromaddr: string;
    hash: string;
}
export interface ContractsResponse {
    __address: string;
    __completed: number;
    __function: string;
    __timeevent: number;
    __canceltime?: number;
    addencumbrances: RawAddEncumbrance[];
    authorisations: any[];
    deletedelayoncomplete: number;
    encumbrance: any[];
    events: string[];
    expiry: number;
    issuingaddress: string;
    metadata: string;
    parameters: any;
    parties: RawParties[];
    protocol: string;
    startdate: number;
}
export declare enum ContractStatus {
    Pending = 0,
    Complete = 1,
    Cancelled = 2
}
export interface Receipt {
    /**
     * Address to which payment will be made.
     */
    address: string;
    /**
     * Asset Issuer.
     */
    namespace: string;
    /**
     * Asset Class.
     */
    instrument: string;
    /**
     * Amount.
     */
    quantity: number;
}
export interface Payment {
    /**
     * Address from which payment will be taken.
     */
    address: string;
    /**
     * Asset Issuer.
     */
    namespace: string;
    /**
     * Asset Class.
     */
    instrument: string;
    /**
     * Amount.
     */
    quantity: number;
    /**
     * Public Key for this Address. HEX.
     */
    publicKey?: string;
    /**
     * Base64. Signature of [NameSpace, AssetID, Qty] by Address1.
     */
    signatature?: string;
    /**
     * Issue new asset to fulfil this payment. Only works if this Payment Address (which MUST be specified).
     */
    issuance?: boolean;
    /**
     * Metadata related to this payment. Will be copied through to 'Effective' Transactions.
     */
    metadata?: string;
    /**
     *  A specific encumbrance to be used for this payment. This will override the general Contract
     *  value, though encumbrances must still be enabled in the 'encumbrance' section.
     */
    encumbrance?: string;
}
export interface Party {
    partyIdentifier: string;
    /**
     * Party Address.
     */
    address: string;
    /**
     * PayList, may be an empty list.
     */
    payList: Payment[];
    /**
     * ReceiveList, may be an empty list.
     */
    receiveList: Receipt[];
    /**
     * Public Key for this Address. HEX.
     */
    publicKey?: string;
    /**
     * Base64. Signature of [NameSpace, AssetID, Qty] by Address1.
     */
    signature?: string;
    /**
     * (default = false) If True, then party must sign, otherwise 'receipt-only' parties are not required to sign and Encumbrances will be used without signature.
     */
    mustSign?: boolean;
    /**
     * User-defined metadata to be added to the contract
     */
    metadata?: string;
}
export interface ContractEncumbrance {
    use: boolean;
    reference?: string;
}
export interface AddEncumbrance {
    address: string;
    fullAssetId: string;
    reference: string;
    amount: number;
    beneficiaries: Beneficiary[];
    administrators: Administrator[];
}
export interface IJsonPoster {
    post<T, R>(url: string, data: T): Promise<R>;
}
export interface ILogger {
    info(...msg: any[]): void;
    error(...msg: any[]): void;
    debug(...msg: any[]): void;
}
export {};
