@farcaster/frame-core 0.0.23 → 0.0.24

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.
@@ -0,0 +1,4 @@
1
+ export type ViewProfileOptions = {
2
+ fid: number;
3
+ };
4
+ export type ViewProfile = (options: ViewProfileOptions) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,3 @@
1
1
  export * as AddFrame from './AddFrame';
2
+ export * as ViewProfile from './ViewProfile';
2
3
  export * as SignIn from './SignIn';
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.SignIn = exports.AddFrame = void 0;
36
+ exports.SignIn = exports.ViewProfile = exports.AddFrame = void 0;
37
37
  exports.AddFrame = __importStar(require("./AddFrame"));
38
+ exports.ViewProfile = __importStar(require("./ViewProfile"));
38
39
  exports.SignIn = __importStar(require("./SignIn"));
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from 'ox';
2
- import type { AddFrame, SignIn } from './actions';
2
+ import type { AddFrame, SignIn, ViewProfile } from './actions';
3
3
  import type { FrameContext } from './context';
4
4
  import type { EventFrameAdded, EventFrameRemoved, EventNotificationsDisabled, EventNotificationsEnabled } from './schemas';
5
5
  export type SetPrimaryButtonOptions = {
@@ -47,6 +47,7 @@ export type WireFrameHost = {
47
47
  ethProviderRequestV2: RpcTransport;
48
48
  eip6963RequestProvider: () => void;
49
49
  addFrame: AddFrame.WireAddFrame;
50
+ viewProfile: ViewProfile.ViewProfile;
50
51
  };
51
52
  export type FrameHost = {
52
53
  context: FrameContext;
@@ -63,6 +64,7 @@ export type FrameHost = {
63
64
  */
64
65
  eip6963RequestProvider: () => void;
65
66
  addFrame: AddFrame.AddFrame;
67
+ viewProfile: ViewProfile.ViewProfile;
66
68
  };
67
69
  export type FrameEthProviderEventData = {
68
70
  type: 'frame_eth_provider_event';
@@ -1,40 +1,36 @@
1
- import * as Errors from '../errors'
2
- import type { OneOf } from '../internal/types'
3
- import type { FrameNotificationDetails } from '../schemas'
1
+ import * as Errors from '../errors';
2
+ import type { OneOf } from '../internal/types';
3
+ import type { FrameNotificationDetails } from '../schemas';
4
4
  export type AddFrameResult = {
5
- notificationDetails?: FrameNotificationDetails
6
- }
7
- export type AddFrame = () => Promise<AddFrameResult>
5
+ notificationDetails?: FrameNotificationDetails;
6
+ };
7
+ export type AddFrame = () => Promise<AddFrameResult>;
8
8
  type InvalidDomainManifestJsonError = {
9
- type: 'invalid_domain_manifest'
10
- }
9
+ type: 'invalid_domain_manifest';
10
+ };
11
11
  type RejectedByUserJsonError = {
12
- type: 'rejected_by_user'
13
- }
14
- export type AddFrameJsonError =
15
- | InvalidDomainManifestJsonError
16
- | RejectedByUserJsonError
17
- export type AddFrameRejectedReason = AddFrameJsonError['type']
18
- export type AddFrameJsonResult = OneOf<
19
- | {
20
- result: AddFrameResult
21
- }
22
- | {
23
- error: AddFrameJsonError
24
- }
25
- >
26
- export type WireAddFrame = () => Promise<AddFrameJsonResult>
12
+ type: 'rejected_by_user';
13
+ };
14
+ export type AddFrameJsonError = InvalidDomainManifestJsonError | RejectedByUserJsonError;
15
+ export type AddFrameRejectedReason = AddFrameJsonError['type'];
16
+ export type AddFrameJsonResult = OneOf<{
17
+ result: AddFrameResult;
18
+ } | {
19
+ error: AddFrameJsonError;
20
+ }>;
21
+ export type WireAddFrame = () => Promise<AddFrameJsonResult>;
27
22
  /**
28
23
  * Thrown when the frame does not have a valid domain manifest.
29
24
  */
