Skip to content

Commit

Permalink
Add State field to be in line with OF spec
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Feb 29, 2024
1 parent f93721d commit cab6fb3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-knives-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@xmtp/frames-client": patch
---

Add support for the state field
2 changes: 1 addition & 1 deletion packages/frames-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 1 addition & 0 deletions packages/frames-client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class FramesClient {
timestamp,
inputText: inputText || "",
unixTimestamp: now,
state: inputs.state || "",
};

const signedAction = await this.buildSignedFrameAction(toSign);
Expand Down
2 changes: 2 additions & 0 deletions packages/frames-client/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe("signFrameAction", () => {
buttonIndex,
conversationTopic: "foo",
participantAccountAddresses: ["amal", "bola"],
state: "state",
});

expect(signedPayload.untrustedData.walletAddress).toEqual(client.address);
Expand All @@ -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 ||
Expand Down
1 change: 1 addition & 0 deletions packages/frames-client/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type FrameActionInputs = {
frameUrl: string;
buttonIndex: number;
inputText?: string;
state?: string;
} & ConversationActionInputs;

type KeyType = {
Expand Down
16 changes: 14 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4230,7 +4230,7 @@ __metadata:
"@open-frames/types": "npm:^0.0.6"
"@rollup/plugin-terser": "npm:^0.4.4"
"@rollup/plugin-typescript": "npm:^11.1.6"
"@xmtp/proto": "npm:3.44.0"
"@xmtp/proto": "npm:3.45.0"
"@xmtp/tsconfig": "workspace:*"
"@xmtp/xmtp-js": "npm:^11.4.1"
eslint: "npm:^8.57.0"
Expand Down Expand Up @@ -4265,7 +4265,19 @@ __metadata:
languageName: node
linkType: hard

"@xmtp/proto@npm:3.44.0, @xmtp/proto@npm:^3.29.0":
"@xmtp/proto@npm:3.45.0":
version: 3.45.0
resolution: "@xmtp/proto@npm:3.45.0"
dependencies:
long: "npm:^5.2.0"
protobufjs: "npm:^7.0.0"
rxjs: "npm:^7.8.0"
undici: "npm:^5.8.1"
checksum: 10/8f9cb9de2265db8c329edbb6e17af117fd7a2ad6a688b3a353e103ce609d57f2df682aae481e6a4aa9df07fe7135cac8ba6e5a91f69a7d7a9f4946b2083e3a02
languageName: node
linkType: hard

"@xmtp/proto@npm:^3.29.0":
version: 3.44.0
resolution: "@xmtp/proto@npm:3.44.0"
dependencies:
Expand Down

0 comments on commit cab6fb3

Please sign in to comment.