@bitgo/public-types 2.20.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/src/index.d.ts +0 -1
  2. package/dist/src/schema/index.d.ts +0 -1
  3. package/dist/src/schema/keyGen/index.d.ts +0 -1
  4. package/dist/src/schema/keyGen/keyGenState.d.ts +0 -1
  5. package/dist/src/schema/keyGen/keyGenType.d.ts +0 -1
  6. package/dist/src/schema/mpcv2/common/index.d.ts +0 -1
  7. package/dist/src/schema/mpcv2/common/mpcv2BroadcastMessage.d.ts +0 -1
  8. package/dist/src/schema/mpcv2/common/mpcv2P2PMessage.d.ts +0 -1
  9. package/dist/src/schema/mpcv2/common/mpcv2PartyFromStringOrNumber.d.ts +0 -1
  10. package/dist/src/schema/mpcv2/index.d.ts +0 -1
  11. package/dist/src/schema/mpcv2/keyGen/index.d.ts +0 -1
  12. package/dist/src/schema/mpcv2/keyGen/keygenRound.d.ts +0 -1
  13. package/dist/src/schema/mpcv2/keyGen/mpcv2KeyGenState.d.ts +0 -1
  14. package/dist/src/schema/mpcv2/signing/index.d.ts +0 -1
  15. package/dist/src/schema/mpcv2/signing/mpcv2SigningState.d.ts +0 -1
  16. package/dist/src/schema/mpcv2/signing/signingRound.d.ts +0 -1
  17. package/dist/src/schema/transactionRequest/index.d.ts +0 -1
  18. package/dist/src/schema/transactionRequest/transactionRequestState.d.ts +0 -1
  19. package/dist/src/schema/transactionRequest/transactionState.d.ts +0 -1
  20. package/dist/src/schema/transactions/coinSpecific.d.ts +0 -1
  21. package/dist/src/schema/transactions/index.d.ts +0 -1
  22. package/dist/src/schema/transactions/sendTransactions.d.ts +0 -1
  23. package/dist/src/schema/wallet/index.d.ts +0 -1
  24. package/dist/src/schema/wallet/wallet.d.ts +0 -1
  25. package/dist/src/schema/webhook/addWalletWebhookRequest.d.ts +0 -1
  26. package/dist/src/schema/webhook/enterpriseWebhooks.d.ts +0 -1
  27. package/dist/src/schema/webhook/index.d.ts +0 -1
  28. package/dist/src/schema/webhook/webhook.d.ts +0 -1
  29. package/dist/src/schema/webhook/webhookNotification.d.ts +0 -1
  30. package/dist/src/schema/webhook/webhookScope.d.ts +0 -1
  31. package/dist/src/schema/webhook/webhookState.d.ts +0 -1
  32. package/dist/src/schema/webhook/webhookType.d.ts +0 -1
  33. package/dist/src/utils/arrayFromSingle.d.ts +0 -1
  34. package/dist/src/utils/index.d.ts +0 -1
  35. package/dist/src/utils/minMaxArray.d.ts +0 -1
  36. package/dist/src/utils/optional.d.ts +0 -1
  37. package/dist/src/utils/primitives.d.ts +0 -1
  38. package/package.json +4 -3
  39. package/src/index.ts +2 -0
  40. package/src/schema/index.ts +6 -0
  41. package/src/schema/keyGen/index.ts +2 -0
  42. package/src/schema/keyGen/keyGenState.ts +8 -0
  43. package/src/schema/keyGen/keyGenType.ts +7 -0
  44. package/src/schema/mpcv2/common/index.ts +3 -0
  45. package/src/schema/mpcv2/common/mpcv2BroadcastMessage.ts +24 -0
  46. package/src/schema/mpcv2/common/mpcv2P2PMessage.ts +14 -0
  47. package/src/schema/mpcv2/common/mpcv2PartyFromStringOrNumber.ts +13 -0
  48. package/src/schema/mpcv2/index.ts +3 -0
  49. package/src/schema/mpcv2/keyGen/index.ts +2 -0
  50. package/src/schema/mpcv2/keyGen/keygenRound.ts +70 -0
  51. package/src/schema/mpcv2/keyGen/mpcv2KeyGenState.ts +12 -0
  52. package/src/schema/mpcv2/signing/index.ts +2 -0
  53. package/src/schema/mpcv2/signing/mpcv2SigningState.ts +11 -0
  54. package/src/schema/mpcv2/signing/signingRound.ts +113 -0
  55. package/src/schema/transactionRequest/index.ts +2 -0
  56. package/src/schema/transactionRequest/transactionRequestState.ts +21 -0
  57. package/src/schema/transactionRequest/transactionState.ts +22 -0
  58. package/src/schema/transactions/coinSpecific.ts +59 -0
  59. package/src/schema/transactions/index.ts +1 -0
  60. package/src/schema/transactions/sendTransactions.ts +245 -0
  61. package/src/schema/wallet/index.ts +1 -0
  62. package/src/schema/wallet/wallet.ts +8 -0
  63. package/src/schema/webhook/addWalletWebhookRequest.ts +24 -0
  64. package/src/schema/webhook/enterpriseWebhooks.ts +44 -0
  65. package/src/schema/webhook/index.ts +7 -0
  66. package/src/schema/webhook/webhook.ts +35 -0
  67. package/src/schema/webhook/webhookNotification.ts +33 -0
  68. package/src/schema/webhook/webhookScope.ts +10 -0
  69. package/src/schema/webhook/webhookState.ts +9 -0
  70. package/src/schema/webhook/webhookType.ts +56 -0
  71. package/src/utils/arrayFromSingle.ts +19 -0
  72. package/src/utils/index.ts +4 -0
  73. package/src/utils/minMaxArray.ts +27 -0
  74. package/src/utils/optional.ts +5 -0
  75. package/src/utils/primitives.ts +11 -0
  76. package/dist/src/index.d.ts.map +0 -1
  77. package/dist/src/schema/index.d.ts.map +0 -1
  78. package/dist/src/schema/keyGen/index.d.ts.map +0 -1
  79. package/dist/src/schema/keyGen/keyGenState.d.ts.map +0 -1
  80. package/dist/src/schema/keyGen/keyGenType.d.ts.map +0 -1
  81. package/dist/src/schema/mpcv2/common/index.d.ts.map +0 -1
  82. package/dist/src/schema/mpcv2/common/mpcv2BroadcastMessage.d.ts.map +0 -1
  83. package/dist/src/schema/mpcv2/common/mpcv2P2PMessage.d.ts.map +0 -1
  84. package/dist/src/schema/mpcv2/common/mpcv2PartyFromStringOrNumber.d.ts.map +0 -1
  85. package/dist/src/schema/mpcv2/index.d.ts.map +0 -1
  86. package/dist/src/schema/mpcv2/keyGen/index.d.ts.map +0 -1
  87. package/dist/src/schema/mpcv2/keyGen/keygenRound.d.ts.map +0 -1
  88. package/dist/src/schema/mpcv2/keyGen/mpcv2KeyGenState.d.ts.map +0 -1
  89. package/dist/src/schema/mpcv2/signing/index.d.ts.map +0 -1
  90. package/dist/src/schema/mpcv2/signing/mpcv2SigningState.d.ts.map +0 -1
  91. package/dist/src/schema/mpcv2/signing/signingRound.d.ts.map +0 -1
  92. package/dist/src/schema/transactionRequest/index.d.ts.map +0 -1
  93. package/dist/src/schema/transactionRequest/transactionRequestState.d.ts.map +0 -1
  94. package/dist/src/schema/transactionRequest/transactionState.d.ts.map +0 -1
  95. package/dist/src/schema/transactions/coinSpecific.d.ts.map +0 -1
  96. package/dist/src/schema/transactions/index.d.ts.map +0 -1
  97. package/dist/src/schema/transactions/sendTransactions.d.ts.map +0 -1
  98. package/dist/src/schema/wallet/index.d.ts.map +0 -1
  99. package/dist/src/schema/wallet/wallet.d.ts.map +0 -1
  100. package/dist/src/schema/webhook/addWalletWebhookRequest.d.ts.map +0 -1
  101. package/dist/src/schema/webhook/enterpriseWebhooks.d.ts.map +0 -1
  102. package/dist/src/schema/webhook/index.d.ts.map +0 -1
  103. package/dist/src/schema/webhook/webhook.d.ts.map +0 -1
  104. package/dist/src/schema/webhook/webhookNotification.d.ts.map +0 -1
  105. package/dist/src/schema/webhook/webhookScope.d.ts.map +0 -1
  106. package/dist/src/schema/webhook/webhookState.d.ts.map +0 -1
  107. package/dist/src/schema/webhook/webhookType.d.ts.map +0 -1
  108. package/dist/src/utils/arrayFromSingle.d.ts.map +0 -1
  109. package/dist/src/utils/index.d.ts.map +0 -1
  110. package/dist/src/utils/minMaxArray.d.ts.map +0 -1
  111. package/dist/src/utils/optional.d.ts.map +0 -1
  112. package/dist/src/utils/primitives.d.ts.map +0 -1
