@bitgo/public-types 2.27.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.
- package/dist/src/schema/webhook/webhook.js.map +1 -1
- package/dist/src/schema/webhook/webhookNotification.d.ts +4 -2
- package/dist/src/schema/webhook/webhookNotification.js +11 -3
- package/dist/src/schema/webhook/webhookNotification.js.map +1 -1
- package/package.json +1 -1
- package/src/schema/webhook/webhook.ts +47 -0
- package/src/schema/webhook/webhookNotification.ts +45 -2
@@ -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;
|
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;QAKL,EAAE,EAAE,CAAC,CAAC,MAAM;QAKZ,OAAO,EAAE,+BAAiB;QAK1B,IAAI,EAAE,CAAC,CAAC,MAAM;QAKd,GAAG,EAAE,CAAC,CAAC,MAAM;QAKb,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,KAAK,EAAE,2BAAY;QACnB,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.
|
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.
|
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:
|
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:
|
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;
|
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,O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ope";
|
|
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
|
-
|
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
|
-
|
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,
|