// contentScript.ts
import { setupTwitterObserver } from "@dialectlabs/blinks/ext/twitter";
import { ActionConfig, ActionContext } from "@dialectlabs/blinks";
// your RPC_URL is used to create a connection to confirm the transaction after action execution
setupTwitterObserver(new ActionConfig(RPC_URL, {
signTransaction: async (tx: string, context: ActionContext) => { ... },
signMessage(data: string | SignMessageData, context: ActionContext) { ... },
connect: async (context: ActionContext) => { ... }
}))
// or
import { type ActionAdapter } from "@dialectlabs/blinks";
class MyActionAdapter implements ActionAdapter {
get metadata() { ... }
async signTransaction(tx: string, context: ActionContext) { ... }
async connect(context: ActionContext) { ... }
async confirmTransaction(sig: string, context: ActionContext) { ... }
async signMessage(data: string | SignMessageData, context: ActionContext) { ... }
}
setupTwitterObserver(new MyActionAdapter());