@farcaster/frame-core 0.1.1 → 0.1.3

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.
Files changed (64) hide show
  1. package/README.md +1 -1
  2. package/dist/actions/AddMiniApp.d.ts +3 -3
  3. package/dist/actions/AddMiniApp.js +1 -1
  4. package/dist/actions/Haptics.d.ts +3 -0
  5. package/dist/actions/Haptics.js +2 -0
  6. package/dist/actions/SignIn.d.ts +2 -2
  7. package/dist/actions/SignIn.js +1 -1
  8. package/dist/actions/index.d.ts +10 -9
  9. package/dist/actions/index.js +11 -10
  10. package/dist/context.d.ts +5 -1
  11. package/dist/index.d.ts +9 -9
  12. package/dist/index.js +9 -9
  13. package/dist/manifest.d.ts +1 -1
  14. package/dist/schemas/embeds.js +9 -9
  15. package/dist/schemas/events.js +3 -3
  16. package/dist/schemas/index.d.ts +5 -5
  17. package/dist/schemas/index.js +5 -5
  18. package/dist/schemas/manifest.js +22 -22
  19. package/dist/schemas/notifications.js +2 -2
  20. package/dist/solanaWire.d.ts +1 -1
  21. package/dist/types.d.ts +14 -8
  22. package/dist/types.js +6 -3
  23. package/dist/wallet/index.d.ts +1 -1
  24. package/dist/wallet/index.js +1 -1
  25. package/esm/actions/AddMiniApp.d.ts +3 -3
  26. package/esm/actions/AddMiniApp.js +1 -1
  27. package/esm/actions/Haptics.d.ts +3 -0
  28. package/esm/actions/Haptics.js +1 -0
  29. package/esm/actions/SignIn.d.ts +2 -2
  30. package/esm/actions/SignIn.js +1 -1
  31. package/esm/actions/index.d.ts +10 -9
  32. package/esm/actions/index.js +10 -9
  33. package/esm/context.d.ts +5 -1
  34. package/esm/index.d.ts +9 -9
  35. package/esm/index.js +9 -9
  36. package/esm/manifest.d.ts +1 -1
  37. package/esm/schemas/embeds.js +1 -1
  38. package/esm/schemas/events.js +1 -1
  39. package/esm/schemas/index.d.ts +5 -5
  40. package/esm/schemas/index.js +5 -5
  41. package/esm/schemas/manifest.js +2 -2
  42. package/esm/schemas/notifications.js +1 -1
  43. package/esm/solanaWire.d.ts +1 -1
  44. package/esm/tsconfig.tsbuildinfo +1 -1
  45. package/esm/types.d.ts +14 -8
  46. package/esm/types.js +5 -2
  47. package/esm/wallet/index.d.ts +1 -1
  48. package/esm/wallet/index.js +1 -1
  49. package/package.json +2 -2
  50. package/src/actions/AddMiniApp.ts +3 -3
  51. package/src/actions/Haptics.ts +9 -0
  52. package/src/actions/SignIn.ts +2 -2
  53. package/src/actions/index.ts +10 -9
  54. package/src/context.ts +6 -1
  55. package/src/index.ts +9 -9
  56. package/src/manifest.ts +1 -1
  57. package/src/schemas/embeds.ts +1 -1
  58. package/src/schemas/events.ts +1 -1
  59. package/src/schemas/index.ts +5 -5
  60. package/src/schemas/manifest.ts +2 -2
  61. package/src/schemas/notifications.ts +1 -1
  62. package/src/solanaWire.ts +1 -1
  63. package/src/types.ts +20 -7
  64. package/src/wallet/index.ts +1 -1
