raiden-ts
Version:
Raiden Light Client Typescript/Javascript SDK
663 lines (662 loc) • 22.4 kB
TypeScript
import * as t from 'io-ts';
import { ShutdownReason } from './constants';
import type { Action, ActionType } from './utils/actions';
export declare const raidenShutdown: ((payload: {
reason: Error | ShutdownReason;
}) => {
readonly type: "raiden/shutdown";
readonly payload: {
reason: Error | ShutdownReason;
};
}) & {
type: "raiden/shutdown";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "raiden/shutdown";
readonly payload: {
reason: Error | ShutdownReason;
};
};
error: undefined;
};
export interface raidenShutdown extends ActionType<typeof raidenShutdown> {
}
export declare const raidenConfigUpdate: ((payload: Readonly<{
matrixServer?: string | undefined;
subkey?: boolean | undefined;
gasPriceFactor?: number | null | undefined;
matrixServerLookup?: string | undefined;
revealTimeout?: number | undefined;
expiryFactor?: number | undefined;
httpTimeout?: number | undefined;
additionalServices?: readonly (string | import("./utils/types").Address)[] | undefined;
pfsMode?: import(".").PfsMode | undefined;
pfsSafetyMargin?: number | [number, number] | undefined;
pfsMaxPaths?: number | undefined;
pfsMaxFee?: import("./utils/types").UInt<32> | undefined;
pfsIouTimeout?: number | undefined;
confirmationBlocks?: number | undefined;
monitoringReward?: import("./utils/types").UInt<32> | null | undefined;
logger?: "error" | "" | "trace" | "debug" | "info" | "warn" | undefined;
caps?: Readonly<{
[x: string]: string | number | boolean | (string | number | boolean | null)[] | null;
}> | null | undefined;
fallbackIceServers?: {
urls: string | string[];
}[] | undefined;
rateToSvt?: {
[x: string]: import("./utils/types").UInt<32>;
} | undefined;
pollingInterval?: number | undefined;
minimumAllowance?: import("./utils/types").UInt<32> | undefined;
autoSettle?: boolean | undefined;
autoUDCWithdraw?: boolean | undefined;
mediationFees?: unknown;
encryptSecret?: boolean | undefined;
}>) => {
readonly type: "raiden/config/update";
readonly payload: Readonly<{
matrixServer?: string | undefined;
subkey?: boolean | undefined;
gasPriceFactor?: number | null | undefined;
matrixServerLookup?: string | undefined;
revealTimeout?: number | undefined;
expiryFactor?: number | undefined;
httpTimeout?: number | undefined;
additionalServices?: readonly (string | import("./utils/types").Address)[] | undefined;
pfsMode?: import(".").PfsMode | undefined;
pfsSafetyMargin?: number | [number, number] | undefined;
pfsMaxPaths?: number | undefined;
pfsMaxFee?: import("./utils/types").UInt<32> | undefined;
pfsIouTimeout?: number | undefined;
confirmationBlocks?: number | undefined;
monitoringReward?: import("./utils/types").UInt<32> | null | undefined;
logger?: "error" | "" | "trace" | "debug" | "info" | "warn" | undefined;
caps?: Readonly<{
[x: string]: string | number | boolean | (string | number | boolean | null)[] | null;
}> | null | undefined;
fallbackIceServers?: {
urls: string | string[];
}[] | undefined;
rateToSvt?: {
[x: string]: import("./utils/types").UInt<32>;
} | undefined;
pollingInterval?: number | undefined;
minimumAllowance?: import("./utils/types").UInt<32> | undefined;
autoSettle?: boolean | undefined;
autoUDCWithdraw?: boolean | undefined;
mediationFees?: unknown;
encryptSecret?: boolean | undefined;
}>;
}) & {
type: "raiden/config/update";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "raiden/config/update";
readonly payload: Readonly<{
matrixServer?: string | undefined;
subkey?: boolean | undefined;
gasPriceFactor?: number | null | undefined;
matrixServerLookup?: string | undefined;
revealTimeout?: number | undefined;
expiryFactor?: number | undefined;
httpTimeout?: number | undefined;
additionalServices?: readonly (string | import("./utils/types").Address)[] | undefined;
pfsMode?: import(".").PfsMode | undefined;
pfsSafetyMargin?: number | [number, number] | undefined;
pfsMaxPaths?: number | undefined;
pfsMaxFee?: import("./utils/types").UInt<32> | undefined;
pfsIouTimeout?: number | undefined;
confirmationBlocks?: number | undefined;
monitoringReward?: import("./utils/types").UInt<32> | null | undefined;
logger?: "error" | "" | "trace" | "debug" | "info" | "warn" | undefined;
caps?: Readonly<{
[x: string]: string | number | boolean | (string | number | boolean | null)[] | null;
}> | null | undefined;
fallbackIceServers?: {
urls: string | string[];
}[] | undefined;
rateToSvt?: {
[x: string]: import("./utils/types").UInt<32>;
} | undefined;
pollingInterval?: number | undefined;
minimumAllowance?: import("./utils/types").UInt<32> | undefined;
autoSettle?: boolean | undefined;
autoUDCWithdraw?: boolean | undefined;
mediationFees?: unknown;
encryptSecret?: boolean | undefined;
}>;
};
error: undefined;
};
export interface raidenConfigUpdate extends ActionType<typeof raidenConfigUpdate> {
}
export declare const raidenConfigCaps: ((payload: {
caps: Readonly<{
[x: string]: string | number | boolean | (string | number | boolean | null)[] | null;
}> | null;
}) => {
readonly type: "raiden/config/caps";
readonly payload: {
caps: Readonly<{
[x: string]: string | number | boolean | (string | number | boolean | null)[] | null;
}> | null;
};
}) & {
type: "raiden/config/caps";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "raiden/config/caps";
readonly payload: {
caps: Readonly<{
[x: string]: string | number | boolean | (string | number | boolean | null)[] | null;
}> | null;
};
};
error: undefined;
};
export interface raidenConfigCaps extends ActionType<typeof raidenConfigCaps> {
}
export declare const raidenStarted: (() => {
readonly type: "raiden/started";
}) & {
type: "raiden/started";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "raiden/started";
};
error: undefined;
};
export interface raidenStarted extends ActionType<typeof raidenStarted> {
}
export declare const raidenSynced: ((payload: {
tookMs: number;
initialBlock: number;
currentBlock: number;
}) => {
readonly type: "raiden/synced";
readonly payload: {
tookMs: number;
initialBlock: number;
currentBlock: number;
};
}) & {
type: "raiden/synced";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "raiden/synced";
readonly payload: {
tookMs: number;
initialBlock: number;
currentBlock: number;
};
};
error: undefined;
};
export interface raidenSynced extends ActionType<typeof raidenSynced> {
}
export declare type RaidenAction = Action;
export declare const RaidenEvents: ((((payload: {
userId: string;
available: boolean;
ts: number;
pubkey: import("./utils/types").HexString<65>;
} & {
caps?: Readonly<{
[x: string]: string | number | boolean | (string | number | boolean | null)[] | null;
}> | undefined;
}, meta: {
address: import("./utils/types").Address;
}) => {
readonly type: "matrix/presence/success";
readonly payload: {
userId: string;
available: boolean;
ts: number;
pubkey: import("./utils/types").HexString<65>;
} & {
caps?: Readonly<{
[x: string]: string | number | boolean | (string | number | boolean | null)[] | null;
}> | undefined;
};
readonly meta: {
address: import("./utils/types").Address;
};
}) & {
type: "matrix/presence/success";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "matrix/presence/success";
readonly payload: {
userId: string;
available: boolean;
ts: number;
pubkey: import("./utils/types").HexString<65>;
} & {
caps?: Readonly<{
[x: string]: string | number | boolean | (string | number | boolean | null)[] | null;
}> | undefined;
};
readonly meta: {
address: import("./utils/types").Address;
};
};
error: undefined;
}) | (((payload: {
reason: Error | ShutdownReason;
}) => {
readonly type: "raiden/shutdown";
readonly payload: {
reason: Error | ShutdownReason;
};
}) & {
type: "raiden/shutdown";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "raiden/shutdown";
readonly payload: {
reason: Error | ShutdownReason;
};
};
error: undefined;
}) | (((payload: {
blockNumber: number;
}) => {
readonly type: "block/new";
readonly payload: {
blockNumber: number;
};
}) & {
type: "block/new";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "block/new";
readonly payload: {
blockNumber: number;
};
};
error: undefined;
}) | (((payload: {
token: import("./utils/types").Address;
tokenNetwork: import("./utils/types").Address;
} & {
fromBlock?: number | undefined;
toBlock?: number | undefined;
}) => {
readonly type: "token/monitored";
readonly payload: {
token: import("./utils/types").Address;
tokenNetwork: import("./utils/types").Address;
} & {
fromBlock?: number | undefined;
toBlock?: number | undefined;
};
}) & {
type: "token/monitored";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "token/monitored";
readonly payload: {
token: import("./utils/types").Address;
tokenNetwork: import("./utils/types").Address;
} & {
fromBlock?: number | undefined;
toBlock?: number | undefined;
};
};
error: undefined;
}) | (((payload: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
id: number;
reward: import("./utils/types").UInt<32>;
nonce: import("./utils/types").UInt<8>;
monitoringService: import("./utils/types").Address;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
}) => {
readonly type: "ms/balanceProof/sent";
readonly payload: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
id: number;
reward: import("./utils/types").UInt<32>;
nonce: import("./utils/types").UInt<8>;
monitoringService: import("./utils/types").Address;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
};
}) & {
type: "ms/balanceProof/sent";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "ms/balanceProof/sent";
readonly payload: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
id: number;
reward: import("./utils/types").UInt<32>;
nonce: import("./utils/types").UInt<8>;
monitoringService: import("./utils/types").Address;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
};
};
error: undefined;
}) | (((payload: {
withdrawableAfter: number;
} & {
txHash?: import("./utils/types").HexString<32> | undefined;
txBlock?: number | undefined;
confirmed?: boolean | undefined;
}, meta: {
amount: import("./utils/types").UInt<32>;
}) => {
readonly type: "udc/withdraw/plan/success";
readonly payload: {
withdrawableAfter: number;
} & {
txHash?: import("./utils/types").HexString<32> | undefined;
txBlock?: number | undefined;
confirmed?: boolean | undefined;
};
readonly meta: {
amount: import("./utils/types").UInt<32>;
};
}) & {
type: "udc/withdraw/plan/success";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "udc/withdraw/plan/success";
readonly payload: {
withdrawableAfter: number;
} & {
txHash?: import("./utils/types").HexString<32> | undefined;
txBlock?: number | undefined;
confirmed?: boolean | undefined;
};
readonly meta: {
amount: import("./utils/types").UInt<32>;
};
};
error: undefined;
}) | (((payload: unknown, meta: {
amount: import("./utils/types").UInt<32>;
}) => {
readonly type: "udc/withdraw/plan/failure";
readonly payload: unknown;
readonly meta: {
amount: import("./utils/types").UInt<32>;
};
readonly error: true;
}) & {
type: "udc/withdraw/plan/failure";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "udc/withdraw/plan/failure";
readonly payload: unknown;
readonly meta: {
amount: import("./utils/types").UInt<32>;
};
readonly error: true;
};
error: true;
}) | (((payload: {
withdrawal: import("./utils/types").UInt<32>;
beneficiary: import("./utils/types").Address;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
}, meta: {
amount: import("./utils/types").UInt<32>;
}) => {
readonly type: "udc/withdraw/success";
readonly payload: {
withdrawal: import("./utils/types").UInt<32>;
beneficiary: import("./utils/types").Address;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
};
readonly meta: {
amount: import("./utils/types").UInt<32>;
};
}) & {
type: "udc/withdraw/success";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "udc/withdraw/success";
readonly payload: {
withdrawal: import("./utils/types").UInt<32>;
beneficiary: import("./utils/types").Address;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
};
readonly meta: {
amount: import("./utils/types").UInt<32>;
};
};
error: undefined;
}) | (((payload: unknown, meta: {
amount: import("./utils/types").UInt<32>;
}) => {
readonly type: "udc/withdraw/failure";
readonly payload: unknown;
readonly meta: {
amount: import("./utils/types").UInt<32>;
};
readonly error: true;
}) & {
type: "udc/withdraw/failure";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "udc/withdraw/failure";
readonly payload: unknown;
readonly meta: {
amount: import("./utils/types").UInt<32>;
};
readonly error: true;
};
error: true;
}) | (((payload: {
id: number;
token: import("./utils/types").Address;
isFirstParticipant: boolean;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
}, meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
}) => {
readonly type: "channel/open/success";
readonly payload: {
id: number;
token: import("./utils/types").Address;
isFirstParticipant: boolean;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
};
readonly meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
};
}) & {
type: "channel/open/success";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "channel/open/success";
readonly payload: {
id: number;
token: import("./utils/types").Address;
isFirstParticipant: boolean;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
};
readonly meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
};
};
error: undefined;
}) | (((payload: unknown, meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
}) => {
readonly type: "channel/open/failure";
readonly payload: unknown;
readonly meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
};
readonly error: true;
}) & {
type: "channel/open/failure";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "channel/open/failure";
readonly payload: unknown;
readonly meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
};
readonly error: true;
};
error: true;
}) | (((payload: {
id: number;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
} & {
locks?: readonly ({
amount: import("./utils/types").UInt<32>;
expiration: import("./utils/types").UInt<32>;
secrethash: import("./utils/types").HexString<32>;
} & {
registered?: true | undefined;
})[] | undefined;
}, meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
}) => {
readonly type: "channel/settle/success";
readonly payload: {
id: number;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
} & {
locks?: readonly ({
amount: import("./utils/types").UInt<32>;
expiration: import("./utils/types").UInt<32>;
secrethash: import("./utils/types").HexString<32>;
} & {
registered?: true | undefined;
})[] | undefined;
};
readonly meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
};
}) & {
type: "channel/settle/success";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "channel/settle/success";
readonly payload: {
id: number;
txHash: import("./utils/types").HexString<32>;
txBlock: number;
confirmed: boolean | undefined;
} & {
locks?: readonly ({
amount: import("./utils/types").UInt<32>;
expiration: import("./utils/types").UInt<32>;
secrethash: import("./utils/types").HexString<32>;
} & {
registered?: true | undefined;
})[] | undefined;
};
readonly meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
};
};
error: undefined;
}) | (((payload: unknown, meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
}) => {
readonly type: "channel/settle/failure";
readonly payload: unknown;
readonly meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
};
readonly error: true;
}) & {
type: "channel/settle/failure";
codec: t.Mixed;
is: (a: unknown) => a is {
readonly type: "channel/settle/failure";
readonly payload: unknown;
readonly meta: {
tokenNetwork: import("./utils/types").Address;
partner: import("./utils/types").Address;
};
readonly error: true;
};
error: true;
}))[];
export declare type RaidenEvent = ActionType<typeof RaidenEvents>;
/**
* Pure codec which decodes/validates actions which can be confirmed on-chain
*
* Note that this isn't a complete ActionCreator, but it helps identify and narrow actions which
* matches this schema. Also important is that this codec isn't `t.exact`, and therefore it will
* validate objects with additional properties (like meta and payload properties), as long as it
* matches the required schema below.
* Use [[ConfirmableAction]] to ensure it both complies with and decodes/validates also to the
* actual corresponding action registered in [[RaidenActionsMap]]
*/
declare const _ConfirmableAction: t.ReadonlyC<t.TypeC<{
type: t.StringC;
payload: t.TypeC<{
txHash: import("./utils/types").HexStringC<32>;
txBlock: t.NumberC;
confirmed: t.UnionC<[t.UndefinedC, t.BooleanC]>;
}>;
}>>;
/** The type of a confirmable action object. */
export declare type ConfirmableAction = t.TypeOf<typeof _ConfirmableAction>;
/**
* Special custom codec with validates a type equivalent to:
* ConfirmableAction & ValueOf<RaidenActionsMap>
* i.e. a ConfirmableAction intersected with an union of any possible registered RaidenAction.
* This is needed in order to properly handle members of actions which require special encoding/
* decoding logic, like BigNumbers, otherwise when decoding actions (e.g. from
* RaidenState['pendingTxs']), the members would be kept but not decoded properly.
*/
export declare const ConfirmableAction: 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>;
export {};