@@ -1,3 +1,2 @@
1
1
  export * from "./schema";
2
2
  export * from "./utils";
3
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@ export * from "./webhook";
4
4
  export * from "./mpcv2";
5
5
  export * from "./keyGen";
6
6
  export * from "./wallet";
7
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,2 @@
1
1
  export * from "./keyGenState";
2
2
  export * from "./keyGenType";
3
- //# sourceMappingURL=index.d.ts.map
@@ -11,4 +11,3 @@ export declare const KeyGenState: t.KeyofC<{
11
11
  "MPCv2-R3": (typeof MPCv2KeyGenStateEnum)["MPCv2-R3"];
12
12
  }>;
13
13
  export type KeyGenState = t.TypeOf<typeof KeyGenState>;
14
- //# sourceMappingURL=keyGenState.d.ts.map
@@ -4,4 +4,3 @@ export declare enum KeyGenTypeEnum {
4
4
  }
5
5
  export declare const KeyGenType: t.KeyofC<typeof KeyGenTypeEnum>;
6
6
  export type KeyGenType = t.TypeOf<typeof KeyGenType>;
7
- //# sourceMappingURL=keyGenType.d.ts.map
@@ -1,4 +1,3 @@
1
1
  export * from "./mpcv2BroadcastMessage";
2
2
  export * from "./mpcv2P2PMessage";
