Skip to content

Commit

Permalink
Merge pull request #964 from ethereum-push-notification-service/963-i…
Browse files Browse the repository at this point in the history
…mprovement-proposal-support-for-fuse-network

963 improvement proposal support for fuse network
  • Loading branch information
akp111 authored Jan 15, 2024
2 parents 76710d4 + e3f2760 commit 6d5b15b
Show file tree
Hide file tree
Showing 15 changed files with 206 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ const NETWORK_MAPPING: NwMappingType = {
1442: 'POLYGON_ZK_EVM_TESTNET',
1101: 'POLYGON_ZK_EVM_MAINNET',
421613: "ARBITRUM_TESTNET",
42161: "ARBITRUMONE_MAINNET"
42161: "ARBITRUMONE_MAINNET",
122: "FUSE_MAINNET",
123: "FUSE_TESTNET"
};

const injected = new InjectedConnector({
supportedChainIds: [1, 3, 4, 11155111, 42, 137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161],
supportedChainIds: [1, 3, 4, 11155111, 42, 137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161, 122, 123],
})

const ConnectWrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/sdk-frontend-react/src/app/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Constants = {
},
DEFAULT_CHAIN_ID: 11155111,
DEV_CHAIN_ID: 99999,
NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161],
NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161, 122, 123],
ETH_CHAINS: [1, 11155111]
};

Expand Down
81 changes: 77 additions & 4 deletions packages/restapi/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import {
polygonZkEvm,
polygonZkEvmTestnet,
sepolia,
arbitrum,
arbitrumGoerli,
fuse,
fuseSparknet,
} from 'viem/chains';
const { ENV } = Constants;

Expand Down Expand Up @@ -41,14 +45,17 @@ const BLOCKCHAIN_NETWORK = {
POLYGON_ZK_EVM_MAINNET: 'eip155:1101',
ARBITRUM_TESTNET: 'eip155:421613',
ARBITRUMONE_MAINNET: 'eip155:42161',
FUSE_TESTNET: 'eip155:123',
FUSE_MAINNET: 'eip155:122',
};

export type ALIAS_CHAIN =
| 'POLYGON'
| 'BSC'
| 'OPTIMISM'
| 'POLYGONZKEVM'
| 'ARBITRUMONE';
| 'ARBITRUMONE'
| 'FUSE';

export const ETH_CHAIN_ID = {
[ENV.PROD]: 1,
Expand Down Expand Up @@ -87,6 +94,12 @@ export const ALIAS_CHAIN_ID = {
[ENV.DEV]: 421613,
[ENV.LOCAL]: 421613,
},
FUSE: {
[ENV.PROD]: 122,
[ENV.STAGING]: 123,
[ENV.DEV]: 123,
[ENV.LOCAL]: 123,
},
};