30
25
  export declare class InvalidDomainManifest extends Errors.BaseError {
31
- readonly name = 'AddFrame.InvalidDomainManifest'
32
- constructor()
26
+ readonly name = "AddFrame.InvalidDomainManifest";
27
+ constructor();
33
28
  }
34
29
  /**
35
30
  * Thrown when add frame action was rejected by the user.
36
31
  */
37
32
  export declare class RejectedByUser extends Errors.BaseError {
38
- readonly name = 'AddFrame.RejectedByUser'
39
- constructor()
33
+ readonly name = "AddFrame.RejectedByUser";
34
+ constructor();
40
35
  }
36
+ export {};
@@ -1,19 +1,19 @@
1
- import * as Errors from '../errors'
1
+ import * as Errors from '../errors';
2
2
  /**
3
3
  * Thrown when the frame does not have a valid domain manifest.
4
4
  */
5
5
  export class InvalidDomainManifest extends Errors.BaseError {
6
- name = 'AddFrame.InvalidDomainManifest'
7
- constructor() {
8
- super('Invalid domain manifest')
9
- }
6
+ name = 'AddFrame.InvalidDomainManifest';
7
+ constructor() {
8
+ super('Invalid domain manifest');
9
+ }
10
10
  }
11
11
  /**
12
12
  * Thrown when add frame action was rejected by the user.
13
13
  */
14
14
  export class RejectedByUser extends Errors.BaseError {
15
- name = 'AddFrame.RejectedByUser'
16
- constructor() {
17
- super('Add frame rejected by user')
18
- }
15
+ name = 'AddFrame.RejectedByUser';
16
+ constructor() {
17
+ super('Add frame rejected by user');
18
+ }
19
19
  }
@@ -1,43 +1,41 @@
1
- import * as Errors from '../errors'
2
- import type { OneOf } from '../internal/types'
1
+ import * as Errors from '../errors';
2
+ import type { OneOf } from '../internal/types';
3
3
  export type SignInOptions = {
4
- /**
5
- * A random string used to prevent replay attacks.
6
- */
7
- nonce: string
8
- /**
9
- * Start time at which the signature becomes valid.
10
- * ISO 8601 datetime.
11
- */
12
- notBefore?: string
13
- /**
14
- * Expiration time at which the signature is no longer valid.
15
- * ISO 8601 datetime.
16
- */
17
- expirationTime?: string
18
- }
4
+ /**
5
+ * A random string used to prevent replay attacks.
6
+ */
7
+ nonce: string;
8
+ /**
9
+ * Start time at which the signature becomes valid.
10
+ * ISO 8601 datetime.
11
+ */
12
+ notBefore?: string;
13
+ /**
14
+ * Expiration time at which the signature is no longer valid.
15
+ * ISO 8601 datetime.
16
+ */
17
+ expirationTime?: string;
18
+ };
19
19
  export type SignInResult = {
20
- signature: string
21
- message: string
22
- }
23
- export type SignIn = (options: SignInOptions) => Promise<SignInResult>
20
+ signature: string;
21
+ message: string;
22
+ };
23
+ export type SignIn = (options: SignInOptions) => Promise<SignInResult>;
24
24
  type RejectedByUserJsonError = {
25
- type: 'rejected_by_user'
26
- }
27
- export type SignInJsonError = RejectedByUserJsonError
28
- export type SignInJsonResult = OneOf<
29
- | {
30
- result: SignInResult
31
- }
32
- | {
33
- error: SignInJsonError
34
- }
35
- >
36
- export type WireSignIn = (options: SignInOptions) => Promise<SignInJsonResult>
25
+ type: 'rejected_by_user';
26
+ };
27
+ export type SignInJsonError = RejectedByUserJsonError;
28
+ export type SignInJsonResult = OneOf<{
29
+ result: SignInResult;
30
+ } | {
31
+ error: SignInJsonError;
32
+ }>;
33
+ export type WireSignIn = (options: SignInOptions) => Promise<SignInJsonResult>;
37
34
  /**
38
35
  * Thrown when a sign in action was rejected.
39
36
  */
