From 605ce64215989432331c069440e5e45de37126dc Mon Sep 17 00:00:00 2001 From: Leonardo Zizzamia Date: Thu, 22 Feb 2024 01:16:04 -0800 Subject: [PATCH] feat: created `frame` module (#172) --- .changeset/orange-rockets-collect.md | 5 +++++ CHANGELOG.md | 4 ++-- package.json | 10 ++++++++++ src/core/index.ts | 10 +++++----- src/frame/{ => components}/FrameMetadata.test.tsx | 0 src/frame/{ => components}/FrameMetadata.tsx | 2 +- src/{core => frame}/getFrameHtmlResponse.test.ts | 0 src/{core => frame}/getFrameHtmlResponse.ts | 0 src/{core => frame}/getFrameMessage.integ.ts | 0 src/{core => frame}/getFrameMessage.test.ts | 0 src/{core => frame}/getFrameMessage.ts | 0 src/{core => frame}/getFrameMetadata.test.ts | 0 src/{core => frame}/getFrameMetadata.ts | 0 src/{core => frame}/getMockFrameRequest.ts | 0 src/{core => frame}/mock.ts | 0 src/{core => frame}/types.ts | 0 src/index.ts | 12 ++++++------ src/utils/neynar/frame/neynarFrameFunctions.ts | 4 +--- src/utils/neynar/frame/neynarFrameModels.ts | 2 +- src/version.ts | 2 +- 20 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 .changeset/orange-rockets-collect.md rename src/frame/{ => components}/FrameMetadata.test.tsx (100%) rename src/frame/{ => components}/FrameMetadata.tsx (98%) rename src/{core => frame}/getFrameHtmlResponse.test.ts (100%) rename src/{core => frame}/getFrameHtmlResponse.ts (100%) rename src/{core => frame}/getFrameMessage.integ.ts (100%) rename src/{core => frame}/getFrameMessage.test.ts (100%) rename src/{core => frame}/getFrameMessage.ts (100%) rename src/{core => frame}/getFrameMetadata.test.ts (100%) rename src/{core => frame}/getFrameMetadata.ts (100%) rename src/{core => frame}/getMockFrameRequest.ts (100%) rename src/{core => frame}/mock.ts (100%) rename src/{core => frame}/types.ts (100%) diff --git a/.changeset/orange-rockets-collect.md b/.changeset/orange-rockets-collect.md new file mode 100644 index 0000000000..f76d9136a1 --- /dev/null +++ b/.changeset/orange-rockets-collect.md @@ -0,0 +1,5 @@ +--- +'@coinbase/onchainkit': patch +--- + +- **feat**: created `frame` module. By @zizzamia #172 diff --git a/CHANGELOG.md b/CHANGELOG.md index c32d7cb4fd..001fb3d96b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,8 @@ ### Minor Changes -- 311b027: - **feat**: prep the identity `identity` module. By @zizzamia #171 - - **feat**: added initial version of `getEASAttestations`, which helps getting the user attestations from the Ethereum Attetation Service (EAS). By @alvaroraminelli #126 +- **feat**: prep the identity `identity` module. By @zizzamia #171 311b027 +- **feat**: added initial version of `getEASAttestations`, which helps getting the user attestations from the Ethereum Attetation Service (EAS). By @alvaroraminelli #126 ## 0.8.2 diff --git a/package.json b/package.json index cbf94b1f7f..23c7a5a729 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,16 @@ }, "default": "./lib/farcaster/index.js" }, + "./frame": { + "types": "./lib/frame/index.d.ts", + "browser": { + "types": "./esm/frame/index.d.ts", + "module": "./esm/frame/index.js", + "import": "./esm/frame/index.js", + "default": "./lib/frame/index.js" + }, + "default": "./lib/frame/index.js" + }, "./identity": { "types": "./lib/identity/index.d.ts", "browser": { diff --git a/src/core/index.ts b/src/core/index.ts index c27b1b66b8..a9d69c7072 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,10 +1,10 @@ // 🌲☀️🌲 // This file is the entry point for the core utilities // that have no dependencies on external libraries. -export { getFrameHtmlResponse } from './getFrameHtmlResponse'; -export { getFrameMetadata } from './getFrameMetadata'; -export { getFrameMessage } from './getFrameMessage'; -export { getMockFrameRequest } from './getMockFrameRequest'; +export { getFrameHtmlResponse } from '../frame/getFrameHtmlResponse'; +export { getFrameMetadata } from '../frame/getFrameMetadata'; +export { getFrameMessage } from '../frame/getFrameMessage'; +export { getMockFrameRequest } from '../frame/getMockFrameRequest'; export type { FrameButtonMetadata, FrameImageMetadata, @@ -15,4 +15,4 @@ export type { FrameValidationData, MockFrameRequest, MockFrameRequestOptions, -} from './types'; +} from '../frame/types'; diff --git a/src/frame/FrameMetadata.test.tsx b/src/frame/components/FrameMetadata.test.tsx similarity index 100% rename from src/frame/FrameMetadata.test.tsx rename to src/frame/components/FrameMetadata.test.tsx diff --git a/src/frame/FrameMetadata.tsx b/src/frame/components/FrameMetadata.tsx similarity index 98% rename from src/frame/FrameMetadata.tsx rename to src/frame/components/FrameMetadata.tsx index 4c7229fd6a..c0ebb5aef5 100644 --- a/src/frame/FrameMetadata.tsx +++ b/src/frame/components/FrameMetadata.tsx @@ -1,5 +1,5 @@ import { Fragment } from 'react'; -import type { FrameMetadataReact } from '../core/types'; +import type { FrameMetadataReact } from '../types'; /** * FrameMetadata component diff --git a/src/core/getFrameHtmlResponse.test.ts b/src/frame/getFrameHtmlResponse.test.ts similarity index 100% rename from src/core/getFrameHtmlResponse.test.ts rename to src/frame/getFrameHtmlResponse.test.ts diff --git a/src/core/getFrameHtmlResponse.ts b/src/frame/getFrameHtmlResponse.ts similarity index 100% rename from src/core/getFrameHtmlResponse.ts rename to src/frame/getFrameHtmlResponse.ts diff --git a/src/core/getFrameMessage.integ.ts b/src/frame/getFrameMessage.integ.ts similarity index 100% rename from src/core/getFrameMessage.integ.ts rename to src/frame/getFrameMessage.integ.ts diff --git a/src/core/getFrameMessage.test.ts b/src/frame/getFrameMessage.test.ts similarity index 100% rename from src/core/getFrameMessage.test.ts rename to src/frame/getFrameMessage.test.ts diff --git a/src/core/getFrameMessage.ts b/src/frame/getFrameMessage.ts similarity index 100% rename from src/core/getFrameMessage.ts rename to src/frame/getFrameMessage.ts diff --git a/src/core/getFrameMetadata.test.ts b/src/frame/getFrameMetadata.test.ts similarity index 100% rename from src/core/getFrameMetadata.test.ts rename to src/frame/getFrameMetadata.test.ts diff --git a/src/core/getFrameMetadata.ts b/src/frame/getFrameMetadata.ts similarity index 100% rename from src/core/getFrameMetadata.ts rename to src/frame/getFrameMetadata.ts diff --git a/src/core/getMockFrameRequest.ts b/src/frame/getMockFrameRequest.ts similarity index 100% rename from src/core/getMockFrameRequest.ts rename to src/frame/getMockFrameRequest.ts diff --git a/src/core/mock.ts b/src/frame/mock.ts similarity index 100% rename from src/core/mock.ts rename to src/frame/mock.ts diff --git a/src/core/types.ts b/src/frame/types.ts similarity index 100% rename from src/core/types.ts rename to src/frame/types.ts diff --git a/src/index.ts b/src/index.ts index 607040e4e4..83016b24a7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,10 @@ // 🌲☀️🌲 export { version } from './version'; -export { getFrameHtmlResponse } from './core/getFrameHtmlResponse'; -export { getFrameMetadata } from './core/getFrameMetadata'; -export { getFrameMessage } from './core/getFrameMessage'; -export { getMockFrameRequest } from './core/getMockFrameRequest'; -export { FrameMetadata } from './frame/FrameMetadata'; +export { getFrameHtmlResponse } from './frame/getFrameHtmlResponse'; +export { getFrameMetadata } from './frame/getFrameMetadata'; +export { getFrameMessage } from './frame/getFrameMessage'; +export { getMockFrameRequest } from './frame/getMockFrameRequest'; +export { FrameMetadata } from './frame/components/FrameMetadata'; export { Avatar } from './identity/components/Avatar'; export { Name } from './identity/components/Name'; export { useAvatar } from './identity/hooks/useAvatar'; @@ -19,4 +19,4 @@ export type { FrameValidationData, MockFrameRequest, MockFrameRequestOptions, -} from './core/types'; +} from './frame/types'; diff --git a/src/utils/neynar/frame/neynarFrameFunctions.ts b/src/utils/neynar/frame/neynarFrameFunctions.ts index 26445c6bbd..f0658fe030 100644 --- a/src/utils/neynar/frame/neynarFrameFunctions.ts +++ b/src/utils/neynar/frame/neynarFrameFunctions.ts @@ -1,6 +1,4 @@ -import { version } from '../../../version'; -import { FrameValidationData } from '../../../core/types'; -import { FetchError } from '../exceptions/FetchError'; +import { FrameValidationData } from '../../../frame/types'; import { convertToNeynarResponseModel } from './neynarFrameModels'; import { postDataToNeynar } from '../postDataToNeynar'; diff --git a/src/utils/neynar/frame/neynarFrameModels.ts b/src/utils/neynar/frame/neynarFrameModels.ts index 6093f73c52..d98cc54a02 100644 --- a/src/utils/neynar/frame/neynarFrameModels.ts +++ b/src/utils/neynar/frame/neynarFrameModels.ts @@ -1,4 +1,4 @@ -import { FrameValidationData } from '../../../core/types'; +import { FrameValidationData } from '../../../frame/types'; import { NeynarFrameValidationInternalModel } from './types'; export function convertToNeynarResponseModel(data: any): FrameValidationData | undefined { diff --git a/src/version.ts b/src/version.ts index b7abd0b85d..e38157be4f 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const version = '0.9.0'; +export const version = '0.9.1';