3
3
  export * from "./mpcv2PartyFromStringOrNumber";
4
- //# sourceMappingURL=index.d.ts.map
@@ -13,4 +13,3 @@ export declare const MPCv2BroadcastMessageWithSignatureR: t.IntersectionC<[t.Typ
13
13
  signatureR: t.StringC;
14
14
  }>]>;
15
15
  export type MPCv2BroadcastMessageWithSignatureR = t.TypeOf<typeof MPCv2BroadcastMessageWithSignatureR>;
16
- //# sourceMappingURL=mpcv2BroadcastMessage.d.ts.map
@@ -6,4 +6,3 @@ export declare const MPCv2P2PMessage: t.TypeC<{
6
6
  signature: t.StringC;
7
7
  }>;
8
8
  export type MPCv2P2PMessage = t.TypeOf<typeof MPCv2P2PMessage>;
9
- //# sourceMappingURL=mpcv2P2PMessage.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import * as t from "io-ts";
2
2
  export declare const MPCv2PartyFromStringOrNumber: t.UnionC<[t.UnionC<[t.LiteralC<0>, t.LiteralC<1>, t.LiteralC<2>]>, t.Type<0 | 2 | 1, string, unknown>]>;
3
3
  export type MPCv2PartyFromStringOrNumber = t.TypeOf<typeof MPCv2PartyFromStringOrNumber>;
4
- //# sourceMappingURL=mpcv2PartyFromStringOrNumber.d.ts.map
@@ -1,4 +1,3 @@
1
1
  export * from "./common";
2
2
  export * from "./keyGen";
3
3
  export * from "./signing";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,2 @@
1
1
  export * from "./keygenRound";
2
2
  export * from "./mpcv2KeyGenState";
3
- //# sourceMappingURL=index.d.ts.map
@@ -106,4 +106,3 @@ export declare const MPCv2KeyGenRound3Response: t.TypeC<{
106
106
  }>;
107
107
  }>;
108
108
  export type MPCv2KeyGenRound3Response = t.TypeOf<typeof MPCv2KeyGenRound3Response>;
109
- //# sourceMappingURL=keygenRound.d.ts.map
@@ -6,4 +6,3 @@ export declare enum MPCv2KeyGenStateEnum {
6
6
  }
7
7
  export declare const MPCv2KeyGenState: t.KeyofC<typeof MPCv2KeyGenStateEnum>;
8
8
  export type MPCv2KeyGenState = t.TypeOf<typeof MPCv2KeyGenState>;
9
- //# sourceMappingURL=mpcv2KeyGenState.d.ts.map
@@ -1,3 +1,2 @@
1
1
  export * from "./mpcv2SigningState";
2
2
  export * from "./signingRound";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import * as t from "io-ts";
2
2
  export declare const MPCv2SigningState: t.UnionC<[t.LiteralC<"round1Input">, t.LiteralC<"round1Output">, t.LiteralC<"round2Input">, t.LiteralC<"round2Output">, t.LiteralC<"round3Input">]>;
3
3
  export type MPCv2SigningState = t.TypeOf<typeof MPCv2SigningState>;