40
37
  export declare class RejectedByUser extends Errors.BaseError {
41
- readonly name = 'SignIn.RejectedByUser'
42
- constructor()
38
+ readonly name = "SignIn.RejectedByUser";
39
+ constructor();
43
40
  }
41
+ export {};
@@ -1,10 +1,10 @@
1
- import * as Errors from '../errors'
1
+ import * as Errors from '../errors';
2
2
  /**
3
3
  * Thrown when a sign in action was rejected.
4
4
  */
5
5
  export class RejectedByUser extends Errors.BaseError {
6
- name = 'SignIn.RejectedByUser'
7
- constructor() {
8
- super('Sign in rejected by user')
9
- }
6
+ name = 'SignIn.RejectedByUser';
7
+ constructor() {
8
+ super('Sign in rejected by user');
9
+ }
10
10
  }
@@ -0,0 +1,4 @@
1
+ export type ViewProfileOptions = {
2
+ fid: number;
3
+ };
4
+ export type ViewProfile = (options: ViewProfileOptions) => Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,3 @@
1
- export * as AddFrame from './AddFrame'
2
- export * as SignIn from './SignIn'
1
+ export * as AddFrame from './AddFrame';
2
+ export * as ViewProfile from './ViewProfile';
3
+ export * as SignIn from './SignIn';
@@ -1,2 +1,3 @@
1
- export * as AddFrame from './AddFrame'
2
- export * as SignIn from './SignIn'
1
+ export * as AddFrame from './AddFrame';
2
+ export * as ViewProfile from './ViewProfile';
3
+ export * as SignIn from './SignIn';
package/esm/context.d.ts CHANGED
@@ -1,76 +1,72 @@
1
- import type { FrameNotificationDetails } from './schemas'
1
+ import type { FrameNotificationDetails } from './schemas';
2
2
  export type CastEmbedLocationContext = {
3
- type: 'cast_embed'
4
- embed: string
5
- cast: {
6
- fid: number
7
- hash: string
8
- }
9
- }
3
+ type: 'cast_embed';
4
+ embed: string;
5
+ cast: {
6
+ fid: number;
7
+ hash: string;
8
+ };
9
+ };
10
10
  export type NotificationLocationContext = {
11
- type: 'notification'
12
- notification: {
13
- notificationId: string
14
- title: string
15
- body: string
16
- }
17
- }
11
+ type: 'notification';
12
+ notification: {
13
+ notificationId: string;
14
+ title: string;
15
+ body: string;
16
+ };
17
+ };
18
18
  export type LauncherLocationContext = {
19
- type: 'launcher'
20
- }
19
+ type: 'launcher';
20
+ };
21
21
  export type ChannelLocationContext = {
22
- type: 'channel'
23
- channel: {
24
- /**
25
- * Channel key identifier
26
- */
27
- key: string
22
+ type: 'channel';
23
+ channel: {
24
+ /**
25
+ * Channel key identifier
26
+ */
27
+ key: string;
28
+ /**
29
+ * Channel name
30
+ */
31
+ name: string;
32
+ /**
33
+ * Channel profile image URL
34
+ */
35
+ imageUrl?: string;
36
+ };
37
+ };
38
+ export type LocationContext = CastEmbedLocationContext | NotificationLocationContext | LauncherLocationContext | ChannelLocationContext;
39
+ export type AccountLocation = {
40
+ placeId: string;
28
41
  /**
29
- * Channel name
42
+ * Human-readable string describing the location
30
43
  */
31
- name: string
44
+ description: string;
45
+ };
46
+ export type UserContext = {
47
+ fid: number;
48
+ username?: string;
49
+ displayName?: string;
32
50
  /**
33
- * Channel profile image URL
51
+ * Profile image URL
34
52
  */
35
- imageUrl?: string
36
- }
37
- }
38
- export type LocationContext =
39
- | CastEmbedLocationContext
40
- | NotificationLocationContext
41
- | LauncherLocationContext
42
- | ChannelLocationContext
43
- export type AccountLocation = {
44
- placeId: string
45
- /**
46
- * Human-readable string describing the location
47
- */
48
- description: string
49
- }
50
- export type UserContext = {
51
- fid: number
52
- username?: string
53
- displayName?: string
54
- /**
55
- * Profile image URL
56
- */
57
- pfpUrl?: string
58
- location?: AccountLocation
59
- }
53
+ pfpUrl?: string;
54
+ location?: AccountLocation;
55
+ };
60
56
  export type SafeAreaInsets = {
61
- top: number
62
- bottom: number
63
- left: number
64
- right: number
65
- }
57
+ top: number;
58
+ bottom: number;
59
+ left: number;
60
+ right: number;
61
+ };
66
62
  export type ClientContext = {
67
- clientFid: number
68
- added: boolean
69
- notificationDetails?: FrameNotificationDetails
70
- safeAreaInsets?: SafeAreaInsets
71
- }
63
+ clientFid: number;
64
+ added: boolean;
65
+ notificationDetails?: FrameNotificationDetails;
66
+ safeAreaInsets?: SafeAreaInsets;
67
+ };
72
68
  export type FrameContext = {
73
- client: ClientContext
74
- user: UserContext
75
- location?: LocationContext
76
- }
69
+ client: ClientContext;
70
+ user: UserContext;
71
+ location?: LocationContext;
72
+ };
package/esm/context.js CHANGED
@@ -1 +1 @@
1
- export {}
1
+ export {};
package/esm/errors.d.ts CHANGED
@@ -1,12 +1,10 @@
1
- export declare class BaseError<
2
- cause extends Error | undefined = undefined,
3
- > extends Error {
4
- name: string
5
- cause: cause
6
- constructor(message: string, options?: BaseError.Options<cause>)
1
+ export declare class BaseError<cause extends Error | undefined = undefined> extends Error {
2
+ name: string;
3
+ cause: cause;
4
+ constructor(message: string, options?: BaseError.Options<cause>);
7
5
  }
8
6
  export declare namespace BaseError {
9
- type Options<cause extends Error | undefined = Error | undefined> = {
10
- cause?: cause | undefined
11
- }
7
+ type Options<cause extends Error | undefined = Error | undefined> = {
8
+ cause?: cause | undefined;
9
+ };
12
10
  }
package/esm/errors.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export class BaseError extends Error {
2
- name = 'BaseError'
3
- cause
4
- constructor(message, options = {}) {
5
- super(message, options.cause ? { cause: options.cause } : undefined)
6
- this.cause = options.cause
7
- }
2
+ name = 'BaseError';
3
+ cause;
4
+ constructor(message, options = {}) {
5
+ super(message, options.cause ? { cause: options.cause } : undefined);
6
+ this.cause = options.cause;
7
+ }
8
8
  }
package/esm/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './actions'
2
- export * as Context from './context'
3
- export * from './types'
4
- export * from './schemas'
1
+ export * from './actions';
2
+ export * as Context from './context';
3
+ export * from './types';
4
+ export * from './schemas';
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from './actions'
2
- export * as Context from './context'
3
- export * from './types'
4
- export * from './schemas'
1
+ export * from './actions';
2
+ export * as Context from './context';
3
+ export * from './types';
4
+ export * from './schemas';
@@ -1,19 +1,8 @@
1
1
  type Compute<type> = {
2
- [key in keyof type]: type[key]
3
- } & unknown
4
- type KeyofUnion<type> = type extends type ? keyof type : never
5
- export type OneOf<
6
- union extends object,
7
- fallback extends object | undefined = undefined,
8
- keys extends KeyofUnion<union> = KeyofUnion<union>,
9
- > = union extends infer item
10
- ? Compute<
11
- item & {
12
- [key in Exclude<keys, keyof item>]?: fallback extends object
13
- ? key extends keyof fallback
14
- ? fallback[key]
15
- : undefined
16
- : undefined
17
- }
18
- >
19
- : never
2
+ [key in keyof type]: type[key];
3
+ } & unknown;
4
+ type KeyofUnion<type> = type extends type ? keyof type : never;
5
+ export type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Compute<item & {
6
+ [key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined;
7
+ }> : never;
8
+ export {};
@@ -1 +1 @@
1
- export {}
1
+ export {};