@bitgo/public-types 7.6.0 → 7.6.2
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/baseIntent.d.ts +2 -103
- package/dist/src/schema/transactionRequest/intents/baseIntent.js +18 -9
- package/dist/src/schema/transactionRequest/intents/baseIntent.js.map +1 -1
- package/dist/src/schema/transactionRequest/intents/intent.d.ts +13 -99
- package/dist/src/schema/transactionRequest/intents/intentGroups.d.ts +13 -99
- package/package.json +1 -1
- package/src/schema/transactionRequest/intents/baseIntent.ts +78 -33
|
@@ -99,109 +99,8 @@ 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
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
export declare const BaseIntentCatchAll: t.BrandC<t.IntersectionC<[t.TypeC<{
|
|
106
|
-
intentType: t.KeyofC<{
|
|
107
|
-
payment: t.LiteralC<"payment">;
|
|
108
|
-
transferToken: t.LiteralC<"transferToken">;
|
|
109
|
-
consolidate: t.LiteralC<"consolidate">;
|
|
110
|
-
consolidateToken: t.LiteralC<"consolidateToken">;
|
|
111
|
-
fanout: t.LiteralC<"fanout">;
|
|
112
|
-
stake: t.LiteralC<"stake">;
|
|
113
|
-
unstake: t.LiteralC<"unstake">;
|
|
114
|
-
cancel: t.LiteralC<"cancel">;
|
|
115
|
-
delegate: t.LiteralC<"delegate">;
|
|
116
|
-
undelegate: t.LiteralC<"undelegate">;
|
|
117
|
-
switchValidator: t.LiteralC<"switchValidator">;
|
|
118
|
-
claim: t.LiteralC<"claim">;
|
|
119
|
-
stakeClaimRewards: t.LiteralC<"stakeClaimRewards">;
|
|
120
|
-
pledge: t.LiteralC<"pledge">;
|
|
121
|
-
voteDelegation: t.LiteralC<"voteDelegation">;
|
|
122
|
-
vote: t.LiteralC<"vote">;
|
|
123
|
-
createAccount: t.LiteralC<"createAccount">;
|
|
124
|
-
updateAccount: t.LiteralC<"updateAccount">;
|
|
125
|
-
addTrustLine: t.LiteralC<"addTrustLine">;
|
|
126
|
-
removeTrustLine: t.LiteralC<"removeTrustLine">;
|
|
127
|
-
signMessage: t.LiteralC<"signMessage">;
|
|
128
|
-
signTypedStructuredData: t.LiteralC<"signTypedStructuredData">;
|
|
129
|
-
enableToken: t.LiteralC<"enableToken">;
|
|
130
|
-
disableToken: t.LiteralC<"disableToken">;
|
|
131
|
-
authorize: t.LiteralC<"authorize">;
|
|
132
|
-
acceleration: t.LiteralC<"acceleration">;
|
|
133
|
-
fillNonce: t.LiteralC<"fillNonce">;
|
|
134
|
-
walletRecovery: t.LiteralC<"walletRecovery">;
|
|
135
|
-
contractCall: t.LiteralC<"contractCall">;
|
|
136
|
-
deactivate: t.LiteralC<"deactivate">;
|
|
137
|
-
customTx: t.LiteralC<"customTx">;
|
|
138
|
-
confidentialTransfer: t.LiteralC<"confidentialTransfer">;
|
|
139
|
-
closeAssociatedTokenAccount: t.LiteralC<"closeAssociatedTokenAccount">;
|
|
140
|
-
stakeWithCallData: t.LiteralC<"stakeWithCallData">;
|
|
141
|
-
unstakeWithCallData: t.LiteralC<"unstakeWithCallData">;
|
|
142
|
-
switchValidatorWithCallData: t.LiteralC<"switchValidatorWithCallData">;
|
|
143
|
-
feeAddressTransfer: t.LiteralC<"feeAddressTransfer">;
|
|
144
|
-
tokenApproval: t.LiteralC<"tokenApproval">;
|
|
145
|
-
transferStake: t.LiteralC<"transferStake">;
|
|
146
|
-
validatorRegistration: t.LiteralC<"validatorRegistration">;
|
|
147
|
-
increaseStake: t.LiteralC<"increaseStake">;
|
|
148
|
-
decreaseStake: t.LiteralC<"decreaseStake">;
|
|
149
|
-
signalExit: t.LiteralC<"signalExit">;
|
|
150
|
-
withdrawStake: t.LiteralC<"withdrawStake">;
|
|
151
|
-
spotTransfer: t.LiteralC<"spotTransfer">;
|
|
152
|
-
bridgeFunds: t.LiteralC<"bridgeFunds">;
|
|
153
|
-
enableBridging: t.LiteralC<"enableBridging">;
|
|
154
|
-
goUnstake: t.LiteralC<"goUnstake">;
|
|
155
|
-
createBtcDelegation: t.LiteralC<"createBtcDelegation">;
|
|
156
|
-
transferAccept: t.LiteralC<"transferAccept">;
|
|
157
|
-
transferReject: t.LiteralC<"transferReject">;
|
|
158
|
-
transferAcknowledge: t.LiteralC<"transferAcknowledge">;
|
|
159
|
-
transferOfferWithdrawn: t.LiteralC<"transferOfferWithdrawn">;
|
|
160
|
-
cosignDelegationProposal: t.LiteralC<"cosignDelegationProposal">;
|
|
161
|
-
cosignDelegationAccept: t.LiteralC<"cosignDelegationAccept">;
|
|
162
|
-
allocationRequest: t.LiteralC<"allocationRequest">;
|
|
163
|
-
cantonCommand: t.LiteralC<"cantonCommand">;
|
|
164
|
-
cantonBroadridgeStandingDelegation: t.LiteralC<"cantonBroadridgeStandingDelegation">;
|
|
165
|
-
allocationAllocate: t.LiteralC<"allocationAllocate">;
|
|
166
|
-
allocationOfferWithdrawn: t.LiteralC<"allocationOfferWithdrawn">;
|
|
167
|
-
allocationReject: t.LiteralC<"allocationReject">;
|
|
168
|
-
cantonEndInvestorOnboardingOffer: t.LiteralC<"cantonEndInvestorOnboardingOffer">;
|
|
169
|
-
cantonEndInvestorOnboardingAccept: t.LiteralC<"cantonEndInvestorOnboardingAccept">;
|
|
170
|
-
cantonEndInvestorOnboardingReject: t.LiteralC<"cantonEndInvestorOnboardingReject">;
|
|
171
|
-
cantonEndInvestorOnboardingCancel: t.LiteralC<"cantonEndInvestorOnboardingCancel">;
|
|
172
|
-
cantonEndInvestorOffboarding: t.LiteralC<"cantonEndInvestorOffboarding">;
|
|
173
|
-
cantonParticipantOnboardingRequest: t.LiteralC<"cantonParticipantOnboardingRequest">;
|
|
174
|
-
cantonParticipantAllowListAdd: t.LiteralC<"cantonParticipantAllowListAdd">;
|
|
175
|
-
cantonParticipantAllowListRemove: t.LiteralC<"cantonParticipantAllowListRemove">;
|
|
176
|
-
cantonGovernanceLockCreate: t.LiteralC<"cantonGovernanceLockCreate">;
|
|
177
|
-
cantonGovernanceLockUnlock: t.LiteralC<"cantonGovernanceLockUnlock">;
|
|
178
|
-
cantonGovernanceLockProvisionalUnlock: t.LiteralC<"cantonGovernanceLockProvisionalUnlock">;
|
|
179
|
-
cantonGovernanceLockWithdraw: t.LiteralC<"cantonGovernanceLockWithdraw">;
|
|
180
|
-
cantonGovernanceLockProposeSubstitution: t.LiteralC<"cantonGovernanceLockProposeSubstitution">;
|
|
181
|
-
cantonGovernanceLockProposeTransfer: t.LiteralC<"cantonGovernanceLockProposeTransfer">;
|
|
182
|
-
"defi-deposit": t.LiteralC<"defi-deposit">;
|
|
183
|
-
"defi-redeem": t.LiteralC<"defi-redeem">;
|
|
184
|
-
"defi-approve": t.LiteralC<"defi-approve">;
|
|
185
|
-
"defi-withdraw": t.LiteralC<"defi-withdraw">;
|
|
186
|
-
"wrap-native": t.LiteralC<"wrap-native">;
|
|
187
|
-
"unwrap-native": t.LiteralC<"unwrap-native">;
|
|
188
|
-
wrapApprove: t.LiteralC<"wrapApprove">;
|
|
189
|
-
wrap: t.LiteralC<"wrap">;
|
|
190
|
-
unwrap: t.LiteralC<"unwrap">;
|
|
191
|
-
finalizeUnwrap: t.LiteralC<"finalizeUnwrap">;
|
|
192
|
-
delegateResource: t.LiteralC<"delegateResource">;
|
|
193
|
-
undelegateResource: t.LiteralC<"undelegateResource">;
|
|
194
|
-
stacksRegisterForBond: t.LiteralC<"stacksRegisterForBond">;
|
|
195
|
-
export: t.LiteralC<"export">;
|
|
196
|
-
import: t.LiteralC<"import">;
|
|
197
|
-
importtoc: t.LiteralC<"importtoc">;
|
|
198
|
-
}>;
|
|
199
|
-
}>, t.PartialC<{
|
|
200
|
-
sequenceId: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
201
|
-
comment: t.UnionC<[t.Type<string, string, unknown>, t.UndefinedC]>;
|
|
202
|
-
nonce: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
|
203
|
-
}>]>, BaseIntentCatchAllBrand>;
|
|
204
|
-
export type BaseIntentCatchAll = t.TypeOf<typeof BaseIntentCatchAll>;
|
|
102
|
+
export declare const BaseIntentCatchAll: t.Type<BaseIntent>;
|
|
103
|
+
export type BaseIntentCatchAll = BaseIntent;
|
|
205
104
|
export declare const BaseIntentWithoutNonce: t.IntersectionC<[t.TypeC<{
|
|
206
105
|
intentType: t.KeyofC<{
|
|
207
106
|
payment: t.LiteralC<"payment">;
|
|
@@ -30,15 +30,17 @@ 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
|
+
});
|
|
33
41
|
exports.BaseIntent = t.intersection([
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
}),
|
|
42
|
+
BaseIntentRequired,
|
|
43
|
+
BaseIntentOptional,
|
|
42
44
|
]);
|
|
43
45
|
const CATCH_ALL_EXCLUDED_INTENT_TYPES = [
|
|
44
46
|
intentType_1.intentTypes.cantonGovernanceLockCreate.value,
|
|
@@ -48,7 +50,14 @@ const CATCH_ALL_EXCLUDED_INTENT_TYPES = [
|
|
|
48
50
|
intentType_1.intentTypes.cantonGovernanceLockProposeSubstitution.value,
|
|
49
51
|
intentType_1.intentTypes.cantonGovernanceLockProposeTransfer.value,
|
|
50
52
|
];
|
|
51
|
-
|
|
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;
|
|
52
61
|
exports.BaseIntentWithoutNonce = t.intersection([
|
|
53
62
|
t.type({
|
|
54
63
|
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;
|
|
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"}
|
|
@@ -20359,103 +20359,17 @@ 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.
|
|
20363
|
-
intentType:
|
|
20364
|
-
|
|
20365
|
-
|
|
20366
|
-
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
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
|
-
}>]>, import("./baseIntent").BaseIntentCatchAllBrand>]>;
|
|
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>]>;
|
|
20461
20375
|
export type TransactionIntent = t.TypeOf<typeof TransactionIntent>;
|
|
@@ -20363,103 +20363,17 @@ 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.
|
|
20367
|
-
intentType:
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
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
|
-
}>]>, import("./baseIntent").BaseIntentCatchAllBrand>;
|
|
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>;
|
|
20465
20379
|
export type TransactionIntentLiteOnly = t.TypeOf<typeof TransactionIntentLiteOnly>;
|
package/package.json
CHANGED
|
@@ -8,18 +8,23 @@ 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
|
+
|
|
11
25
|
export const BaseIntent = t.intersection([
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
}),
|
|
26
|
+
BaseIntentRequired,
|
|
27
|
+
BaseIntentOptional,
|
|
23
28
|
]);
|
|
24
29
|
|
|
25
30
|
export type BaseIntent = t.TypeOf<typeof BaseIntent>;
|
|
@@ -30,38 +35,78 @@ export type BaseIntent = t.TypeOf<typeof BaseIntent>;
|
|
|
30
35
|
* of these intents (e.g. one carrying a forbidden protocol `memo`) would fall through the
|
|
31
36
|
* dedicated codec and still decode as a plain `BaseIntent`.
|
|
32
37
|
*/
|
|
33
|
-
const CATCH_ALL_EXCLUDED_INTENT_TYPES
|
|
38
|
+
const CATCH_ALL_EXCLUDED_INTENT_TYPES = [
|
|
34
39
|
intentTypes.cantonGovernanceLockCreate.value,
|
|
35
40
|
intentTypes.cantonGovernanceLockUnlock.value,
|
|
36
41
|
intentTypes.cantonGovernanceLockProvisionalUnlock.value,
|
|
37
42
|
intentTypes.cantonGovernanceLockWithdraw.value,
|
|
38
43
|
intentTypes.cantonGovernanceLockProposeSubstitution.value,
|
|
39
44
|
intentTypes.cantonGovernanceLockProposeTransfer.value,
|
|
40
|
-
];
|
|
45
|
+
] as const;
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
/**
|
|
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;
|
|
45
67
|
|
|
46
68
|
/**
|
|
47
|
-
* Catch-all for intents that have no codec yet:
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
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.
|
|
80
|
+
*/
|
|
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>;
|
|
88
|
+
|
|
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.
|
|
52
96
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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;
|
|
65
110
|
|
|
66
111
|
export const BaseIntentWithoutNonce = t.intersection([
|
|
67
112
|
t.type({
|