-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
145 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@coinbase/onchainkit': patch | ||
--- | ||
|
||
- **feat**: Added `getXmtpFrameMessage` and `isXmtpFrameRequest` so that Frames can receive interactions from apps outside of Farcaster, such as from XMTP conversations. By @neekolas #123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: Introduction to XMTP Kit · OnchainKit | ||
deescription: Introduction to XMTP Kit | ||
--- | ||
|
||
# Introduction to XMTP Kit | ||
|
||
XMTP Kit is designed to be modular and flexible, allowing developers to use only the parts of the protocol that they need. | ||
|
||
To assist you in engaging with XMTP, here is the XMTP Kit which includes: | ||
|
||
- [XMTP Kit](/xmtpkit/introduction) | ||
- Utilities: | ||
- [`getXmtpFrameMessage`](/xmtpkit/get-xmtp-frame-message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# isXmtpFrameRequest | ||
|
||
isXmtpFrameRequest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// 🌲☀️🌲 | ||
export { getEASAttestations } from './getEASAttestations'; | ||
export { getFrameHtmlResponse } from './getFrameHtmlResponse'; | ||
export { getFrameMetadata } from './getFrameMetadata'; | ||
export { getFrameMessage } from './getFrameMessage'; | ||
export { getMockFrameRequest } from './getMockFrameRequest'; | ||
export type { | ||
FrameButtonMetadata, | ||
FrameImageMetadata, | ||
FrameInputMetadata, | ||
FrameMetadataReact, | ||
FrameMetadataType, | ||
FrameRequest, | ||
FrameValidationData, | ||
MockFrameRequest, | ||
MockFrameRequestOptions, | ||
} from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { getXmtpFrameMessage, isXmtpFrameRequest } from './validation'; | ||
export { getXmtpFrameMessage } from './getXmtpFrameMessage'; | ||
export { isXmtpFrameRequest } from './isXmtpFrameRequest'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { isXmtpFrameRequest } from './isXmtpFrameRequest'; | ||
|
||
describe('isXmtpFrameRequest', () => { | ||
it('should return true for requests with the correct client protocol', () => { | ||
expect( | ||
isXmtpFrameRequest({ | ||
clientProtocol: 'xmtp@2024-02-09', | ||
untrustedData: {}, | ||
trustedData: {}, | ||
}), | ||
).toBe(true); | ||
}); | ||
|
||
it('should return false for farcaster requests', () => { | ||
expect( | ||
isXmtpFrameRequest({ | ||
untrustedData: {}, | ||
trustedData: {}, | ||
}), | ||
).toBe(false); | ||
}); | ||
|
||
it('should return false for other client protocols', () => { | ||
expect( | ||
isXmtpFrameRequest({ | ||
clientProtocol: 'lens@v1', | ||
untrustedData: {}, | ||
trustedData: {}, | ||
}), | ||
); | ||
}); | ||
|
||
it('should return false for malformed requests', () => { | ||
expect( | ||
isXmtpFrameRequest({ | ||
clientProtocol: 'xmtp@2024-02-09', | ||
}), | ||
).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { XmtpOpenFramesRequest } from '@xmtp/frames-validator'; | ||
|
||
export function isXmtpFrameRequest(payload: any): payload is XmtpOpenFramesRequest { | ||
return ( | ||
!!payload && | ||
!!payload.untrustedData && | ||
!!payload.trustedData && | ||
!!payload.clientProtocol?.startsWith('xmtp@') | ||
); | ||
} |