@bitgo/public-types 6.81.0 → 6.83.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.
@@ -36,6 +36,7 @@ const signatureShare_1 = require("./signatureShare");
36
36
  const unsignedTransaction_1 = require("./unsignedTransaction");
37
37
  const message_1 = require("./message");
38
38
  const transaction_1 = require("./transaction");
39
+ const txChannel_1 = require("./txChannel");
39
40
  exports.TransactionRequestId = t.string;
40
41
  exports.TransactionRequestIdNonEmptyString = io_ts_types_1.NonEmptyString;
41
42
  exports.TransactionRequestBase = t.intersection([
@@ -57,10 +58,14 @@ exports.TransactionRequestBase = t.intersection([
57
58
  idempotencyKey: t.string,
58
59
  walletType: walletTypes_1.WalletTypes,
59
60
  enterpriseId: enterprise_1.EnterpriseIdString,
61
+ organizationId: t.string,
60
62
  intent: t.unknown,
61
63
  pendingApprovalId: t.string,
62
64
  policiesChecked: t.boolean,
63
65
  isCanceled: t.boolean,
66
+ cancelReason: t.string,
67
+ initiatedByDAppClient: t.boolean,
68
+ txChannel: txChannel_1.TxChannel,
64
69
  }),
65
70
  ]);
