@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.
package/esm/types.d.ts CHANGED
@@ -1,140 +1,117 @@
1
- import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from 'ox'
2
- import type { AddFrame, SignIn } from './actions'
3
- import type { FrameContext } from './context'
4
- import type {
5
- EventFrameAdded,
6
- EventFrameRemoved,
7
- EventNotificationsDisabled,
8
- EventNotificationsEnabled,
9
- } from './schemas'
1
+ import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from 'ox';
2
+ import type { AddFrame, SignIn, ViewProfile } from './actions';
3
+ import type { FrameContext } from './context';
4
+ import type { EventFrameAdded, EventFrameRemoved, EventNotificationsDisabled, EventNotificationsEnabled } from './schemas';
10
5
  export type SetPrimaryButtonOptions = {
11
- text: string
12
- loading?: boolean
13
- disabled?: boolean
14
- hidden?: boolean
15
- }
16
- export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void
17
- export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default>
6
+ text: string;
7
+ loading?: boolean;
8
+ disabled?: boolean;
9
+ hidden?: boolean;
10
+ };
11
+ export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void;
12
+ export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default>;
18
13
  export type ReadyOptions = {
19
- /**
20
- * Disable native gestures. Use this option if your frame uses gestures
21
- * that conflict with native gestures.
22
- *
23
- * @defaultValue false
24
- */
25
- disableNativeGestures: boolean
26
- }
27
- export declare const DEFAULT_READY_OPTIONS: ReadyOptions
14
+ /**
15
+ * Disable native gestures. Use this option if your frame uses gestures
16
+ * that conflict with native gestures.
17
+ *
18
+ * @defaultValue false
19
+ */
20
+ disableNativeGestures: boolean;
21
+ };
22
+ export declare const DEFAULT_READY_OPTIONS: ReadyOptions;
28
23
  export type SignInOptions = {
29
- /**
30
- * A random string used to prevent replay attacks.
31
- */
32
- nonce: string
33
- /**
34
- * Start time at which the signature becomes valid.
35
- * ISO 8601 datetime.
36
- */
37
- notBefore?: string
38
- /**
39
- * Expiration time at which the signature is no longer valid.
40
- * ISO 8601 datetime.
41
- */
42
- expirationTime?: string
43
- }
24
+ /**
25
+ * A random string used to prevent replay attacks.
26
+ */
27
+ nonce: string;
28
+ /**
29
+ * Start time at which the signature becomes valid.
30
+ * ISO 8601 datetime.
31
+ */
32
+ notBefore?: string;
33
+ /**
34
+ * Expiration time at which the signature is no longer valid.
35
+ * ISO 8601 datetime.
36
+ */
37
+ expirationTime?: string;
38
+ };
44
39
  export type WireFrameHost = {
45
- context: FrameContext
46
- close: () => void
47
- ready: (options?: Partial<ReadyOptions>) => void
48
- openUrl: (url: string) => void
49
- signIn: SignIn.WireSignIn
50
- setPrimaryButton: SetPrimaryButton
51
- ethProviderRequest: EthProviderRequest
52
- ethProviderRequestV2: RpcTransport
53
- eip6963RequestProvider: () => void
54
- addFrame: AddFrame.WireAddFrame
55
- }
40
+ context: FrameContext;
41
+ close: () => void;
42
+ ready: (options?: Partial<ReadyOptions>) => void;
43
+ openUrl: (url: string) => void;
44
+ signIn: SignIn.WireSignIn;
45
+ setPrimaryButton: SetPrimaryButton;
46
+ ethProviderRequest: EthProviderRequest;
47
+ ethProviderRequestV2: RpcTransport;
48
+ eip6963RequestProvider: () => void;
49
+ addFrame: AddFrame.WireAddFrame;
50
+ viewProfile: ViewProfile.ViewProfile;
51
+ };
56
52
  export type FrameHost = {
57
- context: FrameContext
58
- close: () => void
59
- ready: (options?: Partial<ReadyOptions>) => void
60
- openUrl: (url: string) => void
61
- signIn: SignIn.SignIn
62
- setPrimaryButton: SetPrimaryButton
63
- ethProviderRequest: EthProviderRequest
64
- ethProviderRequestV2: RpcTransport
65
- /**
66
- * Receive forwarded eip6963:requestProvider events from the frame document.
67
- * Hosts must emit an EventEip6963AnnounceProvider in response.
68
- */
69
- eip6963RequestProvider: () => void
70
- addFrame: AddFrame.AddFrame
71
- }
53
+ context: FrameContext;
54
+ close: () => void;
55
+ ready: (options?: Partial<ReadyOptions>) => void;
56
+ openUrl: (url: string) => void;
57
+ signIn: SignIn.SignIn;
58
+ setPrimaryButton: SetPrimaryButton;
59
+ ethProviderRequest: EthProviderRequest;
60
+ ethProviderRequestV2: RpcTransport;
61
+ /**
62
+ * Receive forwarded eip6963:requestProvider events from the frame document.
63
+ * Hosts must emit an EventEip6963AnnounceProvider in response.
64
+ */
65
+ eip6963RequestProvider: () => void;
66
+ addFrame: AddFrame.AddFrame;
67
+ viewProfile: ViewProfile.ViewProfile;
68
+ };
72
69
  export type FrameEthProviderEventData = {
73
- type: 'frame_eth_provider_event'
74
- } & EthProviderWireEvent
75
- export type RpcTransport = (
76
- request: RpcRequest.RpcRequest,
77
- ) => Promise<RpcResponse.RpcResponse>
70
+ type: 'frame_eth_provider_event';
71
+ } & EthProviderWireEvent;
72
+ export type RpcTransport = (request: RpcRequest.RpcRequest) => Promise<RpcResponse.RpcResponse>;
78
73
  export type ProviderRpcError = {
79
- code: number
80
- details?: string
81
- message?: string
82
- }
83
- export type EthProviderWireEvent =
84
- | {
85
- event: 'accountsChanged'
86
- params: [readonly Address.Address[]]
87
- }
88
- | {
89
- event: 'chainChanged'
90
- params: [string]
91
- }
92
- | {
93
- event: 'connect'
94
- params: [Provider.ConnectInfo]
95
- }
96
- | {
97
- event: 'disconnect'
98
- params: [ProviderRpcError]
99
- }
100
- | {
101
- event: 'message'
102
- params: [Provider.Message]
103
- }
104
- export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(
105
- event: event,
106
- params: Extract<
107
- EthProviderWireEvent,
108
- {
109
- event: event
110
- }
111
- >['params'],
112
- ) => void
74
+ code: number;
75
+ details?: string;
76
+ message?: string;
77
+ };
78
+ export type EthProviderWireEvent = {
79
+ event: 'accountsChanged';
80
+ params: [readonly Address.Address[]];
81
+ } | {
82
+ event: 'chainChanged';
83
+ params: [string];
84
+ } | {
85
+ event: 'connect';
86
+ params: [Provider.ConnectInfo];
87
+ } | {
88
+ event: 'disconnect';
89
+ params: [ProviderRpcError];
90
+ } | {
91
+ event: 'message';
92
+ params: [Provider.Message];
93
+ };
94
+ export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(event: event, params: Extract<EthProviderWireEvent, {
95
+ event: event;
96
+ }>['params']) => void;
113
97
  export type EventFrameAddRejected = {
114
- event: 'frame_add_rejected'
115
- reason: AddFrame.AddFrameRejectedReason
116
- }
98
+ event: 'frame_add_rejected';
99
+ reason: AddFrame.AddFrameRejectedReason;
100
+ };
117
101
  export type EventPrimaryButtonClicked = {
118
- event: 'primary_button_clicked'
119
- }
102
+ event: 'primary_button_clicked';
103
+ };
120
104
  /**
121
105
  * Metadata of the EIP-1193 Provider.
122
106
  */
