@bitgo/public-types 2.19.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.
- package/dist/src/index.d.ts +0 -1
- package/dist/src/schema/index.d.ts +1 -1
- package/dist/src/schema/index.js +1 -0
- package/dist/src/schema/index.js.map +1 -1
- package/dist/src/schema/keyGen/index.d.ts +0 -1
- package/dist/src/schema/keyGen/keyGenState.d.ts +0 -1
- package/dist/src/schema/keyGen/keyGenType.d.ts +0 -1
- package/dist/src/schema/mpcv2/common/index.d.ts +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2BroadcastMessage.d.ts +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2P2PMessage.d.ts +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2PartyFromStringOrNumber.d.ts +0 -1
- package/dist/src/schema/mpcv2/index.d.ts +0 -1
- package/dist/src/schema/mpcv2/keyGen/index.d.ts +0 -1
- package/dist/src/schema/mpcv2/keyGen/keygenRound.d.ts +0 -1
- package/dist/src/schema/mpcv2/keyGen/mpcv2KeyGenState.d.ts +0 -1
- package/dist/src/schema/mpcv2/signing/index.d.ts +0 -1
- package/dist/src/schema/mpcv2/signing/mpcv2SigningState.d.ts +0 -1
- package/dist/src/schema/mpcv2/signing/signingRound.d.ts +0 -1
- package/dist/src/schema/transactionRequest/index.d.ts +2 -0
- package/dist/src/schema/transactionRequest/index.js +19 -0
- package/dist/src/schema/transactionRequest/index.js.map +1 -0
- package/dist/src/schema/transactionRequest/transactionRequestState.d.ts +0 -1
- package/dist/src/schema/transactionRequest/transactionState.d.ts +3 -1
- package/dist/src/schema/transactionRequest/transactionState.js +3 -0
- package/dist/src/schema/transactionRequest/transactionState.js.map +1 -1
- package/dist/src/schema/transactions/coinSpecific.d.ts +0 -1
- package/dist/src/schema/transactions/index.d.ts +0 -1
- package/dist/src/schema/transactions/sendTransactions.d.ts +0 -1
- package/dist/src/schema/wallet/index.d.ts +0 -1
- package/dist/src/schema/wallet/wallet.d.ts +0 -1
- package/dist/src/schema/webhook/addWalletWebhookRequest.d.ts +4 -5
- package/dist/src/schema/webhook/enterpriseWebhooks.d.ts +3 -1
- package/dist/src/schema/webhook/index.d.ts +0 -1
- package/dist/src/schema/webhook/webhook.d.ts +3 -1
- package/dist/src/schema/webhook/webhookNotification.d.ts +0 -1
- package/dist/src/schema/webhook/webhookScope.d.ts +0 -1
- package/dist/src/schema/webhook/webhookState.d.ts +0 -1
- package/dist/src/schema/webhook/webhookType.d.ts +0 -1
- package/dist/src/utils/arrayFromSingle.d.ts +0 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/minMaxArray.d.ts +0 -1
- package/dist/src/utils/optional.d.ts +0 -1
- package/dist/src/utils/primitives.d.ts +0 -1
- package/package.json +4 -3
- package/src/index.ts +2 -0
- package/src/schema/index.ts +6 -0
- package/src/schema/keyGen/index.ts +2 -0
- package/src/schema/keyGen/keyGenState.ts +8 -0
- package/src/schema/keyGen/keyGenType.ts +7 -0
- package/src/schema/mpcv2/common/index.ts +3 -0
- package/src/schema/mpcv2/common/mpcv2BroadcastMessage.ts +24 -0
- package/src/schema/mpcv2/common/mpcv2P2PMessage.ts +14 -0
- package/src/schema/mpcv2/common/mpcv2PartyFromStringOrNumber.ts +13 -0
- package/src/schema/mpcv2/index.ts +3 -0
- package/src/schema/mpcv2/keyGen/index.ts +2 -0
- package/src/schema/mpcv2/keyGen/keygenRound.ts +70 -0
- package/src/schema/mpcv2/keyGen/mpcv2KeyGenState.ts +12 -0
- package/src/schema/mpcv2/signing/index.ts +2 -0
- package/src/schema/mpcv2/signing/mpcv2SigningState.ts +11 -0
- package/src/schema/mpcv2/signing/signingRound.ts +113 -0
- package/src/schema/transactionRequest/index.ts +2 -0
- package/src/schema/transactionRequest/transactionRequestState.ts +21 -0
- package/src/schema/transactionRequest/transactionState.ts +22 -0
- package/src/schema/transactions/coinSpecific.ts +59 -0
- package/src/schema/transactions/index.ts +1 -0
- package/src/schema/transactions/sendTransactions.ts +245 -0
- package/src/schema/wallet/index.ts +1 -0
- package/src/schema/wallet/wallet.ts +8 -0
- package/src/schema/webhook/addWalletWebhookRequest.ts +24 -0
- package/src/schema/webhook/enterpriseWebhooks.ts +44 -0
- package/src/schema/webhook/index.ts +7 -0
- package/src/schema/webhook/webhook.ts +35 -0
- package/src/schema/webhook/webhookNotification.ts +33 -0
- package/src/schema/webhook/webhookScope.ts +10 -0
- package/src/schema/webhook/webhookState.ts +9 -0
- package/src/schema/webhook/webhookType.ts +56 -0
- package/src/utils/arrayFromSingle.ts +19 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/minMaxArray.ts +27 -0
- package/src/utils/optional.ts +5 -0
- package/src/utils/primitives.ts +11 -0
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/schema/index.d.ts.map +0 -1
- package/dist/src/schema/keyGen/index.d.ts.map +0 -1
- package/dist/src/schema/keyGen/keyGenState.d.ts.map +0 -1
- package/dist/src/schema/keyGen/keyGenType.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/common/index.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2BroadcastMessage.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2P2PMessage.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2PartyFromStringOrNumber.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/index.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/keyGen/index.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/keyGen/keygenRound.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/keyGen/mpcv2KeyGenState.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/signing/index.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/signing/mpcv2SigningState.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/signing/signingRound.d.ts.map +0 -1
- package/dist/src/schema/transactionRequest/transactionRequestState.d.ts.map +0 -1
- package/dist/src/schema/transactionRequest/transactionState.d.ts.map +0 -1
- package/dist/src/schema/transactions/coinSpecific.d.ts.map +0 -1
- package/dist/src/schema/transactions/index.d.ts.map +0 -1
- package/dist/src/schema/transactions/sendTransactions.d.ts.map +0 -1
- package/dist/src/schema/wallet/index.d.ts.map +0 -1
- package/dist/src/schema/wallet/wallet.d.ts.map +0 -1
- package/dist/src/schema/webhook/addWalletWebhookRequest.d.ts.map +0 -1
- package/dist/src/schema/webhook/enterpriseWebhooks.d.ts.map +0 -1
- package/dist/src/schema/webhook/index.d.ts.map +0 -1
- package/dist/src/schema/webhook/webhook.d.ts.map +0 -1
- package/dist/src/schema/webhook/webhookNotification.d.ts.map +0 -1
- package/dist/src/schema/webhook/webhookScope.d.ts.map +0 -1
- package/dist/src/schema/webhook/webhookState.d.ts.map +0 -1
- package/dist/src/schema/webhook/webhookType.d.ts.map +0 -1
- package/dist/src/utils/arrayFromSingle.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/minMaxArray.d.ts.map +0 -1
- package/dist/src/utils/optional.d.ts.map +0 -1
- package/dist/src/utils/primitives.d.ts.map +0 -1
@@ -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,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>;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import {
|
3
|
+
optionalStringOrNumber,
|
4
|
+
optionalString,
|
5
|
+
optionalNumber,
|
6
|
+
optionalStringArray,
|
7
|
+
optionalBoolean,
|
8
|
+
optionalUnknown,
|
9
|
+
} from "../../utils";
|
10
|
+
|
11
|
+
const BaseBuildParams = {
|
12
|
+
type: t.string,
|
13
|
+
nonce: optionalNumber,
|
14
|
+
memo: t.partial({
|
15
|
+
type: optionalString,
|
16
|
+
value: optionalString,
|
17
|
+
}),
|
18
|
+
comment: optionalString,
|
19
|
+
ledgerSequenceDelta: optionalNumber,
|
20
|
+
lastLedgerSequence: optionalNumber,
|
21
|
+
feeRate: optionalStringOrNumber,
|
22
|
+
messageKey: optionalString,
|
23
|
+
previewPendingTxs: optionalBoolean,
|
24
|
+
pendingApprovalId: optionalString,
|
25
|
+
sequenceId: optionalString,
|
26
|
+
};
|
27
|
+
|
28
|
+
const ConsolidateBuildParams = {
|
29
|
+
...BaseBuildParams,
|
30
|
+
consolidateId: optionalString,
|
31
|
+
senderAddress: optionalString,
|
32
|
+
};
|
33
|
+
|
34
|
+
// Coin Specific Build Params
|
35
|
+
export const CoinSpecificBuildParams = {
|
36
|
+
avaxp: {
|
37
|
+
locktime: optionalNumber,
|
38
|
+
sourceChain: optionalString,
|
39
|
+
destinationChain: optionalString,
|
40
|
+
unspents: optionalStringArray,
|
41
|
+
},
|
42
|
+
dot: {
|
43
|
+
...ConsolidateBuildParams,
|
44
|
+
sequenceId: optionalString,
|
45
|
+
senderAddressIndex: optionalNumber,
|
46
|
+
nonce: optionalNumber,
|
47
|
+
proxyType: optionalString,
|
48
|
+
forceProxyType: optionalString,
|
49
|
+
owner: optionalUnknown,
|
50
|
+
delay: optionalUnknown,
|
51
|
+
index: optionalUnknown,
|
52
|
+
validityWindow: optionalUnknown,
|
53
|
+
version: optionalUnknown,
|
54
|
+
referenceBlock: optionalUnknown,
|
55
|
+
},
|
56
|
+
sol: {
|
57
|
+
tokenName: optionalString,
|
58
|
+
},
|
59
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./sendTransactions";
|
@@ -0,0 +1,245 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import {
|
3
|
+
Optional,
|
4
|
+
optionalString,
|
5
|
+
optionalBoolean,
|
6
|
+
optionalNumber,
|
7
|
+
optionalStringOrNumber,
|
8
|
+
optionalUnknown,
|
9
|
+
} from "../../utils";
|
10
|
+
import { CoinSpecificBuildParams } from "./coinSpecific";
|
11
|
+
|
12
|
+
const recipient = t.partial({
|
13
|
+
address: t.string,
|
14
|
+
amount: t.union([t.string, t.number]),
|
15
|
+
feeLimit: optionalString,
|
16
|
+
data: optionalString,
|
17
|
+
memo: optionalString,
|
18
|
+
tokenName: optionalString,
|
19
|
+
});
|
20
|
+
export type TransactionRecipient = t.TypeOf<typeof recipient>;
|
21
|
+
const recipients = t.array(recipient);
|
22
|
+
|
23
|
+
const eip1559 = t.partial({
|
24
|
+
maxPriorityFeePerGas: optionalString,
|
25
|
+
maxFeePerGas: optionalString,
|
26
|
+
});
|
27
|
+
|
28
|
+
const lightningPaymentRequest = t.intersection([
|
29
|
+
t.type({
|
30
|
+
invoice: t.string,
|
31
|
+
}),
|
32
|
+
t.partial({
|
33
|
+
amount: t.number,
|
34
|
+
sequenceId: t.string,
|
35
|
+
feeLimit: t.number,
|
36
|
+
feeLimitRatio: t.number,
|
37
|
+
}),
|
38
|
+
]);
|
39
|
+
export type LightningPaymentRequest = t.TypeOf<typeof lightningPaymentRequest>;
|
40
|
+
|
41
|
+
const halfSigned = t.partial({
|
42
|
+
txHex: optionalString,
|
43
|
+
recipients: Optional(recipients),
|
44
|
+
eip1559: Optional(eip1559),
|
45
|
+
isBatch: optionalBoolean,
|
46
|
+
expireTime: optionalNumber,
|
47
|
+
contractSequenceId: optionalNumber,
|
48
|
+
nextContractSequenceId: optionalNumber,
|
49
|
+
operationHash: optionalString,
|
50
|
+
signedChildPsbt: optionalString,
|
51
|
+
signature: optionalString,
|
52
|
+
lightningPaymentRequest: Optional(lightningPaymentRequest),
|
53
|
+
});
|
54
|
+
export type HalfSignedTransaction = t.TypeOf<typeof halfSigned>;
|
55
|
+
|
56
|
+
export const memo = t.partial({
|
57
|
+
type: optionalString,
|
58
|
+
value: optionalString,
|
59
|
+
});
|
60
|
+
|
61
|
+
const feeOptions = {
|
62
|
+
amount: optionalStringOrNumber,
|
63
|
+
unit: Optional(
|
64
|
+
t.union([t.literal("baseUnit"), t.literal("cpu"), t.literal("ram")]),
|
65
|
+
),
|
66
|
+
formula: Optional(
|
67
|
+
t.union([
|
68
|
+
t.literal("fixed"),
|
69
|
+
t.literal("feeRate"),
|
70
|
+
t.literal("perKB"),
|
71
|
+
t.literal("custom"),
|
72
|
+
]),
|
73
|
+
),
|
74
|
+
type: Optional(
|
75
|
+
t.union([t.literal("base"), t.literal("max"), t.literal("tip")]),
|
76
|
+
),
|
77
|
+
};
|
78
|
+
|
79
|
+
export const txSendBody = {
|
80
|
+
comment: optionalString,
|
81
|
+
consolidateId: optionalString,
|
82
|
+
halfSigned: Optional(halfSigned),
|
83
|
+
invoice: optionalString,
|
84
|
+
memo: Optional(memo),
|
85
|
+
otp: optionalString,
|
86
|
+
recipients: Optional(recipients),
|
87
|
+
suppressBroadcast: optionalBoolean,
|
88
|
+
txHex: optionalString,
|
89
|
+
txRequestId: optionalString,
|
90
|
+
videoApprovers: Optional(t.array(t.string)),
|
91
|
+
|
92
|
+
numBlocks: optionalNumber,
|
93
|
+
feeRate: optionalNumber,
|
94
|
+
maxFeeRate: optionalNumber,
|
95
|
+
minConfirms: optionalNumber,
|
96
|
+
enforceMinConfirmsForChange: optionalBoolean,
|
97
|
+
targetWalletUnspents: optionalNumber,
|
98
|
+
message: optionalString,
|
99
|
+
minValue: optionalStringOrNumber,
|
100
|
+
maxValue: optionalStringOrNumber,
|
101
|
+
sequenceId: optionalStringOrNumber,
|
102
|
+
lastLedgerSequence: optionalNumber,
|
103
|
+
ledgerSequenceDelta: optionalNumber,
|
104
|
+
gasPrice: optionalNumber,
|
105
|
+
noSplitChange: optionalBoolean,
|
106
|
+
unspents: t.array(t.string),
|
107
|
+
changeAddress: optionalString,
|
108
|
+
instant: optionalBoolean,
|
109
|
+
transferId: optionalNumber,
|
110
|
+
gasLimit: optionalNumber,
|
111
|
+
custodianTransactionId: optionalString,
|
112
|
+
|
113
|
+
cpfpTxIds: Optional(t.array(t.string)),
|
114
|
+
cpfpFeeRate: optionalNumber,
|
115
|
+
noCpfpFeeRate: optionalBoolean,
|
116
|
+
maxFee: optionalNumber,
|
117
|
+
noMaxFee: optionalBoolean,
|
118
|
+
|
119
|
+
/// all other props from wp whitelist
|
120
|
+
feeMultiplier: optionalNumber,
|
121
|
+
addressType: optionalString,
|
122
|
+
changeAddressType: optionalString,
|
123
|
+
strategy: optionalString,
|
124
|
+
strategyAllowFallback: optionalBoolean,
|
125
|
+
fee: t.union([optionalString, t.partial(feeOptions)]),
|
126
|
+
timeBounds: Optional(
|
127
|
+
t.partial({
|
128
|
+
minTime: optionalStringOrNumber,
|
129
|
+
maxTime: optionalStringOrNumber,
|
130
|
+
}),
|
131
|
+
),
|
132
|
+
idfSignedTimestamp: optionalString,
|
133
|
+
idfVersion: optionalNumber,
|
134
|
+
idfUserId: optionalString,
|
135
|
+
hopParams: t.partial({
|
136
|
+
gasPriceMax: optionalNumber,
|
137
|
+
paymentId: optionalString,
|
138
|
+
userReqSig: optionalString,
|
139
|
+
}),
|
140
|
+
validFromBlock: optionalNumber,
|
141
|
+
validToBlock: optionalNumber,
|
142
|
+
type: optionalString,
|
143
|
+
trustlines: t.partial({
|
144
|
+
token: optionalString,
|
145
|
+
action: optionalString,
|
146
|
+
limit: optionalString,
|
147
|
+
}),
|
148
|
+
reservation: t.partial({
|
149
|
+
expireTime: optionalString,
|
150
|
+
pendingApprovalId: optionalString,
|
151
|
+
}),
|
152
|
+
delayMs: optionalNumber,
|
153
|
+
messageKey: optionalString,
|
154
|
+
senderAddress: optionalString,
|
155
|
+
startTime: optionalString,
|
156
|
+
nonParticipation: optionalBoolean,
|
157
|
+
keyregTxBase64: optionalString,
|
158
|
+
closeRemainderTo: optionalString,
|
159
|
+
stateProofKey: optionalString,
|
160
|
+
contractName: optionalString,
|
161
|
+
functionName: optionalString,
|
162
|
+
eip1559: Optional(eip1559),
|
163
|
+
maxChangeOutputs: optionalNumber,
|
164
|
+
smallestChangeSplitSize: optionalNumber,
|
165
|
+
emergency: optionalBoolean,
|
166
|
+
sourceChain: optionalString,
|
167
|
+
destinationChain: optionalString,
|
168
|
+
txFormat: optionalString,
|
169
|
+
previewPendingTxs: optionalBoolean,
|
170
|
+
pendingApprovalId: optionalString,
|
171
|
+
stakingOptions: optionalUnknown,
|
172
|
+
unstakingOptions: optionalUnknown,
|
173
|
+
refundOptions: optionalUnknown,
|
174
|
+
stakingParams: t.partial({
|
175
|
+
actionType: optionalString,
|
176
|
+
validator: optionalString,
|
177
|
+
coin: optionalString,
|
178
|
+
amount: optionalString,
|
179
|
+
}),
|
180
|
+
isReplaceableByFee: optionalBoolean,
|
181
|
+
rbfTxIds: Optional(t.array(t.string)),
|
182
|
+
};
|
183
|
+
|
184
|
+
export const TxSendBody = t.exact(
|
185
|
+
t.intersection([
|
186
|
+
t.partial(txSendBody, "TxSendBody"),
|
187
|
+
t.partial(CoinSpecificBuildParams.avaxp),
|
188
|
+
t.partial(CoinSpecificBuildParams.dot),
|
189
|
+
t.partial(CoinSpecificBuildParams.sol),
|
190
|
+
]),
|
191
|
+
);
|
192
|
+
export type TxSendBody = t.TypeOf<typeof TxSendBody>;
|
193
|
+
|
194
|
+
const entry = t.partial({
|
195
|
+
address: t.string,
|
196
|
+
wallet: t.string,
|
197
|
+
value: t.number,
|
198
|
+
valueString: t.string,
|
199
|
+
isChange: t.boolean,
|
200
|
+
isPayGo: t.boolean,
|
201
|
+
});
|
202
|
+
const historyItem = t.partial({
|
203
|
+
date: t.string,
|
204
|
+
action: t.string,
|
205
|
+
user: t.string,
|
206
|
+
});
|
207
|
+
|
208
|
+
export const TxSendResponse = t.partial({
|
209
|
+
baseValue: t.number,
|
210
|
+
baseValueString: t.string,
|
211
|
+
coin: t.string,
|
212
|
+
coinSpecific: t.record(t.string, t.unknown),
|
213
|
+
createdTime: t.string,
|
214
|
+
date: t.string,
|
215
|
+
enterprise: t.string,
|
216
|
+
entries: t.array(entry),
|
217
|
+
feeString: t.string,
|
218
|
+
height: t.number,
|
219
|
+
heightId: t.string,
|
220
|
+
history: t.array(historyItem),
|
221
|
+
id: t.string,
|
222
|
+
instant: t.boolean,
|
223
|
+
intendedValueString: t.string,
|
224
|
+
isFee: t.boolean,
|
225
|
+
isReward: t.boolean,
|
226
|
+
metadata: t.record(t.string, t.unknown),
|
227
|
+
payGoFee: t.number,
|
228
|
+
payGoFeeString: t.string,
|
229
|
+
signedDate: t.string,
|
230
|
+
signedTime: t.string,
|
231
|
+
state: t.string,
|
232
|
+
tags: t.array(t.string),
|
233
|
+
txid: t.string,
|
234
|
+
txidType: t.string,
|
235
|
+
txRequestId: t.string,
|
236
|
+
type: t.string,
|
237
|
+
usd: t.number,
|
238
|
+
usdRate: t.number,
|
239
|
+
value: t.number,
|
240
|
+
valueString: t.string,
|
241
|
+
vSize: t.number,
|
242
|
+
wallet: t.string,
|
243
|
+
walletType: t.string,
|
244
|
+
});
|
245
|
+
export type TxSendResponse = t.TypeOf<typeof TxSendResponse>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./wallet";
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import { NonEmptyString, NumberFromString } from "io-ts-types";
|
3
|
+
import { Optional } from "../../utils/optional";
|
4
|
+
import { TransactionRequestState } from "../transactionRequest/transactionRequestState";
|
5
|
+
import { TransactionState } from "../transactionRequest/transactionState";
|
6
|
+
import { WalletWebhookType } from "./webhookType";
|
7
|
+
|
8
|
+
export const AddWalletWebhookRequestBody = {
|
9
|
+
type: WalletWebhookType,
|
10
|
+
url: NonEmptyString,
|
11
|
+
label: Optional(t.string),
|
12
|
+
numConfirmations: t.union([t.number, NumberFromString, t.undefined]),
|
13
|
+
allToken: Optional(t.boolean),
|
14
|
+
listenToFailureStates: Optional(t.boolean),
|
15
|
+
txRequestStates: Optional(t.array(TransactionRequestState)),
|
16
|
+
txRequestTransactionStates: Optional(t.array(TransactionState)),
|
17
|
+
};
|
18
|
+
export const AddWalletWebhookRequestBodyC = t.type({
|
19
|
+
...AddWalletWebhookRequestBody,
|
20
|
+
});
|
21
|
+
|
22
|
+
export type AddWalletWebhookRequestBody = t.TypeOf<
|
23
|
+
typeof AddWalletWebhookRequestBodyC
|
24
|
+
>;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { EnterpriseWebhookType } from "./webhookType";
|
2
|
+
import { NonEmptyString } from "io-ts-types";
|
3
|
+
import { Optional, optionalString, optionalStringOrNumber } from "../../utils";
|
4
|
+
import * as t from "io-ts";
|
5
|
+
import { Webhook } from "./webhook";
|
6
|
+
|
7
|
+
export const AddEnterpriseWebhookRequestBody = {
|
8
|
+
type: EnterpriseWebhookType,
|
9
|
+
url: NonEmptyString,
|
10
|
+
label: Optional(t.string),
|
11
|
+
};
|
12
|
+
export const AddEnterpriseWebhookRequestBodyC = t.type({
|
13
|
+
...AddEnterpriseWebhookRequestBody,
|
14
|
+
});
|
15
|
+
|
16
|
+
export type AddEnterpriseWebhookRequestBody = t.TypeOf<
|
17
|
+
typeof AddEnterpriseWebhookRequestBodyC
|
18
|
+
>;
|
19
|
+
|
20
|
+
export const ListEnterpriseWebhooksRequestBody = {
|
21
|
+
type: Optional(EnterpriseWebhookType),
|
22
|
+
limit: optionalStringOrNumber,
|
23
|
+
prevId: optionalString,
|
24
|
+
};
|
25
|
+
|
26
|
+
export const ListEnterpriseWebhooksRequestBodyC = t.type({
|
27
|
+
...ListEnterpriseWebhooksRequestBody,
|
28
|
+
});
|
29
|
+
|
30
|
+
export type ListEnterpriseWebhooksRequestBody = t.TypeOf<
|
31
|
+
typeof ListEnterpriseWebhooksRequestBodyC
|
32
|
+
>;
|
33
|
+
|
34
|
+
export const ListEnterpriseWebhooksResponse = t.intersection([
|
35
|
+
t.type({
|
36
|
+
webhooks: t.array(Webhook),
|
37
|
+
}),
|
38
|
+
t.partial({
|
39
|
+
nextBatchPrevId: Optional(t.union([t.string, t.undefined])),
|
40
|
+
}),
|
41
|
+
]);
|
42
|
+
export type ListEnterpriseWebhooksResponse = t.TypeOf<
|
43
|
+
typeof ListEnterpriseWebhooksResponse
|
44
|
+
>;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import { DateFromISOString } from "io-ts-types";
|
3
|
+
import { TransactionRequestState } from "../transactionRequest/transactionRequestState";
|
4
|
+
import { TransactionState } from "../transactionRequest/transactionState";
|
5
|
+
import { WebhookState } from "./webhookState";
|
6
|
+
import { WebhookType } from "./webhookType";
|
7
|
+
import { WebhookScope } from "./webhookScope";
|
8
|
+
|
9
|
+
export const Webhook = t.intersection([
|
10
|
+
t.type({
|
11
|
+
id: t.string,
|
12
|
+
created: DateFromISOString,
|
13
|
+
coin: t.string,
|
14
|
+
url: t.string,
|
15
|
+
version: t.number,
|
16
|
+
state: WebhookState,
|
17
|
+
successiveFailedAttempts: t.number,
|
18
|
+
listenToFailureStates: t.boolean,
|
19
|
+
}),
|
20
|
+
t.partial({
|
21
|
+
label: t.string,
|
22
|
+
walletId: t.string,
|
23
|
+
enterpriseId: t.string,
|
24
|
+
organizationId: t.string,
|
25
|
+
scope: WebhookScope,
|
26
|
+
userId: t.string,
|
27
|
+
type: WebhookType,
|
28
|
+
numConfirmations: t.number,
|
29
|
+
lastAttempt: DateFromISOString,
|
30
|
+
failingSince: DateFromISOString,
|
31
|
+
allToken: t.boolean,
|
32
|
+
txRequestStates: t.array(TransactionRequestState),
|
33
|
+
txRequestTransactionStates: t.array(TransactionState),
|
34
|
+
}),
|
35
|
+
]);
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import { DateFromISOString } from "io-ts-types";
|
3
|
+
|
4
|
+
export const WebhookNotification = t.intersection([
|
5
|
+
t.type({
|
6
|
+
id: t.string,
|
7
|
+
}),
|
8
|
+
t.partial({
|
9
|
+
type: t.string,
|
10
|
+
wallet: t.string,
|
11
|
+
url: t.string,
|
12
|
+
hash: t.string,
|
13
|
+
coin: t.string,
|
14
|
+
coinChain: t.string,
|
15
|
+
transfer: t.string,
|
16
|
+
state: t.string,
|
17
|
+
simulation: t.boolean,
|
18
|
+
retries: t.number,
|
19
|
+
webhook: t.string,
|
20
|
+
updatedAt: DateFromISOString,
|
21
|
+
nextAttempt: DateFromISOString,
|
22
|
+
version: t.number,
|
23
|
+
allowBlockedHosts: t.boolean,
|
24
|
+
heightToConfirm: t.number,
|
25
|
+
payload: t.string,
|
26
|
+
response: t.partial({
|
27
|
+
code: t.unknown,
|
28
|
+
type: t.string,
|
29
|
+
body: t.string,
|
30
|
+
error: t.string,
|
31
|
+
}),
|
32
|
+
}),
|
33
|
+
]);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
|
3
|
+
export enum WebhookScopeEnum {
|
4
|
+
"wallet" = "wallet",
|
5
|
+
"enterprise" = "enterprise",
|
6
|
+
"organization" = "organization",
|
7
|
+
}
|
8
|
+
|
9
|
+
export const WebhookScope = t.keyof(WebhookScopeEnum, "WebhookScope");
|
10
|
+
export type WebhookScope = t.TypeOf<typeof WebhookScope>;
|