export const CHAIN_ID = {
Expand All @@ -113,6 +126,9 @@ export const CHAIN_NAME: { [key: number]: string } = {
// arbitrun
421613: 'ARBITRUN',
42161: 'ARBITRUM',
// fuse
122: 'FUSE',
123: 'FUSE',
};
export interface ConfigType {
API_BASE_URL: string;
Expand Down Expand Up @@ -187,6 +203,10 @@ const CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
[BLOCKCHAIN_NETWORK.FUSE_MAINNET]: {
API_BASE_URL: API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
},
[ENV.STAGING]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand All @@ -213,6 +233,10 @@ const CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
[BLOCKCHAIN_NETWORK.FUSE_TESTNET]: {
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
},
[ENV.DEV]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand All @@ -236,9 +260,13 @@ const CONFIG = {
EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572',
},
[BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: {
API_BASE_URL: API_BASE_URL[ENV.STAGING],
API_BASE_URL: API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x2f6aE0907116A2c50D712e78b48D874fadeB6850',
},
[BLOCKCHAIN_NETWORK.FUSE_TESTNET]: {
API_BASE_URL: API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x7eBb54D86CF928115965DB596a3E600404dD8039',
},
},
[ENV.LOCAL]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand All @@ -258,13 +286,17 @@ const CONFIG = {
EPNS_COMMUNICATOR_CONTRACT: '0x4305D572F2bf38Fc2AE8D0172055b1EFd18F57a6',
},
[BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: {
API_BASE_URL: API_BASE_URL[ENV.DEV],
API_BASE_URL: API_BASE_URL[ENV.LOCAL],
EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572',
},
[BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: {
API_BASE_URL: API_BASE_URL[ENV.STAGING],
API_BASE_URL: API_BASE_URL[ENV.LOCAL],
EPNS_COMMUNICATOR_CONTRACT: '0x2f6aE0907116A2c50D712e78b48D874fadeB6850',
},
[BLOCKCHAIN_NETWORK.FUSE_TESTNET]: {
API_BASE_URL: API_BASE_URL[ENV.LOCAL],
EPNS_COMMUNICATOR_CONTRACT: '0x7eBb54D86CF928115965DB596a3E600404dD8039',
},
},
};

Expand Down Expand Up @@ -327,6 +359,16 @@ export const VIEM_CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
[BLOCKCHAIN_NETWORK.ARBITRUMONE_MAINNET]: {
NETWORK: arbitrum,
API_BASE_URL: API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
[BLOCKCHAIN_NETWORK.FUSE_MAINNET]: {
NETWORK: fuse,
API_BASE_URL: API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
},
[ENV.STAGING]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand Down Expand Up @@ -354,6 +396,16 @@ export const VIEM_CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
[BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: {
NETWORK: arbitrumGoerli,
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
[BLOCKCHAIN_NETWORK.FUSE_TESTNET]: {
NETWORK: fuseSparknet,
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
},
[ENV.DEV]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand Down Expand Up @@ -381,6 +433,16 @@ export const VIEM_CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572',
},
[BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: {
NETWORK: arbitrumGoerli,
API_BASE_URL: API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x2f6aE0907116A2c50D712e78b48D874fadeB6850',
},
[BLOCKCHAIN_NETWORK.FUSE_TESTNET]: {
NETWORK: fuseSparknet,
API_BASE_URL: API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x7eBb54D86CF928115965DB596a3E600404dD8039',
},
},
[ENV.LOCAL]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand Down Expand Up @@ -408,9 +470,20 @@ export const VIEM_CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572',
},
[BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: {
NETWORK: arbitrumGoerli,
API_BASE_URL: API_BASE_URL[ENV.LOCAL],
EPNS_COMMUNICATOR_CONTRACT: '0x2f6aE0907116A2c50D712e78b48D874fadeB6850',
},
[BLOCKCHAIN_NETWORK.FUSE_TESTNET]: {
NETWORK: fuseSparknet,
API_BASE_URL: API_BASE_URL[ENV.LOCAL],
EPNS_COMMUNICATOR_CONTRACT: '0x7eBb54D86CF928115965DB596a3E600404dD8039',
},
},
};


export const ALPHA_FEATURE_CONFIG = {
STABLE: {
feature: [] as string[],
Expand Down
2 changes: 1 addition & 1 deletion packages/restapi/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const Constants = {
},
DEFAULT_CHAIN_ID: 11155111,
DEV_CHAIN_ID: 99999,
NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161],
NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161, 122, 123],
ETH_CHAINS: [1, 11155111],
ENC_TYPE_V1: 'x25519-xsalsa20-poly1305',
ENC_TYPE_V2: 'aes256GcmHkdfSha256',
Expand Down
6 changes: 5 additions & 1 deletion packages/restapi/src/lib/payloads/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export const CHAIN_ID_TO_SOURCE: ChainIdToSourceType = {
1442: 'POLYGON_ZK_EVM_TESTNET',
1101: 'POLYGON_ZK_EVM_MAINNET',
421613: "ARBITRUM_TESTNET",
42161: "ARBITRUMONE_MAINNET"
42161: "ARBITRUMONE_MAINNET",
122: "FUSE_MAINNET",
123: "FUSE_TESTNET"
};

export const SOURCE_TYPES = {
Expand All @@ -30,6 +32,8 @@ export const SOURCE_TYPES = {
POLYGON_ZK_EVM_MAINNET: 'POLYGON_ZK_EVM_MAINNET',
ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
ARBITRUMONE_MAINNET: "ARBITRUMONE_MAINNET",
FUSE_TESTNET:"FUSE_TESTNET",
FUSE_MAINNET:"FUSE_MAINNET",
THE_GRAPH: 'THE_GRAPH',
PUSH_VIDEO: 'PUSH_VIDEO',
SIMULATE: 'SIMULATE'
Expand Down
4 changes: 1 addition & 3 deletions packages/restapi/src/lib/payloads/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,7 @@ export function getSource(
export function getCAIPFormat(chainId: number, address: string) {
// EVM based chains
if (
[
1, 11155111, 42, 137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161,
].includes(chainId)
[1, 11155111, 42, 137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161, 122, 123].includes(chainId)
) {
return `eip155:${chainId}:${address}`;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/uiweb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ where
| cta | string | Call To Action Link (given during notification creation) |
| image | string | Any media link (given during notification creation) |
| url | string | Channel Link (given during channel setup) |
| chainName | string | Can be anyone of the following blockchain networks on which the notification was sent - "ETH_MAINNET", "ETH_TEST_SEPOLIA", "POLYGON_MAINNET", "POLYGON_TEST_MUMBAI", "BSC_MAINNET, "BSC_TESTNET", "OPTIMISM_MAINNET", "OPTIMISM_TESTNET", "POLYGON_ZK_EVM_TESTNET", "POLYGON_ZK_EVM_MAINNET", "ARBITRUM_TESTNET", "ARBITRUMONE_MAINNET", "THE_GRAPH" |
| chainName | string | Can be anyone of the following blockchain networks on which the notification was sent - "ETH_MAINNET", "ETH_TEST_SEPOLIA", "POLYGON_MAINNET", "POLYGON_TEST_MUMBAI", "BSC_MAINNET, "BSC_TESTNET", "OPTIMISM_MAINNET", "OPTIMISM_TESTNET", "POLYGON_ZK_EVM_TESTNET", "POLYGON_ZK_EVM_MAINNET", "ARBITRUM_TESTNET", "ARBITRUMONE_MAINNET", "FUSE_TESTNET", "FUSE_MAINNET", "THE_GRAPH" |
| theme | string | 'light' or 'dark' (customization to be given by the dApp) |
| customTheme | INotificationItemTheme | custom theme object for the component |
| isSpam | boolean | whether a spam notification or not |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Checkbox } from '../reusables/Checkbox';
import OptionButtons from '../reusables/OptionButtons';

import EthereumSvg from '../../../icons/ethereum.svg';
import FuseSVG from '../../../icons/fuse.svg';
import PolygonSvg from '../../../icons/polygon.svg';
import ArbitrumSvg from '../../../icons/arbitrum.svg';
import BSCSvg from '../../../icons/bsc.svg';
Expand Down Expand Up @@ -240,6 +241,13 @@ const AddCriteria = ({
icon: ArbitrumSvg,
function: () => setSelectedChainValue(4),
},
{
id: 5,
value: BLOCKCHAIN_NETWORK[env].FUSE,
title: 'Fuse',
icon: FuseSVG,
function: () => setSelectedChainValue(5),
},
];

const onQuantityChange = (e: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { BSCSvg } from "../../../icons/BSCSvg";
import { OptimismSvg } from "../../../icons/OptimismSvg";
import { PolygonzkevmSvg } from "../../../icons/PolygonzkevmSvg";
import { ArbitrumSvg } from "../../../icons/ArbitrumSvg"
import { FuseSvg } from "../../../icons/FuseSvg"
import React from "react";

const createSVGIcon = (element:any, chainName: string) => {
Expand Down Expand Up @@ -67,4 +68,12 @@ export const NETWORK_ICON_DETAILS = {
label: 'ARBITRUM TESTNET',
icon: createSVGIcon(<ArbitrumSvg/>, 'Arbitrum Testnet'),
},
123 : {
label: 'FUSE TESTNET',
icon: createSVGIcon(<FuseSvg/>, 'Fuse Testnet'),
},
122 : {
label: 'FUSE MAINNET',
icon: createSVGIcon(<FuseSvg/>, 'Fuse Mainnet'),
}
};
Loading

0 comments on commit 6d5b15b

Please sign in to comment.