@farcaster/frame-sdk 0.0.0-canary-20250512185912 → 0.0.0-canary-20250512194707
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.min.js +2 -2
- package/dist/index.min.js.map +4 -4
- package/dist/sdk.js +16 -14
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +4 -3
- package/package.json +2 -2
- package/src/sdk.ts +20 -17
- package/src/types.ts +5 -3
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AddMiniApp, ComposeCast, Context, FrameNotificationDetails, GetCapabilities, Ready, SendToken, SetPrimaryButtonOptions, SignIn, SolanaWalletProvider, SwapToken, ViewProfile, ViewToken } from '@farcaster/frame-core';
|
|
2
2
|
import type { EventEmitter } from 'eventemitter3';
|
|
3
3
|
import type * as Provider from 'ox/Provider';
|
|
4
4
|
declare global {
|
|
@@ -18,7 +18,7 @@ export type EventMap = {
|
|
|
18
18
|
notificationDetails?: FrameNotificationDetails;
|
|
19
19
|
}) => void;
|
|
20
20
|
frameAddRejected: ({ reason, }: {
|
|
21
|
-
reason:
|
|
21
|
+
reason: AddMiniApp.AddMiniAppRejectedReason;
|
|
22
22
|
}) => void;
|
|
23
23
|
frameRemoved: () => void;
|
|
24
24
|
notificationsEnabled: ({ notificationDetails, }: {
|
|
@@ -37,7 +37,8 @@ export type FrameSDK = {
|
|
|
37
37
|
openUrl: (url: string) => Promise<void>;
|
|
38
38
|
close: () => Promise<void>;
|
|
39
39
|
setPrimaryButton: SetPrimaryButton;
|
|
40
|
-
addFrame:
|
|
40
|
+
addFrame: AddMiniApp.AddMiniApp;
|
|
41
|
+
addMiniApp: AddMiniApp.AddMiniApp;
|
|
41
42
|
signIn: SignIn.SignIn;
|
|
42
43
|
viewProfile: ViewProfile.ViewProfile;
|
|
43
44
|
composeCast: <close extends boolean | undefined = undefined>(options?: ComposeCast.Options<close>) => Promise<ComposeCast.Result<close>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farcaster/frame-sdk",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20250512194707",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"comlink": "^4.4.2",
|
|
23
23
|
"eventemitter3": "^5.0.1",
|
|
24
24
|
"ox": "^0.4.4",
|
|
25
|
-
"@farcaster/frame-core": "0.0.0-canary-
|
|
25
|
+
"@farcaster/frame-core": "0.0.0-canary-20250512194707"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"clean": "rm -rf dist",
|
package/src/sdk.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AddMiniApp,
|
|
3
3
|
type FrameClientEvent,
|
|
4
4
|
SignIn,
|
|
5
5
|
type SolanaRequestFn,
|
|
@@ -78,6 +78,23 @@ async function isInMiniApp(timeoutMs = 50): Promise<boolean> {
|
|
|
78
78
|
return isInMiniApp
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
const addMiniApp = async () => {
|
|
82
|
+
const response = await frameHost.addFrame()
|
|
83
|
+
if (response.result) {
|
|
84
|
+
return response.result
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (response.error.type === 'invalid_domain_manifest') {
|
|
88
|
+
throw new AddMiniApp.InvalidDomainManifest()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (response.error.type === 'rejected_by_user') {
|
|
92
|
+
throw new AddMiniApp.RejectedByUser()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
throw new Error('Unreachable')
|
|
96
|
+
}
|
|
97
|
+
|
|
81
98
|
export const sdk: FrameSDK = {
|
|
82
99
|
...emitter,
|
|
83
100
|
getCapabilities: frameHost.getCapabilities,
|
|
@@ -104,22 +121,8 @@ export const sdk: FrameSDK = {
|
|
|
104
121
|
const url = typeof urlArg === 'string' ? urlArg : urlArg.url
|
|
105
122
|
return frameHost.openUrl(url.trim())
|
|
106
123
|
},
|
|
107
|
-
addFrame:
|
|
108
|
-
|
|
109
|
-
if (response.result) {
|
|
110
|
-
return response.result
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (response.error.type === 'invalid_domain_manifest') {
|
|
114
|
-
throw new AddFrame.InvalidDomainManifest()
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (response.error.type === 'rejected_by_user') {
|
|
118
|
-
throw new AddFrame.RejectedByUser()
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
throw new Error('Unreachable')
|
|
122
|
-
},
|
|
124
|
+
addFrame: addMiniApp,
|
|
125
|
+
addMiniApp,
|
|
123
126
|
composeCast(options = {}) {
|
|
124
127
|
return frameHost.composeCast(options) as never
|
|
125
128
|
},
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
AddMiniApp,
|
|
3
3
|
ComposeCast,
|
|
4
4
|
Context,
|
|
5
5
|
FrameNotificationDetails,
|
|
@@ -38,7 +38,7 @@ export type EventMap = {
|
|
|
38
38
|
}) => void
|
|
39
39
|
frameAddRejected: ({
|
|
40
40
|
reason,
|
|
41
|
-
}: { reason:
|
|
41
|
+
}: { reason: AddMiniApp.AddMiniAppRejectedReason }) => void
|
|
42
42
|
frameRemoved: () => void
|
|
43
43
|
notificationsEnabled: ({
|
|
44
44
|
notificationDetails,
|
|
@@ -61,7 +61,9 @@ export type FrameSDK = {
|
|
|
61
61
|
openUrl: (url: string) => Promise<void>
|
|
62
62
|
close: () => Promise<void>
|
|
63
63
|
setPrimaryButton: SetPrimaryButton
|
|
64
|
-
|
|
64
|
+
// Deprecated in favor of addMiniApp
|
|
65
|
+
addFrame: AddMiniApp.AddMiniApp
|
|
66
|
+
addMiniApp: AddMiniApp.AddMiniApp
|
|
65
67
|
signIn: SignIn.SignIn
|
|
66
68
|
viewProfile: ViewProfile.ViewProfile
|
|
67
69
|
composeCast: <close extends boolean | undefined = undefined>(
|