1 | import { Address, BigNumber, Bytes32, DecString, Network, PublicIdentifier } from "./basic";
|
2 | import {
|
3 | ConditionalTransactionCommitmentJSON,
|
4 | MinimalTransaction,
|
5 | SetStateCommitmentJSON,
|
6 | } from "./commitments";
|
7 | import { MethodResults } from "./methods";
|
8 | import { PublicResults } from "./public";
|
9 | import { StateChannelJSON } from "./state";
|
10 | import { LinkedTransferStatus, HashLockTransferStatus, SignedTransferStatus } from "./transfers";
|
11 | import { Collateralizations, RebalanceProfile } from "./misc";
|
12 | import { ContractAddresses } from "./contracts";
|
13 |
|
14 | type GetRebalanceProfileResponse = RebalanceProfile;
|
15 |
|
16 | export type ContractAddressBook = {
|
17 | [chainId: string]: ContractAddresses;
|
18 | };
|
19 |
|
20 | type GetHashLockTransferResponse =
|
21 | | {
|
22 | senderIdentifier: PublicIdentifier;
|
23 | receiverIdentifier?: PublicIdentifier;
|
24 | assetId: Address;
|
25 | amount: DecString;
|
26 | lockHash: Bytes32;
|
27 | status: HashLockTransferStatus;
|
28 | meta?: any;
|
29 | preImage: Bytes32;
|
30 | expiry: BigNumber;
|
31 | }
|
32 | | undefined;
|
33 |
|
34 | type GetSignedTransferResponse = {
|
35 | senderIdentifier: PublicIdentifier;
|
36 | receiverIdentifier?: PublicIdentifier;
|
37 | assetId: Address;
|
38 | amount: DecString;
|
39 | paymentId: Bytes32;
|
40 | status: SignedTransferStatus;
|
41 | meta?: any;
|
42 | };
|
43 |
|
44 | type GetTransferResponse = {
|
45 | paymentId: Bytes32;
|
46 | amount: BigNumber;
|
47 | assetId: Address;
|
48 | senderIdentifier: PublicIdentifier;
|
49 | receiverIdentifier: PublicIdentifier;
|
50 | meta: any;
|
51 | };
|
52 |
|
53 | type GetConfigResponse = {
|
54 | ethNetwork: Network;
|
55 | contractAddresses: ContractAddressBook;
|
56 | nodeIdentifier: PublicIdentifier;
|
57 | messagingUrl: string[];
|
58 | signerAddress: Address;
|
59 | supportedTokenAddresses: { [chainId: number]: Address[] };
|
60 | };
|
61 |
|
62 | type GetChannelResponse = {
|
63 | nodeIdentifier: PublicIdentifier;
|
64 | userIdentifier: PublicIdentifier;
|
65 | multisigAddress: Address;
|
66 | available: boolean;
|
67 | activeCollateralizations: Collateralizations;
|
68 | };
|
69 |
|
70 |
|
71 |
|
72 | type CreateChannelResponse = {
|
73 | transactionHash: Bytes32;
|
74 | };
|
75 |
|
76 | type RequestCollateralResponse = MethodResults.Deposit | undefined;
|
77 |
|
78 |
|
79 | type ChannelRestoreResponse = {
|
80 | channel: StateChannelJSON;
|
81 | setupCommitment: MinimalTransaction | undefined;
|
82 | setStateCommitments: [Bytes32, SetStateCommitmentJSON][];
|
83 | conditionalCommitments: [Bytes32, ConditionalTransactionCommitmentJSON][];
|
84 | };
|
85 |
|
86 | type FetchedLinkedTransfer = {
|
87 | paymentId: Bytes32;
|
88 | createdAt: Date;
|
89 | amount: BigNumber;
|
90 | assetId: Address;
|
91 | senderIdentifier: PublicIdentifier;
|
92 | receiverIdentifier?: PublicIdentifier;
|
93 | status: LinkedTransferStatus;
|
94 | meta: any;
|
95 | encryptedPreImage?: string;
|
96 | };
|
97 |
|
98 | type GetLinkedTransferResponse = FetchedLinkedTransfer;
|
99 | type GetPendingAsyncTransfersResponse = FetchedLinkedTransfer[];
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | export namespace NodeResponses {
|
105 | export type GetConfig = GetConfigResponse;
|
106 | export type GetTransfer = GetTransferResponse;
|
107 | export type GetTransferHistory = GetTransferResponse[];
|
108 | export type GetLinkedTransfer = GetLinkedTransferResponse;
|
109 | export type GetPendingAsyncTransfers = GetPendingAsyncTransfersResponse;
|
110 | export type InstallConditionalTransferReceiverApp = PublicResults.ResolveCondition;
|
111 | export type ResolveLinkedTransfer = PublicResults.ResolveLinkedTransfer;
|
112 | export type ResolveSignedTransfer = PublicResults.ResolveSignedTransfer;
|
113 | export type GetRebalanceProfile = GetRebalanceProfileResponse;
|
114 | export type GetHashLockTransfer = GetHashLockTransferResponse;
|
115 | export type GetSignedTransfer = GetSignedTransferResponse;
|
116 | export type GetChannel = GetChannelResponse;
|
117 | export type CreateChannel = CreateChannelResponse;
|
118 | export type RequestCollateral = RequestCollateralResponse;
|
119 | export type ChannelRestore = ChannelRestoreResponse;
|
120 | }
|