@metamask/subscription-controller 6.2.2 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -1
- package/dist/SubscriptionController-method-action-types.cjs.map +1 -1
- package/dist/SubscriptionController-method-action-types.d.cts +55 -18
- package/dist/SubscriptionController-method-action-types.d.cts.map +1 -1
- package/dist/SubscriptionController-method-action-types.d.mts +55 -18
- package/dist/SubscriptionController-method-action-types.d.mts.map +1 -1
- package/dist/SubscriptionController-method-action-types.mjs.map +1 -1
- package/dist/SubscriptionController.cjs +180 -68
- package/dist/SubscriptionController.cjs.map +1 -1
- package/dist/SubscriptionController.d.cts +58 -26
- package/dist/SubscriptionController.d.cts.map +1 -1
- package/dist/SubscriptionController.d.mts +58 -26
- package/dist/SubscriptionController.d.mts.map +1 -1
- package/dist/SubscriptionController.mjs +181 -69
- package/dist/SubscriptionController.mjs.map +1 -1
- package/dist/SubscriptionService-method-action-types.cjs +7 -0
- package/dist/SubscriptionService-method-action-types.cjs.map +1 -0
- package/dist/SubscriptionService-method-action-types.d.cts +155 -0
- package/dist/SubscriptionService-method-action-types.d.cts.map +1 -0
- package/dist/SubscriptionService-method-action-types.d.mts +155 -0
- package/dist/SubscriptionService-method-action-types.d.mts.map +1 -0
- package/dist/SubscriptionService-method-action-types.mjs +6 -0
- package/dist/SubscriptionService-method-action-types.mjs.map +1 -0
- package/dist/SubscriptionService-structs.cjs +158 -0
- package/dist/SubscriptionService-structs.cjs.map +1 -0
- package/dist/SubscriptionService-structs.d.cts +721 -0
- package/dist/SubscriptionService-structs.d.cts.map +1 -0
- package/dist/SubscriptionService-structs.d.mts +721 -0
- package/dist/SubscriptionService-structs.d.mts.map +1 -0
- package/dist/SubscriptionService-structs.mjs +155 -0
- package/dist/SubscriptionService-structs.mjs.map +1 -0
- package/dist/SubscriptionService.cjs +279 -87
- package/dist/SubscriptionService.cjs.map +1 -1
- package/dist/SubscriptionService.d.cts +94 -10
- package/dist/SubscriptionService.d.cts.map +1 -1
- package/dist/SubscriptionService.d.mts +94 -10
- package/dist/SubscriptionService.d.mts.map +1 -1
- package/dist/SubscriptionService.mjs +279 -87
- package/dist/SubscriptionService.mjs.map +1 -1
- package/dist/constants.cjs +2 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +2 -0
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +2 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +2 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs +27 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +171 -10
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +171 -10
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +26 -0
- package/dist/types.mjs.map +1 -1
- package/package.json +5 -2
package/dist/types.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TransactionMeta } from "@metamask/transaction-controller";
|
|
1
2
|
import type { CaipAccountId, Hex } from "@metamask/utils";
|
|
2
3
|
/**
|
|
3
4
|
* Error response from the Subscription API.
|
|
@@ -7,10 +8,37 @@ export type SubscriptionApiError = {
|
|
|
7
8
|
message?: string;
|
|
8
9
|
statusCode?: number;
|
|
9
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Supported subscription products.
|
|
13
|
+
*/
|
|
10
14
|
export declare const PRODUCT_TYPES: {
|
|
15
|
+
/**
|
|
16
|
+
* MetaMask Shield.
|
|
17
|
+
*/
|
|
11
18
|
readonly SHIELD: "shield";
|
|
19
|
+
/**
|
|
20
|
+
* Money Account Plus (delegation-based crypto billing).
|
|
21
|
+
*/
|
|
22
|
+
readonly MONEY_ACCOUNT_PLUS: "money_account_plus";
|
|
12
23
|
};
|
|
13
24
|
export type ProductType = (typeof PRODUCT_TYPES)[keyof typeof PRODUCT_TYPES];
|
|
25
|
+
/**
|
|
26
|
+
* How a crypto subscription is authorized.
|
|
27
|
+
*
|
|
28
|
+
* Use `erc20_approval` with `rawTransaction` (e.g. Shield). Use `delegation`
|
|
29
|
+
* with `delegationHash` (e.g. Money Account Plus).
|
|
30
|
+
*/
|
|
31
|
+
export declare const CRYPTO_AUTH_METHODS: {
|
|
32
|
+
/**
|
|
33
|
+
* User signs an ERC-20 approve transaction.
|
|
34
|
+
*/
|
|
35
|
+
readonly ERC20_APPROVAL: "erc20_approval";
|
|
36
|
+
/**
|
|
37
|
+
* User authorizes via a stored delegation hash.
|
|
38
|
+
*/
|
|
39
|
+
readonly DELEGATION: "delegation";
|
|
40
|
+
};
|
|
41
|
+
export type CryptoAuthMethod = (typeof CRYPTO_AUTH_METHODS)[keyof typeof CRYPTO_AUTH_METHODS];
|
|
14
42
|
export declare const PAYMENT_TYPES: {
|
|
15
43
|
readonly byCard: "card";
|
|
16
44
|
readonly byCrypto: "crypto";
|
|
@@ -122,8 +150,9 @@ export type StartSubscriptionRequest = {
|
|
|
122
150
|
cancelUrl?: string;
|
|
123
151
|
useTestClock?: boolean;
|
|
124
152
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
153
|
+
* Optional CAIP account ID of the rewards account to opt in alongside this
|
|
154
|
+
* subscription. Required when the user wants to link rewards during
|
|
155
|
+
* subscription creation.
|
|
127
156
|
*
|
|
128
157
|
* @example {
|
|
129
158
|
* rewardAccountId: 'eip155:1:0x1234567890123456789012345678901234567890',
|
|
@@ -134,7 +163,7 @@ export type StartSubscriptionRequest = {
|
|
|
134
163
|
export type StartSubscriptionResponse = {
|
|
135
164
|
checkoutSessionUrl: string;
|
|
136
165
|
};
|
|
137
|
-
|
|
166
|
+
type StartCryptoSubscriptionRequestBase = {
|
|
138
167
|
products: ProductType[];
|
|
139
168
|
isTrialRequested: boolean;
|
|
140
169
|
recurringInterval: RecurringInterval;
|
|
@@ -145,12 +174,12 @@ export type StartCryptoSubscriptionRequest = {
|
|
|
145
174
|
* e.g. "USDC"
|
|
146
175
|
*/
|
|
147
176
|
tokenSymbol: string;
|
|
148
|
-
rawTransaction: Hex;
|
|
149
177
|
isSponsored?: boolean;
|
|
150
178
|
useTestClock?: boolean;
|
|
151
179
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
180
|
+
* Optional CAIP account ID of the rewards account to opt in alongside this
|
|
181
|
+
* subscription. Required when the user wants to link rewards during
|
|
182
|
+
* subscription creation.
|
|
154
183
|
*
|
|
155
184
|
* @example {
|
|
156
185
|
* rewardAccountId: 'eip155:1:0x1234567890123456789012345678901234567890',
|
|
@@ -158,6 +187,35 @@ export type StartCryptoSubscriptionRequest = {
|
|
|
158
187
|
*/
|
|
159
188
|
rewardAccountId?: CaipAccountId;
|
|
160
189
|
};
|
|
190
|
+
/**
|
|
191
|
+
* ERC-20 approval crypto subscription request (e.g. Shield).
|
|
192
|
+
*
|
|
193
|
+
* `cryptoAuthMethod` defaults to `CRYPTO_AUTH_METHODS.ERC20_APPROVAL` when
|
|
194
|
+
* omitted.
|
|
195
|
+
*/
|
|
196
|
+
export type StartErc20CryptoSubscriptionRequest = StartCryptoSubscriptionRequestBase & {
|
|
197
|
+
cryptoAuthMethod?: typeof CRYPTO_AUTH_METHODS.ERC20_APPROVAL;
|
|
198
|
+
rawTransaction: Hex;
|
|
199
|
+
delegationHash?: never;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Delegation-based crypto subscription request (e.g. Money Account Plus).
|
|
203
|
+
*/
|
|
204
|
+
export type StartDelegationCryptoSubscriptionRequest = StartCryptoSubscriptionRequestBase & {
|
|
205
|
+
cryptoAuthMethod: typeof CRYPTO_AUTH_METHODS.DELEGATION;
|
|
206
|
+
delegationHash: Hex;
|
|
207
|
+
rawTransaction?: never;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Request to start a crypto subscription.
|
|
211
|
+
*
|
|
212
|
+
* Discriminated union of ERC-20 approval vs delegation. Provide
|
|
213
|
+
* `rawTransaction` for ERC-20 approval (the default when `cryptoAuthMethod` is
|
|
214
|
+
* omitted), or `delegationHash` with `cryptoAuthMethod: 'delegation'`.
|
|
215
|
+
* Combining or omitting both is a type error, and is also rejected at runtime
|
|
216
|
+
* by `startSubscriptionWithCrypto`.
|
|
217
|
+
*/
|
|
218
|
+
export type StartCryptoSubscriptionRequest = StartErc20CryptoSubscriptionRequest | StartDelegationCryptoSubscriptionRequest;
|
|
161
219
|
export type StartCryptoSubscriptionResponse = {
|
|
162
220
|
subscriptionId: string;
|
|
163
221
|
status: SubscriptionStatus;
|
|
@@ -200,7 +258,7 @@ export type ProductPricing = {
|
|
|
200
258
|
name: ProductType;
|
|
201
259
|
prices: ProductPrice[];
|
|
202
260
|
};
|
|
203
|
-
|
|
261
|
+
type TokenPaymentInfoBase = {
|
|
204
262
|
symbol: string;
|
|
205
263
|
address: Hex;
|
|
206
264
|
decimals: number;
|
|
@@ -209,13 +267,43 @@ export type TokenPaymentInfo = {
|
|
|
209
267
|
usd: '1.0',
|
|
210
268
|
},
|
|
211
269
|
*/
|
|
212
|
-
conversionRate
|
|
270
|
+
conversionRate?: {
|
|
213
271
|
usd: string;
|
|
214
272
|
};
|
|
273
|
+
/**
|
|
274
|
+
* Source tokens that can be converted into this settlement token.
|
|
275
|
+
*/
|
|
276
|
+
sources?: TokenPaymentInfo[];
|
|
215
277
|
};
|
|
278
|
+
/**
|
|
279
|
+
* Spot (non-vault) settlement token. Priced via `conversionRate` when provided.
|
|
280
|
+
* `accountantAddress` is not present on this variant.
|
|
281
|
+
*/
|
|
282
|
+
export type SpotTokenPaymentInfo = TokenPaymentInfoBase & {
|
|
283
|
+
isVaultShare?: false;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Yield-bearing vault share priced via an accountant rate.
|
|
287
|
+
*/
|
|
288
|
+
export type VaultTokenPaymentInfo = TokenPaymentInfoBase & {
|
|
289
|
+
isVaultShare: true;
|
|
290
|
+
/**
|
|
291
|
+
* Veda accountant address used to value this vault share.
|
|
292
|
+
*/
|
|
293
|
+
accountantAddress: Hex;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* A settlement token in a pricing chain. Discriminated by `isVaultShare`:
|
|
297
|
+
* vault shares require `accountantAddress`; spot tokens omit it.
|
|
298
|
+
*/
|
|
299
|
+
export type TokenPaymentInfo = SpotTokenPaymentInfo | VaultTokenPaymentInfo;
|
|
216
300
|
export type ChainPaymentInfo = {
|
|
217
301
|
chainId: Hex;
|
|
218
302
|
paymentAddress: Hex;
|
|
303
|
+
/**
|
|
304
|
+
* Delegate address clients authorize when using the delegation auth method.
|
|
305
|
+
*/
|
|
306
|
+
delegateAddress?: Hex;
|
|
219
307
|
tokens: TokenPaymentInfo[];
|
|
220
308
|
/**
|
|
221
309
|
* Whether the chain supports sponsorship for the trialed subscription approval transaction.
|
|
@@ -223,10 +311,34 @@ export type ChainPaymentInfo = {
|
|
|
223
311
|
*/
|
|
224
312
|
isSponsorshipSupported?: boolean;
|
|
225
313
|
};
|
|
226
|
-
export type
|
|
227
|
-
type: PaymentType
|
|
314
|
+
export type PricingCardPaymentMethod = {
|
|
315
|
+
type: Extract<PaymentType, 'card'>;
|
|
316
|
+
/**
|
|
317
|
+
* Products that support this payment method.
|
|
318
|
+
*/
|
|
319
|
+
products?: ProductType[];
|
|
320
|
+
};
|
|
321
|
+
export type PricingCryptoPaymentMethod = {
|
|
322
|
+
type: Extract<PaymentType, 'crypto'>;
|
|
323
|
+
/**
|
|
324
|
+
* Crypto authorization method. Omitted together with `products` on persisted
|
|
325
|
+
* pre-multi-product pricing rows; those rows are treated as Shield + `erc20_approval`.
|
|
326
|
+
* If `products` is set, this field must be explicit.
|
|
327
|
+
*/
|
|
328
|
+
cryptoAuthMethod?: CryptoAuthMethod;
|
|
329
|
+
/**
|
|
330
|
+
* Products that support this payment method. Omitted together with
|
|
331
|
+
* `cryptoAuthMethod` on persisted pre-multi-product pricing rows (treated as Shield).
|
|
332
|
+
* If present, must be non-empty and paired with an explicit `cryptoAuthMethod`.
|
|
333
|
+
*/
|
|
334
|
+
products?: ProductType[];
|
|
228
335
|
chains?: ChainPaymentInfo[];
|
|
229
336
|
};
|
|
337
|
+
/**
|
|
338
|
+
* A pricing payment-method row. Discriminated by `type`: card rows have no
|
|
339
|
+
* crypto fields; crypto rows may include `cryptoAuthMethod` and `chains`.
|
|
340
|
+
*/
|
|
341
|
+
export type PricingPaymentMethod = PricingCardPaymentMethod | PricingCryptoPaymentMethod;
|
|
230
342
|
export type PricingResponse = {
|
|
231
343
|
products: ProductPricing[];
|
|
232
344
|
paymentMethods: PricingPaymentMethod[];
|
|
@@ -259,6 +371,29 @@ export type GetCryptoApproveTransactionResponse = {
|
|
|
259
371
|
paymentTokenAddress: Hex;
|
|
260
372
|
chainId: Hex;
|
|
261
373
|
};
|
|
374
|
+
/**
|
|
375
|
+
* Request to submit a Shield ERC-20 crypto approval transaction.
|
|
376
|
+
*/
|
|
377
|
+
export type SubmitSubscriptionCryptoApprovalRequest = {
|
|
378
|
+
/**
|
|
379
|
+
* The subscription product. Typed as `typeof PRODUCT_TYPES.SHIELD` only at
|
|
380
|
+
* the moment (future might support more product).
|
|
381
|
+
*/
|
|
382
|
+
productType: typeof PRODUCT_TYPES.SHIELD;
|
|
383
|
+
/**
|
|
384
|
+
* The transaction metadata. Must have type
|
|
385
|
+
* `TransactionType.shieldSubscriptionApprove`.
|
|
386
|
+
*/
|
|
387
|
+
txMeta: TransactionMeta;
|
|
388
|
+
/**
|
|
389
|
+
* Whether the transaction is sponsored.
|
|
390
|
+
*/
|
|
391
|
+
isSponsored?: boolean;
|
|
392
|
+
/**
|
|
393
|
+
* The account ID of the reward subscription to link.
|
|
394
|
+
*/
|
|
395
|
+
rewardAccountId?: CaipAccountId;
|
|
396
|
+
};
|
|
262
397
|
export declare const COHORT_NAMES: {
|
|
263
398
|
readonly POST_TX: "post_tx";
|
|
264
399
|
readonly WALLET_HOME: "wallet_home";
|
|
@@ -321,6 +456,13 @@ export type ISubscriptionService = {
|
|
|
321
456
|
unCancelSubscription(request: {
|
|
322
457
|
subscriptionId: string;
|
|
323
458
|
}): Promise<Subscription>;
|
|
459
|
+
/**
|
|
460
|
+
* Starts a card-paid subscription checkout session for the requested products
|
|
461
|
+
* (e.g. Shield or Money Account Plus).
|
|
462
|
+
*
|
|
463
|
+
* @param request - The start subscription request.
|
|
464
|
+
* @returns The checkout session response.
|
|
465
|
+
*/
|
|
324
466
|
startSubscriptionWithCard(request: StartSubscriptionRequest): Promise<StartSubscriptionResponse>;
|
|
325
467
|
getBillingPortalUrl(): Promise<BillingPortalResponse>;
|
|
326
468
|
getPricing(): Promise<PricingResponse>;
|
|
@@ -396,6 +538,24 @@ export type CachedLastSelectedPaymentMethod = {
|
|
|
396
538
|
paymentTokenSymbol?: string;
|
|
397
539
|
plan: RecurringInterval;
|
|
398
540
|
useTestClock?: boolean;
|
|
541
|
+
/**
|
|
542
|
+
* Crypto authorization method. Omitted on persisted cache entries written
|
|
543
|
+
* before this field existed; treat as `erc20_approval` when missing.
|
|
544
|
+
*/
|
|
545
|
+
cryptoAuthMethod?: CryptoAuthMethod;
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* Request to cache the last selected payment method for a product.
|
|
549
|
+
*/
|
|
550
|
+
export type CacheLastSelectedPaymentMethodRequest = {
|
|
551
|
+
/**
|
|
552
|
+
* The product to cache the payment method for.
|
|
553
|
+
*/
|
|
554
|
+
product: ProductType;
|
|
555
|
+
/**
|
|
556
|
+
* The payment method to cache.
|
|
557
|
+
*/
|
|
558
|
+
paymentMethod: CachedLastSelectedPaymentMethod;
|
|
399
559
|
};
|
|
400
560
|
/**
|
|
401
561
|
* Request object for linking rewards to a subscription.
|
|
@@ -410,4 +570,5 @@ export type LinkRewardsRequest = {
|
|
|
410
570
|
*/
|
|
411
571
|
rewardAccountId: CaipAccountId;
|
|
412
572
|
};
|
|
573
|
+
export {};
|
|
413
574
|
//# sourceMappingURL=types.d.cts.map
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,wBAAwB;AAE1D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,aAAa;;
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,yCAAyC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,wBAAwB;AAE1D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;IAEH;;OAEG;;CAEK,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE7E;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;OAEG;;IAEH;;OAEG;;CAEK,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,eAAO,MAAM,aAAa;;;CAGhB,CAAC;A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,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,GAAG,CAAC;IACb,YAAY,EAAE,GAAG,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,WAAW,CAAC;IAClB,mBAAmB,CAAC,EAAE,GAAG,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD;;OAEG;IACH,OAAO,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,aAAa,EAAE,+BAA+B,CAAC;CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;;OAMG;IACH,eAAe,EAAE,aAAa,CAAC;CAChC,CAAC"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TransactionMeta } from "@metamask/transaction-controller";
|
|
1
2
|
import type { CaipAccountId, Hex } from "@metamask/utils";
|
|
2
3
|
/**
|
|
3
4
|
* Error response from the Subscription API.
|
|
@@ -7,10 +8,37 @@ export type SubscriptionApiError = {
|
|
|
7
8
|
message?: string;
|
|
8
9
|
statusCode?: number;
|
|
9
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Supported subscription products.
|
|
13
|
+
*/
|
|
10
14
|
export declare const PRODUCT_TYPES: {
|
|
15
|
+
/**
|
|
16
|
+
* MetaMask Shield.
|
|
17
|
+
*/
|
|
11
18
|
readonly SHIELD: "shield";
|
|
19
|
+
/**
|
|
20
|
+
* Money Account Plus (delegation-based crypto billing).
|
|
21
|
+
*/
|
|
22
|
+
readonly MONEY_ACCOUNT_PLUS: "money_account_plus";
|
|
12
23
|
};
|
|
13
24
|
export type ProductType = (typeof PRODUCT_TYPES)[keyof typeof PRODUCT_TYPES];
|
|
25
|
+
/**
|
|
26
|
+
* How a crypto subscription is authorized.
|
|
27
|
+
*
|
|
28
|
+
* Use `erc20_approval` with `rawTransaction` (e.g. Shield). Use `delegation`
|
|
29
|
+
* with `delegationHash` (e.g. Money Account Plus).
|
|
30
|
+
*/
|
|
31
|
+
export declare const CRYPTO_AUTH_METHODS: {
|
|
32
|
+
/**
|
|
33
|
+
* User signs an ERC-20 approve transaction.
|
|
34
|
+
*/
|
|
35
|
+
readonly ERC20_APPROVAL: "erc20_approval";
|
|
36
|
+
/**
|
|
37
|
+
* User authorizes via a stored delegation hash.
|
|
38
|
+
*/
|
|
39
|
+
readonly DELEGATION: "delegation";
|
|
40
|
+
};
|
|
41
|
+
export type CryptoAuthMethod = (typeof CRYPTO_AUTH_METHODS)[keyof typeof CRYPTO_AUTH_METHODS];
|
|
14
42
|
export declare const PAYMENT_TYPES: {
|
|
15
43
|
readonly byCard: "card";
|
|
16
44
|
readonly byCrypto: "crypto";
|
|
@@ -122,8 +150,9 @@ export type StartSubscriptionRequest = {
|
|
|
122
150
|
cancelUrl?: string;
|
|
123
151
|
useTestClock?: boolean;
|
|
124
152
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
153
|
+
* Optional CAIP account ID of the rewards account to opt in alongside this
|
|
154
|
+
* subscription. Required when the user wants to link rewards during
|
|
155
|
+
* subscription creation.
|
|
127
156
|
*
|
|
128
157
|
* @example {
|
|
129
158
|
* rewardAccountId: 'eip155:1:0x1234567890123456789012345678901234567890',
|
|
@@ -134,7 +163,7 @@ export type StartSubscriptionRequest = {
|
|
|
134
163
|
export type StartSubscriptionResponse = {
|
|
135
164
|
checkoutSessionUrl: string;
|
|
136
165
|
};
|
|
137
|
-
|
|
166
|
+
type StartCryptoSubscriptionRequestBase = {
|
|
138
167
|
products: ProductType[];
|
|
139
168
|
isTrialRequested: boolean;
|
|
140
169
|
recurringInterval: RecurringInterval;
|
|
@@ -145,12 +174,12 @@ export type StartCryptoSubscriptionRequest = {
|
|
|
145
174
|
* e.g. "USDC"
|
|
146
175
|
*/
|
|
147
176
|
tokenSymbol: string;
|
|
148
|
-
rawTransaction: Hex;
|
|
149
177
|
isSponsored?: boolean;
|
|
150
178
|
useTestClock?: boolean;
|
|
151
179
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
180
|
+
* Optional CAIP account ID of the rewards account to opt in alongside this
|
|
181
|
+
* subscription. Required when the user wants to link rewards during
|
|
182
|
+
* subscription creation.
|
|
154
183
|
*
|
|
155
184
|
* @example {
|
|
156
185
|
* rewardAccountId: 'eip155:1:0x1234567890123456789012345678901234567890',
|
|
@@ -158,6 +187,35 @@ export type StartCryptoSubscriptionRequest = {
|
|
|
158
187
|
*/
|
|
159
188
|
rewardAccountId?: CaipAccountId;
|
|
160
189
|
};
|
|
190
|
+
/**
|
|
191
|
+
* ERC-20 approval crypto subscription request (e.g. Shield).
|
|
192
|
+
*
|
|
193
|
+
* `cryptoAuthMethod` defaults to `CRYPTO_AUTH_METHODS.ERC20_APPROVAL` when
|
|
194
|
+
* omitted.
|
|
195
|
+
*/
|
|
196
|
+
export type StartErc20CryptoSubscriptionRequest = StartCryptoSubscriptionRequestBase & {
|
|
197
|
+
cryptoAuthMethod?: typeof CRYPTO_AUTH_METHODS.ERC20_APPROVAL;
|
|
198
|
+
rawTransaction: Hex;
|
|
199
|
+
delegationHash?: never;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Delegation-based crypto subscription request (e.g. Money Account Plus).
|
|
203
|
+
*/
|
|
204
|
+
export type StartDelegationCryptoSubscriptionRequest = StartCryptoSubscriptionRequestBase & {
|
|
205
|
+
cryptoAuthMethod: typeof CRYPTO_AUTH_METHODS.DELEGATION;
|
|
206
|
+
delegationHash: Hex;
|
|
207
|
+
rawTransaction?: never;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Request to start a crypto subscription.
|
|
211
|
+
*
|
|
212
|
+
* Discriminated union of ERC-20 approval vs delegation. Provide
|
|
213
|
+
* `rawTransaction` for ERC-20 approval (the default when `cryptoAuthMethod` is
|
|
214
|
+
* omitted), or `delegationHash` with `cryptoAuthMethod: 'delegation'`.
|
|
215
|
+
* Combining or omitting both is a type error, and is also rejected at runtime
|
|
216
|
+
* by `startSubscriptionWithCrypto`.
|
|
217
|
+
*/
|
|
218
|
+
export type StartCryptoSubscriptionRequest = StartErc20CryptoSubscriptionRequest | StartDelegationCryptoSubscriptionRequest;
|
|
161
219
|
export type StartCryptoSubscriptionResponse = {
|
|
162
220
|
subscriptionId: string;
|
|
163
221
|
status: SubscriptionStatus;
|
|
@@ -200,7 +258,7 @@ export type ProductPricing = {
|
|
|
200
258
|
name: ProductType;
|
|
201
259
|
prices: ProductPrice[];
|
|
202
260
|
};
|
|
203
|
-
|
|
261
|
+
type TokenPaymentInfoBase = {
|
|
204
262
|
symbol: string;
|
|
205
263
|
address: Hex;
|
|
206
264
|
decimals: number;
|
|
@@ -209,13 +267,43 @@ export type TokenPaymentInfo = {
|
|
|
209
267
|
usd: '1.0',
|
|
210
268
|
},
|
|
211
269
|
*/
|
|
212
|
-
conversionRate
|
|
270
|
+
conversionRate?: {
|
|
213
271
|
usd: string;
|
|
214
272
|
};
|
|
273
|
+
/**
|
|
274
|
+
* Source tokens that can be converted into this settlement token.
|
|
275
|
+
*/
|
|
276
|
+
sources?: TokenPaymentInfo[];
|
|
215
277
|
};
|
|
278
|
+
/**
|
|
279
|
+
* Spot (non-vault) settlement token. Priced via `conversionRate` when provided.
|
|
280
|
+
* `accountantAddress` is not present on this variant.
|
|
281
|
+
*/
|
|
282
|
+
export type SpotTokenPaymentInfo = TokenPaymentInfoBase & {
|
|
283
|
+
isVaultShare?: false;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Yield-bearing vault share priced via an accountant rate.
|
|
287
|
+
*/
|
|
288
|
+
export type VaultTokenPaymentInfo = TokenPaymentInfoBase & {
|
|
289
|
+
isVaultShare: true;
|
|
290
|
+
/**
|
|
291
|
+
* Veda accountant address used to value this vault share.
|
|
292
|
+
*/
|
|
293
|
+
accountantAddress: Hex;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* A settlement token in a pricing chain. Discriminated by `isVaultShare`:
|
|
297
|
+
* vault shares require `accountantAddress`; spot tokens omit it.
|
|
298
|
+
*/
|
|
299
|
+
export type TokenPaymentInfo = SpotTokenPaymentInfo | VaultTokenPaymentInfo;
|
|
216
300
|
export type ChainPaymentInfo = {
|
|
217
301
|
chainId: Hex;
|
|
218
302
|
paymentAddress: Hex;
|
|
303
|
+
/**
|
|
304
|
+
* Delegate address clients authorize when using the delegation auth method.
|
|
305
|
+
*/
|
|
306
|
+
delegateAddress?: Hex;
|
|
219
307
|
tokens: TokenPaymentInfo[];
|
|
220
308
|
/**
|
|
221
309
|
* Whether the chain supports sponsorship for the trialed subscription approval transaction.
|
|
@@ -223,10 +311,34 @@ export type ChainPaymentInfo = {
|
|
|
223
311
|
*/
|
|
224
312
|
isSponsorshipSupported?: boolean;
|
|
225
313
|
};
|
|
226
|
-
export type
|
|
227
|
-
type: PaymentType
|
|
314
|
+
export type PricingCardPaymentMethod = {
|
|
315
|
+
type: Extract<PaymentType, 'card'>;
|
|
316
|
+
/**
|
|
317
|
+
* Products that support this payment method.
|
|
318
|
+
*/
|
|
319
|
+
products?: ProductType[];
|
|
320
|
+
};
|
|
321
|
+
export type PricingCryptoPaymentMethod = {
|
|
322
|
+
type: Extract<PaymentType, 'crypto'>;
|
|
323
|
+
/**
|
|
324
|
+
* Crypto authorization method. Omitted together with `products` on persisted
|
|
325
|
+
* pre-multi-product pricing rows; those rows are treated as Shield + `erc20_approval`.
|
|
326
|
+
* If `products` is set, this field must be explicit.
|
|
327
|
+
*/
|
|
328
|
+
cryptoAuthMethod?: CryptoAuthMethod;
|
|
329
|
+
/**
|
|
330
|
+
* Products that support this payment method. Omitted together with
|
|
331
|
+
* `cryptoAuthMethod` on persisted pre-multi-product pricing rows (treated as Shield).
|
|
332
|
+
* If present, must be non-empty and paired with an explicit `cryptoAuthMethod`.
|
|
333
|
+
*/
|
|
334
|
+
products?: ProductType[];
|
|
228
335
|
chains?: ChainPaymentInfo[];
|
|
229
336
|
};
|
|
337
|
+
/**
|
|
338
|
+
* A pricing payment-method row. Discriminated by `type`: card rows have no
|
|
339
|
+
* crypto fields; crypto rows may include `cryptoAuthMethod` and `chains`.
|
|
340
|
+
*/
|
|
341
|
+
export type PricingPaymentMethod = PricingCardPaymentMethod | PricingCryptoPaymentMethod;
|
|
230
342
|
export type PricingResponse = {
|
|
231
343
|
products: ProductPricing[];
|
|
232
344
|
paymentMethods: PricingPaymentMethod[];
|
|
@@ -259,6 +371,29 @@ export type GetCryptoApproveTransactionResponse = {
|
|
|
259
371
|
paymentTokenAddress: Hex;
|
|
260
372
|
chainId: Hex;
|
|
261
373
|
};
|
|
374
|
+
/**
|
|
375
|
+
* Request to submit a Shield ERC-20 crypto approval transaction.
|
|
376
|
+
*/
|
|
377
|
+
export type SubmitSubscriptionCryptoApprovalRequest = {
|
|
378
|
+
/**
|
|
379
|
+
* The subscription product. Typed as `typeof PRODUCT_TYPES.SHIELD` only at
|
|
380
|
+
* the moment (future might support more product).
|
|
381
|
+
*/
|
|
382
|
+
productType: typeof PRODUCT_TYPES.SHIELD;
|
|
383
|
+
/**
|
|
384
|
+
* The transaction metadata. Must have type
|
|
385
|
+
* `TransactionType.shieldSubscriptionApprove`.
|
|
386
|
+
*/
|
|
387
|
+
txMeta: TransactionMeta;
|
|
388
|
+
/**
|
|
389
|
+
* Whether the transaction is sponsored.
|
|
390
|
+
*/
|
|
391
|
+
isSponsored?: boolean;
|
|
392
|
+
/**
|
|
393
|
+
* The account ID of the reward subscription to link.
|
|
394
|
+
*/
|
|
395
|
+
rewardAccountId?: CaipAccountId;
|
|
396
|
+
};
|
|
262
397
|
export declare const COHORT_NAMES: {
|
|
263
398
|
readonly POST_TX: "post_tx";
|
|
264
399
|
readonly WALLET_HOME: "wallet_home";
|
|
@@ -321,6 +456,13 @@ export type ISubscriptionService = {
|
|
|
321
456
|
unCancelSubscription(request: {
|
|
322
457
|
subscriptionId: string;
|
|
323
458
|
}): Promise<Subscription>;
|
|
459
|
+
/**
|
|
460
|
+
* Starts a card-paid subscription checkout session for the requested products
|
|
461
|
+
* (e.g. Shield or Money Account Plus).
|
|
462
|
+
*
|
|
463
|
+
* @param request - The start subscription request.
|
|
464
|
+
* @returns The checkout session response.
|
|
465
|
+
*/
|
|
324
466
|
startSubscriptionWithCard(request: StartSubscriptionRequest): Promise<StartSubscriptionResponse>;
|
|
325
467
|
getBillingPortalUrl(): Promise<BillingPortalResponse>;
|
|
326
468
|
getPricing(): Promise<PricingResponse>;
|
|
@@ -396,6 +538,24 @@ export type CachedLastSelectedPaymentMethod = {
|
|
|
396
538
|
paymentTokenSymbol?: string;
|
|
397
539
|
plan: RecurringInterval;
|
|
398
540
|
useTestClock?: boolean;
|
|
541
|
+
/**
|
|
542
|
+
* Crypto authorization method. Omitted on persisted cache entries written
|
|
543
|
+
* before this field existed; treat as `erc20_approval` when missing.
|
|
544
|
+
*/
|
|
545
|
+
cryptoAuthMethod?: CryptoAuthMethod;
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* Request to cache the last selected payment method for a product.
|
|
549
|
+
*/
|
|
550
|
+
export type CacheLastSelectedPaymentMethodRequest = {
|
|
551
|
+
/**
|
|
552
|
+
* The product to cache the payment method for.
|
|
553
|
+
*/
|
|
554
|
+
product: ProductType;
|
|
555
|
+
/**
|
|
556
|
+
* The payment method to cache.
|
|
557
|
+
*/
|
|
558
|
+
paymentMethod: CachedLastSelectedPaymentMethod;
|
|
399
559
|
};
|
|
400
560
|
/**
|
|
401
561
|
* Request object for linking rewards to a subscription.
|
|
@@ -410,4 +570,5 @@ export type LinkRewardsRequest = {
|
|
|
410
570
|
*/
|
|
411
571
|
rewardAccountId: CaipAccountId;
|
|
412
572
|
};
|
|
573
|
+
export {};
|
|
413
574
|
//# sourceMappingURL=types.d.mts.map
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,wBAAwB;AAE1D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,aAAa;;
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,yCAAyC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,wBAAwB;AAE1D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;IAEH;;OAEG;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,EAAE,+BAA+B,CAAC;CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;;OAMG;IACH,eAAe,EAAE,aAAa,CAAC;CAChC,CAAC"}
|
package/dist/types.mjs
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported subscription products.
|
|
3
|
+
*/
|
|
1
4
|
export const PRODUCT_TYPES = {
|
|
5
|
+
/**
|
|
6
|
+
* MetaMask Shield.
|
|
7
|
+
*/
|
|
2
8
|
SHIELD: 'shield',
|
|
9
|
+
/**
|
|
10
|
+
* Money Account Plus (delegation-based crypto billing).
|
|
11
|
+
*/
|
|
12
|
+
MONEY_ACCOUNT_PLUS: 'money_account_plus',
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* How a crypto subscription is authorized.
|
|
16
|
+
*
|
|
17
|
+
* Use `erc20_approval` with `rawTransaction` (e.g. Shield). Use `delegation`
|
|
18
|
+
* with `delegationHash` (e.g. Money Account Plus).
|
|
19
|
+
*/
|
|
20
|
+
export const CRYPTO_AUTH_METHODS = {
|
|
21
|
+
/**
|
|
22
|
+
* User signs an ERC-20 approve transaction.
|
|
23
|
+
*/
|
|
24
|
+
ERC20_APPROVAL: 'erc20_approval',
|
|
25
|
+
/**
|
|
26
|
+
* User authorizes via a stored delegation hash.
|
|
27
|
+
*/
|
|
28
|
+
DELEGATION: 'delegation',
|
|
3
29
|
};
|
|
4
30
|
export const PAYMENT_TYPES = {
|
|
5
31
|
byCard: 'card',
|