@bitgo/public-types 6.5.0 → 6.5.1
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/intent.d.ts +2 -2
- package/dist/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.d.ts +8 -2
- package/dist/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.js +2 -2
- package/dist/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/transactionRequest.d.ts +4 -4
- package/package.json +1 -1
- package/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.ts +44 -14
|
@@ -5414,7 +5414,7 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5414
5414
|
memo: t.StringC;
|
|
5415
5415
|
}>]>, t.TypeC<{
|
|
5416
5416
|
intentType: t.LiteralC<"closeAssociatedTokenAccount">;
|
|
5417
|
-
recipients: t.
|
|
5417
|
+
recipients: t.BrandC<t.ArrayC<t.BrandC<t.IntersectionC<[t.TypeC<{
|
|
5418
5418
|
address: t.PartialC<{
|
|
5419
5419
|
address: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
5420
5420
|
option: t.UnionC<[t.Type<{
|
|
@@ -5429,7 +5429,7 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
|
|
|
5429
5429
|
}>;
|
|
5430
5430
|
}>, t.PartialC<{
|
|
5431
5431
|
data: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
5432
|
-
}>]
|
|
5432
|
+
}>]>, import("./solCloseAssociatedTokenAccountIntent").SolCloseAssociatedTokenAccountRecipientEntryBrand>>, import("./solCloseAssociatedTokenAccountIntent").SolCloseAssociatedTokenAccountRecipientsBrand>;
|
|
5433
5433
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5434
5434
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5435
5435
|
}>, t.TypeC<{
|
package/dist/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ export type SolCloseAssociatedTokenAccountRecipient = {
|
|
|
10
10
|
};
|
|
11
11
|
data?: string | undefined;
|
|
12
12
|
};
|
|
13
|
+
export interface SolCloseAssociatedTokenAccountRecipientEntryBrand {
|
|
14
|
+
readonly SolCloseAssociatedTokenAccountRecipientEntry: unique symbol;
|
|
15
|
+
}
|
|
16
|
+
export interface SolCloseAssociatedTokenAccountRecipientsBrand {
|
|
17
|
+
readonly SolCloseAssociatedTokenAccountRecipients: unique symbol;
|
|
18
|
+
}
|
|
13
19
|
export declare const SolCloseAssociatedTokenAccountIntent: t.IntersectionC<[t.IntersectionC<[t.TypeC<{
|
|
14
20
|
intentType: t.KeyofC<{
|
|
15
21
|
payment: t.LiteralC<"payment">;
|
|
@@ -77,7 +83,7 @@ export declare const SolCloseAssociatedTokenAccountIntent: t.IntersectionC<[t.In
|
|
|
77
83
|
memo: t.StringC;
|
|
78
84
|
}>]>, t.TypeC<{
|
|
79
85
|
intentType: t.LiteralC<"closeAssociatedTokenAccount">;
|
|
80
|
-
recipients: t.
|
|
86
|
+
recipients: t.BrandC<t.ArrayC<t.BrandC<t.IntersectionC<[t.TypeC<{
|
|
81
87
|
address: t.PartialC<{
|
|
82
88
|
address: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
83
89
|
option: t.UnionC<[t.Type<{
|
|
@@ -92,7 +98,7 @@ export declare const SolCloseAssociatedTokenAccountIntent: t.IntersectionC<[t.In
|
|
|
92
98
|
}>;
|
|
93
99
|
}>, t.PartialC<{
|
|
94
100
|
data: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
95
|
-
}>]
|
|
101
|
+
}>]>, SolCloseAssociatedTokenAccountRecipientEntryBrand>>, SolCloseAssociatedTokenAccountRecipientsBrand>;
|
|
96
102
|
}>]>;
|
|
97
103
|
export type SolCloseAssociatedTokenAccountIntent = Omit<t.TypeOf<typeof SolCloseAssociatedTokenAccountIntent>, "recipients"> & {
|
|
98
104
|
recipients: SolCloseAssociatedTokenAccountRecipient[];
|
|
@@ -43,8 +43,8 @@ function isSolCloseAssociatedTokenAccountRecipient(recipient) {
|
|
|
43
43
|
}
|
|
44
44
|
return true;
|
|
45
45
|
}
|
|
46
|
-
const solCloseAssociatedTokenAccountRecipientEntry = t.
|
|
47
|
-
const solCloseAssociatedTokenAccountRecipients = t.
|
|
46
|
+
const solCloseAssociatedTokenAccountRecipientEntry = t.brand(recipientEntry_1.RecipientEntry, isSolCloseAssociatedTokenAccountRecipient, "SolCloseAssociatedTokenAccountRecipientEntry");
|
|
47
|
+
const solCloseAssociatedTokenAccountRecipients = t.brand(t.array(solCloseAssociatedTokenAccountRecipientEntry), ((recipients) => recipients.length > 0), "SolCloseAssociatedTokenAccountRecipients");
|
|
48
48
|
exports.SolCloseAssociatedTokenAccountIntent = t.intersection([
|
|
49
49
|
baseIntent_1.BaseIntent,
|
|
50
50
|
solBuildOptions_1.SolBuildOptions,
|
package/dist/src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solCloseAssociatedTokenAccountIntent.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAE3B,6CAA0C;AAC1C,6CAA2C;AAC3C,qDAAkD;AAClD,uDAAoD;AAoCpD,SAAS,yCAAyC,CAChD,SAAyB;IAEzB,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,eAAe,GAAG,SAAoC,CAAC;IAG7D,IAAI,WAAW,IAAI,eAAe,IAAI,WAAW,IAAI,eAAe,EAAE,CAAC;QACrE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,aAAa,GAAG,SAAS,CAAC,OAAgC,CAAC;IACjE,IAAI,OAAO,aAAa,EAAE,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;
|
|
1
|
+
{"version":3,"file":"solCloseAssociatedTokenAccountIntent.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/solCloseAssociatedTokenAccountIntent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAE3B,6CAA0C;AAC1C,6CAA2C;AAC3C,qDAAkD;AAClD,uDAAoD;AAoCpD,SAAS,yCAAyC,CAChD,SAAyB;IAEzB,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,eAAe,GAAG,SAAoC,CAAC;IAG7D,IAAI,WAAW,IAAI,eAAe,IAAI,WAAW,IAAI,eAAe,EAAE,CAAC;QACrE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,aAAa,GAAG,SAAS,CAAC,OAAgC,CAAC;IACjE,IAAI,OAAO,aAAa,EAAE,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AA0BD,MAAM,4CAA4C,GAAG,CAAC,CAAC,KAAK,CAC1D,+BAAc,EACd,yCAKC,EACD,8CAA8C,CAC/C,CAAC;AAMF,MAAM,wCAAwC,GAAG,CAAC,CAAC,KAAK,CACtD,CAAC,CAAC,KAAK,CAAC,4CAA4C,CAAC,EACrD,CAAC,CAAC,UAAwD,EAAE,EAAE,CAC5D,UAAU,CAAC,MAAM,GAAG,CAAC,CAKtB,EACD,0CAA0C,CAC3C,CAAC;AAWW,QAAA,oCAAoC,GAAG,CAAC,CAAC,YAAY,CAAC;IACjE,uBAAU;IACV,iCAAe;IACf,CAAC,CAAC,IAAI,CAAC;QACL,UAAU,EAAE,wBAAW,CAAC,2BAA2B;QACnD,UAAU,EAAE,wCAAwC;KACrD,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -5512,7 +5512,7 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5512
5512
|
memo: t.StringC;
|
|
5513
5513
|
}>]>, t.TypeC<{
|
|
5514
5514
|
intentType: t.LiteralC<"closeAssociatedTokenAccount">;
|
|
5515
|
-
recipients: t.
|
|
5515
|
+
recipients: t.BrandC<t.ArrayC<t.BrandC<t.IntersectionC<[t.TypeC<{
|
|
5516
5516
|
address: t.PartialC<{
|
|
5517
5517
|
address: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
5518
5518
|
option: t.UnionC<[t.Type<{
|
|
@@ -5527,7 +5527,7 @@ export declare const TransactionRequestLite: t.IntersectionC<[t.IntersectionC<[t
|
|
|
5527
5527
|
}>;
|
|
5528
5528
|
}>, t.PartialC<{
|
|
5529
5529
|
data: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
5530
|
-
}>]
|
|
5530
|
+
}>]>, import(".").SolCloseAssociatedTokenAccountRecipientEntryBrand>>, import(".").SolCloseAssociatedTokenAccountRecipientsBrand>;
|
|
5531
5531
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
5532
5532
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
5533
5533
|
}>, t.TypeC<{
|
|
@@ -16758,7 +16758,7 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16758
16758
|
memo: t.StringC;
|
|
16759
16759
|
}>]>, t.TypeC<{
|
|
16760
16760
|
intentType: t.LiteralC<"closeAssociatedTokenAccount">;
|
|
16761
|
-
recipients: t.
|
|
16761
|
+
recipients: t.BrandC<t.ArrayC<t.BrandC<t.IntersectionC<[t.TypeC<{
|
|
16762
16762
|
address: t.PartialC<{
|
|
16763
16763
|
address: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
16764
16764
|
option: t.UnionC<[t.Type<{
|
|
@@ -16773,7 +16773,7 @@ export declare const TransactionRequest: t.UnionC<[t.IntersectionC<[t.Intersecti
|
|
|
16773
16773
|
}>;
|
|
16774
16774
|
}>, t.PartialC<{
|
|
16775
16775
|
data: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
16776
|
-
}>]
|
|
16776
|
+
}>]>, import(".").SolCloseAssociatedTokenAccountRecipientEntryBrand>>, import(".").SolCloseAssociatedTokenAccountRecipientsBrand>;
|
|
16777
16777
|
}>]>, t.IntersectionC<[t.PartialC<{
|
|
16778
16778
|
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
16779
16779
|
}>, t.TypeC<{
|
package/package.json
CHANGED
|
@@ -12,14 +12,14 @@ import { SolBuildOptions } from "./solBuildOptions";
|
|
|
12
12
|
*
|
|
13
13
|
* **Address typing:** {@link Address} is `t.partial` in io-ts, so
|
|
14
14
|
* `t.TypeOf<typeof RecipientEntry>["address"]` still allows a missing inner
|
|
15
|
-
* `address`. The
|
|
16
|
-
* not narrow `TypeOf`
|
|
15
|
+
* `address`. The brand predicate rejects non-strings at **runtime**, but io-ts does
|
|
16
|
+
* not narrow `TypeOf` to this row shape—so `decode(...).right` alone will not show
|
|
17
17
|
* `address.address` as required. Use this named type (via
|
|
18
18
|
* {@link SolCloseAssociatedTokenAccountIntent}) for the stricter contract; do
|
|
19
19
|
* not widen back to plain `t.TypeOf<typeof SolCloseAssociatedTokenAccountIntent>`
|
|
20
20
|
* if you need the guarantee on `address.address`.
|
|
21
21
|
*
|
|
22
|
-
* `amount.value` must be the **exact string** `"0"`. The
|
|
22
|
+
* `amount.value` must be the **exact string** `"0"`. The predicate uses string
|
|
23
23
|
* equality (not numeric parsing), so `"0.0"`, `"0.00"`, `"00"`, `"-0"`, `"0x0"`,
|
|
24
24
|
* etc. are rejected. Construct close-ATA placeholders with the literal `"0"`.
|
|
25
25
|
*
|
|
@@ -58,24 +58,54 @@ function isSolCloseAssociatedTokenAccountRecipient(
|
|
|
58
58
|
return true;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/** Phantom brand for the close-ATA recipient row `t.brand` codec (exported for .d.ts emit). */
|
|
62
|
+
export interface SolCloseAssociatedTokenAccountRecipientEntryBrand {
|
|
63
|
+
readonly SolCloseAssociatedTokenAccountRecipientEntry: unique symbol;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Phantom brand for the non-empty close-ATA `recipients` array codec (exported for .d.ts emit). */
|
|
67
|
+
export interface SolCloseAssociatedTokenAccountRecipientsBrand {
|
|
68
|
+
readonly SolCloseAssociatedTokenAccountRecipients: unique symbol;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type RecipientEntryDecoded = t.TypeOf<typeof RecipientEntry>;
|
|
72
|
+
|
|
61
73
|
/**
|
|
62
|
-
* Internal io-ts
|
|
74
|
+
* Internal io-ts brand for one close-ATA recipient row (not exported).
|
|
63
75
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
76
|
+
* Uses {@link t.brand} instead of `t.refinement` so OpenAPI generation does not
|
|
77
|
+
* emit an unresolvable `#/components/schemas/refinement`. The predicate is cast via
|
|
78
|
+
* `unknown` to satisfy `t.brand`'s `Branded<…>` predicate type because runtime checks
|
|
79
|
+
* match the brand, while
|
|
80
|
+
* `SolCloseAssociatedTokenAccountRecipient` is a plain structural alias. For the
|
|
81
|
+
* narrowed row shape after validation, use {@link SolCloseAssociatedTokenAccountRecipient}
|
|
82
|
+
* (see {@link SolCloseAssociatedTokenAccountIntent}’s exported type, which overrides
|
|
83
|
+
* `recipients` accordingly).
|
|
69
84
|
*/
|
|
70
|
-
const solCloseAssociatedTokenAccountRecipientEntry = t.
|
|
85
|
+
const solCloseAssociatedTokenAccountRecipientEntry = t.brand(
|
|
71
86
|
RecipientEntry,
|
|
72
|
-
isSolCloseAssociatedTokenAccountRecipient
|
|
87
|
+
isSolCloseAssociatedTokenAccountRecipient as unknown as (
|
|
88
|
+
recipient: RecipientEntryDecoded,
|
|
89
|
+
) => recipient is t.Branded<
|
|
90
|
+
RecipientEntryDecoded,
|
|
91
|
+
SolCloseAssociatedTokenAccountRecipientEntryBrand
|
|
92
|
+
>,
|
|
73
93
|
"SolCloseAssociatedTokenAccountRecipientEntry",
|
|
74
94
|
);
|
|
75
95
|
|
|
76
|
-
|
|
96
|
+
type SolCloseAssociatedTokenAccountRecipientRow = t.TypeOf<
|
|
97
|
+
typeof solCloseAssociatedTokenAccountRecipientEntry
|
|
98
|
+
>;
|
|
99
|
+
|
|
100
|
+
const solCloseAssociatedTokenAccountRecipients = t.brand(
|
|
77
101
|
t.array(solCloseAssociatedTokenAccountRecipientEntry),
|
|
78
|
-
(recipients) =>
|
|
102
|
+
((recipients: SolCloseAssociatedTokenAccountRecipientRow[]) =>
|
|
103
|
+
recipients.length > 0) as unknown as (
|
|
104
|
+
recipients: SolCloseAssociatedTokenAccountRecipientRow[],
|
|
105
|
+
) => recipients is t.Branded<
|
|
106
|
+
SolCloseAssociatedTokenAccountRecipientRow[],
|
|
107
|
+
SolCloseAssociatedTokenAccountRecipientsBrand
|
|
108
|
+
>,
|
|
79
109
|
"SolCloseAssociatedTokenAccountRecipients",
|
|
80
110
|
);
|
|
81
111
|
|
|
@@ -86,7 +116,7 @@ const solCloseAssociatedTokenAccountRecipients = t.refinement(
|
|
|
86
116
|
* {@link SolCloseAssociatedTokenAccountIntent} **type alias** (below), not raw
|
|
87
117
|
* `t.TypeOf<typeof SolCloseAssociatedTokenAccountIntent>` from io-ts alone, so
|
|
88
118
|
* `recipients` rows keep {@link SolCloseAssociatedTokenAccountRecipient} narrowing
|
|
89
|
-
* (see codec
|
|
119
|
+
* (see codec limitations in that type’s docblock).
|
|
90
120
|
*/
|
|
91
121
|
export const SolCloseAssociatedTokenAccountIntent = t.intersection([
|
|
92
122
|
BaseIntent,
|