123
107
  export interface EIP6963ProviderInfo {
124
- icon: `data:image/${string}`
125
- name: string
126
- rdns: string
127
- uuid: string
108
+ icon: `data:image/${string}`;
109
+ name: string;
110
+ rdns: string;
111
+ uuid: string;
128
112
  }
129
113
  export type EventEip6963AnnounceProvider = {
130
- event: 'eip6963:announceProvider'
131
- info: EIP6963ProviderInfo
132
- }
133
- export type FrameClientEvent =
134
- | EventFrameAdded
135
- | EventFrameAddRejected
136
- | EventFrameRemoved
137
- | EventNotificationsEnabled
138
- | EventNotificationsDisabled
139
- | EventPrimaryButtonClicked
140
- | EventEip6963AnnounceProvider
114
+ event: 'eip6963:announceProvider';
115
+ info: EIP6963ProviderInfo;
116
+ };
117
+ export type FrameClientEvent = EventFrameAdded | EventFrameAddRejected | EventFrameRemoved | EventNotificationsEnabled | EventNotificationsDisabled | EventPrimaryButtonClicked | EventEip6963AnnounceProvider;
package/esm/types.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export const DEFAULT_READY_OPTIONS = {
2
- disableNativeGestures: false,
3
- }
2
+ disableNativeGestures: false,
3
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farcaster/frame-core",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "main": "dist/index.js",
5
5
  "module": "esm/index.js",
6
6
  "files": [
@@ -0,0 +1,5 @@
1
+ export type ViewProfileOptions = {
2
+ fid: number
3
+ }
4
+
5
+ export type ViewProfile = (options: ViewProfileOptions) => Promise<void>
@@ -1,2 +1,3 @@
1
1
  export * as AddFrame from './AddFrame'
2
+ export * as ViewProfile from './ViewProfile'
2
3
  export * as SignIn from './SignIn'
package/src/types.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 {
5
5
  EventFrameAdded,
@@ -63,6 +63,7 @@ export type WireFrameHost = {
63
63
  ethProviderRequestV2: RpcTransport
64
64
  eip6963RequestProvider: () => void
65
65
  addFrame: AddFrame.WireAddFrame
66
+ viewProfile: ViewProfile.ViewProfile
66
67
  }
67
68
 
68
69
  export type FrameHost = {
@@ -80,6 +81,7 @@ export type FrameHost = {
80
81
  */
81
82
  eip6963RequestProvider: () => void
82
83
  addFrame: AddFrame.AddFrame
84
+ viewProfile: ViewProfile.ViewProfile
83
85
  }
84
86
 
85
87
  export type FrameEthProviderEventData = {