@farcaster/frame-core 0.2.0 → 0.3.0
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.d.ts +153 -10
- package/dist/index.js +18 -33
- package/esm/index.d.ts +153 -10
- package/esm/index.js +17 -10
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -8
- package/src/index.ts +50 -10
- package/dist/actions/AddMiniApp.d.ts +0 -36
- package/dist/actions/AddMiniApp.js +0 -57
- package/dist/actions/ComposeCast.d.ts +0 -37
- package/dist/actions/ComposeCast.js +0 -2
- package/dist/actions/Haptics.d.ts +0 -5
- package/dist/actions/Haptics.js +0 -2
- package/dist/actions/Ready.d.ts +0 -13
- package/dist/actions/Ready.js +0 -6
- package/dist/actions/SendToken.d.ts +0 -48
- package/dist/actions/SendToken.js +0 -2
- package/dist/actions/SignIn.d.ts +0 -55
- package/dist/actions/SignIn.js +0 -47
- package/dist/actions/SwapToken.d.ts +0 -46
- package/dist/actions/SwapToken.js +0 -2
- package/dist/actions/ViewCast.d.ts +0 -25
- package/dist/actions/ViewCast.js +0 -2
- package/dist/actions/ViewProfile.d.ts +0 -4
- package/dist/actions/ViewProfile.js +0 -2
- package/dist/actions/ViewToken.d.ts +0 -4
- package/dist/actions/ViewToken.js +0 -2
- package/dist/actions/index.d.ts +0 -10
- package/dist/actions/index.js +0 -46
- package/dist/back.d.ts +0 -13
- package/dist/back.js +0 -6
- package/dist/context.d.ts +0 -94
- package/dist/context.js +0 -2
- package/dist/errors.d.ts +0 -13
- package/dist/errors.js +0 -12
- package/dist/internal/types.d.ts +0 -8
- package/dist/internal/types.js +0 -2
- package/dist/manifest.d.ts +0 -107
- package/dist/manifest.js +0 -2
- package/dist/schemas/embeds.d.ts +0 -243
- package/dist/schemas/embeds.js +0 -32
- package/dist/schemas/events.d.ts +0 -131
- package/dist/schemas/events.js +0 -25
- package/dist/schemas/index.d.ts +0 -5
- package/dist/schemas/index.js +0 -21
- package/dist/schemas/manifest.d.ts +0 -348
- package/dist/schemas/manifest.js +0 -114
- package/dist/schemas/notifications.d.ts +0 -60
- package/dist/schemas/notifications.js +0 -23
- package/dist/schemas/shared.d.ts +0 -40
- package/dist/schemas/shared.js +0 -83
- package/dist/solana.d.ts +0 -72
- package/dist/solana.js +0 -15
- package/dist/solanaWire.d.ts +0 -3
- package/dist/solanaWire.js +0 -84
- package/dist/types.d.ts +0 -87
- package/dist/types.js +0 -41
- package/dist/wallet/ethereum.d.ts +0 -47
- package/dist/wallet/ethereum.js +0 -2
- package/dist/wallet/index.d.ts +0 -1
- package/dist/wallet/index.js +0 -37
- package/esm/actions/AddMiniApp.d.ts +0 -36
- package/esm/actions/AddMiniApp.js +0 -19
- package/esm/actions/ComposeCast.d.ts +0 -37
- package/esm/actions/ComposeCast.js +0 -1
- package/esm/actions/Haptics.d.ts +0 -5
- package/esm/actions/Haptics.js +0 -1
- package/esm/actions/Ready.d.ts +0 -13
- package/esm/actions/Ready.js +0 -3
- package/esm/actions/SendToken.d.ts +0 -48
- package/esm/actions/SendToken.js +0 -1
- package/esm/actions/SignIn.d.ts +0 -55
- package/esm/actions/SignIn.js +0 -10
- package/esm/actions/SwapToken.d.ts +0 -46
- package/esm/actions/SwapToken.js +0 -1
- package/esm/actions/ViewCast.d.ts +0 -25
- package/esm/actions/ViewCast.js +0 -1
- package/esm/actions/ViewProfile.d.ts +0 -4
- package/esm/actions/ViewProfile.js +0 -1
- package/esm/actions/ViewToken.d.ts +0 -4
- package/esm/actions/ViewToken.js +0 -1
- package/esm/actions/index.d.ts +0 -10
- package/esm/actions/index.js +0 -10
- package/esm/back.d.ts +0 -13
- package/esm/back.js +0 -3
- package/esm/context.d.ts +0 -94
- package/esm/context.js +0 -1
- package/esm/errors.d.ts +0 -13
- package/esm/errors.js +0 -8
- package/esm/internal/types.d.ts +0 -8
- package/esm/internal/types.js +0 -1
- package/esm/manifest.d.ts +0 -107
- package/esm/manifest.js +0 -1
- package/esm/schemas/embeds.d.ts +0 -243
- package/esm/schemas/embeds.js +0 -28
- package/esm/schemas/events.d.ts +0 -131
- package/esm/schemas/events.js +0 -22
- package/esm/schemas/index.d.ts +0 -5
- package/esm/schemas/index.js +0 -5
- package/esm/schemas/manifest.d.ts +0 -348
- package/esm/schemas/manifest.js +0 -111
- package/esm/schemas/notifications.d.ts +0 -60
- package/esm/schemas/notifications.js +0 -20
- package/esm/schemas/shared.d.ts +0 -40
- package/esm/schemas/shared.js +0 -79
- package/esm/solana.d.ts +0 -72
- package/esm/solana.js +0 -11
- package/esm/solanaWire.d.ts +0 -3
- package/esm/solanaWire.js +0 -80
- package/esm/types.d.ts +0 -87
- package/esm/types.js +0 -23
- package/esm/wallet/ethereum.d.ts +0 -47
- package/esm/wallet/ethereum.js +0 -1
- package/esm/wallet/index.d.ts +0 -1
- package/esm/wallet/index.js +0 -1
- package/src/actions/AddMiniApp.ts +0 -51
- package/src/actions/ComposeCast.ts +0 -44
- package/src/actions/Haptics.ts +0 -9
- package/src/actions/Ready.ts +0 -15
- package/src/actions/SendToken.ts +0 -57
- package/src/actions/SignIn.ts +0 -67
- package/src/actions/SwapToken.ts +0 -54
- package/src/actions/ViewCast.ts +0 -27
- package/src/actions/ViewProfile.ts +0 -5
- package/src/actions/ViewToken.ts +0 -5
- package/src/actions/index.ts +0 -10
- package/src/back.ts +0 -15
- package/src/context.ts +0 -117
- package/src/errors.ts +0 -21
- package/src/internal/types.ts +0 -20
- package/src/manifest.ts +0 -120
- package/src/schemas/embeds.ts +0 -44
- package/src/schemas/events.ts +0 -41
- package/src/schemas/index.ts +0 -5
- package/src/schemas/manifest.ts +0 -125
- package/src/schemas/notifications.ts +0 -33
- package/src/schemas/shared.ts +0 -109
- package/src/solana.ts +0 -108
- package/src/solanaWire.ts +0 -120
- package/src/types.ts +0 -155
- package/src/wallet/ethereum.ts +0 -65
- package/src/wallet/index.ts +0 -1
package/src/index.ts
CHANGED
|
@@ -1,10 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export * from '
|
|
1
|
+
// Deprecation warning
|
|
2
|
+
if (typeof console !== 'undefined' && console.warn) {
|
|
3
|
+
console.warn(
|
|
4
|
+
'[DEPRECATION WARNING] @farcaster/frame-core is deprecated. Please migrate to @farcaster/miniapp-core. ' +
|
|
5
|
+
'See https://github.com/farcasterxyz/frames/blob/main/MIGRATION.md for migration guide.',
|
|
6
|
+
)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Re-export everything from miniapp-core
|
|
10
|
+
export * from '@farcaster/miniapp-core'
|
|
11
|
+
|
|
12
|
+
// Import types for aliasing
|
|
13
|
+
import {
|
|
14
|
+
type EventFrameAddRejected as _EventFrameAddRejected,
|
|
15
|
+
type EventFrameAdded as _EventFrameAdded,
|
|
16
|
+
type EventFrameRemoved as _EventFrameRemoved,
|
|
17
|
+
type MiniAppClientEvent as _MiniAppClientEvent,
|
|
18
|
+
type MiniAppEmbedNext as _MiniAppEmbedNext,
|
|
19
|
+
type MiniAppHost as _MiniAppHost,
|
|
20
|
+
type MiniAppNotificationDetails as _MiniAppNotificationDetails,
|
|
21
|
+
type MiniAppServerEvent as _MiniAppServerEvent,
|
|
22
|
+
type WireMiniAppHost as _WireMiniAppHost,
|
|
23
|
+
actionLaunchFrameSchema as _actionLaunchFrameSchema,
|
|
24
|
+
domainMiniAppConfigSchema as _domainMiniAppConfigSchema,
|
|
25
|
+
eventFrameAddedSchema as _eventFrameAddedSchema,
|
|
26
|
+
eventFrameRemovedSchema as _eventFrameRemovedSchema,
|
|
27
|
+
miniAppEmbedNextSchema as _miniAppEmbedNextSchema,
|
|
28
|
+
miniAppNameSchema as _miniAppNameSchema,
|
|
29
|
+
safeParseMiniAppEmbed as _safeParseMiniAppEmbed,
|
|
30
|
+
} from '@farcaster/miniapp-core'
|
|
31
|
+
|
|
32
|
+
// Backward compatibility type aliases
|
|
33
|
+
export type FrameHost = _MiniAppHost
|
|
34
|
+
export type WireFrameHost = _WireMiniAppHost
|
|
35
|
+
export type FrameClientEvent = _MiniAppClientEvent
|
|
36
|
+
export type FrameServerEvent = _MiniAppServerEvent
|
|
37
|
+
export type EventFrameAdded = _EventFrameAdded
|
|
38
|
+
export type EventFrameRemoved = _EventFrameRemoved
|
|
39
|
+
export type EventFrameAddRejected = _EventFrameAddRejected
|
|
40
|
+
export type FrameNotificationDetails = _MiniAppNotificationDetails
|
|
41
|
+
export type FrameEmbedNext = _MiniAppEmbedNext
|
|
42
|
+
|
|
43
|
+
// Backward compatibility schema aliases
|
|
44
|
+
export const frameNameSchema = _miniAppNameSchema
|
|
45
|
+
export const eventFrameAddedSchema = _eventFrameAddedSchema
|
|
46
|
+
export const eventFrameRemovedSchema = _eventFrameRemovedSchema
|
|
47
|
+
export const domainFrameConfigSchema = _domainMiniAppConfigSchema
|
|
48
|
+
export const frameEmbedNextSchema = _miniAppEmbedNextSchema
|
|
49
|
+
export const safeParseFrameEmbed = _safeParseMiniAppEmbed
|
|
50
|
+
export const actionLaunchFrameSchema = _actionLaunchFrameSchema
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as Errors from '../errors.ts';
|
|
2
|
-
import type { OneOf } from '../internal/types.ts';
|
|
3
|
-
import type { FrameNotificationDetails } from '../schemas/index.ts';
|
|
4
|
-
export type AddMiniAppResult = {
|
|
5
|
-
notificationDetails?: FrameNotificationDetails;
|
|
6
|
-
};
|
|
7
|
-
export type AddMiniApp = () => Promise<AddMiniAppResult>;
|
|
8
|
-
type InvalidDomainManifestJsonError = {
|
|
9
|
-
type: 'invalid_domain_manifest';
|
|
10
|
-
};
|
|
11
|
-
type RejectedByUserJsonError = {
|
|
12
|
-
type: 'rejected_by_user';
|
|
13
|
-
};
|
|
14
|
-
export type AddMiniAppJsonError = InvalidDomainManifestJsonError | RejectedByUserJsonError;
|
|
15
|
-
export type AddMiniAppRejectedReason = AddMiniAppJsonError['type'];
|
|
16
|
-
export type AddMiniAppJsonResult = OneOf<{
|
|
17
|
-
result: AddMiniAppResult;
|
|
18
|
-
} | {
|
|
19
|
-
error: AddMiniAppJsonError;
|
|
20
|
-
}>;
|
|
21
|
-
export type WireAddMiniApp = () => Promise<AddMiniAppJsonResult>;
|
|
22
|
-
/**
|
|
23
|
-
* Thrown when the frame does not have a valid domain manifest.
|
|
24
|
-
*/
|
|
25
|
-
export declare class InvalidDomainManifest extends Errors.BaseError {
|
|
26
|
-
readonly name = "AddMiniApp.InvalidDomainManifest";
|
|
27
|
-
constructor();
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Thrown when add frame action was rejected by the user.
|
|
31
|
-
*/
|
|
32
|
-
export declare class RejectedByUser extends Errors.BaseError {
|
|
33
|
-
readonly name = "AddMiniApp.RejectedByUser";
|
|
34
|
-
constructor();
|
|
35
|
-
}
|
|
36
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
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 __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.RejectedByUser = exports.InvalidDomainManifest = void 0;
|
|
37
|
-
const Errors = __importStar(require("../errors.js"));
|
|
38
|
-
/**
|
|
39
|
-
* Thrown when the frame does not have a valid domain manifest.
|
|
40
|
-
*/
|
|
41
|
-
class InvalidDomainManifest extends Errors.BaseError {
|
|
42
|
-
name = 'AddMiniApp.InvalidDomainManifest';
|
|
43
|
-
constructor() {
|
|
44
|
-
super('Invalid domain manifest');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.InvalidDomainManifest = InvalidDomainManifest;
|
|
48
|
-
/**
|
|
49
|
-
* Thrown when add frame action was rejected by the user.
|
|
50
|
-
*/
|
|
51
|
-
class RejectedByUser extends Errors.BaseError {
|
|
52
|
-
name = 'AddMiniApp.RejectedByUser';
|
|
53
|
-
constructor() {
|
|
54
|
-
super('Add frame rejected by user');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.RejectedByUser = RejectedByUser;
|
|
@@ -1,37 +0,0 @@
|
|
|
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-writable 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
|
-
/** Whether the cast should be posted to a channel. */
|
|
18
|
-
channelKey?: string;
|
|
19
|
-
};
|
|
20
|
-
export type ComposeCastInnerResult = {
|
|
21
|
-
/** Cast of the created cast */
|
|
22
|
-
hash: string;
|
|
23
|
-
/** Text of the created cast */
|
|
24
|
-
text?: string;
|
|
25
|
-
/** Embeds of the created cast */
|
|
26
|
-
embeds?: [] | [string] | [string, string];
|
|
27
|
-
/** Parent of the created cast */
|
|
28
|
-
parent?: {
|
|
29
|
-
type: 'cast';
|
|
30
|
-
hash: string;
|
|
31
|
-
};
|
|
32
|
-
/** Channel key of the created cast */
|
|
33
|
-
channelKey?: string;
|
|
34
|
-
};
|
|
35
|
-
export type Result<close extends boolean | undefined = undefined> = close extends true ? undefined : {
|
|
36
|
-
cast: ComposeCastInnerResult | null;
|
|
37
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type ImpactOccurredType = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
|
|
2
|
-
export type NotificationOccurredType = 'success' | 'warning' | 'error';
|
|
3
|
-
export type ImpactOccurred = (type: ImpactOccurredType) => Promise<void>;
|
|
4
|
-
export type NotificationOccurred = (type: NotificationOccurredType) => Promise<void>;
|
|
5
|
-
export type SelectionChanged = () => Promise<void>;
|
package/dist/actions/Haptics.js
DELETED
package/dist/actions/Ready.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type ReadyOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* Disable native gestures. Use this option if your frame uses gestures
|
|
4
|
-
* that conflict with native gestures.
|
|
5
|
-
*
|
|
6
|
-
* @defaultValue false
|
|
7
|
-
*/
|
|
8
|
-
disableNativeGestures: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare const DEFAULT_READY_OPTIONS: {
|
|
11
|
-
disableNativeGestures: false;
|
|
12
|
-
};
|
|
13
|
-
export type Ready = (options?: Partial<ReadyOptions>) => void;
|
package/dist/actions/Ready.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export type SendTokenOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* CAIP-19 asset ID
|
|
4
|
-
* For example, Base USDC:
|
|
5
|
-
* eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
6
|
-
*/
|
|
7
|
-
token?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Token amount, as numeric string.
|
|
10
|
-
* For example, 10 USDC: 1000000
|
|
11
|
-
*/
|
|
12
|
-
amount?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Recipient address.
|
|
15
|
-
*/
|
|
16
|
-
recipientAddress?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Recipient fid.
|
|
19
|
-
*/
|
|
20
|
-
recipientFid?: number;
|
|
21
|
-
};
|
|
22
|
-
type SendTokenDetails = {
|
|
23
|
-
/**
|
|
24
|
-
* Tx identifier.
|
|
25
|
-
*/
|
|
26
|
-
transaction: `0x${string}`;
|
|
27
|
-
};
|
|
28
|
-
type SendTokenErrorDetails = {
|
|
29
|
-
/**
|
|
30
|
-
* Error code.
|
|
31
|
-
*/
|
|
32
|
-
error: string;
|
|
33
|
-
/**
|
|
34
|
-
* Error message.
|
|
35
|
-
*/
|
|
36
|
-
message?: string;
|
|
37
|
-
};
|
|
38
|
-
export type SendTokenErrorReason = 'rejected_by_user' | 'send_failed';
|
|
39
|
-
export type SendTokenResult = {
|
|
40
|
-
success: true;
|
|
41
|
-
send: SendTokenDetails;
|
|
42
|
-
} | {
|
|
43
|
-
success: false;
|
|
44
|
-
reason: SendTokenErrorReason;
|
|
45
|
-
error?: SendTokenErrorDetails;
|
|
46
|
-
};
|
|
47
|
-
export type SendToken = (options: SendTokenOptions) => Promise<SendTokenResult>;
|
|
48
|
-
export {};
|
package/dist/actions/SignIn.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as Errors from '../errors.ts';
|
|
2
|
-
import type { OneOf } from '../internal/types.ts';
|
|
3
|
-
export type SignInOptions = {
|
|
4
|
-
/**
|
|
5
|
-
* A random string used to prevent replay attacks.
|
|
6
|
-
*/
|
|
7
|
-
nonce: string;
|
|
8
|
-
/**
|
|
9
|
-
* Start time at which the signature becomes valid.
|
|
10
|
-
* ISO 8601 datetime.
|
|
11
|
-
*/
|
|
12
|
-
notBefore?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Expiration time at which the signature is no longer valid.
|
|
15
|
-
* ISO 8601 datetime.
|
|
16
|
-
*/
|
|
17
|
-
expirationTime?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Whether an [Auth
|
|
20
|
-
* Address](https://github.com/farcasterxyz/protocol/discussions/225) signed
|
|
21
|
-
* message is acceptable. Defaults to `false` to maintain backwards
|
|
22
|
-
* compatibility, though applications should set this to `true` for the best
|
|
23
|
-
* user experience assuming their verification method supports it.
|
|
24
|
-
*
|
|
25
|
-
* @default false
|
|
26
|
-
*/
|
|
27
|
-
acceptAuthAddress?: boolean;
|
|
28
|
-
};
|
|
29
|
-
export type SignInResult = {
|
|
30
|
-
signature: string;
|
|
31
|
-
message: string;
|
|
32
|
-
/**
|
|
33
|
-
* Indicates if the signature was produced by a custody or auth address.
|
|
34
|
-
*/
|
|
35
|
-
authMethod: 'custody' | 'authAddress';
|
|
36
|
-
};
|
|
37
|
-
export type SignIn = (options: SignInOptions) => Promise<SignInResult>;
|
|
38
|
-
type RejectedByUserJsonError = {
|
|
39
|
-
type: 'rejected_by_user';
|
|
40
|
-
};
|
|
41
|
-
export type SignInJsonError = RejectedByUserJsonError;
|
|
42
|
-
export type SignInJsonResult = OneOf<{
|
|
43
|
-
result: SignInResult;
|
|
44
|
-
} | {
|
|
45
|
-
error: SignInJsonError;
|
|
46
|
-
}>;
|
|
47
|
-
export type WireSignIn = (options: SignInOptions) => Promise<SignInJsonResult>;
|
|
48
|
-
/**
|
|
49
|
-
* Thrown when a sign in action was rejected.
|
|
50
|
-
*/
|
|
51
|
-
export declare class RejectedByUser extends Errors.BaseError {
|
|
52
|
-
readonly name = "SignIn.RejectedByUser";
|
|
53
|
-
constructor();
|
|
54
|
-
}
|
|
55
|
-
export {};
|
package/dist/actions/SignIn.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
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 __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.RejectedByUser = void 0;
|
|
37
|
-
const Errors = __importStar(require("../errors.js"));
|
|
38
|
-
/**
|
|
39
|
-
* Thrown when a sign in action was rejected.
|
|
40
|
-
*/
|
|
41
|
-
class RejectedByUser extends Errors.BaseError {
|
|
42
|
-
name = 'SignIn.RejectedByUser';
|
|
43
|
-
constructor() {
|
|
44
|
-
super('Sign in rejected by user');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.RejectedByUser = RejectedByUser;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export type SwapTokenOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* CAIP-19 asset ID
|
|
4
|
-
* For example, Base USDC:
|
|
5
|
-
* eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
6
|
-
*/
|
|
7
|
-
sellToken?: string;
|
|
8
|
-
/**
|
|
9
|
-
* CAIP-19 token ID. For example, OP ETH:
|
|
10
|
-
* eip155:10/native
|
|
11
|
-
*/
|
|
12
|
-
buyToken?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Sell token amount, as numeric string.
|
|
15
|
-
* For example, 1 USDC: 1000000
|
|
16
|
-
*/
|
|
17
|
-
sellAmount?: string;
|
|
18
|
-
};
|
|
19
|
-
type SwapTokenDetails = {
|
|
20
|
-
/**
|
|
21
|
-
* Array of tx identifiers in order of execution.
|
|
22
|
-
* Some swaps will have both an approval and swap tx.
|
|
23
|
-
*/
|
|
24
|
-
transactions: `0x${string}`[];
|
|
25
|
-
};
|
|
26
|
-
type SwapTokenErrorDetails = {
|
|
27
|
-
/**
|
|
28
|
-
* Error code.
|
|
29
|
-
*/
|
|
30
|
-
error: string;
|
|
31
|
-
/**
|
|
32
|
-
* Error message.
|
|
33
|
-
*/
|
|
34
|
-
message?: string;
|
|
35
|
-
};
|
|
36
|
-
export type SwapErrorReason = 'rejected_by_user' | 'swap_failed';
|
|
37
|
-
export type SwapTokenResult = {
|
|
38
|
-
success: true;
|
|
39
|
-
swap: SwapTokenDetails;
|
|
40
|
-
} | {
|
|
41
|
-
success: false;
|
|
42
|
-
reason: SwapErrorReason;
|
|
43
|
-
error?: SwapTokenErrorDetails;
|
|
44
|
-
};
|
|
45
|
-
export type SwapToken = (options: SwapTokenOptions) => Promise<SwapTokenResult>;
|
|
46
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type ViewCastOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* The hash of the cast to view.
|
|
4
|
-
* @example "0x6a112e2d35e2d2008e25dd29811e8769d1edd9ca"
|
|
5
|
-
*/
|
|
6
|
-
hash: string;
|
|
7
|
-
/**
|
|
8
|
-
* Whether the app should be closed when this action is called.
|
|
9
|
-
* If true, the app will be closed after opening the cast view.
|
|
10
|
-
*/
|
|
11
|
-
close?: boolean;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Opens a cast view in the Farcaster client.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* await sdk.actions.viewCast({
|
|
19
|
-
* hash: "0x6a112e2d35e2d2008e25dd29811e8769d1edd9ca"
|
|
20
|
-
* })
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @see {@link https://miniapps.farcaster.xyz/docs/sdk/actions/view-cast | View Cast Documentation}
|
|
24
|
-
*/
|
|
25
|
-
export type ViewCast = (options: ViewCastOptions) => Promise<void>;
|
package/dist/actions/ViewCast.js
DELETED
package/dist/actions/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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/dist/actions/index.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
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 __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ViewToken = exports.ViewProfile = exports.ViewCast = exports.SwapToken = exports.SendToken = exports.SignIn = exports.Ready = exports.Haptics = exports.ComposeCast = exports.AddMiniApp = void 0;
|
|
37
|
-
exports.AddMiniApp = __importStar(require("./AddMiniApp.js"));
|
|
38
|
-
exports.ComposeCast = __importStar(require("./ComposeCast.js"));
|
|
39
|
-
exports.Haptics = __importStar(require("./Haptics.js"));
|
|
40
|
-
exports.Ready = __importStar(require("./Ready.js"));
|
|
41
|
-
exports.SignIn = __importStar(require("./SignIn.js"));
|
|
42
|
-
exports.SendToken = __importStar(require("./SendToken.js"));
|
|
43
|
-
exports.SwapToken = __importStar(require("./SwapToken.js"));
|
|
44
|
-
exports.ViewCast = __importStar(require("./ViewCast.js"));
|
|
45
|
-
exports.ViewProfile = __importStar(require("./ViewProfile.js"));
|
|
46
|
-
exports.ViewToken = __importStar(require("./ViewToken.js"));
|
package/dist/back.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type BackState = {
|
|
2
|
-
/**
|
|
3
|
-
* Is the back control visible. Note that on mobile devices Farcaster clients
|
|
4
|
-
* may support a gesture based control rather than button control.
|
|
5
|
-
*
|
|
6
|
-
* @default false
|
|
7
|
-
*/
|
|
8
|
-
visible: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare const DEFAULT_BACK_STATE: {
|
|
11
|
-
visible: false;
|
|
12
|
-
};
|
|
13
|
-
export type UpdateBackState = (state: BackState) => Promise<void>;
|
package/dist/back.js
DELETED
package/dist/context.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import type { FrameNotificationDetails } from './schemas/index.ts';
|
|
2
|
-
export type MiniappUser = {
|
|
3
|
-
fid: number;
|
|
4
|
-
username?: string;
|
|
5
|
-
displayName?: string;
|
|
6
|
-
pfpUrl?: string;
|
|
7
|
-
};
|
|
8
|
-
export interface MiniappCast {
|
|
9
|
-
author: MiniappUser;
|
|
10
|
-
hash: string;
|
|
11
|
-
parentHash?: string;
|
|
12
|
-
parentFid?: number;
|
|
13
|
-
timestamp?: number;
|
|
14
|
-
mentions?: MiniappUser[];
|
|
15
|
-
text: string;
|
|
16
|
-
embeds?: string[];
|
|
17
|
-
channelKey?: string;
|
|
18
|
-
}
|
|
19
|
-
export type CastEmbedLocationContext = {
|
|
20
|
-
type: 'cast_embed';
|
|
21
|
-
embed: string;
|
|
22
|
-
cast: MiniappCast;
|
|
23
|
-
};
|
|
24
|
-
export type CastShareLocationContext = {
|
|
25
|
-
type: 'cast_share';
|
|
26
|
-
cast: MiniappCast;
|
|
27
|
-
};
|
|
28
|
-
export type NotificationLocationContext = {
|
|
29
|
-
type: 'notification';
|
|
30
|
-
notification: {
|
|
31
|
-
notificationId: string;
|
|
32
|
-
title: string;
|
|
33
|
-
body: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export type LauncherLocationContext = {
|
|
37
|
-
type: 'launcher';
|
|
38
|
-
};
|
|
39
|
-
export type ChannelLocationContext = {
|
|
40
|
-
type: 'channel';
|
|
41
|
-
channel: {
|
|
42
|
-
/**
|
|
43
|
-
* Channel key identifier
|
|
44
|
-
*/
|
|
45
|
-
key: string;
|
|
46
|
-
/**
|
|
47
|
-
* Channel name
|
|
48
|
-
*/
|
|
49
|
-
name: string;
|
|
50
|
-
/**
|
|
51
|
-
* Channel profile image URL
|
|
52
|
-
*/
|
|
53
|
-
imageUrl?: string;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export type LocationContext = CastEmbedLocationContext | CastShareLocationContext | NotificationLocationContext | LauncherLocationContext | ChannelLocationContext;
|
|
57
|
-
export type AccountLocation = {
|
|
58
|
-
placeId: string;
|
|
59
|
-
/**
|
|
60
|
-
* Human-readable string describing the location
|
|
61
|
-
*/
|
|
62
|
-
description: string;
|
|
63
|
-
};
|
|
64
|
-
export type UserContext = {
|
|
65
|
-
fid: number;
|
|
66
|
-
username?: string;
|
|
67
|
-
displayName?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Profile image URL
|
|
70
|
-
*/
|
|
71
|
-
pfpUrl?: string;
|
|
72
|
-
location?: AccountLocation;
|
|
73
|
-
};
|
|
74
|
-
export type SafeAreaInsets = {
|
|
75
|
-
top: number;
|
|
76
|
-
bottom: number;
|
|
77
|
-
left: number;
|
|
78
|
-
right: number;
|
|
79
|
-
};
|
|
80
|
-
export type ClientContext = {
|
|
81
|
-
clientFid: number;
|
|
82
|
-
added: boolean;
|
|
83
|
-
notificationDetails?: FrameNotificationDetails;
|
|
84
|
-
safeAreaInsets?: SafeAreaInsets;
|
|
85
|
-
};
|
|
86
|
-
export type ClientFeatures = {
|
|
87
|
-
haptics: boolean;
|
|
88
|
-
};
|
|
89
|
-
export type FrameContext = {
|
|
90
|
-
client: ClientContext;
|
|
91
|
-
user: UserContext;
|
|
92
|
-
location?: LocationContext;
|
|
93
|
-
features?: ClientFeatures;
|
|
94
|
-
};
|
package/dist/context.js
DELETED