@farcaster/frame-core 0.0.0-canary-20250430150627
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/AddFrame.d.ts +36 -0
- package/dist/actions/AddFrame.js +57 -0
- package/dist/actions/ComposeCast.d.ts +32 -0
- package/dist/actions/ComposeCast.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 +41 -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/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 +8 -0
- package/dist/actions/index.js +44 -0
- package/dist/context.d.ts +72 -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 +7 -0
- package/dist/index.js +46 -0
- package/dist/internal/types.d.ts +8 -0
- package/dist/internal/types.js +2 -0
- package/dist/manifest.d.ts +101 -0
- package/dist/manifest.js +2 -0
- package/dist/schemas/embeds.d.ts +243 -0
- package/dist/schemas/embeds.js +32 -0
- package/dist/schemas/events.d.ts +131 -0
- package/dist/schemas/events.js +25 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.js +21 -0
- package/dist/schemas/manifest.d.ts +208 -0
- package/dist/schemas/manifest.js +61 -0
- package/dist/schemas/notifications.d.ts +60 -0
- package/dist/schemas/notifications.js +23 -0
- package/dist/schemas/shared.d.ts +39 -0
- package/dist/schemas/shared.js +58 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.js +21 -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/AddFrame.d.ts +36 -0
- package/esm/actions/AddFrame.js +19 -0
- package/esm/actions/ComposeCast.d.ts +32 -0
- package/esm/actions/ComposeCast.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 +41 -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/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 +8 -0
- package/esm/actions/index.js +8 -0
- package/esm/context.d.ts +72 -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 +7 -0
- package/esm/index.js +7 -0
- package/esm/internal/types.d.ts +8 -0
- package/esm/internal/types.js +1 -0
- package/esm/manifest.d.ts +101 -0
- package/esm/manifest.js +1 -0
- package/esm/schemas/embeds.d.ts +243 -0
- package/esm/schemas/embeds.js +28 -0
- package/esm/schemas/events.d.ts +131 -0
- package/esm/schemas/events.js +22 -0
- package/esm/schemas/index.d.ts +5 -0
- package/esm/schemas/index.js +5 -0
- package/esm/schemas/manifest.d.ts +208 -0
- package/esm/schemas/manifest.js +58 -0
- package/esm/schemas/notifications.d.ts +60 -0
- package/esm/schemas/notifications.js +20 -0
- package/esm/schemas/shared.d.ts +39 -0
- package/esm/schemas/shared.js +54 -0
- package/esm/tsconfig.tsbuildinfo +1 -0
- package/esm/types.d.ts +60 -0
- package/esm/types.js +3 -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 +41 -0
- package/src/actions/AddFrame.ts +51 -0
- package/src/actions/ComposeCast.ts +36 -0
- package/src/actions/Ready.ts +15 -0
- package/src/actions/SendToken.ts +57 -0
- package/src/actions/SignIn.ts +51 -0
- package/src/actions/SwapToken.ts +54 -0
- package/src/actions/ViewProfile.ts +5 -0
- package/src/actions/ViewToken.ts +5 -0
- package/src/actions/index.ts +8 -0
- package/src/context.ts +90 -0
- package/src/errors.ts +21 -0
- package/src/index.ts +7 -0
- package/src/internal/types.ts +20 -0
- package/src/manifest.ts +113 -0
- package/src/schemas/embeds.ts +44 -0
- package/src/schemas/events.ts +41 -0
- package/src/schemas/index.ts +5 -0
- package/src/schemas/manifest.ts +68 -0
- package/src/schemas/notifications.ts +33 -0
- package/src/schemas/shared.ts +81 -0
- package/src/types.ts +95 -0
- package/src/wallet/ethereum.ts +65 -0
- package/src/wallet/index.ts +1 -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,36 @@
|
|
|
1
|
+
import * as Errors from '../errors';
|
|
2
|
+
import type { OneOf } from '../internal/types';
|
|
3
|
+
import type { FrameNotificationDetails } from '../schemas';
|
|
4
|
+
export type AddFrameResult = {
|
|
5
|
+
notificationDetails?: FrameNotificationDetails;
|
|
6
|
+
};
|
|
7
|
+
export type AddFrame = () => Promise<AddFrameResult>;
|
|
8
|
+
type InvalidDomainManifestJsonError = {
|
|
9
|
+
type: 'invalid_domain_manifest';
|
|
10
|
+
};
|
|
11
|
+
type RejectedByUserJsonError = {
|
|
12
|
+
type: 'rejected_by_user';
|
|
13
|
+
};
|
|
14
|
+
export type AddFrameJsonError = InvalidDomainManifestJsonError | RejectedByUserJsonError;
|
|
15
|
+
export type AddFrameRejectedReason = AddFrameJsonError['type'];
|
|
16
|
+
export type AddFrameJsonResult = OneOf<{
|
|
17
|
+
result: AddFrameResult;
|
|
18
|
+
} | {
|
|
19
|
+
error: AddFrameJsonError;
|
|
20
|
+
}>;
|
|
21
|
+
export type WireAddFrame = () => Promise<AddFrameJsonResult>;
|
|
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 = "AddFrame.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 = "AddFrame.RejectedByUser";
|
|
34
|
+
constructor();
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
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"));
|
|
38
|
+
/**
|
|
39
|
+
* Thrown when the frame does not have a valid domain manifest.
|
|
40
|
+
*/
|
|
41
|
+
class InvalidDomainManifest extends Errors.BaseError {
|
|
42
|
+
name = 'AddFrame.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 = 'AddFrame.RejectedByUser';
|
|
53
|
+
constructor() {
|
|
54
|
+
super('Add frame rejected by user');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.RejectedByUser = RejectedByUser;
|
|
@@ -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,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as Errors from '../errors';
|
|
2
|
+
import type { OneOf } from '../internal/types';
|
|
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
|
+
export type SignInResult = {
|
|
20
|
+
signature: string;
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
export type SignIn = (options: SignInOptions) => Promise<SignInResult>;
|
|
24
|
+
type RejectedByUserJsonError = {
|
|
25
|
+
type: 'rejected_by_user';
|
|
26
|
+
};
|
|
27
|
+
export type SignInJsonError = RejectedByUserJsonError;
|
|
28
|
+
export type SignInJsonResult = OneOf<{
|
|
29
|
+
result: SignInResult;
|
|
30
|
+
} | {
|
|
31
|
+
error: SignInJsonError;
|
|
32
|
+
}>;
|
|
33
|
+
export type WireSignIn = (options: SignInOptions) => Promise<SignInJsonResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Thrown when a sign in action was rejected.
|
|
36
|
+
*/
|
|
37
|
+
export declare class RejectedByUser extends Errors.BaseError {
|
|
38
|
+
readonly name = "SignIn.RejectedByUser";
|
|
39
|
+
constructor();
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
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"));
|
|
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;
|
|
@@ -0,0 +1,46 @@
|
|
|
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, 10 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 {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * as AddFrame from './AddFrame';
|
|
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 ViewProfile from './ViewProfile';
|
|
8
|
+
export * as ViewToken from './ViewToken';
|
|
@@ -0,0 +1,44 @@
|
|
|
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.SwapToken = exports.SendToken = exports.SignIn = exports.Ready = exports.ComposeCast = exports.AddFrame = void 0;
|
|
37
|
+
exports.AddFrame = __importStar(require("./AddFrame"));
|
|
38
|
+
exports.ComposeCast = __importStar(require("./ComposeCast"));
|
|
39
|
+
exports.Ready = __importStar(require("./Ready"));
|
|
40
|
+
exports.SignIn = __importStar(require("./SignIn"));
|
|
41
|
+
exports.SendToken = __importStar(require("./SendToken"));
|
|
42
|
+
exports.SwapToken = __importStar(require("./SwapToken"));
|
|
43
|
+
exports.ViewProfile = __importStar(require("./ViewProfile"));
|
|
44
|
+
exports.ViewToken = __importStar(require("./ViewToken"));
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { FrameNotificationDetails } from './schemas';
|
|
2
|
+
export type CastEmbedLocationContext = {
|
|
3
|
+
type: 'cast_embed';
|
|
4
|
+
embed: string;
|
|
5
|
+
cast: {
|
|
6
|
+
fid: number;
|
|
7
|
+
hash: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type NotificationLocationContext = {
|
|
11
|
+
type: 'notification';
|
|
12
|
+
notification: {
|
|
13
|
+
notificationId: string;
|
|
14
|
+
title: string;
|
|
15
|
+
body: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type LauncherLocationContext = {
|
|
19
|
+
type: 'launcher';
|
|
20
|
+
};
|
|
21
|
+
export type ChannelLocationContext = {
|
|
22
|
+
type: 'channel';
|
|
23
|
+
channel: {
|
|
24
|
+
/**
|
|
25
|
+
* Channel key identifier
|
|
26
|
+
*/
|
|
27
|
+
key: string;
|
|
28
|
+
/**
|
|
29
|
+
* Channel name
|
|
30
|
+
*/
|
|
31
|
+
name: string;
|
|
32
|
+
/**
|
|
33
|
+
* Channel profile image URL
|
|
34
|
+
*/
|
|
35
|
+
imageUrl?: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type LocationContext = CastEmbedLocationContext | NotificationLocationContext | LauncherLocationContext | ChannelLocationContext;
|
|
39
|
+
export type AccountLocation = {
|
|
40
|
+
placeId: string;
|
|
41
|
+
/**
|
|
42
|
+
* Human-readable string describing the location
|
|
43
|
+
*/
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
export type UserContext = {
|
|
47
|
+
fid: number;
|
|
48
|
+
username?: string;
|
|
49
|
+
displayName?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Profile image URL
|
|
52
|
+
*/
|
|
53
|
+
pfpUrl?: string;
|
|
54
|
+
location?: AccountLocation;
|
|
55
|
+
};
|
|
56
|
+
export type SafeAreaInsets = {
|
|
57
|
+
top: number;
|
|
58
|
+
bottom: number;
|
|
59
|
+
left: number;
|
|
60
|
+
right: number;
|
|
61
|
+
};
|
|
62
|
+
export type ClientContext = {
|
|
63
|
+
clientFid: number;
|
|
64
|
+
added: boolean;
|
|
65
|
+
notificationDetails?: FrameNotificationDetails;
|
|
66
|
+
safeAreaInsets?: SafeAreaInsets;
|
|
67
|
+
};
|
|
68
|
+
export type FrameContext = {
|
|
69
|
+
client: ClientContext;
|
|
70
|
+
user: UserContext;
|
|
71
|
+
location?: LocationContext;
|
|
72
|
+
};
|
package/dist/context.js
ADDED
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type GlobalErrorType<name extends string = 'Error'> = Error & {
|
|
2
|
+
name: name;
|
|
3
|
+
};
|
|
4
|
+
export declare class BaseError<cause extends Error | undefined = undefined> extends Error {
|
|
5
|
+
name: string;
|
|
6
|
+
cause: cause;
|
|
7
|
+
constructor(message: string, options?: BaseError.Options<cause>);
|
|
8
|
+
}
|
|
9
|
+
export declare namespace BaseError {
|
|
10
|
+
type Options<cause extends Error | undefined = Error | undefined> = {
|
|
11
|
+
cause?: cause | undefined;
|
|
12
|
+
};
|
|
13
|
+
}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseError = void 0;
|
|
4
|
+
class BaseError extends Error {
|
|
5
|
+
name = 'BaseError';
|
|
6
|
+
cause;
|
|
7
|
+
constructor(message, options = {}) {
|
|
8
|
+
super(message, options.cause ? { cause: options.cause } : undefined);
|
|
9
|
+
this.cause = options.cause;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.BaseError = BaseError;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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 = void 0;
|
|
40
|
+
__exportStar(require("./actions"), exports);
|
|
41
|
+
__exportStar(require("./wallet"), exports);
|
|
42
|
+
exports.Errors = __importStar(require("./errors"));
|
|
43
|
+
exports.Context = __importStar(require("./context"));
|
|
44
|
+
exports.Manifest = __importStar(require("./manifest"));
|
|
45
|
+
__exportStar(require("./types"), exports);
|
|
46
|
+
__exportStar(require("./schemas"), 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 {};
|