Skip to content

Commit

Permalink
add treasure chain definition (#178)
Browse files Browse the repository at this point in the history
* add treasure chain definition

* add changeset

* fix typecheck
  • Loading branch information
alecananian authored Nov 22, 2024
1 parent 5591996 commit d133cb5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-countries-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@treasure-dev/tdk-core": patch
---

Added Treasure chain configuration
12 changes: 11 additions & 1 deletion apps/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -63,6 +66,7 @@ const main = async () => {
arbitrumSepolia,
mainnet,
sepolia,
defineChain(TREASURE_CHAIN_DEFINITION),
defineChain(TREASURE_TOPAZ_CHAIN_DEFINITION),
],
transports: {
Expand Down Expand Up @@ -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}`,
Expand Down
5 changes: 1 addition & 4 deletions apps/api/src/routes/transactions.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
29 changes: 26 additions & 3 deletions packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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]:
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit d133cb5

Please sign in to comment.