@farcaster/frame-core 0.0.22 → 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/dist/actions/ViewProfile.d.ts +4 -0
- package/dist/actions/ViewProfile.js +2 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +2 -1
- package/dist/context.d.ts +72 -0
- package/dist/context.js +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +25 -1
- package/dist/types.d.ts +5 -54
- package/esm/actions/AddFrame.d.ts +23 -27
- package/esm/actions/AddFrame.js +9 -9
- package/esm/actions/SignIn.d.ts +33 -35
- package/esm/actions/SignIn.js +5 -5
- package/esm/actions/ViewProfile.d.ts +4 -0
- package/esm/actions/ViewProfile.js +1 -0
- package/esm/actions/index.d.ts +3 -2
- package/esm/actions/index.js +3 -2
- package/esm/context.d.ts +72 -0
- package/esm/context.js +1 -0
- package/esm/errors.d.ts +7 -9
- package/esm/errors.js +6 -6
- package/esm/index.d.ts +4 -3
- package/esm/index.js +4 -3
- package/esm/internal/types.d.ts +7 -18
- package/esm/internal/types.js +1 -1
- package/esm/schemas/embeds.d.ts +169 -231
- package/esm/schemas/embeds.js +18 -24
- package/esm/schemas/events.d.ts +129 -225
- package/esm/schemas/events.js +17 -17
- package/esm/schemas/index.d.ts +5 -5
- package/esm/schemas/index.js +5 -5
- package/esm/schemas/manifest.d.ts +110 -154
- package/esm/schemas/manifest.js +23 -29
- package/esm/schemas/notifications.d.ts +58 -86
- package/esm/schemas/notifications.js +17 -17
- package/esm/schemas/shared.d.ts +33 -49
- package/esm/schemas/shared.js +19 -20
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/types.d.ts +101 -179
- package/esm/types.js +2 -2
- package/package.json +1 -1
- package/src/actions/ViewProfile.ts +5 -0
- package/src/actions/index.ts +1 -0
- package/src/context.ts +90 -0
- package/src/index.ts +2 -1
- package/src/types.ts +4 -64
package/esm/types.d.ts
CHANGED
|
@@ -1,195 +1,117 @@
|
|
|
1
|
-
import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from 'ox'
|
|
2
|
-
import type { AddFrame, SignIn } from './actions'
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
EventFrameRemoved,
|
|
6
|
-
EventNotificationsDisabled,
|
|
7
|
-
EventNotificationsEnabled,
|
|
8
|
-
FrameNotificationDetails,
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void
|
|
17
|
-
export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default
|
|
18
|
-
export type
|
|
19
|
-
placeId: string
|
|
20
|
-
/**
|
|
21
|
-
* Human-readable string describing the location
|
|
22
|
-
*/
|
|
23
|
-
description: string
|
|
24
|
-
}
|
|
25
|
-
export type FrameLocationContextCastEmbed = {
|
|
26
|
-
type: 'cast_embed'
|
|
27
|
-
embed: string
|
|
28
|
-
cast: {
|
|
29
|
-
fid: number
|
|
30
|
-
hash: string
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export type FrameLocationContextNotification = {
|
|
34
|
-
type: 'notification'
|
|
35
|
-
notification: {
|
|
36
|
-
notificationId: string
|
|
37
|
-
title: string
|
|
38
|
-
body: string
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export type FrameLocationContextLauncher = {
|
|
42
|
-
type: 'launcher'
|
|
43
|
-
}
|
|
44
|
-
export type FrameLocationContext =
|
|
45
|
-
| FrameLocationContextCastEmbed
|
|
46
|
-
| FrameLocationContextNotification
|
|
47
|
-
| FrameLocationContextLauncher
|
|
48
|
-
export type SafeAreaInsets = {
|
|
49
|
-
top: number
|
|
50
|
-
bottom: number
|
|
51
|
-
left: number
|
|
52
|
-
right: number
|
|
53
|
-
}
|
|
54
|
-
export type FrameContext = {
|
|
55
|
-
user: {
|
|
56
|
-
fid: number
|
|
57
|
-
username?: string
|
|
58
|
-
displayName?: string
|
|
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>;
|
|
13
|
+
export type ReadyOptions = {
|
|
59
14
|
/**
|
|
60
|
-
*
|
|
15
|
+
* Disable native gestures. Use this option if your frame uses gestures
|
|
16
|
+
* that conflict with native gestures.
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue false
|
|
61
19
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
location?: FrameLocationContext
|
|
66
|
-
client: {
|
|
67
|
-
clientFid: number
|
|
68
|
-
added: boolean
|
|
69
|
-
notificationDetails?: FrameNotificationDetails
|
|
70
|
-
safeAreaInsets?: SafeAreaInsets
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
export type ReadyOptions = {
|
|
74
|
-
/**
|
|
75
|
-
* Disable native gestures. Use this option if your frame uses gestures
|
|
76
|
-
* that conflict with native gestures.
|
|
77
|
-
*
|
|
78
|
-
* @defaultValue false
|
|
79
|
-
*/
|
|
80
|
-
disableNativeGestures: boolean
|
|
81
|
-
}
|
|
82
|
-
export declare const DEFAULT_READY_OPTIONS: ReadyOptions
|
|
20
|
+
disableNativeGestures: boolean;
|
|
21
|
+
};
|
|
22
|
+
export declare const DEFAULT_READY_OPTIONS: ReadyOptions;
|
|
83
23
|
export type SignInOptions = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
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
|
+
};
|
|
99
39
|
export type WireFrameHost = {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
+
};
|
|
111
52
|
export type FrameHost = {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
+
};
|
|
127
69
|
export type FrameEthProviderEventData = {
|
|
128
|
-
|
|
129
|
-
} & EthProviderWireEvent
|
|
130
|
-
export type RpcTransport = (
|
|
131
|
-
request: RpcRequest.RpcRequest,
|
|
132
|
-
) => Promise<RpcResponse.RpcResponse>
|
|
70
|
+
type: 'frame_eth_provider_event';
|
|
71
|
+
} & EthProviderWireEvent;
|
|
72
|
+
export type RpcTransport = (request: RpcRequest.RpcRequest) => Promise<RpcResponse.RpcResponse>;
|
|
133
73
|
export type ProviderRpcError = {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
export type EthProviderWireEvent =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
params: [Provider.Message]
|
|
158
|
-
}
|
|
159
|
-
export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(
|
|
160
|
-
event: event,
|
|
161
|
-
params: Extract<
|
|
162
|
-
EthProviderWireEvent,
|
|
163
|
-
{
|
|
164
|
-
event: event
|
|
165
|
-
}
|
|
166
|
-
>['params'],
|
|
167
|
-
) => 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;
|
|
168
97
|
export type EventFrameAddRejected = {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
98
|
+
event: 'frame_add_rejected';
|
|
99
|
+
reason: AddFrame.AddFrameRejectedReason;
|
|
100
|
+
};
|
|
172
101
|
export type EventPrimaryButtonClicked = {
|
|
173
|
-
|
|
174
|
-
}
|
|
102
|
+
event: 'primary_button_clicked';
|
|
103
|
+
};
|
|
175
104
|
/**
|
|
176
105
|
* Metadata of the EIP-1193 Provider.
|
|
177
106
|
*/
|
|
178
107
|
export interface EIP6963ProviderInfo {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
108
|
+
icon: `data:image/${string}`;
|
|
109
|
+
name: string;
|
|
110
|
+
rdns: string;
|
|
111
|
+
uuid: string;
|
|
183
112
|
}
|
|
184
113
|
export type EventEip6963AnnounceProvider = {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
export type FrameClientEvent =
|
|
189
|
-
| EventFrameAdded
|
|
190
|
-
| EventFrameAddRejected
|
|
191
|
-
| EventFrameRemoved
|
|
192
|
-
| EventNotificationsEnabled
|
|
193
|
-
| EventNotificationsDisabled
|
|
194
|
-
| EventPrimaryButtonClicked
|
|
195
|
-
| 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
|
-
|
|
3
|
-
}
|
|
2
|
+
disableNativeGestures: false,
|
|
3
|
+
};
|
package/package.json
CHANGED
package/src/actions/index.ts
CHANGED
package/src/context.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { FrameNotificationDetails } from './schemas'
|
|
2
|
+
|
|
3
|
+
export type CastEmbedLocationContext = {
|
|
4
|
+
type: 'cast_embed'
|
|
5
|
+
embed: string
|
|
6
|
+
cast: {
|
|
7
|
+
fid: number
|
|
8
|
+
hash: string
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type NotificationLocationContext = {
|
|
13
|
+
type: 'notification'
|
|
14
|
+
notification: {
|
|
15
|
+
notificationId: string
|
|
16
|
+
title: string
|
|
17
|
+
body: string
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type LauncherLocationContext = {
|
|
22
|
+
type: 'launcher'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type ChannelLocationContext = {
|
|
26
|
+
type: 'channel'
|
|
27
|
+
channel: {
|
|
28
|
+
/**
|
|
29
|
+
* Channel key identifier
|
|
30
|
+
*/
|
|
31
|
+
key: string
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Channel name
|
|
35
|
+
*/
|
|
36
|
+
name: string
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Channel profile image URL
|
|
40
|
+
*/
|
|
41
|
+
imageUrl?: string
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type LocationContext =
|
|
46
|
+
| CastEmbedLocationContext
|
|
47
|
+
| NotificationLocationContext
|
|
48
|
+
| LauncherLocationContext
|
|
49
|
+
| ChannelLocationContext
|
|
50
|
+
|
|
51
|
+
export type AccountLocation = {
|
|
52
|
+
placeId: string
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Human-readable string describing the location
|
|
56
|
+
*/
|
|
57
|
+
description: string
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type UserContext = {
|
|
61
|
+
fid: number
|
|
62
|
+
username?: string
|
|
63
|
+
displayName?: string
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Profile image URL
|
|
67
|
+
*/
|
|
68
|
+
pfpUrl?: string
|
|
69
|
+
location?: AccountLocation
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type SafeAreaInsets = {
|
|
73
|
+
top: number
|
|
74
|
+
bottom: number
|
|
75
|
+
left: number
|
|
76
|
+
right: number
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type ClientContext = {
|
|
80
|
+
clientFid: number
|
|
81
|
+
added: boolean
|
|
82
|
+
notificationDetails?: FrameNotificationDetails
|
|
83
|
+
safeAreaInsets?: SafeAreaInsets
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type FrameContext = {
|
|
87
|
+
client: ClientContext
|
|
88
|
+
user: UserContext
|
|
89
|
+
location?: LocationContext
|
|
90
|
+
}
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
|
+
import type { FrameContext } from './context'
|
|
3
4
|
import type {
|
|
4
5
|
EventFrameAdded,
|
|
5
6
|
EventFrameRemoved,
|
|
6
7
|
EventNotificationsDisabled,
|
|
7
8
|
EventNotificationsEnabled,
|
|
8
|
-
FrameNotificationDetails,
|
|
9
9
|
} from './schemas'
|
|
10
10
|
|
|
11
11
|
export type SetPrimaryButtonOptions = {
|
|
@@ -19,68 +19,6 @@ export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void
|
|
|
19
19
|
|
|
20
20
|
export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default>
|
|
21
21
|
|
|
22
|
-
export type AccountLocation = {
|
|
23
|
-
placeId: string
|
|
24
|
-
/**
|
|
25
|
-
* Human-readable string describing the location
|
|
26
|
-
*/
|
|
27
|
-
description: string
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type FrameLocationContextCastEmbed = {
|
|
31
|
-
type: 'cast_embed'
|
|
32
|
-
embed: string
|
|
33
|
-
cast: {
|
|
34
|
-
fid: number
|
|
35
|
-
hash: string
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export type FrameLocationContextNotification = {
|
|
40
|
-
type: 'notification'
|
|
41
|
-
notification: {
|
|
42
|
-
notificationId: string
|
|
43
|
-
title: string
|
|
44
|
-
body: string
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type FrameLocationContextLauncher = {
|
|
49
|
-
type: 'launcher'
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type FrameLocationContext =
|
|
53
|
-
| FrameLocationContextCastEmbed
|
|
54
|
-
| FrameLocationContextNotification
|
|
55
|
-
| FrameLocationContextLauncher
|
|
56
|
-
|
|
57
|
-
export type SafeAreaInsets = {
|
|
58
|
-
top: number
|
|
59
|
-
bottom: number
|
|
60
|
-
left: number
|
|
61
|
-
right: number
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export type FrameContext = {
|
|
65
|
-
user: {
|
|
66
|
-
fid: number
|
|
67
|
-
username?: string
|
|
68
|
-
displayName?: string
|
|
69
|
-
/**
|
|
70
|
-
* Profile image URL
|
|
71
|
-
*/
|
|
72
|
-
pfpUrl?: string
|
|
73
|
-
location?: AccountLocation
|
|
74
|
-
}
|
|
75
|
-
location?: FrameLocationContext
|
|
76
|
-
client: {
|
|
77
|
-
clientFid: number
|
|
78
|
-
added: boolean
|
|
79
|
-
notificationDetails?: FrameNotificationDetails
|
|
80
|
-
safeAreaInsets?: SafeAreaInsets
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
22
|
export type ReadyOptions = {
|
|
85
23
|
/**
|
|
86
24
|
* Disable native gestures. Use this option if your frame uses gestures
|
|
@@ -125,6 +63,7 @@ export type WireFrameHost = {
|
|
|
125
63
|
ethProviderRequestV2: RpcTransport
|
|
126
64
|
eip6963RequestProvider: () => void
|
|
127
65
|
addFrame: AddFrame.WireAddFrame
|
|
66
|
+
viewProfile: ViewProfile.ViewProfile
|
|
128
67
|
}
|
|
129
68
|
|
|
130
69
|
export type FrameHost = {
|
|
@@ -142,6 +81,7 @@ export type FrameHost = {
|
|
|
142
81
|
*/
|
|
143
82
|
eip6963RequestProvider: () => void
|
|
144
83
|
addFrame: AddFrame.AddFrame
|
|
84
|
+
viewProfile: ViewProfile.ViewProfile
|
|
145
85
|
}
|
|
146
86
|
|
|
147
87
|
export type FrameEthProviderEventData = {
|