4
- //# sourceMappingURL=mpcv2SigningState.d.ts.map
@@ -83,4 +83,3 @@ export declare const MPCv2SignatureShareRound3Input: t.IntersectionC<[t.TypeC<{
83
83
  }>;
84
84
  }>]>;
85
85
  export type MPCv2SignatureShareRound3Input = t.TypeOf<typeof MPCv2SignatureShareRound3Input>;
86
- //# sourceMappingURL=signingRound.d.ts.map
@@ -1,3 +1,2 @@
1
1
  export * from "./transactionState";
2
2
  export * from "./transactionRequestState";
3
- //# sourceMappingURL=index.d.ts.map
@@ -15,4 +15,3 @@ export declare const TransactionRequestState: t.KeyofC<{
15
15
  failed: number;
16
16
  }>;
17
17
  export type TransactionRequestState = t.TypeOf<typeof TransactionRequestState>;
18
- //# sourceMappingURL=transactionRequestState.d.ts.map
@@ -16,4 +16,3 @@ export declare const TransactionState: t.KeyofC<{
16
16
  rejected: number;
17
17
  }>;
18
18
  export type TransactionState = t.TypeOf<typeof TransactionState>;
19
- //# sourceMappingURL=transactionState.d.ts.map
@@ -37,4 +37,3 @@ export declare const CoinSpecificBuildParams: {
37
37
  tokenName: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
38
38
  };
39
39
  };
40
- //# sourceMappingURL=coinSpecific.d.ts.map
@@ -1,2 +1 @@
1
1
  export * from "./sendTransactions";
2
- //# sourceMappingURL=index.d.ts.map
@@ -533,4 +533,3 @@ export declare const TxSendResponse: t.PartialC<{
533
533
  }>;
534
534
  export type TxSendResponse = t.TypeOf<typeof TxSendResponse>;
535
535
  export {};
536
- //# sourceMappingURL=sendTransactions.d.ts.map
@@ -1,2 +1 @@
1
1
  export * from "./wallet";
2
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@ export declare const WalletUser: t.TypeC<{
4
4
  permissions: t.ArrayC<t.StringC>;
5
5
  }>;
6
6
  export type WalletUser = t.TypeOf<typeof WalletUser>;
7
- //# sourceMappingURL=wallet.d.ts.map
@@ -20,4 +20,3 @@ export declare const AddWalletWebhookRequestBodyC: t.TypeC<{
20
20
  txRequestTransactionStates: t.UnionC<[t.Type<("initialized" | "pendingSignature" | "eddsaPendingCommitment" | "eddsaPendingRShare" | "eddsaPendingGShare" | "ecdsaMPCv2Round1" | "ecdsaMPCv2Round2" | "ecdsaMPCv2Round3" | "readyToCombineShares" | "signed" | "held" | "delivered" | "invalidSignature" | "rejected")[], ("initialized" | "pendingSignature" | "eddsaPendingCommitment" | "eddsaPendingRShare" | "eddsaPendingGShare" | "ecdsaMPCv2Round1" | "ecdsaMPCv2Round2" | "ecdsaMPCv2Round3" | "readyToCombineShares" | "signed" | "held" | "delivered" | "invalidSignature" | "rejected")[], unknown>, t.UndefinedC]>;
21
21
  }>;
22
22
  export type AddWalletWebhookRequestBody = t.TypeOf<typeof AddWalletWebhookRequestBodyC>;
23
- //# sourceMappingURL=addWalletWebhookRequest.d.ts.map
@@ -79,4 +79,3 @@ export declare const ListEnterpriseWebhooksResponse: t.IntersectionC<[t.TypeC<{
79
79
  nextBatchPrevId: t.UnionC<[t.Type<string | undefined, string | undefined, unknown>, t.UndefinedC]>;
80
80
  }>]>;
81
81
  export type ListEnterpriseWebhooksResponse = t.TypeOf<typeof ListEnterpriseWebhooksResponse>;
82
- //# sourceMappingURL=enterpriseWebhooks.d.ts.map
@@ -5,4 +5,3 @@ export * from "./webhookNotification";
5
5
  export * from "./webhookScope";
6
6
  export * from "./webhookState";
7
7
  export * from "./webhookType";
8
- //# sourceMappingURL=index.d.ts.map
@@ -52,4 +52,3 @@ export declare const Webhook: t.IntersectionC<[t.TypeC<{
52
52
  rejected: number;
53
53
  }>>;
54
54
  }>]>;
