Skip to content

Commit f657657

Browse files
karlpriebdjwhitt
authored andcommitted
feat(farcaster): add initial frame support
ar.io gateways now support (GET and POST) calls to /local/farcaster/frame/<txId>
1 parent be5f3aa commit f657657

File tree

3 files changed

+62
-3
lines changed

3 files changed

+62
-3
lines changed

docs/openapi.yaml

+48-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ tags:
5050
Get data from the AR.IO Gateway index using GQL
5151
- name: Admin
5252
description: |
53-
Access several password protected features and functions specific to your AR.IO Gateway.
53+
Access several password protected features and functions specific to your AR.IO Gateway.
54+
- name: Admin
55+
description: |
56+
Access several password protected features and functions specific to your AR.IO Gateway.
57+
- name: Farcaster Frames
58+
description: |
59+
Retrieve and interact with Farcaster Frames using Arweave transactions.
5460
components:
5561
securitySchemes:
5662
bearerAuth:
@@ -735,8 +741,8 @@ paths:
735741
put:
736742
tags: [Admin]
737743
summary: Blocks transactions or data-items so your AR.IO Gateway will not serve them.
738-
description: |
739-
Submits a TX ID/data-item ID or sha-256 content hash for content you do not want your AR.IO Gateway to serve. Once submitted, your Gateway will not respond to requests for these transactions or data-items.
744+
description: |
745+
Submits a TX ID/data-item ID or sha-256 content hash for content you do not want your AR.IO Gateway to serve. Once submitted, your Gateway will not respond to requests for these transactions or data-items.
740746
741747
742748
WARNING - Testing a TX ID here WILL result in that data being blocked by your Gateway.
@@ -770,3 +776,42 @@ paths:
770776
description: Unauthorized, API key likely incorrect.
771777
security:
772778
- bearerAuth: []
779+
'/local/farcaster/frame/{txId}':
780+
get:
781+
tags: [Farcaster Frames]
782+
summary: Get transaction.
783+
description: Get the content of a specified transaction.
784+
parameters:
785+
- name: txId
786+
in: path
787+
required: true
788+
schema:
789+
type: string
790+
pattern: '^[0-9a-zA-Z_-]{43}$'
791+
responses:
792+
'200':
793+
description: |-
794+
Successful operation.
795+
content:
796+
application/json:
797+
schema:
798+
'$ref': '#/components/schemas/Transaction'
799+
post:
800+
tags: [Farcaster Frames]
801+
summary: Get transaction.
802+
description: Get the content of a specified transaction.
803+
parameters:
804+
- name: txId
805+
in: path
806+
required: true
807+
schema:
808+
type: string
809+
pattern: '^[0-9a-zA-Z_-]{43}$'
810+
responses:
811+
'200':
812+
description: |-
813+
Successful operation.
814+
content:
815+
application/json:
816+
schema:
817+
'$ref': '#/components/schemas/Transaction'

envoy/envoy.template.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ static_resources:
9696
retry_policy:
9797
retry_on: '5xx,reset'
9898
num_retries: 5
99+
- match:
100+
safe_regex:
101+
google_re2: { max_program_size: 200 }
102+
regex: '^\/local\/farcaster\/frame\/[a-zA-Z0-9_-]{43}$'
103+
route:
104+
timeout: 0s
105+
cluster: ario_gateways
106+
retry_policy:
107+
retry_on: '5xx,reset'
108+
num_retries: 5
99109
- match: { prefix: '/' }
100110
response_headers_to_add:
101111
- header:

src/routes/data/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { createDataHandler, createRawDataHandler } from './handlers.js';
2424
const DATA_PATH_REGEX =
2525
/^\/?([a-zA-Z0-9-_]{43})\/?$|^\/?([a-zA-Z0-9-_]{43})\/(.*)$/i;
2626
const RAW_DATA_PATH_REGEX = /^\/raw\/([a-zA-Z0-9-_]{43})\/?$/i;
27+
const FARCASTER_FRAME_DATA_PATH_REGEX =
28+
/^\/local\/farcaster\/frame\/([a-zA-Z0-9-_]{43})\/?$/i;
2729

2830
// Used by ArNS Router
2931
export const dataHandler = createDataHandler({
@@ -45,3 +47,5 @@ dataRouter.get(
4547
blockListValidator: system.blockListValidator,
4648
}),
4749
);
50+
dataRouter.get(FARCASTER_FRAME_DATA_PATH_REGEX, dataHandler);
51+
dataRouter.post(FARCASTER_FRAME_DATA_PATH_REGEX, dataHandler);

0 commit comments

Comments
 (0)