@universal-everything/sdk-core 1.4.0-dev.51cc43a → 1.4.0-dev.69ffcab
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/index.d.ts +82 -5
- package/dist/index.js +44 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -397,12 +397,60 @@ type ProfileWithChains = {
|
|
|
397
397
|
extend: ExtendVerdict;
|
|
398
398
|
chains: ChainStatus[];
|
|
399
399
|
};
|
|
400
|
-
|
|
401
|
-
|
|
400
|
+
/** One network kind's quota (`GET /v1/quota` → `kinds`). */
|
|
401
|
+
type KindQuota = {
|
|
402
|
+
/** Whole percent of this kind's monthly credits left (0–100); null = no allowance. */
|
|
403
|
+
percentRemaining: number | null;
|
|
404
|
+
/** When the monthly credits refill (ISO, first of next month UTC). */
|
|
405
|
+
resetsAt: string;
|
|
406
|
+
/** Profiles of this kind vs the cap. The cap only limits creating new ones. */
|
|
407
|
+
profiles?: {
|
|
408
|
+
used: number;
|
|
409
|
+
cap: number;
|
|
410
|
+
};
|
|
411
|
+
/** Cross-chain tickets of this kind: used vs cap. Tickets don't renew monthly. */
|
|
412
|
+
crossChain?: {
|
|
413
|
+
used: number;
|
|
414
|
+
cap: number;
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
/** Gas on one chain, rendered from its kind's credits (legacy shape). */
|
|
418
|
+
type QuotaChain = {
|
|
419
|
+
chainId: number;
|
|
402
420
|
periodStart: string;
|
|
403
421
|
includedRemaining: string;
|
|
422
|
+
includedPerPeriod: string;
|
|
404
423
|
topupRemaining: string;
|
|
405
|
-
|
|
424
|
+
totalRemaining: string;
|
|
425
|
+
/** False for a chain the account holds a profile on but its plan doesn't fund. */
|
|
426
|
+
funded: boolean;
|
|
427
|
+
reason?: "tier_chain_not_allowed" | "chain_disabled";
|
|
428
|
+
note?: string;
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* `GET /v1/quota`. Credits are split into a mainnet and a testnet pool
|
|
432
|
+
* (`kinds`); `credits` is the mainnet pool, and `chains` renders each chain
|
|
433
|
+
* from its own kind's pool.
|
|
434
|
+
*/
|
|
435
|
+
type QuotaSnapshot = {
|
|
436
|
+
tier: string;
|
|
437
|
+
period: string;
|
|
438
|
+
kinds: {
|
|
439
|
+
mainnet: KindQuota;
|
|
440
|
+
testnet: KindQuota;
|
|
441
|
+
};
|
|
442
|
+
credits: {
|
|
443
|
+
remaining: string;
|
|
444
|
+
tierRemaining: string;
|
|
445
|
+
perPeriod: string;
|
|
446
|
+
};
|
|
447
|
+
allowedChains: Array<{
|
|
448
|
+
chainId: number;
|
|
449
|
+
name: string;
|
|
450
|
+
kind: "mainnet" | "testnet";
|
|
451
|
+
sponsored: true;
|
|
452
|
+
}>;
|
|
453
|
+
chains: QuotaChain[];
|
|
406
454
|
};
|
|
407
455
|
/**
|
|
408
456
|
* A paid subscription snapshot (from `GET /v1/billing/subscription`).
|
|
@@ -414,7 +462,8 @@ type SubscriptionSnapshot = {
|
|
|
414
462
|
tier: string;
|
|
415
463
|
/** `'active' | 'trialing'` mean feature access is granted. */
|
|
416
464
|
status: string;
|
|
417
|
-
|
|
465
|
+
/** `'admin'` = granted by the relayer's team; no store to manage it in. */
|
|
466
|
+
source: "stripe" | "apple" | "google" | "admin";
|
|
418
467
|
externalId: string;
|
|
419
468
|
currentPeriodEnd: string | null;
|
|
420
469
|
};
|
|
@@ -832,6 +881,34 @@ declare class WalletKitClient {
|
|
|
832
881
|
* subscription_exists` (already subscribed) and `400 tier_not_purchasable`.
|
|
833
882
|
*/
|
|
834
883
|
openCheckout(input: OpenCheckoutInput): Promise<CheckoutSession>;
|
|
884
|
+
/**
|
|
885
|
+
* Buy a booster pack (DEV-16547): creates a Stripe Checkout session for the
|
|
886
|
+
* pack (`POST /v1/billing/topup-session`) and, in a browser, navigates to it
|
|
887
|
+
* unless `redirect: false`. Same return-origin defaulting as `openCheckout`.
|
|
888
|
+
* `returnDeepLink` is passed on but not honoured yet: Stripe returns to the
|
|
889
|
+
* relayer's web pages, which don't hand off to an app.
|
|
890
|
+
*/
|
|
891
|
+
openTopup(input: {
|
|
892
|
+
pack: string;
|
|
893
|
+
returnOrigin?: string;
|
|
894
|
+
returnDeepLink?: string;
|
|
895
|
+
redirect?: boolean;
|
|
896
|
+
}): Promise<CheckoutSession & {
|
|
897
|
+
credits?: string;
|
|
898
|
+
}>;
|
|
899
|
+
/**
|
|
900
|
+
* Manage or cancel a Stripe subscription (DEV-16547): opens the Stripe
|
|
901
|
+
* customer portal (`POST /v1/billing/portal-session`), in a browser by
|
|
902
|
+
* navigating unless `redirect: false`. A store-managed (Apple/Google)
|
|
903
|
+
* subscription is a `409 manage_in_store` `WalletKitError` — send the user to
|
|
904
|
+
* the store instead.
|
|
905
|
+
*/
|
|
906
|
+
openBillingPortal(input?: {
|
|
907
|
+
returnOrigin?: string;
|
|
908
|
+
redirect?: boolean;
|
|
909
|
+
}): Promise<{
|
|
910
|
+
url: string;
|
|
911
|
+
}>;
|
|
835
912
|
beginKeyImport(): Promise<ImportBeginResponse>;
|
|
836
913
|
completeKeyImport(input: ImportCompleteInput): Promise<ImportCompleteResponse>;
|
|
837
914
|
requestKeyExport(input: ExportRequestInput): Promise<ExportRequestResponse>;
|
|
@@ -862,4 +939,4 @@ declare class IdentityError extends Error {
|
|
|
862
939
|
constructor(code: IdentityErrorCode, message: string);
|
|
863
940
|
}
|
|
864
941
|
|
|
865
|
-
export { type AddSubscriptionProfileResult, type BillingStore, type Catalog, type CatalogDefaultPrice, type CatalogPlan, type CatalogProduct, type ChainStatus, type CheckoutSession, type ControlProof, type ControllerSummary, type CoveredBy, type DeployProfileInput, type DeployProfileMultiChainResponse, type DeployProfileResponse, type DeployProfileSingleChainResponse, type DeployQueueStatus, type ExportCompleteResponse, type ExportRequestInput, type ExportRequestResponse, type ExportedKey, type ExtendVerdict, type ExtendVerdictReason, type FreeDefaultSnapshot, type Hex, IdentityError, type IdentityErrorCode, type IdentityProvider, type ImportBeginResponse, type ImportCompleteInput, type ImportCompleteResponse, type IpfsUploadTokenResponse, KeyCustodyError, type KeyCustodyErrorCode, type KeyCustodyOpContext, type KeyCustodyProvider, type Me, type NonceResponse, type OpContext, type OpenCheckoutInput, type Profile, type ProfileStatus, type ProfileWithChains, type PublicChain, type QuotaSnapshot, type RelaySponsoredInput, type RelaySponsoredResponse, type SignLsp25Input, type SignLsp25Response, type SignMessageResponse, type SignTransactionInput, type SignTransactionResponse, type SignTxRequest, type StoreTransactionResult, type Subject, type SubscriptionMember, type SubscriptionResponse, type SubscriptionSnapshot, type SubscriptionSummary, TIER_ERROR_CODES, TierError, type VerifiedToken, type VerifyOptions, type Wallet, type WalletInfo, WalletKitClient, type WalletKitClientConfig, WalletKitError, createWalletKitClient };
|
|
942
|
+
export { type AddSubscriptionProfileResult, type BillingStore, type Catalog, type CatalogDefaultPrice, type CatalogPlan, type CatalogProduct, type ChainStatus, type CheckoutSession, type ControlProof, type ControllerSummary, type CoveredBy, type DeployProfileInput, type DeployProfileMultiChainResponse, type DeployProfileResponse, type DeployProfileSingleChainResponse, type DeployQueueStatus, type ExportCompleteResponse, type ExportRequestInput, type ExportRequestResponse, type ExportedKey, type ExtendVerdict, type ExtendVerdictReason, type FreeDefaultSnapshot, type Hex, IdentityError, type IdentityErrorCode, type IdentityProvider, type ImportBeginResponse, type ImportCompleteInput, type ImportCompleteResponse, type IpfsUploadTokenResponse, KeyCustodyError, type KeyCustodyErrorCode, type KeyCustodyOpContext, type KeyCustodyProvider, type KindQuota, type Me, type NonceResponse, type OpContext, type OpenCheckoutInput, type Profile, type ProfileStatus, type ProfileWithChains, type PublicChain, type QuotaChain, type QuotaSnapshot, type RelaySponsoredInput, type RelaySponsoredResponse, type SignLsp25Input, type SignLsp25Response, type SignMessageResponse, type SignTransactionInput, type SignTransactionResponse, type SignTxRequest, type StoreTransactionResult, type Subject, type SubscriptionMember, type SubscriptionResponse, type SubscriptionSnapshot, type SubscriptionSummary, TIER_ERROR_CODES, TierError, type VerifiedToken, type VerifyOptions, type Wallet, type WalletInfo, WalletKitClient, type WalletKitClientConfig, WalletKitError, createWalletKitClient };
|
package/dist/index.js
CHANGED
|
@@ -292,6 +292,50 @@ var WalletKitClient = class {
|
|
|
292
292
|
}
|
|
293
293
|
return session;
|
|
294
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* Buy a booster pack (DEV-16547): creates a Stripe Checkout session for the
|
|
297
|
+
* pack (`POST /v1/billing/topup-session`) and, in a browser, navigates to it
|
|
298
|
+
* unless `redirect: false`. Same return-origin defaulting as `openCheckout`.
|
|
299
|
+
* `returnDeepLink` is passed on but not honoured yet: Stripe returns to the
|
|
300
|
+
* relayer's web pages, which don't hand off to an app.
|
|
301
|
+
*/
|
|
302
|
+
async openTopup(input) {
|
|
303
|
+
const loc = globalThis.window?.location;
|
|
304
|
+
const returnOrigin = input.returnOrigin ?? loc?.origin;
|
|
305
|
+
const session = await this.#request(
|
|
306
|
+
"POST",
|
|
307
|
+
"/v1/billing/topup-session",
|
|
308
|
+
{
|
|
309
|
+
pack: input.pack,
|
|
310
|
+
...input.returnDeepLink ? { returnDeepLink: input.returnDeepLink } : {},
|
|
311
|
+
...returnOrigin ? { returnOrigin } : {}
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
if (input.redirect !== false && loc) {
|
|
315
|
+
loc.href = session.url;
|
|
316
|
+
}
|
|
317
|
+
return session;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Manage or cancel a Stripe subscription (DEV-16547): opens the Stripe
|
|
321
|
+
* customer portal (`POST /v1/billing/portal-session`), in a browser by
|
|
322
|
+
* navigating unless `redirect: false`. A store-managed (Apple/Google)
|
|
323
|
+
* subscription is a `409 manage_in_store` `WalletKitError` — send the user to
|
|
324
|
+
* the store instead.
|
|
325
|
+
*/
|
|
326
|
+
async openBillingPortal(input = {}) {
|
|
327
|
+
const loc = globalThis.window?.location;
|
|
328
|
+
const returnOrigin = input.returnOrigin ?? loc?.origin;
|
|
329
|
+
const session = await this.#request(
|
|
330
|
+
"POST",
|
|
331
|
+
"/v1/billing/portal-session",
|
|
332
|
+
returnOrigin ? { returnOrigin } : {}
|
|
333
|
+
);
|
|
334
|
+
if (input.redirect !== false && loc) {
|
|
335
|
+
loc.href = session.url;
|
|
336
|
+
}
|
|
337
|
+
return session;
|
|
338
|
+
}
|
|
295
339
|
// --- key import / export ---
|
|
296
340
|
async beginKeyImport() {
|
|
297
341
|
return this.#request("GET", "/v1/keys/import/begin");
|