@bitgo/public-types 6.78.3 → 6.78.4
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/transactionRequest/intents/cantonTransferAcknowledgeIntent.d.ts +5 -2
- package/dist/src/schema/transactionRequest/intents/cantonTransferAcknowledgeIntent.js +1 -7
- package/dist/src/schema/transactionRequest/intents/cantonTransferAcknowledgeIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/intent.d.ts +1 -1
- package/dist/src/schema/transactionRequest/transactionRequest.d.ts +2 -2
- package/package.json +2 -7
- package/src/schema/transactionRequest/intents/cantonTransferAcknowledgeIntent.ts +9 -15
- package/openapi-gen.config.js +0 -3
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
export
|
|
2
|
+
export interface CantonAmountBrand {
|
|
3
|
+
readonly CantonAmount: unique symbol;
|
|
4
|
+
}
|
|
5
|
+
export declare const CantonAmount: t.BrandC<t.StringC, CantonAmountBrand>;
|
|
3
6
|
export declare const CantonTransferAcknowledgeIntent: t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
4
7
|
intentType: t.KeyofC<{
|
|
5
8
|
payment: t.LiteralC<"payment">;
|
|
@@ -90,7 +93,7 @@ export declare const CantonTransferAcknowledgeIntent: t.IntersectionC<[t.Interse
|
|
|
90
93
|
contractId: t.StringC;
|
|
91
94
|
senderPartyId: t.StringC;
|
|
92
95
|
updateId: t.StringC;
|
|
93
|
-
amount: t.
|
|
96
|
+
amount: t.BrandC<t.StringC, CantonAmountBrand>;
|
|
94
97
|
expiry: t.NumberC;
|
|
95
98
|
}>, t.PartialC<{
|
|
96
99
|
memoId: t.StringC;
|
|
@@ -28,13 +28,7 @@ const t = __importStar(require("io-ts"));
|
|
|
28
28
|
const baseIntent_1 = require("./baseIntent");
|
|
29
29
|
const intentType_1 = require("./intentType");
|
|
30
30
|
const CANTON_DECIMAL_AMOUNT = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/;
|
|
31
|
-
|
|
32
|
-
if (typeof value === "string") {
|
|
33
|
-
return CANTON_DECIMAL_AMOUNT.test(value);
|
|
34
|
-
}
|
|
35
|
-
return typeof value === "number" && Number.isSafeInteger(value);
|
|
36
|
-
}
|
|
37
|
-
exports.CantonAmount = new t.Type("CantonAmount", isCantonAmount, (value, context) => isCantonAmount(value) ? t.success(value) : t.failure(value, context), t.identity);
|
|
31
|
+
exports.CantonAmount = t.brand(t.string, ((value) => CANTON_DECIMAL_AMOUNT.test(value)), "CantonAmount");
|
|
38
32
|
exports.CantonTransferAcknowledgeIntent = t.intersection([
|
|
39
33
|
baseIntent_1.BaseIntent,
|
|
40
34
|
t.type({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cantonTransferAcknowledgeIntent.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/cantonTransferAcknowledgeIntent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAA0C;AAC1C,6CAA2C;AAE3C,MAAM,qBAAqB,GAAG,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"cantonTransferAcknowledgeIntent.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/cantonTransferAcknowledgeIntent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAA0C;AAC1C,6CAA2C;AAE3C,MAAM,qBAAqB,GAAG,gCAAgC,CAAC;AAUlD,QAAA,YAAY,GAAG,CAAC,CAAC,KAAK,CACjC,CAAC,CAAC,MAAM,EACR,CAAC,CAAC,KAAa,EAAiD,EAAE,CAChE,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAEe,EAClD,cAAc,CACf,CAAC;AAkBW,QAAA,+BAA+B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC5D,uBAAU;IACV,CAAC,CAAC,IAAI,CAAC;QACL,UAAU,EAAE,wBAAW,CAAC,mBAAmB;QAC3C,UAAU,EAAE,CAAC,CAAC,MAAM;QACpB,aAAa,EAAE,CAAC,CAAC,MAAM;QACvB,QAAQ,EAAE,CAAC,CAAC,MAAM;QAClB,MAAM,EAAE,oBAAY;QACpB,MAAM,EAAE,CAAC,CAAC,MAAM;KACjB,CAAC;IACF,CAAC,CAAC,OAAO,CAAC;QACR,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,KAAK,EAAE,CAAC,CAAC,MAAM;KAChB,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -2901,7 +2901,7 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
2901
2901
|
contractId: t.StringC;
|
|
2902
2902
|
senderPartyId: t.StringC;
|
|
2903
2903
|
updateId: t.StringC;
|
|
2904
|
-
amount: t.
|
|
2904
|
+
amount: t.BrandC<t.StringC, import("./cantonTransferAcknowledgeIntent").CantonAmountBrand>;
|
|
2905
2905
|
expiry: t.NumberC;
|
|
2906
2906
|
}>, t.PartialC<{
|
|
2907
2907
|
memoId: t.StringC;
|
|
@@ -2999,7 +2999,7 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
2999
2999
|
contractId: t.StringC;
|
|
3000
3000
|
senderPartyId: t.StringC;
|
|
3001
3001
|
updateId: t.StringC;
|
|
3002
|
-
amount: t.
|
|
3002
|
+
amount: t.BrandC<t.StringC, import(".").CantonAmountBrand>;
|
|
3003
3003
|
expiry: t.NumberC;
|
|
3004
3004
|
}>, t.PartialC<{
|
|
3005
3005
|
memoId: t.StringC;
|
|
@@ -20335,7 +20335,7 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
20335
20335
|
contractId: t.StringC;
|
|
20336
20336
|
senderPartyId: t.StringC;
|
|
20337
20337
|
updateId: t.StringC;
|
|
20338
|
-
amount: t.
|
|
20338
|
+
amount: t.BrandC<t.StringC, import(".").CantonAmountBrand>;
|
|
20339
20339
|
expiry: t.NumberC;
|
|
20340
20340
|
}>, t.PartialC<{
|
|
20341
20341
|
memoId: t.StringC;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitgo/public-types",
|
|
3
|
-
"version": "6.78.
|
|
3
|
+
"version": "6.78.4",
|
|
4
4
|
"description": "Collection of types exposed externally as part of the BitGo public API",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "",
|
|
@@ -11,14 +11,9 @@
|
|
|
11
11
|
"main": "dist/src/index.js",
|
|
12
12
|
"types": "dist/src/index.d.ts",
|
|
13
13
|
"source": "src/index.ts",
|
|
14
|
-
"customCodecFile": "openapi-gen.config.js",
|
|
15
|
-
"openapi-generator": {
|
|
16
|
-
"codec-file": "openapi-gen.config.js"
|
|
17
|
-
},
|
|
18
14
|
"files": [
|
|
19
15
|
"dist/src/",
|
|
20
|
-
"src"
|
|
21
|
-
"openapi-gen.config.js"
|
|
16
|
+
"src"
|
|
22
17
|
],
|
|
23
18
|
"scripts": {
|
|
24
19
|
"build": "tsc --build --incremental --verbose .",
|
|
@@ -4,27 +4,21 @@ import { intentTypes } from "./intentType";
|
|
|
4
4
|
|
|
5
5
|
const CANTON_DECIMAL_AMOUNT = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return CANTON_DECIMAL_AMOUNT.test(value);
|
|
10
|
-
}
|
|
11
|
-
return typeof value === "number" && Number.isSafeInteger(value);
|
|
7
|
+
export interface CantonAmountBrand {
|
|
8
|
+
readonly CantonAmount: unique symbol;
|
|
12
9
|
}
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
12
|
* Exact Canton decimal-string amount codec.
|
|
16
|
-
*
|
|
13
|
+
* API amounts remain strings so the OpenAPI schema stays backward compatible.
|
|
17
14
|
*/
|
|
18
|
-
export const CantonAmount =
|
|
19
|
-
string
|
|
20
|
-
string
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
export const CantonAmount = t.brand(
|
|
16
|
+
t.string,
|
|
17
|
+
((value: string): value is t.Branded<string, CantonAmountBrand> =>
|
|
18
|
+
CANTON_DECIMAL_AMOUNT.test(value)) as (
|
|
19
|
+
value: string,
|
|
20
|
+
) => value is t.Branded<string, CantonAmountBrand>,
|
|
23
21
|
"CantonAmount",
|
|
24
|
-
isCantonAmount,
|
|
25
|
-
(value, context) =>
|
|
26
|
-
isCantonAmount(value) ? t.success(value) : t.failure(value, context),
|
|
27
|
-
t.identity,
|
|
28
22
|
);
|
|
29
23
|
/**
|
|
30
24
|
* @title Canton Transfer Acknowledge Intent
|
package/openapi-gen.config.js
DELETED