-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from xmtp/nm/frames-client
Frames client
- Loading branch information
Showing
12 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"mode": "pre", | ||
"tag": "beta", | ||
"initialVersions": { | ||
"@xmtp/react-app": "0.0.0", | ||
"@xmtp/react-vite-example": "0.0.0", | ||
"eslint-config-xmtp-web": "1.0.0", | ||
"@xmtp/frames-client": "0.0.1", | ||
"@xmtp/react-sdk": "5.0.1", | ||
"@xmtp/tsconfig": "0.0.0" | ||
}, | ||
"changesets": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@xmtp/frames-client": minor | ||
--- | ||
|
||
Initialize Frames Client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ["xmtp-web"], | ||
parserOptions: { | ||
project: "./tsconfig.eslint.json", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# frames-client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
"name": "@xmtp/frames-client", | ||
"packageManager": "[email protected]", | ||
"version": "0.0.1", | ||
"author": "XMTP Labs <[email protected]>", | ||
"license": "MIT", | ||
"type": "module", | ||
"browser": "lib/index.js", | ||
"module": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./lib/index.d.ts", | ||
"default": "./lib/index.js" | ||
} | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"sideEffects": false, | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:xmtp/xmtp-web.git", | ||
"directory": "packages/react-sdk" | ||
}, | ||
"homepage": "https://github.com/xmtp/xmtp-web", | ||
"bugs": { | ||
"url": "https://github.com/xmtp/xmtp-web/issues" | ||
}, | ||
"keywords": [ | ||
"xmtp", | ||
"messaging", | ||
"web3", | ||
"sdk", | ||
"js", | ||
"ts", | ||
"javascript", | ||
"typescript", | ||
"react", | ||
"reactjs", | ||
"react-hooks", | ||
"hooks" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 3 chrome versions", | ||
"last 3 firefox versions", | ||
"last 3 safari versions" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"@xmtp/tsconfig": "workspace:*", | ||
"eslint": "^8.56.0", | ||
"eslint-config-xmtp-web": "workspace:*", | ||
"prettier": "^3.2.4", | ||
"rollup": "^4.9.6", | ||
"rollup-plugin-dts": "^6.1.0", | ||
"rollup-plugin-filesize": "^10.0.0", | ||
"rollup-plugin-tsconfig-paths": "^1.5.2", | ||
"typedoc": "^0.25.7", | ||
"typescript": "^5.3.3", | ||
"vite": "^5.0.12", | ||
"vite-tsconfig-paths": "^4.3.1", | ||
"vitest": "^1.2.1" | ||
}, | ||
"scripts": { | ||
"build": "yarn clean:lib && yarn rollup -c", | ||
"dev": "yarn clean:lib && yarn rollup -c --watch", | ||
"clean:lib": "rm -rf lib", | ||
"clean": "rm -rf .turbo && rm -rf node_modules && yarn clean:lib", | ||
"lint": "eslint . --ignore-path ../../.gitignore", | ||
"format:base": "prettier --ignore-path ../../.gitignore", | ||
"format:check": "yarn format:base -c .", | ||
"format": "yarn format:base -w .", | ||
"test": "vitest run --passWithNoTests", | ||
"typecheck": "tsc", | ||
"typedoc": "typedoc" | ||
}, | ||
"peerDependencies": { | ||
"@xmtp/xmtp-js": "^11.3.7" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { defineConfig } from "rollup"; | ||
import typescript from "@rollup/plugin-typescript"; | ||
import { dts } from "rollup-plugin-dts"; | ||
import tsConfigPaths from "rollup-plugin-tsconfig-paths"; | ||
import terser from "@rollup/plugin-terser"; | ||
import filesize from "rollup-plugin-filesize"; | ||
|
||
export default defineConfig([ | ||
{ | ||
input: "src/index.ts", | ||
output: { | ||
file: "lib/index.js", | ||
format: "es", | ||
sourcemap: true, | ||
}, | ||
plugins: [ | ||
tsConfigPaths(), | ||
typescript({ | ||
declaration: false, | ||
declarationMap: false, | ||
}), | ||
terser(), | ||
filesize({ | ||
showMinifiedSize: false, | ||
}), | ||
], | ||
external: [], | ||
}, | ||
{ | ||
input: "src/index.ts", | ||
output: { | ||
file: "lib/index.d.ts", | ||
format: "es", | ||
}, | ||
plugins: [tsConfigPaths(), dts()], | ||
}, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const OG_PROXY_URL = "https://og-proxy.fly.dev"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { Client } from "@xmtp/xmtp-js"; | ||
import { OG_PROXY_URL } from "./constants"; | ||
import type { FramesResponse } from "./types"; | ||
|
||
export class FramesClient { | ||
xmtpClient: Client; | ||
|
||
constructor(xmtpClient: Client) { | ||
this.xmtpClient = xmtpClient; | ||
} | ||
|
||
static async readMetadata(url: string): Promise<FramesResponse> { | ||
const response = await fetch( | ||
`${OG_PROXY_URL}?url=${encodeURIComponent(url)}`, | ||
); | ||
return (await response.json()) as FramesResponse; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type FramesResponse = { | ||
url: string; | ||
extractedTags: { [k: string]: string }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": [".", ".eslintrc.cjs", "rollup.config.js"], | ||
"exclude": ["lib", "node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "@xmtp/tsconfig/react-sdk.json", | ||
"include": ["src", ".eslintrc.cjs", "vitest.config.ts", "vitest.setup.ts"], | ||
"compilerOptions": { | ||
"paths": { | ||
"@/*": ["./src/*"], | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters