diff --git a/chainhooks/stackswap/stackswap-swap-v5k.swap-x-for-y.json b/chainhooks/stackswap/stackswap-swap-v5k.swap-x-for-y.json new file mode 100644 index 0000000..229496c --- /dev/null +++ b/chainhooks/stackswap/stackswap-swap-v5k.swap-x-for-y.json @@ -0,0 +1,23 @@ +{ + "chain": "stacks", + "uuid": "1", + "name": "stackswap-swap-v5k.swap-x-for-y", + "version": 1, + "networks": { + "mainnet": { + "if_this": { + "scope": "contract_call", + "contract_identifier": "SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.stackswap-swap-v5k", + "method": "swap-x-for-y" + }, + "then_that": { + "http_post": { + "url": "http://localhost:3000/api/chainhooks/swap", + "authorization_header": "Bearer dev-api-token" + } + }, + "start_block": 37537, + "decode_clarity_values": false + } + } +} diff --git a/chainhooks/stackswap/stackswap-swap-v5k.swap-y-for-x.json b/chainhooks/stackswap/stackswap-swap-v5k.swap-y-for-x.json new file mode 100644 index 0000000..4c2c047 --- /dev/null +++ b/chainhooks/stackswap/stackswap-swap-v5k.swap-y-for-x.json @@ -0,0 +1,23 @@ +{ + "chain": "stacks", + "uuid": "1", + "name": "stackswap-swap-v5k.swap-y-for-x", + "version": 1, + "networks": { + "mainnet": { + "if_this": { + "scope": "contract_call", + "contract_identifier": "SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.stackswap-swap-v5k", + "method": "swap-y-for-x" + }, + "then_that": { + "http_post": { + "url": "http://localhost:3000/api/chainhooks/swap", + "authorization_header": "Bearer dev-api-token" + } + }, + "start_block": 37537, + "decode_clarity_values": false + } + } +} diff --git a/public/protocols/stackswap.png b/public/protocols/stackswap.png new file mode 100644 index 0000000..cc124a9 Binary files /dev/null and b/public/protocols/stackswap.png differ diff --git a/src/app/api/chainhooks/swap/route.ts b/src/app/api/chainhooks/swap/route.ts index 4aa740c..2ca9217 100644 --- a/src/app/api/chainhooks/swap/route.ts +++ b/src/app/api/chainhooks/swap/route.ts @@ -47,6 +47,11 @@ export async function POST(request: Request) { "SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-swap-v2-1" ) { protocol = "arkadiko"; + } else if ( + transactionToProcess.metadata.kind.data.contract_identifier === + "SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.stackswap-swap-v5k" + ) { + protocol = "stackswap"; } else { throw new Error("Unknown protocol"); } diff --git a/src/components/Stats/UniqueUsersBarChart/UniqueUsersBarChartClient.tsx b/src/components/Stats/UniqueUsersBarChart/UniqueUsersBarChartClient.tsx index ff12727..0b83934 100644 --- a/src/components/Stats/UniqueUsersBarChart/UniqueUsersBarChartClient.tsx +++ b/src/components/Stats/UniqueUsersBarChart/UniqueUsersBarChartClient.tsx @@ -1,4 +1,5 @@ "use client"; +import type { Protocol } from "@/lib/protocols"; import { Card, Separator, Text } from "@radix-ui/themes"; import { Bar, @@ -12,7 +13,7 @@ import { interface UniqueUsersBarChartProps { data: { - protocol: "alex" | "arkadiko"; + protocol: Protocol; month: string; uniqueSenders: number; }[]; @@ -26,6 +27,7 @@ export const UniqueUsersBarChartClient = ({ date: string; arkadiko: number; alex: number; + stackswap: number; }[] = []; for (const item of data) { @@ -41,6 +43,7 @@ export const UniqueUsersBarChartClient = ({ date: month, arkadiko: protocol === "arkadiko" ? uniqueSenders : 0, alex: protocol === "alex" ? uniqueSenders : 0, + stackswap: protocol === "stackswap" ? uniqueSenders : 0, }); } } @@ -109,6 +112,7 @@ export const UniqueUsersBarChartClient = ({ )} /> + diff --git a/src/lib/actions.ts b/src/lib/actions.ts index 74357ad..c52008b 100644 --- a/src/lib/actions.ts +++ b/src/lib/actions.ts @@ -51,4 +51,5 @@ export const protocolsActions: { } = { alex: ["swap"], arkadiko: ["swap", "add-liquidity", "remove-liquidity"], + stackswap: ["swap"], } as const; diff --git a/src/lib/protocols.ts b/src/lib/protocols.ts index f81706f..bc508a7 100644 --- a/src/lib/protocols.ts +++ b/src/lib/protocols.ts @@ -1,4 +1,4 @@ -export const protocols = ["alex", "arkadiko"] as const; +export const protocols = ["alex", "arkadiko", "stackswap"] as const; export type Protocol = (typeof protocols)[number]; @@ -20,4 +20,11 @@ export const protocolsInfo = { website: "https://arkadiko.finance/", x: "https://twitter.com/ArkadikoFinance", }, + stackswap: { + name: "StackSwap", + description: + "Stackswap is a combination of DEX and token launchpad on Stacks blockchain.", + website: "https://app.stackswap.org/", + x: "https://twitter.com/Stackswap_BTC", + }, } as const;