@universal-everything/sdk-core 1.1.0-dev.19fc914 → 1.1.0-dev.21c58cf
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 +207 -9
- package/dist/index.js +39 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -139,6 +139,8 @@ type Profile = {
|
|
|
139
139
|
status?: ProfileStatus;
|
|
140
140
|
defaultControllerId: string | null;
|
|
141
141
|
controllers: ControllerSummary[];
|
|
142
|
+
/** The owner-level deploy-time controller (lowercase) or `null` = unknown. */
|
|
143
|
+
generatingController: string | null;
|
|
142
144
|
createdAt: string;
|
|
143
145
|
};
|
|
144
146
|
/**
|
|
@@ -157,6 +159,12 @@ type ChainStatus = {
|
|
|
157
159
|
profileId: string;
|
|
158
160
|
chainId: number;
|
|
159
161
|
status: ProfileStatus;
|
|
162
|
+
/**
|
|
163
|
+
* The owner-level controller the LSP23 deploy granted (lowercase), or
|
|
164
|
+
* `null` = unknown. Clients compare it with their own keystore to tell a
|
|
165
|
+
* *created* profile from an *Imported* (secondary-key) one.
|
|
166
|
+
*/
|
|
167
|
+
generatingController: string | null;
|
|
160
168
|
label: string | null;
|
|
161
169
|
defaultControllerId: string | null;
|
|
162
170
|
controllers: ControllerSummary[];
|
|
@@ -172,8 +180,153 @@ type ChainStatus = {
|
|
|
172
180
|
* `getProfileByAddress`. Address is the natural primary key once a UP
|
|
173
181
|
* may live on multiple chains (handoff G1).
|
|
174
182
|
*/
|
|
183
|
+
/** A subscription currently covering an identity. */
|
|
184
|
+
type CoveredBy = {
|
|
185
|
+
subscriptionId: string;
|
|
186
|
+
/**
|
|
187
|
+
* `self` = owned by the caller's account. `other` (a foreign covering
|
|
188
|
+
* subscription) is reserved for R2's explicit membership — the server only
|
|
189
|
+
* emits `self` today.
|
|
190
|
+
*/
|
|
191
|
+
owner: "self" | "other";
|
|
192
|
+
tier: string;
|
|
193
|
+
status: string;
|
|
194
|
+
source: string;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Server-side extend verdict — ADVISORY. `reason` reports the ownership and
|
|
198
|
+
* capacity gates the extend route enforces for this session; target-dependent
|
|
199
|
+
* gates (chain availability, tier chain allow-list, LSP23 package / factory /
|
|
200
|
+
* deployability) come from `extend-targets` and at submit, so `null` means
|
|
201
|
+
* "no ownership or capacity refusal", not "extend will succeed". Whether THIS
|
|
202
|
+
* device can extend (holds the generating key) is the client's call from
|
|
203
|
+
* `generatingController`.
|
|
204
|
+
*/
|
|
205
|
+
type ExtendVerdictReason = "not_active" | "held_by_another_login" | "subscription_required" | "cross_chain_cap_reached" | "capacity_unknown";
|
|
206
|
+
type ExtendVerdict = {
|
|
207
|
+
/**
|
|
208
|
+
* Chains the identity is live on (active / pending), across every login of
|
|
209
|
+
* the holder account — NOT candidate targets; those come from
|
|
210
|
+
* `GET /v1/profiles/:id/extend-targets`, whose occupancy check is scoped to
|
|
211
|
+
* the calling login.
|
|
212
|
+
*/
|
|
213
|
+
chains: number[];
|
|
214
|
+
reason: ExtendVerdictReason | null;
|
|
215
|
+
};
|
|
216
|
+
/** A store the relayer sells through. The tiers are the same in every store. */
|
|
217
|
+
type BillingStore = "stripe" | "apple" | "google";
|
|
218
|
+
/** One purchasable item of a plan in one store — see {@link RelayerClient.getCatalog}. */
|
|
219
|
+
type CatalogProduct = {
|
|
220
|
+
store: BillingStore;
|
|
221
|
+
/**
|
|
222
|
+
* The id the store knows the item by: the Stripe Price id, the App Store /
|
|
223
|
+
* Play product id. On Apple / Google, fetch the localized title and price
|
|
224
|
+
* from StoreKit / Play Billing with it — those are what the user must see.
|
|
225
|
+
*/
|
|
226
|
+
externalProductId: string;
|
|
227
|
+
displayName: string;
|
|
228
|
+
/** Stripe: the charged amount. Apple / Google: a reference price only. */
|
|
229
|
+
amountCents: number | null;
|
|
230
|
+
currency: string | null;
|
|
231
|
+
/** Stripe only; always `false` / `0` for Apple / Google (attach order). */
|
|
232
|
+
isDefault: boolean;
|
|
233
|
+
sortOrder: number;
|
|
234
|
+
/** What the store needs besides the id (Play `basePlanId`); `{}` for Stripe. */
|
|
235
|
+
metadata: Record<string, unknown>;
|
|
236
|
+
productName: string | null;
|
|
237
|
+
productDescription: string | null;
|
|
238
|
+
};
|
|
239
|
+
/** The plan's default Stripe Price — see {@link CatalogPlan.defaultPrice}. */
|
|
240
|
+
type CatalogDefaultPrice = {
|
|
241
|
+
stripePriceId: string;
|
|
242
|
+
displayName: string;
|
|
243
|
+
amountCents: number | null;
|
|
244
|
+
currency: string | null;
|
|
245
|
+
stripeMode: "test" | "live";
|
|
246
|
+
productName: string | null;
|
|
247
|
+
productDescription: string | null;
|
|
248
|
+
};
|
|
249
|
+
/** One plan of `GET /v1/billing/catalog` — what it grants and what buys it. */
|
|
250
|
+
type CatalogPlan = {
|
|
251
|
+
/** `tier:<name>` for subscriptions, `pack:<name>` for one-time packs. */
|
|
252
|
+
key: string;
|
|
253
|
+
label: string;
|
|
254
|
+
description: string | null;
|
|
255
|
+
audience: "user" | "dev";
|
|
256
|
+
cadence: string;
|
|
257
|
+
/** What a store page groups by. `interval` is null for a one-time purchase. */
|
|
258
|
+
kind: "subscription" | "one_time";
|
|
259
|
+
interval: "day" | "month" | "year" | null;
|
|
260
|
+
stackable: boolean;
|
|
261
|
+
/** Only purchasable on top of a live subscription. */
|
|
262
|
+
requiresSubscription: boolean;
|
|
263
|
+
mainnetProfileCap: number;
|
|
264
|
+
testnetProfileCap: number;
|
|
265
|
+
crossChainDeployCap: number;
|
|
266
|
+
crossChainTestnetCap: number;
|
|
267
|
+
crossChainEnabledChains: number[];
|
|
268
|
+
overageEnabled: boolean;
|
|
269
|
+
overageCapCredits: string | null;
|
|
270
|
+
/** Gas budget per period in credits (1 credit = €1), decimal string. */
|
|
271
|
+
credits: string | null;
|
|
272
|
+
gasCreditsPerChain: Record<string, string>;
|
|
273
|
+
/**
|
|
274
|
+
* The default Stripe Price, whatever `store` was requested (null = none
|
|
275
|
+
* attached). Predates `products`; a store page reads `products`.
|
|
276
|
+
*/
|
|
277
|
+
defaultPrice: CatalogDefaultPrice | null;
|
|
278
|
+
/** Active items for the requested store. */
|
|
279
|
+
products: CatalogProduct[];
|
|
280
|
+
};
|
|
281
|
+
type Catalog = {
|
|
282
|
+
audience: "user" | "dev";
|
|
283
|
+
store: BillingStore;
|
|
284
|
+
plans: CatalogPlan[];
|
|
285
|
+
};
|
|
286
|
+
/** One entry of `GET /v1/subscriptions` — a subscription of the caller's account. */
|
|
287
|
+
type SubscriptionSummary = {
|
|
288
|
+
subscriptionId: string;
|
|
289
|
+
/** Always `self` today; `other` (a subscription that only covers one of your profiles) arrives with explicit membership. */
|
|
290
|
+
owner: "self" | "other";
|
|
291
|
+
tier: string;
|
|
292
|
+
status: string;
|
|
293
|
+
/** `active` or `trialing`. */
|
|
294
|
+
live: boolean;
|
|
295
|
+
source: "stripe" | "apple" | "google" | "admin";
|
|
296
|
+
currentPeriodEnd: string | null;
|
|
297
|
+
/** Where Manage goes: `stripe` ⇒ {@link RelayerClient.createPortalSession}; `apple` / `google` ⇒ the store; `admin` ⇒ nothing. */
|
|
298
|
+
manage: {
|
|
299
|
+
kind: "stripe" | "apple" | "google" | "admin";
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
/** `GET /v1/me` — the authenticated login and its account context. */
|
|
303
|
+
type Me = {
|
|
304
|
+
subject: string;
|
|
305
|
+
isAdmin: boolean;
|
|
306
|
+
/** The login's personal account (null only before provisioning). */
|
|
307
|
+
accountId: string | null;
|
|
308
|
+
/** This login's own tier — what the cross-chain cap resolves from. */
|
|
309
|
+
tier: string;
|
|
310
|
+
/**
|
|
311
|
+
* The account's effective tier (best tier across its login subjects) —
|
|
312
|
+
* what gas coverage resolves from. Differs from `tier` only on legacy
|
|
313
|
+
* multi-login accounts.
|
|
314
|
+
*/
|
|
315
|
+
accountTier: string;
|
|
316
|
+
};
|
|
175
317
|
type ProfileWithChains = {
|
|
176
318
|
address: Hex;
|
|
319
|
+
/**
|
|
320
|
+
* Identity-level generating controller: the value every chain row agrees
|
|
321
|
+
* on; `null` when unknown or when the rows disagree.
|
|
322
|
+
*/
|
|
323
|
+
generatingController: string | null;
|
|
324
|
+
/**
|
|
325
|
+
* Present on the `/v1/profiles` mount; omitted on the sig-auth
|
|
326
|
+
* `/v1/relayer/profiles` mirror.
|
|
327
|
+
*/
|
|
328
|
+
coveredBy?: CoveredBy[];
|
|
329
|
+
extend: ExtendVerdict;
|
|
177
330
|
chains: ChainStatus[];
|
|
178
331
|
};
|
|
179
332
|
type QuotaSnapshot = {
|
|
@@ -313,6 +466,11 @@ type NonceResponse = {
|
|
|
313
466
|
nonce: string;
|
|
314
467
|
issuedAt: string;
|
|
315
468
|
};
|
|
469
|
+
/** `POST /v1/ipfs/upload-token` — a short-lived bearer for the IPFS upload service. */
|
|
470
|
+
type IpfsUploadTokenResponse = {
|
|
471
|
+
token: string;
|
|
472
|
+
expiresAt: string;
|
|
473
|
+
};
|
|
316
474
|
type DeployProfileBase = {
|
|
317
475
|
chainId: number;
|
|
318
476
|
label?: string | null;
|
|
@@ -331,10 +489,17 @@ type DeployProfileBase = {
|
|
|
331
489
|
* Deploy a sponsored Universal Profile. Two mutually-exclusive controller
|
|
332
490
|
* modes:
|
|
333
491
|
* - **custody**: `controllerWalletId` — a relayer-held wallet row.
|
|
334
|
-
* - **external (A1)**: `controllerAddress` + `controlProof` — a user-held key
|
|
335
|
-
* (a Privy embedded wallet, or an extension/mobile key)
|
|
336
|
-
* by
|
|
492
|
+
* - **external (A1)**: `controllerAddress` (+ `controlProof`) — a user-held key
|
|
493
|
+
* (a Privy embedded wallet, or an extension/mobile key). The proof is a
|
|
494
|
+
* signature by that key over a nonce-bound challenge; build it with
|
|
337
495
|
* `@universal-everything/sdk-core-viem`'s `buildControlProof`.
|
|
496
|
+
*
|
|
497
|
+
* On `/v1` the proof is **optional**: a first-time user has only a social
|
|
498
|
+
* login, and the extension / mobile app holding the new controller cannot sign
|
|
499
|
+
* for a not-yet-deployed profile. When present it is always verified. The next
|
|
500
|
+
* API version makes it mandatory for everyone (relayer
|
|
501
|
+
* `docs/DESIGN_2026-09-10_control-proof-versioning.md`), so callers that CAN
|
|
502
|
+
* sign (a Privy embedded wallet) should always send it.
|
|
338
503
|
*/
|
|
339
504
|
type DeployProfileInput = (DeployProfileBase & {
|
|
340
505
|
controllerWalletId: string;
|
|
@@ -342,7 +507,7 @@ type DeployProfileInput = (DeployProfileBase & {
|
|
|
342
507
|
controlProof?: never;
|
|
343
508
|
}) | (DeployProfileBase & {
|
|
344
509
|
controllerAddress: Hex;
|
|
345
|
-
controlProof
|
|
510
|
+
controlProof?: ControlProof;
|
|
346
511
|
controllerWalletId?: never;
|
|
347
512
|
});
|
|
348
513
|
type DeployProfileSingleChainResponse = {
|
|
@@ -447,10 +612,7 @@ declare class TierError extends WalletKitError {
|
|
|
447
612
|
declare class WalletKitClient {
|
|
448
613
|
#private;
|
|
449
614
|
constructor(config: WalletKitClientConfig);
|
|
450
|
-
me(): Promise<
|
|
451
|
-
subject: string;
|
|
452
|
-
isAdmin: boolean;
|
|
453
|
-
}>;
|
|
615
|
+
me(): Promise<Me>;
|
|
454
616
|
listWallets(): Promise<Wallet[]>;
|
|
455
617
|
getWallet(walletId: string): Promise<Wallet>;
|
|
456
618
|
createWallet(input?: {
|
|
@@ -475,6 +637,14 @@ declare class WalletKitClient {
|
|
|
475
637
|
* bind an A1 control proof for an external-controller {@link deployProfile}.
|
|
476
638
|
*/
|
|
477
639
|
getNonce(): Promise<NonceResponse>;
|
|
640
|
+
/**
|
|
641
|
+
* Mint a short-lived (~120s) HS256 token for the IPFS upload service
|
|
642
|
+
* (`POST /v1/ipfs/upload-token`, authenticated). Fetch one per upload:
|
|
643
|
+
* the token is meant to expire within the service's 600s window (which the
|
|
644
|
+
* service does not enforce today — see the relayer's routes/ipfs.ts). 503
|
|
645
|
+
* when the relayer has no upload secret configured.
|
|
646
|
+
*/
|
|
647
|
+
getIpfsUploadToken(): Promise<IpfsUploadTokenResponse>;
|
|
478
648
|
importProfile(input: {
|
|
479
649
|
address: Hex;
|
|
480
650
|
chainId: number;
|
|
@@ -498,6 +668,34 @@ declare class WalletKitClient {
|
|
|
498
668
|
* default (`source === null`) when they have no paid subscription.
|
|
499
669
|
*/
|
|
500
670
|
getSubscription(): Promise<SubscriptionResponse>;
|
|
671
|
+
/**
|
|
672
|
+
* What can be bought, per store — what a store page renders. With `store`
|
|
673
|
+
* the list holds only the plans purchasable there plus the free tier;
|
|
674
|
+
* without it every active plan comes back with its Stripe products (empty
|
|
675
|
+
* = not purchasable yet). The layout is the caller's: group by `kind` /
|
|
676
|
+
* `interval`; Stripe products arrive in `sortOrder`.
|
|
677
|
+
*/
|
|
678
|
+
getCatalog(opts?: {
|
|
679
|
+
audience?: "user" | "dev";
|
|
680
|
+
store?: BillingStore;
|
|
681
|
+
}): Promise<Catalog>;
|
|
682
|
+
/**
|
|
683
|
+
* Every subscription of the caller's account, live ones first — what the
|
|
684
|
+
* dashboard's account / subscription dropdown renders.
|
|
685
|
+
*/
|
|
686
|
+
listSubscriptions(): Promise<{
|
|
687
|
+
subscriptions: SubscriptionSummary[];
|
|
688
|
+
}>;
|
|
689
|
+
/**
|
|
690
|
+
* Stripe Customer Portal URL for the caller's own Stripe subscription.
|
|
691
|
+
* Rejects with `manage_in_store` (409) for an Apple / Google subscription
|
|
692
|
+
* and `no_subscription` (404) when there is nothing to manage.
|
|
693
|
+
*/
|
|
694
|
+
createPortalSession(opts?: {
|
|
695
|
+
returnOrigin?: string;
|
|
696
|
+
}): Promise<{
|
|
697
|
+
url: string;
|
|
698
|
+
}>;
|
|
501
699
|
/**
|
|
502
700
|
* Start a Stripe Checkout for a tier and return the created session
|
|
503
701
|
* `{ id, url }`. In a browser this ALSO navigates to `url` by default
|
|
@@ -539,4 +737,4 @@ declare class IdentityError extends Error {
|
|
|
539
737
|
constructor(code: IdentityErrorCode, message: string);
|
|
540
738
|
}
|
|
541
739
|
|
|
542
|
-
export { type ChainStatus, type CheckoutSession, type ControlProof, type ControllerSummary, type DeployProfileInput, type DeployProfileMultiChainResponse, type DeployProfileResponse, type DeployProfileSingleChainResponse, type DeployQueueStatus, type ExportCompleteResponse, type ExportRequestInput, type ExportRequestResponse, type ExportedKey, type FreeDefaultSnapshot, type Hex, IdentityError, type IdentityErrorCode, type IdentityProvider, type ImportBeginResponse, type ImportCompleteInput, type ImportCompleteResponse, KeyCustodyError, type KeyCustodyErrorCode, type KeyCustodyOpContext, type KeyCustodyProvider, type NonceResponse, type OpContext, type OpenCheckoutInput, type Profile, type ProfileStatus, type ProfileWithChains, type QuotaSnapshot, type RelaySponsoredInput, type RelaySponsoredResponse, type SignLsp25Input, type SignLsp25Response, type SignMessageResponse, type SignTransactionInput, type SignTransactionResponse, type SignTxRequest, type Subject, type SubscriptionResponse, type SubscriptionSnapshot, TIER_ERROR_CODES, TierError, type VerifiedToken, type VerifyOptions, type Wallet, type WalletInfo, WalletKitClient, type WalletKitClientConfig, WalletKitError, createWalletKitClient };
|
|
740
|
+
export { 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 QuotaSnapshot, type RelaySponsoredInput, type RelaySponsoredResponse, type SignLsp25Input, type SignLsp25Response, type SignMessageResponse, type SignTransactionInput, type SignTransactionResponse, type SignTxRequest, type Subject, 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
|
@@ -121,6 +121,16 @@ var WalletKitClient = class {
|
|
|
121
121
|
async getNonce() {
|
|
122
122
|
return this.#request("POST", "/v1/auth/nonce");
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Mint a short-lived (~120s) HS256 token for the IPFS upload service
|
|
126
|
+
* (`POST /v1/ipfs/upload-token`, authenticated). Fetch one per upload:
|
|
127
|
+
* the token is meant to expire within the service's 600s window (which the
|
|
128
|
+
* service does not enforce today — see the relayer's routes/ipfs.ts). 503
|
|
129
|
+
* when the relayer has no upload secret configured.
|
|
130
|
+
*/
|
|
131
|
+
async getIpfsUploadToken() {
|
|
132
|
+
return this.#request("POST", "/v1/ipfs/upload-token");
|
|
133
|
+
}
|
|
124
134
|
async importProfile(input) {
|
|
125
135
|
return this.#request("POST", "/v1/profiles/import", input);
|
|
126
136
|
}
|
|
@@ -160,6 +170,35 @@ var WalletKitClient = class {
|
|
|
160
170
|
async getSubscription() {
|
|
161
171
|
return this.#request("GET", "/v1/billing/subscription");
|
|
162
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* What can be bought, per store — what a store page renders. With `store`
|
|
175
|
+
* the list holds only the plans purchasable there plus the free tier;
|
|
176
|
+
* without it every active plan comes back with its Stripe products (empty
|
|
177
|
+
* = not purchasable yet). The layout is the caller's: group by `kind` /
|
|
178
|
+
* `interval`; Stripe products arrive in `sortOrder`.
|
|
179
|
+
*/
|
|
180
|
+
async getCatalog(opts) {
|
|
181
|
+
const query = new URLSearchParams();
|
|
182
|
+
if (opts?.audience) query.set("audience", opts.audience);
|
|
183
|
+
if (opts?.store) query.set("store", opts.store);
|
|
184
|
+
const qs = query.toString();
|
|
185
|
+
return this.#request("GET", `/v1/billing/catalog${qs ? `?${qs}` : ""}`);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Every subscription of the caller's account, live ones first — what the
|
|
189
|
+
* dashboard's account / subscription dropdown renders.
|
|
190
|
+
*/
|
|
191
|
+
async listSubscriptions() {
|
|
192
|
+
return this.#request("GET", "/v1/subscriptions");
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Stripe Customer Portal URL for the caller's own Stripe subscription.
|
|
196
|
+
* Rejects with `manage_in_store` (409) for an Apple / Google subscription
|
|
197
|
+
* and `no_subscription` (404) when there is nothing to manage.
|
|
198
|
+
*/
|
|
199
|
+
async createPortalSession(opts) {
|
|
200
|
+
return this.#request("POST", "/v1/billing/portal-session", opts ?? {});
|
|
201
|
+
}
|
|
163
202
|
/**
|
|
164
203
|
* Start a Stripe Checkout for a tier and return the created session
|
|
165
204
|
* `{ id, url }`. In a browser this ALSO navigates to `url` by default
|