@farcaster/miniapp-core 0.0.0-canary-20250630212339
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/AddMiniApp.d.ts +36 -0
- package/dist/actions/AddMiniApp.js +57 -0
- package/dist/actions/ComposeCast.d.ts +37 -0
- package/dist/actions/ComposeCast.js +2 -0
- package/dist/actions/Haptics.d.ts +5 -0
- package/dist/actions/Haptics.js +2 -0
- package/dist/actions/Ready.d.ts +13 -0
- package/dist/actions/Ready.js +6 -0
- package/dist/actions/SendToken.d.ts +48 -0
- package/dist/actions/SendToken.js +2 -0
- package/dist/actions/SignIn.d.ts +55 -0
- package/dist/actions/SignIn.js +47 -0
- package/dist/actions/SwapToken.d.ts +46 -0
- package/dist/actions/SwapToken.js +2 -0
- package/dist/actions/ViewCast.d.ts +25 -0
- package/dist/actions/ViewCast.js +2 -0
- package/dist/actions/ViewProfile.d.ts +4 -0
- package/dist/actions/ViewProfile.js +2 -0
- package/dist/actions/ViewToken.d.ts +4 -0
- package/dist/actions/ViewToken.js +2 -0
- package/dist/actions/index.d.ts +10 -0
- package/dist/actions/index.js +46 -0
- package/dist/back.d.ts +13 -0
- package/dist/back.js +6 -0
- package/dist/context.d.ts +94 -0
- package/dist/context.js +2 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.js +12 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +49 -0
- package/dist/internal/types.d.ts +8 -0
- package/dist/internal/types.js +2 -0
- package/dist/manifest.d.ts +113 -0
- package/dist/manifest.js +10 -0
- package/dist/schemas/embeds.d.ts +128 -0
- package/dist/schemas/embeds.js +43 -0
- package/dist/schemas/events.d.ts +63 -0
- package/dist/schemas/events.js +35 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.js +21 -0
- package/dist/schemas/manifest.d.ts +236 -0
- package/dist/schemas/manifest.js +127 -0
- package/dist/schemas/notifications.d.ts +22 -0
- package/dist/schemas/notifications.js +23 -0
- package/dist/schemas/shared.d.ts +24 -0
- package/dist/schemas/shared.js +110 -0
- package/dist/solana.d.ts +72 -0
- package/dist/solana.js +15 -0
- package/dist/solanaWire.d.ts +3 -0
- package/dist/solanaWire.js +84 -0
- package/dist/types.d.ts +91 -0
- package/dist/types.js +41 -0
- package/dist/wallet/ethereum.d.ts +47 -0
- package/dist/wallet/ethereum.js +2 -0
- package/dist/wallet/index.d.ts +1 -0
- package/dist/wallet/index.js +37 -0
- package/esm/actions/AddMiniApp.d.ts +36 -0
- package/esm/actions/AddMiniApp.js +19 -0
- package/esm/actions/ComposeCast.d.ts +37 -0
- package/esm/actions/ComposeCast.js +1 -0
- package/esm/actions/Haptics.d.ts +5 -0
- package/esm/actions/Haptics.js +1 -0
- package/esm/actions/Ready.d.ts +13 -0
- package/esm/actions/Ready.js +3 -0
- package/esm/actions/SendToken.d.ts +48 -0
- package/esm/actions/SendToken.js +1 -0
- package/esm/actions/SignIn.d.ts +55 -0
- package/esm/actions/SignIn.js +10 -0
- package/esm/actions/SwapToken.d.ts +46 -0
- package/esm/actions/SwapToken.js +1 -0
- package/esm/actions/ViewCast.d.ts +25 -0
- package/esm/actions/ViewCast.js +1 -0
- package/esm/actions/ViewProfile.d.ts +4 -0
- package/esm/actions/ViewProfile.js +1 -0
- package/esm/actions/ViewToken.d.ts +4 -0
- package/esm/actions/ViewToken.js +1 -0
- package/esm/actions/index.d.ts +10 -0
- package/esm/actions/index.js +10 -0
- package/esm/back.d.ts +13 -0
- package/esm/back.js +3 -0
- package/esm/context.d.ts +94 -0
- package/esm/context.js +1 -0
- package/esm/errors.d.ts +13 -0
- package/esm/errors.js +8 -0
- package/esm/index.d.ts +10 -0
- package/esm/index.js +10 -0
- package/esm/internal/types.d.ts +8 -0
- package/esm/internal/types.js +1 -0
- package/esm/manifest.d.ts +113 -0
- package/esm/manifest.js +7 -0
- package/esm/schemas/embeds.d.ts +128 -0
- package/esm/schemas/embeds.js +39 -0
- package/esm/schemas/events.d.ts +63 -0
- package/esm/schemas/events.js +32 -0
- package/esm/schemas/index.d.ts +5 -0
- package/esm/schemas/index.js +5 -0
- package/esm/schemas/manifest.d.ts +236 -0
- package/esm/schemas/manifest.js +124 -0
- package/esm/schemas/notifications.d.ts +22 -0
- package/esm/schemas/notifications.js +20 -0
- package/esm/schemas/shared.d.ts +24 -0
- package/esm/schemas/shared.js +106 -0
- package/esm/solana.d.ts +72 -0
- package/esm/solana.js +11 -0
- package/esm/solanaWire.d.ts +3 -0
- package/esm/solanaWire.js +80 -0
- package/esm/tsconfig.tsbuildinfo +1 -0
- package/esm/types.d.ts +91 -0
- package/esm/types.js +23 -0
- package/esm/wallet/ethereum.d.ts +47 -0
- package/esm/wallet/ethereum.js +1 -0
- package/esm/wallet/index.d.ts +1 -0
- package/esm/wallet/index.js +1 -0
- package/package.json +42 -0
- package/src/actions/AddMiniApp.ts +51 -0
- package/src/actions/ComposeCast.ts +44 -0
- package/src/actions/Haptics.ts +9 -0
- package/src/actions/Ready.ts +15 -0
- package/src/actions/SendToken.ts +57 -0
- package/src/actions/SignIn.ts +67 -0
- package/src/actions/SwapToken.ts +54 -0
- package/src/actions/ViewCast.ts +27 -0
- package/src/actions/ViewProfile.ts +5 -0
- package/src/actions/ViewToken.ts +5 -0
- package/src/actions/index.ts +10 -0
- package/src/back.ts +15 -0
- package/src/context.ts +117 -0
- package/src/errors.ts +21 -0
- package/src/index.ts +10 -0
- package/src/internal/types.ts +20 -0
- package/src/manifest.ts +131 -0
- package/src/schemas/embeds.ts +58 -0
- package/src/schemas/events.ts +57 -0
- package/src/schemas/index.ts +5 -0
- package/src/schemas/manifest.ts +142 -0
- package/src/schemas/notifications.ts +35 -0
- package/src/schemas/shared.ts +138 -0
- package/src/solana.ts +108 -0
- package/src/solanaWire.ts +120 -0
- package/src/types.ts +165 -0
- package/src/wallet/ethereum.ts +65 -0
- package/src/wallet/index.ts +1 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './actions/index.ts';
|
|
2
|
+
export * from './wallet/index.ts';
|
|
3
|
+
export * as Back from './back.ts';
|
|
4
|
+
export * as Errors from './errors.ts';
|
|
5
|
+
export * as Context from './context.ts';
|
|
6
|
+
export * as Manifest from './manifest.ts';
|
|
7
|
+
export * from './types.ts';
|
|
8
|
+
export * from './schemas/index.ts';
|
|
9
|
+
export * from './solana.ts';
|
|
10
|
+
export * from './solanaWire.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.Manifest = exports.Context = exports.Errors = exports.Back = void 0;
|
|
40
|
+
__exportStar(require("./actions/index.js"), exports);
|
|
41
|
+
__exportStar(require("./wallet/index.js"), exports);
|
|
42
|
+
exports.Back = __importStar(require("./back.js"));
|
|
43
|
+
exports.Errors = __importStar(require("./errors.js"));
|
|
44
|
+
exports.Context = __importStar(require("./context.js"));
|
|
45
|
+
exports.Manifest = __importStar(require("./manifest.js"));
|
|
46
|
+
__exportStar(require("./types.js"), exports);
|
|
47
|
+
__exportStar(require("./schemas/index.js"), exports);
|
|
48
|
+
__exportStar(require("./solana.js"), exports);
|
|
49
|
+
__exportStar(require("./solanaWire.js"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
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<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 {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Farcaster manifest for a domain hosted at `/.well-known/farcaster.json`
|
|
3
|
+
*/
|
|
4
|
+
export type Manifest = {
|
|
5
|
+
accountAssociation: AccountAssociation;
|
|
6
|
+
miniapp?: MiniAppConfig;
|
|
7
|
+
frame?: MiniAppConfig;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Signed domain association linking this miniapp to a Farcaster account
|
|
11
|
+
*
|
|
12
|
+
* A DomainAssociation can be generated using the {@link https://farcaster.xyz/~/developers/domains | Warpcast
|
|
13
|
+
* Domains Developer} tool.
|
|
14
|
+
*/
|
|
15
|
+
export type AccountAssociation = {
|
|
16
|
+
/**
|
|
17
|
+
* Base64URL encoded JFS signature
|
|
18
|
+
*/
|
|
19
|
+
header: string;
|
|
20
|
+
/**
|
|
21
|
+
* Base64URL encoded payload signature
|
|
22
|
+
*/
|
|
23
|
+
payload: string;
|
|
24
|
+
/**
|
|
25
|
+
* Base64URL encoded signature
|
|
26
|
+
*/
|
|
27
|
+
signature: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* MiniApp configuration
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ``ts
|
|
34
|
+
* const miniapp: MiniAppConfig = {
|
|
35
|
+
* version: '1',
|
|
36
|
+
* name: 'Yoink!',
|
|
37
|
+
* homeUrl: 'https://yoink.party',
|
|
38
|
+
* iconUrl: 'https://yoink.party/img/icon.png',
|
|
39
|
+
* imageUrl: 'https://yoink.party/framesV2/opengraph-image',
|
|
40
|
+
* buttonTitle: '🚩 Start',
|
|
41
|
+
* splashImageUrl: 'https://yoink.party/img/splash.png',
|
|
42
|
+
* splashImageBackgroundColor: '#eeeee4',
|
|
43
|
+
* webhookUrl: 'https://yoink.party/webhook'
|
|
44
|
+
* };
|
|
45
|
+
* ``
|
|
46
|
+
*/
|
|
47
|
+
export type MiniAppConfig = {
|
|
48
|
+
/**
|
|
49
|
+
* Manifest version
|
|
50
|
+
*
|
|
51
|
+
* Must be the literal '1'.
|
|
52
|
+
*/
|
|
53
|
+
version: '1';
|
|
54
|
+
/**
|
|
55
|
+
* App name that will be displayed to users
|
|
56
|
+
*
|
|
57
|
+
* Max length of 32 characters.
|
|
58
|
+
*/
|
|
59
|
+
name: string;
|
|
60
|
+
/**
|
|
61
|
+
* Default launch URL
|
|
62
|
+
*
|
|
63
|
+
* Max length of 1024 characters.
|
|
64
|
+
*/
|
|
65
|
+
homeUrl: string;
|
|
66
|
+
/**
|
|
67
|
+
* Icon URL
|
|
68
|
+
*
|
|
69
|
+
* Max length of 1024 characters. Image must be 200x200px and less than 1MB.
|
|
70
|
+
*/
|
|
71
|
+
iconUrl: string;
|
|
72
|
+
/**
|
|
73
|
+
* Image URL
|
|
74
|
+
*
|
|
75
|
+
* Max length of 1024 characters. Image must have a 3:2 ratio.
|
|
76
|
+
*/
|
|
77
|
+
imageUrl: string;
|
|
78
|
+
/**
|
|
79
|
+
* Default button title to use when miniapp is rendered.
|
|
80
|
+
*
|
|
81
|
+
* Max length of 32 characters.
|
|
82
|
+
*/
|
|
83
|
+
buttonTitle: string;
|
|
84
|
+
/**
|
|
85
|
+
* Splash image URL
|
|
86
|
+
*
|
|
87
|
+
* Max length of 1024 characters. Image must be 200x200px and less than 1MB.
|
|
88
|
+
*/
|
|
89
|
+
splashImageUrl?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Splash background color
|
|
92
|
+
*
|
|
93
|
+
* Must be a hex color code.
|
|
94
|
+
*/
|
|
95
|
+
splashBackgroundColor?: string;
|
|
96
|
+
/**
|
|
97
|
+
* URL to which clients will POST server events.
|
|
98
|
+
* Max length of 1024 characters.
|
|
99
|
+
* Required if the miniapp application uses notifications.
|
|
100
|
+
*/
|
|
101
|
+
webhookUrl?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Canonical domain for the miniapp application.
|
|
104
|
+
* If specified, this domain will be treated as the primary domain for the miniapp.
|
|
105
|
+
* Max length of 1024 characters.
|
|
106
|
+
*/
|
|
107
|
+
canonicalDomain?: string;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Helper function to get the MiniApp config from a manifest,
|
|
111
|
+
* supporting both 'miniapp' and 'frame' properties during the transition period
|
|
112
|
+
*/
|
|
113
|
+
export declare function getMiniAppConfig(manifest: Manifest): MiniAppConfig | undefined;
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMiniAppConfig = getMiniAppConfig;
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to get the MiniApp config from a manifest,
|
|
6
|
+
* supporting both 'miniapp' and 'frame' properties during the transition period
|
|
7
|
+
*/
|
|
8
|
+
function getMiniAppConfig(manifest) {
|
|
9
|
+
return manifest.miniapp || manifest.frame;
|
|
10
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const actionLaunchFrameSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"launch_frame">;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
url: z.ZodOptional<z.ZodString>;
|
|
6
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
7
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const actionLaunchMiniAppSchema: z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"launch_miniapp">;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
url: z.ZodOptional<z.ZodString>;
|
|
13
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
14
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export declare const actionViewTokenSchema: z.ZodObject<{
|
|
17
|
+
type: z.ZodLiteral<"view_token">;
|
|
18
|
+
token: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const actionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"launch_miniapp">;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
url: z.ZodOptional<z.ZodString>;
|
|
24
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
25
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"view_token">;
|
|
28
|
+
token: z.ZodString;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<"launch_frame">;
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
url: z.ZodOptional<z.ZodString>;
|
|
33
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
34
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>]>;
|
|
36
|
+
export declare const buttonSchema: z.ZodObject<{
|
|
37
|
+
title: z.ZodString;
|
|
38
|
+
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"launch_miniapp">;
|
|
40
|
+
name: z.ZodString;
|
|
41
|
+
url: z.ZodOptional<z.ZodString>;
|
|
42
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
43
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
+
type: z.ZodLiteral<"view_token">;
|
|
46
|
+
token: z.ZodString;
|
|
47
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
48
|
+
type: z.ZodLiteral<"launch_frame">;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
url: z.ZodOptional<z.ZodString>;
|
|
51
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
52
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>]>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export declare const miniAppEmbedNextSchema: z.ZodObject<{
|
|
56
|
+
version: z.ZodLiteral<"next">;
|
|
57
|
+
imageUrl: z.ZodString;
|
|
58
|
+
aspectRatio: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"1:1">, z.ZodLiteral<"3:2">]>>;
|
|
59
|
+
button: z.ZodObject<{
|
|
60
|
+
title: z.ZodString;
|
|
61
|
+
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
62
|
+
type: z.ZodLiteral<"launch_miniapp">;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
url: z.ZodOptional<z.ZodString>;
|
|
65
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
66
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"view_token">;
|
|
69
|
+
token: z.ZodString;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"launch_frame">;
|
|
72
|
+
name: z.ZodString;
|
|
73
|
+
url: z.ZodOptional<z.ZodString>;
|
|
74
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
75
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>]>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
export declare const safeParseMiniAppEmbed: (rawResponse: unknown) => z.ZodSafeParseResult<{
|
|
80
|
+
version: "next";
|
|
81
|
+
imageUrl: string;
|
|
82
|
+
button: {
|
|
83
|
+
title: string;
|
|
84
|
+
action: {
|
|
85
|
+
type: "launch_miniapp";
|
|
86
|
+
name: string;
|
|
87
|
+
url?: string | undefined;
|
|
88
|
+
splashImageUrl?: string | undefined;
|
|
89
|
+
splashBackgroundColor?: string | undefined;
|
|
90
|
+
} | {
|
|
91
|
+
type: "view_token";
|
|
92
|
+
token: string;
|
|
93
|
+
} | {
|
|
94
|
+
type: "launch_frame";
|
|
95
|
+
name: string;
|
|
96
|
+
url?: string | undefined;
|
|
97
|
+
splashImageUrl?: string | undefined;
|
|
98
|
+
splashBackgroundColor?: string | undefined;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
aspectRatio?: "1:1" | "3:2" | undefined;
|
|
102
|
+
}>;
|
|
103
|
+
export declare const safeParseFrameEmbed: (rawResponse: unknown) => z.ZodSafeParseResult<{
|
|
104
|
+
version: "next";
|
|
105
|
+
imageUrl: string;
|
|
106
|
+
button: {
|
|
107
|
+
title: string;
|
|
108
|
+
action: {
|
|
109
|
+
type: "launch_miniapp";
|
|
110
|
+
name: string;
|
|
111
|
+
url?: string | undefined;
|
|
112
|
+
splashImageUrl?: string | undefined;
|
|
113
|
+
splashBackgroundColor?: string | undefined;
|
|
114
|
+
} | {
|
|
115
|
+
type: "view_token";
|
|
116
|
+
token: string;
|
|
117
|
+
} | {
|
|
118
|
+
type: "launch_frame";
|
|
119
|
+
name: string;
|
|
120
|
+
url?: string | undefined;
|
|
121
|
+
splashImageUrl?: string | undefined;
|
|
122
|
+
splashBackgroundColor?: string | undefined;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
aspectRatio?: "1:1" | "3:2" | undefined;
|
|
126
|
+
}>;
|
|
127
|
+
export type MiniAppEmbedNext = z.infer<typeof miniAppEmbedNextSchema>;
|
|
128
|
+
export type FrameEmbedNext = MiniAppEmbedNext;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safeParseFrameEmbed = exports.safeParseMiniAppEmbed = exports.miniAppEmbedNextSchema = exports.buttonSchema = exports.actionSchema = exports.actionViewTokenSchema = exports.actionLaunchMiniAppSchema = exports.actionLaunchFrameSchema = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
const shared_ts_1 = require("./shared.js");
|
|
6
|
+
exports.actionLaunchFrameSchema = v4_1.z.object({
|
|
7
|
+
type: v4_1.z.literal('launch_frame'),
|
|
8
|
+
name: shared_ts_1.miniAppNameSchema,
|
|
9
|
+
url: shared_ts_1.secureUrlSchema.optional(),
|
|
10
|
+
splashImageUrl: shared_ts_1.secureUrlSchema.optional(),
|
|
11
|
+
splashBackgroundColor: shared_ts_1.hexColorSchema.optional(),
|
|
12
|
+
});
|
|
13
|
+
exports.actionLaunchMiniAppSchema = v4_1.z.object({
|
|
14
|
+
type: v4_1.z.literal('launch_miniapp'),
|
|
15
|
+
name: shared_ts_1.miniAppNameSchema,
|
|
16
|
+
url: shared_ts_1.secureUrlSchema.optional(),
|
|
17
|
+
splashImageUrl: shared_ts_1.secureUrlSchema.optional(),
|
|
18
|
+
splashBackgroundColor: shared_ts_1.hexColorSchema.optional(),
|
|
19
|
+
});
|
|
20
|
+
exports.actionViewTokenSchema = v4_1.z.object({
|
|
21
|
+
type: v4_1.z.literal('view_token'),
|
|
22
|
+
token: shared_ts_1.caip19TokenSchema,
|
|
23
|
+
});
|
|
24
|
+
exports.actionSchema = v4_1.z.discriminatedUnion('type', [
|
|
25
|
+
exports.actionLaunchMiniAppSchema,
|
|
26
|
+
exports.actionViewTokenSchema,
|
|
27
|
+
// Remove after compatibility period
|
|
28
|
+
exports.actionLaunchFrameSchema,
|
|
29
|
+
]);
|
|
30
|
+
exports.buttonSchema = v4_1.z.object({
|
|
31
|
+
title: shared_ts_1.buttonTitleSchema,
|
|
32
|
+
action: exports.actionSchema,
|
|
33
|
+
});
|
|
34
|
+
exports.miniAppEmbedNextSchema = v4_1.z.object({
|
|
35
|
+
version: v4_1.z.literal('next'),
|
|
36
|
+
imageUrl: shared_ts_1.secureUrlSchema,
|
|
37
|
+
aspectRatio: shared_ts_1.aspectRatioSchema.optional(),
|
|
38
|
+
button: exports.buttonSchema,
|
|
39
|
+
});
|
|
40
|
+
const safeParseMiniAppEmbed = (rawResponse) => exports.miniAppEmbedNextSchema.safeParse(rawResponse);
|
|
41
|
+
exports.safeParseMiniAppEmbed = safeParseMiniAppEmbed;
|
|
42
|
+
// Backward compatibility - also parse fc:frame meta tags
|
|
43
|
+
exports.safeParseFrameEmbed = exports.safeParseMiniAppEmbed;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const eventMiniAppAddedSchema: z.ZodObject<{
|
|
3
|
+
event: z.ZodLiteral<"miniapp_added">;
|
|
4
|
+
notificationDetails: z.ZodOptional<z.ZodObject<{
|
|
5
|
+
url: z.ZodString;
|
|
6
|
+
token: z.ZodString;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type EventMiniAppAdded = z.infer<typeof eventMiniAppAddedSchema>;
|
|
10
|
+
export declare const eventFrameAddedSchema: z.ZodObject<{
|
|
11
|
+
event: z.ZodLiteral<"frame_added">;
|
|
12
|
+
notificationDetails: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
url: z.ZodString;
|
|
14
|
+
token: z.ZodString;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>;
|
|
18
|
+
export declare const eventMiniAppRemovedSchema: z.ZodObject<{
|
|
19
|
+
event: z.ZodLiteral<"miniapp_removed">;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type EventMiniAppRemoved = z.infer<typeof eventMiniAppRemovedSchema>;
|
|
22
|
+
export declare const eventFrameRemovedSchema: z.ZodObject<{
|
|
23
|
+
event: z.ZodLiteral<"frame_removed">;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>;
|
|
26
|
+
export declare const eventNotificationsEnabledSchema: z.ZodObject<{
|
|
27
|
+
event: z.ZodLiteral<"notifications_enabled">;
|
|
28
|
+
notificationDetails: z.ZodObject<{
|
|
29
|
+
url: z.ZodNonOptional<z.ZodString>;
|
|
30
|
+
token: z.ZodNonOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type EventNotificationsEnabled = z.infer<typeof eventNotificationsEnabledSchema>;
|
|
34
|
+
export declare const notificationsDisabledSchema: z.ZodObject<{
|
|
35
|
+
event: z.ZodLiteral<"notifications_disabled">;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type EventNotificationsDisabled = z.infer<typeof notificationsDisabledSchema>;
|
|
38
|
+
export declare const serverEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
39
|
+
event: z.ZodLiteral<"miniapp_added">;
|
|
40
|
+
notificationDetails: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
url: z.ZodString;
|
|
42
|
+
token: z.ZodString;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
+
event: z.ZodLiteral<"miniapp_removed">;
|
|
46
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
+
event: z.ZodLiteral<"notifications_enabled">;
|
|
48
|
+
notificationDetails: z.ZodObject<{
|
|
49
|
+
url: z.ZodNonOptional<z.ZodString>;
|
|
50
|
+
token: z.ZodNonOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
event: z.ZodLiteral<"notifications_disabled">;
|
|
54
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
55
|
+
event: z.ZodLiteral<"frame_added">;
|
|
56
|
+
notificationDetails: z.ZodOptional<z.ZodObject<{
|
|
57
|
+
url: z.ZodString;
|
|
58
|
+
token: z.ZodString;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
event: z.ZodLiteral<"frame_removed">;
|
|
62
|
+
}, z.core.$strip>]>;
|
|
63
|
+
export type MiniAppServerEvent = z.infer<typeof serverEventSchema>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serverEventSchema = exports.notificationsDisabledSchema = exports.eventNotificationsEnabledSchema = exports.eventFrameRemovedSchema = exports.eventMiniAppRemovedSchema = exports.eventFrameAddedSchema = exports.eventMiniAppAddedSchema = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
const notifications_ts_1 = require("./notifications.js");
|
|
6
|
+
exports.eventMiniAppAddedSchema = v4_1.z.object({
|
|
7
|
+
event: v4_1.z.literal('miniapp_added'),
|
|
8
|
+
notificationDetails: notifications_ts_1.notificationDetailsSchema.optional(),
|
|
9
|
+
});
|
|
10
|
+
exports.eventFrameAddedSchema = v4_1.z.object({
|
|
11
|
+
event: v4_1.z.literal('frame_added'),
|
|
12
|
+
notificationDetails: notifications_ts_1.notificationDetailsSchema.optional(),
|
|
13
|
+
});
|
|
14
|
+
exports.eventMiniAppRemovedSchema = v4_1.z.object({
|
|
15
|
+
event: v4_1.z.literal('miniapp_removed'),
|
|
16
|
+
});
|
|
17
|
+
exports.eventFrameRemovedSchema = v4_1.z.object({
|
|
18
|
+
event: v4_1.z.literal('frame_removed'),
|
|
19
|
+
});
|
|
20
|
+
exports.eventNotificationsEnabledSchema = v4_1.z.object({
|
|
21
|
+
event: v4_1.z.literal('notifications_enabled'),
|
|
22
|
+
notificationDetails: notifications_ts_1.notificationDetailsSchema.required(),
|
|
23
|
+
});
|
|
24
|
+
exports.notificationsDisabledSchema = v4_1.z.object({
|
|
25
|
+
event: v4_1.z.literal('notifications_disabled'),
|
|
26
|
+
});
|
|
27
|
+
exports.serverEventSchema = v4_1.z.discriminatedUnion('event', [
|
|
28
|
+
exports.eventMiniAppAddedSchema,
|
|
29
|
+
exports.eventMiniAppRemovedSchema,
|
|
30
|
+
exports.eventNotificationsEnabledSchema,
|
|
31
|
+
exports.notificationsDisabledSchema,
|
|
32
|
+
// Remove after compatibility period
|
|
33
|
+
exports.eventFrameAddedSchema,
|
|
34
|
+
exports.eventFrameRemovedSchema,
|
|
35
|
+
]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./embeds.js"), exports);
|
|
18
|
+
__exportStar(require("./events.js"), exports);
|
|
19
|
+
__exportStar(require("./shared.js"), exports);
|
|
20
|
+
__exportStar(require("./manifest.js"), exports);
|
|
21
|
+
__exportStar(require("./notifications.js"), exports);
|