diff --git a/.changeset/curvy-countries-exercise.md b/.changeset/curvy-countries-exercise.md new file mode 100644 index 00000000..47e037b3 --- /dev/null +++ b/.changeset/curvy-countries-exercise.md @@ -0,0 +1,5 @@ +--- +"@treasure-dev/tdk-core": patch +--- + +Added Treasure chain configuration diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index 93594343..dd3cc53d 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -4,7 +4,10 @@ import { PrismaClient } from "@prisma/client"; import * as Sentry from "@sentry/node"; import { Engine } from "@thirdweb-dev/engine"; import { createAuth } from "@treasure-dev/auth"; -import { TREASURE_TOPAZ_CHAIN_DEFINITION } from "@treasure-dev/tdk-core"; +import { + TREASURE_CHAIN_DEFINITION, + TREASURE_TOPAZ_CHAIN_DEFINITION, +} from "@treasure-dev/tdk-core"; import { http, createConfig, fallback } from "@wagmi/core"; import { arbitrum, @@ -63,6 +66,7 @@ const main = async () => { arbitrumSepolia, mainnet, sepolia, + defineChain(TREASURE_CHAIN_DEFINITION), defineChain(TREASURE_TOPAZ_CHAIN_DEFINITION), ], transports: { @@ -90,6 +94,12 @@ const main = async () => { ), http(), ]), + [TREASURE_CHAIN_DEFINITION.id]: fallback([ + http( + `https://${TREASURE_CHAIN_DEFINITION.id}.rpc.thirdweb.com/${env.THIRDWEB_CLIENT_ID}`, + ), + http(), + ]), [TREASURE_TOPAZ_CHAIN_DEFINITION.id]: fallback([ http( `https://${TREASURE_TOPAZ_CHAIN_DEFINITION.id}.rpc.thirdweb.com/${env.THIRDWEB_CLIENT_ID}`, diff --git a/apps/api/src/routes/transactions.ts b/apps/api/src/routes/transactions.ts index e9c60860..f40cc32a 100644 --- a/apps/api/src/routes/transactions.ts +++ b/apps/api/src/routes/transactions.ts @@ -1,8 +1,5 @@ import * as Sentry from "@sentry/node"; -import { - ACCOUNT_FACTORY_ADDRESS, - getContractAddress, -} from "@treasure-dev/tdk-core"; +import { ACCOUNT_FACTORY_ADDRESS } from "@treasure-dev/tdk-core"; import type { FastifyPluginAsync } from "fastify"; import "../middleware/auth"; diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 8f67b779..42c3a2ce 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -16,7 +16,7 @@ export const DEFAULT_TDK_DARKMATTER_BASE_URI = // Chains export const TREASURE_TOPAZ_CHAIN_DEFINITION = { - id: 978_658, + id: 978658, name: "Treasure Topaz", nativeCurrency: { name: "MAGIC", @@ -30,15 +30,38 @@ export const TREASURE_TOPAZ_CHAIN_DEFINITION = { }, blockExplorers: { default: { - name: "Treasurescan", + name: "Treasure Topaz Explorer", url: "https://topaz.treasurescan.io", - apiUrl: "https://block-explorer.topaz.treasurescan.io/api", + apiUrl: "https://topaz.treasurescan.io/node-api/proxy/api/v2", }, }, testnet: true, }; export const treasureTopaz = defineChain(TREASURE_TOPAZ_CHAIN_DEFINITION); +export const TREASURE_CHAIN_DEFINITION = { + id: 61166, + name: "Treasure", + nativeCurrency: { + name: "MAGIC", + symbol: "MAGIC", + decimals: 18, + }, + rpcUrls: { + default: { + http: ["https://rpc.treasure.lol"], + }, + }, + blockExplorers: { + default: { + name: "Treasure Explorer", + url: "https://treasurescan.io", + apiUrl: "https://treasurescan.io/api/v2", + }, + }, +}; +export const treasure = defineChain(TREASURE_CHAIN_DEFINITION); + // APIs export const BRIDGEWORLD_API_URL = { [arbitrum.id]: diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 2169dc9e..3391aff4 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -11,7 +11,9 @@ export { DEFAULT_TDK_ECOSYSTEM_ID, TOKEN_IDS, TREASURE_CONDUIT_KEYS, + TREASURE_CHAIN_DEFINITION, TREASURE_TOPAZ_CHAIN_DEFINITION, + treasure, treasureTopaz, } from "./constants"; export { erc20Abi } from "./abis/erc20Abi";