From b147ae57691518f0e3143c669f3b473a5375c3a7 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 16:04:53 -0800 Subject: [PATCH 001/107] Add frames client --- packages/frames-client/.eslintrc.cjs | 7 ++ packages/frames-client/README.md | 1 + packages/frames-client/package.json | 92 +++++++++++++++++++++ packages/frames-client/rollup.config.js | 37 +++++++++ packages/frames-client/src/constants.ts | 1 + packages/frames-client/src/index.ts | 18 ++++ packages/frames-client/src/types.ts | 4 + packages/frames-client/tsconfig.eslint.json | 5 ++ packages/frames-client/tsconfig.json | 9 ++ 9 files changed, 174 insertions(+) create mode 100644 packages/frames-client/.eslintrc.cjs create mode 100644 packages/frames-client/README.md create mode 100644 packages/frames-client/package.json create mode 100644 packages/frames-client/rollup.config.js create mode 100644 packages/frames-client/src/constants.ts create mode 100644 packages/frames-client/src/index.ts create mode 100644 packages/frames-client/src/types.ts create mode 100644 packages/frames-client/tsconfig.eslint.json create mode 100644 packages/frames-client/tsconfig.json diff --git a/packages/frames-client/.eslintrc.cjs b/packages/frames-client/.eslintrc.cjs new file mode 100644 index 000000000..0e3d6a266 --- /dev/null +++ b/packages/frames-client/.eslintrc.cjs @@ -0,0 +1,7 @@ +module.exports = { + root: true, + extends: ["xmtp-web"], + parserOptions: { + project: "./tsconfig.eslint.json", + }, +}; diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md new file mode 100644 index 000000000..cdc25b1a8 --- /dev/null +++ b/packages/frames-client/README.md @@ -0,0 +1 @@ +# frames-client diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json new file mode 100644 index 000000000..577910f20 --- /dev/null +++ b/packages/frames-client/package.json @@ -0,0 +1,92 @@ +{ + "name": "@xmtp/frames-client", + "packageManager": "yarn@4.0.2", + "version": "0.0.1", + "author": "XMTP Labs ", + "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": "git@github.com: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" + } +} diff --git a/packages/frames-client/rollup.config.js b/packages/frames-client/rollup.config.js new file mode 100644 index 000000000..28ff8e438 --- /dev/null +++ b/packages/frames-client/rollup.config.js @@ -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()], + }, +]); diff --git a/packages/frames-client/src/constants.ts b/packages/frames-client/src/constants.ts new file mode 100644 index 000000000..2355a34b1 --- /dev/null +++ b/packages/frames-client/src/constants.ts @@ -0,0 +1 @@ +export const OG_PROXY_URL = "https://og-proxy.fly.dev"; diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts new file mode 100644 index 000000000..5e00d6893 --- /dev/null +++ b/packages/frames-client/src/index.ts @@ -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 { + const response = await fetch( + `${OG_PROXY_URL}?url=${encodeURIComponent(url)}`, + ); + return (await response.json()) as FramesResponse; + } +} diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts new file mode 100644 index 000000000..bf3d7be95 --- /dev/null +++ b/packages/frames-client/src/types.ts @@ -0,0 +1,4 @@ +export type FramesResponse = { + url: string; + extractedTags: { [k: string]: string }; +}; diff --git a/packages/frames-client/tsconfig.eslint.json b/packages/frames-client/tsconfig.eslint.json new file mode 100644 index 000000000..bf165d3f0 --- /dev/null +++ b/packages/frames-client/tsconfig.eslint.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.json", + "include": [".", ".eslintrc.cjs", "rollup.config.js"], + "exclude": ["lib", "node_modules"] +} diff --git a/packages/frames-client/tsconfig.json b/packages/frames-client/tsconfig.json new file mode 100644 index 000000000..56054a9ae --- /dev/null +++ b/packages/frames-client/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@xmtp/tsconfig/react-sdk.json", + "include": ["src", ".eslintrc.cjs", "vitest.config.ts", "vitest.setup.ts"], + "compilerOptions": { + "paths": { + "@/*": ["./src/*"], + }, + }, +} From a87020578f1c548af289279f2375b51d33488643 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 18:08:06 -0800 Subject: [PATCH 002/107] Add signed frame action payloads --- packages/frames-client/package.json | 95 ++++++++++++++++++++++++ packages/frames-client/src/converters.ts | 43 +++++++++++ packages/frames-client/src/crypto.ts | 4 + packages/frames-client/src/index.ts | 80 ++++++++++++++++++++ packages/frames-client/src/types.ts | 22 ++++++ 5 files changed, 244 insertions(+) create mode 100644 packages/frames-client/package.json create mode 100644 packages/frames-client/src/converters.ts create mode 100644 packages/frames-client/src/crypto.ts create mode 100644 packages/frames-client/src/index.ts create mode 100644 packages/frames-client/src/types.ts diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json new file mode 100644 index 000000000..b5a122777 --- /dev/null +++ b/packages/frames-client/package.json @@ -0,0 +1,95 @@ +{ + "name": "@xmtp/frames-client", + "packageManager": "yarn@4.0.2", + "version": "0.0.1", + "author": "XMTP Labs ", + "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": "git@github.com: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": ">9.3.1" + }, + "dependencies": { + "@xmtp/proto": "3.41.0-beta.2" + } +} diff --git a/packages/frames-client/src/converters.ts b/packages/frames-client/src/converters.ts new file mode 100644 index 000000000..6b267ade5 --- /dev/null +++ b/packages/frames-client/src/converters.ts @@ -0,0 +1,43 @@ +import { publicKey, signature } from "@xmtp/proto"; + +function publicKeyBytesToSign(pubKey: publicKey.PublicKey): Uint8Array { + return publicKey.PublicKey.encode({ + timestamp: pubKey.timestamp, + secp256k1Uncompressed: pubKey.secp256k1Uncompressed, + }).finish(); +} + +function toSignedPublicKey( + v1Key: publicKey.PublicKey, + signedByWallet: boolean, +): publicKey.SignedPublicKey { + if (!v1Key.signature) { + throw new Error("Missing signature"); + } + + let v1Signature = v1Key.signature; + if (signedByWallet) { + v1Signature = { + walletEcdsaCompact: v1Signature.ecdsaCompact, + ecdsaCompact: undefined, + }; + } + + return { + keyBytes: publicKeyBytesToSign(v1Key), + signature: v1Signature, + }; +} + +export function v1ToV2Bundle( + v1Bundle: publicKey.PublicKeyBundle, +): publicKey.SignedPublicKeyBundle { + if (!v1Bundle.identityKey || !v1Bundle.preKey) { + throw new Error("Invalid bundle"); + } + + return { + identityKey: toSignedPublicKey(v1Bundle.identityKey, true), + preKey: toSignedPublicKey(v1Bundle.preKey, false), + }; +} diff --git a/packages/frames-client/src/crypto.ts b/packages/frames-client/src/crypto.ts new file mode 100644 index 000000000..b45c2f8f7 --- /dev/null +++ b/packages/frames-client/src/crypto.ts @@ -0,0 +1,4 @@ +export async function sha256(data: Uint8Array): Promise { + const digest = await crypto.subtle.digest("SHA-256", data); + return new Uint8Array(digest); +} diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts new file mode 100644 index 000000000..22b78c893 --- /dev/null +++ b/packages/frames-client/src/index.ts @@ -0,0 +1,80 @@ +import type { Client } from "@xmtp/xmtp-js"; +import { frames, fetcher } from "@xmtp/proto"; +import { OG_PROXY_URL } from "./constants"; +import type { FramePostPayload, FramesApiResponse } from "./types"; +import { sha256 } from "./crypto"; +import { v1ToV2Bundle } from "./converters"; + +const { b64Encode } = fetcher; + +export class FramesClient { + xmtpClient: Client; + + constructor(xmtpClient: Client) { + this.xmtpClient = xmtpClient; + } + + static async readMetadata(url: string): Promise { + const response = await fetch( + `${OG_PROXY_URL}?url=${encodeURIComponent(url)}`, + ); + return (await response.json()) as FramesApiResponse; + } + + async signFrameAction( + frameUrl: string, + buttonIndex: number, + conversationIdentifier: string, + messageId: string, + ): Promise { + const signedAction = await this.buildSignedFrameAction( + frameUrl, + buttonIndex, + conversationIdentifier, + messageId, + ); + + return { + untrustedData: { + walletAddress: this.xmtpClient.address, + url: frameUrl, + messageId, + timestamp: Date.now(), + buttonIndex, + conversationIdentifier, + }, + trustedData: { + messageBytes: b64Encode(signedAction, 0, signedAction.length), + }, + }; + } + + private async buildSignedFrameAction( + frameUrl: string, + buttonIndex: number, + conversationIdentifier: string, + messageId: string, + ) { + const actionBody = frames.FrameActionBody.encode({ + frameUrl: new TextEncoder().encode(frameUrl), + buttonIndex: new TextEncoder().encode(buttonIndex.toString()), + conversationIdentifier, + messageId, + }).finish(); + + const digest = await sha256(actionBody); + const signature = await this.xmtpClient.keystore.signDigest({ + digest, + identityKey: true, + prekeyIndex: undefined, + }); + + const publicKeyBundle = await this.xmtpClient.keystore.getPublicKeyBundle(); + + return frames.FrameAction.encode({ + actionBody, + signature, + signedPublicKeyBundle: v1ToV2Bundle(publicKeyBundle), + }).finish(); + } +} diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts new file mode 100644 index 000000000..46c3b2559 --- /dev/null +++ b/packages/frames-client/src/types.ts @@ -0,0 +1,22 @@ +export type FramesApiResponse = { + url: string; + extractedTags: { [k: string]: string }; +}; + +export type FramePostUntrustedData = { + walletAddress: string; + url: string; + messageId: string; + timestamp: number; + buttonIndex: number; + conversationIdentifier: string; +}; + +export type FramePostTrustedData = { + messageBytes: string; +}; + +export type FramePostPayload = { + untrustedData: FramePostUntrustedData; + trustedData: FramePostTrustedData; +}; From 7f16c454d30e49bf1028e498e0fba098fe779fa2 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 18:15:55 -0800 Subject: [PATCH 003/107] Lint --- packages/frames-client/src/converters.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-client/src/converters.ts b/packages/frames-client/src/converters.ts index 6b267ade5..5266dae53 100644 --- a/packages/frames-client/src/converters.ts +++ b/packages/frames-client/src/converters.ts @@ -1,4 +1,4 @@ -import { publicKey, signature } from "@xmtp/proto"; +import { publicKey } from "@xmtp/proto"; function publicKeyBytesToSign(pubKey: publicKey.PublicKey): Uint8Array { return publicKey.PublicKey.encode({ From 1389a0be850300adbfc9824314ebb57cbfd12099 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Jan 2024 02:27:23 +0000 Subject: [PATCH 004/107] release: version packages --- packages/frames-client/CHANGELOG.md | 8 ++++++++ packages/frames-client/package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 packages/frames-client/CHANGELOG.md diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md new file mode 100644 index 000000000..13de7ef0d --- /dev/null +++ b/packages/frames-client/CHANGELOG.md @@ -0,0 +1,8 @@ +# @xmtp/frames-client + +## 0.1.0 + +### Minor Changes + +- a04afac: Add support for preparing signed payloads for the Frames API +- 502c402: Initialize Frames Client diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index b5a122777..04e338271 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,7 +1,7 @@ { "name": "@xmtp/frames-client", "packageManager": "yarn@4.0.2", - "version": "0.0.1", + "version": "0.1.0", "author": "XMTP Labs ", "license": "MIT", "type": "module", From 54e90b8384782266bc1efb2c9a120ec642f7c98e Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 18:36:45 -0800 Subject: [PATCH 005/107] Scaffold tests --- packages/frames-client/package.json | 2 ++ packages/frames-client/src/index.test.ts | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 packages/frames-client/src/index.test.ts diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 577910f20..6365804a2 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -60,8 +60,10 @@ "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", + "@xmtp/xmtp-js": "^11.3.7", "eslint": "^8.56.0", "eslint-config-xmtp-web": "workspace:*", + "ethers": "^6.10.0", "prettier": "^3.2.4", "rollup": "^4.9.6", "rollup-plugin-dts": "^6.1.0", diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts new file mode 100644 index 000000000..f98bd734d --- /dev/null +++ b/packages/frames-client/src/index.test.ts @@ -0,0 +1,11 @@ +import { Client, PrivateKey } from "@xmtp/xmtp-js"; +import { Wallet } from "ethers"; +import { it, expect, describe, beforeEach } from "vitest"; + +describe("signFrameAction", () => { + let client: Client; + beforeEach(async () => { + client = await Client.create(Wallet.createRandom()); + }); + it("should sign a frame action with a valid signature", async () => {}); +}); From a40553a2e4ad83c84c27da2450cf7fc999cc23e6 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 18:50:56 -0800 Subject: [PATCH 006/107] Add some more tests --- packages/frames-client/src/crypto.ts | 7 ++- packages/frames-client/src/index.test.ts | 54 +++++++++++++++++++++++- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/packages/frames-client/src/crypto.ts b/packages/frames-client/src/crypto.ts index b45c2f8f7..6505e0b38 100644 --- a/packages/frames-client/src/crypto.ts +++ b/packages/frames-client/src/crypto.ts @@ -1,4 +1,9 @@ +// eslint-disable-next-line +const webCrypto: Crypto = + // eslint-disable-next-line + typeof crypto === "undefined" ? require("crypto").webcrypto : crypto; + export async function sha256(data: Uint8Array): Promise { - const digest = await crypto.subtle.digest("SHA-256", data); + const digest = await webCrypto.subtle.digest("SHA-256", data); return new Uint8Array(digest); } diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index f98bd734d..fc03804c1 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -1,11 +1,61 @@ -import { Client, PrivateKey } from "@xmtp/xmtp-js"; +import { Client } from "@xmtp/xmtp-js"; import { Wallet } from "ethers"; +import { frames, fetcher } from "@xmtp/proto"; import { it, expect, describe, beforeEach } from "vitest"; +import { FramesClient } from "."; + +const { b64Decode } = fetcher; describe("signFrameAction", () => { let client: Client; + let framesClient: FramesClient; beforeEach(async () => { client = await Client.create(Wallet.createRandom()); + framesClient = new FramesClient(client); + }); + it("should sign a frame action with a valid signature", async () => { + const frameUrl = "https://example.com"; + const buttonIndex = 1; + const conversationIdentifier = "testConversationIdentifier"; + const messageId = "testMessageId"; + + const signedPayload = await framesClient.signFrameAction( + frameUrl, + buttonIndex, + conversationIdentifier, + messageId, + ); + + expect(signedPayload.untrustedData.walletAddress).toEqual(client.address); + expect(signedPayload.untrustedData.url).toEqual(frameUrl); + expect(signedPayload.untrustedData.buttonIndex).toEqual(buttonIndex); + expect(signedPayload.untrustedData.conversationIdentifier).toEqual( + conversationIdentifier, + ); + expect(signedPayload.untrustedData.timestamp).toBeGreaterThan(0); + + const signedPayloadProto = frames.FrameAction.decode( + b64Decode(signedPayload.trustedData.messageBytes), + ); + expect(signedPayloadProto.actionBody).toBeDefined(); + expect(signedPayloadProto.signature).toBeDefined(); + expect(signedPayloadProto.signedPublicKeyBundle).toBeDefined(); + + const signedPayloadBody = frames.FrameActionBody.decode( + signedPayloadProto.actionBody, + ); + expect(signedPayloadBody.messageId).toEqual(messageId); + expect(new TextDecoder().decode(signedPayloadBody.buttonIndex)).toEqual( + buttonIndex.toString(), + ); + expect(new TextDecoder().decode(signedPayloadBody.frameUrl)).toEqual( + frameUrl, + ); + expect(signedPayloadBody.conversationIdentifier).toEqual( + conversationIdentifier, + ); + expect(new TextDecoder().decode(signedPayloadBody.frameUrl)).toEqual( + frameUrl, + ); }); - it("should sign a frame action with a valid signature", async () => {}); }); From f195c59e9047e400eaf3d1d6b8b24339288c0def Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 19:23:01 -0800 Subject: [PATCH 007/107] Add README and tests --- packages/frames-client/README.md | 16 +++++++++++++ packages/frames-client/src/converters.test.ts | 17 ++++++++++++++ packages/frames-client/src/index.test.ts | 23 ++++++++++++++++++- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 packages/frames-client/src/converters.test.ts diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index cdc25b1a8..361522b5c 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -1 +1,17 @@ # frames-client + +## Usage + +```ts +const xmtpClient = await Client.create(wallet); +const framesClient = new FramesClient(xmtpClient); + +const frameUrl = "https://www.myframe.xyz"; + +// Read data from a frame +const frameMetadata = await readMetadata(frameUrl); + +// Handle a click to button 2 from a conversation with topic "/xmtp/0/123" on messageId "45678" +const payload = await signFrameAction(frameUrl, 2, "/xmtp/0/123", "45678"); +const updatedFrameMetadata = await postToFrame(frameUrl, payload); +``` diff --git a/packages/frames-client/src/converters.test.ts b/packages/frames-client/src/converters.test.ts new file mode 100644 index 000000000..798e541e1 --- /dev/null +++ b/packages/frames-client/src/converters.test.ts @@ -0,0 +1,17 @@ +import { Wallet } from "ethers"; +import { it, expect, describe, beforeEach } from "vitest"; +import { PrivateKeyBundleV1, SignedPublicKeyBundle } from "@xmtp/xmtp-js"; +import { v1ToV2Bundle } from "./converters"; + +describe("converters", () => { + it("can convert a valid public key bundle", async () => { + const v1Bundle = await PrivateKeyBundleV1.generate(Wallet.createRandom()); + const publicKeyBundle = v1Bundle.getPublicKeyBundle(); + + const v2Bundle = v1ToV2Bundle(publicKeyBundle); + const v2BundleInstance = new SignedPublicKeyBundle(v2Bundle); + const downgradedBundle = v2BundleInstance.toLegacyBundle(); + + expect(downgradedBundle.equals(publicKeyBundle)).toBe(true); + }); +}); diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index fc03804c1..9f0b9fa2d 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -1,8 +1,9 @@ -import { Client } from "@xmtp/xmtp-js"; +import { Client, Signature, SignedPublicKey } from "@xmtp/xmtp-js"; import { Wallet } from "ethers"; import { frames, fetcher } from "@xmtp/proto"; import { it, expect, describe, beforeEach } from "vitest"; import { FramesClient } from "."; +import { sha256 } from "./crypto"; const { b64Decode } = fetcher; @@ -57,5 +58,25 @@ describe("signFrameAction", () => { expect(new TextDecoder().decode(signedPayloadBody.frameUrl)).toEqual( frameUrl, ); + + if ( + !signedPayloadProto.signature || + !signedPayloadProto?.signedPublicKeyBundle?.identityKey + ) { + throw new Error("Missing signature"); + } + + const signatureInstance = new Signature(signedPayloadProto.signature); + const digest = await sha256(signedPayloadProto.actionBody); + // Ensure the signature is valid + expect( + signatureInstance + .getPublicKey(digest) + ?.equals( + new SignedPublicKey( + signedPayloadProto.signedPublicKeyBundle.identityKey, + ).toLegacyKey(), + ), + ); }); }); From 675ce1fe8b1ecfc19adc25b23c309c5ab814e617 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 19:23:11 -0800 Subject: [PATCH 008/107] Ability to POST to the frame --- packages/frames-client/src/index.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts index 22b78c893..d47c9810e 100644 --- a/packages/frames-client/src/index.ts +++ b/packages/frames-client/src/index.ts @@ -21,6 +21,30 @@ export class FramesClient { return (await response.json()) as FramesApiResponse; } + static async postToFrame( + url: string, + payload: FramePostPayload, + ): Promise { + const response = await fetch( + `${OG_PROXY_URL}?url=${encodeURIComponent(url)}`, + { + method: "POST", + body: JSON.stringify(payload), + headers: { + "Content-Type": "application/json", + }, + }, + ); + + if (!response.ok) { + throw new Error( + `Failed to post to frame: ${response.status} ${response.statusText}`, + ); + } + + return (await response.json()) as FramesApiResponse; + } + async signFrameAction( frameUrl: string, buttonIndex: number, From 805e155c69fd74bc1e19fd91efc61258112b3e5a Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 19:25:37 -0800 Subject: [PATCH 009/107] Lint --- packages/frames-client/src/converters.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-client/src/converters.test.ts b/packages/frames-client/src/converters.test.ts index 798e541e1..ce939eb69 100644 --- a/packages/frames-client/src/converters.test.ts +++ b/packages/frames-client/src/converters.test.ts @@ -1,5 +1,5 @@ import { Wallet } from "ethers"; -import { it, expect, describe, beforeEach } from "vitest"; +import { it, expect, describe } from "vitest"; import { PrivateKeyBundleV1, SignedPublicKeyBundle } from "@xmtp/xmtp-js"; import { v1ToV2Bundle } from "./converters"; From c951403c93a999eb747c286523be851d026d6b44 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Jan 2024 03:36:30 +0000 Subject: [PATCH 010/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 13de7ef0d..a094dd46f 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.1.1 + +### Patch Changes + +- fd952ee: Adds ability to post frame to a destination and see an updated response + ## 0.1.0 ### Minor Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index a0161c7cc..eb3b13e38 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,7 +1,7 @@ { "name": "@xmtp/frames-client", "packageManager": "yarn@4.0.2", - "version": "0.1.0", + "version": "0.1.1", "author": "XMTP Labs ", "license": "MIT", "type": "module", From 4cfb55abf309ea2a62b839fdcbdbef2bf4a7080c Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 29 Jan 2024 21:03:31 -0800 Subject: [PATCH 011/107] Add vitest setup --- packages/frames-client/src/crypto.ts | 5 +---- packages/frames-client/vitest.config.ts | 18 ++++++++++++++++++ packages/frames-client/vitest.setup.ts | 5 +++++ 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 packages/frames-client/vitest.config.ts create mode 100644 packages/frames-client/vitest.setup.ts diff --git a/packages/frames-client/src/crypto.ts b/packages/frames-client/src/crypto.ts index 6505e0b38..a094e74af 100644 --- a/packages/frames-client/src/crypto.ts +++ b/packages/frames-client/src/crypto.ts @@ -1,7 +1,4 @@ -// eslint-disable-next-line -const webCrypto: Crypto = - // eslint-disable-next-line - typeof crypto === "undefined" ? require("crypto").webcrypto : crypto; +const webCrypto = crypto; export async function sha256(data: Uint8Array): Promise { const digest = await webCrypto.subtle.digest("SHA-256", data); diff --git a/packages/frames-client/vitest.config.ts b/packages/frames-client/vitest.config.ts new file mode 100644 index 000000000..b4435352a --- /dev/null +++ b/packages/frames-client/vitest.config.ts @@ -0,0 +1,18 @@ +import { defineConfig, mergeConfig } from "vite"; +import { defineConfig as defineVitestConfig } from "vitest/config"; +import tsconfigPaths from "vite-tsconfig-paths"; + +// https://vitejs.dev/config/ +const viteConfig = defineConfig({ + plugins: [tsconfigPaths()], +}); + +const vitestConfig = defineVitestConfig({ + test: { + globals: true, + environment: "happy-dom", + setupFiles: "./vitest.setup.ts", + }, +}); + +export default mergeConfig(viteConfig, vitestConfig); diff --git a/packages/frames-client/vitest.setup.ts b/packages/frames-client/vitest.setup.ts new file mode 100644 index 000000000..c0ab99828 --- /dev/null +++ b/packages/frames-client/vitest.setup.ts @@ -0,0 +1,5 @@ +import { webcrypto } from "crypto"; + +// eslint-disable-next-line +// @ts-ignore +global.crypto = webcrypto; From 1ecbcc90d8eb244473c4c467f660b605e788e447 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Jan 2024 05:14:08 +0000 Subject: [PATCH 012/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index a094dd46f..5a61a78fd 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.1.2 + +### Patch Changes + +- aa1cc83: Fix polyfill for webcrypto in Node.js + ## 0.1.1 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index eb3b13e38..c7058eceb 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,7 +1,7 @@ { "name": "@xmtp/frames-client", "packageManager": "yarn@4.0.2", - "version": "0.1.1", + "version": "0.1.2", "author": "XMTP Labs ", "license": "MIT", "type": "module", From 171e0175fe8e67d24f913a48c0d9442238a48c17 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Tue, 30 Jan 2024 09:15:50 -0800 Subject: [PATCH 013/107] Dynamic import of crypto --- packages/frames-client/src/crypto.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/frames-client/src/crypto.ts b/packages/frames-client/src/crypto.ts index 6505e0b38..a2b0378f6 100644 --- a/packages/frames-client/src/crypto.ts +++ b/packages/frames-client/src/crypto.ts @@ -1,9 +1,16 @@ -// eslint-disable-next-line -const webCrypto: Crypto = - // eslint-disable-next-line - typeof crypto === "undefined" ? require("crypto").webcrypto : crypto; +async function getCrypto(): Promise { + if (typeof crypto !== "undefined") { + return crypto; + } + + if (typeof window !== "undefined" && window.crypto) { + return window.crypto; + } + + return (await import("crypto")).webcrypto as Crypto; +} export async function sha256(data: Uint8Array): Promise { - const digest = await webCrypto.subtle.digest("SHA-256", data); + const digest = await (await getCrypto()).subtle.digest("SHA-256", data); return new Uint8Array(digest); } From 259598ae7415ec803d41ed966091decb3c592781 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Tue, 30 Jan 2024 09:17:05 -0800 Subject: [PATCH 014/107] Add caching --- packages/frames-client/src/crypto.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/src/crypto.ts b/packages/frames-client/src/crypto.ts index a2b0378f6..8f13df5d5 100644 --- a/packages/frames-client/src/crypto.ts +++ b/packages/frames-client/src/crypto.ts @@ -1,13 +1,21 @@ +let cachedCrypto: Crypto | undefined; + async function getCrypto(): Promise { if (typeof crypto !== "undefined") { return crypto; } + if (typeof cachedCrypto !== "undefined") { + return cachedCrypto; + } + if (typeof window !== "undefined" && window.crypto) { return window.crypto; } - return (await import("crypto")).webcrypto as Crypto; + cachedCrypto = (await import("crypto")).webcrypto as Crypto; + + return cachedCrypto; } export async function sha256(data: Uint8Array): Promise { From 2da9b294fb8e4ccee14351524709fc77c0bace7e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Jan 2024 17:22:41 +0000 Subject: [PATCH 015/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 5a61a78fd..389916c7b 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.1.3 + +### Patch Changes + +- 4c735d0: Add dynamic crypto import + ## 0.1.2 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index c7058eceb..e2da58598 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,7 +1,7 @@ { "name": "@xmtp/frames-client", "packageManager": "yarn@4.0.2", - "version": "0.1.2", + "version": "0.1.3", "author": "XMTP Labs ", "license": "MIT", "type": "module", From 3d0697beaa5dba762cb822eff2e88beadad66b1f Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 30 Jan 2024 11:43:42 -0600 Subject: [PATCH 016/107] Update crypto imports, build, and exports --- packages/frames-client/package.json | 4 ++- packages/frames-client/rollup.config.js | 36 +++++++++++++++----- packages/frames-client/src/crypto.browser.ts | 1 + packages/frames-client/src/crypto.ts | 25 +------------- packages/frames-client/src/index.test.ts | 2 +- packages/frames-client/src/index.ts | 2 +- packages/frames-client/src/utils.ts | 6 ++++ packages/frames-client/vitest.config.ts | 1 - packages/frames-client/vitest.setup.ts | 5 --- 9 files changed, 40 insertions(+), 42 deletions(-) create mode 100644 packages/frames-client/src/crypto.browser.ts create mode 100644 packages/frames-client/src/utils.ts delete mode 100644 packages/frames-client/vitest.setup.ts diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index e2da58598..1ca41d348 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -5,12 +5,13 @@ "author": "XMTP Labs ", "license": "MIT", "type": "module", - "browser": "lib/index.js", + "browser": "lib/browser/index.js", "module": "lib/index.js", "types": "lib/index.d.ts", "exports": { ".": { "types": "./lib/index.d.ts", + "browser": "./lib/browser/index.js", "default": "./lib/index.js" } }, @@ -59,6 +60,7 @@ "devDependencies": { "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", + "@xmtp/rollup-plugin-resolve-extensions": "^1.0.1", "@xmtp/tsconfig": "workspace:*", "@xmtp/xmtp-js": "^11.3.7", "eslint": "^8.56.0", diff --git a/packages/frames-client/rollup.config.js b/packages/frames-client/rollup.config.js index 28ff8e438..5207340eb 100644 --- a/packages/frames-client/rollup.config.js +++ b/packages/frames-client/rollup.config.js @@ -4,6 +4,20 @@ 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"; +import { resolveExtensions } from "@xmtp/rollup-plugin-resolve-extensions"; + +const plugins = [ + tsConfigPaths(), + typescript({ + declaration: false, + declarationMap: false, + }), + filesize({ + showMinifiedSize: false, + }), +]; + +const external = ["@xmtp/proto", "node:crypto"]; export default defineConfig([ { @@ -13,18 +27,22 @@ export default defineConfig([ format: "es", sourcemap: true, }, + external, + plugins, + }, + { + input: "src/index.ts", + output: { + file: "lib/browser/index.js", + format: "es", + sourcemap: true, + }, + external, plugins: [ - tsConfigPaths(), - typescript({ - declaration: false, - declarationMap: false, - }), + resolveExtensions({ extensions: [".browser"] }), terser(), - filesize({ - showMinifiedSize: false, - }), + ...plugins, ], - external: [], }, { input: "src/index.ts", diff --git a/packages/frames-client/src/crypto.browser.ts b/packages/frames-client/src/crypto.browser.ts new file mode 100644 index 000000000..8b9b36658 --- /dev/null +++ b/packages/frames-client/src/crypto.browser.ts @@ -0,0 +1 @@ +export const { crypto } = window; diff --git a/packages/frames-client/src/crypto.ts b/packages/frames-client/src/crypto.ts index 8f13df5d5..be214cd70 100644 --- a/packages/frames-client/src/crypto.ts +++ b/packages/frames-client/src/crypto.ts @@ -1,24 +1 @@ -let cachedCrypto: Crypto | undefined; - -async function getCrypto(): Promise { - if (typeof crypto !== "undefined") { - return crypto; - } - - if (typeof cachedCrypto !== "undefined") { - return cachedCrypto; - } - - if (typeof window !== "undefined" && window.crypto) { - return window.crypto; - } - - cachedCrypto = (await import("crypto")).webcrypto as Crypto; - - return cachedCrypto; -} - -export async function sha256(data: Uint8Array): Promise { - const digest = await (await getCrypto()).subtle.digest("SHA-256", data); - return new Uint8Array(digest); -} +export { webcrypto as crypto } from "node:crypto"; diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 9f0b9fa2d..66835d9c1 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -3,7 +3,7 @@ import { Wallet } from "ethers"; import { frames, fetcher } from "@xmtp/proto"; import { it, expect, describe, beforeEach } from "vitest"; import { FramesClient } from "."; -import { sha256 } from "./crypto"; +import { sha256 } from "./utils"; const { b64Decode } = fetcher; diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts index d47c9810e..87afb5f3f 100644 --- a/packages/frames-client/src/index.ts +++ b/packages/frames-client/src/index.ts @@ -2,7 +2,7 @@ import type { Client } from "@xmtp/xmtp-js"; import { frames, fetcher } from "@xmtp/proto"; import { OG_PROXY_URL } from "./constants"; import type { FramePostPayload, FramesApiResponse } from "./types"; -import { sha256 } from "./crypto"; +import { sha256 } from "./utils"; import { v1ToV2Bundle } from "./converters"; const { b64Encode } = fetcher; diff --git a/packages/frames-client/src/utils.ts b/packages/frames-client/src/utils.ts new file mode 100644 index 000000000..a4c81d25d --- /dev/null +++ b/packages/frames-client/src/utils.ts @@ -0,0 +1,6 @@ +import { crypto } from "./crypto"; + +export async function sha256(data: Uint8Array): Promise { + const digest = await crypto.subtle.digest("SHA-256", data); + return new Uint8Array(digest); +} diff --git a/packages/frames-client/vitest.config.ts b/packages/frames-client/vitest.config.ts index b4435352a..21252a9d1 100644 --- a/packages/frames-client/vitest.config.ts +++ b/packages/frames-client/vitest.config.ts @@ -11,7 +11,6 @@ const vitestConfig = defineVitestConfig({ test: { globals: true, environment: "happy-dom", - setupFiles: "./vitest.setup.ts", }, }); diff --git a/packages/frames-client/vitest.setup.ts b/packages/frames-client/vitest.setup.ts deleted file mode 100644 index c0ab99828..000000000 --- a/packages/frames-client/vitest.setup.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { webcrypto } from "crypto"; - -// eslint-disable-next-line -// @ts-ignore -global.crypto = webcrypto; From 766ad2bea49f52d7159cec2b44c9f66af5902404 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Jan 2024 18:09:00 +0000 Subject: [PATCH 017/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 389916c7b..1ff5fbcc2 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.1.4 + +### Patch Changes + +- 8b21c05: Updated crypto imports, build, and exports + ## 0.1.3 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 1ca41d348..71e021f2c 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,7 +1,7 @@ { "name": "@xmtp/frames-client", "packageManager": "yarn@4.0.2", - "version": "0.1.3", + "version": "0.1.4", "author": "XMTP Labs ", "license": "MIT", "type": "module", From b96f343b1d9c4b6a883518ba5950c9d08b792506 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 30 Jan 2024 11:24:55 -0600 Subject: [PATCH 018/107] Add prettier plugin, format `package.json` files --- packages/frames-client/package.json | 87 ++++++++++++++--------------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 71e021f2c..028cb5ac4 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,33 +1,6 @@ { "name": "@xmtp/frames-client", - "packageManager": "yarn@4.0.2", "version": "0.1.4", - "author": "XMTP Labs ", - "license": "MIT", - "type": "module", - "browser": "lib/browser/index.js", - "module": "lib/index.js", - "types": "lib/index.d.ts", - "exports": { - ".": { - "types": "./lib/index.d.ts", - "browser": "./lib/browser/index.js", - "default": "./lib/index.js" - } - }, - "files": [ - "lib" - ], - "sideEffects": false, - "repository": { - "type": "git", - "url": "git@github.com: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", @@ -42,8 +15,43 @@ "react-hooks", "hooks" ], - "publishConfig": { - "access": "public" + "homepage": "https://github.com/xmtp/xmtp-web", + "bugs": { + "url": "https://github.com/xmtp/xmtp-web/issues" + }, + "repository": { + "type": "git", + "url": "git@github.com:xmtp/xmtp-web.git", + "directory": "packages/react-sdk" + }, + "license": "MIT", + "author": "XMTP Labs ", + "sideEffects": false, + "type": "module", + "exports": { + ".": { + "types": "./lib/index.d.ts", + "default": "./lib/index.js" + } + }, + "module": "lib/index.js", + "browser": "lib/index.js", + "types": "lib/index.d.ts", + "files": [ + "lib" + ], + "scripts": { + "build": "yarn clean:lib && yarn rollup -c", + "clean": "rm -rf .turbo && rm -rf node_modules && yarn clean:lib", + "clean:lib": "rm -rf lib", + "dev": "yarn clean:lib && yarn rollup -c --watch", + "format": "yarn format:base -w .", + "format:base": "prettier --ignore-path ../../.gitignore", + "format:check": "yarn format:base -c .", + "lint": "eslint . --ignore-path ../../.gitignore", + "test": "vitest run --passWithNoTests", + "typecheck": "tsc", + "typedoc": "typedoc" }, "browserslist": { "production": [ @@ -57,6 +65,9 @@ "last 3 safari versions" ] }, + "dependencies": { + "@xmtp/proto": "3.41.0-beta.2" + }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", @@ -77,23 +88,11 @@ "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": ">9.3.1" }, - "dependencies": { - "@xmtp/proto": "3.41.0-beta.2" + "packageManager": "yarn@4.0.2", + "publishConfig": { + "access": "public" } } From b999c26b0b120c5154ed3d3767f0bfd936c0ba04 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:13:15 -0800 Subject: [PATCH 019/107] Update to latest protos --- packages/frames-client/package.json | 5 +- packages/frames-client/rollup.config.js | 7 +-- packages/frames-client/src/crypto.browser.ts | 1 - packages/frames-client/src/crypto.ts | 1 - packages/frames-client/src/errors.ts | 12 ++++ packages/frames-client/src/index.test.ts | 56 +++++++++-------- packages/frames-client/src/index.ts | 63 ++++++++++---------- packages/frames-client/src/types.ts | 28 +++++++-- packages/frames-client/src/utils.test.ts | 60 +++++++++++++++++++ packages/frames-client/src/utils.ts | 46 ++++++++++++-- 10 files changed, 204 insertions(+), 75 deletions(-) delete mode 100644 packages/frames-client/src/crypto.browser.ts delete mode 100644 packages/frames-client/src/crypto.ts create mode 100644 packages/frames-client/src/errors.ts create mode 100644 packages/frames-client/src/utils.test.ts diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 71e021f2c..2820b07e9 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -60,7 +60,6 @@ "devDependencies": { "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", - "@xmtp/rollup-plugin-resolve-extensions": "^1.0.1", "@xmtp/tsconfig": "workspace:*", "@xmtp/xmtp-js": "^11.3.7", "eslint": "^8.56.0", @@ -94,6 +93,8 @@ "@xmtp/xmtp-js": ">9.3.1" }, "dependencies": { - "@xmtp/proto": "3.41.0-beta.2" + "@noble/hashes": "^1.3.3", + "@xmtp/proto": "3.41.0-beta.5", + "long": "^5.2.3" } } diff --git a/packages/frames-client/rollup.config.js b/packages/frames-client/rollup.config.js index 5207340eb..fc035a86a 100644 --- a/packages/frames-client/rollup.config.js +++ b/packages/frames-client/rollup.config.js @@ -4,7 +4,6 @@ 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"; -import { resolveExtensions } from "@xmtp/rollup-plugin-resolve-extensions"; const plugins = [ tsConfigPaths(), @@ -38,11 +37,7 @@ export default defineConfig([ sourcemap: true, }, external, - plugins: [ - resolveExtensions({ extensions: [".browser"] }), - terser(), - ...plugins, - ], + plugins: [terser(), ...plugins], }, { input: "src/index.ts", diff --git a/packages/frames-client/src/crypto.browser.ts b/packages/frames-client/src/crypto.browser.ts deleted file mode 100644 index 8b9b36658..000000000 --- a/packages/frames-client/src/crypto.browser.ts +++ /dev/null @@ -1 +0,0 @@ -export const { crypto } = window; diff --git a/packages/frames-client/src/crypto.ts b/packages/frames-client/src/crypto.ts deleted file mode 100644 index be214cd70..000000000 --- a/packages/frames-client/src/crypto.ts +++ /dev/null @@ -1 +0,0 @@ -export { webcrypto as crypto } from "node:crypto"; diff --git a/packages/frames-client/src/errors.ts b/packages/frames-client/src/errors.ts new file mode 100644 index 000000000..d82986d15 --- /dev/null +++ b/packages/frames-client/src/errors.ts @@ -0,0 +1,12 @@ +/* eslint-disable max-classes-per-file */ + +export class ApiError extends Error { + status: number; + + constructor(message: string, status: number) { + super(message); + this.status = status; + } +} + +export class InvalidArgumentsError extends Error {} diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 66835d9c1..8599330dd 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -2,8 +2,8 @@ import { Client, Signature, SignedPublicKey } from "@xmtp/xmtp-js"; import { Wallet } from "ethers"; import { frames, fetcher } from "@xmtp/proto"; import { it, expect, describe, beforeEach } from "vitest"; +import { sha256 } from "@noble/hashes/sha256"; import { FramesClient } from "."; -import { sha256 } from "./utils"; const { b64Decode } = fetcher; @@ -17,22 +17,20 @@ describe("signFrameAction", () => { it("should sign a frame action with a valid signature", async () => { const frameUrl = "https://example.com"; const buttonIndex = 1; - const conversationIdentifier = "testConversationIdentifier"; - const messageId = "testMessageId"; - const signedPayload = await framesClient.signFrameAction( + const signedPayload = await framesClient.signFrameAction({ frameUrl, buttonIndex, - conversationIdentifier, - messageId, - ); + conversationTopic: "foo", + participantAccountAddresses: ["amal", "bola"], + }); expect(signedPayload.untrustedData.walletAddress).toEqual(client.address); expect(signedPayload.untrustedData.url).toEqual(frameUrl); expect(signedPayload.untrustedData.buttonIndex).toEqual(buttonIndex); - expect(signedPayload.untrustedData.conversationIdentifier).toEqual( - conversationIdentifier, - ); + expect( + signedPayload.untrustedData.opaqueConversationIdentifier, + ).toBeDefined(); expect(signedPayload.untrustedData.timestamp).toBeGreaterThan(0); const signedPayloadProto = frames.FrameAction.decode( @@ -45,19 +43,10 @@ describe("signFrameAction", () => { const signedPayloadBody = frames.FrameActionBody.decode( signedPayloadProto.actionBody, ); - expect(signedPayloadBody.messageId).toEqual(messageId); - expect(new TextDecoder().decode(signedPayloadBody.buttonIndex)).toEqual( - buttonIndex.toString(), - ); - expect(new TextDecoder().decode(signedPayloadBody.frameUrl)).toEqual( - frameUrl, - ); - expect(signedPayloadBody.conversationIdentifier).toEqual( - conversationIdentifier, - ); - expect(new TextDecoder().decode(signedPayloadBody.frameUrl)).toEqual( - frameUrl, - ); + + expect(signedPayloadBody.buttonIndex).toEqual(buttonIndex); + expect(signedPayloadBody.frameUrl).toEqual(frameUrl); + expect(signedPayloadBody.opaqueConversationIdentifier).toBeDefined(); if ( !signedPayloadProto.signature || @@ -67,7 +56,7 @@ describe("signFrameAction", () => { } const signatureInstance = new Signature(signedPayloadProto.signature); - const digest = await sha256(signedPayloadProto.actionBody); + const digest = sha256(signedPayloadProto.actionBody); // Ensure the signature is valid expect( signatureInstance @@ -79,4 +68,23 @@ describe("signFrameAction", () => { ), ); }); + + // Will add E2E tests back once we have Frames deployed with the new schema + // it("works e2e", async () => { + // const frameUrl = + // "https://fc-polls-five.vercel.app/polls/01032f47-e976-42ee-9e3d-3aac1324f4b8"; + // const metadata = await FramesClient.readMetadata(frameUrl); + // expect(metadata).toBeDefined(); + // const signedPayload = await framesClient.signFrameAction( + // frameUrl, + // 1, + // "foo", + // "bar", + // ); + // console.log(signedPayload); + // const postUrl = metadata.extractedTags["fc:frame:post_url"]; + // console.log("posting to", postUrl); + // const response = await FramesClient.postToFrame(postUrl, signedPayload); + // console.log(response); + // }); }); diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts index 87afb5f3f..e22df34a3 100644 --- a/packages/frames-client/src/index.ts +++ b/packages/frames-client/src/index.ts @@ -1,11 +1,16 @@ import type { Client } from "@xmtp/xmtp-js"; -import { frames, fetcher } from "@xmtp/proto"; +import { frames } from "@xmtp/proto"; +import { sha256 } from "@noble/hashes/sha256"; +import Long from "long"; import { OG_PROXY_URL } from "./constants"; -import type { FramePostPayload, FramesApiResponse } from "./types"; -import { sha256 } from "./utils"; +import type { + FrameActionInputs, + FramePostPayload, + FramesApiResponse, +} from "./types"; import { v1ToV2Bundle } from "./converters"; - -const { b64Encode } = fetcher; +import { ApiError } from "./errors"; +import { base64Encode, buildOpaqueIdentifier } from "./utils"; export class FramesClient { xmtpClient: Client; @@ -18,6 +23,11 @@ export class FramesClient { const response = await fetch( `${OG_PROXY_URL}?url=${encodeURIComponent(url)}`, ); + + if (!response.ok) { + throw new ApiError(`Failed to read metadata for ${url}`, response.status); + } + return (await response.json()) as FramesApiResponse; } @@ -45,48 +55,39 @@ export class FramesClient { return (await response.json()) as FramesApiResponse; } - async signFrameAction( - frameUrl: string, - buttonIndex: number, - conversationIdentifier: string, - messageId: string, - ): Promise { - const signedAction = await this.buildSignedFrameAction( + async signFrameAction(inputs: FrameActionInputs): Promise { + const opaqueConversationIdentifier = buildOpaqueIdentifier(inputs); + const { frameUrl, buttonIndex } = inputs; + const now = Date.now(); + const toSign: frames.FrameActionBody = { frameUrl, buttonIndex, - conversationIdentifier, - messageId, - ); + opaqueConversationIdentifier, + timestamp: Long.fromNumber(now), + }; + + const signedAction = await this.buildSignedFrameAction(toSign); return { untrustedData: { + buttonIndex, + opaqueConversationIdentifier, walletAddress: this.xmtpClient.address, url: frameUrl, - messageId, - timestamp: Date.now(), - buttonIndex, - conversationIdentifier, + timestamp: now, }, trustedData: { - messageBytes: b64Encode(signedAction, 0, signedAction.length), + messageBytes: base64Encode(signedAction), }, }; } private async buildSignedFrameAction( - frameUrl: string, - buttonIndex: number, - conversationIdentifier: string, - messageId: string, + actionBodyInputs: frames.FrameActionBody, ) { - const actionBody = frames.FrameActionBody.encode({ - frameUrl: new TextEncoder().encode(frameUrl), - buttonIndex: new TextEncoder().encode(buttonIndex.toString()), - conversationIdentifier, - messageId, - }).finish(); + const actionBody = frames.FrameActionBody.encode(actionBodyInputs).finish(); - const digest = await sha256(actionBody); + const digest = sha256(actionBody); const signature = await this.xmtpClient.keystore.signDigest({ digest, identityKey: true, diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index 46c3b2559..cb916bac2 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -4,12 +4,11 @@ export type FramesApiResponse = { }; export type FramePostUntrustedData = { - walletAddress: string; - url: string; - messageId: string; - timestamp: number; - buttonIndex: number; - conversationIdentifier: string; + walletAddress: string; // Untrusted version of the wallet address + url: string; // Frame URL. May be different from the `post_url` this is being sent to + timestamp: number; // Timestamp in milliseconds + buttonIndex: number; // 1-indexed button that was clicked + opaqueConversationIdentifier: string; // A hash of the conversation topic and the participants }; export type FramePostTrustedData = { @@ -20,3 +19,20 @@ export type FramePostPayload = { untrustedData: FramePostUntrustedData; trustedData: FramePostTrustedData; }; + +type DmActionInputs = { + conversationTopic: string; + participantAccountAddresses: string[]; +}; + +type GroupActionInputs = { + groupId: Uint8Array; + groupSecret: Uint8Array; +}; + +type ConversationActionInputs = DmActionInputs | GroupActionInputs; + +export type FrameActionInputs = { + frameUrl: string; + buttonIndex: number; +} & ConversationActionInputs; diff --git a/packages/frames-client/src/utils.test.ts b/packages/frames-client/src/utils.test.ts new file mode 100644 index 000000000..05f5407f7 --- /dev/null +++ b/packages/frames-client/src/utils.test.ts @@ -0,0 +1,60 @@ +import { it, expect, describe } from "vitest"; +import { webcrypto } from "crypto"; +import { + base64Encode, + buildOpaqueIdentifier, + concatArrays, + concatStringsToBytes, +} from "./utils"; + +describe("concatArrays", () => { + it("should work with a single array", () => { + const input = new Uint8Array([1, 2, 3]); + const result = concatArrays(input); + expect(result).toEqual(input); + }); + + it("should work with multiple arrays", () => { + const input1 = new Uint8Array([1, 2, 3]); + const input2 = new Uint8Array([4, 5, 6]); + const result = concatArrays(input1, input2); + expect(result).toEqual(new Uint8Array([1, 2, 3, 4, 5, 6])); + }); +}); + +describe("concatStringsToBytes", () => { + it("should work with a single string", () => { + const input = "abc"; + const result = concatStringsToBytes(input); + expect(result).toEqual(new TextEncoder().encode(input)); + }); + + it("should work with multiple strings", () => { + const input1 = "abc"; + const input2 = "def"; + const result = concatStringsToBytes(input1, input2); + expect(result).toEqual(new TextEncoder().encode(input1 + input2)); + }); +}); + +describe("buildOpaqueIdentifier", () => { + it("should return a base64 encoded sha256 hash of the inputs", async () => { + const inputs = { + frameUrl: "https://example.com", + buttonIndex: 2, + conversationTopic: "foo", + participantAccountAddresses: ["bola", "amal"], + }; + const result = buildOpaqueIdentifier(inputs); + expect(result).toEqual( + base64Encode( + new Uint8Array( + await webcrypto.subtle.digest( + "SHA-256", + new TextEncoder().encode("fooamalbola"), + ), + ), + ), + ); + }); +}); diff --git a/packages/frames-client/src/utils.ts b/packages/frames-client/src/utils.ts index a4c81d25d..c4a80e36a 100644 --- a/packages/frames-client/src/utils.ts +++ b/packages/frames-client/src/utils.ts @@ -1,6 +1,44 @@ -import { crypto } from "./crypto"; +import { fetcher } from "@xmtp/proto"; +import { sha256 } from "@noble/hashes/sha256"; +import type { FrameActionInputs } from "./types"; +import { InvalidArgumentsError } from "./errors"; -export async function sha256(data: Uint8Array): Promise { - const digest = await crypto.subtle.digest("SHA-256", data); - return new Uint8Array(digest); +const { b64Encode } = fetcher; + +export function concatArrays(...arrays: Uint8Array[]): Uint8Array { + return new Uint8Array( + arrays.reduce((acc, arr) => acc.concat(Array.from(arr)), [] as number[]), + ); +} + +export function concatStringsToBytes(...arrays: string[]): Uint8Array { + return new TextEncoder().encode(arrays.join("")); +} + +export function base64Encode(input: Uint8Array): string { + return b64Encode(input, 0, input.length); +} + +export function buildOpaqueIdentifier(inputs: FrameActionInputs): string { + if ("groupId" in inputs && "groupSecret" in inputs) { + return base64Encode( + sha256(concatArrays(inputs.groupId, inputs.groupSecret)), + ); + } + + const { conversationTopic, participantAccountAddresses } = inputs; + if (!conversationTopic || !participantAccountAddresses.length) { + throw new InvalidArgumentsError( + "Missing conversation topic or participants", + ); + } + + return base64Encode( + sha256( + concatStringsToBytes( + conversationTopic, + ...participantAccountAddresses.sort(), + ), + ), + ); } From 89a322b61090541883933ce940933b22aee97b2e Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:40:15 -0800 Subject: [PATCH 020/107] Lowercase everything when computing the digest --- packages/frames-client/src/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frames-client/src/utils.ts b/packages/frames-client/src/utils.ts index c4a80e36a..fda785ea3 100644 --- a/packages/frames-client/src/utils.ts +++ b/packages/frames-client/src/utils.ts @@ -36,8 +36,8 @@ export function buildOpaqueIdentifier(inputs: FrameActionInputs): string { return base64Encode( sha256( concatStringsToBytes( - conversationTopic, - ...participantAccountAddresses.sort(), + conversationTopic.toLowerCase(), + ...participantAccountAddresses.map(p => p.toLowerCase()).sort(), ), ), ); From 5cd6e6af0c644d7ac9871ced8db790d1aa56d888 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:40:41 -0800 Subject: [PATCH 021/107] Test for lowercasing --- packages/frames-client/src/utils.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frames-client/src/utils.test.ts b/packages/frames-client/src/utils.test.ts index 05f5407f7..a4fa7a9b6 100644 --- a/packages/frames-client/src/utils.test.ts +++ b/packages/frames-client/src/utils.test.ts @@ -42,8 +42,8 @@ describe("buildOpaqueIdentifier", () => { const inputs = { frameUrl: "https://example.com", buttonIndex: 2, - conversationTopic: "foo", - participantAccountAddresses: ["bola", "amal"], + conversationTopic: "Foo", + participantAccountAddresses: ["Bola", "Amal"], }; const result = buildOpaqueIdentifier(inputs); expect(result).toEqual( From 7c546036bbeac32465e042060b7bf1cef38a14c4 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:44:33 -0800 Subject: [PATCH 022/107] Format --- packages/frames-client/package.json | 1 + packages/frames-client/src/utils.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index c606e9117..8c4651b55 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -79,6 +79,7 @@ "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.10.0", "prettier": "^3.2.4", + "prettier-plugin-packagejson": "^2.4.10", "rollup": "^4.9.6", "rollup-plugin-dts": "^6.1.0", "rollup-plugin-filesize": "^10.0.0", diff --git a/packages/frames-client/src/utils.ts b/packages/frames-client/src/utils.ts index fda785ea3..3e0c8bab2 100644 --- a/packages/frames-client/src/utils.ts +++ b/packages/frames-client/src/utils.ts @@ -37,7 +37,7 @@ export function buildOpaqueIdentifier(inputs: FrameActionInputs): string { sha256( concatStringsToBytes( conversationTopic.toLowerCase(), - ...participantAccountAddresses.map(p => p.toLowerCase()).sort(), + ...participantAccountAddresses.map((p) => p.toLowerCase()).sort(), ), ), ); From 5435c4c7e3812a61a7276c1a75b8df1bcf4c5022 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 5 Feb 2024 21:36:02 +0000 Subject: [PATCH 023/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 1ff5fbcc2..e785edfa5 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.2.0 + +### Minor Changes + +- b955667: Updates to the latest format of the proto message and tries to make safe for RN usage + ## 0.1.4 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 8c4651b55..e8cd063b6 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.1.4", + "version": "0.2.0", "keywords": [ "xmtp", "messaging", From 5097ac6e52e7a559499b5895683cfa77949ecc79 Mon Sep 17 00:00:00 2001 From: daria-github Date: Tue, 6 Feb 2024 13:23:26 -0800 Subject: [PATCH 024/107] update readme for new spec --- packages/frames-client/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index 361522b5c..b13fc408a 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -11,7 +11,7 @@ const frameUrl = "https://www.myframe.xyz"; // Read data from a frame const frameMetadata = await readMetadata(frameUrl); -// Handle a click to button 2 from a conversation with topic "/xmtp/0/123" on messageId "45678" -const payload = await signFrameAction(frameUrl, 2, "/xmtp/0/123", "45678"); +// Handle a click to button 2 from a conversation with topic "/xmtp/0/123" and participant addresses "abc" and "xyz" +const payload = await signFrameAction({frameUrl, buttonIndex: 2, conversationTopic: "/xmtp/0/123", participantAccountAddresses: ["abc", "xyz"]}); const updatedFrameMetadata = await postToFrame(frameUrl, payload); ``` From fe6895ff33b27adb2b36e408d68c6f75e5873f96 Mon Sep 17 00:00:00 2001 From: daria-github Date: Tue, 6 Feb 2024 13:30:39 -0800 Subject: [PATCH 025/107] format fix --- packages/frames-client/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index b13fc408a..be702b516 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -12,6 +12,11 @@ const frameUrl = "https://www.myframe.xyz"; const frameMetadata = await readMetadata(frameUrl); // Handle a click to button 2 from a conversation with topic "/xmtp/0/123" and participant addresses "abc" and "xyz" -const payload = await signFrameAction({frameUrl, buttonIndex: 2, conversationTopic: "/xmtp/0/123", participantAccountAddresses: ["abc", "xyz"]}); +const payload = await signFrameAction({ + frameUrl, + buttonIndex: 2, + conversationTopic: "/xmtp/0/123", + participantAccountAddresses: ["abc", "xyz"], +}); const updatedFrameMetadata = await postToFrame(frameUrl, payload); ``` From a9ed389d58924ca1d8a992e5abedd5b6eb44d0ef Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 6 Feb 2024 21:33:31 +0000 Subject: [PATCH 026/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index e785edfa5..9cbbe2ec6 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.2.1 + +### Patch Changes + +- 3bbf05c: updated readme + ## 0.2.0 ### Minor Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index e8cd063b6..5a282b4b8 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.2.0", + "version": "0.2.1", "keywords": [ "xmtp", "messaging", From 00671e29685f5726e435f6b6d2e22c6cb12d9196 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Fri, 9 Feb 2024 16:34:18 -0800 Subject: [PATCH 027/107] Make Open Frames compatible payloads --- packages/frames-client/package.json | 1 + packages/frames-client/src/constants.ts | 2 ++ packages/frames-client/src/index.ts | 13 +++++++++---- packages/frames-client/src/types.ts | 8 ++++---- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 5a282b4b8..b7545cd5d 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -71,6 +71,7 @@ "long": "^5.2.3" }, "devDependencies": { + "@open-frames/types": "^0.0.5", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", diff --git a/packages/frames-client/src/constants.ts b/packages/frames-client/src/constants.ts index 2355a34b1..7f54f6e3a 100644 --- a/packages/frames-client/src/constants.ts +++ b/packages/frames-client/src/constants.ts @@ -1 +1,3 @@ export const OG_PROXY_URL = "https://og-proxy.fly.dev"; + +export const PROTOCOL_VERSION = "2024-02-09"; diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts index e22df34a3..55c6927f6 100644 --- a/packages/frames-client/src/index.ts +++ b/packages/frames-client/src/index.ts @@ -2,7 +2,7 @@ import type { Client } from "@xmtp/xmtp-js"; import { frames } from "@xmtp/proto"; import { sha256 } from "@noble/hashes/sha256"; import Long from "long"; -import { OG_PROXY_URL } from "./constants"; +import { OG_PROXY_URL, PROTOCOL_VERSION } from "./constants"; import type { FrameActionInputs, FramePostPayload, @@ -19,9 +19,12 @@ export class FramesClient { this.xmtpClient = xmtpClient; } - static async readMetadata(url: string): Promise { + static async readMetadata( + url: string, + ogProxyUrl = OG_PROXY_URL, + ): Promise { const response = await fetch( - `${OG_PROXY_URL}?url=${encodeURIComponent(url)}`, + `${ogProxyUrl}?url=${encodeURIComponent(url)}`, ); if (!response.ok) { @@ -34,9 +37,10 @@ export class FramesClient { static async postToFrame( url: string, payload: FramePostPayload, + ogProxyUrl = OG_PROXY_URL, ): Promise { const response = await fetch( - `${OG_PROXY_URL}?url=${encodeURIComponent(url)}`, + `${ogProxyUrl}?url=${encodeURIComponent(url)}`, { method: "POST", body: JSON.stringify(payload), @@ -69,6 +73,7 @@ export class FramesClient { const signedAction = await this.buildSignedFrameAction(toSign); return { + clientProtocol: `xmtp@${PROTOCOL_VERSION}`, untrustedData: { buttonIndex, opaqueConversationIdentifier, diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index cb916bac2..61238a22c 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -1,13 +1,12 @@ +import type { OpenFramesUntrustedData } from "@open-frames/types"; + export type FramesApiResponse = { url: string; extractedTags: { [k: string]: string }; }; -export type FramePostUntrustedData = { +export type FramePostUntrustedData = OpenFramesUntrustedData & { walletAddress: string; // Untrusted version of the wallet address - url: string; // Frame URL. May be different from the `post_url` this is being sent to - timestamp: number; // Timestamp in milliseconds - buttonIndex: number; // 1-indexed button that was clicked opaqueConversationIdentifier: string; // A hash of the conversation topic and the participants }; @@ -16,6 +15,7 @@ export type FramePostTrustedData = { }; export type FramePostPayload = { + clientProtocol: `xmtp@${string}`; untrustedData: FramePostUntrustedData; trustedData: FramePostTrustedData; }; From 8b0c043f0bb537bc246b38a293fdb7c1f4c0eec1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 10 Feb 2024 17:02:56 +0000 Subject: [PATCH 028/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 9cbbe2ec6..7c147ccd6 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.2.2 + +### Patch Changes + +- c323d3b: Makes the payloads Open Frames compatible and allows overriding the OG proxy URL + ## 0.2.1 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index b7545cd5d..b5d7dc4af 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.2.1", + "version": "0.2.2", "keywords": [ "xmtp", "messaging", From 3327b558764006d0dc452dd57166c853fcfb0b9f Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 14 Feb 2024 10:22:30 -0600 Subject: [PATCH 029/107] Add provenance --- packages/frames-client/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 5a282b4b8..a6499a08a 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -95,6 +95,8 @@ }, "packageManager": "yarn@4.0.2", "publishConfig": { - "access": "public" + "access": "public", + "provenance": true, + "registry": "https://registry.npmjs.org/" } } From 09d9b7acdb66c18e24b4d3ea8a950edeec2078af Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:47:31 -0800 Subject: [PATCH 030/107] Add new frames proxy --- packages/frames-client/src/constants.ts | 2 +- packages/frames-client/src/index.test.ts | 41 +++++++----- packages/frames-client/src/index.ts | 56 +++-------------- packages/frames-client/src/proxy.ts | 79 ++++++++++++++++++++++++ packages/frames-client/src/types.ts | 8 ++- 5 files changed, 119 insertions(+), 67 deletions(-) create mode 100644 packages/frames-client/src/proxy.ts diff --git a/packages/frames-client/src/constants.ts b/packages/frames-client/src/constants.ts index 7f54f6e3a..2817cfede 100644 --- a/packages/frames-client/src/constants.ts +++ b/packages/frames-client/src/constants.ts @@ -1,3 +1,3 @@ -export const OG_PROXY_URL = "https://og-proxy.fly.dev"; +export const OPEN_FRAMES_PROXY_URL = "https://open-frames-proxy.fly.dev/"; export const PROTOCOL_VERSION = "2024-02-09"; diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 8599330dd..4b3a39cf7 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -70,21 +70,28 @@ describe("signFrameAction", () => { }); // Will add E2E tests back once we have Frames deployed with the new schema - // it("works e2e", async () => { - // const frameUrl = - // "https://fc-polls-five.vercel.app/polls/01032f47-e976-42ee-9e3d-3aac1324f4b8"; - // const metadata = await FramesClient.readMetadata(frameUrl); - // expect(metadata).toBeDefined(); - // const signedPayload = await framesClient.signFrameAction( - // frameUrl, - // 1, - // "foo", - // "bar", - // ); - // console.log(signedPayload); - // const postUrl = metadata.extractedTags["fc:frame:post_url"]; - // console.log("posting to", postUrl); - // const response = await FramesClient.postToFrame(postUrl, signedPayload); - // console.log(response); - // }); + it("works e2e", async () => { + const frameUrl = + "https://fc-polls-five.vercel.app/polls/01032f47-e976-42ee-9e3d-3aac1324f4b8"; + + const metadata = await framesClient.proxy.readMetadata(frameUrl); + expect(metadata).toBeDefined(); + const signedPayload = await framesClient.signFrameAction({ + frameUrl, + buttonIndex: 1, + conversationTopic: "foo", + participantAccountAddresses: ["amal", "bola"], + }); + const postUrl = metadata.metaTags["fc:frame:post_url"]; + const response = await framesClient.proxy.post(postUrl, signedPayload); + expect(response).toBeDefined(); + expect(response.metaTags["fc:frame"]).toEqual("vNext"); + + const imageUrl = response.metaTags["fc:frame:image"]; + const mediaUrl = framesClient.proxy.mediaUrl(imageUrl); + + const downloadedMedia = await fetch(mediaUrl); + expect(downloadedMedia.ok).toBeTruthy(); + expect(downloadedMedia.headers.get("content-type")).toEqual("image/png"); + }); }); diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts index 55c6927f6..2bab093ca 100644 --- a/packages/frames-client/src/index.ts +++ b/packages/frames-client/src/index.ts @@ -2,61 +2,20 @@ import type { Client } from "@xmtp/xmtp-js"; import { frames } from "@xmtp/proto"; import { sha256 } from "@noble/hashes/sha256"; import Long from "long"; -import { OG_PROXY_URL, PROTOCOL_VERSION } from "./constants"; -import type { - FrameActionInputs, - FramePostPayload, - FramesApiResponse, -} from "./types"; +import { PROTOCOL_VERSION } from "./constants"; +import type { FrameActionInputs, FramePostPayload } from "./types"; import { v1ToV2Bundle } from "./converters"; -import { ApiError } from "./errors"; import { base64Encode, buildOpaqueIdentifier } from "./utils"; +import OpenFramesProxy from "./proxy"; export class FramesClient { xmtpClient: Client; - constructor(xmtpClient: Client) { - this.xmtpClient = xmtpClient; - } - - static async readMetadata( - url: string, - ogProxyUrl = OG_PROXY_URL, - ): Promise { - const response = await fetch( - `${ogProxyUrl}?url=${encodeURIComponent(url)}`, - ); - - if (!response.ok) { - throw new ApiError(`Failed to read metadata for ${url}`, response.status); - } - - return (await response.json()) as FramesApiResponse; - } - - static async postToFrame( - url: string, - payload: FramePostPayload, - ogProxyUrl = OG_PROXY_URL, - ): Promise { - const response = await fetch( - `${ogProxyUrl}?url=${encodeURIComponent(url)}`, - { - method: "POST", - body: JSON.stringify(payload), - headers: { - "Content-Type": "application/json", - }, - }, - ); + proxy: OpenFramesProxy; - if (!response.ok) { - throw new Error( - `Failed to post to frame: ${response.status} ${response.statusText}`, - ); - } - - return (await response.json()) as FramesApiResponse; + constructor(xmtpClient: Client, proxy?: OpenFramesProxy) { + this.xmtpClient = xmtpClient; + this.proxy = proxy || new OpenFramesProxy(); } async signFrameAction(inputs: FrameActionInputs): Promise { @@ -80,6 +39,7 @@ export class FramesClient { walletAddress: this.xmtpClient.address, url: frameUrl, timestamp: now, + unixTimestamp: now, }, trustedData: { messageBytes: base64Encode(signedAction), diff --git a/packages/frames-client/src/proxy.ts b/packages/frames-client/src/proxy.ts new file mode 100644 index 000000000..1af5b05ce --- /dev/null +++ b/packages/frames-client/src/proxy.ts @@ -0,0 +1,79 @@ +import { OPEN_FRAMES_PROXY_URL } from "./constants"; +import { ApiError } from "./errors"; +import type { + FramePostPayload, + FramesApiRedirectResponse, + FramesApiResponse, +} from "./types"; + +export default class OpenFramesProxy { + baseUrl: string; + + constructor(baseUrl: string = OPEN_FRAMES_PROXY_URL) { + this.baseUrl = baseUrl; + } + + async readMetadata(url: string): Promise { + const response = await fetch( + `${this.baseUrl}?url=${encodeURIComponent(url)}`, + ); + + if (!response.ok) { + throw new ApiError(`Failed to read metadata for ${url}`, response.status); + } + + return (await response.json()) as FramesApiResponse; + } + + async post( + url: string, + payload: FramePostPayload, + ): Promise { + const response = await fetch( + `${this.baseUrl}?url=${encodeURIComponent(url)}`, + { + method: "POST", + body: JSON.stringify(payload), + headers: { + "Content-Type": "application/json", + }, + }, + ); + + if (!response.ok) { + throw new Error( + `Failed to post to frame: ${response.status} ${response.statusText}`, + ); + } + + return (await response.json()) as FramesApiResponse; + } + + async postRedirect( + url: string, + payload: FramePostPayload, + ): Promise { + const response = await fetch( + `${this.baseUrl}redirect?url=${encodeURIComponent(url)}`, + { + method: "POST", + body: JSON.stringify(payload), + headers: { + "Content-Type": "application/json", + }, + }, + ); + + if (!response.ok) { + throw new Error( + `Failed to post to frame: ${response.status} ${response.statusText}`, + ); + } + + return (await response.json()) as FramesApiRedirectResponse; + } + + mediaUrl(url: string): string { + return `${this.baseUrl}media?url=${encodeURIComponent(url)}`; + } +} diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index 61238a22c..04620b11b 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -2,12 +2,18 @@ import type { OpenFramesUntrustedData } from "@open-frames/types"; export type FramesApiResponse = { url: string; - extractedTags: { [k: string]: string }; + metaTags: { [k: string]: string }; +}; + +export type FramesApiRedirectResponse = { + originalUrl: string; + redirectedTo: string; }; export type FramePostUntrustedData = OpenFramesUntrustedData & { walletAddress: string; // Untrusted version of the wallet address opaqueConversationIdentifier: string; // A hash of the conversation topic and the participants + unixTimestamp: number; }; export type FramePostTrustedData = { From 292b8b315dd0f11994705e427016c7039d3bc746 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:56:46 -0800 Subject: [PATCH 031/107] Update README --- packages/frames-client/README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index be702b516..03dddf7f6 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -9,7 +9,12 @@ const framesClient = new FramesClient(xmtpClient); const frameUrl = "https://www.myframe.xyz"; // Read data from a frame -const frameMetadata = await readMetadata(frameUrl); +const frameMetadata = await framesClient.proxy.readMetadata(frameUrl); + +// Get a proxied image URL, which you can use directly in an tag +const imageUrl = framesClient.proxy.mediaUrl( + frameMetadata.metaTags["fc:frame:image"], +); // Handle a click to button 2 from a conversation with topic "/xmtp/0/123" and participant addresses "abc" and "xyz" const payload = await signFrameAction({ @@ -18,5 +23,12 @@ const payload = await signFrameAction({ conversationTopic: "/xmtp/0/123", participantAccountAddresses: ["abc", "xyz"], }); -const updatedFrameMetadata = await postToFrame(frameUrl, payload); + +// If the button action type was `post` +const updatedFrameMetadata = await framesClient.proxy.post(frameUrl, payload); +// If the button action type was `post_redirect` +const { redirectedTo } = await framesClient.proxy.postRedirect( + frameUrl, + payload, +); ``` From 8d72d77e8efb21c054306f46e8174f071c2b0467 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Wed, 14 Feb 2024 17:45:59 -0800 Subject: [PATCH 032/107] Rename back --- packages/frames-client/src/index.test.ts | 6 +++--- packages/frames-client/src/types.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 4b3a39cf7..4c993227d 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -82,12 +82,12 @@ describe("signFrameAction", () => { conversationTopic: "foo", participantAccountAddresses: ["amal", "bola"], }); - const postUrl = metadata.metaTags["fc:frame:post_url"]; + const postUrl = metadata.extractedTags["fc:frame:post_url"]; const response = await framesClient.proxy.post(postUrl, signedPayload); expect(response).toBeDefined(); - expect(response.metaTags["fc:frame"]).toEqual("vNext"); + expect(response.extractedTags["fc:frame"]).toEqual("vNext"); - const imageUrl = response.metaTags["fc:frame:image"]; + const imageUrl = response.extractedTags["fc:frame:image"]; const mediaUrl = framesClient.proxy.mediaUrl(imageUrl); const downloadedMedia = await fetch(mediaUrl); diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index 04620b11b..d3f27fc2d 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -2,7 +2,7 @@ import type { OpenFramesUntrustedData } from "@open-frames/types"; export type FramesApiResponse = { url: string; - metaTags: { [k: string]: string }; + extractedTags: { [k: string]: string }; }; export type FramesApiRedirectResponse = { From f810a05b7e6710929898e30fb66525dcaa34ad1a Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Wed, 14 Feb 2024 17:48:32 -0800 Subject: [PATCH 033/107] Longer timeout --- packages/frames-client/src/index.test.ts | 47 +++++++++++++----------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 4c993227d..58f2b3590 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -70,28 +70,33 @@ describe("signFrameAction", () => { }); // Will add E2E tests back once we have Frames deployed with the new schema - it("works e2e", async () => { - const frameUrl = - "https://fc-polls-five.vercel.app/polls/01032f47-e976-42ee-9e3d-3aac1324f4b8"; + it( + "works e2e", + async () => { + const frameUrl = + "https://fc-polls-five.vercel.app/polls/01032f47-e976-42ee-9e3d-3aac1324f4b8"; - const metadata = await framesClient.proxy.readMetadata(frameUrl); - expect(metadata).toBeDefined(); - const signedPayload = await framesClient.signFrameAction({ - frameUrl, - buttonIndex: 1, - conversationTopic: "foo", - participantAccountAddresses: ["amal", "bola"], - }); - const postUrl = metadata.extractedTags["fc:frame:post_url"]; - const response = await framesClient.proxy.post(postUrl, signedPayload); - expect(response).toBeDefined(); - expect(response.extractedTags["fc:frame"]).toEqual("vNext"); + const metadata = await framesClient.proxy.readMetadata(frameUrl); + expect(metadata).toBeDefined(); + const signedPayload = await framesClient.signFrameAction({ + frameUrl, + buttonIndex: 1, + conversationTopic: "foo", + participantAccountAddresses: ["amal", "bola"], + }); + const postUrl = metadata.extractedTags["fc:frame:post_url"]; + const response = await framesClient.proxy.post(postUrl, signedPayload); + expect(response).toBeDefined(); + expect(response.extractedTags["fc:frame"]).toEqual("vNext"); - const imageUrl = response.extractedTags["fc:frame:image"]; - const mediaUrl = framesClient.proxy.mediaUrl(imageUrl); + const imageUrl = response.extractedTags["fc:frame:image"]; + const mediaUrl = framesClient.proxy.mediaUrl(imageUrl); - const downloadedMedia = await fetch(mediaUrl); - expect(downloadedMedia.ok).toBeTruthy(); - expect(downloadedMedia.headers.get("content-type")).toEqual("image/png"); - }); + const downloadedMedia = await fetch(mediaUrl); + expect(downloadedMedia.ok).toBeTruthy(); + expect(downloadedMedia.headers.get("content-type")).toEqual("image/png"); + }, + // Add a long timeout because Vercel cold starts can be slow + { timeout: 20000 }, + ); }); From 83d9b33f526ebb3e28418fcfe0ce9d7507a9ad9e Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Wed, 14 Feb 2024 18:48:43 -0800 Subject: [PATCH 034/107] Add RN support --- packages/frames-client/src/index.ts | 56 +++++++++++++++++++++++------ packages/frames-client/src/types.ts | 11 ++++++ packages/frames-client/src/utils.ts | 13 ++++++- 3 files changed, 68 insertions(+), 12 deletions(-) diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts index 2bab093ca..6356dc3ef 100644 --- a/packages/frames-client/src/index.ts +++ b/packages/frames-client/src/index.ts @@ -1,23 +1,61 @@ import type { Client } from "@xmtp/xmtp-js"; -import { frames } from "@xmtp/proto"; +import { + signature as signatureProto, + publicKey as publicKeyProto, + frames, +} from "@xmtp/proto"; import { sha256 } from "@noble/hashes/sha256"; import Long from "long"; import { PROTOCOL_VERSION } from "./constants"; -import type { FrameActionInputs, FramePostPayload } from "./types"; +import type { + FrameActionInputs, + FramePostPayload, + ReactNativeClient, +} from "./types"; import { v1ToV2Bundle } from "./converters"; -import { base64Encode, buildOpaqueIdentifier } from "./utils"; +import { + base64Encode, + buildOpaqueIdentifier, + isReactNativeClient, +} from "./utils"; import OpenFramesProxy from "./proxy"; export class FramesClient { - xmtpClient: Client; + xmtpClient: Client | ReactNativeClient; proxy: OpenFramesProxy; - constructor(xmtpClient: Client, proxy?: OpenFramesProxy) { + constructor(xmtpClient: Client | ReactNativeClient, proxy?: OpenFramesProxy) { this.xmtpClient = xmtpClient; this.proxy = proxy || new OpenFramesProxy(); } + private async signDigest( + digest: Uint8Array, + ): Promise { + if (isReactNativeClient(this.xmtpClient)) { + const signatureBytes = await this.xmtpClient.sign(digest, { + kind: "identity", + }); + return signatureProto.Signature.decode(signatureBytes); + } + + return this.xmtpClient.keystore.signDigest({ + digest, + identityKey: true, + prekeyIndex: undefined, + }); + } + + private async getPublicKeyBundle(): Promise { + if (isReactNativeClient(this.xmtpClient)) { + const bundleBytes = await this.xmtpClient.exportPublicKeyBundle(); + return publicKeyProto.PublicKeyBundle.decode(bundleBytes); + } + + return this.xmtpClient.keystore.getPublicKeyBundle(); + } + async signFrameAction(inputs: FrameActionInputs): Promise { const opaqueConversationIdentifier = buildOpaqueIdentifier(inputs); const { frameUrl, buttonIndex } = inputs; @@ -53,13 +91,9 @@ export class FramesClient { const actionBody = frames.FrameActionBody.encode(actionBodyInputs).finish(); const digest = sha256(actionBody); - const signature = await this.xmtpClient.keystore.signDigest({ - digest, - identityKey: true, - prekeyIndex: undefined, - }); + const signature = await this.signDigest(digest); - const publicKeyBundle = await this.xmtpClient.keystore.getPublicKeyBundle(); + const publicKeyBundle = await this.getPublicKeyBundle(); return frames.FrameAction.encode({ actionBody, diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index d3f27fc2d..4732bd7b1 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -42,3 +42,14 @@ export type FrameActionInputs = { frameUrl: string; buttonIndex: number; } & ConversationActionInputs; + +type KeyType = { + kind: "identity" | "prekey"; + prekeyIndex?: number | undefined; +}; + +export type ReactNativeClient = { + address: string; + exportPublicKeyBundle(): Promise; + sign(digest: Uint8Array, type: KeyType): Promise; +}; diff --git a/packages/frames-client/src/utils.ts b/packages/frames-client/src/utils.ts index 3e0c8bab2..55a05c0cc 100644 --- a/packages/frames-client/src/utils.ts +++ b/packages/frames-client/src/utils.ts @@ -1,6 +1,7 @@ import { fetcher } from "@xmtp/proto"; import { sha256 } from "@noble/hashes/sha256"; -import type { FrameActionInputs } from "./types"; +import type { Client } from "@xmtp/xmtp-js"; +import type { FrameActionInputs, ReactNativeClient } from "./types"; import { InvalidArgumentsError } from "./errors"; const { b64Encode } = fetcher; @@ -42,3 +43,13 @@ export function buildOpaqueIdentifier(inputs: FrameActionInputs): string { ), ); } + +export function isReactNativeClient( + client: Client | ReactNativeClient, +): client is ReactNativeClient { + const assertedClient = client as ReactNativeClient; + return ( + typeof assertedClient.sign === "function" && + typeof assertedClient.exportPublicKeyBundle === "function" + ); +} From 9b480ad7c9fbf8c19d9d556b8ffbe5babac76676 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Wed, 14 Feb 2024 18:51:14 -0800 Subject: [PATCH 035/107] Ensure no keystore --- packages/frames-client/src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/src/utils.ts b/packages/frames-client/src/utils.ts index 55a05c0cc..78bc13ec3 100644 --- a/packages/frames-client/src/utils.ts +++ b/packages/frames-client/src/utils.ts @@ -50,6 +50,7 @@ export function isReactNativeClient( const assertedClient = client as ReactNativeClient; return ( typeof assertedClient.sign === "function" && - typeof assertedClient.exportPublicKeyBundle === "function" + typeof assertedClient.exportPublicKeyBundle === "function" && + !("keystore" in client) ); } From 4e3a0db806eb0f3e7f90e9de8d6bd908e36ee658 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Wed, 14 Feb 2024 18:53:25 -0800 Subject: [PATCH 036/107] Flip around order --- packages/frames-client/src/index.ts | 52 ++++++++++++++--------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts index 6356dc3ef..78fd8c548 100644 --- a/packages/frames-client/src/index.ts +++ b/packages/frames-client/src/index.ts @@ -30,32 +30,6 @@ export class FramesClient { this.proxy = proxy || new OpenFramesProxy(); } - private async signDigest( - digest: Uint8Array, - ): Promise { - if (isReactNativeClient(this.xmtpClient)) { - const signatureBytes = await this.xmtpClient.sign(digest, { - kind: "identity", - }); - return signatureProto.Signature.decode(signatureBytes); - } - - return this.xmtpClient.keystore.signDigest({ - digest, - identityKey: true, - prekeyIndex: undefined, - }); - } - - private async getPublicKeyBundle(): Promise { - if (isReactNativeClient(this.xmtpClient)) { - const bundleBytes = await this.xmtpClient.exportPublicKeyBundle(); - return publicKeyProto.PublicKeyBundle.decode(bundleBytes); - } - - return this.xmtpClient.keystore.getPublicKeyBundle(); - } - async signFrameAction(inputs: FrameActionInputs): Promise { const opaqueConversationIdentifier = buildOpaqueIdentifier(inputs); const { frameUrl, buttonIndex } = inputs; @@ -101,4 +75,30 @@ export class FramesClient { signedPublicKeyBundle: v1ToV2Bundle(publicKeyBundle), }).finish(); } + + private async signDigest( + digest: Uint8Array, + ): Promise { + if (isReactNativeClient(this.xmtpClient)) { + const signatureBytes = await this.xmtpClient.sign(digest, { + kind: "identity", + }); + return signatureProto.Signature.decode(signatureBytes); + } + + return this.xmtpClient.keystore.signDigest({ + digest, + identityKey: true, + prekeyIndex: undefined, + }); + } + + private async getPublicKeyBundle(): Promise { + if (isReactNativeClient(this.xmtpClient)) { + const bundleBytes = await this.xmtpClient.exportPublicKeyBundle(); + return publicKeyProto.PublicKeyBundle.decode(bundleBytes); + } + + return this.xmtpClient.keystore.getPublicKeyBundle(); + } } From ad38807a6c921080b0b17674aee187ba4673c314 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 15 Feb 2024 04:29:54 +0000 Subject: [PATCH 037/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 7c147ccd6..2d9793731 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.3.0 + +### Minor Changes + +- 65a7cc1: Add new Frames Proxy service and support for redirects and image URLs + ## 0.2.2 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index b5d7dc4af..cc1874dab 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.2.2", + "version": "0.3.0", "keywords": [ "xmtp", "messaging", From 3271f0dfb0493a685c0c3451bc0cf3133549a39f Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 15 Feb 2024 10:11:19 -0800 Subject: [PATCH 038/107] Check both the walletEcdsaCompact and the ecdsaCompact --- packages/frames-client/src/converters.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/src/converters.ts b/packages/frames-client/src/converters.ts index 5266dae53..709385ca7 100644 --- a/packages/frames-client/src/converters.ts +++ b/packages/frames-client/src/converters.ts @@ -18,7 +18,8 @@ function toSignedPublicKey( let v1Signature = v1Key.signature; if (signedByWallet) { v1Signature = { - walletEcdsaCompact: v1Signature.ecdsaCompact, + walletEcdsaCompact: + v1Signature.walletEcdsaCompact || v1Signature.ecdsaCompact, ecdsaCompact: undefined, }; } From a359725f607d099bf7822edfc9c3e6cfba3ac260 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 15 Feb 2024 18:38:18 +0000 Subject: [PATCH 039/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 2d9793731..ac8f1f12c 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.3.1 + +### Patch Changes + +- 71cb3a3: Fix bug with identity key translation + ## 0.3.0 ### Minor Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index cc1874dab..90bdad9b1 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.3.0", + "version": "0.3.1", "keywords": [ "xmtp", "messaging", From 710bf497da61422fae375a216000b0234e058f15 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:13:00 -0800 Subject: [PATCH 040/107] Change up exports --- packages/frames-client/src/client.ts | 104 ++++++++++++++++++++++ packages/frames-client/src/index.test.ts | 2 +- packages/frames-client/src/index.ts | 108 +---------------------- 3 files changed, 109 insertions(+), 105 deletions(-) create mode 100644 packages/frames-client/src/client.ts diff --git a/packages/frames-client/src/client.ts b/packages/frames-client/src/client.ts new file mode 100644 index 000000000..78fd8c548 --- /dev/null +++ b/packages/frames-client/src/client.ts @@ -0,0 +1,104 @@ +import type { Client } from "@xmtp/xmtp-js"; +import { + signature as signatureProto, + publicKey as publicKeyProto, + frames, +} from "@xmtp/proto"; +import { sha256 } from "@noble/hashes/sha256"; +import Long from "long"; +import { PROTOCOL_VERSION } from "./constants"; +import type { + FrameActionInputs, + FramePostPayload, + ReactNativeClient, +} from "./types"; +import { v1ToV2Bundle } from "./converters"; +import { + base64Encode, + buildOpaqueIdentifier, + isReactNativeClient, +} from "./utils"; +import OpenFramesProxy from "./proxy"; + +export class FramesClient { + xmtpClient: Client | ReactNativeClient; + + proxy: OpenFramesProxy; + + constructor(xmtpClient: Client | ReactNativeClient, proxy?: OpenFramesProxy) { + this.xmtpClient = xmtpClient; + this.proxy = proxy || new OpenFramesProxy(); + } + + async signFrameAction(inputs: FrameActionInputs): Promise { + const opaqueConversationIdentifier = buildOpaqueIdentifier(inputs); + const { frameUrl, buttonIndex } = inputs; + const now = Date.now(); + const toSign: frames.FrameActionBody = { + frameUrl, + buttonIndex, + opaqueConversationIdentifier, + timestamp: Long.fromNumber(now), + }; + + const signedAction = await this.buildSignedFrameAction(toSign); + + return { + clientProtocol: `xmtp@${PROTOCOL_VERSION}`, + untrustedData: { + buttonIndex, + opaqueConversationIdentifier, + walletAddress: this.xmtpClient.address, + url: frameUrl, + timestamp: now, + unixTimestamp: now, + }, + trustedData: { + messageBytes: base64Encode(signedAction), + }, + }; + } + + private async buildSignedFrameAction( + actionBodyInputs: frames.FrameActionBody, + ) { + const actionBody = frames.FrameActionBody.encode(actionBodyInputs).finish(); + + const digest = sha256(actionBody); + const signature = await this.signDigest(digest); + + const publicKeyBundle = await this.getPublicKeyBundle(); + + return frames.FrameAction.encode({ + actionBody, + signature, + signedPublicKeyBundle: v1ToV2Bundle(publicKeyBundle), + }).finish(); + } + + private async signDigest( + digest: Uint8Array, + ): Promise { + if (isReactNativeClient(this.xmtpClient)) { + const signatureBytes = await this.xmtpClient.sign(digest, { + kind: "identity", + }); + return signatureProto.Signature.decode(signatureBytes); + } + + return this.xmtpClient.keystore.signDigest({ + digest, + identityKey: true, + prekeyIndex: undefined, + }); + } + + private async getPublicKeyBundle(): Promise { + if (isReactNativeClient(this.xmtpClient)) { + const bundleBytes = await this.xmtpClient.exportPublicKeyBundle(); + return publicKeyProto.PublicKeyBundle.decode(bundleBytes); + } + + return this.xmtpClient.keystore.getPublicKeyBundle(); + } +} diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 58f2b3590..def05b141 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -3,7 +3,7 @@ import { Wallet } from "ethers"; import { frames, fetcher } from "@xmtp/proto"; import { it, expect, describe, beforeEach } from "vitest"; import { sha256 } from "@noble/hashes/sha256"; -import { FramesClient } from "."; +import { FramesClient } from "./client"; const { b64Decode } = fetcher; diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts index 78fd8c548..a763bd2b9 100644 --- a/packages/frames-client/src/index.ts +++ b/packages/frames-client/src/index.ts @@ -1,104 +1,4 @@ -import type { Client } from "@xmtp/xmtp-js"; -import { - signature as signatureProto, - publicKey as publicKeyProto, - frames, -} from "@xmtp/proto"; -import { sha256 } from "@noble/hashes/sha256"; -import Long from "long"; -import { PROTOCOL_VERSION } from "./constants"; -import type { - FrameActionInputs, - FramePostPayload, - ReactNativeClient, -} from "./types"; -import { v1ToV2Bundle } from "./converters"; -import { - base64Encode, - buildOpaqueIdentifier, - isReactNativeClient, -} from "./utils"; -import OpenFramesProxy from "./proxy"; - -export class FramesClient { - xmtpClient: Client | ReactNativeClient; - - proxy: OpenFramesProxy; - - constructor(xmtpClient: Client | ReactNativeClient, proxy?: OpenFramesProxy) { - this.xmtpClient = xmtpClient; - this.proxy = proxy || new OpenFramesProxy(); - } - - async signFrameAction(inputs: FrameActionInputs): Promise { - const opaqueConversationIdentifier = buildOpaqueIdentifier(inputs); - const { frameUrl, buttonIndex } = inputs; - const now = Date.now(); - const toSign: frames.FrameActionBody = { - frameUrl, - buttonIndex, - opaqueConversationIdentifier, - timestamp: Long.fromNumber(now), - }; - - const signedAction = await this.buildSignedFrameAction(toSign); - - return { - clientProtocol: `xmtp@${PROTOCOL_VERSION}`, - untrustedData: { - buttonIndex, - opaqueConversationIdentifier, - walletAddress: this.xmtpClient.address, - url: frameUrl, - timestamp: now, - unixTimestamp: now, - }, - trustedData: { - messageBytes: base64Encode(signedAction), - }, - }; - } - - private async buildSignedFrameAction( - actionBodyInputs: frames.FrameActionBody, - ) { - const actionBody = frames.FrameActionBody.encode(actionBodyInputs).finish(); - - const digest = sha256(actionBody); - const signature = await this.signDigest(digest); - - const publicKeyBundle = await this.getPublicKeyBundle(); - - return frames.FrameAction.encode({ - actionBody, - signature, - signedPublicKeyBundle: v1ToV2Bundle(publicKeyBundle), - }).finish(); - } - - private async signDigest( - digest: Uint8Array, - ): Promise { - if (isReactNativeClient(this.xmtpClient)) { - const signatureBytes = await this.xmtpClient.sign(digest, { - kind: "identity", - }); - return signatureProto.Signature.decode(signatureBytes); - } - - return this.xmtpClient.keystore.signDigest({ - digest, - identityKey: true, - prekeyIndex: undefined, - }); - } - - private async getPublicKeyBundle(): Promise { - if (isReactNativeClient(this.xmtpClient)) { - const bundleBytes = await this.xmtpClient.exportPublicKeyBundle(); - return publicKeyProto.PublicKeyBundle.decode(bundleBytes); - } - - return this.xmtpClient.keystore.getPublicKeyBundle(); - } -} +export * from "./types"; +export * from "./constants"; +export { FramesClient } from "./client"; +export { default as OpenFramesProxy } from "./proxy"; From 2dd05e28ccd62765941e2fc5b12fc4427a3a8961 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 15 Feb 2024 21:28:03 +0000 Subject: [PATCH 041/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index ac8f1f12c..f8f164eaa 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.3.2 + +### Patch Changes + +- b8297be: Add more exports + ## 0.3.1 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 90bdad9b1..2684cd723 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.3.1", + "version": "0.3.2", "keywords": [ "xmtp", "messaging", From 3e06530e24da6ab435a52582592508e0f510a9ff Mon Sep 17 00:00:00 2001 From: Fabri Date: Fri, 16 Feb 2024 10:26:07 -0300 Subject: [PATCH 042/107] Update README.md Added the distinction for the Frame postUrl --- packages/frames-client/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index 03dddf7f6..b4c2fe30a 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -7,6 +7,7 @@ const xmtpClient = await Client.create(wallet); const framesClient = new FramesClient(xmtpClient); const frameUrl = "https://www.myframe.xyz"; +const framePostUrl = "https://www.myframe.xyz/api/post"; //fc:frame:post_url // Read data from a frame const frameMetadata = await framesClient.proxy.readMetadata(frameUrl); @@ -25,10 +26,10 @@ const payload = await signFrameAction({ }); // If the button action type was `post` -const updatedFrameMetadata = await framesClient.proxy.post(frameUrl, payload); +const updatedFrameMetadata = await framesClient.proxy.post(framePostUrl, payload); // If the button action type was `post_redirect` const { redirectedTo } = await framesClient.proxy.postRedirect( - frameUrl, + framePostUrl, payload, ); ``` From 0b760e56b62e44181ca62514f7f33cfba8055022 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Fri, 16 Feb 2024 14:00:32 -0600 Subject: [PATCH 043/107] Upgrade to JS SDK `11.3.12` --- packages/frames-client/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index a6499a08a..c1a8f2eec 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -74,7 +74,7 @@ "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", - "@xmtp/xmtp-js": "^11.3.7", + "@xmtp/xmtp-js": "^11.3.12", "eslint": "^8.56.0", "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.10.0", From 434a21b614c9287fa572c580b50a2501c1c95a42 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Tue, 20 Feb 2024 20:28:47 -0800 Subject: [PATCH 044/107] Use new OpenFrames proxy service --- packages/frames-client/package.json | 1 + packages/frames-client/src/constants.ts | 2 +- packages/frames-client/src/proxy.ts | 65 ++++--------------------- packages/frames-client/src/types.ts | 14 +++--- 4 files changed, 18 insertions(+), 64 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 0cd5506ad..1d187e6ac 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -67,6 +67,7 @@ }, "dependencies": { "@noble/hashes": "^1.3.3", + "@open-frames/proxy-client": "^0.1.0", "@xmtp/proto": "3.41.0-beta.5", "long": "^5.2.3" }, diff --git a/packages/frames-client/src/constants.ts b/packages/frames-client/src/constants.ts index 2817cfede..24c94df51 100644 --- a/packages/frames-client/src/constants.ts +++ b/packages/frames-client/src/constants.ts @@ -1,3 +1,3 @@ -export const OPEN_FRAMES_PROXY_URL = "https://open-frames-proxy.fly.dev/"; +export const OPEN_FRAMES_PROXY_URL = "https://frames.xmtp.chat/"; export const PROTOCOL_VERSION = "2024-02-09"; diff --git a/packages/frames-client/src/proxy.ts b/packages/frames-client/src/proxy.ts index 1af5b05ce..252138fd5 100644 --- a/packages/frames-client/src/proxy.ts +++ b/packages/frames-client/src/proxy.ts @@ -1,5 +1,5 @@ +import { OpenFramesProxy as BaseProxy } from "@open-frames/proxy-client"; import { OPEN_FRAMES_PROXY_URL } from "./constants"; -import { ApiError } from "./errors"; import type { FramePostPayload, FramesApiRedirectResponse, @@ -7,73 +7,28 @@ import type { } from "./types"; export default class OpenFramesProxy { - baseUrl: string; + inner: BaseProxy; constructor(baseUrl: string = OPEN_FRAMES_PROXY_URL) { - this.baseUrl = baseUrl; + this.inner = new BaseProxy(baseUrl); } - async readMetadata(url: string): Promise { - const response = await fetch( - `${this.baseUrl}?url=${encodeURIComponent(url)}`, - ); - - if (!response.ok) { - throw new ApiError(`Failed to read metadata for ${url}`, response.status); - } - - return (await response.json()) as FramesApiResponse; + readMetadata(url: string): Promise { + return this.inner.readMetadata(url); } - async post( - url: string, - payload: FramePostPayload, - ): Promise { - const response = await fetch( - `${this.baseUrl}?url=${encodeURIComponent(url)}`, - { - method: "POST", - body: JSON.stringify(payload), - headers: { - "Content-Type": "application/json", - }, - }, - ); - - if (!response.ok) { - throw new Error( - `Failed to post to frame: ${response.status} ${response.statusText}`, - ); - } - - return (await response.json()) as FramesApiResponse; + post(url: string, payload: FramePostPayload): Promise { + return this.inner.post(url, payload); } - async postRedirect( + postRedirect( url: string, payload: FramePostPayload, ): Promise { - const response = await fetch( - `${this.baseUrl}redirect?url=${encodeURIComponent(url)}`, - { - method: "POST", - body: JSON.stringify(payload), - headers: { - "Content-Type": "application/json", - }, - }, - ); - - if (!response.ok) { - throw new Error( - `Failed to post to frame: ${response.status} ${response.statusText}`, - ); - } - - return (await response.json()) as FramesApiRedirectResponse; + return this.inner.postRedirect(url, payload); } mediaUrl(url: string): string { - return `${this.baseUrl}media?url=${encodeURIComponent(url)}`; + return this.inner.mediaUrl(url); } } diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index 4732bd7b1..f53041ba8 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -1,14 +1,12 @@ import type { OpenFramesUntrustedData } from "@open-frames/types"; +import type { + GetMetadataResponse, + PostRedirectResponse, +} from "@open-frames/proxy-client"; -export type FramesApiResponse = { - url: string; - extractedTags: { [k: string]: string }; -}; +export type FramesApiResponse = GetMetadataResponse; -export type FramesApiRedirectResponse = { - originalUrl: string; - redirectedTo: string; -}; +export type FramesApiRedirectResponse = PostRedirectResponse; export type FramePostUntrustedData = OpenFramesUntrustedData & { walletAddress: string; // Untrusted version of the wallet address From e1e2db58cd572b1449c38a4d1413ac50993b83e4 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Tue, 20 Feb 2024 20:32:36 -0800 Subject: [PATCH 045/107] Add better test --- packages/frames-client/src/index.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index def05b141..43fa5d5be 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -78,6 +78,25 @@ describe("signFrameAction", () => { const metadata = await framesClient.proxy.readMetadata(frameUrl); expect(metadata).toBeDefined(); + expect(metadata.frameInfo).toMatchObject({ + acceptedClients: { + farcaster: "vNext", + }, + buttons: { + "1": { + label: "Yes", + }, + "2": { + label: "No", + }, + }, + image: { + content: + "https://fc-polls-five.vercel.app/api/image?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", + }, + postUrl: + "https://fc-polls-five.vercel.app/api/vote?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", + }); const signedPayload = await framesClient.signFrameAction({ frameUrl, buttonIndex: 1, From 14319dc8142a01f379ac948c62d3eb6897ee3538 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Tue, 20 Feb 2024 23:20:13 -0800 Subject: [PATCH 046/107] Use latest proxy client --- packages/frames-client/package.json | 10 +++------- packages/frames-client/src/index.test.ts | 1 - packages/frames-client/src/proxy.ts | 2 +- packages/frames-client/tsconfig.json | 5 ----- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 1d187e6ac..3215bb133 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -9,11 +9,7 @@ "js", "ts", "javascript", - "typescript", - "react", - "reactjs", - "react-hooks", - "hooks" + "typescript" ], "homepage": "https://github.com/xmtp/xmtp-web", "bugs": { @@ -67,12 +63,12 @@ }, "dependencies": { "@noble/hashes": "^1.3.3", - "@open-frames/proxy-client": "^0.1.0", + "@open-frames/proxy-client": "^0.1.2", "@xmtp/proto": "3.41.0-beta.5", "long": "^5.2.3" }, "devDependencies": { - "@open-frames/types": "^0.0.5", + "@open-frames/types": "^0.0.6", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 43fa5d5be..b6657c43b 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -75,7 +75,6 @@ describe("signFrameAction", () => { async () => { const frameUrl = "https://fc-polls-five.vercel.app/polls/01032f47-e976-42ee-9e3d-3aac1324f4b8"; - const metadata = await framesClient.proxy.readMetadata(frameUrl); expect(metadata).toBeDefined(); expect(metadata.frameInfo).toMatchObject({ diff --git a/packages/frames-client/src/proxy.ts b/packages/frames-client/src/proxy.ts index 252138fd5..7a7970a91 100644 --- a/packages/frames-client/src/proxy.ts +++ b/packages/frames-client/src/proxy.ts @@ -13,7 +13,7 @@ export default class OpenFramesProxy { this.inner = new BaseProxy(baseUrl); } - readMetadata(url: string): Promise { + readMetadata(url: string) { return this.inner.readMetadata(url); } diff --git a/packages/frames-client/tsconfig.json b/packages/frames-client/tsconfig.json index 56054a9ae..1d523acc6 100644 --- a/packages/frames-client/tsconfig.json +++ b/packages/frames-client/tsconfig.json @@ -1,9 +1,4 @@ { "extends": "@xmtp/tsconfig/react-sdk.json", "include": ["src", ".eslintrc.cjs", "vitest.config.ts", "vitest.setup.ts"], - "compilerOptions": { - "paths": { - "@/*": ["./src/*"], - }, - }, } From ddbe2ced00aac6cfd8dc4fdf8bc91a31be2fac1d Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Tue, 20 Feb 2024 23:28:36 -0800 Subject: [PATCH 047/107] Add open frames proxy dev --- packages/frames-client/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 3215bb133..2fd1800b1 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -68,6 +68,7 @@ "long": "^5.2.3" }, "devDependencies": { + "@open-frames/proxy": "^0.0.3", "@open-frames/types": "^0.0.6", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", From c13831253a995dcb5b6e03fe4f97547dd3a1f17f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 21 Feb 2024 15:37:30 +0000 Subject: [PATCH 048/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index f8f164eaa..7dfc571b0 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.4.0 + +### Minor Changes + +- 893bf17: Use new Frames Proxy with support for frameInfo field + ## 0.3.2 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 2fd1800b1..8c00058a2 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.3.2", + "version": "0.4.0", "keywords": [ "xmtp", "messaging", From 10c0e8a980936f5cc0ce2ca9bd500196f474d514 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:02:19 -0800 Subject: [PATCH 049/107] Use 0.2.0 of proxy-client --- packages/frames-client/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 2fd1800b1..7bcc0cac6 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -63,12 +63,11 @@ }, "dependencies": { "@noble/hashes": "^1.3.3", - "@open-frames/proxy-client": "^0.1.2", + "@open-frames/proxy-client": "^0.2.0", "@xmtp/proto": "3.41.0-beta.5", "long": "^5.2.3" }, "devDependencies": { - "@open-frames/proxy": "^0.0.3", "@open-frames/types": "^0.0.6", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", From bc86f67665525adc0e5c28d818c414e66d740099 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 23 Feb 2024 00:43:48 +0000 Subject: [PATCH 050/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 7dfc571b0..1331014ee 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.4.1 + +### Patch Changes + +- f822a36: Upgrade to 0.2.0 of the Frames Proxy client + ## 0.4.0 ### Minor Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 310a88750..b2b369cf7 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.4.0", + "version": "0.4.1", "keywords": [ "xmtp", "messaging", From e09a7646c1a34965d80c59b557f5d8ca0a1eddbf Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 22 Feb 2024 23:06:27 -0800 Subject: [PATCH 051/107] Add support for inputText --- packages/frames-client/package.json | 2 +- packages/frames-client/src/client.ts | 8 ++++++-- packages/frames-client/src/types.ts | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index b2b369cf7..e62e5845e 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -64,7 +64,7 @@ "dependencies": { "@noble/hashes": "^1.3.3", "@open-frames/proxy-client": "^0.2.0", - "@xmtp/proto": "3.41.0-beta.5", + "@xmtp/proto": "3.44.0", "long": "^5.2.3" }, "devDependencies": { diff --git a/packages/frames-client/src/client.ts b/packages/frames-client/src/client.ts index 78fd8c548..d9be0ee48 100644 --- a/packages/frames-client/src/client.ts +++ b/packages/frames-client/src/client.ts @@ -32,13 +32,16 @@ export class FramesClient { async signFrameAction(inputs: FrameActionInputs): Promise { const opaqueConversationIdentifier = buildOpaqueIdentifier(inputs); - const { frameUrl, buttonIndex } = inputs; + const { frameUrl, buttonIndex, inputText } = inputs; const now = Date.now(); + const timestamp = Long.fromNumber(now); const toSign: frames.FrameActionBody = { frameUrl, buttonIndex, opaqueConversationIdentifier, - timestamp: Long.fromNumber(now), + timestamp, + inputText: inputText || "", + unixTimestamp: now, }; const signedAction = await this.buildSignedFrameAction(toSign); @@ -49,6 +52,7 @@ export class FramesClient { buttonIndex, opaqueConversationIdentifier, walletAddress: this.xmtpClient.address, + inputText, url: frameUrl, timestamp: now, unixTimestamp: now, diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index f53041ba8..9c586ad36 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -39,6 +39,7 @@ type ConversationActionInputs = DmActionInputs | GroupActionInputs; export type FrameActionInputs = { frameUrl: string; buttonIndex: number; + inputText?: string; } & ConversationActionInputs; type KeyType = { From 9b98aa2c55071a1d3c24e6e8e85564034ec0cbc7 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Fri, 23 Feb 2024 00:30:22 -0800 Subject: [PATCH 052/107] Support data URIs --- packages/frames-client/src/proxy.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/frames-client/src/proxy.ts b/packages/frames-client/src/proxy.ts index 7a7970a91..74e22ebfb 100644 --- a/packages/frames-client/src/proxy.ts +++ b/packages/frames-client/src/proxy.ts @@ -29,6 +29,9 @@ export default class OpenFramesProxy { } mediaUrl(url: string): string { + if (url?.startsWith("data:")) { + return url; + } return this.inner.mediaUrl(url); } } From 711d1c45409bf597d682e0ad1ed5a756479dc959 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 23 Feb 2024 15:50:57 +0000 Subject: [PATCH 053/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 1331014ee..9f0344e18 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.4.2 + +### Patch Changes + +- d01544d: Add support for optional inputText + ## 0.4.1 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index e62e5845e..aad915360 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.4.1", + "version": "0.4.2", "keywords": [ "xmtp", "messaging", From b6613b73c87abcbbf1d305c72ce61fa797ec15e8 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 26 Feb 2024 20:35:49 -0600 Subject: [PATCH 054/107] Upgrade dependencies --- packages/frames-client/package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index aad915360..7146e3e8d 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -73,20 +73,20 @@ "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", "@xmtp/xmtp-js": "^11.3.12", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", - "ethers": "^6.10.0", - "prettier": "^3.2.4", - "prettier-plugin-packagejson": "^2.4.10", - "rollup": "^4.9.6", + "ethers": "^6.11.1", + "prettier": "^3.2.5", + "prettier-plugin-packagejson": "^2.4.12", + "rollup": "^4.12.0", "rollup-plugin-dts": "^6.1.0", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", - "typedoc": "^0.25.7", + "typedoc": "^0.25.9", "typescript": "^5.3.3", - "vite": "^5.0.12", + "vite": "^5.1.4", "vite-tsconfig-paths": "^4.3.1", - "vitest": "^1.2.1" + "vitest": "^1.3.1" }, "peerDependencies": { "@xmtp/xmtp-js": ">9.3.1" From 6257c65dbe03e2ce031c50578002ed5a9c5597f0 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 26 Feb 2024 20:36:16 -0600 Subject: [PATCH 055/107] Format tsconfig.json files --- packages/frames-client/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-client/tsconfig.json b/packages/frames-client/tsconfig.json index 1d523acc6..235fbd5e9 100644 --- a/packages/frames-client/tsconfig.json +++ b/packages/frames-client/tsconfig.json @@ -1,4 +1,4 @@ { "extends": "@xmtp/tsconfig/react-sdk.json", - "include": ["src", ".eslintrc.cjs", "vitest.config.ts", "vitest.setup.ts"], + "include": ["src", ".eslintrc.cjs", "vitest.config.ts", "vitest.setup.ts"] } From ad8d3d50077813b6f9239dff453beb1975ab82d7 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 28 Feb 2024 09:48:05 -0600 Subject: [PATCH 056/107] Include source files when publishing packages --- packages/frames-client/package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 7146e3e8d..38dbf440b 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -34,7 +34,10 @@ "browser": "lib/index.js", "types": "lib/index.d.ts", "files": [ - "lib" + "lib", + "src", + "!src/**/*.test.*", + "tsconfig.json" ], "scripts": { "build": "yarn clean:lib && yarn rollup -c", From e06d0c718e10046013b4aea8fc4c25231df13446 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 28 Feb 2024 11:33:13 -0600 Subject: [PATCH 057/107] Upgrade JS SDK --- packages/frames-client/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 38dbf440b..af9ffddd5 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -75,7 +75,7 @@ "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", - "@xmtp/xmtp-js": "^11.3.12", + "@xmtp/xmtp-js": "^11.4.1", "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.11.1", From 3371ae485dc5f65d42f34e80ebb41ec7264fb44d Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Wed, 28 Feb 2024 19:43:56 -0700 Subject: [PATCH 058/107] Add State field to be in line with OF spec --- packages/frames-client/package.json | 2 +- packages/frames-client/src/client.ts | 1 + packages/frames-client/src/index.test.ts | 2 ++ packages/frames-client/src/types.ts | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index af9ffddd5..83dbe6009 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -67,7 +67,7 @@ "dependencies": { "@noble/hashes": "^1.3.3", "@open-frames/proxy-client": "^0.2.0", - "@xmtp/proto": "3.44.0", + "@xmtp/proto": "3.45.0", "long": "^5.2.3" }, "devDependencies": { diff --git a/packages/frames-client/src/client.ts b/packages/frames-client/src/client.ts index d9be0ee48..430822563 100644 --- a/packages/frames-client/src/client.ts +++ b/packages/frames-client/src/client.ts @@ -42,6 +42,7 @@ export class FramesClient { timestamp, inputText: inputText || "", unixTimestamp: now, + state: inputs.state || "", }; const signedAction = await this.buildSignedFrameAction(toSign); diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index b6657c43b..4844410a1 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -23,6 +23,7 @@ describe("signFrameAction", () => { buttonIndex, conversationTopic: "foo", participantAccountAddresses: ["amal", "bola"], + state: "state", }); expect(signedPayload.untrustedData.walletAddress).toEqual(client.address); @@ -47,6 +48,7 @@ describe("signFrameAction", () => { expect(signedPayloadBody.buttonIndex).toEqual(buttonIndex); expect(signedPayloadBody.frameUrl).toEqual(frameUrl); expect(signedPayloadBody.opaqueConversationIdentifier).toBeDefined(); + expect(signedPayloadBody.state).toEqual("state"); if ( !signedPayloadProto.signature || diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index 9c586ad36..792bcdb42 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -40,6 +40,7 @@ export type FrameActionInputs = { frameUrl: string; buttonIndex: number; inputText?: string; + state?: string; } & ConversationActionInputs; type KeyType = { From 1c949871ff553758d3667e231b7cd5dc13890c6d Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Wed, 28 Feb 2024 19:43:56 -0700 Subject: [PATCH 059/107] Add State field to be in line with OF spec --- packages/frames-client/package.json | 2 +- packages/frames-client/src/client.ts | 1 + packages/frames-client/src/index.test.ts | 2 ++ packages/frames-client/src/types.ts | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index af9ffddd5..83dbe6009 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -67,7 +67,7 @@ "dependencies": { "@noble/hashes": "^1.3.3", "@open-frames/proxy-client": "^0.2.0", - "@xmtp/proto": "3.44.0", + "@xmtp/proto": "3.45.0", "long": "^5.2.3" }, "devDependencies": { diff --git a/packages/frames-client/src/client.ts b/packages/frames-client/src/client.ts index d9be0ee48..430822563 100644 --- a/packages/frames-client/src/client.ts +++ b/packages/frames-client/src/client.ts @@ -42,6 +42,7 @@ export class FramesClient { timestamp, inputText: inputText || "", unixTimestamp: now, + state: inputs.state || "", }; const signedAction = await this.buildSignedFrameAction(toSign); diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index b6657c43b..4844410a1 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -23,6 +23,7 @@ describe("signFrameAction", () => { buttonIndex, conversationTopic: "foo", participantAccountAddresses: ["amal", "bola"], + state: "state", }); expect(signedPayload.untrustedData.walletAddress).toEqual(client.address); @@ -47,6 +48,7 @@ describe("signFrameAction", () => { expect(signedPayloadBody.buttonIndex).toEqual(buttonIndex); expect(signedPayloadBody.frameUrl).toEqual(frameUrl); expect(signedPayloadBody.opaqueConversationIdentifier).toBeDefined(); + expect(signedPayloadBody.state).toEqual("state"); if ( !signedPayloadProto.signature || diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index 9c586ad36..792bcdb42 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -40,6 +40,7 @@ export type FrameActionInputs = { frameUrl: string; buttonIndex: number; inputText?: string; + state?: string; } & ConversationActionInputs; type KeyType = { From df7812ce5d80ca3f05607a1433a3ff624bae393d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 1 Mar 2024 01:19:39 +0000 Subject: [PATCH 060/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 9f0344e18..ffc78f1c4 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.4.3 + +### Patch Changes + +- cab6fb3: Add support for the state field + ## 0.4.2 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 83dbe6009..cd8e60079 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.4.2", + "version": "0.4.3", "keywords": [ "xmtp", "messaging", From a30b9d647bc95ad17c2d849e6144a5c3e955e786 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 7 Mar 2024 08:46:15 -0800 Subject: [PATCH 061/107] Upgrade dev deps --- packages/frames-client/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index af9ffddd5..d2cb32c16 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -81,13 +81,13 @@ "ethers": "^6.11.1", "prettier": "^3.2.5", "prettier-plugin-packagejson": "^2.4.12", - "rollup": "^4.12.0", + "rollup": "^4.12.1", "rollup-plugin-dts": "^6.1.0", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", - "typedoc": "^0.25.9", - "typescript": "^5.3.3", - "vite": "^5.1.4", + "typedoc": "^0.25.11", + "typescript": "^5.4.2", + "vite": "^5.1.5", "vite-tsconfig-paths": "^4.3.1", "vitest": "^1.3.1" }, From fa9c2a908ebe07a847c4c4b4247d95ad276c8840 Mon Sep 17 00:00:00 2001 From: fabri Date: Mon, 11 Mar 2024 19:04:54 -0300 Subject: [PATCH 062/107] format --- packages/frames-client/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index b4c2fe30a..fd622a6dd 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -7,7 +7,7 @@ const xmtpClient = await Client.create(wallet); const framesClient = new FramesClient(xmtpClient); const frameUrl = "https://www.myframe.xyz"; -const framePostUrl = "https://www.myframe.xyz/api/post"; //fc:frame:post_url +const framePostUrl = "https://www.myframe.xyz/api/post"; //fc:frame:post_url // Read data from a frame const frameMetadata = await framesClient.proxy.readMetadata(frameUrl); @@ -26,7 +26,10 @@ const payload = await signFrameAction({ }); // If the button action type was `post` -const updatedFrameMetadata = await framesClient.proxy.post(framePostUrl, payload); +const updatedFrameMetadata = await framesClient.proxy.post( + framePostUrl, + payload, +); // If the button action type was `post_redirect` const { redirectedTo } = await framesClient.proxy.postRedirect( framePostUrl, From 46c01b1cd383a6c174245da0db6b3877bdd03aa7 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 13 Mar 2024 12:45:19 -0500 Subject: [PATCH 063/107] Upgrade dev deps --- packages/frames-client/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 774da500b..c526c7093 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -81,13 +81,13 @@ "ethers": "^6.11.1", "prettier": "^3.2.5", "prettier-plugin-packagejson": "^2.4.12", - "rollup": "^4.12.1", + "rollup": "^4.13.0", "rollup-plugin-dts": "^6.1.0", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", - "typedoc": "^0.25.11", + "typedoc": "^0.25.12", "typescript": "^5.4.2", - "vite": "^5.1.5", + "vite": "^5.1.6", "vite-tsconfig-paths": "^4.3.1", "vitest": "^1.3.1" }, From 685acca319ec63cc6feeca80d87ec18839b3e951 Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Wed, 27 Mar 2024 18:28:53 -0600 Subject: [PATCH 064/107] Frames Client State Updated types to include state Send state in untrusted data --- packages/frames-client/package.json | 4 ++-- packages/frames-client/src/client.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index c526c7093..05841a88b 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -66,12 +66,12 @@ }, "dependencies": { "@noble/hashes": "^1.3.3", - "@open-frames/proxy-client": "^0.2.0", + "@open-frames/proxy-client": "^0.2.1", "@xmtp/proto": "3.45.0", "long": "^5.2.3" }, "devDependencies": { - "@open-frames/types": "^0.0.6", + "@open-frames/types": "^0.0.7", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", diff --git a/packages/frames-client/src/client.ts b/packages/frames-client/src/client.ts index 430822563..53e738338 100644 --- a/packages/frames-client/src/client.ts +++ b/packages/frames-client/src/client.ts @@ -32,7 +32,7 @@ export class FramesClient { async signFrameAction(inputs: FrameActionInputs): Promise { const opaqueConversationIdentifier = buildOpaqueIdentifier(inputs); - const { frameUrl, buttonIndex, inputText } = inputs; + const { frameUrl, buttonIndex, inputText, state } = inputs; const now = Date.now(); const timestamp = Long.fromNumber(now); const toSign: frames.FrameActionBody = { @@ -42,7 +42,7 @@ export class FramesClient { timestamp, inputText: inputText || "", unixTimestamp: now, - state: inputs.state || "", + state: state || "", }; const signedAction = await this.buildSignedFrameAction(toSign); @@ -57,6 +57,7 @@ export class FramesClient { url: frameUrl, timestamp: now, unixTimestamp: now, + state, }, trustedData: { messageBytes: base64Encode(signedAction), From 369051e1292796446c120e78c4f003584015d363 Mon Sep 17 00:00:00 2001 From: daria-github Date: Fri, 19 Apr 2024 09:45:44 -0700 Subject: [PATCH 065/107] add postTransaction support --- packages/frames-client/README.md | 5 +++++ packages/frames-client/package.json | 2 +- packages/frames-client/src/proxy.ts | 11 +++++++++++ packages/frames-client/src/types.ts | 3 +++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index fd622a6dd..d516e2504 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -35,4 +35,9 @@ const { redirectedTo } = await framesClient.proxy.postRedirect( framePostUrl, payload, ); +// If the button action type was `postTransaction` +const transactionInfo = await framesClient.proxy.postTransaction( + framePostUrl, + payload, +); ``` diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 05841a88b..b38b28eb4 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -66,7 +66,7 @@ }, "dependencies": { "@noble/hashes": "^1.3.3", - "@open-frames/proxy-client": "^0.2.1", + "@open-frames/proxy-client": "^0.3.0", "@xmtp/proto": "3.45.0", "long": "^5.2.3" }, diff --git a/packages/frames-client/src/proxy.ts b/packages/frames-client/src/proxy.ts index 74e22ebfb..c797f3fc1 100644 --- a/packages/frames-client/src/proxy.ts +++ b/packages/frames-client/src/proxy.ts @@ -4,6 +4,7 @@ import type { FramePostPayload, FramesApiRedirectResponse, FramesApiResponse, + FramesTransactionApiResponse, } from "./types"; export default class OpenFramesProxy { @@ -28,6 +29,16 @@ export default class OpenFramesProxy { return this.inner.postRedirect(url, payload); } + postTransaction( + url: string, + payload: FramePostPayload, + ): Promise { + return this.inner.postTransaction(url, { + ...payload, + address: payload.untrustedData.walletAddress, + }); + } + mediaUrl(url: string): string { if (url?.startsWith("data:")) { return url; diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index 792bcdb42..9f84e6f25 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -2,12 +2,15 @@ import type { OpenFramesUntrustedData } from "@open-frames/types"; import type { GetMetadataResponse, PostRedirectResponse, + TransactionResponse, } from "@open-frames/proxy-client"; export type FramesApiResponse = GetMetadataResponse; export type FramesApiRedirectResponse = PostRedirectResponse; +export type FramesTransactionApiResponse = TransactionResponse; + export type FramePostUntrustedData = OpenFramesUntrustedData & { walletAddress: string; // Untrusted version of the wallet address opaqueConversationIdentifier: string; // A hash of the conversation topic and the participants From 4281918bcebaebbdf9d81b17c36d76e4ef2ae577 Mon Sep 17 00:00:00 2001 From: daria-github Date: Fri, 19 Apr 2024 14:57:10 -0700 Subject: [PATCH 066/107] bumped packages --- packages/frames-client/package.json | 4 ++-- packages/frames-client/src/proxy.ts | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index b38b28eb4..e08056e32 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -67,11 +67,11 @@ "dependencies": { "@noble/hashes": "^1.3.3", "@open-frames/proxy-client": "^0.3.0", - "@xmtp/proto": "3.45.0", + "@xmtp/proto": "3.51.1", "long": "^5.2.3" }, "devDependencies": { - "@open-frames/types": "^0.0.7", + "@open-frames/types": "^0.1.0", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", diff --git a/packages/frames-client/src/proxy.ts b/packages/frames-client/src/proxy.ts index c797f3fc1..30b8ead60 100644 --- a/packages/frames-client/src/proxy.ts +++ b/packages/frames-client/src/proxy.ts @@ -33,10 +33,7 @@ export default class OpenFramesProxy { url: string, payload: FramePostPayload, ): Promise { - return this.inner.postTransaction(url, { - ...payload, - address: payload.untrustedData.walletAddress, - }); + return this.inner.postTransaction(url, payload); } mediaUrl(url: string): string { From f033104c8e1e511980c263824ea4eb4931c9a7cc Mon Sep 17 00:00:00 2001 From: daria-github Date: Fri, 19 Apr 2024 15:28:01 -0700 Subject: [PATCH 067/107] fix tests --- packages/frames-client/README.md | 1 + packages/frames-client/src/client.ts | 5 ++++- packages/frames-client/src/index.test.ts | 6 ++++++ packages/frames-client/src/types.ts | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index d516e2504..ccca7e387 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -23,6 +23,7 @@ const payload = await signFrameAction({ buttonIndex: 2, conversationTopic: "/xmtp/0/123", participantAccountAddresses: ["abc", "xyz"], + address: "0x...", }); // If the button action type was `post` diff --git a/packages/frames-client/src/client.ts b/packages/frames-client/src/client.ts index 53e738338..ae9cb9677 100644 --- a/packages/frames-client/src/client.ts +++ b/packages/frames-client/src/client.ts @@ -32,7 +32,7 @@ export class FramesClient { async signFrameAction(inputs: FrameActionInputs): Promise { const opaqueConversationIdentifier = buildOpaqueIdentifier(inputs); - const { frameUrl, buttonIndex, inputText, state } = inputs; + const { frameUrl, buttonIndex, inputText, state, address } = inputs; const now = Date.now(); const timestamp = Long.fromNumber(now); const toSign: frames.FrameActionBody = { @@ -43,6 +43,7 @@ export class FramesClient { inputText: inputText || "", unixTimestamp: now, state: state || "", + address: address || "", }; const signedAction = await this.buildSignedFrameAction(toSign); @@ -58,6 +59,8 @@ export class FramesClient { timestamp: now, unixTimestamp: now, state, + // The address associated with initiating a transaction + address, }, trustedData: { messageBytes: base64Encode(signedAction), diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 4844410a1..0f1192e8b 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -24,9 +24,15 @@ describe("signFrameAction", () => { conversationTopic: "foo", participantAccountAddresses: ["amal", "bola"], state: "state", + address: "0x...", }); + // Below addresses are typically the same but can technically be different + // walletAddress references address of XMTP client expect(signedPayload.untrustedData.walletAddress).toEqual(client.address); + + // address references the address associated with initiating a transaction + expect(signedPayload.untrustedData.address).toEqual("0x..."); expect(signedPayload.untrustedData.url).toEqual(frameUrl); expect(signedPayload.untrustedData.buttonIndex).toEqual(buttonIndex); expect( diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index 9f84e6f25..affc1315a 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -44,6 +44,7 @@ export type FrameActionInputs = { buttonIndex: number; inputText?: string; state?: string; + address?: string; } & ConversationActionInputs; type KeyType = { From 16ae852e7370fb9c8e80fc4f80a7ede6f54b608a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 19 Apr 2024 22:50:17 +0000 Subject: [PATCH 068/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index ffc78f1c4..66a098554 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.5.0 + +### Minor Changes + +- e1ac826: add postTransaction support + ## 0.4.3 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index e08056e32..e2d16b85a 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.4.3", + "version": "0.5.0", "keywords": [ "xmtp", "messaging", From 8e7de2a739d8883345dc2f1f1fdd886205a943cb Mon Sep 17 00:00:00 2001 From: Fabri Date: Tue, 30 Apr 2024 18:28:31 -0300 Subject: [PATCH 069/107] Update README.md Added state to Docs --- packages/frames-client/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index ccca7e387..216b28b3e 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -20,10 +20,12 @@ const imageUrl = framesClient.proxy.mediaUrl( // Handle a click to button 2 from a conversation with topic "/xmtp/0/123" and participant addresses "abc" and "xyz" const payload = await signFrameAction({ frameUrl, + inputText: textInputValue || undefined, buttonIndex: 2, conversationTopic: "/xmtp/0/123", participantAccountAddresses: ["abc", "xyz"], address: "0x...", + state: frameInfo.state, }); // If the button action type was `post` From b5ddeb335a5f79eaa8f93bfd450e4ecd6f54f400 Mon Sep 17 00:00:00 2001 From: fabri Date: Tue, 30 Apr 2024 20:26:45 -0300 Subject: [PATCH 070/107] =?UTF-8?q?=E2=80=9Cupdate=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frames-client/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index 216b28b3e..edeacbcd5 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -1,4 +1,6 @@ -# frames-client +# Frames Client + +This repo is used by messaging apps to render Open Frames. ## Usage @@ -18,6 +20,7 @@ const imageUrl = framesClient.proxy.mediaUrl( ); // Handle a click to button 2 from a conversation with topic "/xmtp/0/123" and participant addresses "abc" and "xyz" +const textInputValue = "Your value"; const payload = await signFrameAction({ frameUrl, inputText: textInputValue || undefined, @@ -25,7 +28,7 @@ const payload = await signFrameAction({ conversationTopic: "/xmtp/0/123", participantAccountAddresses: ["abc", "xyz"], address: "0x...", - state: frameInfo.state, + state: frameMetadata?.frameInfo?.state, // Pulled from frame metadata }); // If the button action type was `post` From 3adbc5cf19db8b0e9a0ee888f4160cab1b392031 Mon Sep 17 00:00:00 2001 From: daria-github Date: Thu, 2 May 2024 13:05:38 -0700 Subject: [PATCH 071/107] pass postUrl through in frameInfo --- packages/frames-client/package.json | 2 +- packages/frames-client/src/index.test.ts | 30 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index e2d16b85a..653ed5a7d 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -66,7 +66,7 @@ }, "dependencies": { "@noble/hashes": "^1.3.3", - "@open-frames/proxy-client": "^0.3.0", + "@open-frames/proxy-client": "^0.3.2", "@xmtp/proto": "3.51.1", "long": "^5.2.3" }, diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 0f1192e8b..7b992e0b5 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -125,4 +125,34 @@ describe("signFrameAction", () => { // Add a long timeout because Vercel cold starts can be slow { timeout: 20000 }, ); + it( + "sends back the button postUrl for a tx frame in frame info", + async () => { + const frameUrl = + "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/"; + const metadata = await framesClient.proxy.readMetadata(frameUrl); + expect(metadata).toBeDefined(); + expect(metadata.frameInfo).toMatchObject({ + acceptedClients: { + xmtp: "2024-02-09", + farcaster: "vNext", + }, + buttons: { + "1": { + label: "Make transaction", + action: "tx", + target: + "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/api/transaction", + postUrl: + "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/api/transaction-success", + }, + }, + image: { + content: + "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/api/og?transaction=null", + }, + }); + }, + { timeout: 20000 }, + ); }); From 169e0009c20c67885a9c0e79e7e61bae26a9a8e3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 May 2024 20:13:35 +0000 Subject: [PATCH 072/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index 66a098554..cf0069868 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.5.1 + +### Patch Changes + +- 3ffc491: bumped packages to pass postUrl through in frameInfo + ## 0.5.0 ### Minor Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 653ed5a7d..7ae96a83c 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.5.0", + "version": "0.5.1", "keywords": [ "xmtp", "messaging", From 1f9e950bc3f230195f1d9742d0de677f7233d4d6 Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Fri, 3 May 2024 13:04:59 -0600 Subject: [PATCH 073/107] Add consent proof message package --- .../consent-proof-signature/.eslintrc.cjs | 7 ++ packages/consent-proof-signature/package.json | 89 +++++++++++++++++++ .../consent-proof-signature/rollup.config.js | 50 +++++++++++ .../consent-proof-signature/src/index.test.ts | 14 +++ packages/consent-proof-signature/src/index.ts | 16 ++++ .../tsconfig.eslint.json | 5 ++ .../consent-proof-signature/tsconfig.json | 4 + packages/frames-client/package.json | 2 +- 8 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 packages/consent-proof-signature/.eslintrc.cjs create mode 100644 packages/consent-proof-signature/package.json create mode 100644 packages/consent-proof-signature/rollup.config.js create mode 100644 packages/consent-proof-signature/src/index.test.ts create mode 100644 packages/consent-proof-signature/src/index.ts create mode 100644 packages/consent-proof-signature/tsconfig.eslint.json create mode 100644 packages/consent-proof-signature/tsconfig.json diff --git a/packages/consent-proof-signature/.eslintrc.cjs b/packages/consent-proof-signature/.eslintrc.cjs new file mode 100644 index 000000000..0e3d6a266 --- /dev/null +++ b/packages/consent-proof-signature/.eslintrc.cjs @@ -0,0 +1,7 @@ +module.exports = { + root: true, + extends: ["xmtp-web"], + parserOptions: { + project: "./tsconfig.eslint.json", + }, +}; diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json new file mode 100644 index 000000000..b086aee72 --- /dev/null +++ b/packages/consent-proof-signature/package.json @@ -0,0 +1,89 @@ +{ + "name": "@xmtp/consent-proof-signature", + "version": "0.1.0", + "description": "", + "keywords": [ + "xmtp", + "messaging", + "web3", + "sdk", + "js", + "ts", + "javascript", + "typescript" + ], + "homepage": "https://github.com/xmtp/xmtp-web", + "bugs": { + "url": "https://github.com/xmtp/xmtp-web/issues" + }, + "repository": { + "type": "git", + "url": "git@github.com:xmtp/xmtp-web.git", + "directory": "packages/consent-proof-signature" + }, + "license": "MIT", + "author": "XMTP Labs ", + "sideEffects": false, + "type": "module", + "exports": { + ".": { + "types": "./lib/index.d.ts", + "default": "./lib/index.js" + } + }, + "main": "index.js", + "module": "lib/index.js", + "browser": "lib/index.js", + "types": "lib/index.d.ts", + "files": [ + "lib", + "src", + "!src/**/*.test.*", + "tsconfig.json" + ], + "scripts": { + "lint": "eslint . --ignore-path ../../.gitignore", + "test": "vitest run --passWithNoTests", + "typecheck": "tsc", + "typedoc": "typedoc" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 3 chrome versions", + "last 3 firefox versions", + "last 3 safari versions" + ] + }, + "devDependencies": { + "@open-frames/types": "^0.0.7", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^11.1.6", + "@xmtp/tsconfig": "workspace:*", + "@xmtp/xmtp-js": "^11.4.1", + "eslint": "^8.57.0", + "eslint-config-xmtp-web": "workspace:*", + "ethers": "^6.11.1", + "prettier": "^3.2.5", + "prettier-plugin-packagejson": "^2.4.12", + "rollup": "^4.13.0", + "rollup-plugin-dts": "^6.1.0", + "rollup-plugin-filesize": "^10.0.0", + "rollup-plugin-tsconfig-paths": "^1.5.2", + "typedoc": "^0.25.12", + "typescript": "^5.4.2", + "vite": "^5.1.6", + "vite-tsconfig-paths": "^4.3.1", + "vitest": "^1.3.1" + }, + "packageManager": "yarn@4.0.2", + "publishConfig": { + "access": "public", + "provenance": true, + "registry": "https://registry.npmjs.org/" + } +} diff --git a/packages/consent-proof-signature/rollup.config.js b/packages/consent-proof-signature/rollup.config.js new file mode 100644 index 000000000..fc035a86a --- /dev/null +++ b/packages/consent-proof-signature/rollup.config.js @@ -0,0 +1,50 @@ +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"; + +const plugins = [ + tsConfigPaths(), + typescript({ + declaration: false, + declarationMap: false, + }), + filesize({ + showMinifiedSize: false, + }), +]; + +const external = ["@xmtp/proto", "node:crypto"]; + +export default defineConfig([ + { + input: "src/index.ts", + output: { + file: "lib/index.js", + format: "es", + sourcemap: true, + }, + external, + plugins, + }, + { + input: "src/index.ts", + output: { + file: "lib/browser/index.js", + format: "es", + sourcemap: true, + }, + external, + plugins: [terser(), ...plugins], + }, + { + input: "src/index.ts", + output: { + file: "lib/index.d.ts", + format: "es", + }, + plugins: [tsConfigPaths(), dts()], + }, +]); diff --git a/packages/consent-proof-signature/src/index.test.ts b/packages/consent-proof-signature/src/index.test.ts new file mode 100644 index 000000000..d7c629a84 --- /dev/null +++ b/packages/consent-proof-signature/src/index.test.ts @@ -0,0 +1,14 @@ +import { describe, expect, it } from "vitest"; +import { createConsentMessage } from "."; + +describe("createConsentMessage", () => { + it("should return a signature", () => { + const date = new Date(2020, 1, 14); + const timestampMs = date.getTime(); + const exampleAddress = "0x1234567890abcdef"; + const signatureMessage = createConsentMessage(exampleAddress, timestampMs); + expect(signatureMessage).toEqual( + "XMTP : Grant inbox consent to sender\n\nCurrent Time: 1581663600000\nFrom Address: 0x1234567890abcdef\n\nFor more info: https://xmtp.org/signatures/", + ); + }); +}); diff --git a/packages/consent-proof-signature/src/index.ts b/packages/consent-proof-signature/src/index.ts new file mode 100644 index 000000000..5c67b2a37 --- /dev/null +++ b/packages/consent-proof-signature/src/index.ts @@ -0,0 +1,16 @@ +/** + * + * @param peerAddress - Ethereum address of the broadcaster + * @param timestampMs - Timestamp in milliseconds used in the signature + * @returns + */ +export const createConsentMessage = ( + peerAddress: string, + timestampMs: number, +): string => + "XMTP : Grant inbox consent to sender\n" + + "\n" + + `Current Time: ${timestampMs}\n` + + `From Address: ${peerAddress}\n` + + "\n" + + "For more info: https://xmtp.org/signatures/"; diff --git a/packages/consent-proof-signature/tsconfig.eslint.json b/packages/consent-proof-signature/tsconfig.eslint.json new file mode 100644 index 000000000..bf165d3f0 --- /dev/null +++ b/packages/consent-proof-signature/tsconfig.eslint.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.json", + "include": [".", ".eslintrc.cjs", "rollup.config.js"], + "exclude": ["lib", "node_modules"] +} diff --git a/packages/consent-proof-signature/tsconfig.json b/packages/consent-proof-signature/tsconfig.json new file mode 100644 index 000000000..235fbd5e9 --- /dev/null +++ b/packages/consent-proof-signature/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@xmtp/tsconfig/react-sdk.json", + "include": ["src", ".eslintrc.cjs", "vitest.config.ts", "vitest.setup.ts"] +} diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 7ae96a83c..c8b4bb98b 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -18,7 +18,7 @@ "repository": { "type": "git", "url": "git@github.com:xmtp/xmtp-web.git", - "directory": "packages/react-sdk" + "directory": "packages/frames-client" }, "license": "MIT", "author": "XMTP Labs ", From 63df893d95f784231223fe8e7e394200941c070e Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Fri, 3 May 2024 13:08:15 -0600 Subject: [PATCH 074/107] Fix test Fixed test timestamp to not create a date and avoid weirdness with date time for a simple test --- packages/consent-proof-signature/src/index.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/consent-proof-signature/src/index.test.ts b/packages/consent-proof-signature/src/index.test.ts index d7c629a84..bed945939 100644 --- a/packages/consent-proof-signature/src/index.test.ts +++ b/packages/consent-proof-signature/src/index.test.ts @@ -3,8 +3,7 @@ import { createConsentMessage } from "."; describe("createConsentMessage", () => { it("should return a signature", () => { - const date = new Date(2020, 1, 14); - const timestampMs = date.getTime(); + const timestampMs = 1581663600000; const exampleAddress = "0x1234567890abcdef"; const signatureMessage = createConsentMessage(exampleAddress, timestampMs); expect(signatureMessage).toEqual( From 59e745cbe55c4bc9cbf7790cffec5c66d0853dee Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Fri, 3 May 2024 14:54:15 -0600 Subject: [PATCH 075/107] added dependencies Added Readme Added dependencies Added function to encode consent proofs --- packages/consent-proof-signature/README.md | 22 +++++++++++++++++++ packages/consent-proof-signature/package.json | 14 +++++++++--- .../consent-proof-signature/src/index.test.ts | 19 +++++++++++++++- packages/consent-proof-signature/src/index.ts | 19 ++++++++++++++++ .../consent-proof-signature/vitest.config.ts | 17 ++++++++++++++ 5 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 packages/consent-proof-signature/README.md create mode 100644 packages/consent-proof-signature/vitest.config.ts diff --git a/packages/consent-proof-signature/README.md b/packages/consent-proof-signature/README.md new file mode 100644 index 000000000..d34252154 --- /dev/null +++ b/packages/consent-proof-signature/README.md @@ -0,0 +1,22 @@ +# Consent Proof Signature + +## Usage + +```ts +const timestamp = Date.now(); +const message = createConsentMessag(broadcastAddress, timestamp) +// Sign the message for example with Viem +import { createWalletClient, custom } from 'viem' + +const walletClient = createWalletClient({ + chain: mainnet, + transport: custom((window as any).ethereum!), +}) +const [account] = await walletClient.getAddresses() +const signature = await walletClient.signMessage({ + account, + message, +}) +const consentProofBytes = createConsentProofPayload(signature, timestamp) +``` +Now the consentProofBytes can be encoded and sent to a service to decode and add in a new conversation invitation diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index b086aee72..3cbe90309 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -1,7 +1,6 @@ { "name": "@xmtp/consent-proof-signature", "version": "0.1.0", - "description": "", "keywords": [ "xmtp", "messaging", @@ -42,6 +41,13 @@ "tsconfig.json" ], "scripts": { + "build": "yarn clean:lib && yarn rollup -c", + "clean": "rm -rf .turbo && rm -rf node_modules && yarn clean:lib", + "clean:lib": "rm -rf lib", + "dev": "yarn clean:lib && yarn rollup -c --watch", + "format": "yarn format:base -w .", + "format:base": "prettier --ignore-path ../../.gitignore", + "format:check": "yarn format:base -c .", "lint": "eslint . --ignore-path ../../.gitignore", "test": "vitest run --passWithNoTests", "typecheck": "tsc", @@ -59,12 +65,14 @@ "last 3 safari versions" ] }, + "dependencies": { + "@xmtp/proto": "3.56.0", + "long": "^5.2.3" + }, "devDependencies": { - "@open-frames/types": "^0.0.7", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", - "@xmtp/xmtp-js": "^11.4.1", "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.11.1", diff --git a/packages/consent-proof-signature/src/index.test.ts b/packages/consent-proof-signature/src/index.test.ts index bed945939..e570669dd 100644 --- a/packages/consent-proof-signature/src/index.test.ts +++ b/packages/consent-proof-signature/src/index.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { createConsentMessage } from "."; +import { createConsentMessage, createConsentProofPayload } from "."; describe("createConsentMessage", () => { it("should return a signature", () => { @@ -11,3 +11,20 @@ describe("createConsentMessage", () => { ); }); }); + +describe("createConsentProofPayload", () => { + it("should return data of consent proof", () => { + const timestampMs = 1581663600000; + const exampleSignature = "0x1234567890abcdef"; + const signatureMessage = createConsentProofPayload( + exampleSignature, + timestampMs, + ); + expect(signatureMessage).toEqual( + Buffer.from([ + 10, 18, 48, 120, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 97, 98, 99, + 100, 101, 102, 16, 128, 251, 252, 147, 132, 46, 24, 1, + ]), + ); + }); +}); diff --git a/packages/consent-proof-signature/src/index.ts b/packages/consent-proof-signature/src/index.ts index 5c67b2a37..c51fa321c 100644 --- a/packages/consent-proof-signature/src/index.ts +++ b/packages/consent-proof-signature/src/index.ts @@ -1,3 +1,5 @@ +import Long from "long"; +import { invitation } from "@xmtp/proto"; /** * * @param peerAddress - Ethereum address of the broadcaster @@ -14,3 +16,20 @@ export const createConsentMessage = ( `From Address: ${peerAddress}\n` + "\n" + "For more info: https://xmtp.org/signatures/"; + +/** + * + * @param signature hex string of the signature + * @param timestampMs timestamp in milliseconds used in the signature + * @returns Uint8Array of the consent proof payload + */ +export const createConsentProofPayload = ( + signature: string, + timestampMs: number, +): Uint8Array => + invitation.ConsentProofPayload.encode({ + signature, + timestamp: Long.fromNumber(timestampMs), + payloadVersion: + invitation.ConsentProofPayloadVersion.CONSENT_PROOF_PAYLOAD_VERSION_1, + }).finish(); diff --git a/packages/consent-proof-signature/vitest.config.ts b/packages/consent-proof-signature/vitest.config.ts new file mode 100644 index 000000000..21252a9d1 --- /dev/null +++ b/packages/consent-proof-signature/vitest.config.ts @@ -0,0 +1,17 @@ +import { defineConfig, mergeConfig } from "vite"; +import { defineConfig as defineVitestConfig } from "vitest/config"; +import tsconfigPaths from "vite-tsconfig-paths"; + +// https://vitejs.dev/config/ +const viteConfig = defineConfig({ + plugins: [tsconfigPaths()], +}); + +const vitestConfig = defineVitestConfig({ + test: { + globals: true, + environment: "happy-dom", + }, +}); + +export default mergeConfig(viteConfig, vitestConfig); From 44b10253fcf8cc2ab51d2b83c927233a8a177556 Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Sat, 4 May 2024 15:57:02 -0600 Subject: [PATCH 076/107] updated signature Updated signature text Formatted read me --- packages/consent-proof-signature/README.md | 15 ++++++++------- .../consent-proof-signature/src/index.test.ts | 2 +- packages/consent-proof-signature/src/index.ts | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/consent-proof-signature/README.md b/packages/consent-proof-signature/README.md index d34252154..afb9a5cc3 100644 --- a/packages/consent-proof-signature/README.md +++ b/packages/consent-proof-signature/README.md @@ -4,19 +4,20 @@ ```ts const timestamp = Date.now(); -const message = createConsentMessag(broadcastAddress, timestamp) +const message = createConsentMessage(broadcastAddress, timestamp); // Sign the message for example with Viem -import { createWalletClient, custom } from 'viem' +import { createWalletClient, custom } from "viem"; const walletClient = createWalletClient({ chain: mainnet, transport: custom((window as any).ethereum!), -}) -const [account] = await walletClient.getAddresses() -const signature = await walletClient.signMessage({ +}); +const [account] = await walletClient.getAddresses(); +const signature = await walletClient.signMessage({ account, message, -}) -const consentProofBytes = createConsentProofPayload(signature, timestamp) +}); +const consentProofBytes = createConsentProofPayload(signature, timestamp); ``` + Now the consentProofBytes can be encoded and sent to a service to decode and add in a new conversation invitation diff --git a/packages/consent-proof-signature/src/index.test.ts b/packages/consent-proof-signature/src/index.test.ts index e570669dd..223831030 100644 --- a/packages/consent-proof-signature/src/index.test.ts +++ b/packages/consent-proof-signature/src/index.test.ts @@ -7,7 +7,7 @@ describe("createConsentMessage", () => { const exampleAddress = "0x1234567890abcdef"; const signatureMessage = createConsentMessage(exampleAddress, timestampMs); expect(signatureMessage).toEqual( - "XMTP : Grant inbox consent to sender\n\nCurrent Time: 1581663600000\nFrom Address: 0x1234567890abcdef\n\nFor more info: https://xmtp.org/signatures/", + "XMTP : Grant inbox consent to sender\n\nCurrent Time: Fri, 14 Feb 2020 07:00:00 GMT\nFrom Address: 0x1234567890abcdef\n\nFor more info: https://xmtp.org/signatures/", ); }); }); diff --git a/packages/consent-proof-signature/src/index.ts b/packages/consent-proof-signature/src/index.ts index c51fa321c..b3a54f7ca 100644 --- a/packages/consent-proof-signature/src/index.ts +++ b/packages/consent-proof-signature/src/index.ts @@ -12,7 +12,7 @@ export const createConsentMessage = ( ): string => "XMTP : Grant inbox consent to sender\n" + "\n" + - `Current Time: ${timestampMs}\n` + + `Current Time: ${new Date(timestampMs).toUTCString()}\n` + `From Address: ${peerAddress}\n` + "\n" + "For more info: https://xmtp.org/signatures/"; From 8003ad87837e75e7f00342725cd21042af6e7997 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 6 May 2024 14:50:36 +0000 Subject: [PATCH 077/107] release: version packages --- packages/consent-proof-signature/CHANGELOG.md | 7 +++++++ packages/consent-proof-signature/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 packages/consent-proof-signature/CHANGELOG.md diff --git a/packages/consent-proof-signature/CHANGELOG.md b/packages/consent-proof-signature/CHANGELOG.md new file mode 100644 index 000000000..6c6bb2e07 --- /dev/null +++ b/packages/consent-proof-signature/CHANGELOG.md @@ -0,0 +1,7 @@ +# @xmtp/consent-proof-signature + +## 0.1.1 + +### Patch Changes + +- 6fbe931: Created package diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 3cbe90309..4c44a52ff 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/consent-proof-signature", - "version": "0.1.0", + "version": "0.1.1", "keywords": [ "xmtp", "messaging", From 3dcb88cdabc03d09978821582e1b1d9ca88079fb Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 16 May 2024 08:54:02 -0500 Subject: [PATCH 078/107] Add CommonJS export to consent-proof-signature --- packages/consent-proof-signature/package.json | 7 +++---- .../consent-proof-signature/rollup.config.js | 16 ++++++++++++---- .../consent-proof-signature/vitest.config.ts | 5 +---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 4c44a52ff..e4a5496aa 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -27,10 +27,11 @@ "exports": { ".": { "types": "./lib/index.d.ts", - "default": "./lib/index.js" + "require": "./lib/index.cjs", + "import": "./lib/index.js" } }, - "main": "index.js", + "main": "lib/index.cjs", "module": "lib/index.js", "browser": "lib/index.js", "types": "lib/index.d.ts", @@ -81,11 +82,9 @@ "rollup": "^4.13.0", "rollup-plugin-dts": "^6.1.0", "rollup-plugin-filesize": "^10.0.0", - "rollup-plugin-tsconfig-paths": "^1.5.2", "typedoc": "^0.25.12", "typescript": "^5.4.2", "vite": "^5.1.6", - "vite-tsconfig-paths": "^4.3.1", "vitest": "^1.3.1" }, "packageManager": "yarn@4.0.2", diff --git a/packages/consent-proof-signature/rollup.config.js b/packages/consent-proof-signature/rollup.config.js index fc035a86a..87f1b47ba 100644 --- a/packages/consent-proof-signature/rollup.config.js +++ b/packages/consent-proof-signature/rollup.config.js @@ -1,12 +1,10 @@ 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"; const plugins = [ - tsConfigPaths(), typescript({ declaration: false, declarationMap: false, @@ -16,7 +14,7 @@ const plugins = [ }), ]; -const external = ["@xmtp/proto", "node:crypto"]; +const external = ["@xmtp/proto", "node:crypto", "long"]; export default defineConfig([ { @@ -29,6 +27,16 @@ export default defineConfig([ external, plugins, }, + { + input: "src/index.ts", + output: { + file: "lib/index.cjs", + format: "cjs", + sourcemap: true, + }, + external, + plugins, + }, { input: "src/index.ts", output: { @@ -45,6 +53,6 @@ export default defineConfig([ file: "lib/index.d.ts", format: "es", }, - plugins: [tsConfigPaths(), dts()], + plugins: [dts()], }, ]); diff --git a/packages/consent-proof-signature/vitest.config.ts b/packages/consent-proof-signature/vitest.config.ts index 21252a9d1..b6ebdaef6 100644 --- a/packages/consent-proof-signature/vitest.config.ts +++ b/packages/consent-proof-signature/vitest.config.ts @@ -1,11 +1,8 @@ import { defineConfig, mergeConfig } from "vite"; import { defineConfig as defineVitestConfig } from "vitest/config"; -import tsconfigPaths from "vite-tsconfig-paths"; // https://vitejs.dev/config/ -const viteConfig = defineConfig({ - plugins: [tsconfigPaths()], -}); +const viteConfig = defineConfig({}); const vitestConfig = defineVitestConfig({ test: { From 9cadba67cc77c49fb00363c8b62ac5ad0b434076 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 May 2024 14:25:19 +0000 Subject: [PATCH 079/107] release: version packages --- packages/consent-proof-signature/CHANGELOG.md | 6 ++++++ packages/consent-proof-signature/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/consent-proof-signature/CHANGELOG.md b/packages/consent-proof-signature/CHANGELOG.md index 6c6bb2e07..2c603db44 100644 --- a/packages/consent-proof-signature/CHANGELOG.md +++ b/packages/consent-proof-signature/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/consent-proof-signature +## 0.1.2 + +### Patch Changes + +- 8adc23f: Add CommonJS export to `consent-proof-signature` package + ## 0.1.1 ### Patch Changes diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index e4a5496aa..da50c00c2 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/consent-proof-signature", - "version": "0.1.1", + "version": "0.1.2", "keywords": [ "xmtp", "messaging", From 5f218e63511bf08fd2ce0e5301ad2957b82e70fa Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 16 May 2024 09:31:44 -0500 Subject: [PATCH 080/107] Manually bump version for consent-proof-signature --- packages/consent-proof-signature/CHANGELOG.md | 2 +- packages/consent-proof-signature/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/consent-proof-signature/CHANGELOG.md b/packages/consent-proof-signature/CHANGELOG.md index 2c603db44..00abb5989 100644 --- a/packages/consent-proof-signature/CHANGELOG.md +++ b/packages/consent-proof-signature/CHANGELOG.md @@ -1,6 +1,6 @@ # @xmtp/consent-proof-signature -## 0.1.2 +## 0.1.3 ### Patch Changes diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index da50c00c2..a138d38c3 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/consent-proof-signature", - "version": "0.1.2", + "version": "0.1.3", "keywords": [ "xmtp", "messaging", From 1688b43ac820c17e1d4007f8eba735560290a28a Mon Sep 17 00:00:00 2001 From: daria-github Date: Fri, 24 May 2024 16:04:21 -0700 Subject: [PATCH 081/107] add transactionId --- packages/frames-client/package.json | 2 +- packages/frames-client/src/client.ts | 4 +++- packages/frames-client/src/types.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index c8b4bb98b..00901f9b4 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -67,7 +67,7 @@ "dependencies": { "@noble/hashes": "^1.3.3", "@open-frames/proxy-client": "^0.3.2", - "@xmtp/proto": "3.51.1", + "@xmtp/proto": "3.61.1", "long": "^5.2.3" }, "devDependencies": { diff --git a/packages/frames-client/src/client.ts b/packages/frames-client/src/client.ts index ae9cb9677..f50b94e96 100644 --- a/packages/frames-client/src/client.ts +++ b/packages/frames-client/src/client.ts @@ -32,7 +32,8 @@ export class FramesClient { async signFrameAction(inputs: FrameActionInputs): Promise { const opaqueConversationIdentifier = buildOpaqueIdentifier(inputs); - const { frameUrl, buttonIndex, inputText, state, address } = inputs; + const { frameUrl, buttonIndex, inputText, state, address, transactionId } = + inputs; const now = Date.now(); const timestamp = Long.fromNumber(now); const toSign: frames.FrameActionBody = { @@ -44,6 +45,7 @@ export class FramesClient { unixTimestamp: now, state: state || "", address: address || "", + transactionId: transactionId || "", }; const signedAction = await this.buildSignedFrameAction(toSign); diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index affc1315a..44dfc9f55 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -45,6 +45,7 @@ export type FrameActionInputs = { inputText?: string; state?: string; address?: string; + transactionId?: string; } & ConversationActionInputs; type KeyType = { From f9740701a4132a596755a2d475721112b83c024a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 25 May 2024 14:03:41 +0000 Subject: [PATCH 082/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index cf0069868..d24e99a81 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.5.2 + +### Patch Changes + +- 7db2728: adds transactionId to type + ## 0.5.1 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 00901f9b4..96e1013f3 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.5.1", + "version": "0.5.2", "keywords": [ "xmtp", "messaging", From 285930872b6c309cf8a4702a03d7324894f8a9f4 Mon Sep 17 00:00:00 2001 From: daria-github Date: Wed, 29 May 2024 10:06:17 -0700 Subject: [PATCH 083/107] return txId --- packages/frames-client/package.json | 2 +- packages/frames-client/src/client.ts | 1 + packages/frames-client/src/index.test.ts | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 00901f9b4..40d86ee87 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -71,7 +71,7 @@ "long": "^5.2.3" }, "devDependencies": { - "@open-frames/types": "^0.1.0", + "@open-frames/types": "^0.1.1", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", diff --git a/packages/frames-client/src/client.ts b/packages/frames-client/src/client.ts index f50b94e96..25549148d 100644 --- a/packages/frames-client/src/client.ts +++ b/packages/frames-client/src/client.ts @@ -63,6 +63,7 @@ export class FramesClient { state, // The address associated with initiating a transaction address, + transactionId, }, trustedData: { messageBytes: base64Encode(signedAction), diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 7b992e0b5..5df76dc87 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -25,6 +25,7 @@ describe("signFrameAction", () => { participantAccountAddresses: ["amal", "bola"], state: "state", address: "0x...", + transactionId: "123", }); // Below addresses are typically the same but can technically be different @@ -33,6 +34,8 @@ describe("signFrameAction", () => { // address references the address associated with initiating a transaction expect(signedPayload.untrustedData.address).toEqual("0x..."); + expect(signedPayload.untrustedData.transactionId).toEqual("123"); + expect(signedPayload.untrustedData.url).toEqual(frameUrl); expect(signedPayload.untrustedData.buttonIndex).toEqual(buttonIndex); expect( From 92228d2f8217dee8389efda8418107a735d1a0a9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 May 2024 17:14:42 +0000 Subject: [PATCH 084/107] release: version packages --- packages/frames-client/CHANGELOG.md | 6 ++++++ packages/frames-client/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index d24e99a81..f70826386 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @xmtp/frames-client +## 0.5.3 + +### Patch Changes + +- 815ef8f: fix for transaction id + ## 0.5.2 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 1bb157bac..fdfec44d3 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.5.2", + "version": "0.5.3", "keywords": [ "xmtp", "messaging", From 6086293269d2d7e69ee2be7fd365453980bac942 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 2 Jul 2024 15:06:21 -0500 Subject: [PATCH 085/107] Upgrade @xmtp dependencies --- packages/consent-proof-signature/package.json | 2 +- packages/frames-client/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index a138d38c3..264460766 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -67,7 +67,7 @@ ] }, "dependencies": { - "@xmtp/proto": "3.56.0", + "@xmtp/proto": "3.62.1", "long": "^5.2.3" }, "devDependencies": { diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index fdfec44d3..414c9942b 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -67,7 +67,7 @@ "dependencies": { "@noble/hashes": "^1.3.3", "@open-frames/proxy-client": "^0.3.2", - "@xmtp/proto": "3.61.1", + "@xmtp/proto": "3.62.1", "long": "^5.2.3" }, "devDependencies": { @@ -75,7 +75,7 @@ "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", "@xmtp/tsconfig": "workspace:*", - "@xmtp/xmtp-js": "^11.4.1", + "@xmtp/xmtp-js": "^12.0.0", "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.11.1", From 252f1e9322563e036276e84dcb8e4c1ade5c2955 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 2 Jul 2024 16:42:10 -0500 Subject: [PATCH 086/107] Upgrade yarn --- packages/consent-proof-signature/package.json | 2 +- packages/frames-client/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 264460766..85932c2b6 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -87,7 +87,7 @@ "vite": "^5.1.6", "vitest": "^1.3.1" }, - "packageManager": "yarn@4.0.2", + "packageManager": "yarn@4.3.1", "publishConfig": { "access": "public", "provenance": true, diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 414c9942b..fa0e2f5c2 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -94,7 +94,7 @@ "peerDependencies": { "@xmtp/xmtp-js": ">9.3.1" }, - "packageManager": "yarn@4.0.2", + "packageManager": "yarn@4.3.1", "publishConfig": { "access": "public", "provenance": true, From 5d401d7663487931a7398fee34fd0594a1e43165 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 3 Jul 2024 09:57:28 -0500 Subject: [PATCH 087/107] Upgrade prettier --- packages/consent-proof-signature/package.json | 4 ++-- packages/frames-client/package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 85932c2b6..34410a451 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -77,8 +77,8 @@ "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.11.1", - "prettier": "^3.2.5", - "prettier-plugin-packagejson": "^2.4.12", + "prettier": "^3.3.2", + "prettier-plugin-packagejson": "^2.5.0", "rollup": "^4.13.0", "rollup-plugin-dts": "^6.1.0", "rollup-plugin-filesize": "^10.0.0", diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index fa0e2f5c2..23f1b4b88 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -79,8 +79,8 @@ "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.11.1", - "prettier": "^3.2.5", - "prettier-plugin-packagejson": "^2.4.12", + "prettier": "^3.3.2", + "prettier-plugin-packagejson": "^2.5.0", "rollup": "^4.13.0", "rollup-plugin-dts": "^6.1.0", "rollup-plugin-filesize": "^10.0.0", From 5e3dd7480ead4f5be80fe7551b3f5e2b799b01f5 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 3 Jul 2024 10:02:31 -0500 Subject: [PATCH 088/107] Upgrade rollup, fix config --- packages/consent-proof-signature/package.json | 4 ++-- packages/frames-client/package.json | 4 ++-- packages/frames-client/rollup.config.js | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 34410a451..5c93bec64 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -79,8 +79,8 @@ "ethers": "^6.11.1", "prettier": "^3.3.2", "prettier-plugin-packagejson": "^2.5.0", - "rollup": "^4.13.0", - "rollup-plugin-dts": "^6.1.0", + "rollup": "^4.18.0", + "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "typedoc": "^0.25.12", "typescript": "^5.4.2", diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 23f1b4b88..0235679ec 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -81,8 +81,8 @@ "ethers": "^6.11.1", "prettier": "^3.3.2", "prettier-plugin-packagejson": "^2.5.0", - "rollup": "^4.13.0", - "rollup-plugin-dts": "^6.1.0", + "rollup": "^4.18.0", + "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", "typedoc": "^0.25.12", diff --git a/packages/frames-client/rollup.config.js b/packages/frames-client/rollup.config.js index fc035a86a..6871bf8c1 100644 --- a/packages/frames-client/rollup.config.js +++ b/packages/frames-client/rollup.config.js @@ -16,7 +16,13 @@ const plugins = [ }), ]; -const external = ["@xmtp/proto", "node:crypto"]; +const external = [ + "@xmtp/proto", + "node:crypto", + "@open-frames/proxy-client", + "@noble/hashes/sha256", + "long", +]; export default defineConfig([ { From 48b3c947bb30de03dc0dee8c8d60ac99b878e7f4 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 3 Jul 2024 10:08:38 -0500 Subject: [PATCH 089/107] Upgrade vite deps --- packages/consent-proof-signature/package.json | 4 ++-- packages/frames-client/package.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 5c93bec64..b92aba2c2 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -84,8 +84,8 @@ "rollup-plugin-filesize": "^10.0.0", "typedoc": "^0.25.12", "typescript": "^5.4.2", - "vite": "^5.1.6", - "vitest": "^1.3.1" + "vite": "^5.3.3", + "vitest": "^1.6.0" }, "packageManager": "yarn@4.3.1", "publishConfig": { diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 0235679ec..c88966ab6 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -87,9 +87,9 @@ "rollup-plugin-tsconfig-paths": "^1.5.2", "typedoc": "^0.25.12", "typescript": "^5.4.2", - "vite": "^5.1.6", - "vite-tsconfig-paths": "^4.3.1", - "vitest": "^1.3.1" + "vite": "^5.3.3", + "vite-tsconfig-paths": "^4.3.2", + "vitest": "^1.6.0" }, "peerDependencies": { "@xmtp/xmtp-js": ">9.3.1" From 61da5ae5d24f05792aa6217f3abb863fe8e4730c Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 3 Jul 2024 10:09:44 -0500 Subject: [PATCH 090/107] Upgrade typescript --- packages/consent-proof-signature/package.json | 2 +- packages/frames-client/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index b92aba2c2..0340cecaa 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -83,7 +83,7 @@ "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "typedoc": "^0.25.12", - "typescript": "^5.4.2", + "typescript": "^5.5.3", "vite": "^5.3.3", "vitest": "^1.6.0" }, diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index c88966ab6..99203f7a1 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -86,7 +86,7 @@ "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", "typedoc": "^0.25.12", - "typescript": "^5.4.2", + "typescript": "^5.5.3", "vite": "^5.3.3", "vite-tsconfig-paths": "^4.3.2", "vitest": "^1.6.0" From 828512a68880882cda7dd5d77d81f0cbb75abd2b Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 3 Jul 2024 10:13:33 -0500 Subject: [PATCH 091/107] Upgrade ethers --- packages/consent-proof-signature/package.json | 2 +- packages/frames-client/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 0340cecaa..4a9442a00 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -76,7 +76,7 @@ "@xmtp/tsconfig": "workspace:*", "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", - "ethers": "^6.11.1", + "ethers": "^6.13.1", "prettier": "^3.3.2", "prettier-plugin-packagejson": "^2.5.0", "rollup": "^4.18.0", diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 99203f7a1..03ff1566b 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -78,7 +78,7 @@ "@xmtp/xmtp-js": "^12.0.0", "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", - "ethers": "^6.11.1", + "ethers": "^6.13.1", "prettier": "^3.3.2", "prettier-plugin-packagejson": "^2.5.0", "rollup": "^4.18.0", From 79b44210091fadcc8df1cd76433dbc397e05df76 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 3 Jul 2024 10:42:55 -0500 Subject: [PATCH 092/107] Upgrade typedoc --- packages/consent-proof-signature/package.json | 2 +- packages/frames-client/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 4a9442a00..6b4900491 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -82,7 +82,7 @@ "rollup": "^4.18.0", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", - "typedoc": "^0.25.12", + "typedoc": "^0.26.3", "typescript": "^5.5.3", "vite": "^5.3.3", "vitest": "^1.6.0" diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 03ff1566b..e0155b0c1 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -85,7 +85,7 @@ "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", - "typedoc": "^0.25.12", + "typedoc": "^0.26.3", "typescript": "^5.5.3", "vite": "^5.3.3", "vite-tsconfig-paths": "^4.3.2", From 98f47929eb83078cea9d9cce7dd709d02c11a92b Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 8 Jul 2024 15:23:23 -0500 Subject: [PATCH 093/107] Upgrade frames client deps --- packages/frames-client/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index e0155b0c1..921cee454 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -65,8 +65,8 @@ ] }, "dependencies": { - "@noble/hashes": "^1.3.3", - "@open-frames/proxy-client": "^0.3.2", + "@noble/hashes": "^1.4.0", + "@open-frames/proxy-client": "^0.3.3", "@xmtp/proto": "3.62.1", "long": "^5.2.3" }, From 7eb108fd88ad6fff80e00942f4c3effc3dde2944 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 8 Jul 2024 15:32:11 -0500 Subject: [PATCH 094/107] Upgrade testing deps --- packages/consent-proof-signature/package.json | 2 +- packages/frames-client/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 6b4900491..a2d77bcfb 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -85,7 +85,7 @@ "typedoc": "^0.26.3", "typescript": "^5.5.3", "vite": "^5.3.3", - "vitest": "^1.6.0" + "vitest": "^2.0.1" }, "packageManager": "yarn@4.3.1", "publishConfig": { diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 921cee454..68a46dd51 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -89,7 +89,7 @@ "typescript": "^5.5.3", "vite": "^5.3.3", "vite-tsconfig-paths": "^4.3.2", - "vitest": "^1.6.0" + "vitest": "^2.0.1" }, "peerDependencies": { "@xmtp/xmtp-js": ">9.3.1" From 514f7f3aac97fd692e53116d9bd360bc53385afc Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 8 Jul 2024 15:33:56 -0500 Subject: [PATCH 095/107] Upgrade dev deps --- packages/consent-proof-signature/package.json | 2 +- packages/frames-client/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index a2d77bcfb..3496bf44b 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -79,7 +79,7 @@ "ethers": "^6.13.1", "prettier": "^3.3.2", "prettier-plugin-packagejson": "^2.5.0", - "rollup": "^4.18.0", + "rollup": "^4.18.1", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "typedoc": "^0.26.3", diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 68a46dd51..84438730a 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -81,7 +81,7 @@ "ethers": "^6.13.1", "prettier": "^3.3.2", "prettier-plugin-packagejson": "^2.5.0", - "rollup": "^4.18.0", + "rollup": "^4.18.1", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", From ebefdc5c891c2544de579661ddd69afcaf717009 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Jul 2024 21:15:27 +0000 Subject: [PATCH 096/107] release: version packages --- packages/frames-client/CHANGELOG.md | 12 ++++++++++++ packages/frames-client/package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index f70826386..ce22c2f5f 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -1,5 +1,17 @@ # @xmtp/frames-client +## 0.5.4 + +### Patch Changes + +- 3fc5b82: ### React SDK + + - Fixed dev and peer dependencies + + ### Frames client + + - Upgraded dependencies + ## 0.5.3 ### Patch Changes diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 84438730a..891227092 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-client", - "version": "0.5.3", + "version": "0.5.4", "keywords": [ "xmtp", "messaging", From 965e13d5ccf8908019f185c69c4ec9d72a42b168 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 8 Jul 2024 16:17:18 -0500 Subject: [PATCH 097/107] Update CHANGELOG.md --- packages/frames-client/CHANGELOG.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/frames-client/CHANGELOG.md b/packages/frames-client/CHANGELOG.md index ce22c2f5f..54c68f6fd 100644 --- a/packages/frames-client/CHANGELOG.md +++ b/packages/frames-client/CHANGELOG.md @@ -4,13 +4,7 @@ ### Patch Changes -- 3fc5b82: ### React SDK - - - Fixed dev and peer dependencies - - ### Frames client - - - Upgraded dependencies +- 3fc5b82: Upgraded dependencies ## 0.5.3 From 16dfda3b59b70e20794efd16d79eb8a10b9c428d Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 15 Jul 2024 13:19:42 -0500 Subject: [PATCH 098/107] Upgrade dev dependencies --- packages/consent-proof-signature/package.json | 6 +++--- packages/frames-client/package.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 3496bf44b..80167bbbb 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -77,15 +77,15 @@ "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.13.1", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "prettier-plugin-packagejson": "^2.5.0", "rollup": "^4.18.1", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", - "typedoc": "^0.26.3", + "typedoc": "^0.26.4", "typescript": "^5.5.3", "vite": "^5.3.3", - "vitest": "^2.0.1" + "vitest": "^2.0.3" }, "packageManager": "yarn@4.3.1", "publishConfig": { diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 891227092..9f88132ad 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -79,17 +79,17 @@ "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.13.1", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "prettier-plugin-packagejson": "^2.5.0", "rollup": "^4.18.1", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", - "typedoc": "^0.26.3", + "typedoc": "^0.26.4", "typescript": "^5.5.3", "vite": "^5.3.3", "vite-tsconfig-paths": "^4.3.2", - "vitest": "^2.0.1" + "vitest": "^2.0.3" }, "peerDependencies": { "@xmtp/xmtp-js": ">9.3.1" From afa95ee5dea029457e909293d267493b995ad1ba Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 17 Oct 2024 14:14:25 -0500 Subject: [PATCH 099/107] Add tsconfigs --- shared/tsconfig/react-app.json | 12 ++++++++++++ shared/tsconfig/react-sdk.json | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 shared/tsconfig/react-app.json create mode 100644 shared/tsconfig/react-sdk.json diff --git a/shared/tsconfig/react-app.json b/shared/tsconfig/react-app.json new file mode 100644 index 000000000..5481553f5 --- /dev/null +++ b/shared/tsconfig/react-app.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "React App", + "extends": "./base.json", + "compilerOptions": { + "jsx": "react-jsx", + "lib": ["DOM", "DOM.Iterable", "ESNext"], + "module": "ESNext", + "moduleResolution": "Bundler", + "target": "ESNext" + } +} diff --git a/shared/tsconfig/react-sdk.json b/shared/tsconfig/react-sdk.json new file mode 100644 index 000000000..0062b43ab --- /dev/null +++ b/shared/tsconfig/react-sdk.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "React SDK", + "extends": "./base.json", + "compilerOptions": { + "jsx": "react-jsx", + "lib": ["DOM", "DOM.Iterable", "ESNext"], + "module": "ESNext", + "moduleResolution": "Bundler", + "target": "ESNext", + "types": ["vitest", "vitest/globals"] + } +} From e05c1d1fc33cc9d6eca81f8267fbd12c53539481 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 17 Oct 2024 14:16:28 -0500 Subject: [PATCH 100/107] Refactor package.json file, run prettier --- .../consent-proof-signature/.eslintrc.cjs | 7 - packages/consent-proof-signature/README.md | 5 +- packages/consent-proof-signature/package.json | 16 +- .../consent-proof-signature/rollup.config.js | 4 +- packages/consent-proof-signature/src/index.ts | 3 +- .../tsconfig.eslint.json | 5 - .../consent-proof-signature/tsconfig.json | 4 +- packages/frames-client/.eslintrc.cjs | 7 - packages/frames-client/package.json | 18 +- packages/frames-client/rollup.config.js | 6 +- packages/frames-client/src/client.ts | 12 +- packages/frames-client/src/converters.test.ts | 4 +- packages/frames-client/src/index.test.ts | 6 +- packages/frames-client/src/types.ts | 2 +- packages/frames-client/src/utils.test.ts | 2 +- packages/frames-client/src/utils.ts | 4 +- packages/frames-client/tsconfig.eslint.json | 5 - packages/frames-client/tsconfig.json | 4 +- packages/frames-client/vitest.config.ts | 2 +- yarn.lock | 188 +++++++++++++++++- 20 files changed, 218 insertions(+), 86 deletions(-) delete mode 100644 packages/consent-proof-signature/.eslintrc.cjs delete mode 100644 packages/consent-proof-signature/tsconfig.eslint.json delete mode 100644 packages/frames-client/.eslintrc.cjs delete mode 100644 packages/frames-client/tsconfig.eslint.json diff --git a/packages/consent-proof-signature/.eslintrc.cjs b/packages/consent-proof-signature/.eslintrc.cjs deleted file mode 100644 index 0e3d6a266..000000000 --- a/packages/consent-proof-signature/.eslintrc.cjs +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - root: true, - extends: ["xmtp-web"], - parserOptions: { - project: "./tsconfig.eslint.json", - }, -}; diff --git a/packages/consent-proof-signature/README.md b/packages/consent-proof-signature/README.md index afb9a5cc3..29e34c334 100644 --- a/packages/consent-proof-signature/README.md +++ b/packages/consent-proof-signature/README.md @@ -3,11 +3,12 @@ ## Usage ```ts -const timestamp = Date.now(); -const message = createConsentMessage(broadcastAddress, timestamp); // Sign the message for example with Viem import { createWalletClient, custom } from "viem"; +const timestamp = Date.now(); +const message = createConsentMessage(broadcastAddress, timestamp); + const walletClient = createWalletClient({ chain: mainnet, transport: custom((window as any).ethereum!), diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 80167bbbb..e61416540 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -11,13 +11,13 @@ "javascript", "typescript" ], - "homepage": "https://github.com/xmtp/xmtp-web", + "homepage": "https://github.com/xmtp/xmtp-js", "bugs": { - "url": "https://github.com/xmtp/xmtp-web/issues" + "url": "https://github.com/xmtp/xmtp-js/issues" }, "repository": { "type": "git", - "url": "git@github.com:xmtp/xmtp-web.git", + "url": "git@github.com:xmtp/xmtp-js.git", "directory": "packages/consent-proof-signature" }, "license": "MIT", @@ -46,10 +46,6 @@ "clean": "rm -rf .turbo && rm -rf node_modules && yarn clean:lib", "clean:lib": "rm -rf lib", "dev": "yarn clean:lib && yarn rollup -c --watch", - "format": "yarn format:base -w .", - "format:base": "prettier --ignore-path ../../.gitignore", - "format:check": "yarn format:base -c .", - "lint": "eslint . --ignore-path ../../.gitignore", "test": "vitest run --passWithNoTests", "typecheck": "tsc", "typedoc": "typedoc" @@ -73,15 +69,11 @@ "devDependencies": { "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", - "@xmtp/tsconfig": "workspace:*", - "eslint": "^8.57.0", - "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.13.1", - "prettier": "^3.3.3", - "prettier-plugin-packagejson": "^2.5.0", "rollup": "^4.18.1", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", + "tsconfig": "workspace:*", "typedoc": "^0.26.4", "typescript": "^5.5.3", "vite": "^5.3.3", diff --git a/packages/consent-proof-signature/rollup.config.js b/packages/consent-proof-signature/rollup.config.js index 87f1b47ba..77e66f1d5 100644 --- a/packages/consent-proof-signature/rollup.config.js +++ b/packages/consent-proof-signature/rollup.config.js @@ -1,7 +1,7 @@ -import { defineConfig } from "rollup"; +import terser from "@rollup/plugin-terser"; import typescript from "@rollup/plugin-typescript"; +import { defineConfig } from "rollup"; import { dts } from "rollup-plugin-dts"; -import terser from "@rollup/plugin-terser"; import filesize from "rollup-plugin-filesize"; const plugins = [ diff --git a/packages/consent-proof-signature/src/index.ts b/packages/consent-proof-signature/src/index.ts index b3a54f7ca..c854f46c9 100644 --- a/packages/consent-proof-signature/src/index.ts +++ b/packages/consent-proof-signature/src/index.ts @@ -1,5 +1,6 @@ -import Long from "long"; import { invitation } from "@xmtp/proto"; +import Long from "long"; + /** * * @param peerAddress - Ethereum address of the broadcaster diff --git a/packages/consent-proof-signature/tsconfig.eslint.json b/packages/consent-proof-signature/tsconfig.eslint.json deleted file mode 100644 index bf165d3f0..000000000 --- a/packages/consent-proof-signature/tsconfig.eslint.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [".", ".eslintrc.cjs", "rollup.config.js"], - "exclude": ["lib", "node_modules"] -} diff --git a/packages/consent-proof-signature/tsconfig.json b/packages/consent-proof-signature/tsconfig.json index 235fbd5e9..b0fc3ebd2 100644 --- a/packages/consent-proof-signature/tsconfig.json +++ b/packages/consent-proof-signature/tsconfig.json @@ -1,4 +1,4 @@ { - "extends": "@xmtp/tsconfig/react-sdk.json", - "include": ["src", ".eslintrc.cjs", "vitest.config.ts", "vitest.setup.ts"] + "extends": "tsconfig/react-sdk.json", + "include": ["src", "rollup.config.js", "vitest.config.ts"] } diff --git a/packages/frames-client/.eslintrc.cjs b/packages/frames-client/.eslintrc.cjs deleted file mode 100644 index 0e3d6a266..000000000 --- a/packages/frames-client/.eslintrc.cjs +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - root: true, - extends: ["xmtp-web"], - parserOptions: { - project: "./tsconfig.eslint.json", - }, -}; diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 9f88132ad..b3347c2ff 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -11,13 +11,13 @@ "javascript", "typescript" ], - "homepage": "https://github.com/xmtp/xmtp-web", + "homepage": "https://github.com/xmtp/xmtp-js", "bugs": { - "url": "https://github.com/xmtp/xmtp-web/issues" + "url": "https://github.com/xmtp/xmtp-js/issues" }, "repository": { "type": "git", - "url": "git@github.com:xmtp/xmtp-web.git", + "url": "git@github.com:xmtp/xmtp-js.git", "directory": "packages/frames-client" }, "license": "MIT", @@ -44,10 +44,6 @@ "clean": "rm -rf .turbo && rm -rf node_modules && yarn clean:lib", "clean:lib": "rm -rf lib", "dev": "yarn clean:lib && yarn rollup -c --watch", - "format": "yarn format:base -w .", - "format:base": "prettier --ignore-path ../../.gitignore", - "format:check": "yarn format:base -c .", - "lint": "eslint . --ignore-path ../../.gitignore", "test": "vitest run --passWithNoTests", "typecheck": "tsc", "typedoc": "typedoc" @@ -74,17 +70,13 @@ "@open-frames/types": "^0.1.1", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^11.1.6", - "@xmtp/tsconfig": "workspace:*", "@xmtp/xmtp-js": "^12.0.0", - "eslint": "^8.57.0", - "eslint-config-xmtp-web": "workspace:*", "ethers": "^6.13.1", - "prettier": "^3.3.3", - "prettier-plugin-packagejson": "^2.5.0", "rollup": "^4.18.1", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", + "tsconfig": "workspace:*", "typedoc": "^0.26.4", "typescript": "^5.5.3", "vite": "^5.3.3", @@ -94,7 +86,7 @@ "peerDependencies": { "@xmtp/xmtp-js": ">9.3.1" }, - "packageManager": "yarn@4.3.1", + "packageManager": "yarn@4.5.0", "publishConfig": { "access": "public", "provenance": true, diff --git a/packages/frames-client/rollup.config.js b/packages/frames-client/rollup.config.js index 6871bf8c1..d847278c1 100644 --- a/packages/frames-client/rollup.config.js +++ b/packages/frames-client/rollup.config.js @@ -1,9 +1,9 @@ -import { defineConfig } from "rollup"; +import terser from "@rollup/plugin-terser"; import typescript from "@rollup/plugin-typescript"; +import { defineConfig } from "rollup"; 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"; +import tsConfigPaths from "rollup-plugin-tsconfig-paths"; const plugins = [ tsConfigPaths(), diff --git a/packages/frames-client/src/client.ts b/packages/frames-client/src/client.ts index 25549148d..f1ce4929e 100644 --- a/packages/frames-client/src/client.ts +++ b/packages/frames-client/src/client.ts @@ -1,24 +1,24 @@ -import type { Client } from "@xmtp/xmtp-js"; +import { sha256 } from "@noble/hashes/sha256"; import { - signature as signatureProto, - publicKey as publicKeyProto, frames, + publicKey as publicKeyProto, + signature as signatureProto, } from "@xmtp/proto"; -import { sha256 } from "@noble/hashes/sha256"; +import type { Client } from "@xmtp/xmtp-js"; import Long from "long"; import { PROTOCOL_VERSION } from "./constants"; +import { v1ToV2Bundle } from "./converters"; +import OpenFramesProxy from "./proxy"; import type { FrameActionInputs, FramePostPayload, ReactNativeClient, } from "./types"; -import { v1ToV2Bundle } from "./converters"; import { base64Encode, buildOpaqueIdentifier, isReactNativeClient, } from "./utils"; -import OpenFramesProxy from "./proxy"; export class FramesClient { xmtpClient: Client | ReactNativeClient; diff --git a/packages/frames-client/src/converters.test.ts b/packages/frames-client/src/converters.test.ts index ce939eb69..bf77320aa 100644 --- a/packages/frames-client/src/converters.test.ts +++ b/packages/frames-client/src/converters.test.ts @@ -1,6 +1,6 @@ -import { Wallet } from "ethers"; -import { it, expect, describe } from "vitest"; import { PrivateKeyBundleV1, SignedPublicKeyBundle } from "@xmtp/xmtp-js"; +import { Wallet } from "ethers"; +import { describe, expect, it } from "vitest"; import { v1ToV2Bundle } from "./converters"; describe("converters", () => { diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 5df76dc87..87050aed4 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -1,8 +1,8 @@ +import { sha256 } from "@noble/hashes/sha256"; +import { fetcher, frames } from "@xmtp/proto"; import { Client, Signature, SignedPublicKey } from "@xmtp/xmtp-js"; import { Wallet } from "ethers"; -import { frames, fetcher } from "@xmtp/proto"; -import { it, expect, describe, beforeEach } from "vitest"; -import { sha256 } from "@noble/hashes/sha256"; +import { beforeEach, describe, expect, it } from "vitest"; import { FramesClient } from "./client"; const { b64Decode } = fetcher; diff --git a/packages/frames-client/src/types.ts b/packages/frames-client/src/types.ts index 44dfc9f55..e2de54477 100644 --- a/packages/frames-client/src/types.ts +++ b/packages/frames-client/src/types.ts @@ -1,9 +1,9 @@ -import type { OpenFramesUntrustedData } from "@open-frames/types"; import type { GetMetadataResponse, PostRedirectResponse, TransactionResponse, } from "@open-frames/proxy-client"; +import type { OpenFramesUntrustedData } from "@open-frames/types"; export type FramesApiResponse = GetMetadataResponse; diff --git a/packages/frames-client/src/utils.test.ts b/packages/frames-client/src/utils.test.ts index a4fa7a9b6..f3ce14c78 100644 --- a/packages/frames-client/src/utils.test.ts +++ b/packages/frames-client/src/utils.test.ts @@ -1,5 +1,5 @@ -import { it, expect, describe } from "vitest"; import { webcrypto } from "crypto"; +import { describe, expect, it } from "vitest"; import { base64Encode, buildOpaqueIdentifier, diff --git a/packages/frames-client/src/utils.ts b/packages/frames-client/src/utils.ts index 78bc13ec3..1cd4a97d8 100644 --- a/packages/frames-client/src/utils.ts +++ b/packages/frames-client/src/utils.ts @@ -1,8 +1,8 @@ -import { fetcher } from "@xmtp/proto"; import { sha256 } from "@noble/hashes/sha256"; +import { fetcher } from "@xmtp/proto"; import type { Client } from "@xmtp/xmtp-js"; -import type { FrameActionInputs, ReactNativeClient } from "./types"; import { InvalidArgumentsError } from "./errors"; +import type { FrameActionInputs, ReactNativeClient } from "./types"; const { b64Encode } = fetcher; diff --git a/packages/frames-client/tsconfig.eslint.json b/packages/frames-client/tsconfig.eslint.json deleted file mode 100644 index bf165d3f0..000000000 --- a/packages/frames-client/tsconfig.eslint.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [".", ".eslintrc.cjs", "rollup.config.js"], - "exclude": ["lib", "node_modules"] -} diff --git a/packages/frames-client/tsconfig.json b/packages/frames-client/tsconfig.json index 235fbd5e9..b0fc3ebd2 100644 --- a/packages/frames-client/tsconfig.json +++ b/packages/frames-client/tsconfig.json @@ -1,4 +1,4 @@ { - "extends": "@xmtp/tsconfig/react-sdk.json", - "include": ["src", ".eslintrc.cjs", "vitest.config.ts", "vitest.setup.ts"] + "extends": "tsconfig/react-sdk.json", + "include": ["src", "rollup.config.js", "vitest.config.ts"] } diff --git a/packages/frames-client/vitest.config.ts b/packages/frames-client/vitest.config.ts index 21252a9d1..ee5fe64b2 100644 --- a/packages/frames-client/vitest.config.ts +++ b/packages/frames-client/vitest.config.ts @@ -1,6 +1,6 @@ import { defineConfig, mergeConfig } from "vite"; -import { defineConfig as defineVitestConfig } from "vitest/config"; import tsconfigPaths from "vite-tsconfig-paths"; +import { defineConfig as defineVitestConfig } from "vitest/config"; // https://vitejs.dev/config/ const viteConfig = defineConfig({ diff --git a/yarn.lock b/yarn.lock index 511ceeba0..19bb1ec05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1660,6 +1660,31 @@ __metadata: languageName: node linkType: hard +"@open-frames/proxy-client@npm:^0.3.3": + version: 0.3.3 + resolution: "@open-frames/proxy-client@npm:0.3.3" + dependencies: + "@open-frames/proxy-types": "npm:0.2.3" + checksum: 10/c75c2fbd455aae83c85bcb06308d92081b8ddfda2d26771ac9c75c5b7baea06cf2fba65fe314d2ca900a4f5b2300563d8e83e309772cade77049c62c2c23de99 + languageName: node + linkType: hard + +"@open-frames/proxy-types@npm:0.2.3": + version: 0.2.3 + resolution: "@open-frames/proxy-types@npm:0.2.3" + peerDependencies: + typescript: ^5.3.3 + checksum: 10/ab7effbb4a90e26e23b42c36c19cffc83ef50401ecf35570765516c92acc96e6461da846130a52de3e3e30ca77f64d1049a79adc012211d6eabfdf5993bee46d + languageName: node + linkType: hard + +"@open-frames/types@npm:^0.1.1": + version: 0.1.1 + resolution: "@open-frames/types@npm:0.1.1" + checksum: 10/2e23b984123f760e4fd4f205fb50e89725679563f8830a86d9d0c436315b6df02d336a4ab06c583b31c568103bc2a82dbe23d36356909a80fc9a1c0026cc04ee + languageName: node + linkType: hard + "@pkgjs/parseargs@npm:^0.11.0": version: 0.11.0 resolution: "@pkgjs/parseargs@npm:0.11.0" @@ -1795,6 +1820,25 @@ __metadata: languageName: node linkType: hard +"@rollup/plugin-typescript@npm:^11.1.6": + version: 11.1.6 + resolution: "@rollup/plugin-typescript@npm:11.1.6" + dependencies: + "@rollup/pluginutils": "npm:^5.1.0" + resolve: "npm:^1.22.1" + peerDependencies: + rollup: ^2.14.0||^3.0.0||^4.0.0 + tslib: "*" + typescript: ">=3.7.0" + peerDependenciesMeta: + rollup: + optional: true + tslib: + optional: true + checksum: 10/4ae4d6cfc929393171288df2f18b5eb837fa53d8689118d9661b3064567341f6f6cf8389af55f1d5f015e3682abf30a64ab609fdf75ecb5a84224505e407eb69 + languageName: node + linkType: hard + "@rollup/plugin-typescript@npm:^12.1.0": version: 12.1.0 resolution: "@rollup/plugin-typescript@npm:12.1.0" @@ -2233,7 +2277,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:>=13.7.0": +"@types/node@npm:*, @types/node@npm:22.7.5, @types/node@npm:>=13.7.0": version: 22.7.5 resolution: "@types/node@npm:22.7.5" dependencies: @@ -2530,6 +2574,26 @@ __metadata: languageName: node linkType: hard +"@xmtp/consent-proof-signature@workspace:packages/consent-proof-signature": + version: 0.0.0-use.local + resolution: "@xmtp/consent-proof-signature@workspace:packages/consent-proof-signature" + dependencies: + "@rollup/plugin-terser": "npm:^0.4.4" + "@rollup/plugin-typescript": "npm:^11.1.6" + "@xmtp/proto": "npm:3.62.1" + ethers: "npm:^6.13.1" + long: "npm:^5.2.3" + rollup: "npm:^4.18.1" + rollup-plugin-dts: "npm:^6.1.1" + rollup-plugin-filesize: "npm:^10.0.0" + tsconfig: "workspace:*" + typedoc: "npm:^0.26.4" + typescript: "npm:^5.5.3" + vite: "npm:^5.3.3" + vitest: "npm:^2.0.3" + languageName: unknown + linkType: soft + "@xmtp/content-type-primitives@npm:^1.0.1, @xmtp/content-type-primitives@npm:^1.0.2, @xmtp/content-type-primitives@workspace:content-types/content-type-primitives": version: 0.0.0-use.local resolution: "@xmtp/content-type-primitives@workspace:content-types/content-type-primitives" @@ -2711,6 +2775,34 @@ __metadata: languageName: unknown linkType: soft +"@xmtp/frames-client@workspace:packages/frames-client": + version: 0.0.0-use.local + resolution: "@xmtp/frames-client@workspace:packages/frames-client" + dependencies: + "@noble/hashes": "npm:^1.4.0" + "@open-frames/proxy-client": "npm:^0.3.3" + "@open-frames/types": "npm:^0.1.1" + "@rollup/plugin-terser": "npm:^0.4.4" + "@rollup/plugin-typescript": "npm:^11.1.6" + "@xmtp/proto": "npm:3.62.1" + "@xmtp/xmtp-js": "npm:^12.0.0" + ethers: "npm:^6.13.1" + long: "npm:^5.2.3" + rollup: "npm:^4.18.1" + rollup-plugin-dts: "npm:^6.1.1" + rollup-plugin-filesize: "npm:^10.0.0" + rollup-plugin-tsconfig-paths: "npm:^1.5.2" + tsconfig: "workspace:*" + typedoc: "npm:^0.26.4" + typescript: "npm:^5.5.3" + vite: "npm:^5.3.3" + vite-tsconfig-paths: "npm:^4.3.2" + vitest: "npm:^2.0.3" + peerDependencies: + "@xmtp/xmtp-js": ">9.3.1" + languageName: unknown + linkType: soft + "@xmtp/node-bindings@npm:^0.0.13": version: 0.0.13 resolution: "@xmtp/node-bindings@npm:0.0.13" @@ -2769,6 +2861,18 @@ __metadata: languageName: node linkType: hard +"@xmtp/proto@npm:3.62.1": + version: 3.62.1 + resolution: "@xmtp/proto@npm:3.62.1" + dependencies: + long: "npm:^5.2.0" + protobufjs: "npm:^7.0.0" + rxjs: "npm:^7.8.0" + undici: "npm:^5.8.1" + checksum: 10/7d6633f5ffb60725a6f3f128191944caf203fb3110a6076cdec31bc3cc6e5dca1b03170c6fa38b877125475ed3050031b93a47587c5e6bee6ebd91de53f8f0f2 + languageName: node + linkType: hard + "@xmtp/proto@npm:^3.61.1, @xmtp/proto@npm:^3.62.1, @xmtp/proto@npm:^3.68.0": version: 3.71.0 resolution: "@xmtp/proto@npm:3.71.0" @@ -2817,6 +2921,24 @@ __metadata: languageName: node linkType: hard +"@xmtp/xmtp-js@npm:^12.0.0": + version: 12.1.0 + resolution: "@xmtp/xmtp-js@npm:12.1.0" + dependencies: + "@noble/secp256k1": "npm:1.7.1" + "@xmtp/consent-proof-signature": "npm:^0.1.3" + "@xmtp/content-type-primitives": "npm:^1.0.1" + "@xmtp/content-type-text": "npm:^1.0.0" + "@xmtp/proto": "npm:^3.62.1" + "@xmtp/user-preferences-bindings-wasm": "npm:^0.3.6" + async-mutex: "npm:^0.5.0" + elliptic: "npm:^6.5.5" + long: "npm:^5.2.3" + viem: "npm:2.7.15" + checksum: 10/4368b9e7f9fb6a6b4dd63110e655ef41d9c5aabf8666c0a9f0d166e31d1f3cde1af9bd6c981d620c81b8a0466ac612195007bbb9342142da39ee1b4ff75e1adb + languageName: node + linkType: hard + "@xmtp/xmtp-js@workspace:^, @xmtp/xmtp-js@workspace:sdks/js-sdk": version: 0.0.0-use.local resolution: "@xmtp/xmtp-js@workspace:sdks/js-sdk" @@ -3768,7 +3890,7 @@ __metadata: languageName: node linkType: hard -"elliptic@npm:^6.5.4, elliptic@npm:^6.5.7": +"elliptic@npm:^6.5.4, elliptic@npm:^6.5.5, elliptic@npm:^6.5.7": version: 6.5.7 resolution: "elliptic@npm:6.5.7" dependencies: @@ -4177,6 +4299,21 @@ __metadata: languageName: node linkType: hard +"ethers@npm:^6.13.1": + version: 6.13.4 + resolution: "ethers@npm:6.13.4" + dependencies: + "@adraffy/ens-normalize": "npm:1.10.1" + "@noble/curves": "npm:1.2.0" + "@noble/hashes": "npm:1.3.2" + "@types/node": "npm:22.7.5" + aes-js: "npm:4.0.0-beta.5" + tslib: "npm:2.7.0" + ws: "npm:8.17.1" + checksum: 10/221192fed93f6b0553f3e5e72bfd667d676220577d34ff854f677e955d6f608e60636a9c08b5d54039c532a9b9b7056384f0d7019eb6e111d53175806f896ac6 + languageName: node + linkType: hard + "event-target-shim@npm:^5.0.0": version: 5.0.1 resolution: "event-target-shim@npm:5.0.1" @@ -6650,7 +6787,7 @@ __metadata: languageName: node linkType: hard -"rollup@npm:^4.20.0, rollup@npm:^4.24.0": +"rollup@npm:^4.18.1, rollup@npm:^4.20.0, rollup@npm:^4.24.0": version: 4.24.0 resolution: "rollup@npm:4.24.0" dependencies: @@ -7343,7 +7480,7 @@ __metadata: languageName: node linkType: hard -"tsconfig@workspace:shared/tsconfig": +"tsconfig@workspace:*, tsconfig@workspace:shared/tsconfig": version: 0.0.0-use.local resolution: "tsconfig@workspace:shared/tsconfig" languageName: unknown @@ -7356,7 +7493,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.1.0, tslib@npm:^2.4.0, tslib@npm:^2.6.2": +"tslib@npm:2.7.0, tslib@npm:^2.1.0, tslib@npm:^2.4.0, tslib@npm:^2.6.2": version: 2.7.0 resolution: "tslib@npm:2.7.0" checksum: 10/9a5b47ddac65874fa011c20ff76db69f97cf90c78cff5934799ab8894a5342db2d17b4e7613a087046bc1d133d21547ddff87ac558abeec31ffa929c88b7fce6 @@ -7468,6 +7605,23 @@ __metadata: languageName: node linkType: hard +"typedoc@npm:^0.26.4": + version: 0.26.10 + resolution: "typedoc@npm:0.26.10" + dependencies: + lunr: "npm:^2.3.9" + markdown-it: "npm:^14.1.0" + minimatch: "npm:^9.0.5" + shiki: "npm:^1.16.2" + yaml: "npm:^2.5.1" + peerDependencies: + typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x + bin: + typedoc: bin/typedoc + checksum: 10/22db2da44fe06274b0b6620570802baf6cefca931fca8eadbdb3ca51b1fca7c5561d0689ae73c6763cfc7aa554079a26f200b436a4d5848a7bf3ceb2aa205340 + languageName: node + linkType: hard + "typedoc@npm:^0.26.8": version: 0.26.8 resolution: "typedoc@npm:0.26.8" @@ -7508,7 +7662,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^5.3.3, typescript@npm:^5.6.3": +"typescript@npm:^5.3.3, typescript@npm:^5.5.3, typescript@npm:^5.6.3": version: 5.6.3 resolution: "typescript@npm:5.6.3" bin: @@ -7518,7 +7672,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A^5.3.3#optional!builtin, typescript@patch:typescript@npm%3A^5.6.3#optional!builtin": +"typescript@patch:typescript@npm%3A^5.3.3#optional!builtin, typescript@patch:typescript@npm%3A^5.5.3#optional!builtin, typescript@patch:typescript@npm%3A^5.6.3#optional!builtin": version: 5.6.3 resolution: "typescript@patch:typescript@npm%3A5.6.3#optional!builtin::version=5.6.3&hash=8c6c40" bin: @@ -7789,6 +7943,22 @@ __metadata: languageName: node linkType: hard +"vite-tsconfig-paths@npm:^4.3.2": + version: 4.3.2 + resolution: "vite-tsconfig-paths@npm:4.3.2" + dependencies: + debug: "npm:^4.1.1" + globrex: "npm:^0.1.2" + tsconfck: "npm:^3.0.3" + peerDependencies: + vite: "*" + peerDependenciesMeta: + vite: + optional: true + checksum: 10/c12e2087fd01ac8a694850c649b79d5b9798cdba0ef9ab4116f669d8ffa1a9a3195c5a14410d3d9a12d2f08cd35ddd74f03d9c7b13a2d590d002055cdaab45c0 + languageName: node + linkType: hard + "vite-tsconfig-paths@npm:^5.0.1": version: 5.0.1 resolution: "vite-tsconfig-paths@npm:5.0.1" @@ -7848,7 +8018,7 @@ __metadata: languageName: node linkType: hard -"vite@npm:^5.4.9": +"vite@npm:^5.3.3, vite@npm:^5.4.9": version: 5.4.9 resolution: "vite@npm:5.4.9" dependencies: @@ -7891,7 +8061,7 @@ __metadata: languageName: node linkType: hard -"vitest@npm:^2.1.3": +"vitest@npm:^2.0.3, vitest@npm:^2.1.3": version: 2.1.3 resolution: "vitest@npm:2.1.3" dependencies: From 631c70badfa1120645e6e0a23e0a72fa67ff6c2f Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 17 Oct 2024 14:21:07 -0500 Subject: [PATCH 101/107] Fix lint issues in frames-client --- packages/frames-client/src/errors.ts | 2 - packages/frames-client/src/index.test.ts | 138 +++++++++++------------ packages/frames-client/src/index.ts | 2 +- packages/frames-client/src/proxy.ts | 2 +- packages/frames-client/src/utils.ts | 2 +- packages/frames-client/vitest.config.ts | 1 + 6 files changed, 69 insertions(+), 78 deletions(-) diff --git a/packages/frames-client/src/errors.ts b/packages/frames-client/src/errors.ts index d82986d15..2548a5676 100644 --- a/packages/frames-client/src/errors.ts +++ b/packages/frames-client/src/errors.ts @@ -1,5 +1,3 @@ -/* eslint-disable max-classes-per-file */ - export class ApiError extends Error { status: number; diff --git a/packages/frames-client/src/index.test.ts b/packages/frames-client/src/index.test.ts index 87050aed4..73e2a44a8 100644 --- a/packages/frames-client/src/index.test.ts +++ b/packages/frames-client/src/index.test.ts @@ -61,7 +61,7 @@ describe("signFrameAction", () => { if ( !signedPayloadProto.signature || - !signedPayloadProto?.signedPublicKeyBundle?.identityKey + !signedPayloadProto.signedPublicKeyBundle?.identityKey ) { throw new Error("Missing signature"); } @@ -81,81 +81,73 @@ describe("signFrameAction", () => { }); // Will add E2E tests back once we have Frames deployed with the new schema - it( - "works e2e", - async () => { - const frameUrl = - "https://fc-polls-five.vercel.app/polls/01032f47-e976-42ee-9e3d-3aac1324f4b8"; - const metadata = await framesClient.proxy.readMetadata(frameUrl); - expect(metadata).toBeDefined(); - expect(metadata.frameInfo).toMatchObject({ - acceptedClients: { - farcaster: "vNext", + it("works e2e", async () => { + const frameUrl = + "https://fc-polls-five.vercel.app/polls/01032f47-e976-42ee-9e3d-3aac1324f4b8"; + const metadata = await framesClient.proxy.readMetadata(frameUrl); + expect(metadata).toBeDefined(); + expect(metadata.frameInfo).toMatchObject({ + acceptedClients: { + farcaster: "vNext", + }, + buttons: { + "1": { + label: "Yes", }, - buttons: { - "1": { - label: "Yes", - }, - "2": { - label: "No", - }, + "2": { + label: "No", }, - image: { - content: - "https://fc-polls-five.vercel.app/api/image?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", - }, - postUrl: - "https://fc-polls-five.vercel.app/api/vote?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", - }); - const signedPayload = await framesClient.signFrameAction({ - frameUrl, - buttonIndex: 1, - conversationTopic: "foo", - participantAccountAddresses: ["amal", "bola"], - }); - const postUrl = metadata.extractedTags["fc:frame:post_url"]; - const response = await framesClient.proxy.post(postUrl, signedPayload); - expect(response).toBeDefined(); - expect(response.extractedTags["fc:frame"]).toEqual("vNext"); + }, + image: { + content: + "https://fc-polls-five.vercel.app/api/image?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", + }, + postUrl: + "https://fc-polls-five.vercel.app/api/vote?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", + }); + const signedPayload = await framesClient.signFrameAction({ + frameUrl, + buttonIndex: 1, + conversationTopic: "foo", + participantAccountAddresses: ["amal", "bola"], + }); + const postUrl = metadata.extractedTags["fc:frame:post_url"]; + const response = await framesClient.proxy.post(postUrl, signedPayload); + expect(response).toBeDefined(); + expect(response.extractedTags["fc:frame"]).toEqual("vNext"); - const imageUrl = response.extractedTags["fc:frame:image"]; - const mediaUrl = framesClient.proxy.mediaUrl(imageUrl); + const imageUrl = response.extractedTags["fc:frame:image"]; + const mediaUrl = framesClient.proxy.mediaUrl(imageUrl); - const downloadedMedia = await fetch(mediaUrl); - expect(downloadedMedia.ok).toBeTruthy(); - expect(downloadedMedia.headers.get("content-type")).toEqual("image/png"); - }, - // Add a long timeout because Vercel cold starts can be slow - { timeout: 20000 }, - ); - it( - "sends back the button postUrl for a tx frame in frame info", - async () => { - const frameUrl = - "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/"; - const metadata = await framesClient.proxy.readMetadata(frameUrl); - expect(metadata).toBeDefined(); - expect(metadata.frameInfo).toMatchObject({ - acceptedClients: { - xmtp: "2024-02-09", - farcaster: "vNext", - }, - buttons: { - "1": { - label: "Make transaction", - action: "tx", - target: - "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/api/transaction", - postUrl: - "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/api/transaction-success", - }, - }, - image: { - content: - "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/api/og?transaction=null", + const downloadedMedia = await fetch(mediaUrl); + expect(downloadedMedia.ok).toBeTruthy(); + expect(downloadedMedia.headers.get("content-type")).toEqual("image/png"); + }); + + it("sends back the button postUrl for a tx frame in frame info", async () => { + const frameUrl = + "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/"; + const metadata = await framesClient.proxy.readMetadata(frameUrl); + expect(metadata).toBeDefined(); + expect(metadata.frameInfo).toMatchObject({ + acceptedClients: { + xmtp: "2024-02-09", + farcaster: "vNext", + }, + buttons: { + "1": { + label: "Make transaction", + action: "tx", + target: + "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/api/transaction", + postUrl: + "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/api/transaction-success", }, - }); - }, - { timeout: 20000 }, - ); + }, + image: { + content: + "https://tx-boilerplate-frame-git-main-xmtp-labs.vercel.app/api/og?transaction=null", + }, + }); + }); }); diff --git a/packages/frames-client/src/index.ts b/packages/frames-client/src/index.ts index a763bd2b9..56201315d 100644 --- a/packages/frames-client/src/index.ts +++ b/packages/frames-client/src/index.ts @@ -1,4 +1,4 @@ -export * from "./types"; +export type * from "./types"; export * from "./constants"; export { FramesClient } from "./client"; export { default as OpenFramesProxy } from "./proxy"; diff --git a/packages/frames-client/src/proxy.ts b/packages/frames-client/src/proxy.ts index 30b8ead60..a2e3af112 100644 --- a/packages/frames-client/src/proxy.ts +++ b/packages/frames-client/src/proxy.ts @@ -37,7 +37,7 @@ export default class OpenFramesProxy { } mediaUrl(url: string): string { - if (url?.startsWith("data:")) { + if (url.startsWith("data:")) { return url; } return this.inner.mediaUrl(url); diff --git a/packages/frames-client/src/utils.ts b/packages/frames-client/src/utils.ts index 1cd4a97d8..78f830867 100644 --- a/packages/frames-client/src/utils.ts +++ b/packages/frames-client/src/utils.ts @@ -8,7 +8,7 @@ const { b64Encode } = fetcher; export function concatArrays(...arrays: Uint8Array[]): Uint8Array { return new Uint8Array( - arrays.reduce((acc, arr) => acc.concat(Array.from(arr)), [] as number[]), + arrays.reduce((acc, arr) => acc.concat(Array.from(arr)), []), ); } diff --git a/packages/frames-client/vitest.config.ts b/packages/frames-client/vitest.config.ts index ee5fe64b2..5b9029d98 100644 --- a/packages/frames-client/vitest.config.ts +++ b/packages/frames-client/vitest.config.ts @@ -11,6 +11,7 @@ const vitestConfig = defineVitestConfig({ test: { globals: true, environment: "happy-dom", + testTimeout: 60000, }, }); From 854538763112bdf98e792b3039cfb1d9319fb6f0 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 17 Oct 2024 14:23:46 -0500 Subject: [PATCH 102/107] Update READMEs --- README.md | 5 +++++ packages/consent-proof-signature/README.md | 2 +- packages/frames-client/README.md | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4fe30cddb..1a17ee267 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,11 @@ To learn more about the contents of this repository, see this README and the REA - [`content-type-text`](content-types/content-type-text): Content type for plain text messages - [`content-type-transaction-reference`](content-types/content-type-transaction-reference): Content type for on-chain transaction references +### Packages + +- [`frames-client`](https://github.com/xmtp/xmtp-js/blob/main/packages/frames-client): XMTP Open Frames client +- [`consent-proof-signature`](https://github.com/xmtp/xmtp-js/blob/main/packages/consent-proof-signature): Lightweight package for creating consent proofs + ## Contributing See our [contribution guide](./CONTRIBUTING.md) to learn more about contributing to this project. diff --git a/packages/consent-proof-signature/README.md b/packages/consent-proof-signature/README.md index 29e34c334..1ce16cf5d 100644 --- a/packages/consent-proof-signature/README.md +++ b/packages/consent-proof-signature/README.md @@ -21,4 +21,4 @@ const signature = await walletClient.signMessage({ const consentProofBytes = createConsentProofPayload(signature, timestamp); ``` -Now the consentProofBytes can be encoded and sent to a service to decode and add in a new conversation invitation +Now the `consentProofBytes` can be encoded and sent to a service to decode and add in a new conversation invitation diff --git a/packages/frames-client/README.md b/packages/frames-client/README.md index edeacbcd5..06505de6d 100644 --- a/packages/frames-client/README.md +++ b/packages/frames-client/README.md @@ -1,6 +1,6 @@ # Frames Client -This repo is used by messaging apps to render Open Frames. +This package is used by messaging apps to render Open Frames. ## Usage From ffa422088dca62b1f3ee3b4595acb940760308d9 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 17 Oct 2024 14:29:22 -0500 Subject: [PATCH 103/107] Change output dir to /dist --- packages/consent-proof-signature/package.json | 26 +++++++++---------- .../consent-proof-signature/rollup.config.js | 8 +++--- .../consent-proof-signature/tsconfig.json | 3 ++- packages/frames-client/package.json | 20 +++++++------- packages/frames-client/rollup.config.js | 6 ++--- packages/frames-client/tsconfig.json | 3 ++- 6 files changed, 34 insertions(+), 32 deletions(-) diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index e61416540..16fdc04e3 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -26,26 +26,26 @@ "type": "module", "exports": { ".": { - "types": "./lib/index.d.ts", - "require": "./lib/index.cjs", - "import": "./lib/index.js" + "types": "./dist/index.d.ts", + "require": "./dist/index.cjs", + "import": "./dist/index.js" } }, - "main": "lib/index.cjs", - "module": "lib/index.js", - "browser": "lib/index.js", - "types": "lib/index.d.ts", + "main": "dist/index.cjs", + "module": "dist/index.js", + "browser": "dist/index.js", + "types": "dist/index.d.ts", "files": [ - "lib", + "dist", "src", "!src/**/*.test.*", "tsconfig.json" ], "scripts": { - "build": "yarn clean:lib && yarn rollup -c", - "clean": "rm -rf .turbo && rm -rf node_modules && yarn clean:lib", - "clean:lib": "rm -rf lib", - "dev": "yarn clean:lib && yarn rollup -c --watch", + "build": "yarn clean:dist && yarn rollup -c", + "clean": "rm -rf .turbo && rm -rf node_modules && yarn clean:dist", + "clean:dist": "rm -rf dist", + "dev": "yarn clean:dist && yarn rollup -c --watch", "test": "vitest run --passWithNoTests", "typecheck": "tsc", "typedoc": "typedoc" @@ -79,7 +79,7 @@ "vite": "^5.3.3", "vitest": "^2.0.3" }, - "packageManager": "yarn@4.3.1", + "packageManager": "yarn@4.5.0", "publishConfig": { "access": "public", "provenance": true, diff --git a/packages/consent-proof-signature/rollup.config.js b/packages/consent-proof-signature/rollup.config.js index 77e66f1d5..455d229ed 100644 --- a/packages/consent-proof-signature/rollup.config.js +++ b/packages/consent-proof-signature/rollup.config.js @@ -20,7 +20,7 @@ export default defineConfig([ { input: "src/index.ts", output: { - file: "lib/index.js", + file: "dist/index.js", format: "es", sourcemap: true, }, @@ -30,7 +30,7 @@ export default defineConfig([ { input: "src/index.ts", output: { - file: "lib/index.cjs", + file: "dist/index.cjs", format: "cjs", sourcemap: true, }, @@ -40,7 +40,7 @@ export default defineConfig([ { input: "src/index.ts", output: { - file: "lib/browser/index.js", + file: "dist/browser/index.js", format: "es", sourcemap: true, }, @@ -50,7 +50,7 @@ export default defineConfig([ { input: "src/index.ts", output: { - file: "lib/index.d.ts", + file: "dist/index.d.ts", format: "es", }, plugins: [dts()], diff --git a/packages/consent-proof-signature/tsconfig.json b/packages/consent-proof-signature/tsconfig.json index b0fc3ebd2..8dd79af93 100644 --- a/packages/consent-proof-signature/tsconfig.json +++ b/packages/consent-proof-signature/tsconfig.json @@ -1,4 +1,5 @@ { "extends": "tsconfig/react-sdk.json", - "include": ["src", "rollup.config.js", "vitest.config.ts"] + "include": ["src", "rollup.config.js", "vitest.config.ts"], + "exclude": ["dist", "node_modules"] } diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index b3347c2ff..c1ab0d897 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -26,24 +26,24 @@ "type": "module", "exports": { ".": { - "types": "./lib/index.d.ts", - "default": "./lib/index.js" + "types": "./dist/index.d.ts", + "default": "./dist/index.js" } }, - "module": "lib/index.js", - "browser": "lib/index.js", - "types": "lib/index.d.ts", + "module": "dist/index.js", + "browser": "dist/index.js", + "types": "dist/index.d.ts", "files": [ - "lib", + "dist", "src", "!src/**/*.test.*", "tsconfig.json" ], "scripts": { - "build": "yarn clean:lib && yarn rollup -c", - "clean": "rm -rf .turbo && rm -rf node_modules && yarn clean:lib", - "clean:lib": "rm -rf lib", - "dev": "yarn clean:lib && yarn rollup -c --watch", + "build": "yarn clean:dist && yarn rollup -c", + "clean": "rm -rf .turbo && rm -rf node_modules && yarn clean:dist", + "clean:dist": "rm -rf dist", + "dev": "yarn clean:dist && yarn rollup -c --watch", "test": "vitest run --passWithNoTests", "typecheck": "tsc", "typedoc": "typedoc" diff --git a/packages/frames-client/rollup.config.js b/packages/frames-client/rollup.config.js index d847278c1..90ec607ab 100644 --- a/packages/frames-client/rollup.config.js +++ b/packages/frames-client/rollup.config.js @@ -28,7 +28,7 @@ export default defineConfig([ { input: "src/index.ts", output: { - file: "lib/index.js", + file: "dist/index.js", format: "es", sourcemap: true, }, @@ -38,7 +38,7 @@ export default defineConfig([ { input: "src/index.ts", output: { - file: "lib/browser/index.js", + file: "dist/browser/index.js", format: "es", sourcemap: true, }, @@ -48,7 +48,7 @@ export default defineConfig([ { input: "src/index.ts", output: { - file: "lib/index.d.ts", + file: "dist/index.d.ts", format: "es", }, plugins: [tsConfigPaths(), dts()], diff --git a/packages/frames-client/tsconfig.json b/packages/frames-client/tsconfig.json index b0fc3ebd2..8dd79af93 100644 --- a/packages/frames-client/tsconfig.json +++ b/packages/frames-client/tsconfig.json @@ -1,4 +1,5 @@ { "extends": "tsconfig/react-sdk.json", - "include": ["src", "rollup.config.js", "vitest.config.ts"] + "include": ["src", "rollup.config.js", "vitest.config.ts"], + "exclude": ["dist", "node_modules"] } From 135c7ac8a0d3e71a12d6d2b2b5afc9f9f5efc711 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 17 Oct 2024 14:30:32 -0500 Subject: [PATCH 104/107] Add GitHub workflow for packages --- .github/workflows/packages.yml | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/packages.yml diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml new file mode 100644 index 000000000..a69cc137f --- /dev/null +++ b/.github/workflows/packages.yml @@ -0,0 +1,76 @@ +name: Packages + +on: + push: + branches: + - main + + pull_request: + paths: + - "packages/**" + - ".github/workflows/packages.yml" + - "dev/**" + - ".node-version" + - ".nvmrc" + - ".yarnrc.yml" + - "turbo.json" + - "yarn.lock" + +jobs: + typecheck: + name: Typecheck + runs-on: warp-ubuntu-latest-x64-8x + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "yarn" + env: + SKIP_YARN_COREPACK_CHECK: "1" + - name: Enable corepack + run: corepack enable + - name: Install dependencies + run: yarn + - name: Typecheck + run: yarn turbo run typecheck --filter='./packages/*' + + test: + name: Test + runs-on: warp-ubuntu-latest-x64-8x + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "yarn" + env: + SKIP_YARN_COREPACK_CHECK: "1" + - name: Enable corepack + run: corepack enable + - name: Install dependencies + run: yarn + - name: Start dev environment + run: ./dev/up + - name: Sleep for 5 seconds + run: sleep 5s + - name: Run tests + run: yarn turbo run test --filter='./packages/*' + + build: + name: Build + runs-on: warp-ubuntu-latest-x64-8x + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "yarn" + env: + SKIP_YARN_COREPACK_CHECK: "1" + - name: Enable corepack + run: corepack enable + - name: Install dependencies + run: yarn + - name: Build + run: yarn turbo run build --filter='./packages/*' From ccbbd79f6f0a77441a6435f59092a4a9bce9846e Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 17 Oct 2024 14:39:06 -0500 Subject: [PATCH 105/107] Fix yarn.lock --- yarn.lock | 399 +++++++++++++++++++++--------------------------------- 1 file changed, 158 insertions(+), 241 deletions(-) diff --git a/yarn.lock b/yarn.lock index 19bb1ec05..8f4e7c66a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -91,15 +91,15 @@ __metadata: linkType: hard "@babel/compat-data@npm:^7.25.7": - version: 7.25.7 - resolution: "@babel/compat-data@npm:7.25.7" - checksum: 10/8fdc451e0ed9e22d1324d504b84d4452ba6f4a806b0f5c364996ee4c2a77293f79ecf4da03033acb625c90bac115c61617eb6c894c2b88486724bcbe3af1a6eb + version: 7.25.8 + resolution: "@babel/compat-data@npm:7.25.8" + checksum: 10/269fcb0d89e02e36c8a11e0c1b960a6b4204e88f59f20c374d28f8e318f4cd5ded42dfedc4b54162065e6a10f71c0de651f5ed3f9b45d3a4b52240196df85726 languageName: node linkType: hard "@babel/core@npm:^7.24.0": - version: 7.25.7 - resolution: "@babel/core@npm:7.25.7" + version: 7.25.8 + resolution: "@babel/core@npm:7.25.8" dependencies: "@ampproject/remapping": "npm:^2.2.0" "@babel/code-frame": "npm:^7.25.7" @@ -107,16 +107,16 @@ __metadata: "@babel/helper-compilation-targets": "npm:^7.25.7" "@babel/helper-module-transforms": "npm:^7.25.7" "@babel/helpers": "npm:^7.25.7" - "@babel/parser": "npm:^7.25.7" + "@babel/parser": "npm:^7.25.8" "@babel/template": "npm:^7.25.7" "@babel/traverse": "npm:^7.25.7" - "@babel/types": "npm:^7.25.7" + "@babel/types": "npm:^7.25.8" convert-source-map: "npm:^2.0.0" debug: "npm:^4.1.0" gensync: "npm:^1.0.0-beta.2" json5: "npm:^2.2.3" semver: "npm:^6.3.1" - checksum: 10/f5fb7fb1e3ce357485cb33fe7984051a2d416472370b33144ae809df86a4663192b58cf0d828d40674d30f485790f3dd5aaf72eb659487673a4dc4be47cb3575 + checksum: 10/31eb1a8ca1a3cc0026060720eb290e68205d95c5c00fbd831e69ddc0810f5920b8eb2749db1889ac0a0312b6eddbf321d18a996a88858f3b75c9582bef9ec1e4 languageName: node linkType: hard @@ -222,14 +222,14 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.24.0, @babel/parser@npm:^7.25.4, @babel/parser@npm:^7.25.7": - version: 7.25.7 - resolution: "@babel/parser@npm:7.25.7" +"@babel/parser@npm:^7.24.0, @babel/parser@npm:^7.25.4, @babel/parser@npm:^7.25.7, @babel/parser@npm:^7.25.8": + version: 7.25.8 + resolution: "@babel/parser@npm:7.25.8" dependencies: - "@babel/types": "npm:^7.25.7" + "@babel/types": "npm:^7.25.8" bin: parser: ./bin/babel-parser.js - checksum: 10/98eaa81bd378734a5f2790f02c7c076ecaba0839217445b4b84f45a7b391d640c34034253231a5bb2b2daf8204796f03584c3f94c10d46b004369bbb426a418f + checksum: 10/0396eb71e379903cedb43862f84ebb1bec809c41e82b4894d2e6e83b8e8bc636ba6eff45382e615baefdb2399ede76ca82247ecc3a9877ac16eb3140074a3276 languageName: node linkType: hard @@ -268,14 +268,14 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.24.0, @babel/types@npm:^7.25.4, @babel/types@npm:^7.25.7": - version: 7.25.7 - resolution: "@babel/types@npm:7.25.7" +"@babel/types@npm:^7.24.0, @babel/types@npm:^7.25.4, @babel/types@npm:^7.25.7, @babel/types@npm:^7.25.8": + version: 7.25.8 + resolution: "@babel/types@npm:7.25.8" dependencies: "@babel/helper-string-parser": "npm:^7.25.7" "@babel/helper-validator-identifier": "npm:^7.25.7" to-fast-properties: "npm:^2.0.0" - checksum: 10/4504e16a95b6a67d50cfaa389bcbc0621019084cff73784ad4797f82d1bb76c870cb0abb6d9881d5776eb06b4607419a2b1205a08c3e87b152d74bd0884b822a + checksum: 10/973108dbb189916bb87360f2beff43ae97f1b08f1c071bc6499d363cce48b3c71674bf3b59dfd617f8c5062d1c76dc2a64232bc07b6ccef831fd0c06162d44d9 languageName: node linkType: hard @@ -1377,7 +1377,18 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-engine@npm:^9.0.1, @metamask/json-rpc-engine@npm:^9.0.3": +"@metamask/json-rpc-engine@npm:^10.0.0": + version: 10.0.0 + resolution: "@metamask/json-rpc-engine@npm:10.0.0" + dependencies: + "@metamask/rpc-errors": "npm:^7.0.0" + "@metamask/safe-event-emitter": "npm:^3.0.0" + "@metamask/utils": "npm:^9.1.0" + checksum: 10/2c401a4a64392aeb11c4f7ca8d7b458ba1106cff1e0b3dba8b3e0cc90e82f8c55ac2dc9fdfcd914b289e3298fb726d637cf21382336dde2c207cf76129ce5eab + languageName: node + linkType: hard + +"@metamask/json-rpc-engine@npm:^9.0.1": version: 9.0.3 resolution: "@metamask/json-rpc-engine@npm:9.0.3" dependencies: @@ -1389,24 +1400,24 @@ __metadata: linkType: hard "@metamask/json-rpc-middleware-stream@npm:^8.0.1": - version: 8.0.3 - resolution: "@metamask/json-rpc-middleware-stream@npm:8.0.3" + version: 8.0.4 + resolution: "@metamask/json-rpc-middleware-stream@npm:8.0.4" dependencies: - "@metamask/json-rpc-engine": "npm:^9.0.3" + "@metamask/json-rpc-engine": "npm:^10.0.0" "@metamask/safe-event-emitter": "npm:^3.0.0" "@metamask/utils": "npm:^9.1.0" readable-stream: "npm:^3.6.2" - checksum: 10/21299e30f735b56d50737739cdc711667e7862b27bf4ce6b73bfa5b9cd7763d5a3022caf1bb2786600169674ac87e7a141321752b92ddd46c12f41dd10b666ae + checksum: 10/93c842e1ac8e624c65d888cb3539b38ade5b8415ea45f649d78dad91e7139f11fa96bbf89136998d21def7711b3f710939f8e4498ce31a6cf461892e3f4ba176 languageName: node linkType: hard "@metamask/object-multiplex@npm:^2.0.0": - version: 2.0.0 - resolution: "@metamask/object-multiplex@npm:2.0.0" + version: 2.1.0 + resolution: "@metamask/object-multiplex@npm:2.1.0" dependencies: once: "npm:^1.4.0" readable-stream: "npm:^3.6.2" - checksum: 10/54baea752a3ac7c2742c376512e00d4902d383e9da8787574d3b21eb0081523309e24e3915a98f3ae0341d65712b6832d2eb7eeb862f4ef0da1ead52dcde5387 + checksum: 10/e119f695e89eb20c3174f8ac6d74587498d85cff92c37e83e167cb758b3d3147d5b5e1a997d6198d430ebcf2cede6265bf5d4513fe96dbb2d82bbc6167752caa languageName: node linkType: hard @@ -1441,6 +1452,16 @@ __metadata: languageName: node linkType: hard +"@metamask/rpc-errors@npm:^7.0.0": + version: 7.0.0 + resolution: "@metamask/rpc-errors@npm:7.0.0" + dependencies: + "@metamask/utils": "npm:^9.0.0" + fast-safe-stringify: "npm:^2.0.6" + checksum: 10/f25e2a5506d4d0d6193c88aef8f035ec189a1177f8aee8fa01c9a33d73b1536ca7b5eea2fb33a477768bbd2abaf16529e68f0b3cf714387e5d6c9178225354fd + languageName: node + linkType: hard + "@metamask/safe-event-emitter@npm:^3.0.0, @metamask/safe-event-emitter@npm:^3.1.1": version: 3.1.1 resolution: "@metamask/safe-event-emitter@npm:3.1.1" @@ -1840,8 +1861,8 @@ __metadata: linkType: hard "@rollup/plugin-typescript@npm:^12.1.0": - version: 12.1.0 - resolution: "@rollup/plugin-typescript@npm:12.1.0" + version: 12.1.1 + resolution: "@rollup/plugin-typescript@npm:12.1.1" dependencies: "@rollup/pluginutils": "npm:^5.1.0" resolve: "npm:^1.22.1" @@ -1854,7 +1875,7 @@ __metadata: optional: true tslib: optional: true - checksum: 10/93e67032377278be3658988423588f2941eb55ccb540312ab847c050ea62a57d056d3f80c292bf463e90cbc71795498805120a0f244040d8304ba57d9bb8c09e + checksum: 10/838d5e67d1b383154fab7ae1b0c58e91844c70380210b12c1d5f2ed5d2264d4fbd21ff991a13a4a72078dce897b5c482c70554a21671269219aa9d2525f14dcd languageName: node linkType: hard @@ -2277,19 +2298,21 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:22.7.5, @types/node@npm:>=13.7.0": - version: 22.7.5 - resolution: "@types/node@npm:22.7.5" +"@types/node@npm:*, @types/node@npm:>=13.7.0": + version: 22.7.6 + resolution: "@types/node@npm:22.7.6" dependencies: undici-types: "npm:~6.19.2" - checksum: 10/e8ba102f8c1aa7623787d625389be68d64e54fcbb76d41f6c2c64e8cf4c9f4a2370e7ef5e5f1732f3c57529d3d26afdcb2edc0101c5e413a79081449825c57ac + checksum: 10/46a8d6bcd61098ece36f790c4bd500537cf78fe075dbfe48f1e07a29efa6cba18cff3b2564aed80fb183244f5d9a95a63b09e27c9f5181ed927ac16ef493bd95 languageName: node linkType: hard -"@types/node@npm:18.15.13": - version: 18.15.13 - resolution: "@types/node@npm:18.15.13" - checksum: 10/b9bbe923573797ef7c5fd2641a6793489e25d9369c32aeadcaa5c7c175c85b42eb12d6fe173f6781ab6f42eaa1ebd9576a419eeaa2a1ec810094adb8adaa9a54 +"@types/node@npm:22.7.5": + version: 22.7.5 + resolution: "@types/node@npm:22.7.5" + dependencies: + undici-types: "npm:~6.19.2" + checksum: 10/e8ba102f8c1aa7623787d625389be68d64e54fcbb76d41f6c2c64e8cf4c9f4a2370e7ef5e5f1732f3c57529d3d26afdcb2edc0101c5e413a79081449825c57ac languageName: node linkType: hard @@ -2301,11 +2324,11 @@ __metadata: linkType: hard "@types/node@npm:^20.16.11": - version: 20.16.11 - resolution: "@types/node@npm:20.16.11" + version: 20.16.12 + resolution: "@types/node@npm:20.16.12" dependencies: undici-types: "npm:~6.19.2" - checksum: 10/6d2f92b7b320c32ba0c2bc54d21651bd21690998a2e27f00d15019d4db3e0ec30fce85332efed5e37d4cda078ff93ea86ee3e92b76b7a25a9b92a52a039b60b2 + checksum: 10/689badb5af2a1a03553a6d21880fa4aabb8cf028b7db1a03be889c0026047a780ac37c83df5dca036f02f5dc3cc4000254fa40d2cadd5df0e9bd6f43dae6eac6 languageName: node linkType: hard @@ -2333,15 +2356,15 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:8.9.0": - version: 8.9.0 - resolution: "@typescript-eslint/eslint-plugin@npm:8.9.0" +"@typescript-eslint/eslint-plugin@npm:8.10.0": + version: 8.10.0 + resolution: "@typescript-eslint/eslint-plugin@npm:8.10.0" dependencies: "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:8.9.0" - "@typescript-eslint/type-utils": "npm:8.9.0" - "@typescript-eslint/utils": "npm:8.9.0" - "@typescript-eslint/visitor-keys": "npm:8.9.0" + "@typescript-eslint/scope-manager": "npm:8.10.0" + "@typescript-eslint/type-utils": "npm:8.10.0" + "@typescript-eslint/utils": "npm:8.10.0" + "@typescript-eslint/visitor-keys": "npm:8.10.0" graphemer: "npm:^1.4.0" ignore: "npm:^5.3.1" natural-compare: "npm:^1.4.0" @@ -2352,66 +2375,66 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/c1858656d7ab3d37674759c838422d8a1b7540e54a25c67c7508c38ee76594a98e8f1f269749f08700f93a7a425e0dca6eb6d031b36539c537e10a32edb4975c + checksum: 10/7a53a40b16188c95651b3d69facbfdeacba93da42850a3fb35dfc08318a5db063f42fea2b22bf8756c54bc26edeefcab8fabc39ce3d717d5f9bc765f4922b58a languageName: node linkType: hard -"@typescript-eslint/parser@npm:8.9.0": - version: 8.9.0 - resolution: "@typescript-eslint/parser@npm:8.9.0" +"@typescript-eslint/parser@npm:8.10.0": + version: 8.10.0 + resolution: "@typescript-eslint/parser@npm:8.10.0" dependencies: - "@typescript-eslint/scope-manager": "npm:8.9.0" - "@typescript-eslint/types": "npm:8.9.0" - "@typescript-eslint/typescript-estree": "npm:8.9.0" - "@typescript-eslint/visitor-keys": "npm:8.9.0" + "@typescript-eslint/scope-manager": "npm:8.10.0" + "@typescript-eslint/types": "npm:8.10.0" + "@typescript-eslint/typescript-estree": "npm:8.10.0" + "@typescript-eslint/visitor-keys": "npm:8.10.0" debug: "npm:^4.3.4" peerDependencies: eslint: ^8.57.0 || ^9.0.0 peerDependenciesMeta: typescript: optional: true - checksum: 10/6f73af7782856b292b37e43dde83c5babbbdae28da1a4fed764474a9ccbbfcce25903cedde82d6847ad53e0c1a7c2ed53f087b281e6f1408a064498169c0e2d1 + checksum: 10/b3059e112f1b85176bb5abdd403adb0b19a7560d3bcd5a6efc414d06d9aeef70d00fb6f0fd8e4923d914d4d15de35a681bdf8f55301457b5b244d7027c38f330 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:8.9.0": - version: 8.9.0 - resolution: "@typescript-eslint/scope-manager@npm:8.9.0" +"@typescript-eslint/scope-manager@npm:8.10.0": + version: 8.10.0 + resolution: "@typescript-eslint/scope-manager@npm:8.10.0" dependencies: - "@typescript-eslint/types": "npm:8.9.0" - "@typescript-eslint/visitor-keys": "npm:8.9.0" - checksum: 10/44dfb640113e8be2f5d25034f5657a9609ee06082b817dc24116c5e1d7a708ca31e8eedcc47f7d309def2ce63be662d1d0a37a1c7bdc7345968a31d04c0a2377 + "@typescript-eslint/types": "npm:8.10.0" + "@typescript-eslint/visitor-keys": "npm:8.10.0" + checksum: 10/02cf2afc57bd048639d876030f6826e7b522bf36db40b7dd7b8e1b8c6f853e8c41b41044b7a32f118bac1b721aff4dfe660d5891e0a9ee103ef87c5ee1792b4c languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:8.9.0": - version: 8.9.0 - resolution: "@typescript-eslint/type-utils@npm:8.9.0" +"@typescript-eslint/type-utils@npm:8.10.0": + version: 8.10.0 + resolution: "@typescript-eslint/type-utils@npm:8.10.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:8.9.0" - "@typescript-eslint/utils": "npm:8.9.0" + "@typescript-eslint/typescript-estree": "npm:8.10.0" + "@typescript-eslint/utils": "npm:8.10.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.3.0" peerDependenciesMeta: typescript: optional: true - checksum: 10/aaeb465ed57d140bc0d9a8b81a474eff5d1c63d99479828b4eb83a1a626dcb2b1377052a971be5b4d094d6adcf1cf8e33c41ee13369bd71aed0f9cd9f3528c8a + checksum: 10/d173232b8bb1738eeb107a76d6e8b5afdfa97b62bff23db22f8a132db01c560b7d9c2c658e3c2bdccd2e7f5dfdf75ddb70d362a44d713a8c7bacdd56e29fd2ee languageName: node linkType: hard -"@typescript-eslint/types@npm:8.9.0": - version: 8.9.0 - resolution: "@typescript-eslint/types@npm:8.9.0" - checksum: 10/4d087153605ec23c980f9bc807b122edefff828e0c3b52ef531f4b8e1d30078c39f95e84019370a395bf97eed0d7886cc50b8cd545c287f8a2a21b301272377a +"@typescript-eslint/types@npm:8.10.0": + version: 8.10.0 + resolution: "@typescript-eslint/types@npm:8.10.0" + checksum: 10/2701711c87181553b68cdeba9d8ea55e0ae8ac441b5fe9667ee8be1dbac20386698930239a0e210b73d14961110ab128559a162abaed6e890a851543b6617c97 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:8.9.0": - version: 8.9.0 - resolution: "@typescript-eslint/typescript-estree@npm:8.9.0" +"@typescript-eslint/typescript-estree@npm:8.10.0": + version: 8.10.0 + resolution: "@typescript-eslint/typescript-estree@npm:8.10.0" dependencies: - "@typescript-eslint/types": "npm:8.9.0" - "@typescript-eslint/visitor-keys": "npm:8.9.0" + "@typescript-eslint/types": "npm:8.10.0" + "@typescript-eslint/visitor-keys": "npm:8.10.0" debug: "npm:^4.3.4" fast-glob: "npm:^3.3.2" is-glob: "npm:^4.0.3" @@ -2421,31 +2444,31 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/855b433f24fad5d6791c16510d035ded31ccfd17235b45f4dcb7fa89ed57268e4bf4bf79311c5323037e6243da506b2edcb113aa51339291efb344b6d8035b1a + checksum: 10/7513fbc43a0d5f06f45e20d18b6855a3e52bd4124283a4b704bb53c6d2c7edfa783cd4fa2c35217bf8562a6bc80892067fa4780aec97d99580624cbd05cde471 languageName: node linkType: hard -"@typescript-eslint/utils@npm:8.9.0": - version: 8.9.0 - resolution: "@typescript-eslint/utils@npm:8.9.0" +"@typescript-eslint/utils@npm:8.10.0": + version: 8.10.0 + resolution: "@typescript-eslint/utils@npm:8.10.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" - "@typescript-eslint/scope-manager": "npm:8.9.0" - "@typescript-eslint/types": "npm:8.9.0" - "@typescript-eslint/typescript-estree": "npm:8.9.0" + "@typescript-eslint/scope-manager": "npm:8.10.0" + "@typescript-eslint/types": "npm:8.10.0" + "@typescript-eslint/typescript-estree": "npm:8.10.0" peerDependencies: eslint: ^8.57.0 || ^9.0.0 - checksum: 10/84efd10d6aa212103615cf52211a79f1ca02dc4fbf2dbb3a8d2aa49cd19f582b04c219ee98ed1ab77a503f967d82ce56521b1663359ff3e7faaa1f8798c19697 + checksum: 10/a28f9fbec67b92bfb9c58445f9cfeb3208d48ecfda4c3ce649e70291af1d23a05466ce76bae9f6aff1270f40a434c8b6a7a71267108b6c32b1c059758f879cc0 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:8.9.0": - version: 8.9.0 - resolution: "@typescript-eslint/visitor-keys@npm:8.9.0" +"@typescript-eslint/visitor-keys@npm:8.10.0": + version: 8.10.0 + resolution: "@typescript-eslint/visitor-keys@npm:8.10.0" dependencies: - "@typescript-eslint/types": "npm:8.9.0" + "@typescript-eslint/types": "npm:8.10.0" eslint-visitor-keys: "npm:^3.4.3" - checksum: 10/809097884b8c706f549d99bafa3e0958bd893b3deb190297110f2f1f9360e12064335c8f2df68f39be7d744d2032b5eb57b710c9671eb38f793877ab9364c731 + checksum: 10/637d4f2a812e5dcf12b2342ebb296fda5e87e425430623c31660d60e09f87fc8dc9843cc0d9b81fe4963e25ce9a44a4418e8b7878b73773f4c1375fb68006b16 languageName: node linkType: hard @@ -2564,17 +2587,7 @@ __metadata: languageName: node linkType: hard -"@xmtp/consent-proof-signature@npm:^0.1.3": - version: 0.1.3 - resolution: "@xmtp/consent-proof-signature@npm:0.1.3" - dependencies: - "@xmtp/proto": "npm:3.56.0" - long: "npm:^5.2.3" - checksum: 10/24f3c5298a951cbf561c7986ffba670400560b94ce51f1ace5b29f98c899c554e13f01b370752e2a9159ccb885d7a0031e75f6d96816c81d799df877bd59715f - languageName: node - linkType: hard - -"@xmtp/consent-proof-signature@workspace:packages/consent-proof-signature": +"@xmtp/consent-proof-signature@npm:^0.1.3, @xmtp/consent-proof-signature@workspace:packages/consent-proof-signature": version: 0.0.0-use.local resolution: "@xmtp/consent-proof-signature@workspace:packages/consent-proof-signature" dependencies: @@ -2849,18 +2862,6 @@ __metadata: languageName: node linkType: hard -"@xmtp/proto@npm:3.56.0": - version: 3.56.0 - resolution: "@xmtp/proto@npm:3.56.0" - dependencies: - long: "npm:^5.2.0" - protobufjs: "npm:^7.0.0" - rxjs: "npm:^7.8.0" - undici: "npm:^5.8.1" - checksum: 10/f752e6858692464319d6f22861fe8f23c46d9bb0eb390fe2220e0b4932a4de84be2e9e1cbafc0200e1bfe2a0ed3a3fb6079941630e57fb80e6325bc2a52bf10d - languageName: node - linkType: hard - "@xmtp/proto@npm:3.62.1": version: 3.62.1 resolution: "@xmtp/proto@npm:3.62.1" @@ -3044,7 +3045,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.12.0": +"acorn@npm:^8.12.0, acorn@npm:^8.8.2": version: 8.13.0 resolution: "acorn@npm:8.13.0" bin: @@ -3053,15 +3054,6 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.8.2": - version: 8.12.1 - resolution: "acorn@npm:8.12.1" - bin: - acorn: bin/acorn - checksum: 10/d08c2d122bba32d0861e0aa840b2ee25946c286d5dc5990abca991baf8cdbfbe199b05aacb221b979411a2fea36f83e26b5ac4f6b4e0ce49038c62316c1848f0 - languageName: node - linkType: hard - "aes-js@npm:3.0.0": version: 3.0.0 resolution: "aes-js@npm:3.0.0" @@ -3514,9 +3506,9 @@ __metadata: linkType: hard "caniuse-lite@npm:^1.0.30001663": - version: 1.0.30001667 - resolution: "caniuse-lite@npm:1.0.30001667" - checksum: 10/5f0c48abb806737c422f05d0d9dda72facc25ee8adbae2c2ea9c57b87d9c2fa9ad8c3f6d54f21aca4e31ee1742cb5dd1543bf6b9133e3f77f79a645876322414 + version: 1.0.30001669 + resolution: "caniuse-lite@npm:1.0.30001669" + checksum: 10/cd0b481bb997703cb7651e55666b4aa4e7b4ecf9784796e2393179a15e55c71a6abc6ff865c922bbd3bbfa4a4bf0530d8da13989b97ff8c7850c8a5bd4e00491 languageName: node linkType: hard @@ -3869,9 +3861,9 @@ __metadata: linkType: hard "electron-to-chromium@npm:^1.5.28": - version: 1.5.35 - resolution: "electron-to-chromium@npm:1.5.35" - checksum: 10/fe8cf5f1ec8587bbd256ddede11272808dd25cdef9d06d546c66495364e03463e9a3b664bf11ec077c1dbc91114dbeb52802b01d944e57ce922112d00b722a74 + version: 1.5.41 + resolution: "electron-to-chromium@npm:1.5.41" + checksum: 10/74e1773d954ddbea82036715f91d2ef78246c9747ac58c00efa4eae3957a29a86b9ef41adfd1a33b5e563cecfc587ad90d0b513673fce65f505af6f2e90e1777 languageName: node linkType: hard @@ -4284,22 +4276,7 @@ __metadata: languageName: node linkType: hard -"ethers@npm:^6.11.1": - version: 6.13.3 - resolution: "ethers@npm:6.13.3" - dependencies: - "@adraffy/ens-normalize": "npm:1.10.1" - "@noble/curves": "npm:1.2.0" - "@noble/hashes": "npm:1.3.2" - "@types/node": "npm:18.15.13" - aes-js: "npm:4.0.0-beta.5" - tslib: "npm:2.4.0" - ws: "npm:8.17.1" - checksum: 10/a3b11a5bd97269f2aa5e5cb844642a84fe139a188fd3c0d7d0c4c7b4958d56286e84c14cd41d1c53bd5dff8bf1060c73bd7a9bde8313f8a994d94881f4010037 - languageName: node - linkType: hard - -"ethers@npm:^6.13.1": +"ethers@npm:^6.11.1, ethers@npm:^6.13.1": version: 6.13.4 resolution: "ethers@npm:6.13.4" dependencies: @@ -5531,11 +5508,11 @@ __metadata: linkType: hard "magic-string@npm:^0.30.10, magic-string@npm:^0.30.11": - version: 0.30.11 - resolution: "magic-string@npm:0.30.11" + version: 0.30.12 + resolution: "magic-string@npm:0.30.12" dependencies: "@jridgewell/sourcemap-codec": "npm:^1.5.0" - checksum: 10/b784d2240252f5b1e755d487354ada4c672cbca16f045144f7185a75b059210e5fcca7be7be03ef1bac2ca754c4428b21d36ae64a9057ba429916f06b8c54eb2 + checksum: 10/98016180a52b28efc1362152b45671067facccdaead6b70c1c14c566cba98491bc2e1336474b0996397730dca24400e85649da84d3da62b2560ed03c067573e6 languageName: node linkType: hard @@ -6389,9 +6366,9 @@ __metadata: linkType: hard "picocolors@npm:^1.0.0, picocolors@npm:^1.1.0": - version: 1.1.0 - resolution: "picocolors@npm:1.1.0" - checksum: 10/a2ad60d94d185c30f2a140b19c512547713fb89b920d32cc6cf658fa786d63a37ba7b8451872c3d9fc34883971fb6e5878e07a20b60506e0bb2554dce9169ccb + version: 1.1.1 + resolution: "picocolors@npm:1.1.1" + checksum: 10/e1cf46bf84886c79055fdfa9dcb3e4711ad259949e3565154b004b260cd356c5d54b31a1437ce9782624bf766272fe6b0154f5f0c744fb7af5d454d2b60db045 languageName: node linkType: hard @@ -7359,8 +7336,8 @@ __metadata: linkType: hard "terser@npm:^5.17.4, terser@npm:^5.6.0": - version: 5.34.1 - resolution: "terser@npm:5.34.1" + version: 5.36.0 + resolution: "terser@npm:5.36.0" dependencies: "@jridgewell/source-map": "npm:^0.3.3" acorn: "npm:^8.8.2" @@ -7368,7 +7345,7 @@ __metadata: source-map-support: "npm:~0.5.20" bin: terser: bin/terser - checksum: 10/4389f39b5b841e2a7795ee733b54bf8fc44f8784a78c213dae32c7e6adc66c3bb258ebdcbacb8e7f1fa08fceb20bfc4ce4f7666d42bbfc29ab71126e89614c34 + checksum: 10/52e641419f79d7ccdecd136b9a8e0b03f93cfe3b53cce556253aaabc347d3f2af1745419b9e622abc95d592084dc76e57774b8f9e68d29d543f4dd11c044daf4 languageName: node linkType: hard @@ -7398,9 +7375,9 @@ __metadata: linkType: hard "tinyexec@npm:^0.3.0": - version: 0.3.0 - resolution: "tinyexec@npm:0.3.0" - checksum: 10/317cc536d091ce7e50271287798d91ef53c4dc80088844d890752a2c7387d213004cba83e5e1d9129390ced617625e34f4a8f0ba5779e31c9b6939f9be0d3543 + version: 0.3.1 + resolution: "tinyexec@npm:0.3.1" + checksum: 10/0537c70590d52d354f40c0255ff0f654a3d18ddb3812b440ddf9d436edf516c8057838ad5a38744c0c59670ec03e3cf23fbe04ae3d49f031d948274e99002569 languageName: node linkType: hard @@ -7467,8 +7444,8 @@ __metadata: linkType: hard "tsconfck@npm:^3.0.3": - version: 3.1.3 - resolution: "tsconfck@npm:3.1.3" + version: 3.1.4 + resolution: "tsconfck@npm:3.1.4" peerDependencies: typescript: ^5.0.0 peerDependenciesMeta: @@ -7476,7 +7453,7 @@ __metadata: optional: true bin: tsconfck: bin/tsconfck.js - checksum: 10/bf9b9b72de5b83f833f5dea8b276e77bab08e85751589f36dd23854fa3d5f7955194086fb8424df388bf232f2fc9a067d7913bfa674cb1217be0bba648ec71f2 + checksum: 10/4fb02e75ff374a82052b4800970bebe4466b5a6e7193d74e7b875cc8225acb5037fb4e7dcd4a5cd751c22129360cb13b4d5536897eae131d69c1a20fb18a99b4 languageName: node linkType: hard @@ -7486,20 +7463,20 @@ __metadata: languageName: unknown linkType: soft -"tslib@npm:2.4.0": - version: 2.4.0 - resolution: "tslib@npm:2.4.0" - checksum: 10/d8379e68b36caf082c1905ec25d17df8261e1d68ddc1abfd6c91158a064f6e4402039ae7c02cf4c81d12e3a2a2c7cd8ea2f57b233eb80136a2e3e7279daf2911 - languageName: node - linkType: hard - -"tslib@npm:2.7.0, tslib@npm:^2.1.0, tslib@npm:^2.4.0, tslib@npm:^2.6.2": +"tslib@npm:2.7.0": version: 2.7.0 resolution: "tslib@npm:2.7.0" checksum: 10/9a5b47ddac65874fa011c20ff76db69f97cf90c78cff5934799ab8894a5342db2d17b4e7613a087046bc1d133d21547ddff87ac558abeec31ffa929c88b7fce6 languageName: node linkType: hard +"tslib@npm:^2.1.0, tslib@npm:^2.4.0, tslib@npm:^2.6.2": + version: 2.8.0 + resolution: "tslib@npm:2.8.0" + checksum: 10/1bc7c43937477059b4d26f2dbde7e49ef0fb4f38f3014e0603eaea76d6a885742c8b1762af45949145e5e7408a736d20ded949da99dabc8ccba1fc5531d2d927 + languageName: node + linkType: hard + "tuf-js@npm:^1.1.7": version: 1.1.7 resolution: "tuf-js@npm:1.1.7" @@ -7605,7 +7582,7 @@ __metadata: languageName: node linkType: hard -"typedoc@npm:^0.26.4": +"typedoc@npm:^0.26.4, typedoc@npm:^0.26.8": version: 0.26.10 resolution: "typedoc@npm:0.26.10" dependencies: @@ -7622,34 +7599,17 @@ __metadata: languageName: node linkType: hard -"typedoc@npm:^0.26.8": - version: 0.26.8 - resolution: "typedoc@npm:0.26.8" - dependencies: - lunr: "npm:^2.3.9" - markdown-it: "npm:^14.1.0" - minimatch: "npm:^9.0.5" - shiki: "npm:^1.16.2" - yaml: "npm:^2.5.1" - peerDependencies: - typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x - bin: - typedoc: bin/typedoc - checksum: 10/a903e77fdbc45f8fa99c6454f31d36304b9edcd4f04a787bed25f0300ce779ffebfd9dc8525678484799bc2d0990bc40522a222f962a4f65a079e68950d13670 - languageName: node - linkType: hard - "typescript-eslint@npm:^8.9.0": - version: 8.9.0 - resolution: "typescript-eslint@npm:8.9.0" + version: 8.10.0 + resolution: "typescript-eslint@npm:8.10.0" dependencies: - "@typescript-eslint/eslint-plugin": "npm:8.9.0" - "@typescript-eslint/parser": "npm:8.9.0" - "@typescript-eslint/utils": "npm:8.9.0" + "@typescript-eslint/eslint-plugin": "npm:8.10.0" + "@typescript-eslint/parser": "npm:8.10.0" + "@typescript-eslint/utils": "npm:8.10.0" peerDependenciesMeta: typescript: optional: true - checksum: 10/34ec65b9f3b9b2a8a17e02bf85c3eab1b9c8a1ccd51883038a2e69f8064177de68916b92976d3b1fe96e52c95898e0de204f43269b76e2230fbefad41cf9b061 + checksum: 10/e59e5bd486155363d66ff2dc5cf81a58a4f40172286bd15ad5f00481cc3dee53837f14ead68dad2e65727c826b17a53424e6325b84bc0a9353337ff0c937b264 languageName: node linkType: hard @@ -7908,8 +7868,8 @@ __metadata: linkType: hard "viem@npm:^2.13.6": - version: 2.21.21 - resolution: "viem@npm:2.21.21" + version: 2.21.28 + resolution: "viem@npm:2.21.28" dependencies: "@adraffy/ens-normalize": "npm:1.11.0" "@noble/curves": "npm:1.6.0" @@ -7925,7 +7885,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/1fe36236c802a512a359c4710d98e627c04795cdf62bb0341c9ac6ab8afc5626431a1b471062ac29f5e2f23bca6ce933d552858f55ad1968514aaea1fb74324d + checksum: 10/191b97d26afa587297f3d940d6ee8e2724944ddd0beae417d235412dedeeef35247b2c02d5ae38904066151378101f0a271557d79625711c1c0ce155e9c8e88f languageName: node linkType: hard @@ -7975,50 +7935,7 @@ __metadata: languageName: node linkType: hard -"vite@npm:^5.0.0": - version: 5.4.8 - resolution: "vite@npm:5.4.8" - dependencies: - esbuild: "npm:^0.21.3" - fsevents: "npm:~2.3.3" - postcss: "npm:^8.4.43" - rollup: "npm:^4.20.0" - peerDependencies: - "@types/node": ^18.0.0 || >=20.0.0 - less: "*" - lightningcss: ^1.21.0 - sass: "*" - sass-embedded: "*" - stylus: "*" - sugarss: "*" - terser: ^5.4.0 - dependenciesMeta: - fsevents: - optional: true - peerDependenciesMeta: - "@types/node": - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - sass-embedded: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - bin: - vite: bin/vite.js - checksum: 10/17fdffa558abaf854f04ead7d3ddd76e4556a59871f9ac63cca3fc20a79979984837d8dddaae4b171e3d73061f781e4eec0f6d3babdbce2b4d111d29cf474c1c - languageName: node - linkType: hard - -"vite@npm:^5.3.3, vite@npm:^5.4.9": +"vite@npm:^5.0.0, vite@npm:^5.3.3, vite@npm:^5.4.9": version: 5.4.9 resolution: "vite@npm:5.4.9" dependencies: @@ -8361,11 +8278,11 @@ __metadata: linkType: hard "yaml@npm:^2.5.1": - version: 2.5.1 - resolution: "yaml@npm:2.5.1" + version: 2.6.0 + resolution: "yaml@npm:2.6.0" bin: yaml: bin.mjs - checksum: 10/0eecb679db75ea6a989ad97715a9fa5d946972945aa6aa7d2175bca66c213b5564502ccb1cdd04b1bf816ee38b5c43e4e2fda3ff6f5e09da24dabb51ae92c57d + checksum: 10/f4369f667c7626c216ea81b5840fe9b530cdae4cff2d84d166ec1239e54bf332dbfac4a71bf60d121f8e85e175364a4e280a520292269b6cf9d074368309adf9 languageName: node linkType: hard From cb0d8365044ebee05084416e159447e37bd685a4 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 17 Oct 2024 14:40:07 -0500 Subject: [PATCH 106/107] Upgrade dev deps --- .../content-type-primitives/package.json | 2 +- .../content-type-reaction/package.json | 2 +- .../content-type-read-receipt/package.json | 2 +- .../package.json | 2 +- content-types/content-type-reply/package.json | 2 +- content-types/content-type-text/package.json | 2 +- .../package.json | 2 +- package.json | 2 +- packages/consent-proof-signature/package.json | 10 +- packages/frames-client/package.json | 12 +-- sdks/js-sdk/package.json | 2 +- sdks/node-sdk/package.json | 2 +- shared/encryption/package.json | 2 +- yarn.lock | 93 ++++++------------- 14 files changed, 51 insertions(+), 86 deletions(-) diff --git a/content-types/content-type-primitives/package.json b/content-types/content-type-primitives/package.json index 598251203..4c3f47aa6 100644 --- a/content-types/content-type-primitives/package.json +++ b/content-types/content-type-primitives/package.json @@ -67,7 +67,7 @@ }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/node": "^20.16.11", "happy-dom": "^15.7.4", "rimraf": "^6.0.1", diff --git a/content-types/content-type-reaction/package.json b/content-types/content-type-reaction/package.json index 9a69e9316..3eedda353 100644 --- a/content-types/content-type-reaction/package.json +++ b/content-types/content-type-reaction/package.json @@ -67,7 +67,7 @@ }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/node": "^20.16.11", "@xmtp/xmtp-js": "^11.6.3", "buffer": "^6.0.3", diff --git a/content-types/content-type-read-receipt/package.json b/content-types/content-type-read-receipt/package.json index caa52a0af..78df7fdd9 100644 --- a/content-types/content-type-read-receipt/package.json +++ b/content-types/content-type-read-receipt/package.json @@ -67,7 +67,7 @@ }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/node": "^20.16.11", "@xmtp/xmtp-js": "^11.6.3", "buffer": "^6.0.3", diff --git a/content-types/content-type-remote-attachment/package.json b/content-types/content-type-remote-attachment/package.json index 69e2cd5d1..c0aae3d28 100644 --- a/content-types/content-type-remote-attachment/package.json +++ b/content-types/content-type-remote-attachment/package.json @@ -71,7 +71,7 @@ "devDependencies": { "@rollup/plugin-node-resolve": "^15.3.0", "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/node": "^20.16.11", "@xmtp/rollup-plugin-resolve-extensions": "^1.0.1", "@xmtp/xmtp-js": "^11.6.3", diff --git a/content-types/content-type-reply/package.json b/content-types/content-type-reply/package.json index bc3a085b5..132bc7712 100644 --- a/content-types/content-type-reply/package.json +++ b/content-types/content-type-reply/package.json @@ -68,7 +68,7 @@ }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/node": "^20.16.11", "@xmtp/content-type-remote-attachment": "workspace:*", "@xmtp/xmtp-js": "^11.6.3", diff --git a/content-types/content-type-text/package.json b/content-types/content-type-text/package.json index 80f0053de..088540983 100644 --- a/content-types/content-type-text/package.json +++ b/content-types/content-type-text/package.json @@ -67,7 +67,7 @@ }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/node": "^20.16.11", "@xmtp/xmtp-js": "^11.6.3", "buffer": "^6.0.3", diff --git a/content-types/content-type-transaction-reference/package.json b/content-types/content-type-transaction-reference/package.json index 16a50176a..eb04bb628 100644 --- a/content-types/content-type-transaction-reference/package.json +++ b/content-types/content-type-transaction-reference/package.json @@ -67,7 +67,7 @@ }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/node": "^20.16.11", "@xmtp/xmtp-js": "^11.6.3", "buffer": "^6.0.3", diff --git a/package.json b/package.json index 8f98bb7dc..700d6a4df 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "rimraf": "^6.0.1", "turbo": "^2.1.3", "typescript": "^5.6.3", - "typescript-eslint": "^8.9.0" + "typescript-eslint": "^8.10.0" }, "packageManager": "yarn@4.5.0", "engines": { diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 16fdc04e3..e8d6067a3 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -68,16 +68,16 @@ }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^11.1.6", + "@rollup/plugin-typescript": "^12.1.1", "ethers": "^6.13.1", - "rollup": "^4.18.1", + "rollup": "^4.24.0", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "tsconfig": "workspace:*", "typedoc": "^0.26.4", - "typescript": "^5.5.3", - "vite": "^5.3.3", - "vitest": "^2.0.3" + "typescript": "^5.6.3", + "vite": "^5.4.9", + "vitest": "^2.1.3" }, "packageManager": "yarn@4.5.0", "publishConfig": { diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index c1ab0d897..58c21ed96 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -69,19 +69,19 @@ "devDependencies": { "@open-frames/types": "^0.1.1", "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^11.1.6", + "@rollup/plugin-typescript": "^12.1.1", "@xmtp/xmtp-js": "^12.0.0", "ethers": "^6.13.1", - "rollup": "^4.18.1", + "rollup": "^4.24.0", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", "tsconfig": "workspace:*", "typedoc": "^0.26.4", - "typescript": "^5.5.3", - "vite": "^5.3.3", - "vite-tsconfig-paths": "^4.3.2", - "vitest": "^2.0.3" + "typescript": "^5.6.3", + "vite": "^5.4.9", + "vite-tsconfig-paths": "^5.0.1", + "vitest": "^2.1.3" }, "peerDependencies": { "@xmtp/xmtp-js": ">9.3.1" diff --git a/sdks/js-sdk/package.json b/sdks/js-sdk/package.json index 9d1fc8562..8caf45a67 100644 --- a/sdks/js-sdk/package.json +++ b/sdks/js-sdk/package.json @@ -110,7 +110,7 @@ "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^15.3.0", "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/benchmark": "^2.1.5", "@types/bl": "^5.1.0", "@types/callback-to-async-iterator": "^1.1.7", diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index 0aae5a4da..95ce99c5f 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -55,7 +55,7 @@ }, "devDependencies": { "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/node": "^20.16.11", "@vitest/coverage-v8": "^2.1.3", "@xmtp/xmtp-js": "workspace:^", diff --git a/shared/encryption/package.json b/shared/encryption/package.json index cec0deea4..5b2f2181c 100644 --- a/shared/encryption/package.json +++ b/shared/encryption/package.json @@ -57,7 +57,7 @@ }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-typescript": "^12.1.1", "@types/node": "^20.16.11", "@vitest/coverage-v8": "^2.1.3", "@xmtp/rollup-plugin-resolve-extensions": "1.0.1", diff --git a/yarn.lock b/yarn.lock index 8f4e7c66a..a16d4b0b6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1841,26 +1841,7 @@ __metadata: languageName: node linkType: hard -"@rollup/plugin-typescript@npm:^11.1.6": - version: 11.1.6 - resolution: "@rollup/plugin-typescript@npm:11.1.6" - dependencies: - "@rollup/pluginutils": "npm:^5.1.0" - resolve: "npm:^1.22.1" - peerDependencies: - rollup: ^2.14.0||^3.0.0||^4.0.0 - tslib: "*" - typescript: ">=3.7.0" - peerDependenciesMeta: - rollup: - optional: true - tslib: - optional: true - checksum: 10/4ae4d6cfc929393171288df2f18b5eb837fa53d8689118d9661b3064567341f6f6cf8389af55f1d5f015e3682abf30a64ab609fdf75ecb5a84224505e407eb69 - languageName: node - linkType: hard - -"@rollup/plugin-typescript@npm:^12.1.0": +"@rollup/plugin-typescript@npm:^12.1.1": version: 12.1.1 resolution: "@rollup/plugin-typescript@npm:12.1.1" dependencies: @@ -2592,18 +2573,18 @@ __metadata: resolution: "@xmtp/consent-proof-signature@workspace:packages/consent-proof-signature" dependencies: "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^11.1.6" + "@rollup/plugin-typescript": "npm:^12.1.1" "@xmtp/proto": "npm:3.62.1" ethers: "npm:^6.13.1" long: "npm:^5.2.3" - rollup: "npm:^4.18.1" + rollup: "npm:^4.24.0" rollup-plugin-dts: "npm:^6.1.1" rollup-plugin-filesize: "npm:^10.0.0" tsconfig: "workspace:*" typedoc: "npm:^0.26.4" - typescript: "npm:^5.5.3" - vite: "npm:^5.3.3" - vitest: "npm:^2.0.3" + typescript: "npm:^5.6.3" + vite: "npm:^5.4.9" + vitest: "npm:^2.1.3" languageName: unknown linkType: soft @@ -2612,7 +2593,7 @@ __metadata: resolution: "@xmtp/content-type-primitives@workspace:content-types/content-type-primitives" dependencies: "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^12.1.0" + "@rollup/plugin-typescript": "npm:^12.1.1" "@types/node": "npm:^20.16.11" "@xmtp/proto": "npm:^3.61.1" happy-dom: "npm:^15.7.4" @@ -2631,7 +2612,7 @@ __metadata: resolution: "@xmtp/content-type-reaction@workspace:content-types/content-type-reaction" dependencies: "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^12.1.0" + "@rollup/plugin-typescript": "npm:^12.1.1" "@types/node": "npm:^20.16.11" "@xmtp/content-type-primitives": "npm:^1.0.2" "@xmtp/xmtp-js": "npm:^11.6.3" @@ -2653,7 +2634,7 @@ __metadata: resolution: "@xmtp/content-type-read-receipt@workspace:content-types/content-type-read-receipt" dependencies: "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^12.1.0" + "@rollup/plugin-typescript": "npm:^12.1.1" "@types/node": "npm:^20.16.11" "@xmtp/content-type-primitives": "npm:^1.0.2" "@xmtp/xmtp-js": "npm:^11.6.3" @@ -2677,7 +2658,7 @@ __metadata: "@noble/secp256k1": "npm:^1.7.1" "@rollup/plugin-node-resolve": "npm:^15.3.0" "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^12.1.0" + "@rollup/plugin-typescript": "npm:^12.1.1" "@types/node": "npm:^20.16.11" "@xmtp/content-type-primitives": "npm:^1.0.2" "@xmtp/encryption": "workspace:*" @@ -2702,7 +2683,7 @@ __metadata: resolution: "@xmtp/content-type-reply@workspace:content-types/content-type-reply" dependencies: "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^12.1.0" + "@rollup/plugin-typescript": "npm:^12.1.1" "@types/node": "npm:^20.16.11" "@xmtp/content-type-primitives": "npm:^1.0.2" "@xmtp/content-type-remote-attachment": "workspace:*" @@ -2726,7 +2707,7 @@ __metadata: resolution: "@xmtp/content-type-text@workspace:content-types/content-type-text" dependencies: "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^12.1.0" + "@rollup/plugin-typescript": "npm:^12.1.1" "@types/node": "npm:^20.16.11" "@xmtp/content-type-primitives": "npm:^1.0.1" "@xmtp/xmtp-js": "npm:^11.6.3" @@ -2748,7 +2729,7 @@ __metadata: resolution: "@xmtp/content-type-transaction-reference@workspace:content-types/content-type-transaction-reference" dependencies: "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^12.1.0" + "@rollup/plugin-typescript": "npm:^12.1.1" "@types/node": "npm:^20.16.11" "@xmtp/content-type-primitives": "npm:^1.0.1" "@xmtp/xmtp-js": "npm:^11.6.3" @@ -2770,7 +2751,7 @@ __metadata: resolution: "@xmtp/encryption@workspace:shared/encryption" dependencies: "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^12.1.0" + "@rollup/plugin-typescript": "npm:^12.1.1" "@types/node": "npm:^20.16.11" "@vitest/coverage-v8": "npm:^2.1.3" "@xmtp/proto": "npm:^3.68.0" @@ -2796,21 +2777,21 @@ __metadata: "@open-frames/proxy-client": "npm:^0.3.3" "@open-frames/types": "npm:^0.1.1" "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^11.1.6" + "@rollup/plugin-typescript": "npm:^12.1.1" "@xmtp/proto": "npm:3.62.1" "@xmtp/xmtp-js": "npm:^12.0.0" ethers: "npm:^6.13.1" long: "npm:^5.2.3" - rollup: "npm:^4.18.1" + rollup: "npm:^4.24.0" rollup-plugin-dts: "npm:^6.1.1" rollup-plugin-filesize: "npm:^10.0.0" rollup-plugin-tsconfig-paths: "npm:^1.5.2" tsconfig: "workspace:*" typedoc: "npm:^0.26.4" - typescript: "npm:^5.5.3" - vite: "npm:^5.3.3" - vite-tsconfig-paths: "npm:^4.3.2" - vitest: "npm:^2.0.3" + typescript: "npm:^5.6.3" + vite: "npm:^5.4.9" + vite-tsconfig-paths: "npm:^5.0.1" + vitest: "npm:^2.1.3" peerDependencies: "@xmtp/xmtp-js": ">9.3.1" languageName: unknown @@ -2828,7 +2809,7 @@ __metadata: resolution: "@xmtp/node-sdk@workspace:sdks/node-sdk" dependencies: "@rollup/plugin-json": "npm:^6.1.0" - "@rollup/plugin-typescript": "npm:^12.1.0" + "@rollup/plugin-typescript": "npm:^12.1.1" "@types/node": "npm:^20.16.11" "@vitest/coverage-v8": "npm:^2.1.3" "@xmtp/content-type-primitives": "npm:^1.0.1" @@ -2949,7 +2930,7 @@ __metadata: "@rollup/plugin-json": "npm:^6.1.0" "@rollup/plugin-node-resolve": "npm:^15.3.0" "@rollup/plugin-terser": "npm:^0.4.4" - "@rollup/plugin-typescript": "npm:^12.1.0" + "@rollup/plugin-typescript": "npm:^12.1.1" "@types/benchmark": "npm:^2.1.5" "@types/bl": "npm:^5.1.0" "@types/callback-to-async-iterator": "npm:^1.1.7" @@ -6764,7 +6745,7 @@ __metadata: languageName: node linkType: hard -"rollup@npm:^4.18.1, rollup@npm:^4.20.0, rollup@npm:^4.24.0": +"rollup@npm:^4.20.0, rollup@npm:^4.24.0": version: 4.24.0 resolution: "rollup@npm:4.24.0" dependencies: @@ -7599,7 +7580,7 @@ __metadata: languageName: node linkType: hard -"typescript-eslint@npm:^8.9.0": +"typescript-eslint@npm:^8.10.0": version: 8.10.0 resolution: "typescript-eslint@npm:8.10.0" dependencies: @@ -7622,7 +7603,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^5.3.3, typescript@npm:^5.5.3, typescript@npm:^5.6.3": +"typescript@npm:^5.3.3, typescript@npm:^5.6.3": version: 5.6.3 resolution: "typescript@npm:5.6.3" bin: @@ -7632,7 +7613,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A^5.3.3#optional!builtin, typescript@patch:typescript@npm%3A^5.5.3#optional!builtin, typescript@patch:typescript@npm%3A^5.6.3#optional!builtin": +"typescript@patch:typescript@npm%3A^5.3.3#optional!builtin, typescript@patch:typescript@npm%3A^5.6.3#optional!builtin": version: 5.6.3 resolution: "typescript@patch:typescript@npm%3A5.6.3#optional!builtin::version=5.6.3&hash=8c6c40" bin: @@ -7903,22 +7884,6 @@ __metadata: languageName: node linkType: hard -"vite-tsconfig-paths@npm:^4.3.2": - version: 4.3.2 - resolution: "vite-tsconfig-paths@npm:4.3.2" - dependencies: - debug: "npm:^4.1.1" - globrex: "npm:^0.1.2" - tsconfck: "npm:^3.0.3" - peerDependencies: - vite: "*" - peerDependenciesMeta: - vite: - optional: true - checksum: 10/c12e2087fd01ac8a694850c649b79d5b9798cdba0ef9ab4116f669d8ffa1a9a3195c5a14410d3d9a12d2f08cd35ddd74f03d9c7b13a2d590d002055cdaab45c0 - languageName: node - linkType: hard - "vite-tsconfig-paths@npm:^5.0.1": version: 5.0.1 resolution: "vite-tsconfig-paths@npm:5.0.1" @@ -7935,7 +7900,7 @@ __metadata: languageName: node linkType: hard -"vite@npm:^5.0.0, vite@npm:^5.3.3, vite@npm:^5.4.9": +"vite@npm:^5.0.0, vite@npm:^5.4.9": version: 5.4.9 resolution: "vite@npm:5.4.9" dependencies: @@ -7978,7 +7943,7 @@ __metadata: languageName: node linkType: hard -"vitest@npm:^2.0.3, vitest@npm:^2.1.3": +"vitest@npm:^2.1.3": version: 2.1.3 resolution: "vitest@npm:2.1.3" dependencies: @@ -8252,7 +8217,7 @@ __metadata: rimraf: "npm:^6.0.1" turbo: "npm:^2.1.3" typescript: "npm:^5.6.3" - typescript-eslint: "npm:^8.9.0" + typescript-eslint: "npm:^8.10.0" languageName: unknown linkType: soft From 92bc000e1899da24692bb837898631187d826030 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 17 Oct 2024 14:45:25 -0500 Subject: [PATCH 107/107] Update turbo.json for certain tests --- turbo.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/turbo.json b/turbo.json index 7980eaa6b..52268248f 100644 --- a/turbo.json +++ b/turbo.json @@ -30,6 +30,17 @@ "@xmtp/content-type-reply#test": { "dependsOn": ["@xmtp/content-type-remote-attachment#build"], "outputs": [] + }, + "@xmtp/content-type-remote-attachment#test": { + "dependsOn": ["@xmtp/consent-proof-signature#build"], + "outputs": [] + }, + "@xmtp/frames-client#test": { + "dependsOn": [ + "@xmtp/consent-proof-signature#build", + "@xmtp/content-type-text#build" + ], + "outputs": [] } } }