From 91cc98acfeb5ca52bfcbfb63e76213326b4b60f1 Mon Sep 17 00:00:00 2001 From: alberto-crossmint Date: Thu, 13 Feb 2025 23:04:44 +0100 Subject: [PATCH] Story: add mainnet --- .../smart-wallet/src/blockchain/chains.ts | 21 +++++++++++-------- .../smart-wallet/src/blockchain/rpc.ts | 3 ++- .../wallets/definitions/story-testnet.ts | 21 +++++++++++++++++++ .../blockchain/wallets/definitions/story.ts | 15 +++++++++++++ .../common/base/src/blockchain/types/evm.ts | 1 + .../blockchain/utils/blockchainToCopyName.ts | 1 + .../utils/evm/blockchainToChainId.ts | 3 ++- 7 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 packages/client/wallets/smart-wallet/src/blockchain/wallets/definitions/story-testnet.ts create mode 100644 packages/client/wallets/smart-wallet/src/blockchain/wallets/definitions/story.ts diff --git a/packages/client/wallets/smart-wallet/src/blockchain/chains.ts b/packages/client/wallets/smart-wallet/src/blockchain/chains.ts index 159a3d41b..bcaa17bd1 100644 --- a/packages/client/wallets/smart-wallet/src/blockchain/chains.ts +++ b/packages/client/wallets/smart-wallet/src/blockchain/chains.ts @@ -12,22 +12,23 @@ import { import { BlockchainIncludingTestnet as Blockchain, type ObjectValues, objectValues } from "@crossmint/common-sdk-base"; import { defineChain } from "viem"; +import { story } from "./wallets/definitions/story"; -const storyOdyssey = defineChain({ - id: 1516, - name: "Story Odyssey", +const storyTestnet = defineChain({ + id: 1513, + name: 'Story Testnet', nativeCurrency: { decimals: 18, - name: "IP", - symbol: "IP", + name: 'IP', + symbol: 'IP', }, rpcUrls: { - default: { http: ["https://rpc.odyssey.storyrpc.io"] }, + default: { http: ['https://testnet.storyrpc.io'] }, }, blockExplorers: { default: { - name: "Story Odyssey Explorer", - url: "https://odyssey.storyscan.xyz", + name: 'Story Testnet Explorer', + url: 'https://testnet.storyscan.xyz', }, }, testnet: true, @@ -48,6 +49,7 @@ export const SmartWalletMainnet = { POLYGON: Blockchain.POLYGON, OPTIMISM: Blockchain.OPTIMISM, ARBITRUM: Blockchain.ARBITRUM, + STORY: Blockchain.STORY, } as const; export type SmartWalletMainnet = ObjectValues; export const SMART_WALLET_MAINNETS = objectValues(SmartWalletMainnet); @@ -76,5 +78,6 @@ export const viemNetworks: Record = { "optimism-sepolia": optimismSepolia, arbitrum: arbitrum, "arbitrum-sepolia": arbitrumSepolia, - "story-testnet": storyOdyssey, + "story-testnet": storyTestnet, + story: story, }; diff --git a/packages/client/wallets/smart-wallet/src/blockchain/rpc.ts b/packages/client/wallets/smart-wallet/src/blockchain/rpc.ts index 7d936a87f..ee1129504 100644 --- a/packages/client/wallets/smart-wallet/src/blockchain/rpc.ts +++ b/packages/client/wallets/smart-wallet/src/blockchain/rpc.ts @@ -21,7 +21,8 @@ function getAlchemyRPC(chain: SmartWalletChain): string { } export function getRPC(chain: SmartWalletChain): string { - if (chain === "story-testnet") { + if (chain === "story-testnet" || chain === "story") { + // Story is not supported by Alchemy yet return viemNetworks[chain].rpcUrls.default.http[0]; } return getAlchemyRPC(chain); diff --git a/packages/client/wallets/smart-wallet/src/blockchain/wallets/definitions/story-testnet.ts b/packages/client/wallets/smart-wallet/src/blockchain/wallets/definitions/story-testnet.ts new file mode 100644 index 000000000..b814e88a9 --- /dev/null +++ b/packages/client/wallets/smart-wallet/src/blockchain/wallets/definitions/story-testnet.ts @@ -0,0 +1,21 @@ +import { defineChain } from "viem"; + +export const storyTestnet = defineChain({ + id: 1513, + name: 'Story Testnet', + nativeCurrency: { + decimals: 18, + name: 'IP', + symbol: 'IP', + }, + rpcUrls: { + default: { http: ['https://testnet.storyrpc.io'] }, + }, + blockExplorers: { + default: { + name: 'Story Testnet Explorer', + url: 'https://testnet.storyscan.xyz', + }, + }, + testnet: true, +}); \ No newline at end of file diff --git a/packages/client/wallets/smart-wallet/src/blockchain/wallets/definitions/story.ts b/packages/client/wallets/smart-wallet/src/blockchain/wallets/definitions/story.ts new file mode 100644 index 000000000..1e76f1446 --- /dev/null +++ b/packages/client/wallets/smart-wallet/src/blockchain/wallets/definitions/story.ts @@ -0,0 +1,15 @@ +import { defineChain } from "viem"; + +export const story = defineChain({ + id: 1514, + name: 'Story', + nativeCurrency: { + decimals: 18, + name: 'IP Token', + symbol: 'IP', + }, + rpcUrls: { + default: { http: ['https://mainnet.storyrpc.io'] }, + }, + testnet: false, +}) \ No newline at end of file diff --git a/packages/common/base/src/blockchain/types/evm.ts b/packages/common/base/src/blockchain/types/evm.ts index 9b2bb61c0..e15bd4a9c 100644 --- a/packages/common/base/src/blockchain/types/evm.ts +++ b/packages/common/base/src/blockchain/types/evm.ts @@ -14,6 +14,7 @@ export const EVMBlockchain = { ASTAR_ZKEVM: "astar-zkevm", APEX: "apex", CHILIZ: "chiliz", + STORY: "story" } as const; export type EVMBlockchain = ObjectValues; export const EVM_CHAINS = objectValues(EVMBlockchain); diff --git a/packages/common/base/src/blockchain/utils/blockchainToCopyName.ts b/packages/common/base/src/blockchain/utils/blockchainToCopyName.ts index 60af63a8f..672cca1e3 100644 --- a/packages/common/base/src/blockchain/utils/blockchainToCopyName.ts +++ b/packages/common/base/src/blockchain/utils/blockchainToCopyName.ts @@ -31,6 +31,7 @@ export const BLOCKCHAIN_TO_COPY_NAME: Record apex: "Apex", "hypersonic-testnet": "Hypersonic Testnet", "story-testnet": "Story Testnet", + story: "Story Mainnet", chiliz: "Chiliz", }; diff --git a/packages/common/base/src/blockchain/utils/evm/blockchainToChainId.ts b/packages/common/base/src/blockchain/utils/evm/blockchainToChainId.ts index dfa5ddca3..742ea599d 100644 --- a/packages/common/base/src/blockchain/utils/evm/blockchainToChainId.ts +++ b/packages/common/base/src/blockchain/utils/evm/blockchainToChainId.ts @@ -26,7 +26,8 @@ export const BLOCKCHAIN_TO_CHAIN_ID: Record