55
- //# sourceMappingURL=webhook.d.ts.map
@@ -26,4 +26,3 @@ export declare const WebhookNotification: t.IntersectionC<[t.TypeC<{
26
26
  error: t.StringC;
27
27
  }>;
28
28
  }>]>;
29
- //# sourceMappingURL=webhookNotification.d.ts.map
@@ -6,4 +6,3 @@ export declare enum WebhookScopeEnum {
6
6
  }
7
7
  export declare const WebhookScope: t.KeyofC<typeof WebhookScopeEnum>;
8
8
  export type WebhookScope = t.TypeOf<typeof WebhookScope>;
9
- //# sourceMappingURL=webhookScope.d.ts.map
@@ -5,4 +5,3 @@ export declare enum WebhookStateEnum {
5
5
  }
6
6
  export declare const WebhookState: t.KeyofC<typeof WebhookStateEnum>;
7
7
  export type WebhookState = t.TypeOf<typeof WebhookState>;
8
- //# sourceMappingURL=webhookState.d.ts.map
@@ -38,4 +38,3 @@ export declare enum EnterpriseWebhookTypeEnum {
38
38
  }
39
39
  export declare const EnterpriseWebhookType: t.KeyofC<typeof EnterpriseWebhookTypeEnum>;
40
40
  export type EnterpriseWebhookType = t.TypeOf<typeof EnterpriseWebhookType>;
41
- //# sourceMappingURL=webhookType.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import * as t from "io-ts";
2
2
  export declare function arrayFromSingle<C extends t.Mixed>(codec: C, name?: string): t.Type<t.TypeOf<C>[], t.TypeOf<C>[], unknown>;
3
- //# sourceMappingURL=arrayFromSingle.d.ts.map
@@ -2,4 +2,3 @@ export * from "./optional";
2
2
  export * from "./primitives";
3
3
  export * from "./arrayFromSingle";
4
4
  export * from "./minMaxArray";
5
- //# sourceMappingURL=index.d.ts.map
@@ -6,4 +6,3 @@ export declare const minMaxArray: <C extends t.Mixed>(codec: C, { min, max, }?:
6
6
  min?: number | undefined;
7
7
  max?: number | undefined;
8
8
  }) => t.BrandC<t.ArrayC<C>, IMinMaxArray<C>>;
9
- //# sourceMappingURL=minMaxArray.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import * as t from "io-ts";
2
2
  export declare function Optional<T>(type: t.Type<T>): t.UnionC<[t.Type<T, T, unknown>, t.UndefinedC]>;
3
- //# sourceMappingURL=optional.d.ts.map
@@ -5,4 +5,3 @@ export declare const optionalBoolean: t.UnionC<[t.Type<boolean, boolean, unknown
5
5
  export declare const optionalNumber: t.UnionC<[t.Type<number, number, unknown>, t.UndefinedC]>;
6
6
  export declare const optionalStringOrNumber: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
7
7
  export declare const optionalUnknown: t.UnionC<[t.Type<{}, {}, unknown>, t.UndefinedC]>;
8
- //# sourceMappingURL=primitives.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitgo/public-types",
3
- "version": "2.20.0",
3
+ "version": "2.21.0",
4
4
  "description": "Collection of types exposed externally as part of the BitGo public API",
5
5
  "license": "UNLICENSED",
6
6
  "author": "",
@@ -9,9 +9,10 @@
9
9
  "url": "git+https://github.com/BitGo/public-types.git"
10
10
  },
11
11
  "main": "dist/src/index.js",
12
- "types": "dist/src/index.d.ts",
12
+ "types": "src/index.ts",
13
13
  "files": [
14
- "dist/src/"
14
+ "dist/src/",
15
+ "src"
15
16
  ],
