@bitgo/public-types 7.6.2 → 7.6.3

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.
@@ -99,8 +99,106 @@ export declare const BaseIntent: t.IntersectionC<[t.TypeC<{
99
99
  nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
100
100
  }>]>;
101
101
  export type BaseIntent = t.TypeOf<typeof BaseIntent>;
102
- export declare const BaseIntentCatchAll: t.Type<BaseIntent>;
103
- export type BaseIntentCatchAll = BaseIntent;
102
+ export declare const BaseIntentCatchAll: t.RefinementC<t.IntersectionC<[t.TypeC<{
103
+ intentType: t.KeyofC<{
104
+ payment: t.LiteralC<"payment">;
105
+ transferToken: t.LiteralC<"transferToken">;
106
+ consolidate: t.LiteralC<"consolidate">;
107
+ consolidateToken: t.LiteralC<"consolidateToken">;
108
+ fanout: t.LiteralC<"fanout">;
109
+ stake: t.LiteralC<"stake">;
110
+ unstake: t.LiteralC<"unstake">;
111
+ cancel: t.LiteralC<"cancel">;
112
+ delegate: t.LiteralC<"delegate">;
113
+ undelegate: t.LiteralC<"undelegate">;
114
+ switchValidator: t.LiteralC<"switchValidator">;
115
+ claim: t.LiteralC<"claim">;
116
+ stakeClaimRewards: t.LiteralC<"stakeClaimRewards">;
117
+ pledge: t.LiteralC<"pledge">;
118
+ voteDelegation: t.LiteralC<"voteDelegation">;
119
+ vote: t.LiteralC<"vote">;
120
+ createAccount: t.LiteralC<"createAccount">;
121
+ updateAccount: t.LiteralC<"updateAccount">;
122
+ addTrustLine: t.LiteralC<"addTrustLine">;
123
+ removeTrustLine: t.LiteralC<"removeTrustLine">;
124
+ signMessage: t.LiteralC<"signMessage">;
125
+ signTypedStructuredData: t.LiteralC<"signTypedStructuredData">;
126
+ enableToken: t.LiteralC<"enableToken">;
127
+ disableToken: t.LiteralC<"disableToken">;
128
+ authorize: t.LiteralC<"authorize">;
129
+ acceleration: t.LiteralC<"acceleration">;
130
+ fillNonce: t.LiteralC<"fillNonce">;
131
+ walletRecovery: t.LiteralC<"walletRecovery">;
132
+ contractCall: t.LiteralC<"contractCall">;
133
+ deactivate: t.LiteralC<"deactivate">;
134
+ customTx: t.LiteralC<"customTx">;
135
+ confidentialTransfer: t.LiteralC<"confidentialTransfer">;
136
+ closeAssociatedTokenAccount: t.LiteralC<"closeAssociatedTokenAccount">;
137
+ stakeWithCallData: t.LiteralC<"stakeWithCallData">;
138
+ unstakeWithCallData: t.LiteralC<"unstakeWithCallData">;
139
+ switchValidatorWithCallData: t.LiteralC<"switchValidatorWithCallData">;
140
+ feeAddressTransfer: t.LiteralC<"feeAddressTransfer">;
141
+ tokenApproval: t.LiteralC<"tokenApproval">;
142
+ transferStake: t.LiteralC<"transferStake">;
143
+ validatorRegistration: t.LiteralC<"validatorRegistration">;
144
+ increaseStake: t.LiteralC<"increaseStake">;
145
+ decreaseStake: t.LiteralC<"decreaseStake">;
146
+ signalExit: t.LiteralC<"signalExit">;
147
+ withdrawStake: t.LiteralC<"withdrawStake">;
148
+ spotTransfer: t.LiteralC<"spotTransfer">;
149
+ bridgeFunds: t.LiteralC<"bridgeFunds">;
150
+ enableBridging: t.LiteralC<"enableBridging">;
151
+ goUnstake: t.LiteralC<"goUnstake">;
152
+ createBtcDelegation: t.LiteralC<"createBtcDelegation">;
153
+ transferAccept: t.LiteralC<"transferAccept">;
154
+ transferReject: t.LiteralC<"transferReject">;
155
+ transferAcknowledge: t.LiteralC<"transferAcknowledge">;
156
+ transferOfferWithdrawn: t.LiteralC<"transferOfferWithdrawn">;
157
+ cosignDelegationProposal: t.LiteralC<"cosignDelegationProposal">;
158
+ cosignDelegationAccept: t.LiteralC<"cosignDelegationAccept">;
159
+ allocationRequest: t.LiteralC<"allocationRequest">;
160
+ cantonCommand: t.LiteralC<"cantonCommand">;
161
+ cantonBroadridgeStandingDelegation: t.LiteralC<"cantonBroadridgeStandingDelegation">;
162
+ allocationAllocate: t.LiteralC<"allocationAllocate">;
163
+ allocationOfferWithdrawn: t.LiteralC<"allocationOfferWithdrawn">;
164
+ allocationReject: t.LiteralC<"allocationReject">;
165
+ cantonEndInvestorOnboardingOffer: t.LiteralC<"cantonEndInvestorOnboardingOffer">;
166
+ cantonEndInvestorOnboardingAccept: t.LiteralC<"cantonEndInvestorOnboardingAccept">;
167
+ cantonEndInvestorOnboardingReject: t.LiteralC<"cantonEndInvestorOnboardingReject">;
168
+ cantonEndInvestorOnboardingCancel: t.LiteralC<"cantonEndInvestorOnboardingCancel">;
169
+ cantonEndInvestorOffboarding: t.LiteralC<"cantonEndInvestorOffboarding">;
170
+ cantonParticipantOnboardingRequest: t.LiteralC<"cantonParticipantOnboardingRequest">;
171
+ cantonParticipantAllowListAdd: t.LiteralC<"cantonParticipantAllowListAdd">;
172
+ cantonParticipantAllowListRemove: t.LiteralC<"cantonParticipantAllowListRemove">;
173
+ cantonGovernanceLockCreate: t.LiteralC<"cantonGovernanceLockCreate">;
174
+ cantonGovernanceLockUnlock: t.LiteralC<"cantonGovernanceLockUnlock">;
175
+ cantonGovernanceLockProvisionalUnlock: t.LiteralC<"cantonGovernanceLockProvisionalUnlock">;
176
+ cantonGovernanceLockWithdraw: t.LiteralC<"cantonGovernanceLockWithdraw">;
177
+ cantonGovernanceLockProposeSubstitution: t.LiteralC<"cantonGovernanceLockProposeSubstitution">;
178
+ cantonGovernanceLockProposeTransfer: t.LiteralC<"cantonGovernanceLockProposeTransfer">;
179
+ "defi-deposit": t.LiteralC<"defi-deposit">;
180
+ "defi-redeem": t.LiteralC<"defi-redeem">;
181
+ "defi-approve": t.LiteralC<"defi-approve">;
182
+ "defi-withdraw": t.LiteralC<"defi-withdraw">;
183
+ "wrap-native": t.LiteralC<"wrap-native">;
184
+ "unwrap-native": t.LiteralC<"unwrap-native">;
185
+ wrapApprove: t.LiteralC<"wrapApprove">;
186
+ wrap: t.LiteralC<"wrap">;
187
+ unwrap: t.LiteralC<"unwrap">;
188
+ finalizeUnwrap: t.LiteralC<"finalizeUnwrap">;
189
+ delegateResource: t.LiteralC<"delegateResource">;
190
+ undelegateResource: t.LiteralC<"undelegateResource">;
191
+ stacksRegisterForBond: t.LiteralC<"stacksRegisterForBond">;
192
+ export: t.LiteralC<"export">;
193
+ import: t.LiteralC<"import">;
194
+ importtoc: t.LiteralC<"importtoc">;
195
+ }>;
196
+ }>, t.PartialC<{
197
+ sequenceId: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
198
+ comment: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
199
+ nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
200
+ }>]>>;
201
+ export type BaseIntentCatchAll = t.TypeOf<typeof BaseIntentCatchAll>;
104
202
  export declare const BaseIntentWithoutNonce: t.IntersectionC<[t.TypeC<{
105
203
  intentType: t.KeyofC<{
106
204
  payment: t.LiteralC<"payment">;
@@ -30,17 +30,15 @@ const utils_1 = require("../../../utils");
30
30
  const recipientEntry_1 = require("./recipientEntry");
31
31
  const tokenRecipientEntry_1 = require("./tokenRecipientEntry");
32
32
  const amount_1 = require("./amount");
33
- const BaseIntentRequired = t.type({
34
- intentType: intentType_1.IntentType,
35
- });
36
- const BaseIntentOptional = t.partial({
37
- sequenceId: utils_1.optionalString,
38
- comment: utils_1.optionalString,
39
- nonce: (0, utils_1.Optional)(t.union([t.string, t.number])),
40
- });
41
33
  exports.BaseIntent = t.intersection([
42
- BaseIntentRequired,
43
- BaseIntentOptional,
34
+ t.type({
35
+ intentType: intentType_1.IntentType,
36
+ }),
37
+ t.partial({
38
+ sequenceId: utils_1.optionalString,
39
+ comment: utils_1.optionalString,
40
+ nonce: (0, utils_1.Optional)(t.union([t.string, t.number])),
41
+ }),
44
42
  ]);
45
43
  const CATCH_ALL_EXCLUDED_INTENT_TYPES = [
46
44
  intentType_1.intentTypes.cantonGovernanceLockCreate.value,
@@ -50,14 +48,7 @@ const CATCH_ALL_EXCLUDED_INTENT_TYPES = [
50
48
  intentType_1.intentTypes.cantonGovernanceLockProposeSubstitution.value,
51
49
  intentType_1.intentTypes.cantonGovernanceLockProposeTransfer.value,
52
50
  ];
53
- const CatchAllIntentTypes = Object.fromEntries(Object.entries(intentType_1.intentTypes).filter(([key]) => !CATCH_ALL_EXCLUDED_INTENT_TYPES.includes(key)));
54
- const BaseIntentCatchAllRuntime = t.intersection([
55
- t.type({ intentType: t.keyof(CatchAllIntentTypes) }),
56
- BaseIntentOptional,
57
- ]);
58
- exports.BaseIntentCatchAll = BaseIntentCatchAllRuntime;
59
- const _catchAllGuardsHold = [true, true];
60
- void _catchAllGuardsHold;
51
+ exports.BaseIntentCatchAll = t.refinement(exports.BaseIntent, (intent) => !CATCH_ALL_EXCLUDED_INTENT_TYPES.includes(intent.intentType), "BaseIntentCatchAll");
61
52
  exports.BaseIntentWithoutNonce = t.intersection([
62
53
  t.type({
63
54
  intentType: intentType_1.IntentType,
@@ -1 +1 @@
1
- {"version":3,"file":"baseIntent.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/baseIntent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAAuD;AACvD,0CAA0D;AAC1D,qDAAkD;AAClD,+DAA4D;AAC5D,qCAAkC;AAMlC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IAChC,UAAU,EAAE,uBAAU;CACvB,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,OAAO,CAAC;IAEnC,UAAU,EAAE,sBAAc;IAE1B,OAAO,EAAE,sBAAc;IAEvB,KAAK,EAAE,IAAA,gBAAQ,EAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;CAC/C,CAAC,CAAC;AAEU,QAAA,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC;IACvC,kBAAkB;IAClB,kBAAkB;CACnB,CAAC,CAAC;AAUH,MAAM,+BAA+B,GAAG;IACtC,wBAAW,CAAC,0BAA0B,CAAC,KAAK;IAC5C,wBAAW,CAAC,0BAA0B,CAAC,KAAK;IAC5C,wBAAW,CAAC,qCAAqC,CAAC,KAAK;IACvD,wBAAW,CAAC,4BAA4B,CAAC,KAAK;IAC9C,wBAAW,CAAC,uCAAuC,CAAC,KAAK;IACzD,wBAAW,CAAC,mCAAmC,CAAC,KAAK;CAC7C,CAAC;AAYX,MAAM,mBAAmB,GAAG,MAAM,CAAC,WAAW,CAE1C,MAAM,CAAC,OAAO,CAAC,wBAAW,CAG3B,CAAC,MAAM,CACN,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CACR,CAAE,+BAAyD,CAAC,QAAQ,CAAC,GAAG,CAAC,CAC5E,CACwB,CAAC;AAe5B,MAAM,yBAAyB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC/C,CAAC,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC;IACpD,kBAAkB;CACnB,CAAC,CAAC;AAEU,QAAA,kBAAkB,GAC7B,yBAA0D,CAAC;AAkB7D,MAAM,mBAAmB,GAGrB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACjB,KAAK,mBAAmB,CAAC;AAEZ,QAAA,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAAC;IACnD,CAAC,CAAC,IAAI,CAAC;QACL,UAAU,EAAE,uBAAU;KACvB,CAAC;IACF,CAAC,CAAC,OAAO,CAAC;QAER,UAAU,EAAE,sBAAc;QAE1B,OAAO,EAAE,sBAAc;KACxB,CAAC;CACH,CAAC,CAAC;AAiCU,QAAA,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAE7C,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,+BAAc,CAAC;CACpC,CAAC,CAAC;AAoBU,QAAA,6BAA6B,GAAG,CAAC,CAAC,IAAI,CAAC;IAElD,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,yCAAmB,CAAC;CACzC,CAAC,CAAC;AAUU,QAAA,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC,KAAK,CACjB,CAAC,CAAC,OAAO,CAAC;QACR,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC;YACnB,SAAS,EAAE,CAAC,CAAC,MAAM;SACpB,CAAC;KACH,CAAC,CACH;CACF,CAAC,CAAC;AAgBU,QAAA,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC;IAE5C,SAAS,EAAE,CAAC,CAAC,MAAM;CACpB,CAAC,CAAC;AAmBU,QAAA,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC;IAEzC,MAAM,EAAE,eAAM;CACf,CAAC,CAAC"}
1
+ {"version":3,"file":"baseIntent.js","sourceRoot":"","sources":["../../../../../src/schema/transactionRequest/intents/baseIntent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAAuD;AACvD,0CAA0D;AAC1D,qDAAkD;AAClD,+DAA4D;AAC5D,qCAAkC;AAKrB,QAAA,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC;IACvC,CAAC,CAAC,IAAI,CAAC;QACL,UAAU,EAAE,uBAAU;KACvB,CAAC;IACF,CAAC,CAAC,OAAO,CAAC;QAER,UAAU,EAAE,sBAAc;QAE1B,OAAO,EAAE,sBAAc;QAEvB,KAAK,EAAE,IAAA,gBAAQ,EAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;KAC/C,CAAC;CACH,CAAC,CAAC;AAUH,MAAM,+BAA+B,GAA0B;IAC7D,wBAAW,CAAC,0BAA0B,CAAC,KAAK;IAC5C,wBAAW,CAAC,0BAA0B,CAAC,KAAK;IAC5C,wBAAW,CAAC,qCAAqC,CAAC,KAAK;IACvD,wBAAW,CAAC,4BAA4B,CAAC,KAAK;IAC9C,wBAAW,CAAC,uCAAuC,CAAC,KAAK;IACzD,wBAAW,CAAC,mCAAmC,CAAC,KAAK;CACtD,CAAC;AAcW,QAAA,kBAAkB,GAAG,CAAC,CAAC,UAAU,CAC5C,kBAAU,EACV,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,+BAA+B,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EACxE,oBAAoB,CACrB,CAAC;AAIW,QAAA,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAAC;IACnD,CAAC,CAAC,IAAI,CAAC;QACL,UAAU,EAAE,uBAAU;KACvB,CAAC;IACF,CAAC,CAAC,OAAO,CAAC;QAER,UAAU,EAAE,sBAAc;QAE1B,OAAO,EAAE,sBAAc;KACxB,CAAC;CACH,CAAC,CAAC;AAiCU,QAAA,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAE7C,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,+BAAc,CAAC;CACpC,CAAC,CAAC;AAoBU,QAAA,6BAA6B,GAAG,CAAC,CAAC,IAAI,CAAC;IAElD,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,yCAAmB,CAAC;CACzC,CAAC,CAAC;AAUU,QAAA,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC,KAAK,CACjB,CAAC,CAAC,OAAO,CAAC;QACR,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC;YACnB,SAAS,EAAE,CAAC,CAAC,MAAM;SACpB,CAAC;KACH,CAAC,CACH;CACF,CAAC,CAAC;AAgBU,QAAA,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC;IAE5C,SAAS,EAAE,CAAC,CAAC,MAAM;CACpB,CAAC,CAAC;AAmBU,QAAA,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC;IAEzC,MAAM,EAAE,eAAM;CACf,CAAC,CAAC"}
@@ -20359,17 +20359,103 @@ export declare const TransactionIntent: t.UnionC<[t.IntersectionC<[t.Intersectio
20359
20359
  isTestTransaction: t.BooleanC;
20360
20360
  }>]>]>, t.TypeC<{
20361
20361
  unifiedRecipientPreference: t.UnionC<[t.Type<"shielded" | "transparent", "shielded" | "transparent", unknown>, t.UndefinedC]>;
20362
- }>]>, t.Type<{
20363
- intentType: "payment" | "transferToken" | "consolidate" | "consolidateToken" | "fanout" | "stake" | "unstake" | "cancel" | "delegate" | "undelegate" | "switchValidator" | "claim" | "stakeClaimRewards" | "pledge" | "voteDelegation" | "vote" | "createAccount" | "updateAccount" | "addTrustLine" | "removeTrustLine" | "signMessage" | "signTypedStructuredData" | "enableToken" | "disableToken" | "authorize" | "acceleration" | "fillNonce" | "walletRecovery" | "contractCall" | "deactivate" | "customTx" | "confidentialTransfer" | "closeAssociatedTokenAccount" | "stakeWithCallData" | "unstakeWithCallData" | "switchValidatorWithCallData" | "feeAddressTransfer" | "tokenApproval" | "transferStake" | "validatorRegistration" | "increaseStake" | "decreaseStake" | "signalExit" | "withdrawStake" | "spotTransfer" | "bridgeFunds" | "enableBridging" | "goUnstake" | "createBtcDelegation" | "transferAccept" | "transferReject" | "transferAcknowledge" | "transferOfferWithdrawn" | "cosignDelegationProposal" | "cosignDelegationAccept" | "allocationRequest" | "cantonCommand" | "cantonBroadridgeStandingDelegation" | "allocationAllocate" | "allocationOfferWithdrawn" | "allocationReject" | "cantonEndInvestorOnboardingOffer" | "cantonEndInvestorOnboardingAccept" | "cantonEndInvestorOnboardingReject" | "cantonEndInvestorOnboardingCancel" | "cantonEndInvestorOffboarding" | "cantonParticipantOnboardingRequest" | "cantonParticipantAllowListAdd" | "cantonParticipantAllowListRemove" | "cantonGovernanceLockCreate" | "cantonGovernanceLockUnlock" | "cantonGovernanceLockProvisionalUnlock" | "cantonGovernanceLockWithdraw" | "cantonGovernanceLockProposeSubstitution" | "cantonGovernanceLockProposeTransfer" | "defi-deposit" | "defi-redeem" | "defi-approve" | "defi-withdraw" | "wrap-native" | "unwrap-native" | "wrapApprove" | "wrap" | "unwrap" | "finalizeUnwrap" | "delegateResource" | "undelegateResource" | "stacksRegisterForBond" | "export" | "import" | "importtoc";
20364
- } & {
20365
- sequenceId?: string | undefined;
20366
- comment?: string | undefined;
20367
- nonce?: string | number | undefined;
20368
- }, {
20369
- intentType: "payment" | "transferToken" | "consolidate" | "consolidateToken" | "fanout" | "stake" | "unstake" | "cancel" | "delegate" | "undelegate" | "switchValidator" | "claim" | "stakeClaimRewards" | "pledge" | "voteDelegation" | "vote" | "createAccount" | "updateAccount" | "addTrustLine" | "removeTrustLine" | "signMessage" | "signTypedStructuredData" | "enableToken" | "disableToken" | "authorize" | "acceleration" | "fillNonce" | "walletRecovery" | "contractCall" | "deactivate" | "customTx" | "confidentialTransfer" | "closeAssociatedTokenAccount" | "stakeWithCallData" | "unstakeWithCallData" | "switchValidatorWithCallData" | "feeAddressTransfer" | "tokenApproval" | "transferStake" | "validatorRegistration" | "increaseStake" | "decreaseStake" | "signalExit" | "withdrawStake" | "spotTransfer" | "bridgeFunds" | "enableBridging" | "goUnstake" | "createBtcDelegation" | "transferAccept" | "transferReject" | "transferAcknowledge" | "transferOfferWithdrawn" | "cosignDelegationProposal" | "cosignDelegationAccept" | "allocationRequest" | "cantonCommand" | "cantonBroadridgeStandingDelegation" | "allocationAllocate" | "allocationOfferWithdrawn" | "allocationReject" | "cantonEndInvestorOnboardingOffer" | "cantonEndInvestorOnboardingAccept" | "cantonEndInvestorOnboardingReject" | "cantonEndInvestorOnboardingCancel" | "cantonEndInvestorOffboarding" | "cantonParticipantOnboardingRequest" | "cantonParticipantAllowListAdd" | "cantonParticipantAllowListRemove" | "cantonGovernanceLockCreate" | "cantonGovernanceLockUnlock" | "cantonGovernanceLockProvisionalUnlock" | "cantonGovernanceLockWithdraw" | "cantonGovernanceLockProposeSubstitution" | "cantonGovernanceLockProposeTransfer" | "defi-deposit" | "defi-redeem" | "defi-approve" | "defi-withdraw" | "wrap-native" | "unwrap-native" | "wrapApprove" | "wrap" | "unwrap" | "finalizeUnwrap" | "delegateResource" | "undelegateResource" | "stacksRegisterForBond" | "export" | "import" | "importtoc";
20370
- } & {
20371
- sequenceId?: string | undefined;
20372
- comment?: string | undefined;
20373
- nonce?: string | number | undefined;
20374
- }, unknown>]>;
20362
+ }>]>, t.RefinementC<t.IntersectionC<[t.TypeC<{
20363
+ intentType: t.KeyofC<{
20364
+ payment: t.LiteralC<"payment">;
20365
+ transferToken: t.LiteralC<"transferToken">;
20366
+ consolidate: t.LiteralC<"consolidate">;
20367
+ consolidateToken: t.LiteralC<"consolidateToken">;
20368
+ fanout: t.LiteralC<"fanout">;
20369
+ stake: t.LiteralC<"stake">;
20370
+ unstake: t.LiteralC<"unstake">;
20371
+ cancel: t.LiteralC<"cancel">;
20372
+ delegate: t.LiteralC<"delegate">;
20373
+ undelegate: t.LiteralC<"undelegate">;
20374
+ switchValidator: t.LiteralC<"switchValidator">;
20375
+ claim: t.LiteralC<"claim">;
20376
+ stakeClaimRewards: t.LiteralC<"stakeClaimRewards">;
20377
+ pledge: t.LiteralC<"pledge">;
20378
+ voteDelegation: t.LiteralC<"voteDelegation">;
20379
+ vote: t.LiteralC<"vote">;
20380
+ createAccount: t.LiteralC<"createAccount">;
20381
+ updateAccount: t.LiteralC<"updateAccount">;
20382
+ addTrustLine: t.LiteralC<"addTrustLine">;
20383
+ removeTrustLine: t.LiteralC<"removeTrustLine">;
20384
+ signMessage: t.LiteralC<"signMessage">;
20385
+ signTypedStructuredData: t.LiteralC<"signTypedStructuredData">;
20386
+ enableToken: t.LiteralC<"enableToken">;
20387
+ disableToken: t.LiteralC<"disableToken">;
20388
+ authorize: t.LiteralC<"authorize">;
20389
+ acceleration: t.LiteralC<"acceleration">;
20390
+ fillNonce: t.LiteralC<"fillNonce">;
20391
+ walletRecovery: t.LiteralC<"walletRecovery">;
20392
+ contractCall: t.LiteralC<"contractCall">;
20393
+ deactivate: t.LiteralC<"deactivate">;
20394
+ customTx: t.LiteralC<"customTx">;
20395
+ confidentialTransfer: t.LiteralC<"confidentialTransfer">;
20396
+ closeAssociatedTokenAccount: t.LiteralC<"closeAssociatedTokenAccount">;
20397
+ stakeWithCallData: t.LiteralC<"stakeWithCallData">;
20398
+ unstakeWithCallData: t.LiteralC<"unstakeWithCallData">;
20399
+ switchValidatorWithCallData: t.LiteralC<"switchValidatorWithCallData">;
20400
+ feeAddressTransfer: t.LiteralC<"feeAddressTransfer">;
20401
+ tokenApproval: t.LiteralC<"tokenApproval">;
20402
+ transferStake: t.LiteralC<"transferStake">;
20403
+ validatorRegistration: t.LiteralC<"validatorRegistration">;
20404
+ increaseStake: t.LiteralC<"increaseStake">;
20405
+ decreaseStake: t.LiteralC<"decreaseStake">;
20406
+ signalExit: t.LiteralC<"signalExit">;
20407
+ withdrawStake: t.LiteralC<"withdrawStake">;
20408
+ spotTransfer: t.LiteralC<"spotTransfer">;
20409
+ bridgeFunds: t.LiteralC<"bridgeFunds">;
20410
+ enableBridging: t.LiteralC<"enableBridging">;
20411
+ goUnstake: t.LiteralC<"goUnstake">;
20412
+ createBtcDelegation: t.LiteralC<"createBtcDelegation">;
20413
+ transferAccept: t.LiteralC<"transferAccept">;
20414
+ transferReject: t.LiteralC<"transferReject">;
20415
+ transferAcknowledge: t.LiteralC<"transferAcknowledge">;
20416
+ transferOfferWithdrawn: t.LiteralC<"transferOfferWithdrawn">;
20417
+ cosignDelegationProposal: t.LiteralC<"cosignDelegationProposal">;
20418
+ cosignDelegationAccept: t.LiteralC<"cosignDelegationAccept">;
20419
+ allocationRequest: t.LiteralC<"allocationRequest">;
20420
+ cantonCommand: t.LiteralC<"cantonCommand">;
20421
+ cantonBroadridgeStandingDelegation: t.LiteralC<"cantonBroadridgeStandingDelegation">;
20422
+ allocationAllocate: t.LiteralC<"allocationAllocate">;
20423
+ allocationOfferWithdrawn: t.LiteralC<"allocationOfferWithdrawn">;
20424
+ allocationReject: t.LiteralC<"allocationReject">;
20425
+ cantonEndInvestorOnboardingOffer: t.LiteralC<"cantonEndInvestorOnboardingOffer">;
20426
+ cantonEndInvestorOnboardingAccept: t.LiteralC<"cantonEndInvestorOnboardingAccept">;
20427
+ cantonEndInvestorOnboardingReject: t.LiteralC<"cantonEndInvestorOnboardingReject">;
20428
+ cantonEndInvestorOnboardingCancel: t.LiteralC<"cantonEndInvestorOnboardingCancel">;
20429
+ cantonEndInvestorOffboarding: t.LiteralC<"cantonEndInvestorOffboarding">;
20430
+ cantonParticipantOnboardingRequest: t.LiteralC<"cantonParticipantOnboardingRequest">;
20431
+ cantonParticipantAllowListAdd: t.LiteralC<"cantonParticipantAllowListAdd">;
20432
+ cantonParticipantAllowListRemove: t.LiteralC<"cantonParticipantAllowListRemove">;
20433
+ cantonGovernanceLockCreate: t.LiteralC<"cantonGovernanceLockCreate">;
20434
+ cantonGovernanceLockUnlock: t.LiteralC<"cantonGovernanceLockUnlock">;
20435
+ cantonGovernanceLockProvisionalUnlock: t.LiteralC<"cantonGovernanceLockProvisionalUnlock">;
20436
+ cantonGovernanceLockWithdraw: t.LiteralC<"cantonGovernanceLockWithdraw">;
20437
+ cantonGovernanceLockProposeSubstitution: t.LiteralC<"cantonGovernanceLockProposeSubstitution">;
20438
+ cantonGovernanceLockProposeTransfer: t.LiteralC<"cantonGovernanceLockProposeTransfer">;
20439
+ "defi-deposit": t.LiteralC<"defi-deposit">;
20440
+ "defi-redeem": t.LiteralC<"defi-redeem">;
20441
+ "defi-approve": t.LiteralC<"defi-approve">;
20442
+ "defi-withdraw": t.LiteralC<"defi-withdraw">;
20443
+ "wrap-native": t.LiteralC<"wrap-native">;
20444
+ "unwrap-native": t.LiteralC<"unwrap-native">;
20445
+ wrapApprove: t.LiteralC<"wrapApprove">;
20446
+ wrap: t.LiteralC<"wrap">;
20447
+ unwrap: t.LiteralC<"unwrap">;
20448
+ finalizeUnwrap: t.LiteralC<"finalizeUnwrap">;
20449
+ delegateResource: t.LiteralC<"delegateResource">;
20450
+ undelegateResource: t.LiteralC<"undelegateResource">;
20451
+ stacksRegisterForBond: t.LiteralC<"stacksRegisterForBond">;
20452
+ export: t.LiteralC<"export">;
20453
+ import: t.LiteralC<"import">;
20454
+ importtoc: t.LiteralC<"importtoc">;
20455
+ }>;
20456
+ }>, t.PartialC<{
20457
+ sequenceId: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
20458
+ comment: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
20459
+ nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
20460
+ }>]>>]>;
20375
20461
  export type TransactionIntent = t.TypeOf<typeof TransactionIntent>;
@@ -20363,17 +20363,103 @@ export declare const TransactionIntentFullOnly: t.UnionC<[t.IntersectionC<[t.Int
20363
20363
  unifiedRecipientPreference: t.UnionC<[t.Type<"shielded" | "transparent", "shielded" | "transparent", unknown>, t.UndefinedC]>;
20364
20364
  }>]>]>;
20365
20365
  export type TransactionIntentFullOnly = t.TypeOf<typeof TransactionIntentFullOnly>;
20366
- export declare const TransactionIntentLiteOnly: t.Type<{
20367
- intentType: "payment" | "transferToken" | "consolidate" | "consolidateToken" | "fanout" | "stake" | "unstake" | "cancel" | "delegate" | "undelegate" | "switchValidator" | "claim" | "stakeClaimRewards" | "pledge" | "voteDelegation" | "vote" | "createAccount" | "updateAccount" | "addTrustLine" | "removeTrustLine" | "signMessage" | "signTypedStructuredData" | "enableToken" | "disableToken" | "authorize" | "acceleration" | "fillNonce" | "walletRecovery" | "contractCall" | "deactivate" | "customTx" | "confidentialTransfer" | "closeAssociatedTokenAccount" | "stakeWithCallData" | "unstakeWithCallData" | "switchValidatorWithCallData" | "feeAddressTransfer" | "tokenApproval" | "transferStake" | "validatorRegistration" | "increaseStake" | "decreaseStake" | "signalExit" | "withdrawStake" | "spotTransfer" | "bridgeFunds" | "enableBridging" | "goUnstake" | "createBtcDelegation" | "transferAccept" | "transferReject" | "transferAcknowledge" | "transferOfferWithdrawn" | "cosignDelegationProposal" | "cosignDelegationAccept" | "allocationRequest" | "cantonCommand" | "cantonBroadridgeStandingDelegation" | "allocationAllocate" | "allocationOfferWithdrawn" | "allocationReject" | "cantonEndInvestorOnboardingOffer" | "cantonEndInvestorOnboardingAccept" | "cantonEndInvestorOnboardingReject" | "cantonEndInvestorOnboardingCancel" | "cantonEndInvestorOffboarding" | "cantonParticipantOnboardingRequest" | "cantonParticipantAllowListAdd" | "cantonParticipantAllowListRemove" | "cantonGovernanceLockCreate" | "cantonGovernanceLockUnlock" | "cantonGovernanceLockProvisionalUnlock" | "cantonGovernanceLockWithdraw" | "cantonGovernanceLockProposeSubstitution" | "cantonGovernanceLockProposeTransfer" | "defi-deposit" | "defi-redeem" | "defi-approve" | "defi-withdraw" | "wrap-native" | "unwrap-native" | "wrapApprove" | "wrap" | "unwrap" | "finalizeUnwrap" | "delegateResource" | "undelegateResource" | "stacksRegisterForBond" | "export" | "import" | "importtoc";
20368
- } & {
20369
- sequenceId?: string | undefined;
20370
- comment?: string | undefined;
20371
- nonce?: string | number | undefined;
20372
- }, {
20373
- intentType: "payment" | "transferToken" | "consolidate" | "consolidateToken" | "fanout" | "stake" | "unstake" | "cancel" | "delegate" | "undelegate" | "switchValidator" | "claim" | "stakeClaimRewards" | "pledge" | "voteDelegation" | "vote" | "createAccount" | "updateAccount" | "addTrustLine" | "removeTrustLine" | "signMessage" | "signTypedStructuredData" | "enableToken" | "disableToken" | "authorize" | "acceleration" | "fillNonce" | "walletRecovery" | "contractCall" | "deactivate" | "customTx" | "confidentialTransfer" | "closeAssociatedTokenAccount" | "stakeWithCallData" | "unstakeWithCallData" | "switchValidatorWithCallData" | "feeAddressTransfer" | "tokenApproval" | "transferStake" | "validatorRegistration" | "increaseStake" | "decreaseStake" | "signalExit" | "withdrawStake" | "spotTransfer" | "bridgeFunds" | "enableBridging" | "goUnstake" | "createBtcDelegation" | "transferAccept" | "transferReject" | "transferAcknowledge" | "transferOfferWithdrawn" | "cosignDelegationProposal" | "cosignDelegationAccept" | "allocationRequest" | "cantonCommand" | "cantonBroadridgeStandingDelegation" | "allocationAllocate" | "allocationOfferWithdrawn" | "allocationReject" | "cantonEndInvestorOnboardingOffer" | "cantonEndInvestorOnboardingAccept" | "cantonEndInvestorOnboardingReject" | "cantonEndInvestorOnboardingCancel" | "cantonEndInvestorOffboarding" | "cantonParticipantOnboardingRequest" | "cantonParticipantAllowListAdd" | "cantonParticipantAllowListRemove" | "cantonGovernanceLockCreate" | "cantonGovernanceLockUnlock" | "cantonGovernanceLockProvisionalUnlock" | "cantonGovernanceLockWithdraw" | "cantonGovernanceLockProposeSubstitution" | "cantonGovernanceLockProposeTransfer" | "defi-deposit" | "defi-redeem" | "defi-approve" | "defi-withdraw" | "wrap-native" | "unwrap-native" | "wrapApprove" | "wrap" | "unwrap" | "finalizeUnwrap" | "delegateResource" | "undelegateResource" | "stacksRegisterForBond" | "export" | "import" | "importtoc";
20374
- } & {
20375
- sequenceId?: string | undefined;
20376
- comment?: string | undefined;
20377
- nonce?: string | number | undefined;
20378
- }, unknown>;
20366
+ export declare const TransactionIntentLiteOnly: t.RefinementC<t.IntersectionC<[t.TypeC<{
20367
+ intentType: t.KeyofC<{
20368
+ payment: t.LiteralC<"payment">;
20369
+ transferToken: t.LiteralC<"transferToken">;
20370
+ consolidate: t.LiteralC<"consolidate">;
20371
+ consolidateToken: t.LiteralC<"consolidateToken">;
20372
+ fanout: t.LiteralC<"fanout">;
20373
+ stake: t.LiteralC<"stake">;
20374
+ unstake: t.LiteralC<"unstake">;
20375
+ cancel: t.LiteralC<"cancel">;
20376
+ delegate: t.LiteralC<"delegate">;
20377
+ undelegate: t.LiteralC<"undelegate">;
20378
+ switchValidator: t.LiteralC<"switchValidator">;
20379
+ claim: t.LiteralC<"claim">;
20380
+ stakeClaimRewards: t.LiteralC<"stakeClaimRewards">;
20381
+ pledge: t.LiteralC<"pledge">;
20382
+ voteDelegation: t.LiteralC<"voteDelegation">;
20383
+ vote: t.LiteralC<"vote">;
20384
+ createAccount: t.LiteralC<"createAccount">;
20385
+ updateAccount: t.LiteralC<"updateAccount">;
20386
+ addTrustLine: t.LiteralC<"addTrustLine">;
20387
+ removeTrustLine: t.LiteralC<"removeTrustLine">;
20388
+ signMessage: t.LiteralC<"signMessage">;
20389
+ signTypedStructuredData: t.LiteralC<"signTypedStructuredData">;
20390
+ enableToken: t.LiteralC<"enableToken">;
20391
+ disableToken: t.LiteralC<"disableToken">;
20392
+ authorize: t.LiteralC<"authorize">;
20393
+ acceleration: t.LiteralC<"acceleration">;
20394
+ fillNonce: t.LiteralC<"fillNonce">;
20395
+ walletRecovery: t.LiteralC<"walletRecovery">;
20396
+ contractCall: t.LiteralC<"contractCall">;
20397
+ deactivate: t.LiteralC<"deactivate">;
20398
+ customTx: t.LiteralC<"customTx">;
20399
+ confidentialTransfer: t.LiteralC<"confidentialTransfer">;
20400
+ closeAssociatedTokenAccount: t.LiteralC<"closeAssociatedTokenAccount">;
20401
+ stakeWithCallData: t.LiteralC<"stakeWithCallData">;
20402
+ unstakeWithCallData: t.LiteralC<"unstakeWithCallData">;
20403
+ switchValidatorWithCallData: t.LiteralC<"switchValidatorWithCallData">;
20404
+ feeAddressTransfer: t.LiteralC<"feeAddressTransfer">;
20405
+ tokenApproval: t.LiteralC<"tokenApproval">;
20406
+ transferStake: t.LiteralC<"transferStake">;
20407
+ validatorRegistration: t.LiteralC<"validatorRegistration">;
20408
+ increaseStake: t.LiteralC<"increaseStake">;
20409
+ decreaseStake: t.LiteralC<"decreaseStake">;
20410
+ signalExit: t.LiteralC<"signalExit">;
20411
+ withdrawStake: t.LiteralC<"withdrawStake">;
20412
+ spotTransfer: t.LiteralC<"spotTransfer">;
20413
+ bridgeFunds: t.LiteralC<"bridgeFunds">;
20414
+ enableBridging: t.LiteralC<"enableBridging">;
20415
+ goUnstake: t.LiteralC<"goUnstake">;
20416
+ createBtcDelegation: t.LiteralC<"createBtcDelegation">;
20417
+ transferAccept: t.LiteralC<"transferAccept">;
20418
+ transferReject: t.LiteralC<"transferReject">;
20419
+ transferAcknowledge: t.LiteralC<"transferAcknowledge">;
20420
+ transferOfferWithdrawn: t.LiteralC<"transferOfferWithdrawn">;
20421
+ cosignDelegationProposal: t.LiteralC<"cosignDelegationProposal">;
20422
+ cosignDelegationAccept: t.LiteralC<"cosignDelegationAccept">;
20423
+ allocationRequest: t.LiteralC<"allocationRequest">;
20424
+ cantonCommand: t.LiteralC<"cantonCommand">;
20425
+ cantonBroadridgeStandingDelegation: t.LiteralC<"cantonBroadridgeStandingDelegation">;
20426
+ allocationAllocate: t.LiteralC<"allocationAllocate">;
20427
+ allocationOfferWithdrawn: t.LiteralC<"allocationOfferWithdrawn">;
20428
+ allocationReject: t.LiteralC<"allocationReject">;
20429
+ cantonEndInvestorOnboardingOffer: t.LiteralC<"cantonEndInvestorOnboardingOffer">;
20430
+ cantonEndInvestorOnboardingAccept: t.LiteralC<"cantonEndInvestorOnboardingAccept">;
20431
+ cantonEndInvestorOnboardingReject: t.LiteralC<"cantonEndInvestorOnboardingReject">;
20432
+ cantonEndInvestorOnboardingCancel: t.LiteralC<"cantonEndInvestorOnboardingCancel">;
20433
+ cantonEndInvestorOffboarding: t.LiteralC<"cantonEndInvestorOffboarding">;
20434
+ cantonParticipantOnboardingRequest: t.LiteralC<"cantonParticipantOnboardingRequest">;
20435
+ cantonParticipantAllowListAdd: t.LiteralC<"cantonParticipantAllowListAdd">;
20436
+ cantonParticipantAllowListRemove: t.LiteralC<"cantonParticipantAllowListRemove">;
20437
+ cantonGovernanceLockCreate: t.LiteralC<"cantonGovernanceLockCreate">;
20438
+ cantonGovernanceLockUnlock: t.LiteralC<"cantonGovernanceLockUnlock">;
20439
+ cantonGovernanceLockProvisionalUnlock: t.LiteralC<"cantonGovernanceLockProvisionalUnlock">;
20440
+ cantonGovernanceLockWithdraw: t.LiteralC<"cantonGovernanceLockWithdraw">;
20441
+ cantonGovernanceLockProposeSubstitution: t.LiteralC<"cantonGovernanceLockProposeSubstitution">;
20442
+ cantonGovernanceLockProposeTransfer: t.LiteralC<"cantonGovernanceLockProposeTransfer">;
20443
+ "defi-deposit": t.LiteralC<"defi-deposit">;
20444
+ "defi-redeem": t.LiteralC<"defi-redeem">;
20445
+ "defi-approve": t.LiteralC<"defi-approve">;
20446
+ "defi-withdraw": t.LiteralC<"defi-withdraw">;
20447
+ "wrap-native": t.LiteralC<"wrap-native">;
20448
+ "unwrap-native": t.LiteralC<"unwrap-native">;
20449
+ wrapApprove: t.LiteralC<"wrapApprove">;
20450
+ wrap: t.LiteralC<"wrap">;
20451
+ unwrap: t.LiteralC<"unwrap">;
20452
+ finalizeUnwrap: t.LiteralC<"finalizeUnwrap">;
20453
+ delegateResource: t.LiteralC<"delegateResource">;
20454
+ undelegateResource: t.LiteralC<"undelegateResource">;
20455
+ stacksRegisterForBond: t.LiteralC<"stacksRegisterForBond">;
20456
+ export: t.LiteralC<"export">;
20457
+ import: t.LiteralC<"import">;
20458
+ importtoc: t.LiteralC<"importtoc">;
20459
+ }>;
20460
+ }>, t.PartialC<{
20461
+ sequenceId: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
20462
+ comment: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
20463
+ nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
20464
+ }>]>>;
20379
20465
  export type TransactionIntentLiteOnly = t.TypeOf<typeof TransactionIntentLiteOnly>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitgo/public-types",
3
- "version": "7.6.2",
3
+ "version": "7.6.3",
4
4
  "description": "Collection of types exposed externally as part of the BitGo public API",
5
5
  "license": "UNLICENSED",
6
6
  "author": "",
@@ -8,23 +8,18 @@ import { Amount } from "./amount";
8
8
  /**
9
9
  * @title Intent
10
10
  */
11
- /** Required fragment, split out so {@link BaseIntentCatchAll} can narrow `intentType`. */
12
- const BaseIntentRequired = t.type({
13
- intentType: IntentType,
14
- });
15
-
16
- const BaseIntentOptional = t.partial({
17
- /** Client-assigned sequence identifier for idempotency. */
18
- sequenceId: optionalString,
19
- /** Human-readable memo attached to the transaction. */
20
- comment: optionalString,
21
- /** Override the on-chain nonce for this transaction. */
22
- nonce: Optional(t.union([t.string, t.number])),
23
- });
24
-
25
11
  export const BaseIntent = t.intersection([
26
- BaseIntentRequired,
27
- BaseIntentOptional,
12
+ t.type({
13
+ intentType: IntentType,
14
+ }),
15
+ t.partial({
16
+ /** Client-assigned sequence identifier for idempotency. */
17
+ sequenceId: optionalString,
18
+ /** Human-readable memo attached to the transaction. */
19
+ comment: optionalString,
20
+ /** Override the on-chain nonce for this transaction. */
21
+ nonce: Optional(t.union([t.string, t.number])),
22
+ }),
28
23
  ]);
29
24
 
30
25
  export type BaseIntent = t.TypeOf<typeof BaseIntent>;
@@ -35,78 +30,34 @@ export type BaseIntent = t.TypeOf<typeof BaseIntent>;
35
30
  * of these intents (e.g. one carrying a forbidden protocol `memo`) would fall through the
36
31
  * dedicated codec and still decode as a plain `BaseIntent`.
37
32
  */
38
- const CATCH_ALL_EXCLUDED_INTENT_TYPES = [
33
+ const CATCH_ALL_EXCLUDED_INTENT_TYPES: ReadonlyArray<string> = [
39
34
  intentTypes.cantonGovernanceLockCreate.value,
40
35
  intentTypes.cantonGovernanceLockUnlock.value,
41
36
  intentTypes.cantonGovernanceLockProvisionalUnlock.value,
42
37
  intentTypes.cantonGovernanceLockWithdraw.value,
43
38
  intentTypes.cantonGovernanceLockProposeSubstitution.value,
44
39
  intentTypes.cantonGovernanceLockProposeTransfer.value,
45
- ] as const;
40
+ ];
46
41
 
47
42
  /**
48
- * {@link intentTypes} minus every excluded key, keeping the literal codec types (`Omit` preserves
49
- * them, unlike `Object.fromEntries`'s widened index signature) so that `t.keyof` yields the finite
50
- * union of allowed `intentType` names rather than `string`.
51
- */
52
- type CatchAllIntentTypesMap = Omit<
53
- typeof intentTypes,
54
- (typeof CATCH_ALL_EXCLUDED_INTENT_TYPES)[number]
55
- >;
56
-
57
- const CatchAllIntentTypes = Object.fromEntries(
58
- (
59
- Object.entries(intentTypes) as Array<
60
- [keyof typeof intentTypes, (typeof intentTypes)[keyof typeof intentTypes]]
61
- >
62
- ).filter(
63
- ([key]) =>
64
- !(CATCH_ALL_EXCLUDED_INTENT_TYPES as ReadonlyArray<string>).includes(key),
65
- ),
66
- ) as CatchAllIntentTypesMap;
67
-
68
- /**
69
- * Catch-all for intents that have no codec yet: the open fallback of intent unions. At RUNTIME it
70
- * rejects every `intentType` listed in {@link CATCH_ALL_EXCLUDED_INTENT_TYPES} (the keyof below
71
- * omits them), so an invalid payload for one of those intents cannot decode as a plain
72
- * `BaseIntent` — it must match its dedicated codec higher up in the union.
73
- *
74
- * The DECLARED type is deliberately the full-width `BaseIntent`, not `t.TypeOf` of the runtime
75
- * codec: stored-intent unions in consumers (e.g. wallet-platform's `Intent`) are built over the
76
- * FULL {@link IntentType} registry, so a narrowed static type would make those unions
77
- * unassignable to `TransactionIntent` — every catch-all-shaped member would fail to match. The
78
- * runtime codec stays a plain intersection with a narrower keyof (no `t.refinement`, no
79
- * `t.brand`), so OpenAPI generation emits a plain enum and no unresolvable schema.
43
+ * Catch-all for intents that have no codec yet: `BaseIntent` minus every `intentType` that owns a
44
+ * dedicated codec listed above. Use this, not `BaseIntent`, as the open fallback in intent unions.
45
+ *
46
+ * Uses {@link t.refinement} so the runtime rejects the excluded `intentType`s while
47
+ * `t.TypeOf` stays the plain full-width {@link BaseIntent} (no brand marker), keeping stored
48
+ * intents — whose unions span the full registry — assignable for decode AND encode.
49
+ *
50
+ * @assumes consumers that generate OpenAPI from this codec register a `refinement` handler in
51
+ * their `.openapi-generator.rc.js` that emits the inner schema (the wallet-platform sdk does);
52
+ * without it the generator emits an unresolvable `$ref` for the refinement.
80
53
  */
81
- const BaseIntentCatchAllRuntime = t.intersection([
82
- t.type({ intentType: t.keyof(CatchAllIntentTypes) }),
83
- BaseIntentOptional,
84
- ]);
85
-
86
- export const BaseIntentCatchAll: t.Type<BaseIntent> =
87
- BaseIntentCatchAllRuntime as unknown as t.Type<BaseIntent>;
54
+ export const BaseIntentCatchAll = t.refinement(
55
+ BaseIntent,
56
+ (intent) => !CATCH_ALL_EXCLUDED_INTENT_TYPES.includes(intent.intentType),
57
+ "BaseIntentCatchAll",
58
+ );
88
59
 
89
- export type BaseIntentCatchAll = BaseIntent;
90
-
91
- /**
92
- * Compile-time drift guards:
93
- * 1. The exclusion list may only contain registry keys — an unknown name fails to compile.
94
- * 2. The catch-all's declared `intentType` remains a subset of {@link IntentType}, so a decoded
95
- * catch-all intent's `intentType` still assigns to any API expecting a supported intent name.
96
- */
97
- type ExcludedIntentType = (typeof CATCH_ALL_EXCLUDED_INTENT_TYPES)[number];
98
- type _ExcludedKeysAreRegistryKeys =
99
- ExcludedIntentType extends keyof typeof intentTypes ? true : never;
100
- type _CatchAllIntentTypeIsIntentType = t.TypeOf<
101
- typeof BaseIntentCatchAll
102
- >["intentType"] extends IntentType
103
- ? true
104
- : never;
105
- const _catchAllGuardsHold: [
106
- _ExcludedKeysAreRegistryKeys,
107
- _CatchAllIntentTypeIsIntentType,
108
- ] = [true, true];
109
- void _catchAllGuardsHold;
60
+ export type BaseIntentCatchAll = t.TypeOf<typeof BaseIntentCatchAll>;
110
61
 
111
62
  export const BaseIntentWithoutNonce = t.intersection([
112
63
  t.type({