package/esm/types.d.ts CHANGED
@@ -1,20 +1,20 @@
1
- import type { AddMiniApp, ComposeCast, Ready, SendToken, SignIn, SwapToken, ViewCast, ViewProfile, ViewToken } from './actions';
2
- import type { FrameContext } from './context';
3
- import type { EventFrameAdded, EventFrameRemoved, EventNotificationsDisabled, EventNotificationsEnabled } from './schemas';
4
- import type { SolanaRequestFn, SolanaWireRequestFn } from './solana';
5
- import type { Ethereum } from './wallet';
1
+ import type { AddMiniApp, ComposeCast, Haptics, Ready, SendToken, SignIn, SwapToken, ViewCast, ViewProfile, ViewToken } from './actions/index.ts';
2
+ import type { FrameContext } from './context.ts';
3
+ import type { EventFrameAdded, EventFrameRemoved, EventNotificationsDisabled, EventNotificationsEnabled } from './schemas/index.ts';
4
+ import type { SolanaRequestFn, SolanaWireRequestFn } from './solana.ts';
5
+ import type { Ethereum } from './wallet/index.ts';
6
6
  export type SetPrimaryButtonOptions = {
7
7
  text: string;
8
8
  loading?: boolean;
9
9
  disabled?: boolean;
10
10
  hidden?: boolean;
11
11
  };
12
- export * from './wallet/ethereum';
13
- export { DEFAULT_READY_OPTIONS, ReadyOptions } from './actions/Ready';
12
+ export * from './wallet/ethereum.ts';
13
+ export { DEFAULT_READY_OPTIONS, ReadyOptions } from './actions/Ready.ts';
14
14
  export type SignInOptions = SignIn.SignInOptions;
15
15
  export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void;
16
16
  export declare const miniAppHostCapabilityList: [string, ...string[]];
17
- export type MiniAppHostCapability = 'wallet.getEthereumProvider' | 'wallet.getSolanaProvider' | 'actions.ready' | 'actions.openUrl' | 'actions.close' | 'actions.setPrimaryButton' | 'actions.addMiniApp' | 'actions.signIn' | 'actions.viewCast' | 'actions.viewProfile' | 'actions.composeCast' | 'actions.viewToken' | 'actions.sendToken' | 'actions.swapToken';
17
+ export type MiniAppHostCapability = 'wallet.getEthereumProvider' | 'wallet.getSolanaProvider' | 'actions.ready' | 'actions.openUrl' | 'actions.close' | 'actions.setPrimaryButton' | 'actions.addMiniApp' | 'actions.signIn' | 'actions.viewCast' | 'actions.viewProfile' | 'actions.composeCast' | 'actions.viewToken' | 'actions.sendToken' | 'actions.swapToken' | 'actions.haptics.impactOccurred' | 'actions.haptics.notificationOccurred' | 'actions.haptics.selectionChanged';
18
18
  export type GetCapabilities = () => Promise<MiniAppHostCapability[]>;
19
19
  export type GetChains = () => Promise<string[]>;
