UNPKG

1.78 kBPlain TextView Raw
1import { Address, BigNumberish, BigNumberJson, Bytes32, HexString } from "./basic";
2import { AppIdentity, MultisigOperation, ContractAddresses } from "./contracts";
3import { enumify } from "./utils";
4
5// This is used instead of the ethers `Transaction` because that type
6// requires the nonce and chain ID to be specified, when sometimes those
7// arguments are not known at the time of creating a transaction.
8export type MinimalTransaction = {
9 to: Address;
10 value: BigNumberish;
11 data: HexString;
12};
13
14// Multisig
15export interface EthereumCommitment {
16 signatures: string[];
17 encode(): HexString;
18 hashToSign(): Bytes32;
19 getSignedTransaction(): Promise<MinimalTransaction>;
20}
21
22export const CommitmentTypes = enumify({
23 Conditional: "conditional",
24 SetState: "setState",
25 Setup: "setup",
26 Withdraw: "withdraw",
27});
28export type CommitmentTypes = typeof CommitmentTypes[keyof typeof CommitmentTypes];
29
30export type MultisigTransaction = MinimalTransaction & {
31 operation: MultisigOperation;
32};
33
34export type SetStateCommitmentJSON = {
35 readonly appIdentity: AppIdentity;
36 readonly appIdentityHash: HexString;
37 readonly appStateHash: HexString;
38 readonly challengeRegistryAddress: Address;
39 readonly signatures: string[];
40 readonly stateTimeout: BigNumberJson;
41 readonly versionNumber: BigNumberJson;
42 readonly transactionData: HexString;
43};
44
45export type ConditionalTransactionCommitmentJSON = {
46 readonly appIdentityHash: HexString;
47 readonly contractAddresses: ContractAddresses;
48 readonly freeBalanceAppIdentityHash: HexString;
49 readonly interpreterAddr: Address;
50 readonly interpreterParams: HexString; // ?
51 readonly multisigAddress: Address;
52 readonly multisigOwners: Address[];
53 readonly signatures: string[];
54 readonly transactionData: HexString;
55};