@farcaster/miniapp-sdk 0.0.0-canary-20250726165352 → 0.0.0-canary-20250905164304

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/sdk.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AddMiniApp, SignIn, } from '@farcaster/miniapp-core';
1
+ import { AddMiniApp, SignIn, SignManifest, } from '@farcaster/miniapp-core';
2
2
  import { createBack } from "./back.js";
3
3
  import { ethereumProvider, getEthereumProvider } from "./ethereumProvider.js";
4
4
  import { miniAppHost } from "./miniAppHost.js";
@@ -9,10 +9,10 @@ let cachedIsInMiniAppResult = null;
9
9
  /**
10
10
  * Determines if the current environment is a MiniApp context.
11
11
  *
12
- * @param timeoutMs - Optional timeout in milliseconds (default: 50)
12
+ * @param timeoutMs - Optional timeout in milliseconds (default: 1000)
13
13
  * @returns Promise resolving to boolean indicating if in MiniApp context
14
14
  */
15
- async function isInMiniApp(timeoutMs = 50) {
15
+ async function isInMiniApp(timeoutMs = 1000) {
16
16
  // Return cached result if we've already determined we are in a MiniApp
17
17
  if (cachedIsInMiniAppResult === true) {
18
18
  return true;
@@ -99,6 +99,22 @@ export const sdk = {
99
99
  },
100
100
  experimental: {
101
101
  getSolanaProvider,
102
+ signManifest: async (options) => {
103
+ const response = await miniAppHost.signManifest(options);
104
+ if (response.result) {
105
+ return response.result;
106
+ }
107
+ if (response.error.type === 'rejected_by_user') {
108
+ throw new SignManifest.RejectedByUser();
109
+ }
110
+ if (response.error.type === 'invalid_domain') {
111
+ throw new SignManifest.InvalidDomain();
112
+ }
113
+ if (response.error.type === 'generic_error') {
114
+ throw new SignManifest.GenericError(response.error.message);
115
+ }
116
+ throw new Error('Unreachable');
117
+ },
102
118
  quickAuth(options) {
103
119
  return quickAuth.getToken(options);
104
120
  },