16
17
  "scripts": {
17
18
  "build": "tsc --build --incremental --verbose .",
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./schema";
2
+ export * from "./utils";
@@ -0,0 +1,6 @@
1
+ export * from "./transactions";
2
+ export * from "./transactionRequest";
3
+ export * from "./webhook";
4
+ export * from "./mpcv2";
5
+ export * from "./keyGen";
6
+ export * from "./wallet";
@@ -0,0 +1,2 @@
1
+ export * from "./keyGenState";
2
+ export * from "./keyGenType";
@@ -0,0 +1,8 @@
1
+ import * as t from "io-ts";
2
+ import { MPCv2KeyGenStateEnum } from "../mpcv2/keyGen/mpcv2KeyGenState";
3
+
4
+ export const KeyGenStateEnum = {
5
+ ...MPCv2KeyGenStateEnum,
6
+ };
7
+ export const KeyGenState = t.keyof(KeyGenStateEnum);
8
+ export type KeyGenState = t.TypeOf<typeof KeyGenState>;
@@ -0,0 +1,7 @@
1
+ import * as t from "io-ts";
2
+
3
+ export enum KeyGenTypeEnum {
4
+ MPCv2 = "MPCv2",
5
+ }
6
+ export const KeyGenType = t.keyof(KeyGenTypeEnum);
7
+ export type KeyGenType = t.TypeOf<typeof KeyGenType>;
@@ -0,0 +1,3 @@
1
+ export * from "./mpcv2BroadcastMessage";
2
+ export * from "./mpcv2P2PMessage";
3
+ export * from "./mpcv2PartyFromStringOrNumber";
@@ -0,0 +1,24 @@
1
+ import * as t from "io-ts";
2
+ import { MPCv2PartyFromStringOrNumber } from "./mpcv2PartyFromStringOrNumber";
3
+
4
+ export const MPCv2BroadcastMessage = t.type(
5
+ {
6
+ from: MPCv2PartyFromStringOrNumber,
7
+ message: t.string,
8
+ signature: t.string,
9
+ },
10
+ "MPCv2BroadcastMessage",
11
+ );
12
+
13
+ export type MPCv2BroadcastMessage = t.TypeOf<typeof MPCv2BroadcastMessage>;
14
+
15
+ export const MPCv2BroadcastMessageWithSignatureR = t.intersection([
16
+ MPCv2BroadcastMessage,
17
+ t.type({
18
+ signatureR: t.string,
19
+ }),
20
+ ]);
21
+
22
+ export type MPCv2BroadcastMessageWithSignatureR = t.TypeOf<
23
+ typeof MPCv2BroadcastMessageWithSignatureR
24
+ >;
@@ -0,0 +1,14 @@
1
+ import * as t from "io-ts";
2
+ import { MPCv2PartyFromStringOrNumber } from "./mpcv2PartyFromStringOrNumber";
3
+
4
+ export const MPCv2P2PMessage = t.type(
5
+ {
6
+ from: MPCv2PartyFromStringOrNumber,
7
+ to: MPCv2PartyFromStringOrNumber,
8
+ encryptedMessage: t.string,
9
+ signature: t.string,
10
+ },
11
+ "P2PMessage",
12
+ );
13
+
14
+ export type MPCv2P2PMessage = t.TypeOf<typeof MPCv2P2PMessage>;
@@ -0,0 +1,13 @@
1
+ import * as t from "io-ts";
2
+ import { NumberFromString, withMessage } from "io-ts-types";
3
+
4
+ const validPartyIndexes = t.union([t.literal(0), t.literal(1), t.literal(2)]);
5
+
6
+ export const MPCv2PartyFromStringOrNumber = withMessage(
7
+ t.union([validPartyIndexes, NumberFromString.pipe(validPartyIndexes)]),
8
+ (input) => `value is ${input} but expected one of [0, 1, 2, "0", "1", "2"]`,
9
+ );
10
+
11
+ export type MPCv2PartyFromStringOrNumber = t.TypeOf<
12
+ typeof MPCv2PartyFromStringOrNumber
13
+ >;
@@ -0,0 +1,3 @@
1
+ export * from "./common";
2
+ export * from "./keyGen";
3
+ export * from "./signing";
@@ -0,0 +1,2 @@
1
+ export * from "./keygenRound";
2
+ export * from "./mpcv2KeyGenState";
@@ -0,0 +1,70 @@
1
+ import * as t from "io-ts";
2
+ import { NonEmptyString } from "io-ts-types";
3
+ import { MPCv2BroadcastMessage, MPCv2P2PMessage } from "../common";
4
+
5
+ export const MPCv2KeyGenRound1Request = t.type({
6
+ userGpgPublicKey: NonEmptyString,
7
+ backupGpgPublicKey: NonEmptyString,
8
+ userMsg1: MPCv2BroadcastMessage,
9
+ backupMsg1: MPCv2BroadcastMessage,
10
+ });
11
+
12
+ export type MPCv2KeyGenRound1Request = t.TypeOf<
13
+ typeof MPCv2KeyGenRound1Request
14
+ >;
15
+
16
+ export const MPCv2KeyGenRound1Response = t.type({
17
+ sessionId: NonEmptyString,
18
+ bitgoMsg1: MPCv2BroadcastMessage,
19
+ bitgoToUserMsg2: MPCv2P2PMessage,
20
+ bitgoToBackupMsg2: MPCv2P2PMessage,
21
+ });
22
+
23
+ export type MPCv2KeyGenRound1Response = t.TypeOf<
24
+ typeof MPCv2KeyGenRound1Response
25
+ >;
26
+
27
+ export const MPCv2KeyGenRound2Request = t.type({
28
+ sessionId: NonEmptyString,
29
+ userMsg2: MPCv2P2PMessage,
30
+ userCommitment2: NonEmptyString,
31
+ backupMsg2: MPCv2P2PMessage,
32
+ backupCommitment2: NonEmptyString,
33
+ });
34
+
35
+ export type MPCv2KeyGenRound2Request = t.TypeOf<
36
+ typeof MPCv2KeyGenRound2Request
37
+ >;
38
+
39
+ export const MPCv2KeyGenRound2Response = t.type({
40
+ sessionId: NonEmptyString,
41
+ bitgoCommitment2: NonEmptyString,
42
+ bitgoToUserMsg3: MPCv2P2PMessage,
43
+ bitgoToBackupMsg3: MPCv2P2PMessage,
44
+ });
45
+
46
+ export type MPCv2KeyGenRound2Response = t.TypeOf<
47
+ typeof MPCv2KeyGenRound2Response
48
+ >;
49
+
50
+ export const MPCv2KeyGenRound3Request = t.type({
51
+ sessionId: NonEmptyString,
52
+ userMsg3: MPCv2P2PMessage,
53
+ backupMsg3: MPCv2P2PMessage,
54
+ userMsg4: MPCv2BroadcastMessage,
55
+ backupMsg4: MPCv2BroadcastMessage,
56
+ });
57
+
58
+ export type MPCv2KeyGenRound3Request = t.TypeOf<
59
+ typeof MPCv2KeyGenRound3Request
60
+ >;
61
+
62
+ export const MPCv2KeyGenRound3Response = t.type({
63
+ sessionId: NonEmptyString,
64
+ commonKeychain: NonEmptyString,
65
+ bitgoMsg4: MPCv2BroadcastMessage,
66
+ });
67
+
68
+ export type MPCv2KeyGenRound3Response = t.TypeOf<
69
+ typeof MPCv2KeyGenRound3Response
70
+ >;
@@ -0,0 +1,12 @@
1
+ import * as t from "io-ts";
2
+
3
+ export enum MPCv2KeyGenStateEnum {
4
+ "MPCv2-R1" = "MPCv2-R1",
5
+ "MPCv2-R2" = "MPCv2-R2",
6
+ "MPCv2-R3" = "MPCv2-R3",
7
+ }
8
+ export const MPCv2KeyGenState = t.keyof(
9
+ MPCv2KeyGenStateEnum,
10
+ "MPCv2KeyGenState",
11
+ );
12
+ export type MPCv2KeyGenState = t.TypeOf<typeof MPCv2KeyGenState>;
@@ -0,0 +1,2 @@
1
+ export * from "./mpcv2SigningState";
2
+ export * from "./signingRound";
@@ -0,0 +1,11 @@
1
+ import * as t from "io-ts";
2
+
3
+ export const MPCv2SigningState = t.union([
4
+ t.literal("round1Input"),
5
+ t.literal("round1Output"),
6
+ t.literal("round2Input"),
7
+ t.literal("round2Output"),
8
+ t.literal("round3Input"),
9
+ ]);
10
+
11
+ export type MPCv2SigningState = t.TypeOf<typeof MPCv2SigningState>;
@@ -0,0 +1,113 @@
1
+ import * as t from "io-ts";
2
+ import {
3
+ MPCv2P2PMessage,
4
+ MPCv2BroadcastMessage,
5
+ MPCv2BroadcastMessageWithSignatureR,
6
+ } from "../common";
7
+ import { MPCv2SigningState } from "./mpcv2SigningState";
8
+
9
+ export const MPCv2SignatureShareBase = t.type({
10
+ type: MPCv2SigningState,
11
+ });
12
+
13
+ /**
14
+ * User to BitGo round 1
15
+ */
16
+ export const MPCv2SignatureShareRound1Input = t.intersection([
17
+ MPCv2SignatureShareBase,
18
+ t.type(
19
+ {
20
+ type: t.literal("round1Input"),
21
+ data: t.type({
22
+ msg1: MPCv2BroadcastMessage,
23
+ }),
24
+ },
25
+ "MPCv2SignatureShareRound1",
26
+ ),
27
+ ]);
28
+
29
+ export type MPCv2SignatureShareRound1Input = t.TypeOf<
30
+ typeof MPCv2SignatureShareRound1Input
31
+ >;
32
+
33
+ /**
34
+ * BitGo to User round 1
35
+ */
36
+ export const MPCv2SignatureShareRound1Output = t.intersection([
37
+ MPCv2SignatureShareBase,
38
+ t.type(
39
+ {
40
+ type: t.literal("round1Output"),
41
+ data: t.type({
42
+ msg1: MPCv2BroadcastMessage,
43
+ msg2: MPCv2P2PMessage,
44
+ }),
45
+ },
46
+ "MPCv2SignatureShareRound1Output",
47
+ ),
48
+ ]);
49
+
50
+ export type MPCv2SignatureShareRound1Output = t.TypeOf<
51
+ typeof MPCv2SignatureShareRound1Output
52
+ >;
53
+
54
+ /**
55
+ * User to BitGo round 2
56
+ */
57
+ export const MPCv2SignatureShareRound2Input = t.intersection([
58
+ MPCv2SignatureShareBase,
59
+ t.type(
60
+ {
61
+ type: t.literal("round2Input"),
62
+ data: t.type({
63
+ msg2: MPCv2P2PMessage,
64
+ msg3: MPCv2P2PMessage,
65
+ }),
66
+ },
67
+ "MPCv2SignatureShareRound2Input",
68
+ ),
69
+ ]);
70
+
71
+ export type MPCv2SignatureShareRound2Input = t.TypeOf<
72
+ typeof MPCv2SignatureShareRound2Input
73
+ >;
74
+
75
+ /**
76
+ * BitGo to User round 2
77
+ */
78
+ export const MPCv2SignatureShareRound2Output = t.intersection([
79
+ MPCv2SignatureShareBase,
80
+ t.type(
81
+ {
82
+ type: t.literal("round2Output"),
83
+ data: t.type({
84
+ msg3: MPCv2P2PMessage,
85
+ }),
86
+ },
87
+ "MPCv2SignatureShareRound2Output",
88
+ ),
89
+ ]);
90
+
91
+ export type MPCv2SignatureShareRound2Output = t.TypeOf<
92
+ typeof MPCv2SignatureShareRound2Output
93
+ >;
94
+
95
+ /**
96
+ * User to BitGo round 3
97
+ */
98
+ export const MPCv2SignatureShareRound3Input = t.intersection([
99
+ MPCv2SignatureShareBase,
100
+ t.type(
101
+ {
102
+ type: t.literal("round3Input"),
103
+ data: t.type({
104
+ msg4: MPCv2BroadcastMessageWithSignatureR,
105
+ }),
106
+ },
107
+ "MPCv2SignatureShareRound3Input",
108
+ ),
109
+ ]);
110
+
111
+ export type MPCv2SignatureShareRound3Input = t.TypeOf<
112
+ typeof MPCv2SignatureShareRound3Input
113
+ >;
@@ -0,0 +1,2 @@
1
+ export * from "./transactionState";
2
+ export * from "./transactionRequestState";
@@ -0,0 +1,21 @@
1
+ import * as t from "io-ts";
2
+
3
+ export const TransactionRequestState = t.keyof(
4
+ {
5
+ pendingApproval: 1,
6
+ canceled: 1,
7
+ rejected: 1,
8
+ initialized: 1,
9
+ pendingDelivery: 1,
10
+ delivered: 1,
11
+ pendingUserSignature: 1,
12
+ pendingUserCommitment: 1,
13
+ pendingUserRShare: 1,
14
+ pendingUserGShare: 1,
15
+ readyToSend: 1,
16
+ signed: 1,
17
+ failed: 1,
18
+ },
19
+ "TransactionRequestState",
20
+ );
21
+ export type TransactionRequestState = t.TypeOf<typeof TransactionRequestState>;
@@ -0,0 +1,22 @@
1
+ import * as t from "io-ts";
2
+
3
+ export const TransactionState = t.keyof(
4
+ {
5
+ initialized: 1,
6
+ pendingSignature: 1,
7
+ eddsaPendingCommitment: 1,
8
+ eddsaPendingRShare: 1,
9
+ eddsaPendingGShare: 1,
10
+ ecdsaMPCv2Round1: 1,
11
+ ecdsaMPCv2Round2: 1,
12
+ ecdsaMPCv2Round3: 1,
13
+ readyToCombineShares: 1,
14
+ signed: 1,
15
+ held: 1,
16
+ delivered: 1,
17
+ invalidSignature: 1,
18
+ rejected: 1,
19
+ },
20
+ "TransactionState",
21
+ );
22
+ export type TransactionState = t.TypeOf<typeof TransactionState>;