UNPKG

raiden-ts

Version:

Raiden Light Client Typescript/Javascript SDK

289 lines (288 loc) 13.4 kB
/** * These io-ts codecs validate and decode JSON Raiden messages * They include BigNumber strings validation, enum validation (if needed), Address checksum * validation, etc, and converting everything to its respective object, where needed. */ import * as t from 'io-ts'; export declare enum MessageType { DELIVERED = "Delivered", PROCESSED = "Processed", SECRET_REQUEST = "SecretRequest", SECRET_REVEAL = "RevealSecret", LOCKED_TRANSFER = "LockedTransfer", UNLOCK = "Unlock", LOCK_EXPIRED = "LockExpired", WITHDRAW_REQUEST = "WithdrawRequest", WITHDRAW_CONFIRMATION = "WithdrawConfirmation", WITHDRAW_EXPIRED = "WithdrawExpired", PFS_CAPACITY_UPDATE = "PFSCapacityUpdate", PFS_FEE_UPDATE = "PFSFeeUpdate", MONITOR_REQUEST = "RequestMonitoring" } declare const _Delivered: t.ReadonlyC<t.TypeC<{ type: t.LiteralC<MessageType.DELIVERED>; delivered_message_identifier: import("../utils/types").UIntC<8>; }>>; export interface Delivered extends t.TypeOf<typeof _Delivered> { } export interface DeliveredC extends t.Type<Delivered, t.OutputOf<typeof _Delivered>> { } export declare const Delivered: DeliveredC; declare const _Processed: t.ReadonlyC<t.IntersectionC<[t.TypeC<{ type: t.LiteralC<MessageType.PROCESSED>; }>, t.ReadonlyC<t.TypeC<{ message_identifier: import("../utils/types").UIntC<8>; }>>]>>; export interface Processed extends t.TypeOf<typeof _Processed> { } export interface ProcessedC extends t.Type<Processed, t.OutputOf<typeof _Processed>> { } export declare const Processed: ProcessedC; declare const _SecretRequest: t.ReadonlyC<t.IntersectionC<[t.TypeC<{ type: t.LiteralC<MessageType.SECRET_REQUEST>; payment_identifier: import("../utils/types").UIntC<8>; secrethash: import("../utils/types").HexStringC<32>; amount: import("../utils/types").UIntC<32>; expiration: import("../utils/types").UIntC<32>; }>, t.ReadonlyC<t.TypeC<{ message_identifier: import("../utils/types").UIntC<8>; }>>]>>; export interface SecretRequest extends t.TypeOf<typeof _SecretRequest> { } export interface SecretRequestC extends t.Type<SecretRequest, t.OutputOf<typeof _SecretRequest>> { } export declare const SecretRequest: SecretRequestC; declare const _SecretReveal: t.ReadonlyC<t.IntersectionC<[t.TypeC<{ type: t.LiteralC<MessageType.SECRET_REVEAL>; secret: import("../utils/types").HexStringC<32>; }>, t.ReadonlyC<t.TypeC<{ message_identifier: import("../utils/types").UIntC<8>; }>>]>>; export interface SecretReveal extends t.TypeOf<typeof _SecretReveal> { } export interface SecretRevealC extends t.Type<SecretReveal, t.OutputOf<typeof _SecretReveal>> { } export declare const SecretReveal: SecretRevealC; declare const _RouteMetadata: t.ReadonlyC<t.IntersectionC<[t.TypeC<{ route: t.ReadonlyArrayC<import("../utils/types").AddressC>; }>, t.PartialC<{ address_metadata: t.RefinementType<t.ReadonlyC<t.RecordC<t.StringC, import("../services/types").AddressMetadataC>>, Readonly<{ [x: string]: import("../services/types").AddressMetadata; }>, Readonly<{ [x: string]: Readonly<{ user_id: string; displayname: string; capabilities: string; }>; }>, unknown>; }>]>>; export interface RouteMetadata extends t.TypeOf<typeof _RouteMetadata> { } export interface RouteMetadataC extends t.Type<RouteMetadata, t.OutputOf<typeof _RouteMetadata>> { } export declare const RouteMetadata: RouteMetadataC; declare const _Metadata: t.ReadonlyC<t.TypeC<{ routes: t.ReadonlyArrayC<RouteMetadataC>; }>>; export interface Metadata extends t.TypeOf<typeof _Metadata> { } export interface MetadataC extends t.Type<Metadata, t.OutputOf<typeof _Metadata>> { } export declare const Metadata: MetadataC; declare const _LockedTransfer: t.ReadonlyC<t.IntersectionC<[t.TypeC<{ type: t.LiteralC<MessageType.LOCKED_TRANSFER>; }>, t.ReadonlyC<t.IntersectionC<[t.TypeC<{ payment_identifier: import("../utils/types").UIntC<8>; token: import("../utils/types").AddressC; recipient: import("../utils/types").AddressC; lock: t.IntersectionC<[t.TypeC<{ amount: import("../utils/types").UIntC<32>; expiration: import("../utils/types").UIntC<32>; secrethash: import("../utils/types").HexStringC<32>; }>, t.PartialC<{ registered: t.LiteralC<true>; }>]>; target: import("../utils/types").AddressC; initiator: import("../utils/types").AddressC; metadata: t.UnknownC; }>, t.ReadonlyC<t.IntersectionC<[t.TypeC<{ chain_id: import("../utils/types").UIntC<32>; token_network_address: import("../utils/types").AddressC; channel_identifier: import("../utils/types").UIntC<32>; nonce: import("../utils/types").UIntC<8>; transferred_amount: import("../utils/types").UIntC<32>; locked_amount: import("../utils/types").UIntC<32>; locksroot: import("../utils/types").HexStringC<32>; }>, t.ReadonlyC<t.TypeC<{ message_identifier: import("../utils/types").UIntC<8>; }>>]>>]>>]>>; export interface LockedTransfer extends t.TypeOf<typeof _LockedTransfer> { } export interface LockedTransferC extends t.Type<LockedTransfer, t.OutputOf<typeof _LockedTransfer>> { } export declare const LockedTransfer: LockedTransferC; declare const _Unlock: t.ReadonlyC<t.IntersectionC<[t.TypeC<{ type: t.LiteralC<MessageType.UNLOCK>; payment_identifier: import("../utils/types").UIntC<8>; secret: import("../utils/types").HexStringC<32>; }>, t.ReadonlyC<t.IntersectionC<[t.TypeC<{ chain_id: import("../utils/types").UIntC<32>; token_network_address: import("../utils/types").AddressC; channel_identifier: import("../utils/types").UIntC<32>; nonce: import("../utils/types").UIntC<8>; transferred_amount: import("../utils/types").UIntC<32>; locked_amount: import("../utils/types").UIntC<32>; locksroot: import("../utils/types").HexStringC<32>; }>, t.ReadonlyC<t.TypeC<{ message_identifier: import("../utils/types").UIntC<8>; }>>]>>]>>; export interface Unlock extends t.TypeOf<typeof _Unlock> { } export interface UnlockC extends t.Type<Unlock, t.OutputOf<typeof _Unlock>> { } export declare const Unlock: UnlockC; declare const _LockExpired: t.ReadonlyC<t.IntersectionC<[t.TypeC<{ type: t.LiteralC<MessageType.LOCK_EXPIRED>; recipient: import("../utils/types").AddressC; secrethash: import("../utils/types").HexStringC<32>; }>, t.ReadonlyC<t.IntersectionC<[t.TypeC<{ chain_id: import("../utils/types").UIntC<32>; token_network_address: import("../utils/types").AddressC; channel_identifier: import("../utils/types").UIntC<32>; nonce: import("../utils/types").UIntC<8>; transferred_amount: import("../utils/types").UIntC<32>; locked_amount: import("../utils/types").UIntC<32>; locksroot: import("../utils/types").HexStringC<32>; }>, t.ReadonlyC<t.TypeC<{ message_identifier: import("../utils/types").UIntC<8>; }>>]>>]>>; export interface LockExpired extends t.TypeOf<typeof _LockExpired> { } export interface LockExpiredC extends t.Type<LockExpired, t.OutputOf<typeof _LockExpired>> { } export declare const LockExpired: LockExpiredC; declare const _WithdrawRequest: t.ReadonlyC<t.IntersectionC<[t.TypeC<{ type: t.LiteralC<MessageType.WITHDRAW_REQUEST>; }>, t.PartialC<{ coop_settle: t.BooleanC; }>, t.ReadonlyC<t.TypeC<{ chain_id: import("../utils/types").UIntC<32>; token_network_address: import("../utils/types").AddressC; channel_identifier: import("../utils/types").UIntC<32>; participant: import("../utils/types").AddressC; total_withdraw: import("../utils/types").UIntC<32>; nonce: import("../utils/types").UIntC<8>; expiration: import("../utils/types").UIntC<32>; }>>, t.ReadonlyC<t.TypeC<{ message_identifier: import("../utils/types").UIntC<8>; }>>]>>; export interface WithdrawRequest extends t.TypeOf<typeof _WithdrawRequest> { } export interface WithdrawRequestC extends t.Type<WithdrawRequest, t.OutputOf<typeof _WithdrawRequest>> { } export declare const WithdrawRequest: WithdrawRequestC; declare const _WithdrawConfirmation: t.ReadonlyC<t.IntersectionC<[t.TypeC<{ type: t.LiteralC<MessageType.WITHDRAW_CONFIRMATION>; }>, t.ReadonlyC<t.TypeC<{ chain_id: import("../utils/types").UIntC<32>; token_network_address: import("../utils/types").AddressC; channel_identifier: import("../utils/types").UIntC<32>; participant: import("../utils/types").AddressC; total_withdraw: import("../utils/types").UIntC<32>; nonce: import("../utils/types").UIntC<8>; expiration: import("../utils/types").UIntC<32>; }>>, t.ReadonlyC<t.TypeC<{ message_identifier: import("../utils/types").UIntC<8>; }>>]>>; export interface WithdrawConfirmation extends t.TypeOf<typeof _WithdrawConfirmation> { } export interface WithdrawConfirmationC extends t.Type<WithdrawConfirmation, t.OutputOf<typeof _WithdrawConfirmation>> { } export declare const WithdrawConfirmation: WithdrawConfirmationC; declare const _WithdrawExpired: t.ReadonlyC<t.IntersectionC<[t.TypeC<{ type: t.LiteralC<MessageType.WITHDRAW_EXPIRED>; }>, t.ReadonlyC<t.TypeC<{ chain_id: import("../utils/types").UIntC<32>; token_network_address: import("../utils/types").AddressC; channel_identifier: import("../utils/types").UIntC<32>; participant: import("../utils/types").AddressC; total_withdraw: import("../utils/types").UIntC<32>; nonce: import("../utils/types").UIntC<8>; expiration: import("../utils/types").UIntC<32>; }>>, t.ReadonlyC<t.TypeC<{ message_identifier: import("../utils/types").UIntC<8>; }>>]>>; export interface WithdrawExpired extends t.TypeOf<typeof _WithdrawExpired> { } export interface WithdrawExpiredC extends t.Type<WithdrawExpired, t.OutputOf<typeof _WithdrawExpired>> { } export declare const WithdrawExpired: WithdrawExpiredC; declare const _PFSCapacityUpdate: t.ReadonlyC<t.TypeC<{ type: t.LiteralC<MessageType.PFS_CAPACITY_UPDATE>; canonical_identifier: t.ReadonlyC<t.TypeC<{ chain_identifier: import("../utils/types").UIntC<32>; token_network_address: import("../utils/types").AddressC; channel_identifier: import("../utils/types").UIntC<32>; }>>; updating_participant: import("../utils/types").AddressC; other_participant: import("../utils/types").AddressC; updating_nonce: import("../utils/types").UIntC<8>; other_nonce: import("../utils/types").UIntC<8>; updating_capacity: import("../utils/types").UIntC<32>; other_capacity: import("../utils/types").UIntC<32>; reveal_timeout: import("../utils/types").UIntC<32>; }>>; export interface PFSCapacityUpdate extends t.TypeOf<typeof _PFSCapacityUpdate> { } export interface PFSCapacityUpdateC extends t.Type<PFSCapacityUpdate, t.OutputOf<typeof _PFSCapacityUpdate>> { } export declare const PFSCapacityUpdate: PFSCapacityUpdateC; declare const _PFSFeeUpdate: t.ReadonlyC<t.TypeC<{ type: t.LiteralC<MessageType.PFS_FEE_UPDATE>; canonical_identifier: t.ReadonlyC<t.TypeC<{ chain_identifier: import("../utils/types").UIntC<32>; token_network_address: import("../utils/types").AddressC; channel_identifier: import("../utils/types").UIntC<32>; }>>; updating_participant: import("../utils/types").AddressC; timestamp: t.StringC; fee_schedule: t.TypeC<{ cap_fees: t.BooleanC; imbalance_penalty: t.UnionC<[t.NullC, t.ReadonlyArrayC<t.ReadonlyC<t.TupleC<[import("../utils/types").UIntC<32>, import("../utils/types").UIntC<32>]>>>]>; proportional: import("../utils/types").IntC<32>; flat: import("../utils/types").IntC<32>; }>; }>>; export interface PFSFeeUpdate extends t.TypeOf<typeof _PFSFeeUpdate> { } export interface PFSFeeUpdateC extends t.Type<PFSFeeUpdate, t.OutputOf<typeof _PFSFeeUpdate>> { } export declare const PFSFeeUpdate: PFSFeeUpdateC; declare const _MonitorRequest: t.ReadonlyC<t.TypeC<{ type: t.LiteralC<MessageType.MONITOR_REQUEST>; balance_proof: t.TypeC<{ chain_id: import("../utils/types").UIntC<32>; token_network_address: import("../utils/types").AddressC; channel_identifier: import("../utils/types").UIntC<32>; nonce: import("../utils/types").UIntC<8>; balance_hash: import("../utils/types").HexStringC<32>; additional_hash: import("../utils/types").HexStringC<32>; signature: import("../utils/types").HexStringC<65>; }>; monitoring_service_contract_address: import("../utils/types").AddressC; non_closing_participant: import("../utils/types").AddressC; non_closing_signature: import("../utils/types").HexStringC<65>; reward_amount: import("../utils/types").UIntC<32>; }>>; export interface MonitorRequest extends t.TypeOf<typeof _MonitorRequest> { } export interface MonitorRequestC extends t.Type<MonitorRequest, t.OutputOf<typeof _MonitorRequest>> { } export declare const MonitorRequest: MonitorRequestC; declare const messages: [DeliveredC, ProcessedC, SecretRequestC, SecretRevealC, LockedTransferC, UnlockC, LockExpiredC, WithdrawRequestC, WithdrawConfirmationC, WithdrawExpiredC, PFSCapacityUpdateC, PFSFeeUpdateC, MonitorRequestC]; export declare type Message = t.TypeOf<typeof messages[number]>; export interface MessageC extends t.UnionC<typeof messages> { } export declare const Message: MessageC; export declare type EnvelopeMessage = LockedTransfer | Unlock | LockExpired; export {};