66
71
  exports.TransactionRequestLite = t.intersection([
@@ -1 +1 @@
1
- {"version":3,"file":"transactionRequest.js","sourceRoot":"","sources":["../../../../src/schema/transactionRequest/transactionRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAAgE;AAChE,sCAA2C;AAC3C,uDAAoD;AACpD,8CAAmD;AACnD,wBAA+D;AAC/D,iFAA8E;AAC9E,uDAAoD;AACpD,qDAAkD;AAClD,+DAA4D;AAC5D,uCAAoC;AACpC,+CAA4C;AAM/B,QAAA,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;AAQhC,QAAA,kCAAkC,GAAG,4BAAc,CAAC;AAMpD,QAAA,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAAC;IAEnD,CAAC,CAAC,IAAI,CAAC;QAEL,WAAW,EAA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IACtB,CAAC,CAAC,OAAO,CAAC;QAER,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,yBAAW,CAAC;QAElC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAO,CAAC;KAC3B,CAAC;CACH,CAAC,CAAC;AAGU,QAAA,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC;IACxC,8BAAsB;IACtB,8BAAsB;CACvB,CAAC,CAAC"}
1
+ {"version":3,"file":"transactionRequest.js","sourceRoot":"","sources":["../../../../src/schema/transactionRequest/transactionRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAAgE;AAChE,sCAA2C;AAC3C,uDAAoD;AACpD,8CAAmD;AACnD,wBAA+D;AAC/D,iFAA8E;AAC9E,uDAAoD;AACpD,qDAAkD;AAClD,+DAA4D;AAC5D,uCAAoC;AACpC,+CAA4C;AAC5C,2CAAwC;AAK3B,QAAA,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;AAQhC,QAAA,kCAAkC,GAAG,4BAAc,CAAC;AAMpD,QAAA,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAAC;IAEnD,CAAC,CAAC,IAAI,CAAC;QAEL,WAAW,EAAE,4BAAoB;QAEjC,QAAQ,EAAE,uBAAc;QAExB,OAAO,EAAE,CAAC,CAAC,MAAM;QAEjB,KAAK,EAAE,0BAAuB;QAK9B,IAAI,EAAE,+BAAiB;QAKvB,WAAW,EAAE,+BAAiB;QAE9B,MAAM,EAAE,CAAC,CAAC,MAAM;QAEhB,WAAW,EAAE,CAAC,CAAC,MAAM;QAErB,SAAS,EAAE,CAAC,CAAC,MAAM;QAEnB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;QAE3B,MAAM,EAAE,CAAC,CAAC,OAAO;KAClB,CAAC;IAEF,CAAC,CAAC,OAAO,CAAC;QAER,UAAU,EAAE,2DAA4B;QAExC,cAAc,EAA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are const TxChannelType: t.KeyofC<{
3
+ defi: number;
4
+ }>;
5
+ export type TxChannelType = t.TypeOf<typeof TxChannelType>;
6
+ export declare const TxChannelSource: t.KeyofC<{
7
+ internal: number;
8
+ external: number;
9
+ }>;
10
+ export type TxChannelSource = t.TypeOf<typeof TxChannelSource>;
11
+ export declare const TxChannelConnector: t.KeyofC<{
12
+ narval: number;
13
+ walletconnect: number;
14
+ }>;
15
+ export type TxChannelConnector = t.TypeOf<typeof TxChannelConnector>;
16
+ export declare const TxChannelProtocol: t.KeyofC<{
17
+ morpho: number;
18
+ aave: number;
19
+ concrete: number;
20
+ }>;
21
+ export type TxChannelProtocol = t.TypeOf<typeof TxChannelProtocol>;
22
+ export declare const TxChannelDefiAction: t.KeyofC<{
23
+ approve: number;
24
+ deposit: number;
25
+ withdraw: number;
26
+ }>;
27
+ export type TxChannelDefiAction = t.TypeOf<typeof TxChannelDefiAction>;
28
+ export declare const TxChannel: t.IntersectionC<[t.TypeC<{
29
+ type: t.KeyofC<{
30
+ defi: number;
31
+ }>;
32
+ source: t.KeyofC<{
33
+ internal: number;
34
+ external: number;
35
+ }>;
36
+ }>, t.PartialC<{
37
+ connector: t.KeyofC<{
38
+ narval: number;
39
+ walletconnect: number;
40
+ }>;
41
+ protocol: t.KeyofC<{
42
+ morpho: number;
43
+ aave: number;
44
+ concrete: number;
45
+ }>;
46
+ defiAction: t.KeyofC<{
47
+ approve: number;
48
+ deposit: number;
49
+ withdraw: number;
50
+ }>;
51
+ vaultId: t.StringC;
52
+ clientId: t.StringC;
53
+ walletConnectRequestId: t.StringC;
54
+ }>]>;
55
+ export type TxChannel = t.TypeOf<typeof TxChannel>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.TxChannel = exports.TxChannelDefiAction = exports.TxChannelProtocol = exports.TxChannelConnector = exports.TxChannelSource = exports.TxChannelType = void 0;
27
+ const t = __importStar(require("io-ts"));
28
+ exports.TxChannelType = t.keyof({ defi: 1 }, "TxChannelType");
29
+ exports.TxChannelSource = t.keyof({ internal: 1, external: 1 }, "TxChannelSource");
30
+ exports.TxChannelConnector = t.keyof({ narval: 1, walletconnect: 1 }, "TxChannelConnector");
31
+ exports.TxChannelProtocol = t.keyof({ morpho: 1, aave: 1, concrete: 1 }, "TxChannelProtocol");
32
+ exports.TxChannelDefiAction = t.keyof({ approve: 1, deposit: 1, withdraw: 1 }, "TxChannelDefiAction");
33
+ exports.TxChannel = t.intersection([
34
+ t.type({
35
+ type: exports.TxChannelType,
36
+ source: exports.TxChannelSource,
37
+ }),
38
+ t.partial({
39
+ connector: exports.TxChannelConnector,
40
+ protocol: exports.TxChannelProtocol,
41
+ defiAction: exports.TxChannelDefiAction,
42
+ vaultId: t.string,
43
+ clientId: t.string,
44
+ walletConnectRequestId: t.string,
45
+ }),
46
+ ]);
47
+ //# sourceMappingURL=txChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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2
2
  "name": "@bitgo/public-types",
3
- "version": "6.81.0",
3
+ "version": "6.83.0",
4
4
  "description": "Collection of types exposed externally as part of the BitGo public API",
5
5
  "license": "UNLICENSED",
6
6
  "author": "",
@@ -75,39 +75,86 @@ export type MPCv2KeyGenRound3Response = t.TypeOf<
75
75
  >;
76
76
 
77
77
  // EdDSA MPCv2 (2-round) keygen codecs
78
-
79
- export const EddsaMPCv2KeyGenRound1Request = t.type({
80
- userGpgPublicKey: NonEmptyString,
81
- backupGpgPublicKey: NonEmptyString,
82
- userMsg1: EddsaMPCv2SignedMessage,
83
- backupMsg1: EddsaMPCv2SignedMessage,
84
- });
78
+ //
79
+ // Safe roots also run a VRF DKG over these same two rounds. Every VRF field is optional and additive:
80
+ // ordinary keygen omits them and is unchanged. The HSM keys VRF mode off the presence of the VRF
81
+ // messages, and requires them all-or-none per round (R1: userVrfMsg1 + backupVrfMsg1; R2: userVrfMsg2 +
82
+ // backupVrfMsg2), so the HSM, not these codecs, enforces the grouping. The HSM's opaque VRF state is not
83
+ // part of these client contracts: the server keeps it between rounds, like the signing-DKG state.
84
+ // Client messages are signed by the sending party's GPG key, like userMsg1/userMsg2.
85
+
86
+ export const EddsaMPCv2KeyGenRound1Request = t.intersection(
87
+ [
88
+ t.type({
89
+ userGpgPublicKey: NonEmptyString,
90
+ backupGpgPublicKey: NonEmptyString,
91
+ userMsg1: EddsaMPCv2SignedMessage,
92
+ backupMsg1: EddsaMPCv2SignedMessage,
93
+ }),
94
+ t.partial({
95
+ userVrfMsg1: EddsaMPCv2SignedMessage,
96
+ backupVrfMsg1: EddsaMPCv2SignedMessage,
97
+ }),
98
+ ],
99
+ "EddsaMPCv2KeyGenRound1Request",
100
+ );
85
101
  export type EddsaMPCv2KeyGenRound1Request = t.TypeOf<
86
102
  typeof EddsaMPCv2KeyGenRound1Request
87
103
  >;
88
104
 
89
- export const EddsaMPCv2KeyGenRound1Response = t.type({
90
- sessionId: NonEmptyString,
91
- bitgoMsg1: EddsaMPCv2SignedMessage,
92
- });
105
+ export const EddsaMPCv2KeyGenRound1Response = t.intersection(
106
+ [
107
+ t.type({
108
+ sessionId: NonEmptyString,
109
+ bitgoMsg1: EddsaMPCv2SignedMessage,
110
+ }),
111
+ t.partial({
112
+ bitgoVrfMsg1: EddsaMPCv2SignedMessage,
113
+ }),
114
+ ],
115
+ "EddsaMPCv2KeyGenRound1Response",
116
+ );
93
117
  export type EddsaMPCv2KeyGenRound1Response = t.TypeOf<
94
118
  typeof EddsaMPCv2KeyGenRound1Response
95
119
  >;
96
120
 
97
- export const EddsaMPCv2KeyGenRound2Request = t.type({
98
- sessionId: NonEmptyString,
99
- userMsg2: EddsaMPCv2SignedMessage,
100
- backupMsg2: EddsaMPCv2SignedMessage,
101
- });
121
+ export const EddsaMPCv2KeyGenRound2Request = t.intersection(
122
+ [
123
+ t.type({
124
+ sessionId: NonEmptyString,
125
+ userMsg2: EddsaMPCv2SignedMessage,
126
+ backupMsg2: EddsaMPCv2SignedMessage,
127
+ }),
128
+ t.partial({
129
+ userVrfMsg2: EddsaMPCv2SignedMessage,
130
+ backupVrfMsg2: EddsaMPCv2SignedMessage,
131
+ }),
132
+ ],
133
+ "EddsaMPCv2KeyGenRound2Request",
134
+ );
102
135
  export type EddsaMPCv2KeyGenRound2Request = t.TypeOf<
103
136
  typeof EddsaMPCv2KeyGenRound2Request
104
137
  >;
105
138
 
106
- export const EddsaMPCv2KeyGenRound2Response = t.type({
107
- sessionId: NonEmptyString,
108
- commonPublicKeychain: NonEmptyString,
109
- bitgoMsg2: EddsaMPCv2SignedMessage,
110
- });
139
+ /**
140
+ * `bitgoVrfMsgToUser` / `bitgoVrfMsgToBackup` are BitGo's VRF openings, each PGP-encrypted to the
141
+ * recipient party's GPG key (`message` is the armored ciphertext) with BitGo's signature over the
142
+ * plaintext. Intermediaries must relay them unread.
143
+ */
144
+ export const EddsaMPCv2KeyGenRound2Response = t.intersection(
145
+ [
146
+ t.type({
147
+ sessionId: NonEmptyString,
148
+ commonPublicKeychain: NonEmptyString,
149
+ bitgoMsg2: EddsaMPCv2SignedMessage,
150
+ }),
151
+ t.partial({
152
+ bitgoVrfMsgToUser: EddsaMPCv2SignedMessage,
153
+ bitgoVrfMsgToBackup: EddsaMPCv2SignedMessage,
154
+ }),
155
+ ],
156
+ "EddsaMPCv2KeyGenRound2Response",
157
+ );
111
158
  export type EddsaMPCv2KeyGenRound2Response = t.TypeOf<
112
159
  typeof EddsaMPCv2KeyGenRound2Response
113
160
  >;
@@ -2,6 +2,7 @@ export * from "./transactionState";
2
2
  export * from "./transactionRequestState";
3
3
  export * from "./intents";
4
4
  export * from "./transactionRequest";
5
+ export * from "./txChannel";
5
6
  export * from "./transactionRequestApiVersion";
6
7
  export * from "./commitmentShare";
7
8
  export * from "./signatureShare";
@@ -10,7 +10,7 @@ import { SignatureShare } from "./signatureShare";
10
10
  import { UnsignedTransaction } from "./unsignedTransaction";
11
11
  import { Message } from "./message";
12
12
  import { Transaction } from "./transaction";
13
-
13
+ import { TxChannel } from "./txChannel";
14
14
  /**
15
15
  * @format uuid
16
16
  * @example 123e4567-e89b-12d3-a456-426614174000
@@ -67,18 +67,28 @@ export const TransactionRequestBase = t.intersection([
67
67
  apiVersion: TransactionRequestApiVersion,
68
68
  /** The idempotency key of the transaction request */
69
69
  idempotencyKey: t.string,
70
+ // todo BG-54028: mark as required once this has been backfilled
70
71
  /** The type describes who owns the keys to the wallet associated to the TxRequest. */
71
72
  walletType: WalletTypes,
72
73
  /** If the wallet that owns the TxRequest is owned by an enterprise then this is the Id of said enterprise. */
73
74
  enterpriseId: EnterpriseIdString,
75
+ /** The id of the organization the TxRequest's wallet belongs to. */
76
+ organizationId: t.string,
74
77
  /** The intent of the transaction request */
75
78
  intent: t.unknown,
76
79
  /** The id of the Pending Approval that was created for the TxRequest if one was required. */
77
80
  pendingApprovalId: t.string,
81
+ // todo BG-54028: mark as required once this has been backfilled
78
82
  /** Indicates if the transaction request has been checked against the policies. */
79
83
  policiesChecked: t.boolean,
80
84
  /** True, if the transaction request is canceled. */
81
85
  isCanceled: t.boolean,
86
+ /** The reason the transaction request was canceled, if applicable. */
87
+ cancelReason: t.string,
88
+ /** True when the txRequest was initiated by a dApp OAuth client (e.g. Narval). */
89
+ initiatedByDAppClient: t.boolean,
90
+ /** Immutable DeFi / marketplace channel classification (DEFI-300). */
91
+ txChannel: TxChannel,
82
92
  }),
83
93
  ]);