20
20
  export type WireFrameHost = {
@@ -35,6 +35,9 @@ export type WireFrameHost = {
35
35
  sendToken: SendToken.SendToken;
36
36
  swapToken: SwapToken.SwapToken;
37
37
  composeCast: <close extends boolean | undefined = undefined>(options: ComposeCast.Options<close>) => Promise<ComposeCast.Result<close>>;
38
+ impactOccurred: Haptics.ImpactOccurred;
39
+ notificationOccurred: Haptics.NotificationOccurred;
40
+ selectionChanged: Haptics.SelectionChanged;
38
41
  getCapabilities: GetCapabilities;
39
42
  getChains: GetChains;
40
43
  };
@@ -60,6 +63,9 @@ export type FrameHost = {
60
63
  sendToken: SendToken.SendToken;
61
64
  swapToken: SwapToken.SwapToken;
62
65
  composeCast: <close extends boolean | undefined = undefined>(options: ComposeCast.Options<close>) => Promise<ComposeCast.Result<close>>;
66
+ impactOccurred: Haptics.ImpactOccurred;
67
+ notificationOccurred: Haptics.NotificationOccurred;
68
+ selectionChanged: Haptics.SelectionChanged;
63
69
  getCapabilities: GetCapabilities;
64
70
  getChains: GetChains;
65
71
  };
package/esm/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // start backwards compat, remove in 1.0
2
- export * from './wallet/ethereum';
3
- export { DEFAULT_READY_OPTIONS } from './actions/Ready';
2
+ export * from "./wallet/ethereum.js";
3
+ export { DEFAULT_READY_OPTIONS } from "./actions/Ready.js";
4
4
  export const miniAppHostCapabilityList = [
5
5
  'wallet.getEthereumProvider',
6
6
  'wallet.getSolanaProvider',
@@ -16,4 +16,7 @@ export const miniAppHostCapabilityList = [
16
16
  'actions.viewToken',
17
17
  'actions.sendToken',
18
18
  'actions.swapToken',
19
+ 'actions.haptics.impactOccurred',
20
+ 'actions.haptics.notificationOccurred',
21
+ 'actions.haptics.selectionChanged',
19
22
  ];
@@ -1 +1 @@
1
- export * as Ethereum from './ethereum';
1
+ export * as Ethereum from './ethereum.ts';
@@ -1 +1 @@
1
- export * as Ethereum from './ethereum';
1
+ export * as Ethereum from "./ethereum.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farcaster/frame-core",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  "@vitest/coverage-v8": "^2.1.8",
19
19
  "typescript": "^5.8.3",
20
20
  "vitest": "^2.1.9",
21
- "@farcaster/tsconfig": "0.0.4"
21
+ "@farcaster/tsconfig": "0.0.5"
22
22
  },
23
23
  "dependencies": {
24
24
  "@solana/web3.js": "^1.98.2",
@@ -1,6 +1,6 @@
1
- import * as Errors from '../errors'
2
- import type { OneOf } from '../internal/types'
3
- import type { FrameNotificationDetails } from '../schemas'
1
+ import * as Errors from '../errors.ts'
2
+ import type { OneOf } from '../internal/types.ts'
3
+ import type { FrameNotificationDetails } from '../schemas/index.ts'
4
4
 
5
5
  export type AddMiniAppResult = {
6
6
  notificationDetails?: FrameNotificationDetails
@@ -0,0 +1,9 @@
1
+ export type ImpactOccurred = (
2
+ type: 'light' | 'medium' | 'heavy' | 'soft' | 'rigid',
3
+ ) => Promise<void>
4
+
5
+ export type NotificationOccurred = (
6
+ type: 'success' | 'warning' | 'error',
7
+ ) => Promise<void>
8
+
9
+ export type SelectionChanged = () => Promise<void>
@@ -1,5 +1,5 @@
1
- import * as Errors from '../errors'
2
- import type { OneOf } from '../internal/types'
1
+ import * as Errors from '../errors.ts'
2
+ import type { OneOf } from '../internal/types.ts'
3
3
 
4
4
  export type SignInOptions = {
5
5
  /**
@@ -1,9 +1,10 @@
1
- export * as AddMiniApp from './AddMiniApp'
2
- export * as ComposeCast from './ComposeCast'
3
- export * as Ready from './Ready'
4
- export * as SignIn from './SignIn'
5
- export * as SendToken from './SendToken'
6
- export * as SwapToken from './SwapToken'
7
- export * as ViewCast from './ViewCast'
8
- export * as ViewProfile from './ViewProfile'
9
- export * as ViewToken from './ViewToken'
1
+ export * as AddMiniApp from './AddMiniApp.ts'
2
+ export * as ComposeCast from './ComposeCast.ts'
3
+ export * as Haptics from './Haptics.ts'
4
+ export * as Ready from './Ready.ts'
5
+ export * as SignIn from './SignIn.ts'
6
+ export * as SendToken from './SendToken.ts'
7
+ export * as SwapToken from './SwapToken.ts'
8
+ export * as ViewCast from './ViewCast.ts'
9
+ export * as ViewProfile from './ViewProfile.ts'
10
+ export * as ViewToken from './ViewToken.ts'
package/src/context.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { FrameNotificationDetails } from './schemas'
1
+ import type { FrameNotificationDetails } from './schemas/index.ts'
2
2
 
3
3
  export type CastEmbedLocationContext = {
4
4
  type: 'cast_embed'
@@ -83,8 +83,13 @@ export type ClientContext = {
83
83
  safeAreaInsets?: SafeAreaInsets
84
84
  }
85
85
 
86
+ export type ClientFeatures = {
87
+ haptics: boolean
88
+ }
89
+
86
90
  export type FrameContext = {
87
91
  client: ClientContext
88
92
  user: UserContext
89
93
  location?: LocationContext
94
+ features?: ClientFeatures
90
95
  }
package/src/index.ts CHANGED
@@ -1,9 +1,9 @@
1
- export * from './actions'
2
- export * from './wallet'
3
- export * as Errors from './errors'
4
- export * as Context from './context'
5
- export * as Manifest from './manifest'
6
- export * from './types'
7
- export * from './schemas'
8
- export * from './solana'
9
- export * from './solanaWire'
1
+ export * from './actions/index.ts'
2
+ export * from './wallet/index.ts'
3
+ export * as Errors from './errors.ts'
4
+ export * as Context from './context.ts'
5
+ export * as Manifest from './manifest.ts'
6
+ export * from './types.ts'
7
+ export * from './schemas/index.ts'
8
+ export * from './solana.ts'
9
+ export * from './solanaWire.ts'
package/src/manifest.ts CHANGED
@@ -9,7 +9,7 @@ export type Manifest = {
9
9
  /**
10
10
  * Signed domain association linking this frame to a Farcaster account
11
11
  *
12
- * A DomainAssociation can be generated using the {@link https://warpcast.com/~/developers/domains | Warpcast
12
+ * A DomainAssociation can be generated using the {@link https://farcaster.xyz/~/developers/domains | Warpcast
13
13
  * Domains Developer} tool.
14
14
  */
15
15
  export type AccountAssociation = {
@@ -6,7 +6,7 @@ import {
6
6
  frameNameSchema,
7
7
  hexColorSchema,
8
8
  secureUrlSchema,
9
- } from './shared'
9
+ } from './shared.ts'
10
10
 
11
11
  export const actionLaunchFrameSchema = z.object({
12
12
  type: z.literal('launch_frame'),
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod'
2
- import { notificationDetailsSchema } from './notifications'
2
+ import { notificationDetailsSchema } from './notifications.ts'
3
3
 
4
4
  export const eventFrameAddedSchema = z.object({
5
5
  event: z.literal('frame_added'),
@@ -1,5 +1,5 @@
1
- export * from './embeds'
2
- export * from './events'
3
- export * from './shared'
4
- export * from './manifest'
5
- export * from './notifications'
1
+ export * from './embeds.ts'
2
+ export * from './events.ts'
3
+ export * from './shared.ts'
4
+ export * from './manifest.ts'
5
+ export * from './notifications.ts'
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod'
2
- import { miniAppHostCapabilityList } from '../types'
2
+ import { miniAppHostCapabilityList } from '../types.ts'
3
3
  import {
4
4
  buttonTitleSchema,
5
5
  createSimpleStringSchema,
@@ -7,7 +7,7 @@ import {
7
7
  frameNameSchema,
8
8
  hexColorSchema,
9
9
  secureUrlSchema,
10
- } from './shared'
10
+ } from './shared.ts'
11
11
 
12
12
  const primaryCategorySchema = z.enum([
13
13
  'games',
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod'
2
- import { secureUrlSchema } from './shared'
2
+ import { secureUrlSchema } from './shared.ts'
3
3
 
4
4
  export const notificationDetailsSchema = z.object({
5
5
  url: z.string(),
package/src/solanaWire.ts CHANGED
@@ -14,7 +14,7 @@ import type {
14
14
  SolanaWireRequestFn,
15
15
  SolanaWireSignAndSendTransactionRequestArguments,
16
16
  SolanaWireSignTransactionRequestArguments,
17
- } from './solana'
17
+ } from './solana.ts'
18
18
 
19
19
  function serializeTransaction(transaction: SolanaCombinedTransaction): string {
20
20
  return Buffer.from(
package/src/types.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type {
2
2
  AddMiniApp,
3
3
  ComposeCast,
4
+ Haptics,
4
5
  Ready,
5
6
  SendToken,
6
7
  SignIn,
@@ -8,16 +9,16 @@ import type {
8
9
  ViewCast,
9
10
  ViewProfile,
10
11
  ViewToken,
11
- } from './actions'
12
- import type { FrameContext } from './context'
12
+ } from './actions/index.ts'
13
+ import type { FrameContext } from './context.ts'
13
14
  import type {
14
15
  EventFrameAdded,
15
16
  EventFrameRemoved,
16
17
  EventNotificationsDisabled,
17
18
  EventNotificationsEnabled,
18
- } from './schemas'
19
- import type { SolanaRequestFn, SolanaWireRequestFn } from './solana'
20
- import type { Ethereum } from './wallet'
19
+ } from './schemas/index.ts'
20
+ import type { SolanaRequestFn, SolanaWireRequestFn } from './solana.ts'
21
+ import type { Ethereum } from './wallet/index.ts'
21
22
 
22
23
  export type SetPrimaryButtonOptions = {
23
24
  text: string
@@ -27,8 +28,8 @@ export type SetPrimaryButtonOptions = {
27
28
  }
28
29
 
29
30
  // start backwards compat, remove in 1.0
30
- export * from './wallet/ethereum'
31
- export { DEFAULT_READY_OPTIONS, ReadyOptions } from './actions/Ready'
31
+ export * from './wallet/ethereum.ts'
32
+ export { DEFAULT_READY_OPTIONS, ReadyOptions } from './actions/Ready.ts'
32
33
  export type SignInOptions = SignIn.SignInOptions
33
34
  // end backwards compat
34
35
 
@@ -49,6 +50,9 @@ export const miniAppHostCapabilityList: [string, ...string[]] = [
49
50
  'actions.viewToken',
50
51
  'actions.sendToken',
51
52
  'actions.swapToken',
53
+ 'actions.haptics.impactOccurred',
54
+ 'actions.haptics.notificationOccurred',
55
+ 'actions.haptics.selectionChanged',
52
56
  ]
53
57
 
54
58
  export type MiniAppHostCapability =
@@ -66,6 +70,9 @@ export type MiniAppHostCapability =
66
70
  | 'actions.viewToken'
67
71
  | 'actions.sendToken'
68
72
  | 'actions.swapToken'
73
+ | 'actions.haptics.impactOccurred'
74
+ | 'actions.haptics.notificationOccurred'
75
+ | 'actions.haptics.selectionChanged'
69
76
 
70
77
  export type GetCapabilities = () => Promise<MiniAppHostCapability[]>
71
78
 
@@ -92,6 +99,9 @@ export type WireFrameHost = {
92
99
  composeCast: <close extends boolean | undefined = undefined>(
93
100
  options: ComposeCast.Options<close>,
94
101
  ) => Promise<ComposeCast.Result<close>>
102
+ impactOccurred: Haptics.ImpactOccurred
103
+ notificationOccurred: Haptics.NotificationOccurred
104
+ selectionChanged: Haptics.SelectionChanged
95
105
  getCapabilities: GetCapabilities
96
106
  getChains: GetChains
97
107
  }
@@ -120,6 +130,9 @@ export type FrameHost = {
120
130
  composeCast: <close extends boolean | undefined = undefined>(
121
131
  options: ComposeCast.Options<close>,
122
132
  ) => Promise<ComposeCast.Result<close>>
133
+ impactOccurred: Haptics.ImpactOccurred
134
+ notificationOccurred: Haptics.NotificationOccurred
135
+ selectionChanged: Haptics.SelectionChanged
123
136
  getCapabilities: GetCapabilities
124
137
  getChains: GetChains
125
138
  }
@@ -1 +1 @@
1
- export * as Ethereum from './ethereum'
1
+ export * as Ethereum from './ethereum.ts'