@bitgo/public-types 2.26.0 → 2.28.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.
@@ -11,12 +11,12 @@ export declare const AddEnterpriseWebhookRequestBodyC: t.TypeC<{
11
11
  }>;
12
12
  export type AddEnterpriseWebhookRequestBody = t.TypeOf<typeof AddEnterpriseWebhookRequestBodyC>;
13
13
  export declare const ListEnterpriseWebhooksRequestBody: {
14
- type: t.UnionC<[t.Type<"bankAccount", "bankAccount", unknown>, t.UndefinedC]>;
14
+ type: t.UnionC<[t.Type<"bankAccount" | "accessToken", "bankAccount" | "accessToken", unknown>, t.UndefinedC]>;
15
15
  limit: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
16
16
  prevId: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
17
17
  };
18
18
  export declare const ListEnterpriseWebhooksRequestBodyC: t.TypeC<{
19
- type: t.UnionC<[t.Type<"bankAccount", "bankAccount", unknown>, t.UndefinedC]>;
19
+ type: t.UnionC<[t.Type<"bankAccount" | "accessToken", "bankAccount" | "accessToken", unknown>, t.UndefinedC]>;
20
20
  limit: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
21
21
  prevId: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
22
22
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../../../src/schema/webhook/webhook.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAAgD;AAChD,2FAAwF;AACxF,6EAA0E;AAC1E,iDAA8C;AAC9C,+CAA4C;AAC5C,iDAA8C;AAEjC,QAAA,OAAO,GAAG,CAAC,CAAC,YAAY,CAAC;IACpC,CAAC,CAAC,IAAI,CAAC;QACL,EAAE,EAAE,CAAC,CAAC,MAAM;QACZ,OAAO,EAAE,+BAAiB;QAC1B,IAAI,EAAE,CAAC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,KAAK,EAAE,2BAAY;QAInB,wBAAwB,EAAE,CAAC,CAAC,MAAM;QAClC,qBAAqB,EAAE,CAAC,CAAC,OAAO;KACjC,CAAC;IACF,CAAC,CAAC,OAAO,CAAC;QACR,KAAK,EAAE,CAAC,CAAC,MAAM;QACf,QAAQ,EAAE,CAAC,CAAC,MAAM;QAClB,YAAY,EAAE,CAAC,CAAC,MAAM;QAKtB,cAAc,EAAE,CAAC,CAAC,MAAM;QACxB,MAAM,EAAE,CAAC,CAAC,MAAM;QAIhB,IAAI,EAAE,yBAAW;QAIjB,gBAAgB,EAAE,CAAC,CAAC,MAAM;QAK1B,WAAW,EAAE,+BAAiB;QAK9B,YAAY,EAAE,+BAAiB;QAC/B,QAAQ,EAAE,CAAC,CAAC,OAAO;QAInB,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,iDAAuB,CAAC;QAIjD,0BAA0B,EAAE,CAAC,CAAC,KAAK,CAAC,mCAAgB,CAAC;KACtD,CAAC;CACH,CAAC,CAAC"}
@@ -1,15 +1,17 @@
1
1
  import * as t from "io-ts";
2
+ export declare const WebhookNotificationState: t.UnionC<[t.LiteralC<"unconfirmed">, t.LiteralC<"new">, t.LiteralC<"pending">, t.LiteralC<"processed">, t.LiteralC<"failed">]>;
3
+ export type WebhookNotificationState = t.TypeOf<typeof WebhookNotificationState>;
2
4
  export declare const WebhookNotification: t.IntersectionC<[t.TypeC<{
3
5
  id: t.StringC;
4
6
  }>, t.PartialC<{
5
- type: t.StringC;
7
+ type: t.KeyofC<typeof import("./webhookType").WebhookTypeEnum>;
6
8
  wallet: t.StringC;
7
9
  url: t.StringC;
8
10
  hash: t.StringC;
9
11
  coin: t.StringC;
10
12
  coinChain: t.StringC;
11
13
  transfer: t.StringC;
12
- state: t.StringC;
14
+ state: t.UnionC<[t.LiteralC<"unconfirmed">, t.LiteralC<"new">, t.LiteralC<"pending">, t.LiteralC<"processed">, t.LiteralC<"failed">]>;
13
15
  simulation: t.BooleanC;
14
16
  retries: t.NumberC;
15
17
  webhook: t.StringC;
@@ -23,22 +23,30 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.WebhookNotification = void 0;
26
+ exports.WebhookNotification = exports.WebhookNotificationState = void 0;
27
27
  const t = __importStar(require("io-ts"));
28
28
  const io_ts_types_1 = require("io-ts-types");
29
+ const webhookType_1 = require("./webhookType");
30
+ exports.WebhookNotificationState = t.union([
31
+ t.literal("unconfirmed"),
32
+ t.literal("new"),
33
+ t.literal("pending"),
34
+ t.literal("processed"),
35
+ t.literal("failed"),
36
+ ]);
29
37
  exports.WebhookNotification = t.intersection([
30
38
  t.type({
31
39
  id: t.string,
32
40
  }),
33
41
  t.partial({
34
- type: t.string,
42
+ type: webhookType_1.WebhookType,
35
43
  wallet: t.string,
36
44
  url: t.string,
37
45
  hash: t.string,
38
46
  coin: t.string,
39
47
  coinChain: t.string,
40
48
  transfer: t.string,
41
- state: t.string,
49
+ state: exports.WebhookNotificationState,
42
50
  simulation: t.boolean,
43
51
  retries: t.number,
44
52
  webhook: t.string,
@@ -1 +1 @@
1
- {"version":3,"file":"webhookNotification.js","sourceRoot":"","sources":["../../../../src/schema/webhook/webhookNotification.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAAgD;AAEnC,QAAA,mBAAmB,GAAG,CAAC,CAAC,YAAY,CAAC;IAChD,CAAC,CAAC,IAAI,CAAC;QACL,EAAE,EAAE,CAAC,CAAC,MAAM;KACb,CAAC;IACF,CAAC,CAAC,OAAO,CAAC;QACR,IAAI,EAAE,CAAC,CAAC,MAAM;QACd,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,GAAG,EAAE,CAAC,CAAC,MAAM;QACb,IAAI,EAAE,CAAC,CAAC,MAAM;QACd,IAAI,EAAE,CAAC,CAAC,MAAM;QACd,SAAS,EAAE,CAAC,CAAC,MAAM;QACnB,QAAQ,EAAE,CAAC,CAAC,MAAM;QAClB,KAAK,EAAE,CAAC,CAAC,MAAM;QACf,UAAU,EAAE,CAAC,CAAC,OAAO;QACrB,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,SAAS,EAAE,+BAAiB;QAC5B,WAAW,EAAE,+BAAiB;QAC9B,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,iBAAiB,EAAE,CAAC,CAAC,OAAO;QAC5B,eAAe,EAAE,CAAC,CAAC,MAAM;QACzB,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC;YAClB,IAAI,EAAE,CAAC,CAAC,OAAO;YACf,IAAI,EAAE,CAAC,CAAC,MAAM;YACd,IAAI,EAAE,CAAC,CAAC,MAAM;YACd,KAAK,EAAE,CAAC,CAAC,MAAM;SAChB,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
1
+ {"version":3,"file":"webhookNotification.js","sourceRoot":"","sources":["../../../../src/schema/webhook/webhookNotification.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAAgD;AAChD,+CAA4C;AAE/B,QAAA,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC9C,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IACxB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAChB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IACpB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;CACpB,CAAC,CAAC;AAMU,QAAA,mBAAmB,GAAG,CAAC,CAAC,YAAY,CAAC;IAChD,CAAC,CAAC,IAAI,CAAC;QAKL,EAAE,EAAE,CAAC,CAAC,MAAM;KACb,CAAC;IACF,CAAC,CAAC,OAAO,CAAC;QAIR,IAAI,EAAE,yBAAW;QAIjB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,GAAG,EAAE,CAAC,CAAC,MAAM;QACb,IAAI,EAAE,CAAC,CAAC,MAAM;QAKd,IAAI,EAAE,CAAC,CAAC,MAAM;QACd,SAAS,EAAE,CAAC,CAAC,MAAM;QAInB,QAAQ,EAAE,CAAC,CAAC,MAAM;QAKlB,KAAK,EAAE,gCAAwB;QAC/B,UAAU,EAAE,CAAC,CAAC,OAAO;QACrB,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,OAAO,EAAE,CAAC,CAAC,MAAM;QAIjB,SAAS,EAAE,+BAAiB;QAI5B,WAAW,EAAE,+BAAiB;QAI9B,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,iBAAiB,EAAE,CAAC,CAAC,OAAO;QAC5B,eAAe,EAAE,CAAC,CAAC,MAAM;QACzB,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC;YAClB,IAAI,EAAE,CAAC,CAAC,OAAO;YACf,IAAI,EAAE,CAAC,CAAC,MAAM;YACd,IAAI,EAAE,CAAC,CAAC,MAAM;YACd,KAAK,EAAE,CAAC,CAAC,MAAM;SAChB,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
@@ -16,7 +16,8 @@ export declare enum WebhookTypeEnum {
16
16
  "bankAccount" = "bankAccount",
17
17
  "userKycState" = "userKycState",
18
18
  "enterpriseKycState" = "enterpriseKycState",
19
- "identityStatus" = "identityStatus"
19
+ "identityStatus" = "identityStatus",
20
+ "accessToken" = "accessToken"
20
21
  }
21
22
  export declare const WebhookType: t.KeyofC<typeof WebhookTypeEnum>;
22
23
  export type WebhookType = t.TypeOf<typeof WebhookType>;
@@ -37,7 +38,8 @@ export declare enum WalletWebhookTypeEnum {
37
38
  export declare const WalletWebhookType: t.KeyofC<typeof WalletWebhookTypeEnum>;
38
39
  export type WalletWebhookType = t.TypeOf<typeof WalletWebhookType>;
39
40
  export declare enum EnterpriseWebhookTypeEnum {
40
- "bankAccount" = "bankAccount"
41
+ "bankAccount" = "bankAccount",
42
+ "accessToken" = "accessToken"
41
43
  }
42
44
  export declare const EnterpriseWebhookType: t.KeyofC<typeof EnterpriseWebhookTypeEnum>;
43
45
  export type EnterpriseWebhookType = t.TypeOf<typeof EnterpriseWebhookType>;
@@ -44,6 +44,7 @@ var WebhookTypeEnum;
44
44
  WebhookTypeEnum["userKycState"] = "userKycState";
45
45
  WebhookTypeEnum["enterpriseKycState"] = "enterpriseKycState";
46
46
  WebhookTypeEnum["identityStatus"] = "identityStatus";
47
+ WebhookTypeEnum["accessToken"] = "accessToken";
47
48
  })(WebhookTypeEnum || (exports.WebhookTypeEnum = WebhookTypeEnum = {}));
48
49
  exports.WebhookType = t.keyof(WebhookTypeEnum, "WebhookType");
49
50
  var WalletWebhookTypeEnum;
@@ -65,6 +66,7 @@ exports.WalletWebhookType = t.keyof(WalletWebhookTypeEnum, "WalletWebhookType");
65
66
  var EnterpriseWebhookTypeEnum;
66
67
  (function (EnterpriseWebhookTypeEnum) {
67
68
  EnterpriseWebhookTypeEnum["bankAccount"] = "bankAccount";
69
+ EnterpriseWebhookTypeEnum["accessToken"] = "accessToken";
68
70
  })(EnterpriseWebhookTypeEnum || (exports.EnterpriseWebhookTypeEnum = EnterpriseWebhookTypeEnum = {}));
69
71
  exports.EnterpriseWebhookType = t.keyof(EnterpriseWebhookTypeEnum, "EnterpriseWebhookType");
70
72
  //# sourceMappingURL=webhookType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhookType.js","sourceRoot":"","sources":["../../../../src/schema/webhook/webhookType.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAE3B,IAAY,eAuBX;AAvBD,WAAY,eAAe;IAEzB,0CAAyB,CAAA;IAEzB,gEAA+C,CAAA;IAC/C,wCAAuB,CAAA;IACvB,8CAA6B,CAAA;IAC7B,4DAA2C,CAAA;IAC3C,0DAAyC,CAAA;IACzC,sD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4DAA2C,CAAA;IAC3C,0DAAyC,CAAA;IACzC,sDAAqC,CAAA;IACrC,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;IACjB,gEAA+C,CAAA;IAC/C,oCAAmB,CAAA;IAGnB,8DAA6C,CAAA;IAE7C,oDAAmC,CAAA;IACnC,8CAA6B,CAAA;IAC7B,gDAA+B,CAAA;IAC/B,4DAA2C,CAAA;IAC3C,oDAAmC,CAAA;IAEnC,8CAA6B,CAAA;AAC/B,CAAC,EAzBW,eAAe,+BAAf,eAAe,QAyB1B;AAEY,QAAA,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AAGnE,IAAY,qBAaX;AAbD,WAAY,qBAAqB;IAC/B,gDAAyB,CAAA;IACzB,sEAA+C,CAAA;IAC/C,8CAAuB,CAAA;IACvB,oDAA6B,CAAA;IAC7B,kEAA2C,CAAA;IAC3C,gEAAyC,CAAA;IACzC,4DAAqC,CAAA;IACrC,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,sEAA+C,CAAA;IAC/C,0CAAmB,CAAA;IACnB,0DAAmC,CAAA;AACrC,CAAC,EAbW,qBAAqB,qCAArB,qBAAqB,QAahC;AAEY,QAAA,iBAAiB,GAAG,CAAC,CAAC,KAAK,CACtC,qBAAqB,EACrB,mBAAmB,CACpB,CAAC;AAGF,IAAY,yBAGX;AAHD,WAAY,yBAAyB;IACnC,wDAA6B,CAAA;IAC7B,wDAA6B,CAAA;AAC/B,CAAC,EAHW,yBAAyB,yCAAzB,yBAAyB,QAGpC;AACY,QAAA,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAC1C,yBAAyB,EACzB,uBAAuB,CACxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitgo/public-types",
3
- "version": "2.26.0",
3
+ "version": "2.28.0",
4
4
  "description": "Collection of types exposed externally as part of the BitGo public API",
5
5
  "license": "UNLICENSED",
6
6
  "author": "",
@@ -8,13 +8,36 @@ import { WebhookScope } from "./webhookScope";
8
8
 
9
9
  export const Webhook = t.intersection([
10
10
  t.type({
11
+ /**
12
+ * @example "59cd72485007a239fb00282ed480da1f"
13
+ * @pattern ^[0-9a-f]{32}$
14
+ */
11
15
  id: t.string,
16
+ /**
17
+ * @format date-time
18
+ * @example "2021-01-01T00:00:00Z"
19
+ */
12
20
  created: DateFromISOString,
21
+ /**
22
+ * A cryptocurrency or token ticker symbol.
23
+ * @example btc
24
+ */
13
25
  coin: t.string,
26
+ /**
27
+ * @format uri
28
+ * @example "https://your.server.com/webhook"
29
+ */
14
30
  url: t.string,
31
+ /**
32
+ * 2 for coins running on API v2.
33
+ * @example 2
34
+ */
15
35
  version: t.number,
16
36
  scope: WebhookScope,
17
37
  state: WebhookState,
38
+ /**
39
+ * @example 0
40
+ */
18
41
  successiveFailedAttempts: t.number,
19
42
  listenToFailureStates: t.boolean,
20
43
  }),
@@ -22,14 +45,38 @@ export const Webhook = t.intersection([
22
45
  label: t.string,
23
46
  walletId: t.string,
24
47
  enterpriseId: t.string,
48
+ /**
49
+ * @example "59cd72485007a239fb00282ed480da1f"
50
+ * @pattern ^[0-9a-f]{32}$
51
+ */
25
52
  organizationId: t.string,
26
53
  userId: t.string,
54
+ /**
55
+ * Event type to listen to.
56
+ */
27
57
  type: WebhookType,
58
+ /**
59
+ * @example 6
60
+ */
28
61
  numConfirmations: t.number,
62
+ /**
63
+ * @format date-time
64
+ * @example "2021-01-01T00:00:00Z"
65
+ */
29
66
  lastAttempt: DateFromISOString,
67
+ /**
68
+ * @format date-time
69
+ * @example "2021-01-01T00:00:00Z"
70
+ */
30
71
  failingSince: DateFromISOString,
31
72
  allToken: t.boolean,
73
+ /**
74
+ * If present, only transaction request state changes from the list will trigger notifications. If not present, all transaction request state changes will trigger notifications.
75
+ */
32
76
  txRequestStates: t.array(TransactionRequestState),
77
+ /**
78
+ * If present, only transaction request transaction state changes from the list will trigger notifications. If not present, all transaction request transaction state changes will trigger notifications.
79
+ */
33
80
  txRequestTransactionStates: t.array(TransactionState),
34
81
  }),
35
82
  ]);
@@ -1,24 +1,67 @@
1
1
  import * as t from "io-ts";
2
2
  import { DateFromISOString } from "io-ts-types";
3
+ import { WebhookType } from "./webhookType";
4
+
5
+ export const WebhookNotificationState = t.union([
6
+ t.literal("unconfirmed"),
7
+ t.literal("new"),
8
+ t.literal("pending"),
9
+ t.literal("processed"),
10
+ t.literal("failed"),
11
+ ]);
12
+
13
+ export type WebhookNotificationState = t.TypeOf<
14
+ typeof WebhookNotificationState
15
+ >;
3
16
 
4
17
  export const WebhookNotification = t.intersection([
5
18
  t.type({
19
+ /**
20
+ * @example "59cd72485007a239fb00282ed480da1f"
21
+ * @pattern ^[0-9a-f]{32}$
22
+ */
6
23
  id: t.string,
7
24
  }),
8
25
  t.partial({
9
- type: t.string,
26
+ /**
27
+ * Event type to listen to.
28
+ */
29
+ type: WebhookType,
30
+ /**
31
+ * @example cold
32
+ */
10
33
  wallet: t.string,
11
34
  url: t.string,
12
35
  hash: t.string,
36
+ /**
37
+ * A cryptocurrency or token ticker symbol.
38
+ * @example btc
39
+ */
13
40
  coin: t.string,
14
41
  coinChain: t.string,
42
+ /**
43
+ * @example receive
44
+ */
15
45
  transfer: t.string,
16
- state: t.string,
46
+ /**
47
+ * If "failed", webhook notification failed to connect with the target URL. If "new", webhook notification was newly generated, in response to an event. If "pending", webhook notification is awaiting processing by the webhook worker. If "processed", webhook notification successfully sent to target URL. If "unconfirmed", webhook notification is awaiting confirmation on the blockchain.
48
+ *
49
+ */
50
+ state: WebhookNotificationState,
17
51
  simulation: t.boolean,
18
52
  retries: t.number,
19
53
  webhook: t.string,
54
+ /**
55
+ * @example "2021-01-01T00:00:00Z"
56
+ */
20
57
  updatedAt: DateFromISOString,
58
+ /**
59
+ * @example "2021-01-01T00:00:00Z"
60
+ */
21
61
  nextAttempt: DateFromISOString,
62
+ /**
63
+ * @example 2
64
+ */
22
65
  version: t.number,
23
66
  allowBlockedHosts: t.boolean,
24
67
  heightToConfirm: t.number,
@@ -23,6 +23,8 @@ export enum WebhookTypeEnum {
23
23
  "userKycState" = "userKycState",
24
24
  "enterpriseKycState" = "enterpriseKycState",
25
25
  "identityStatus" = "identityStatus",
26
+
27
+ "accessToken" = "accessToken",
26
28
  }
27
29
 
28
30
  export const WebhookType = t.keyof(WebhookTypeEnum, "WebhookType");
@@ -51,6 +53,7 @@ export type WalletWebhookType = t.TypeOf<typeof WalletWebhookType>;
51
53
 
52
54
  export enum EnterpriseWebhookTypeEnum {
53
55
  "bankAccount" = "bankAccount",
56
+ "accessToken" = "accessToken",
54
57
  }
55
58
  export const EnterpriseWebhookType = t.keyof(
56
59
  EnterpriseWebhookTypeEnum,