raiden-ts
Version:
Raiden Light Client Typescript/Javascript SDK
78 lines (77 loc) • 3.05 kB
TypeScript
import type { Observable } from 'rxjs';
import type { RaidenAction } from '../../actions';
import type { RaidenState } from '../../state';
import type { RaidenEpicDeps } from '../../types';
import type { Address } from '../../utils/types';
import { Direction } from '../state';
/**
* When receiving a transfer not targeting us, create an outgoing transfer to target
* Mediated transfers are handled the same way as unrelated received & sent pairs. The difference
* is that we don't request the secret (as initiator would only reveal to target), and instead,
* wait for SecretReveal to cascade back from outbound partner, then we unlock it and reveal back
* to inbound partner, to get its Unlock.
* If it doesn't succeed, if we didn't get reveal, we'll accept LockExpired, if we did and know
* the secret but partner didn't unlock, we register on-chain as usual.
*
* @param action$ - Observable of incoming transferSigned transfers
* @param state$ - Observable of RaidenStates
* @param deps - Raiden epic deps
* @param deps.address - Our address
* @param deps.config$ - Latest observable
* @param deps.log - Logger instance
* @param deps.mediationFeeCalculator - Calculator for mediating transfer's fee
* @returns Observable of outbound transfer.request actions
*/
export declare function transferMediateEpic(action$: Observable<RaidenAction>, state$: Observable<RaidenState>, deps: RaidenEpicDeps): Observable<{
readonly type: "transfer/request";
readonly payload: {
tokenNetwork: Address;
target: Address;
value: import("../../utils/types").UInt<32>;
paymentId: import("../../utils/types").UInt<8>;
} & (({
resolved: false;
} & {
paths?: readonly Readonly<({
route: readonly Address[];
} | {
path: readonly Address[];
}) & ({
fee: import("../../utils/types").Int<32>;
} | {
estimated_fee: import("../../utils/types").Int<32>;
}) & {
address_metadata?: Readonly<{
[x: string]: import("../../services/types").AddressMetadata;
}> | undefined;
}>[] | undefined;
pfs?: Readonly<{
address: Address;
url: string;
matrixServer: string;
rtt: number;
price: import("../../utils/types").UInt<32>;
token: Address;
validTill: number;
}> | null | undefined;
encryptSecret?: boolean | undefined;
}) | ({
resolved: true;
metadata: unknown;
fee: import("../../utils/types").Int<32>;
partner: Address;
} & {
userId?: string | undefined;
})) & {
secret?: import("../../utils/types").HexString<32> | undefined;
initiator?: Address | undefined;
} & ({
expiration?: number | undefined;
} | {
lockTimeout?: number | undefined;
});
readonly meta: {
secrethash: import("../../utils/types").HexString<32>;
direction: Direction;
};
}>;