84
94
 
@@ -86,7 +96,7 @@ export const TransactionRequestLite = t.intersection([
86
96
  TransactionRequestBase,
87
97
  t.partial({
88
98
  /** The intent of the transaction request */
89
- intent: t.union([TransactionIntent, t.unknown]),
99
+ intent: t.union([TransactionIntent, t.unknown]) as t.Type<unknown>,
90
100
  /** Holds all unsigned transactions that will be used to fulfill the TxRequest for MPC wallets. */
91
101
  unsignedTxs: t.array(UnsignedTransaction),
92
102
  /** Only used for MPC coins. This is used to collect signature shares from and exchange them with the user. */
@@ -0,0 +1,50 @@
1
+ import * as t from "io-ts";
2
+
3
+ export const TxChannelType = t.keyof({ defi: 1 }, "TxChannelType");
4
+ export type TxChannelType = t.TypeOf<typeof TxChannelType>;
5
+
6
+ export const TxChannelSource = t.keyof(
7
+ { internal: 1, external: 1 },
8
+ "TxChannelSource",
9
+ );
10
+ export type TxChannelSource = t.TypeOf<typeof TxChannelSource>;
11
+
12
+ export const TxChannelConnector = t.keyof(
13
+ { narval: 1, walletconnect: 1 },
14
+ "TxChannelConnector",
15
+ );
16
+ export type TxChannelConnector = t.TypeOf<typeof TxChannelConnector>;
17
+
18
+ /** DeFi protocol. aave/concrete are forward-compat stubs (not stamped by classifiers yet). */
19
+ export const TxChannelProtocol = t.keyof(
20
+ { morpho: 1, aave: 1, concrete: 1 },
21
+ "TxChannelProtocol",
22
+ );
23
+ export type TxChannelProtocol = t.TypeOf<typeof TxChannelProtocol>;
24
+
25
+ export const TxChannelDefiAction = t.keyof(
26
+ { approve: 1, deposit: 1, withdraw: 1 },
27
+ "TxChannelDefiAction",
28
+ );
29
+ export type TxChannelDefiAction = t.TypeOf<typeof TxChannelDefiAction>;
30
+
31
+ /** Immutable classification of how a txRequest entered BitGo (DEFI-300). */
32
+ export const TxChannel = t.intersection([
33
+ t.type({
34
+ type: TxChannelType,
35
+ source: TxChannelSource,
36
+ }),
37
+ t.partial({
38
+ /** External entry connector (narval, walletconnect). Omitted for internal BitGo flows. */
39
+ connector: TxChannelConnector,
40
+ /** DeFi protocol (morpho, aave, concrete). */
41
+ protocol: TxChannelProtocol,
42
+ defiAction: TxChannelDefiAction,
43
+ vaultId: t.string,
44
+ /** OAuth dApp client id (Narval). */
45
+ clientId: t.string,
46
+ /** defi-service walletconnect_requests.id when supplied on the intent. */
47
+ walletConnectRequestId: t.string,
48
+ }),
49
+ ]);
50
+ export type TxChannel = t.TypeOf<typeof TxChannel>;