@farcaster/frame-core 0.0.28 → 0.0.31
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/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/actions/ComposeCast.d.ts +32 -0
- package/dist/actions/ComposeCast.js +2 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +2 -1
- package/dist/errors.d.ts +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/manifest.d.ts +101 -0
- package/dist/manifest.js +2 -0
- package/dist/schemas/shared.js +1 -1
- package/dist/types.d.ts +3 -1
- package/esm/actions/ComposeCast.d.ts +32 -0
- package/esm/actions/ComposeCast.js +1 -0
- package/esm/actions/index.d.ts +1 -0
- package/esm/actions/index.js +1 -0
- package/esm/errors.d.ts +3 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/manifest.d.ts +101 -0
- package/esm/manifest.js +1 -0
- package/esm/schemas/shared.js +1 -1
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/types.d.ts +3 -1
- package/package.json +7 -1
- package/src/actions/ComposeCast.ts +36 -0
- package/src/actions/index.ts +1 -0
- package/src/errors.ts +4 -0
- package/src/index.ts +2 -0
- package/src/manifest.ts +113 -0
- package/src/schemas/shared.ts +1 -1
- package/src/types.ts +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present Merkle Manufactory Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type Options<close extends boolean | undefined = undefined> = {
|
|
2
|
+
/**
|
|
3
|
+
* Suggested text for the body of the cast.
|
|
4
|
+
*
|
|
5
|
+
* Mentions can be included using the human-writeable form (e.g. @farcaster).
|
|
6
|
+
**/
|
|
7
|
+
text?: string;
|
|
8
|
+
/** Suggested embeds. Max two. */
|
|
9
|
+
embeds?: [] | [string] | [string, string];
|
|
10
|
+
/** Suggested parent. */
|
|
11
|
+
parent?: {
|
|
12
|
+
type: 'cast';
|
|
13
|
+
hash: string;
|
|
14
|
+
};
|
|
15
|
+
/** Whether the app should be closed when this action is called. */
|
|
16
|
+
close?: close;
|
|
17
|
+
};
|
|
18
|
+
export type Result<close extends boolean | undefined = undefined> = close extends true ? undefined : {
|
|
19
|
+
cast: {
|
|
20
|
+
/** Cast of the created cast */
|
|
21
|
+
hash: string;
|
|
22
|
+
/** Text of the created cast */
|
|
23
|
+
text?: string;
|
|
24
|
+
/** Embeds of the created cast */
|
|
25
|
+
embeds?: [] | [string] | [string, string];
|
|
26
|
+
/** Parent of the created cast */
|
|
27
|
+
parent?: {
|
|
28
|
+
type: 'cast';
|
|
29
|
+
hash: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
package/dist/actions/index.d.ts
CHANGED
package/dist/actions/index.js
CHANGED
|
@@ -33,8 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ViewToken = exports.ViewProfile = exports.Swap = exports.SignIn = exports.Ready = exports.AddFrame = void 0;
|
|
36
|
+
exports.ViewToken = exports.ViewProfile = exports.Swap = exports.SignIn = exports.Ready = exports.ComposeCast = exports.AddFrame = void 0;
|
|
37
37
|
exports.AddFrame = __importStar(require("./AddFrame"));
|
|
38
|
+
exports.ComposeCast = __importStar(require("./ComposeCast"));
|
|
38
39
|
exports.Ready = __importStar(require("./Ready"));
|
|
39
40
|
exports.SignIn = __importStar(require("./SignIn"));
|
|
40
41
|
exports.Swap = __importStar(require("./Swap"));
|
package/dist/errors.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -36,9 +36,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Context = void 0;
|
|
39
|
+
exports.Manifest = exports.Context = exports.Errors = void 0;
|
|
40
40
|
__exportStar(require("./actions"), exports);
|
|
41
41
|
__exportStar(require("./wallet"), exports);
|
|
42
|
+
exports.Errors = __importStar(require("./errors"));
|
|
42
43
|
exports.Context = __importStar(require("./context"));
|
|
44
|
+
exports.Manifest = __importStar(require("./manifest"));
|
|
43
45
|
__exportStar(require("./types"), exports);
|
|
44
46
|
__exportStar(require("./schemas"), exports);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Farcaster manifest for a domain hosted at `/.well-known/farcaster.json`
|
|
3
|
+
*/
|
|
4
|
+
export type Manifest = {
|
|
5
|
+
accountAssociation: AccountAssociation;
|
|
6
|
+
frame: FrameConfig;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Signed domain association linking this frame to a Farcaster account
|
|
10
|
+
*
|
|
11
|
+
* A DomainAssociation can be generated using the {@link https://warpcast.com/~/developers/domains | Warpcast
|
|
12
|
+
* Domains Developer} tool.
|
|
13
|
+
*/
|
|
14
|
+
export type AccountAssociation = {
|
|
15
|
+
/**
|
|
16
|
+
* Base64URL encoded JFS signature
|
|
17
|
+
*/
|
|
18
|
+
header: string;
|
|
19
|
+
/**
|
|
20
|
+
* Base64URL encoded payload signature
|
|
21
|
+
*/
|
|
22
|
+
payload: string;
|
|
23
|
+
/**
|
|
24
|
+
* Base64URL encoded signature
|
|
25
|
+
*/
|
|
26
|
+
signature: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Frame configuration
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ``ts
|
|
33
|
+
* const frame: FrameConfig = {
|
|
34
|
+
* version: '1',
|
|
35
|
+
* name: 'Yoink!',
|
|
36
|
+
* homeUrl: 'https://yoink.party',
|
|
37
|
+
* iconUrl: 'https://yoink.party/img/icon.png',
|
|
38
|
+
* imageUrl: 'https://yoink.party/framesV2/opengraph-image',
|
|
39
|
+
* buttonTitle: '🚩 Start',
|
|
40
|
+
* splashImageUrl: 'https://yoink.party/img/splash.png',
|
|
41
|
+
* splashImageBackgroundColor: '#eeeee4',
|
|
42
|
+
* webhookUrl: 'https://yoink.party/webhook'
|
|
43
|
+
* };
|
|
44
|
+
* ``
|
|
45
|
+
*/
|
|
46
|
+
export type FrameConfig = {
|
|
47
|
+
/**
|
|
48
|
+
* Manifest version
|
|
49
|
+
*
|
|
50
|
+
* Must be the literal '1'.
|
|
51
|
+
*/
|
|
52
|
+
version: '1';
|
|
53
|
+
/**
|
|
54
|
+
* App name that will be displayed to users
|
|
55
|
+
*
|
|
56
|
+
* Max length of 32 characters.
|
|
57
|
+
*/
|
|
58
|
+
name: string;
|
|
59
|
+
/**
|
|
60
|
+
* Default launch URL
|
|
61
|
+
*
|
|
62
|
+
* Max length of 1024 characters.
|
|
63
|
+
*/
|
|
64
|
+
homeUrl: string;
|
|
65
|
+
/**
|
|
66
|
+
* Icon URL
|
|
67
|
+
*
|
|
68
|
+
* Max length of 1024 characters. Image must be 200x200px and less than 1MB.
|
|
69
|
+
*/
|
|
70
|
+
iconUrl: string;
|
|
71
|
+
/**
|
|
72
|
+
* Image URL
|
|
73
|
+
*
|
|
74
|
+
* Max length of 1024 characters. Image must have a 3:2 ratio.
|
|
75
|
+
*/
|
|
76
|
+
imageUrl: string;
|
|
77
|
+
/**
|
|
78
|
+
* Default button title to use when frame is rendered.
|
|
79
|
+
*
|
|
80
|
+
* Max length of 32 characters.
|
|
81
|
+
*/
|
|
82
|
+
buttonTitle: string;
|
|
83
|
+
/**
|
|
84
|
+
* Splash image URL
|
|
85
|
+
*
|
|
86
|
+
* Max length of 1024 characters. Image must be 200x200px and less than 1MB.
|
|
87
|
+
*/
|
|
88
|
+
splashImageUrl?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Splash background color
|
|
91
|
+
*
|
|
92
|
+
* Must be a hex color code.
|
|
93
|
+
*/
|
|
94
|
+
splashBackgroundColor?: string;
|
|
95
|
+
/**
|
|
96
|
+
* URL to which clients will POST server events.
|
|
97
|
+
* Max length of 1024 characters.
|
|
98
|
+
* Required if the frame application uses notifications.
|
|
99
|
+
*/
|
|
100
|
+
webhookUrl?: string;
|
|
101
|
+
};
|
package/dist/manifest.js
ADDED
package/dist/schemas/shared.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.secureUrlSchema = zod_1.z
|
|
|
6
6
|
.string()
|
|
7
7
|
.url()
|
|
8
8
|
.startsWith('https://', { message: 'Must be an https url' })
|
|
9
|
-
.max(
|
|
9
|
+
.max(1024);
|
|
10
10
|
exports.frameNameSchema = zod_1.z.string().max(32);
|
|
11
11
|
exports.buttonTitleSchema = zod_1.z.string().max(32);
|
|
12
12
|
const CAIP_19_REGEX = /^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}\/(?:[-a-z0-9]{3,8}:[-.%a-zA-Z0-9]{1,128}(?:\/[-.%a-zA-Z0-9]{1,78})?|native)$/;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AddFrame, Ready, SignIn, Swap, ViewProfile, ViewToken } from './actions';
|
|
1
|
+
import type { AddFrame, ComposeCast, Ready, SignIn, Swap, ViewProfile, ViewToken } from './actions';
|
|
2
2
|
import type { FrameContext } from './context';
|
|
3
3
|
import type { EventFrameAdded, EventFrameRemoved, EventNotificationsDisabled, EventNotificationsEnabled } from './schemas';
|
|
4
4
|
import type { Ethereum } from './wallet';
|
|
@@ -26,6 +26,7 @@ export type WireFrameHost = {
|
|
|
26
26
|
viewProfile: ViewProfile.ViewProfile;
|
|
27
27
|
viewToken: ViewToken.ViewToken;
|
|
28
28
|
swap: Swap.Swap;
|
|
29
|
+
composeCast: <close extends boolean | undefined = undefined>(options: ComposeCast.Options<close>) => Promise<ComposeCast.Result<close>>;
|
|
29
30
|
};
|
|
30
31
|
export type FrameHost = {
|
|
31
32
|
context: FrameContext;
|
|
@@ -45,6 +46,7 @@ export type FrameHost = {
|
|
|
45
46
|
viewProfile: ViewProfile.ViewProfile;
|
|
46
47
|
viewToken: ViewToken.ViewToken;
|
|
47
48
|
swap: Swap.Swap;
|
|
49
|
+
composeCast: <close extends boolean | undefined = undefined>(options: ComposeCast.Options<close>) => Promise<ComposeCast.Result<close>>;
|
|
48
50
|
};
|
|
49
51
|
export type EventFrameAddRejected = {
|
|
50
52
|
event: 'frame_add_rejected';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type Options<close extends boolean | undefined = undefined> = {
|
|
2
|
+
/**
|
|
3
|
+
* Suggested text for the body of the cast.
|
|
4
|
+
*
|
|
5
|
+
* Mentions can be included using the human-writeable form (e.g. @farcaster).
|
|
6
|
+
**/
|
|
7
|
+
text?: string;
|
|
8
|
+
/** Suggested embeds. Max two. */
|
|
9
|
+
embeds?: [] | [string] | [string, string];
|
|
10
|
+
/** Suggested parent. */
|
|
11
|
+
parent?: {
|
|
12
|
+
type: 'cast';
|
|
13
|
+
hash: string;
|
|
14
|
+
};
|
|
15
|
+
/** Whether the app should be closed when this action is called. */
|
|
16
|
+
close?: close;
|
|
17
|
+
};
|
|
18
|
+
export type Result<close extends boolean | undefined = undefined> = close extends true ? undefined : {
|
|
19
|
+
cast: {
|
|
20
|
+
/** Cast of the created cast */
|
|
21
|
+
hash: string;
|
|
22
|
+
/** Text of the created cast */
|
|
23
|
+
text?: string;
|
|
24
|
+
/** Embeds of the created cast */
|
|
25
|
+
embeds?: [] | [string] | [string, string];
|
|
26
|
+
/** Parent of the created cast */
|
|
27
|
+
parent?: {
|
|
28
|
+
type: 'cast';
|
|
29
|
+
hash: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/actions/index.d.ts
CHANGED
package/esm/actions/index.js
CHANGED
package/esm/errors.d.ts
CHANGED
package/esm/index.d.ts
CHANGED
package/esm/index.js
CHANGED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Farcaster manifest for a domain hosted at `/.well-known/farcaster.json`
|
|
3
|
+
*/
|
|
4
|
+
export type Manifest = {
|
|
5
|
+
accountAssociation: AccountAssociation;
|
|
6
|
+
frame: FrameConfig;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Signed domain association linking this frame to a Farcaster account
|
|
10
|
+
*
|
|
11
|
+
* A DomainAssociation can be generated using the {@link https://warpcast.com/~/developers/domains | Warpcast
|
|
12
|
+
* Domains Developer} tool.
|
|
13
|
+
*/
|
|
14
|
+
export type AccountAssociation = {
|
|
15
|
+
/**
|
|
16
|
+
* Base64URL encoded JFS signature
|
|
17
|
+
*/
|
|
18
|
+
header: string;
|
|
19
|
+
/**
|
|
20
|
+
* Base64URL encoded payload signature
|
|
21
|
+
*/
|
|
22
|
+
payload: string;
|
|
23
|
+
/**
|
|
24
|
+
* Base64URL encoded signature
|
|
25
|
+
*/
|
|
26
|
+
signature: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Frame configuration
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ``ts
|
|
33
|
+
* const frame: FrameConfig = {
|
|
34
|
+
* version: '1',
|
|
35
|
+
* name: 'Yoink!',
|
|
36
|
+
* homeUrl: 'https://yoink.party',
|
|
37
|
+
* iconUrl: 'https://yoink.party/img/icon.png',
|
|
38
|
+
* imageUrl: 'https://yoink.party/framesV2/opengraph-image',
|
|
39
|
+
* buttonTitle: '🚩 Start',
|
|
40
|
+
* splashImageUrl: 'https://yoink.party/img/splash.png',
|
|
41
|
+
* splashImageBackgroundColor: '#eeeee4',
|
|
42
|
+
* webhookUrl: 'https://yoink.party/webhook'
|
|
43
|
+
* };
|
|
44
|
+
* ``
|
|
45
|
+
*/
|
|
46
|
+
export type FrameConfig = {
|
|
47
|
+
/**
|
|
48
|
+
* Manifest version
|
|
49
|
+
*
|
|
50
|
+
* Must be the literal '1'.
|
|
51
|
+
*/
|
|
52
|
+
version: '1';
|
|
53
|
+
/**
|
|
54
|
+
* App name that will be displayed to users
|
|
55
|
+
*
|
|
56
|
+
* Max length of 32 characters.
|
|
57
|
+
*/
|
|
58
|
+
name: string;
|
|
59
|
+
/**
|
|
60
|
+
* Default launch URL
|
|
61
|
+
*
|
|
62
|
+
* Max length of 1024 characters.
|
|
63
|
+
*/
|
|
64
|
+
homeUrl: string;
|
|
65
|
+
/**
|
|
66
|
+
* Icon URL
|
|
67
|
+
*
|
|
68
|
+
* Max length of 1024 characters. Image must be 200x200px and less than 1MB.
|
|
69
|
+
*/
|
|
70
|
+
iconUrl: string;
|
|
71
|
+
/**
|
|
72
|
+
* Image URL
|
|
73
|
+
*
|
|
74
|
+
* Max length of 1024 characters. Image must have a 3:2 ratio.
|
|
75
|
+
*/
|
|
76
|
+
imageUrl: string;
|
|
77
|
+
/**
|
|
78
|
+
* Default button title to use when frame is rendered.
|
|
79
|
+
*
|
|
80
|
+
* Max length of 32 characters.
|
|
81
|
+
*/
|
|
82
|
+
buttonTitle: string;
|
|
83
|
+
/**
|
|
84
|
+
* Splash image URL
|
|
85
|
+
*
|
|
86
|
+
* Max length of 1024 characters. Image must be 200x200px and less than 1MB.
|
|
87
|
+
*/
|
|
88
|
+
splashImageUrl?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Splash background color
|
|
91
|
+
*
|
|
92
|
+
* Must be a hex color code.
|
|
93
|
+
*/
|
|
94
|
+
splashBackgroundColor?: string;
|
|
95
|
+
/**
|
|
96
|
+
* URL to which clients will POST server events.
|
|
97
|
+
* Max length of 1024 characters.
|
|
98
|
+
* Required if the frame application uses notifications.
|
|
99
|
+
*/
|
|
100
|
+
webhookUrl?: string;
|
|
101
|
+
};
|
package/esm/manifest.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/schemas/shared.js
CHANGED
|
@@ -3,7 +3,7 @@ export const secureUrlSchema = z
|
|
|
3
3
|
.string()
|
|
4
4
|
.url()
|
|
5
5
|
.startsWith('https://', { message: 'Must be an https url' })
|
|
6
|
-
.max(
|
|
6
|
+
.max(1024);
|
|
7
7
|
export const frameNameSchema = z.string().max(32);
|
|
8
8
|
export const buttonTitleSchema = z.string().max(32);
|
|
9
9
|
const CAIP_19_REGEX = /^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}\/(?:[-a-z0-9]{3,8}:[-.%a-zA-Z0-9]{1,128}(?:\/[-.%a-zA-Z0-9]{1,78})?|native)$/;
|