UNPKG

raiden-ts

Version:

Raiden Light Client Typescript/Javascript SDK

166 lines (165 loc) 7.43 kB
import type { Network } from '@ethersproject/networks'; import * as t from 'io-ts'; import { PartialRaidenConfig } from './config'; import { ContractsInfo } from './types'; import { Address } from './utils/types'; declare const _RaidenState: t.ReadonlyC<t.TypeC<{ address: import("./utils/types").AddressC; chainId: t.NumberC; contracts: t.ReadonlyC<t.RecordC<t.KeyofC<{ TokenNetworkRegistry: null; ServiceRegistry: null; UserDeposit: null; SecretRegistry: null; MonitoringService: null; OneToN: null; }>, t.ReadonlyC<t.TypeC<{ address: import("./utils/types").AddressC; block_number: t.NumberC; }>>>>; blockNumber: t.NumberC; config: t.ReadonlyC<t.ExactC<t.PartialC<{ matrixServer: t.StringC; subkey: t.BooleanC; gasPriceFactor: t.UnionC<[t.NumberC, t.NullC]>; matrixServerLookup: t.StringC; revealTimeout: t.NumberC; expiryFactor: t.NumberC; httpTimeout: t.NumberC; additionalServices: t.ReadonlyArrayC<t.UnionC<[import("./utils/types").AddressC, t.StringC]>>; pfsMode: t.KeyofC<{ disabled: string; auto: string; onlyAdditional: string; }>; pfsSafetyMargin: t.UnionC<[t.NumberC, t.TupleC<[t.NumberC, t.NumberC]>]>; pfsMaxPaths: t.NumberC; pfsMaxFee: import("./utils/types").UIntC<32>; pfsIouTimeout: t.NumberC; confirmationBlocks: t.NumberC; monitoringReward: t.UnionC<[t.NullC, import("./utils/types").UIntC<32>]>; logger: t.KeyofC<{ "": null; trace: null; debug: null; info: null; warn: null; error: null; }>; caps: t.UnionC<[t.NullC, t.ReadonlyC<t.RecordC<t.StringC, t.UnionC<[t.UnionC<[t.StringC, t.NumberC, t.BooleanC, t.NullC]>, t.ArrayC<t.UnionC<[t.StringC, t.NumberC, t.BooleanC, t.NullC]>>]>>>]>; fallbackIceServers: t.ArrayC<t.TypeC<{ urls: t.UnionC<[t.StringC, t.ArrayC<t.StringC>]>; }>>; rateToSvt: t.RecordC<t.StringC, import("./utils/types").UIntC<32>>; pollingInterval: t.NumberC; minimumAllowance: import("./utils/types").UIntC<32>; autoSettle: t.BooleanC; autoUDCWithdraw: t.BooleanC; mediationFees: t.UnknownC; encryptSecret: t.BooleanC; }>>>; channels: t.ReadonlyC<t.RecordC<t.StringC, t.IntersectionC<[t.ReadonlyC<t.TypeC<{ _id: t.RefinementType<t.StringC, `0x${string}@0x${string}#${number}`, string, unknown>; id: t.NumberC; token: import("./utils/types").AddressC; tokenNetwork: import("./utils/types").AddressC; isFirstParticipant: t.BooleanC; openBlock: t.NumberC; own: import("./channels/state").ChannelEndC; partner: import("./channels/state").ChannelEndC; }>>, t.UnionC<[t.ReadonlyC<t.TypeC<{ state: t.UnionC<[t.LiteralC<import("./channels/state").ChannelState.open>, t.LiteralC<import("./channels/state").ChannelState.closing>]>; }>>, t.IntersectionC<[t.ReadonlyC<t.TypeC<{ closeBlock: t.NumberC; closeParticipant: import("./utils/types").AddressC; }>>, t.UnionC<[t.ReadonlyC<t.TypeC<{ state: t.UnionC<[t.LiteralC<import("./channels/state").ChannelState.closed>, t.LiteralC<import("./channels/state").ChannelState.settleable>, t.LiteralC<import("./channels/state").ChannelState.settling>]>; }>>, t.ReadonlyC<t.TypeC<{ state: t.LiteralC<import("./channels/state").ChannelState.settled>; settleBlock: t.NumberC; }>>]>]>]>]>>>; oldChannels: t.ReadonlyC<t.RecordC<t.StringC, t.IntersectionC<[t.ReadonlyC<t.TypeC<{ _id: t.RefinementType<t.StringC, `0x${string}@0x${string}#${number}`, string, unknown>; id: t.NumberC; token: import("./utils/types").AddressC; tokenNetwork: import("./utils/types").AddressC; isFirstParticipant: t.BooleanC; openBlock: t.NumberC; own: import("./channels/state").ChannelEndC; partner: import("./channels/state").ChannelEndC; }>>, t.UnionC<[t.ReadonlyC<t.TypeC<{ state: t.UnionC<[t.LiteralC<import("./channels/state").ChannelState.open>, t.LiteralC<import("./channels/state").ChannelState.closing>]>; }>>, t.IntersectionC<[t.ReadonlyC<t.TypeC<{ closeBlock: t.NumberC; closeParticipant: import("./utils/types").AddressC; }>>, t.UnionC<[t.ReadonlyC<t.TypeC<{ state: t.UnionC<[t.LiteralC<import("./channels/state").ChannelState.closed>, t.LiteralC<import("./channels/state").ChannelState.settleable>, t.LiteralC<import("./channels/state").ChannelState.settling>]>; }>>, t.ReadonlyC<t.TypeC<{ state: t.LiteralC<import("./channels/state").ChannelState.settled>; settleBlock: t.NumberC; }>>]>]>]>]>>>; tokens: t.ReadonlyC<t.RecordC<t.StringC, import("./utils/types").AddressC>>; transport: t.ReadonlyC<t.PartialC<{ server: t.StringC; setup: t.ReadonlyC<t.TypeC<{ userId: t.StringC; accessToken: t.StringC; deviceId: t.StringC; displayName: t.StringC; }>>; }>>; transfers: t.ReadonlyC<t.RecordC<t.StringC, import("./transfers/state").TransferStateC>>; iou: t.ReadonlyC<t.RecordC<t.StringC, t.RecordC<t.StringC, import("./utils/types").SignedC<t.ReadonlyC<t.TypeC<{ sender: import("./utils/types").AddressC; receiver: import("./utils/types").AddressC; amount: import("./utils/types").UIntC<32>; claimable_until: import("./utils/types").UIntC<32>; one_to_n_address: import("./utils/types").AddressC; chain_id: import("./utils/types").UIntC<32>; }>>>>>>; pendingTxs: t.ReadonlyArrayC<t.Type<Readonly<{ type: string; payload: { txHash: import("./utils/types").HexString<32>; txBlock: number; confirmed: boolean | undefined; }; }>, { type: string; payload: { txHash: string; txBlock: number; confirmed: boolean | undefined; }; }, unknown>>; services: t.ReadonlyC<t.RecordC<t.StringC, t.NumberC>>; }>>; export interface RaidenState extends t.TypeOf<typeof _RaidenState> { } export interface RaidenStateC extends t.Type<RaidenState, t.OutputOf<typeof _RaidenState>> { } export declare const RaidenState: RaidenStateC; declare type PartialState = { config?: PartialRaidenConfig; } & Omit<Partial<RaidenState>, 'config'>; /** * Create an initial RaidenState from common parameters (including default config) * * @param obj - Object containing common parameters for state * @param obj.network - ether's Network object for the current blockchain * @param obj.address - current account's address * @param obj.contractsInfo - ContractsInfo mapping * @param overrides - A partial object to overwrite top-level properties of the returned config * @returns A full config object */ export declare function makeInitialState({ network, address, contractsInfo, }: { network: Network; address: Address; contractsInfo: ContractsInfo; }, overrides?: PartialState): RaidenState; /** * state constant used as default state reducer parameter only. * To build an actual initial state at runtime, use [[makeInitialState]] instead. */ export declare const initialState: RaidenState; export {};